mirror of https://gitee.com/openkylin/linux.git
vxlan: Don't assume linear buffers in error handler
In commitc3a43b9fec
("vxlan: ICMP error lookup handler") I wrongly assumed buffers from icmp_socket_deliver() would be linear. This is not the case: icmp_socket_deliver() only guarantees we have 8 bytes of linear data. Eric fixed this same issue for fou and fou6 in commits26fc181e6c
("fou, fou6: do not assume linear skbs") and5355ed6388
("fou, fou6: avoid uninit-value in gue_err() and gue6_err()"). Use pskb_may_pull() instead of checking skb->len, and take into account the fact we later access the VXLAN header with udp_hdr(), so we also need to sum skb_transport_header() here. Reported-by: Guillaume Nault <gnault@redhat.com> Fixes:c3a43b9fec
("vxlan: ICMP error lookup handler") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
309b66970e
commit
8399a6930d
|
@ -1766,7 +1766,7 @@ static int vxlan_err_lookup(struct sock *sk, struct sk_buff *skb)
|
|||
struct vxlanhdr *hdr;
|
||||
__be32 vni;
|
||||
|
||||
if (skb->len < VXLAN_HLEN)
|
||||
if (!pskb_may_pull(skb, skb_transport_offset(skb) + VXLAN_HLEN))
|
||||
return -EINVAL;
|
||||
|
||||
hdr = vxlan_hdr(skb);
|
||||
|
|
Loading…
Reference in New Issue