netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] flow_dissector: prevent NULL pointer dereference in __skb_flow_dissect
@ 2024-03-20 12:56 Anastasia Belova
  2024-03-20 13:38 ` Jiri Pirko
  0 siblings, 1 reply; 14+ messages in thread
From: Anastasia Belova @ 2024-03-20 12:56 UTC (permalink / raw)
  To: David S. Miller
  Cc: Anastasia Belova, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	netdev, linux-kernel, lvc-project

skb is an optional parameter, so it may be NULL.
Add check defore dereference in eth_hdr.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 67a900cc0436 ("flow_dissector: introduce support for Ethernet addresses")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 net/core/flow_dissector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 272f09251343..05db3a8aa771 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -1137,7 +1137,7 @@ bool __skb_flow_dissect(const struct net *net,
 		rcu_read_unlock();
 	}
 
-	if (dissector_uses_key(flow_dissector,
+	if (skb && dissector_uses_key(flow_dissector,
 			       FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
 		struct ethhdr *eth = eth_hdr(skb);
 		struct flow_dissector_key_eth_addrs *key_eth_addrs;
-- 
2.30.2


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

end of thread, other threads:[~2024-03-22 11:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20 12:56 [PATCH] flow_dissector: prevent NULL pointer dereference in __skb_flow_dissect Anastasia Belova
2024-03-20 13:38 ` Jiri Pirko
2024-03-20 13:43   ` Eric Dumazet
2024-03-20 13:54     ` Jiri Pirko
2024-03-21  9:36   ` Anastasia Belova
2024-03-21 10:57     ` Jiri Pirko
2024-03-21 11:39       ` Denis Kirjanov
2024-03-21 12:04       ` Anastasia Belova
2024-03-21 12:42         ` Jiri Pirko
2024-03-21 12:34   ` [PATCH v2] " Anastasia Belova
2024-03-21 12:52     ` Denis Kirjanov
2024-03-21 13:09     ` Jiri Pirko
2024-03-21 17:16     ` Eric Dumazet
2024-03-22 11:41       ` Simon Horman

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).