]> git.baikalelectronics.ru Git - kernel.git/commit
ptr_ring: use kmalloc_array()
authorEric Dumazet <edumazet@google.com>
Wed, 16 Aug 2017 17:36:47 +0000 (10:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2017 23:28:47 +0000 (16:28 -0700)
commit15b56857121f4c99577e3f9487febee89f4e4240
treed6b6fc17c19f0df3e916e55726dee279c055deb6
parent33b93f6b9a028e86dd4d406f1eb5939654abb971
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: 6b7f9e897a1b ("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>
include/linux/ptr_ring.h
include/linux/skb_array.h