Currently when an IORING_OP_FILES_UPDATE is submitted with the IOSQE_IO_LINK flag it fails with EINVAL even if it's considered a valid because the expectation is that there are no flags set for the sqe. The patch updates the check to allow IOSQE_IO_LINK and ensure that EINVAL is returned only for IOSQE_FIXED_FILE and IOSQE_BUFFER_SELECT. Signed-off-by: Daniele Albano <d.albano@xxxxxxxxx> --- fs/io_uring.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index ba70dc62f15f..7058b1a0bd39 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5205,7 +5205,14 @@ static int io_async_cancel(struct io_kiocb *req) static int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { - if (sqe->flags || sqe->ioprio || sqe->rw_flags) + unsigned flags = 0; + + if (sqe->ioprio || sqe->rw_flags) + return -EINVAL; + + flags = READ_ONCE(sqe->flags); + + if (flags & (IOSQE_FIXED_FILE | IOSQE_BUFFER_SELECT)) return -EINVAL; req->files_update.offset = READ_ONCE(sqe->off); -- 2.25.1