]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
io_uring: fix sporadic -EFAULT from IORING_OP_RECVMSG
authorJens Axboe <axboe@kernel.dk>
Sun, 15 Dec 2019 17:57:46 +0000 (10:57 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Dec 2019 05:12:47 +0000 (22:12 -0700)
commit0b416c3e1345fd696db4c422643468d844410877
tree0084779addbc4e9e6a5d3c190062fbebab41720a
parentd195a66e367b3d24fdd3c3565f37ab7c6882b9d2
io_uring: fix sporadic -EFAULT from IORING_OP_RECVMSG

If we have to punt the recvmsg to async context, we copy all the
context.  But since the iovec used can be either on-stack (if small) or
dynamically allocated, if it's on-stack, then we need to ensure we reset
the iov pointer. If we don't, then we're reusing old stack data, and
that can lead to -EFAULTs if things get overwritten.

Ensure we retain the right pointers for the iov, and free it as well if
we end up having to go beyond UIO_FASTIOV number of vectors.

Fixes: 03b1230ca12a ("io_uring: ensure async punted sendmsg/recvmsg requests copy data")
Reported-by: 李通洲 <carter.li@eoitek.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c