From: yu kuai Date: Mon, 1 Jun 2020 12:38:56 +0000 (+0800) Subject: block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed X-Git-Tag: v5.8-rc1~37^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a75ca9303175d36af93c0937dd9b1a6422908b8d;p=thirdparty%2Fkernel%2Flinux.git block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") added a kfree() for 'buf' if bio_integrity_add_page() returns '0'. However, the object will be freed in bio_integrity_free() since 'bio->bi_opf' and 'bio->bi_integrity' were set previousy in bio_integrity_alloc(). Fixes: commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") Signed-off-by: yu kuai Reviewed-by: Ming Lei Reviewed-by: Bob Liu Acked-by: Martin K. Petersen Signed-off-by: Jens Axboe --- diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3579ac0f6ec1f..23632a33ed394 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -281,7 +281,6 @@ bool bio_integrity_prep(struct bio *bio) if (ret == 0) { printk(KERN_ERR "could not attach integrity payload\n"); - kfree(buf); status = BLK_STS_RESOURCE; goto err_end_io; }