Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/memmap: explicitly return -EFAULT for mmap on NULL rings

The later mapping will actually check this too, but in terms of code
clarify, explicitly check for whether or not the rings and sqes are
valid during validation. That makes it explicit that if they are
non-NULL, they are valid and can get mapped.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+4
+4
io_uring/memmap.c
··· 204 204 /* Don't allow mmap if the ring was setup without it */ 205 205 if (ctx->flags & IORING_SETUP_NO_MMAP) 206 206 return ERR_PTR(-EINVAL); 207 + if (!ctx->rings) 208 + return ERR_PTR(-EFAULT); 207 209 return ctx->rings; 208 210 case IORING_OFF_SQES: 209 211 /* Don't allow mmap if the ring was setup without it */ 210 212 if (ctx->flags & IORING_SETUP_NO_MMAP) 211 213 return ERR_PTR(-EINVAL); 214 + if (!ctx->sq_sqes) 215 + return ERR_PTR(-EFAULT); 212 216 return ctx->sq_sqes; 213 217 case IORING_OFF_PBUF_RING: { 214 218 struct io_buffer_list *bl;