Skip to contentSkip to conversation

net: fix fraglist segmentation reference count leak

PATCH In review Florian Westphal 3 participants 3 messages Mar 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix fraglist segmentation reference count leak

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 <[email protected]>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)
net/core/skbuff.c +1 -0
index e1101a4f90a6..bea447f38dcc 100644
@@ -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));
Signature · 1 line
2.24.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Florian Westphal

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.

Quoted 8 lines

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 <[email protected]>
maintainer
#2 lore raw
In reply to Florian Westphal

From: Florian Westphal <[email protected]>
Date: Mon, 30 Mar 2020 18:51:29 +0200

Quoted 9 lines

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.

Quoted 8 lines

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 <[email protected]>

Applied and queued up for v5.6 -stable, thanks.