summaryrefslogtreecommitdiff
path: root/io_uring/kbuf.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-11-28 02:47:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-08 10:52:20 +0300
commit7138ebbe65caf65f52b923d4ef819c77d04ea671 (patch)
tree424098a831f170c4ad9777c2ad05c87c1b8b1eee /io_uring/kbuf.h
parent4ca5f54af7d3b60613991b201223c2dc6ebdf1c8 (diff)
downloadlinux-7138ebbe65caf65f52b923d4ef819c77d04ea671.tar.xz
io_uring/kbuf: defer release of mapped buffer rings
commit c392cbecd8eca4c53f2bf508731257d9d0a21c2d upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring/kbuf.h')
-rw-r--r--io_uring/kbuf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/kbuf.h b/io_uring/kbuf.h
index 274f8b7fb8ab..3d0cb6b8c1ed 100644
--- a/io_uring/kbuf.h
+++ b/io_uring/kbuf.h
@@ -54,6 +54,8 @@ int io_provide_buffers(struct io_kiocb *req, unsigned int issue_flags);
int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg);
int io_unregister_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg);
+void io_kbuf_mmap_list_free(struct io_ring_ctx *ctx);
+
unsigned int __io_put_kbuf(struct io_kiocb *req, unsigned issue_flags);
void io_kbuf_recycle_legacy(struct io_kiocb *req, unsigned issue_flags);