diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-11-28 02:47:04 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-11-28 17:56:16 +0300 |
commit | c392cbecd8eca4c53f2bf508731257d9d0a21c2d (patch) | |
tree | 74054d568c3324dc69b65b037d9076466c2352af /include/linux | |
parent | edecf1689768452ba1a64b7aaf3a47a817da651a (diff) | |
download | linux-c392cbecd8eca4c53f2bf508731257d9d0a21c2d.tar.xz |
io_uring/kbuf: defer release of mapped buffer rings
If a provided buffer ring is setup with IOU_PBUF_RING_MMAP, then the
kernel allocates the memory for it and the application is expected to
mmap(2) this memory. However, io_uring uses remap_pfn_range() for this
operation, so we cannot rely on normal munmap/release on freeing them
for us.
Stash an io_buf_free entry away for each of these, if any, and provide
a helper to free them post ->release().
Cc: stable@vger.kernel.org
Fixes: c56e022c0a27 ("io_uring: add support for user mapped provided buffer ring")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/io_uring_types.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index d3009d56af0b..805bb635cdf5 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -340,6 +340,9 @@ struct io_ring_ctx { struct list_head io_buffers_cache; + /* deferred free list, protected by ->uring_lock */ + struct hlist_head io_buf_list; + /* Keep this last, we don't need it for the fast path */ struct wait_queue_head poll_wq; struct io_restriction restrictions; |