2007-11-27 17:03:08

by Jan Kara

[permalink] [raw]
Subject: [PATCH] Fix bug in ext2fs_unlink

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 <[email protected]>
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 <[email protected]>

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 */


2007-12-01 17:36:03

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] Fix bug in ext2fs_unlink

On Tue, Nov 27, 2007 at 06:03:06PM +0100, Jan Kara wrote:
> 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.

Thanks, applied.

- Ted