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: fortify io_pin_pages with a warning

We're a bit too frivolous with types of nr_pages arguments, converting
it to long and back to int, passing an unsigned int pointer as an int
pointer and so on. Shouldn't cause any problem but should be carefully
reviewed, but until then let's add a WARN_ON_ONCE check to be more
confident callers don't pass poorely checked arguents.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d48e0c097cbd90fb47acaddb6c247596510d8cfc.1731689588.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
68685fa2 56cec28d

+2
+2
io_uring/memmap.c
··· 140 140 nr_pages = end - start; 141 141 if (WARN_ON_ONCE(!nr_pages)) 142 142 return ERR_PTR(-EINVAL); 143 + if (WARN_ON_ONCE(nr_pages > INT_MAX)) 144 + return ERR_PTR(-EOVERFLOW); 143 145 144 146 pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL); 145 147 if (!pages)