linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tao Ma <tm@tao.ma>
To: linux-ext4@vger.kernel.org
Cc: "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH] ext4: Fix a possible corruption in dx_probe.
Date: Thu,  1 Sep 2011 00:00:52 +0800	[thread overview]
Message-ID: <1314806452-8763-1-git-send-email-tm@tao.ma> (raw)

From: Tao Ma <boyu.mt@taobao.com>

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: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
 fs/ext4/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index b754b77..86c5c69 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -404,6 +404,7 @@ dx_probe(const struct qstr *d_name, 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)) {
 			ext4_warning(dir->i_sb,
@@ -458,7 +459,6 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
 			goto fail2;
 		}
 		frame++;
-		frame->bh = NULL;
 	}
 fail2:
 	while (frame >= frame_in) {
-- 
1.7.0.4


             reply	other threads:[~2011-08-31 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 16:00 Tao Ma [this message]
2011-09-04 13:57 ` [PATCH] ext4: Fix a possible corruption in dx_probe Ted Ts'o
2011-09-05  2:17   ` Tao Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314806452-8763-1-git-send-email-tm@tao.ma \
    --to=tm@tao.ma \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).