]> 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)
commite27ba219edebfc21654aefa8c790e337fdf5fbbb
tree167b32f1f290b3baaf13ff56f5d547e35141b5c1
parent4d13cd4099d0ce5fec1e37a8fc6dee5934a0e6cd
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