io_uring/rsrc: disallow multi-source reg buffers
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 22 Feb 2023 14:36:48 +0000 (14:36 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:04 +0000 (09:34 +0100)
commit68f703ad03552816acd10ce2b9bc192094df044e
tree5e40a64ad0283db0a713327a3b58fad55a9b926b
parentd9399e543062251cc6102e7e5d80f3bd79115316
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/rsrc.c