Skip to content

Commit 6ca56f8

Browse files
committed
io_uring: mark statx/files_update/epoll_ctl as non-SQPOLL
These will naturally fail when attempted through SQPOLL, but either with -EFAULT or -EBADF. Make it explicit that these are not workable through SQPOLL and return -EINVAL, just like other ops that need to use ->files. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 72f04da commit 6ca56f8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

fs/io_uring.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,7 +3786,7 @@ static int io_epoll_ctl_prep(struct io_kiocb *req,
37863786
#if defined(CONFIG_EPOLL)
37873787
if (sqe->ioprio || sqe->buf_index)
37883788
return -EINVAL;
3789-
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
3789+
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
37903790
return -EINVAL;
37913791

37923792
req->epoll.epfd = READ_ONCE(sqe->fd);
@@ -3901,7 +3901,7 @@ static int io_fadvise(struct io_kiocb *req, bool force_nonblock)
39013901

39023902
static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
39033903
{
3904-
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
3904+
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
39053905
return -EINVAL;
39063906
if (sqe->ioprio || sqe->buf_index)
39073907
return -EINVAL;
@@ -5418,6 +5418,8 @@ static int io_async_cancel(struct io_kiocb *req)
54185418
static int io_files_update_prep(struct io_kiocb *req,
54195419
const struct io_uring_sqe *sqe)
54205420
{
5421+
if (unlikely(req->ctx->flags & IORING_SETUP_SQPOLL))
5422+
return -EINVAL;
54215423
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
54225424
return -EINVAL;
54235425
if (sqe->ioprio || sqe->rw_flags)

0 commit comments

Comments
 (0)