]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jun 2020 14:29:25 +0000 (16:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jun 2020 14:29:25 +0000 (16:29 +0200)
added patches:
block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch

queue-5.4/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch [new file with mode: 0644]

diff --git a/queue-5.4/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch b/queue-5.4/block-bio-integrity-don-t-free-buf-if-bio_integrity_add_page-failed.patch
new file mode 100644 (file)
index 0000000..a429275
--- /dev/null
@@ -0,0 +1,37 @@
+From a75ca9303175d36af93c0937dd9b1a6422908b8d Mon Sep 17 00:00:00 2001
+From: yu kuai <yukuai3@huawei.com>
+Date: Mon, 1 Jun 2020 20:38:56 +0800
+Subject: block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed
+
+From: yu kuai <yukuai3@huawei.com>
+
+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>
+
+---
+ block/bio-integrity.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/block/bio-integrity.c
++++ b/block/bio-integrity.c
+@@ -278,7 +278,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;
+               }