mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
ptr_ring: use kmalloc_array()
As found by syzkaller, malicious users can set whatever tx_queue_len
on a tun device and eventually crash the kernel.
Lets remove the ALIGN(XXX, SMP_CACHE_BYTES) thing since a small
ring buffer is not fast anyway.
Fixes: 2e0ab8ca83
("ptr_ring: array based FIFO for pointers")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
120e9dabaf
commit
81fbfe8ada
2 changed files with 7 additions and 5 deletions
|
@ -193,7 +193,8 @@ static inline int skb_array_resize(struct skb_array *a, int size, gfp_t gfp)
|
|||
}
|
||||
|
||||
static inline int skb_array_resize_multiple(struct skb_array **rings,
|
||||
int nrings, int size, gfp_t gfp)
|
||||
int nrings, unsigned int size,
|
||||
gfp_t gfp)
|
||||
{
|
||||
BUILD_BUG_ON(offsetof(struct skb_array, ring));
|
||||
return ptr_ring_resize_multiple((struct ptr_ring **)rings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue