Re: [PATCH v2] ext4: add checks of block references for non-extent inodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>



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);

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux