io_uring/rsrc: disallow multi-source reg buffers
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 6 Mar 2023 20:21:40 +0000 (13:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:40:04 +0000 (09:40 +0100)
commitdde0d0dfbde23974d7449c04ef2fb8814d09deef
treeab13f01005c6dacdcd5743e4d0b9b9231c6894b9
parentabd54d87dabae7e50492f6ce1199a7ddadbbcaf8
io_uring/rsrc: disallow multi-source reg buffers

commit edd478269640b360c6f301f2baa04abdda563ef3 upstream.

If two or more mappings go back to back to each other they can be passed
into io_uring to be registered as a single registered buffer. That would
even work if mappings came from different sources, e.g. it's possible to
mix in this way anon pages and pages from shmem or hugetlb. That is not
a problem but it'd rather be less prone if we forbid such mixing.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c