From: Greg Kroah-Hartman Date: Sun, 16 Oct 2022 07:09:50 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.219~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5da4dce51ab8f372711b6f7b3640d31ccf363da0;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: io_uring-rw-fix-unexpected-link-breakage.patch --- 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 index 00000000000..fa0776c473e --- /dev/null +++ b/queue-5.10/io_uring-rw-fix-unexpected-link-breakage.patch @@ -0,0 +1,38 @@ +From bf68b5b34311ee57ed40749a1257a30b46127556 Mon Sep 17 00:00:00 2001 +From: Pavel Begunkov +Date: Tue, 27 Sep 2022 00:44:39 +0100 +Subject: io_uring/rw: fix unexpected link breakage + +From: Pavel Begunkov + +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 +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/3a1088440c7be98e5800267af922a67da0ef9f13.1664235732.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + 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. diff --git a/queue-5.10/series b/queue-5.10/series index 93d5a44acd9..3eb7468f240 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -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