[1/7] libext2fs: rec_len is set incorrect in ext2fs_process_dir_inline_data

Submitted by Zheng Liu on Nov. 15, 2012, 8:13 a.m.

Details

Message ID 1352967209-29616-2-git-send-email-wenqing.lz@taobao.com
State Accepted, archived
Headers show

Commit Message

Zheng Liu Nov. 15, 2012, 8:13 a.m.
From: Zheng Liu <wenqing.lz@taobao.com>

A new dir doesn't be created in the parent dir with inline data due to this
bug because rec_len is set incorrect.  It will cause a wrong offset, and no
free room can be found.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 lib/ext2fs/dir_iterate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 3f94ad4..198c5aa 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -335,7 +335,8 @@  int ext2fs_process_dir_inline_data(ext2_filsys	fs,
 			entry++;
 
 		if (ret & DIRENT_CHANGED) {
-			dirent->rec_len = rec_len;
+			if (ext2fs_get_rec_len(fs, dirent, &rec_len))
+				return BLOCK_ABORT;
 			changed++;
 		}
 		if (ret & DIRENT_ABORT) {