OSDN Git Service

io_uring: fix double prep iovec leak
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 8 Feb 2020 10:28:02 +0000 (13:28 +0300)
committerJens Axboe <axboe@kernel.dk>
Sat, 8 Feb 2020 20:07:00 +0000 (13:07 -0700)
commit5f798beaf35d79355cbf18019c1993a84475a2c3
tree8330871ba880f98c2b34ad69248b0f0849f68b2a
parenta93b33312f63ef6d5997f45d6fdf4de84c5396cc
io_uring: fix double prep iovec leak

Requests may be prepared multiple times with ->io allocated (i.e. async
prepared). Preparation functions don't handle it and forget about
previously allocated resources. This may happen in case of:
- spurious defer_check
- non-head (i.e. async prepared) request executed in sync (via nxt).

Make the handlers check, whether they already allocated resources, which
is true IFF REQ_F_NEED_CLEANUP is set.

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