Skip to content

Commit c0737fa

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix double poll leak on repolling
We have re-polling for partial IO, so a request can be polled twice. If it used two poll entries the first time then on the second io_arm_poll_handler() it will find the old apoll entry and NULL kmalloc()'ed second entry, i.e. apoll->double_poll, so leaking it. Fixes: 10c8733 ("io_uring: allow re-poll if we made progress") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/fee2452494222ecc7f1f88c8fb659baef971414a.1655852245.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9d2ad29 commit c0737fa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/io_uring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7208,6 +7208,7 @@ static int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
72087208
mask |= EPOLLEXCLUSIVE;
72097209
if (req->flags & REQ_F_POLLED) {
72107210
apoll = req->apoll;
7211+
kfree(apoll->double_poll);
72117212
} else if (!(issue_flags & IO_URING_F_UNLOCKED) &&
72127213
!list_empty(&ctx->apoll_cache)) {
72137214
apoll = list_first_entry(&ctx->apoll_cache, struct async_poll,

0 commit comments

Comments
 (0)