netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH net] net-gro: restore check for NULL skb in napi_gro_frags
@ 2023-08-02  9:23 edward.cree
  2023-08-02 10:22 ` Eric Dumazet
  2023-08-04 14:36 ` Tyler Stachecki
  0 siblings, 2 replies; 7+ messages in thread
From: edward.cree @ 2023-08-02  9:23 UTC (permalink / raw)
  To: davem, kuba, edumazet, pabeni; +Cc: Edward Cree, netdev, Martin Habets

From: Edward Cree <ecree.xilinx@gmail.com>

Cited commit removed the check on the grounds that napi_gro_frags must
 not be called by drivers if napi_get_frags failed.  But skb can also
 be NULL if napi_frags_skb fails to pull the ethernet header ("dropping
 impossible skb" message).  In this case return GRO_CONSUMED, as
 otherwise continuing on would cause a NULL dereference panic in
 dev_gro_receive().

Fixes: 1d11fa696733 ("net-gro: remove GRO_DROP")
Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
---
An sfc customer has encountered this panic in the wild; we're still
 investigating exactly how it happened (we have a reproducer) but it
 seems wise to have the core handle this check rather than requiring
 it in every driver.
---
 net/core/gro.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/gro.c b/net/core/gro.c
index 0759277dc14e..0159972038da 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -731,6 +731,9 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
 	gro_result_t ret;
 	struct sk_buff *skb = napi_frags_skb(napi);
 
+	if (!skb)
+		return GRO_CONSUMED;
+
 	trace_napi_gro_frags_entry(skb);
 
 	ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));

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

end of thread, other threads:[~2023-08-16 17:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02  9:23 [RFC PATCH net] net-gro: restore check for NULL skb in napi_gro_frags edward.cree
2023-08-02 10:22 ` Eric Dumazet
2023-08-16 17:46   ` Edward Cree
2023-08-16 17:59     ` Eric Dumazet
2023-08-04 14:36 ` Tyler Stachecki
2023-08-04 14:45   ` Eric Dumazet
2023-08-04 16:32     ` Tyler Stachecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).