net: fix fraglist segmentation reference count leak
authorFlorian Westphal <fw@strlen.de>
Mon, 30 Mar 2020 16:51:29 +0000 (18:51 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Mar 2020 17:41:58 +0000 (10:41 -0700)
Xin Long says:
 On udp rx path udp_rcv_segment() may do segment where the frag skbs
 will get the header copied from the head skb in skb_segment_list()
 by calling __copy_skb_header(), which could overwrite the frag skbs'
 extensions by __skb_ext_copy() and cause a leak.

 This issue was found after loading esp_offload where a sec path ext
 is set in the skb.

Fix this by discarding head state of the fraglist skb before replacing
its contents.

Fixes: 3a1296a38d0cf62 ("net: Support GRO/GSO fraglist chaining.")
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Reported-by: Xiumei Mu <xmu@redhat.com>
Tested-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index e1101a4f90a6353038fac59de8a193c91c7d8874..bea447f38dcc804681371da6b6f88338a09d02ab 100644 (file)
@@ -3668,6 +3668,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
 
                skb_push(nskb, -skb_network_offset(nskb) + offset);
 
+               skb_release_head_state(nskb);
                 __copy_skb_header(nskb, skb);
 
                skb_headers_offset_update(nskb, skb_headroom(nskb) - skb_headroom(skb));