Skip to content

Commit

Permalink
io_uring/rsrc: check size when importing reg buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Mar 31, 2025
1 parent ed34451 commit a1fbe0a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,8 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
/* not inside the mapped region */
if (unlikely(buf_addr < imu->ubuf || buf_end > (imu->ubuf + imu->len)))
return -EFAULT;
if (unlikely(len > MAX_RW_COUNT))
return -EFAULT;
if (!(imu->dir & (1 << ddir)))
return -EFAULT;

Expand Down

0 comments on commit a1fbe0a

Please sign in to comment.