[PATCH] Fix bug in ext2fs_unlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Hi,

  the patch below fixes a bug in ext2fs_unlink() I came across when testing
my changes to e2fsprogs for 64KB blocksize support... Please apply.

									Honza
-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR

----
Subject: Fix a bug in deletion of first directory entry in a second (or further) directory block

We cannot merge a removed directory entry to just arbitrary previous directory
entry. The previous entry must be in the same block. We check whether the current
entry is not the first one in the block and only if it isn't merge it to the
previous entry. 

Signed-off-by: Jan Kara <jack@xxxxxxx>

diff --git a/lib/ext2fs/unlink.c b/lib/ext2fs/unlink.c
index eb6527e..d459bbd 100644
--- a/lib/ext2fs/unlink.c
+++ b/lib/ext2fs/unlink.c
@@ -31,7 +31,7 @@ struct link_struct  {
  #pragma argsused
 #endif
 static int unlink_proc(struct ext2_dir_entry *dirent,
-		     int	offset EXT2FS_ATTR((unused)),
+		     int	offset,
 		     int	blocksize EXT2FS_ATTR((unused)),
 		     char	*buf EXT2FS_ATTR((unused)),
 		     void	*priv_data)
@@ -56,7 +56,7 @@ static int unlink_proc(struct ext2_dir_e
 			return 0;
 	}
 
-	if (prev)
+	if (offset)
 		/* We actually would not need to convert initial values as
 		 * they are certainly less than 64K but let's not try to be
 		 * too clever */
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux