From: Greg Kroah-Hartman Date: Sun, 16 Oct 2022 07:09:42 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.4.219~184 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e32559ab3895e17d0846abf20da542820f27b42e;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: io_uring-rw-fix-unexpected-link-breakage.patch --- diff --git a/queue-5.4/io_uring-rw-fix-unexpected-link-breakage.patch b/queue-5.4/io_uring-rw-fix-unexpected-link-breakage.patch new file mode 100644 index 00000000000..b829ef2919e --- /dev/null +++ b/queue-5.4/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 +@@ -854,6 +854,7 @@ static int io_do_iopoll(struct io_ring_c + list_for_each_entry_safe(req, tmp, &ctx->poll_list, list) { + struct kiocb *kiocb = &req->rw; + ++ req->cqe.res = iov_iter_count(&s->iter); + /* + * Move completed entries to our local list. If we find a + * request that requires polling, break out and complete diff --git a/queue-5.4/series b/queue-5.4/series index 93d5a44acd9..3eb7468f240 100644 --- a/queue-5.4/series +++ b/queue-5.4/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