• Pavel Begunkov's avatar
    io_uring: fix iovec leaks · 99bc4c38
    Pavel Begunkov authored
    Allocated iovec is freed only in io_{read,write,send,recv)(), and just
    leaves it if an error occured. There are plenty of such cases:
    - cancellation of non-head requests
    - fail grabbing files in __io_queue_sqe()
    - set REQ_F_NOWAIT and returning in __io_queue_sqe()
    
    Add REQ_F_NEED_CLEANUP, which will force such requests with custom
    allocated resourses go through cleanup handlers on put.
    
    Cc: stable@vger.kernel.org # 5.5
    Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    99bc4c38
io_uring.c 167 KB