Forwarded: [syzbot] test WARN_ON for addrconf on unregistering devices

syzbot posted 1 patch 4 weeks, 1 day ago
net/ipv6/addrconf.c | 4 ++++
1 file changed, 4 insertions(+)
Forwarded: [syzbot] test WARN_ON for addrconf on unregistering devices
Posted by syzbot 4 weeks, 1 day ago
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [syzbot] test WARN_ON for addrconf on unregistering devices
Author: raoxu@uniontech.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci

From: Xu Rao <raoxu@uniontech.com>
Subject: [PATCH debug] ipv6: addrconf: warn on autoconf for unregistering devices

Add WARN_ON() checks where the proposed fix skips IPv6 autoconf on
unregistering devices.  This is a diagnostic patch to confirm whether
the syzbot reproducer reaches the MTU / UP / CHANGE paths after the
netdevice has entered NETREG_UNREGISTERING.

Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 net/ipv6/addrconf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5476b6536eb7..72a3b17d30a1 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3666,6 +3666,8 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
 		break;

 	case NETDEV_CHANGEMTU:
+		WARN_ON(dev->reg_state == NETREG_UNREGISTERING);
+
 		/* if MTU under IPV6_MIN_MTU stop IPv6 on this interface. */
 		if (dev->mtu < IPV6_MIN_MTU) {
 			addrconf_ifdown(dev, dev != net->loopback_dev);
@@ -3691,12 +3693,14 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
 		fallthrough;
 	case NETDEV_UP:
 	case NETDEV_CHANGE:
+		WARN_ON(dev->reg_state == NETREG_UNREGISTERING);
+
 		if (idev && idev->cnf.disable_ipv6)
 			break;

 		if (dev->priv_flags & IFF_NO_ADDRCONF) {
 			if (event == NETDEV_UP && !IS_ERR_OR_NULL(idev) &&
 			    dev->flags & IFF_UP && dev->flags & IFF_MULTICAST)
 				ipv6_mc_up(idev);
 			break;
 		}
--
2.50.1