Skip to content

Commit

Permalink
io_uring: ensure ->list is initialized for poll commands
Browse files Browse the repository at this point in the history
commit 3670324 upstream.

Daniel reports that when testing an http server that uses io_uring
to poll for incoming connections, sometimes it hard crashes. This is
due to an uninitialized list member for the io_uring request. Normally
this doesn't trigger and none of the test cases caught it.

Reported-by: Daniel Kozak <kozzi11@gmail.com>
Tested-by: Daniel Kozak <kozzi11@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jens Axboe authored and Greg Kroah-Hartman committed Jul 31, 2019
1 parent 91b4f2b commit 119be19
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe)
INIT_LIST_HEAD(&poll->wait.entry);
init_waitqueue_func_entry(&poll->wait, io_poll_wake);

INIT_LIST_HEAD(&req->list);

mask = vfs_poll(poll->file, &ipt.pt) & poll->events;

spin_lock_irq(&ctx->completion_lock);
Expand Down

0 comments on commit 119be19

Please sign in to comment.