From a2fbf0694ccdd1fcce6fe2b87db2464e070b272f Mon Sep 17 00:00:00 2001 From: msalve Date: Fri, 17 May 2013 19:03:04 +0530 Subject: [PATCH] LU-2462 e2fsprogs Consider DIRENT_LUFID flag in link_proc(). While adding the new file entry in directory block, link_proc() calculates minimum record length of the existing directory entry without considering the dirent data size and which leads to corruption. Changed the code to use EXT2_DIR_REC_LEN() which will return correct record length including dirent data size. Signed-off-by: Manisha Salve Change-Id: Ic593c558c47a78183143ec8e99d8385ac94d06f7 --- lib/ext2fs/link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c index 6ba6451..cc6e7c8 100644 --- a/lib/ext2fs/link.c +++ b/lib/ext2fs/link.c @@ -69,7 +69,7 @@ static int link_proc(struct ext2_dir_entry *dirent, * truncate it and return. */ if (dirent->inode) { - min_rec_len = __EXT2_DIR_REC_LEN(dirent->name_len & 0xFF); + min_rec_len = EXT2_DIR_REC_LEN((struct ext2_dir_entry_2 *)dirent); if (curr_rec_len < (min_rec_len + rec_len)) return ret; rec_len = curr_rec_len - min_rec_len; -- 1.8.3.1