Skip to content

Commit cce64ef

Browse files
isilenceaxboe
authored andcommitted
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: 6bf9c47 ("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>
1 parent e941976 commit cce64ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/io_uring.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5858,8 +5858,9 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)
58585858

58595859
if (!req->result) {
58605860
struct poll_table_struct pt = { ._key = req->apoll_events };
5861+
unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED;
58615862

5862-
if (unlikely(!io_assign_file(req, IO_URING_F_UNLOCKED)))
5863+
if (unlikely(!io_assign_file(req, flags)))
58635864
req->result = -EBADF;
58645865
else
58655866
req->result = vfs_poll(req->file, &pt) & req->apoll_events;

0 commit comments

Comments
 (0)