]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring/kbuf: use READ_ONCE() for userspace-mapped memory
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 4 Dec 2025 22:43:31 +0000 (15:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:36 +0000 (14:03 +0100)
commit0e777da54152fabd626828356f37505344c0ebb2
tree70355c602ec695b833113116baa2db945df563ba
parent6a960b58df612dec4ca8a85c53019b2bfb70f061
io_uring/kbuf: use READ_ONCE() for userspace-mapped memory

[ Upstream commit 78385c7299f7514697d196b3233a91bd5e485591 ]

The struct io_uring_buf elements in a buffer ring are in a memory region
accessible from userspace. A malicious/buggy userspace program could
therefore write to them at any time, so they should be accessed with
READ_ONCE() in the kernel. Commit 98b6fa62c84f ("io_uring/kbuf: always
use READ_ONCE() to read ring provided buffer lengths") already switched
the reads of the len field to READ_ONCE(). Do the same for bid and addr.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: c7fb19428d67 ("io_uring: add support for ring mapped supplied buffers")
Cc: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/kbuf.c