Thread (11 messages) flat view 11 messages, 6 authors, 2026-03-19

Re: [PATCH net v2] ipv6: sr: Add NULL check for idev in seg6_hmac_validate_skb

From: Andrea Mayer <andrea.mayer@uniroma2.it>
Date: 2026-03-14 22:50:33
Also in: lkml

On Fri, 13 Mar 2026 10:26:34 +0800
Minhong He [off-list ref] wrote:
In seg6_hmac_validate_skb(), the pointer returned by __in6_dev_get()
can be NULL if the network device lacks proper IPv6 initialization
or is being torn down. Add a NULL check to avoid potential NULL pointer
dereference in subsequent code.

Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
Signed-off-by: Minhong He <redacted>
---
 net/ipv6/seg6_hmac.c | 2 ++
 1 file changed, 2 insertions(+)
Hi Minhong,
Do you have a crash log or a way to reproduce this?

Thanks,
Andrea

quoted hunk ↗ jump to hunk
diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
index ee6bac0160ac..e6964c6b0d38 100644
--- a/net/ipv6/seg6_hmac.c
+++ b/net/ipv6/seg6_hmac.c
@@ -184,6 +184,8 @@ bool seg6_hmac_validate_skb(struct sk_buff *skb)
 	int require_hmac;
 
 	idev = __in6_dev_get(skb->dev);
+	if (!idev)
+		return false;
 
 	srh = (struct ipv6_sr_hdr *)skb_transport_header(skb);
 
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help