diff mbox series

[net-next] ipv6: fix NULL deref in ip6_rcv_core()

Message ID 20220413205653.1178458-1-eric.dumazet@gmail.com (mailing list archive)
State Accepted
Commit 0339d25a2807d913f5645b8d5e485640915f9702
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ipv6: fix NULL deref in ip6_rcv_core() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers warning 1 maintainers not CCed: yoshfuji@linux-ipv6.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Eric Dumazet April 13, 2022, 8:56 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

idev can be NULL, as the surrounding code suggests.

Fixes: 4daf841a2ef3 ("net: ipv6: add skb drop reasons to ip6_rcv_core()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Menglong Dong <imagedong@tencent.com>
Cc: Jiang Biao <benbjiang@tencent.com>
Cc: Hao Peng <flyingpeng@tencent.com>
---
 net/ipv6/ip6_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 15, 2022, 9:30 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 13 Apr 2022 13:56:53 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> idev can be NULL, as the surrounding code suggests.
> 
> Fixes: 4daf841a2ef3 ("net: ipv6: add skb drop reasons to ip6_rcv_core()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Menglong Dong <imagedong@tencent.com>
> Cc: Jiang Biao <benbjiang@tencent.com>
> Cc: Hao Peng <flyingpeng@tencent.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 126ae3aa67e1dc579bc0eecd21416e9d89dcbf08..0322cc86b84eaaed7529a4b65fdfba4c97a38375 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -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;
 	}