From: Greg Kroah-Hartman Date: Tue, 7 Jun 2022 11:19:11 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.10.121~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54dc21857d6fbd23ff1e4bb16412188b6b802721;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch --- diff --git a/queue-4.19/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch b/queue-4.19/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch new file mode 100644 index 00000000000..8495c82d0bf --- /dev/null +++ b/queue-4.19/md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch @@ -0,0 +1,38 @@ +From 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +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 + +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 +Signed-off-by: Jia-Ju Bai +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20220527152818.27545-4-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/bcache/request.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/md/bcache/request.c ++++ b/drivers/md/bcache/request.c +@@ -1102,6 +1102,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; + ddip->start_time = jiffies; + ddip->bi_end_io = bio->bi_end_io; diff --git a/queue-4.19/series b/queue-4.19/series index 34f887b182e..1f6c820326b 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -186,3 +186,4 @@ blk-iolatency-fix-inflight-count-imbalances-and-io-hangs-on-offline.patch phy-qcom-qmp-fix-reset-controller-leak-on-probe-errors.patch rdma-rxe-generate-a-completion-for-unsupported-invalid-opcode.patch mips-ip27-remove-incorrect-cpu_has_fpu-override.patch +md-bcache-check-the-return-value-of-kzalloc-in-detached_dev_do_request.patch