io_uring: free iovec if file assignment fails
authorJens Axboe <axboe@kernel.dk>
Sun, 17 Apr 2022 03:14:00 +0000 (21:14 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Apr 2022 12:41:12 +0000 (14:41 +0200)
commit74ffeba57d9ae5c67113ccfd65a7264cc439d09e
tree52940d3608c8f14d9cfb3f74f9dfdb986a556a30
parent71175f2107deac62f7fd470833248be42c3b8a23
io_uring: free iovec if file assignment fails

[ Upstream commit 323b190ba2debbcc03c01d2edaf1ec6b43e6ae43 ]

We just return failure in this case, but we need to release the iovec
first. If we're doing IO with more than FAST_IOV segments, then the
iovec is allocated and must be freed.

Reported-by: syzbot+96b43810dfe9c3bb95ed@syzkaller.appspotmail.com
Fixes: 584b0180f0f4 ("io_uring: move read/write file prep state into actual opcode handler")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c