]> git.baikalelectronics.ru Git - kernel.git/commit
tun: Fix use-after-free on XDP_TX
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Fri, 13 Jul 2018 04:24:38 +0000 (13:24 +0900)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Jul 2018 20:38:29 +0000 (13:38 -0700)
commit374067d93b283bc8e57f61a6c980467f75018802
tree29bab783321200f51b5e37d0f6c22bb78c873890
parent67a6311a113f4c5ccf8cc667f40aa0809d335600
tun: Fix use-after-free on XDP_TX

On XDP_TX we need to free up the frame only when tun_xdp_tx() returns a
negative value. A positive value indicates that the packet is
successfully enqueued to the ptr_ring, so freeing the page causes
use-after-free.

Fixes: fa294a2aac19 ("xdp: change ndo_xdp_xmit API to support bulking")
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c