]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:09:50 +0000 (09:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:09:50 +0000 (09:09 +0200)
added patches:
io_uring-rw-fix-unexpected-link-breakage.patch

queue-5.10/io_uring-rw-fix-unexpected-link-breakage.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/io_uring-rw-fix-unexpected-link-breakage.patch b/queue-5.10/io_uring-rw-fix-unexpected-link-breakage.patch
new file mode 100644 (file)
index 0000000..fa0776c
--- /dev/null
@@ -0,0 +1,38 @@
+From bf68b5b34311ee57ed40749a1257a30b46127556 Mon Sep 17 00:00:00 2001
+From: Pavel Begunkov <asml.silence@gmail.com>
+Date: Tue, 27 Sep 2022 00:44:39 +0100
+Subject: io_uring/rw: fix unexpected link breakage
+
+From: Pavel Begunkov <asml.silence@gmail.com>
+
+commit bf68b5b34311ee57ed40749a1257a30b46127556 upstream.
+
+req->cqe.res is set in io_read() to the amount of bytes left to be done,
+which is used to figure out whether to fail a read or not. However,
+io_read() may do another without returning, and we stash the previous
+value into ->bytes_done but forget to update cqe.res. Then we ask a read
+to do strictly less than cqe.res but expect the return to be exactly
+cqe.res.
+
+Fix the bug by updating cqe.res for retries.
+
+Cc: stable@vger.kernel.org
+Reported-and-Tested-by: Beld Zhang <beldzhang@gmail.com>
+Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
+Link: https://lore.kernel.org/r/3a1088440c7be98e5800267af922a67da0ef9f13.1664235732.git.asml.silence@gmail.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/io_uring.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/io_uring.c
++++ b/fs/io_uring.c
+@@ -369,6 +369,7 @@ struct io_ring_ctx {
+       struct {
+               spinlock_t              completion_lock;
++              req->cqe.res = iov_iter_count(&s->iter);
+               /*
+                * ->iopoll_list is protected by the ctx->uring_lock for
+                * io_uring instances that don't use IORING_SETUP_SQPOLL.
index 93d5a44acd91c781000fb071d7f25d224a517445..3eb7468f2406de94b32c88551ad3d17eb4e8d699 100644 (file)
@@ -7,3 +7,4 @@ alsa-hda-realtek-correct-pin-configs-for-asus-g533z.patch
 alsa-hda-realtek-add-quirk-for-asus-gv601r-laptop.patch
 alsa-hda-realtek-add-intel-reference-ssid-to-support-headset-keys.patch
 mtd-rawnand-atmel-unmap-streaming-dma-mappings.patch
+io_uring-rw-fix-unexpected-link-breakage.patch