summaryrefslogtreecommitdiffstats
path: root/block/bio-integrity.c
diff options
context:
space:
mode:
authoryu kuai <yukuai3@huawei.com>2020-06-01 14:38:56 +0200
committerJens Axboe <axboe@kernel.dk>2020-06-03 01:21:50 +0200
commita75ca9303175d36af93c0937dd9b1a6422908b8d (patch)
tree9029d26e21a9ee22260f92c711061c3ef78783a1 /block/bio-integrity.c
parentMerge tag 'for-5.8/io_uring-2020-06-01' of git://git.kernel.dk/linux-block (diff)
downloadlinux-a75ca9303175d36af93c0937dd9b1a6422908b8d.tar.xz
linux-a75ca9303175d36af93c0937dd9b1a6422908b8d.zip
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 <yukuai3@huawei.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Bob Liu <bob.liu@oracle.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio-integrity.c')
-rw-r--r--block/bio-integrity.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 3579ac0f6ec1..23632a33ed39 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;
}