linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thiemo Nagel <thiemo.nagel@ph.tum.de>
To: Theodore Ts'o <tytso@mit.edu>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	sfr@canb.auug.org.au
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	linux-next@vger.kernel.org
Subject: Re: [PATCH v2] ext4: add checks of block references for non-extent inodes
Date: Tue, 31 Mar 2009 10:41:27 +0200	[thread overview]
Message-ID: <49D1D737.9080105@ph.tum.de> (raw)
In-Reply-To: <49C3A51C.1030201@ph.tum.de>

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

Dear Ted, Aneesh, Stephen,

thanks a lot for your comments and fixes!  The attached patch (applied 
on-top) should fix the
* buffer head leak spotted by Aneesh
* warning reported by Stephen

Kind regards,

Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>




[-- Attachment #2: fixup-blockref-checks.patch --]
[-- Type: text/x-patch, Size: 894 bytes --]

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9ab845e..69715e5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -380,9 +380,9 @@ static int __ext4_check_blockref(const char *function, struct inode *inode,
 		if (unlikely(*bref >= maxblocks)) {
 			ext4_error(inode->i_sb, function,
 				   "block reference %u >= max (%u) "
-				   "in inode #%lu, offset=%u",
+				   "in inode #%lu, offset=%i",
 				   *bref, maxblocks,
-				   inode->i_ino, bref-p);
+				   inode->i_ino, (int)(bref-p));
  			return -EIO;
  		}
 		bref++;
@@ -453,8 +453,10 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth,
 				goto failure;
 			}
 			/* validate block references */
-			if (ext4_check_indirect_blockref(inode, bh))
+			if (ext4_check_indirect_blockref(inode, bh)) {
+				put_bh(bh);
 				goto failure;
+			}
 		}
 		
 		add_chain(++p, bh, (__le32 *)bh->b_data + *++offsets);

  parent reply	other threads:[~2009-03-31  8:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 17:17 [PATCH] ext4: add checks of block references for non-extent inodes Thiemo Nagel
2009-03-12 17:20 ` [PATCH] ext4: check block references only when read from disk Thiemo Nagel
2009-03-12 17:22   ` Thiemo Nagel
2009-03-20 14:15 ` [PATCH v2] ext4: add checks of block references for non-extent inodes Thiemo Nagel
2009-03-27 21:05   ` Theodore Tso
2009-03-28  1:10   ` Theodore Tso
2009-03-30 10:43   ` Aneesh Kumar K.V
2009-03-31  8:41   ` Thiemo Nagel [this message]
2009-03-31 12:37     ` Theodore Tso
2009-03-31 12:50       ` Thiemo Nagel

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=49D1D737.9080105@ph.tum.de \
    --to=thiemo.nagel@ph.tum.de \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --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).