diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-04-13 17:10:34 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-04-13 18:25:37 +0200 |
commit | cce64ef01308b677a687d90927fc2b2e0e1cba67 (patch) | |
tree | 94486edd3f2ff62b930b92ccad513cf7784ea7f8 /fs | |
parent | io_uring: use right issue_flags for splice/tee (diff) | |
download | linux-cce64ef01308b677a687d90927fc2b2e0e1cba67.tar.xz linux-cce64ef01308b677a687d90927fc2b2e0e1cba67.zip |
io_uring: fix poll file assign deadlock
We pass "unlocked" into io_assign_file() in io_poll_check_events(),
which can lead to double locking.
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/2476d4ae46554324b599ee4055447b105f20a75a.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 3d6cbf77c89d..d06f1952fdfa 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5858,8 +5858,9 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked) if (!req->result) { struct poll_table_struct pt = { ._key = req->apoll_events }; + unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED; - if (unlikely(!io_assign_file(req, IO_URING_F_UNLOCKED))) + if (unlikely(!io_assign_file(req, flags))) req->result = -EBADF; else req->result = vfs_poll(req->file, &pt) & req->apoll_events; |