io_uring: only assign io_uring_enter() SQPOLL error in actual error case
authorJens Axboe <axboe@kernel.dk>
Sat, 14 Aug 2021 15:04:40 +0000 (09:04 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 14 Aug 2021 18:38:21 +0000 (12:38 -0600)
commit21f965221e7c42609521342403e8fb91b8b3e76e
treef680b17ee19d8069fafac58f8bcfca3aa4782e75
parent8f40d0370795313b6f1b1782035919cfc76b159f
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: 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>
fs/io_uring.c