diff options
author | Eric Dumazet <edumazet@google.com> | 2022-04-13 13:56:53 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-04-15 14:05:18 -0700 |
commit | 0339d25a2807d913f5645b8d5e485640915f9702 (patch) | |
tree | 6557f6bc38136f7d8f3651132fef7ca414cd951a /net | |
parent | c9a40d1c87e9b5c74b5ac73e81ed3d5be4d1b1af (diff) | |
download | linux-0339d25a2807d913f5645b8d5e485640915f9702.tar.bz2 |
ipv6: fix NULL deref in ip6_rcv_core()
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>
Link: https://lore.kernel.org/r/20220413205653.1178458-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6_input.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 126ae3aa67e1..0322cc86b84e 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; } |