From ce025a34eab5521586a6853669019d8002dbe8d0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:06:29 +0000 Subject: [PATCH] Add sanity check to ntfs_inode_close() to detect attempts at closing extent inodes. (Logical change 1.43) --- libntfs/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index ceb3e22b..f40ae1ea 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -194,9 +194,17 @@ err_out: * and call ntfs_inode_close() again. The following error codes are defined: * * EBUSY @ni is dirty and/or the attribute list runlist is dirty. + * EINVAL @ni is invalid (probably it is an extent inode!) */ int ntfs_inode_close(ntfs_inode *ni) { + /* If the inode is an extent inode, comply rudely! */ + if (ni->nr_extents == -1) { + Dprintf("%s(): BUG: Tried to close extent inode!\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } // TODO: This needs to be replaced with a flush to disk attempt. (AIA) if (NInoDirty(ni) || NInoAttrListDirty(ni)) { errno = EBUSY;