* [PATCH 5.10 backport] io_uring: only assign io_uring_enter() SQPOLL error in actual error case
@ 2021-08-24 12:15 Pavel Begunkov
2021-08-24 15:31 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-08-24 12:15 UTC (permalink / raw)
To: Sasha Levin, stable; +Cc: Jens Axboe
From: Jens Axboe <axboe@kernel.dk>
[ upstream commit 21f965221e7c42609521342403e8fb91b8b3e76e ]
If an SQPOLL based ring is newly created and an application issues an
io_uring_enter(2) system call on it, then we can return a spurious
-EOWNERDEAD error. This happens because there's nothing to submit, and
if the caller doesn't specify any other action, the initial error
assignment of -EOWNERDEAD never gets overwritten. This causes us to
return it directly, even if it isn't valid.
Move the error assignment into the actual failure case instead.
Cc: stable@vger.kernel.org
Fixes: d9d05217cb69 ("io_uring: stop SQPOLL submit on creator's death")
Reported-by: Sherlock Holo sherlockya@gmail.com
Link: https://github.com/axboe/liburing/issues/413
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
fs/io_uring.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ed641dca7957..8492b4e7c4d7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -9078,9 +9078,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
if (ctx->flags & IORING_SETUP_SQPOLL) {
io_cqring_overflow_flush(ctx, false, NULL, NULL);
- ret = -EOWNERDEAD;
- if (unlikely(ctx->sqo_dead))
+ if (unlikely(ctx->sqo_dead)) {
+ ret = -EOWNERDEAD;
goto out;
+ }
if (flags & IORING_ENTER_SQ_WAKEUP)
wake_up(&ctx->sq_data->wait);
if (flags & IORING_ENTER_SQ_WAIT) {
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5.10 backport] io_uring: only assign io_uring_enter() SQPOLL error in actual error case
2021-08-24 12:15 [PATCH 5.10 backport] io_uring: only assign io_uring_enter() SQPOLL error in actual error case Pavel Begunkov
@ 2021-08-24 15:31 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2021-08-24 15:31 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: stable, Jens Axboe
On Tue, Aug 24, 2021 at 01:15:31PM +0100, Pavel Begunkov wrote:
>From: Jens Axboe <axboe@kernel.dk>
>
>[ upstream commit 21f965221e7c42609521342403e8fb91b8b3e76e ]
>
>If an SQPOLL based ring is newly created and an application issues an
>io_uring_enter(2) system call on it, then we can return a spurious
>-EOWNERDEAD error. This happens because there's nothing to submit, and
>if the caller doesn't specify any other action, the initial error
>assignment of -EOWNERDEAD never gets overwritten. This causes us to
>return it directly, even if it isn't valid.
>
>Move the error assignment into the actual failure case instead.
>
>Cc: stable@vger.kernel.org
>Fixes: d9d05217cb69 ("io_uring: stop SQPOLL submit on creator's death")
>Reported-by: Sherlock Holo sherlockya@gmail.com
>Link: https://github.com/axboe/liburing/issues/413
>Signed-off-by: Jens Axboe <axboe@kernel.dk>
>Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Queued up, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-24 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 12:15 [PATCH 5.10 backport] io_uring: only assign io_uring_enter() SQPOLL error in actual error case Pavel Begunkov
2021-08-24 15:31 ` Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.