aboutsummaryrefslogtreecommitdiff
path: root/net/xdp
diff options
context:
space:
mode:
authorGravatar Jakub Kicinski <kuba@kernel.org> 2023-10-12 16:17:46 -0700
committerGravatar Jakub Kicinski <kuba@kernel.org> 2023-10-12 17:07:34 -0700
commit0e6bb5b7f4c8e6665e76bdafce37ad4a8daf83c5 (patch)
tree6f71fc5628f01bcf9d2dc6eceb3000ee4e73c79a /net/xdp
parentnet: gso_test: fix build with gcc-12 and earlier (diff)
parentMerge tag 'net-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netd... (diff)
downloadlinux-0e6bb5b7f4c8e6665e76bdafce37ad4a8daf83c5.tar.gz
linux-0e6bb5b7f4c8e6665e76bdafce37ad4a8daf83c5.tar.bz2
linux-0e6bb5b7f4c8e6665e76bdafce37ad4a8daf83c5.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR. No conflicts. Adjacent changes: kernel/bpf/verifier.c 829955981c55 ("bpf: Fix verifier log for async callback return values") a923819fb2c5 ("bpf: Treat first argument as return value for bpf_throw") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/xdp')
-rw-r--r--net/xdp/xsk_queue.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/xdp/xsk_queue.c b/net/xdp/xsk_queue.c
index f8905400ee07..d2c264030017 100644
--- a/net/xdp/xsk_queue.c
+++ b/net/xdp/xsk_queue.c
@@ -34,6 +34,16 @@ struct xsk_queue *xskq_create(u32 nentries, bool umem_queue)
q->ring_mask = nentries - 1;
size = xskq_get_ring_size(q, umem_queue);
+
+ /* size which is overflowing or close to SIZE_MAX will become 0 in
+ * PAGE_ALIGN(), checking SIZE_MAX is enough due to the previous
+ * is_power_of_2(), the rest will be handled by vmalloc_user()
+ */
+ if (unlikely(size == SIZE_MAX)) {
+ kfree(q);
+ return NULL;
+ }
+
size = PAGE_ALIGN(size);
q->ring = vmalloc_user(size);