Thread (2 messages) 2 messages, 2 authors, 2011-09-01
STALE5441d

[PATCH ] ext3: Fix a possible corruption in dx_probe.

From: Tao Ma <hidden>
Date: 2011-08-31 15:59:38
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

From: Tao Ma <redacted>

For all the callers of dx_probe, frame_in is passed in uninitialized.
So we should set frame->bh to NULL in the beginning of while, not
the end. Otherwise, the first "goto fail2" will try to brelse(frame->bh)
while frame->bh is still invalid.

Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Tao Ma <redacted>
---
 fs/ext3/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 34b6d9b..45468b9 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -404,6 +404,7 @@ dx_probe(struct qstr *entry, struct inode *dir,
 	dxtrace (printk("Look up %x", hash));
 	while (1)
 	{
+		frame->bh = NULL;
 		count = dx_get_count(entries);
 		if (!count || count > dx_get_limit(entries)) {
 			ext3_warning(dir->i_sb, __func__,
@@ -458,7 +459,6 @@ dx_probe(struct qstr *entry, struct inode *dir,
 			goto fail2;
 		}
 		frame++;
-		frame->bh = NULL;
 	}
 fail2:
 	while (frame >= frame_in) {
-- 
1.7.0.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help