Skip to content

Commit 21f9652

Browse files
committed
io_uring: only assign io_uring_enter() SQPOLL error in actual error case
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: [email protected] Fixes: d9d0521 ("io_uring: stop SQPOLL submit on creator's death") Reported-by: Sherlock Holo [email protected] Link: axboe/liburing#413 Signed-off-by: Jens Axboe <[email protected]>
1 parent 8f40d03 commit 21f9652

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/io_uring.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9370,9 +9370,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
93709370
if (ctx->flags & IORING_SETUP_SQPOLL) {
93719371
io_cqring_overflow_flush(ctx, false);
93729372

9373-
ret = -EOWNERDEAD;
9374-
if (unlikely(ctx->sq_data->thread == NULL))
9373+
if (unlikely(ctx->sq_data->thread == NULL)) {
9374+
ret = -EOWNERDEAD;
93759375
goto out;
9376+
}
93769377
if (flags & IORING_ENTER_SQ_WAKEUP)
93779378
wake_up(&ctx->sq_data->wait);
93789379
if (flags & IORING_ENTER_SQ_WAIT) {

0 commit comments

Comments
 (0)