]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 May 2026 15:40:48 +0000 (17:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 May 2026 15:40:48 +0000 (17:40 +0200)
added patches:
bcache-fix-uninitialized-closure-object.patch

queue-5.10/bcache-fix-uninitialized-closure-object.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/bcache-fix-uninitialized-closure-object.patch b/queue-5.10/bcache-fix-uninitialized-closure-object.patch
new file mode 100644 (file)
index 0000000..6c3f834
--- /dev/null
@@ -0,0 +1,42 @@
+From 20a8e451ec1c7e99060b1bbaaad03ce88c39ddb8 Mon Sep 17 00:00:00 2001
+From: Mingzhe Zou <mingzhe.zou@easystack.cn>
+Date: Fri, 3 Apr 2026 12:21:35 +0800
+Subject: bcache: fix uninitialized closure object
+
+From: Mingzhe Zou <mingzhe.zou@easystack.cn>
+
+commit 20a8e451ec1c7e99060b1bbaaad03ce88c39ddb8 upstream.
+
+In the previous patch ("bcache: fix cached_dev.sb_bio use-after-free and
+crash"), we adopted a simple modification suggestion from AI to fix the
+use-after-free.
+
+But in actual testing, we found an extreme case where the device is
+stopped before calling bch_write_bdev_super().
+
+At this point, struct closure sb_write has not been initialized yet.
+For this patch, we ensure that sb_bio has been completed via
+sb_write_mutex.
+
+Signed-off-by: Mingzhe Zou <mingzhe.zou@easystack.cn>
+Signed-off-by: Coly Li <colyli@fnnas.com>
+Link: https://patch.msgid.link/20260403042135.2221247-1-colyli@fnnas.com
+Fixes: fec114a98b87 ("bcache: fix cached_dev.sb_bio use-after-free and crash")
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/bcache/super.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/md/bcache/super.c
++++ b/drivers/md/bcache/super.c
+@@ -1401,7 +1401,8 @@ static void cached_dev_free(struct closu
+        * The sb_bio is embedded in struct cached_dev, so we must
+        * ensure no I/O is in progress.
+        */
+-      closure_sync(&dc->sb_write);
++      down(&dc->sb_write_mutex);
++      up(&dc->sb_write_mutex);
+       if (dc->sb_disk)
+               put_page(virt_to_page(dc->sb_disk));
index aa34eb25d0bf80b5ca1a1050b61e72f924f5b7b1..a5227af5d4eda22b00cb248d2a0644cc836f0987 100644 (file)
@@ -292,3 +292,4 @@ batman-adv-bla-put-backbone-reference-on-failed-claim-hash-insert.patch
 bluetooth-l2cap-fix-null-ptr-deref-in-l2cap_sock_get_sndtimeo_cb.patch
 vsock-fix-buffer-size-clamping-order.patch
 vsock-virtio-fix-accept-queue-count-leak-on-transport-mismatch.patch
+bcache-fix-uninitialized-closure-object.patch