[PATCH] memory leakage in ext4_ext_zeroout

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

 



From: Jing Zhang <zj.barak@xxxxxxxxx>

Date: Sat Mar 13 14:05:27     2010

When EIO occurs after bio is submitted, there is no memory free
operation for bio, which results in memory leakage. And there is also
no check against bio_alloc() for bio.

Cc: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Jing Zhang <zj.barak@xxxxxxxxx>

---

--- o/fs/ext4/extents.c	2010-03-13 13:47:22.000000000 +0800
+++ c/fs/ext4/extents.c	2010-03-13 13:54:36.000000000 +0800
@@ -2568,6 +2568,10 @@ static int ext4_ext_zeroout(struct inode
 			len = ee_len;

 		bio = bio_alloc(GFP_NOIO, len);
+		if (! bio) {
+			ret = -ENOMEM;
+			break;
+		}	
 		bio->bi_sector = ee_pblock;
 		bio->bi_bdev   = inode->i_sb->s_bdev;

@@ -2598,6 +2602,7 @@ static int ext4_ext_zeroout(struct inode
 		if (test_bit(BIO_UPTODATE, &bio->bi_flags))
 			ret = 0;
 		else {
+			bio_put(bio);
 			ret = -EIO;
 			break;
 		}
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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