Skip to contentSkip to conversation

ipv6: fix NULL deref in ip6_rcv_core()

PATCH Applied Eric Dumazet 2 participants 2 messages Apr 13, 2022 – Apr 15, 2022

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

PATCH 1/1 ipv6: fix NULL deref in ip6_rcv_core()

From: Eric Dumazet <[email protected]>

idev can be NULL, as the surrounding code suggests.

Fixes 4daf841a2ef3 ("net: ipv6: add skb drop reasons to ip6_rcv_core()")
Cc Menglong Dong <[email protected]>
Cc Jiang Biao <[email protected]>
Cc Hao Peng <[email protected]>
---
 net/ipv6/ip6_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_input.c +1 -1
index 126ae3aa67e1dc579bc0eecd21416e9d89dcbf08..0322cc86b84eaaed7529a4b65fdfba4c97a38375 100644
@@ -166,7 +166,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL ||
 	    !idev || unlikely(idev->cnf.disable_ipv6)) {
 		__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
-		if (unlikely(idev->cnf.disable_ipv6))
+		if (idev && unlikely(idev->cnf.disable_ipv6))
 			SKB_DR_SET(reason, IPV6DISABLED);
 		goto drop;
 	}
Signature · 1 line
2.35.1.1178.g4f1659d476-goog
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Wed, 13 Apr 2022 13:56:53 -0700 you wrote:

From: Eric Dumazet <[email protected]>

idev can be NULL, as the surrounding code suggests.

Fixes 4daf841a2ef3 ("net: ipv6: add skb drop reasons to ip6_rcv_core()")
Cc Menglong Dong <[email protected]>
Cc Jiang Biao <[email protected]>
Cc Hao Peng <[email protected]>

[...]

Here is the summary with links:
- [net-next] ipv6: fix NULL deref in ip6_rcv_core()

    https://git.kernel.org/netdev/net-next/c/0339d25a2807

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html