From: Herbert Xu Date: Wed, 20 Apr 2005 05:48:59 +0000 (-0700) Subject: [IPSEC]: COW skb header in UDP decap X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d78b6c78ae6d87e4c1c8072f42efa716f04afb9;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [IPSEC]: COW skb header in UDP decap The following patch just makes the header part of the skb writeable. This is needed since we modify the IP headers just a few lines below. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6baddfbedca3..8a213238f287 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -955,6 +955,8 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) * header and optional ESP marker bytes) and then modify the * protocol to ESP, and then call into the transform receiver. */ + if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) + return 0; /* Now we can update and verify the packet length... */ iph = skb->nh.iph;