]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:09:56 +0000 (09:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:09:56 +0000 (09:09 +0200)
added patches:
io_uring-net-don-t-update-msg_name-if-not-provided.patch
io_uring-rw-fix-unexpected-link-breakage.patch

queue-5.15/io_uring-net-don-t-update-msg_name-if-not-provided.patch [new file with mode: 0644]
queue-5.15/io_uring-rw-fix-unexpected-link-breakage.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/io_uring-net-don-t-update-msg_name-if-not-provided.patch b/queue-5.15/io_uring-net-don-t-update-msg_name-if-not-provided.patch
new file mode 100644 (file)
index 0000000..ab547ba
--- /dev/null
@@ -0,0 +1,33 @@
+From 6f10ae8a155446248055c7ddd480ef40139af788 Mon Sep 17 00:00:00 2001
+From: Pavel Begunkov <asml.silence@gmail.com>
+Date: Thu, 29 Sep 2022 22:23:18 +0100
+Subject: io_uring/net: don't update msg_name if not provided
+
+From: Pavel Begunkov <asml.silence@gmail.com>
+
+commit 6f10ae8a155446248055c7ddd480ef40139af788 upstream.
+
+io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't
+provide it, we should retain NULL in this case.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
+Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.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 |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/io_uring.c
++++ b/fs/io_uring.c
+@@ -4763,7 +4763,8 @@ static int io_setup_async_msg(struct io_
+       async_msg = req->async_data;
+       req->flags |= REQ_F_NEED_CLEANUP;
+       memcpy(async_msg, kmsg, sizeof(*kmsg));
+-      async_msg->msg.msg_name = &async_msg->addr;
++      if (async_msg->msg.msg_name)
++              async_msg->msg.msg_name = &async_msg->addr;
+       /* if were using fast_iov, set it to the new one */
+       if (!async_msg->free_iov)
+               async_msg->msg.msg_iter.iov = async_msg->fast_iov;
diff --git a/queue-5.15/io_uring-rw-fix-unexpected-link-breakage.patch b/queue-5.15/io_uring-rw-fix-unexpected-link-breakage.patch
new file mode 100644 (file)
index 0000000..a5201fb
--- /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
+@@ -3600,6 +3600,7 @@ static int io_read(struct io_kiocb *req,
+                       return -EAGAIN;
+               }
++              req->cqe.res = iov_iter_count(&s->iter);
+               /*
+                * Now retry read with the IOCB_WAITQ parts set in the iocb. If
+                * we get -EIOCBQUEUED, then we'll get a notification when the
index f82d22908a95158120f3ef67b1d4170cc3582029..d23ea8575cc66ac79d10c2f6ace257fb17b1694b 100644 (file)
@@ -8,3 +8,5 @@ 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
+io_uring-net-don-t-update-msg_name-if-not-provided.patch