[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac8f92701003122233i6e673351p692dbc2a452b2514@mail.gmail.com>
Date: Sat, 13 Mar 2010 14:33:28 +0800
From: jing zhang <zj.barak@...il.com>
To: linux-ext4@...r.kernel.org
Cc: Xu Chang Ming <xcmhit@...il.com>
Subject: [PATCH] memory leakage in ext4_ext_zeroout
From: Jing Zhang <zj.barak@...il.com>
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@...ux.vnet.ibm.com>
Signed-off-by: Jing Zhang <zj.barak@...il.com>
---
--- 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists