* Re: [PATCH v2] ext4: add checks of block references for non-extent inodes
[not found] ` <49C3A51C.1030201@ph.tum.de>
@ 2009-03-31 8:41 ` Thiemo Nagel
2009-03-31 12:37 ` Theodore Tso
0 siblings, 1 reply; 2+ messages in thread
From: Thiemo Nagel @ 2009-03-31 8:41 UTC (permalink / raw)
To: Theodore Ts'o, Aneesh Kumar K.V, sfr; +Cc: Ext4 Developers List, linux-next
[-- 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);
^ permalink raw reply related [flat|nested] 2+ messages in thread