diff options
author | yu kuai <yukuai3@huawei.com> | 2020-06-01 20:38:56 +0800 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2020-06-30 15:37:57 -0400 |
commit | a32228290d89ddabd4bb2cb2dbcb596a13ae0569 (patch) | |
tree | abbe03611e6dbdc14a6df1c0a2b5a8aed5fd094e /block | |
parent | bfbaf151efe491e30697e21c8b7ae1b615480873 (diff) | |
download | linux-stable-a32228290d89ddabd4bb2cb2dbcb596a13ae0569.tar.gz linux-stable-a32228290d89ddabd4bb2cb2dbcb596a13ae0569.tar.bz2 linux-stable-a32228290d89ddabd4bb2cb2dbcb596a13ae0569.zip |
block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed
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 <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>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/bio-integrity.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 7f8010662437..d3df44c3b43a 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -315,7 +315,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; } |