From: Li Zefan Date: Mon, 9 Mar 2009 09:42:45 +0000 (+0100) Subject: block: fix memory leak in bio_clone() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=059ea3318c8ede71851a52b4359fbf1ab0cec301;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jens Axboe --- 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) ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); - if (ret < 0) + if (ret < 0) { + bio_put(b); return NULL; + } } return b;