• Jens Axboe's avatar
    io_uring/kbuf: defer release of mapped buffer rings · c392cbec
    Jens Axboe authored
    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: c56e022c ("io_uring: add support for user mapped provided buffer ring")
    Reported-by: default avatarJann Horn <jannh@google.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    c392cbec
kbuf.h 3.87 KB