Message ID | 20220728013307.656257-1-william.xuanziyang@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 85f0173df35e5462d89947135a6a5599c6c3ef6f |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,v3] ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr | expand |
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba@kernel.org>: On Thu, 28 Jul 2022 09:33:07 +0800 you wrote: > Change net device's MTU to smaller than IPV6_MIN_MTU or unregister > device while matching route. That may trigger null-ptr-deref bug > for ip6_ptr probability as following. > > ========================================================= > BUG: KASAN: null-ptr-deref in find_match.part.0+0x70/0x134 > Read of size 4 at addr 0000000000000308 by task ping6/263 > > [...] Here is the summary with links: - [net,v3] ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr https://git.kernel.org/netdev/net/c/85f0173df35e You are awesome, thank you!
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index f7506f08e505..c04f359655b8 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -405,6 +405,9 @@ static inline bool ip6_ignore_linkdown(const struct net_device *dev) { const struct inet6_dev *idev = __in6_dev_get(dev); + if (unlikely(!idev)) + return true; + return !!idev->cnf.ignore_routes_with_linkdown; }