diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-06-22 00:00:37 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-21 17:24:37 -0600 |
commit | c0737fa9a5a5cf5a053bcc983f72d58919b997c6 (patch) | |
tree | 723417ce412a2f0e0835c9e6b587b0707d1c2989 /fs/io_uring.c | |
parent | 9d2ad2947a53abf5e5e6527a9eeed50a3a4cbc72 (diff) | |
download | linux-stable-c0737fa9a5a5cf5a053bcc983f72d58919b997c6.tar.gz linux-stable-c0737fa9a5a5cf5a053bcc983f72d58919b997c6.tar.bz2 linux-stable-c0737fa9a5a5cf5a053bcc983f72d58919b997c6.zip |
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: 10c873334feba ("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>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index cb719a53b8bd..5c95755619e2 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7208,6 +7208,7 @@ static int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags) mask |= EPOLLEXCLUSIVE; if (req->flags & REQ_F_POLLED) { apoll = req->apoll; + kfree(apoll->double_poll); } else if (!(issue_flags & IO_URING_F_UNLOCKED) && !list_empty(&ctx->apoll_cache)) { apoll = list_first_entry(&ctx->apoll_cache, struct async_poll, |