From: yu kuai <[email protected]>

commit a75ca9303175d36af93c0937dd9b1a6422908b8d upstream.

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 <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Reviewed-by: Bob Liu <[email protected]>
Acked-by: Martin K. Petersen <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Cc: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 block/bio-integrity.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 5bd90cd4b51e3..a059fad53f1b0 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -293,7 +293,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;
                }
-- 
2.25.1

Reply via email to