Skip to content

Commit 61710e4

Browse files
danielealbanoaxboe
authored andcommitted
io_uring: always allow drain/link/hardlink/async sqe flags
We currently filter these for timeout_remove/async_cancel/files_update, but we only should be filtering for fixed file and buffer select. This also causes a second read of sqe->flags, which isn't needed. Just check req->flags for the relevant bits. This then allows these commands to be used in links, for example, like everything else. Signed-off-by: Daniele Albano <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 807abcb commit 61710e4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

fs/io_uring.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,7 +4737,9 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
47374737
{
47384738
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
47394739
return -EINVAL;
4740-
if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->len)
4740+
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
4741+
return -EINVAL;
4742+
if (sqe->ioprio || sqe->buf_index || sqe->len)
47414743
return -EINVAL;
47424744

47434745
req->timeout.addr = READ_ONCE(sqe->addr);
@@ -4915,8 +4917,9 @@ static int io_async_cancel_prep(struct io_kiocb *req,
49154917
{
49164918
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
49174919
return -EINVAL;
4918-
if (sqe->flags || sqe->ioprio || sqe->off || sqe->len ||
4919-
sqe->cancel_flags)
4920+
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
4921+
return -EINVAL;
4922+
if (sqe->ioprio || sqe->off || sqe->len || sqe->cancel_flags)
49204923
return -EINVAL;
49214924

49224925
req->cancel.addr = READ_ONCE(sqe->addr);
@@ -4934,7 +4937,9 @@ static int io_async_cancel(struct io_kiocb *req)
49344937
static int io_files_update_prep(struct io_kiocb *req,
49354938
const struct io_uring_sqe *sqe)
49364939
{
4937-
if (sqe->flags || sqe->ioprio || sqe->rw_flags)
4940+
if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
4941+
return -EINVAL;
4942+
if (sqe->ioprio || sqe->rw_flags)
49384943
return -EINVAL;
49394944

49404945
req->files_update.offset = READ_ONCE(sqe->off);

0 commit comments

Comments
 (0)