]> git.baikalelectronics.ru Git - kernel.git/commit
net: ip_gre: fix possible use-after-free in erspan_rcv
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Sat, 6 Apr 2019 15:16:52 +0000 (17:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2019 23:16:47 +0000 (16:16 -0700)
commit592e61ba08845b83a6ba8187a54127dd1123ed42
tree02486e4add5ae9176d978eeacc6463f5c52e9897
parentb230714fdb1451824d8f0d53c4f1a8ee1ab870ab
net: ip_gre: fix possible use-after-free in erspan_rcv

erspan tunnels run __iptunnel_pull_header on received skbs to remove
gre and erspan headers. This can determine a possible use-after-free
accessing pkt_md pointer in erspan_rcv since the packet will be 'uncloned'
running pskb_expand_head if it is a cloned gso skb (e.g if the packet has
been sent though a veth device). Fix it resetting pkt_md pointer after
__iptunnel_pull_header

Fixes: c295d817e49d ("net: erspan: refactor existing erspan code")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c