]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Aug 2022 08:01:57 +0000 (10:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Aug 2022 08:01:57 +0000 (10:01 +0200)
added patches:
io_uring-fix-issue-with-io_write-not-always-undoing-sb_start_write.patch

queue-5.19/io_uring-fix-issue-with-io_write-not-always-undoing-sb_start_write.patch [new file with mode: 0644]
queue-5.19/series

diff --git a/queue-5.19/io_uring-fix-issue-with-io_write-not-always-undoing-sb_start_write.patch b/queue-5.19/io_uring-fix-issue-with-io_write-not-always-undoing-sb_start_write.patch
new file mode 100644 (file)
index 0000000..ec1de1f
--- /dev/null
@@ -0,0 +1,36 @@
+From foo@baz Mon Aug 29 10:00:35 AM CEST 2022
+From: Jens Axboe <axboe@kernel.dk>
+Date: Thu, 25 Aug 2022 10:17:25 -0600
+Subject: io_uring: fix issue with io_write() not always undoing sb_start_write()
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit e053aaf4da56cbf0afb33a0fda4a62188e2c0637 upstream.
+
+This is actually an older issue, but we never used to hit the -EAGAIN
+path before having done sb_start_write(). Make sure that we always call
+kiocb_end_write() if we need to retry the write, so that we keep the
+calls to sb_start_write() etc balanced.
+
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ io_uring/io_uring.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/io_uring/io_uring.c
++++ b/io_uring/io_uring.c
+@@ -4331,7 +4331,12 @@ done:
+ copy_iov:
+               iov_iter_restore(&s->iter, &s->iter_state);
+               ret = io_setup_async_rw(req, iovec, s, false);
+-              return ret ?: -EAGAIN;
++              if (!ret) {
++                      if (kiocb->ki_flags & IOCB_WRITE)
++                              kiocb_end_write(req);
++                      return -EAGAIN;
++              }
++              return ret;
+       }
+ out_free:
+       /* it's reportedly faster than delegating the null check to kfree() */
index f254039ebff1fb6dec6f8b17e9b000417b3b430e..893cd90b3a7ba9e89143e95f832c8d38b793ed79 100644 (file)
@@ -130,3 +130,4 @@ riscv-signal-fix-missing-prototype-warning.patch
 riscv-traps-add-missing-prototype.patch
 riscv-dts-microchip-correct-l2-cache-interrupts.patch
 revert-zram-remove-double-compression-logic.patch
+io_uring-fix-issue-with-io_write-not-always-undoing-sb_start_write.patch