diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-04-18 06:40:30 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-20 09:36:28 +0200 |
commit | 540e5ce8b3bc5548d5a342d0f4a57779715545c0 (patch) | |
tree | bed0ca65e11c499b2214f88e69c84815444a2fe6 | |
parent | a8189db2d5d251c4e0234390034fad87d1cecebc (diff) |
io_uring: fix poll file assign deadlock
commit cce64ef01308b677a687d90927fc2b2e0e1cba67 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 34e540755c9f..6ddafa3af170 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5510,8 +5510,9 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked) if (!req->result) { struct poll_table_struct pt = { ._key = poll->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) & poll->events; |