public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: gro: set the last skb->next to NULL when it get merged
@ 2021-10-26 13:18 kerneljasonxing
  2021-10-27  7:23 ` Jason Xing
  2021-10-27 19:20 ` Eric Dumazet
  0 siblings, 2 replies; 9+ messages in thread
From: kerneljasonxing @ 2021-10-26 13:18 UTC (permalink / raw)
  To: davem, kuba, alobakin, jonathan.lemon, willemb, pabeni, vvs,
	cong.wang
  Cc: netdev, linux-kernel, kerneljasonxing, Jason Xing

From: Jason Xing <xingwanli@kuaishou.com>

Setting the @next of the last skb to NULL to prevent the panic in future
when someone does something to the last of the gro list but its @next is
invalid.

For example, without the fix (commit: ece23711dd95), a panic could happen
with the clsact loaded when skb is redirected and then validated in
validate_xmit_skb_list() which could access the error addr of the @next
of the last skb. Thus, "general protection fault" would appear after that.

Signed-off-by: Jason Xing <xingwanli@kuaishou.com>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2170bea..7b248f1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4396,6 +4396,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
 		skb_shinfo(p)->frag_list = skb;
 	else
 		NAPI_GRO_CB(p)->last->next = skb;
+	skb->next = NULL;
 	NAPI_GRO_CB(p)->last = skb;
 	__skb_header_release(skb);
 	lp = p;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-27 19:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 13:18 [PATCH net] net: gro: set the last skb->next to NULL when it get merged kerneljasonxing
2021-10-27  7:23 ` Jason Xing
2021-10-27  8:07   ` Jason Xing
2021-10-27  8:56     ` Jason Xing
2021-10-27 12:40       ` Yunsheng Lin
2021-10-27 12:54         ` Jason Xing
2021-10-27 13:57           ` Jason Xing
2021-10-27 19:25     ` Eric Dumazet
2021-10-27 19:20 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox