/[packages]/backports/8/kernel/current/SOURCES/io_uring-fix-issue-with-io_write-not-always-undoing-.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/io_uring-fix-issue-with-io_write-not-always-undoing-.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1881590 - (show annotations) (download)
Mon Aug 29 03:49:40 2022 UTC (19 months, 3 weeks ago) by tmb
File size: 1268 byte(s)
- add current -stable queue
- io_uring: fix issue with io_write() not always undoing sb_start_write()
- HID: input: fix uclogic tablets


1 From e6ab6c526bab6020869d6d97eb46bec06b4fd287 Mon Sep 17 00:00:00 2001
2 From: Jens Axboe <axboe@kernel.dk>
3 Date: Thu, 25 Aug 2022 10:17:25 -0600
4 Subject: [PATCH] io_uring: fix issue with io_write() not always undoing
5 sb_start_write()
6
7 commit e053aaf4da56cbf0afb33a0fda4a62188e2c0637 upstream.
8
9 This is actually an older issue, but we never used to hit the -EAGAIN
10 path before having done sb_start_write(). Make sure that we always call
11 kiocb_end_write() if we need to retry the write, so that we keep the
12 calls to sb_start_write() etc balanced.
13
14 Signed-off-by: Jens Axboe <axboe@kernel.dk>
15 ---
16 io_uring/io_uring.c | 7 ++++++-
17 1 file changed, 6 insertions(+), 1 deletion(-)
18
19 diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
20 index 6a67dbf5195f..cd155b7e1346 100644
21 --- a/io_uring/io_uring.c
22 +++ b/io_uring/io_uring.c
23 @@ -4331,7 +4331,12 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
24 copy_iov:
25 iov_iter_restore(&s->iter, &s->iter_state);
26 ret = io_setup_async_rw(req, iovec, s, false);
27 - return ret ?: -EAGAIN;
28 + if (!ret) {
29 + if (kiocb->ki_flags & IOCB_WRITE)
30 + kiocb_end_write(req);
31 + return -EAGAIN;
32 + }
33 + return ret;
34 }
35 out_free:
36 /* it's reportedly faster than delegating the null check to kfree() */
37 --
38 2.35.1
39

  ViewVC Help
Powered by ViewVC 1.1.30