Skip to content

Commit a1fbe0a

Browse files
isilenceaxboe
authored andcommitted
io_uring/rsrc: check size when importing reg buffer
We're relying on callers to verify the IO size, do it inside of io_import_fixed() instead. It's safer, easier to deal with, and more consistent as now it's done close to the iter init site. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/f9c2c75ec4d356a0c61289073f68d98e8a9db190.1743446271.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ed34451 commit a1fbe0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/rsrc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,8 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
10161016
/* not inside the mapped region */
10171017
if (unlikely(buf_addr < imu->ubuf || buf_end > (imu->ubuf + imu->len)))
10181018
return -EFAULT;
1019+
if (unlikely(len > MAX_RW_COUNT))
1020+
return -EFAULT;
10191021
if (!(imu->dir & (1 << ddir)))
10201022
return -EFAULT;
10211023

0 commit comments

Comments
 (0)