aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-03-09 05:42:45 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-03-14 16:06:52 -0400
commit059ea3318c8ede71851a52b4359fbf1ab0cec301 (patch)
tree29a70645e27947d820884b1249d0d7f26b8ea0d8 /fs
parent87092698c665e0a358caf9825ae13114343027e8 (diff)
block: fix memory leak in bio_clone()
If bio_integrity_clone() fails, bio_clone() returns NULL without freeing the newly allocated bio. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bio.c b/fs/bio.c
index cf747378b977..d4f06327c810 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -465,8 +465,10 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
465 465
466 ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); 466 ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set);
467 467
468 if (ret < 0) 468 if (ret < 0) {
469 bio_put(b);
469 return NULL; 470 return NULL;
471 }
470 } 472 }
471 473
472 return b; 474 return b;