OSDN Git Service

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)
commit99bc4c38537d774e667d043c520914082da19abf
tree167b32f1f290b3baaf13ff56f5d547e35141b5c1
parente96e977992d0ea40b6e70cb63dede85c9078e744
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