]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix iovec leaks
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 7 Feb 2020 19:04:45 +0000 (22:04 +0300)
committerJens Axboe <axboe@kernel.dk>
Sat, 8 Feb 2020 20:06:58 +0000 (13:06 -0700)
commitd441800435f1511165a6c68b91e54af6969e183e
tree167b32f1f290b3baaf13ff56f5d547e35141b5c1
parent9679779bee3c40c3690f495744f3cd63b494ce9d
io_uring: fix iovec leaks

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: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c