Re: [PATCH net-next] net: ipv4: clear dev->ip_ptr before destroying inetdev
From: Yuyang Huang <hidden>
Date: 2026-07-10 00:29:17
Also in:
lkml
On Fri, Jul 10, 2026 at 2:17 AM Ido Schimmel [off-list ref] wrote:
quoted hunk ↗ jump to hunk
On Tue, Jul 07, 2026 at 01:30:39PM +0900, Yuyang Huang wrote:quoted
To prevent RCU readers from accessing a partially destroyed in_device, clear dev->ip_ptr early in inetdev_destroy() before freeing the multicast list and individual IP addresses. This aligns the IPv4 teardown sequence with the IPv6 implementation. Cc: Ido Schimmel <idosch@nvidia.com> Cc: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Yuyang Huang <redacted>I believe that sashiko-gemini [1] is right and you need to teach prestera to ignore NETDEV_DOWN notifications in the inetaddr chain when a RIF doesn't exist. Something like [2]. Regarding ieee80211_ifa_changed(), the net device is being tore down, so failing to update the firmware ARP filter probably doesn't matter, but you can do something like [3] to avoid it completely. So, three patches where the last one aligns IPv4 with IPv6. Please check if other listeners need to be adjusted (mlxsw is OK). Thanks [1] https://sashiko.dev/#/patchset/20260707043039.101983-1-yuyanghuang%40google.com [2]diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/drivers/net/ethernet/marvell/prestera/prestera_router.c index b036b173a308..0c4f462baa6e 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_router.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c@@ -1302,10 +1302,8 @@ static int __prestera_inetaddr_port_event(struct net_device *port_dev, dev_hold(port_dev); break; case NETDEV_DOWN: - if (!re) { - NL_SET_ERR_MSG_MOD(extack, "Can't find RIF"); - return -EEXIST; - } + if (!re) + return 0; prestera_rif_entry_destroy(port->sw, re); dev_put(port_dev); break;[3]diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 90d295cc364f..0e7a60dd1d8d 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c@@ -588,9 +588,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, if (sdata->vif.type != NL80211_IFTYPE_STATION) return NOTIFY_DONE; - idev = __in_dev_get_rtnl(sdata->dev); - if (!idev) - return NOTIFY_DONE; + idev = ifa->ifa_dev; ifmgd = &sdata->u.mgd;
Thanks for the review comments; I will update prestera and ieee80211, as well as go through other listeners to confirm the sequence and send out stacked patches as suggested. Thanks, Yuyang