]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Jun 2022 11:20:01 +0000 (13:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Jun 2022 11:20:01 +0000 (13:20 +0200)
added patches:
md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch

queue-5.10/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch b/queue-5.10/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch
new file mode 100644 (file)
index 0000000..3254110
--- /dev/null
@@ -0,0 +1,38 @@
+From 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 Mon Sep 17 00:00:00 2001
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+Date: Fri, 27 May 2022 23:28:18 +0800
+Subject: md: bcache: check the return value of kzalloc() in detached_dev_do_request()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+commit 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 upstream.
+
+The function kzalloc() in detached_dev_do_request() can fail, so its
+return value should be checked.
+
+Fixes: bc082a55d25c ("bcache: fix inaccurate io state for detached bcache devices")
+Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: Coly Li <colyli@suse.de>
+Link: https://lore.kernel.org/r/20220527152818.27545-4-colyli@suse.de
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/bcache/request.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/md/bcache/request.c
++++ b/drivers/md/bcache/request.c
+@@ -1109,6 +1109,12 @@ static void detached_dev_do_request(stru
+        * which would call closure_get(&dc->disk.cl)
+        */
+       ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
++      if (!ddip) {
++              bio->bi_status = BLK_STS_RESOURCE;
++              bio->bi_end_io(bio);
++              return;
++      }
++
+       ddip->d = d;
+       /* Count on the bcache device */
+       ddip->start_time = part_start_io_acct(d->disk, &ddip->part, bio);
index a7b4a0149234b844f6fb19930d1e61d4058e4522..5b8958639a911485bc0f243d89580ff3f4042762 100644 (file)
@@ -449,3 +449,4 @@ rdma-rxe-generate-a-completion-for-unsupported-invalid-opcode.patch
 mips-ip27-remove-incorrect-cpu_has_fpu-override.patch
 mips-ip30-remove-incorrect-cpu_has_fpu-override.patch
 ext4-only-allow-test_dummy_encryption-when-supported.patch
+md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch