[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29ffd5ac-07b1-4424-ad3f-8304a28d2946@I-love.SAKURA.ne.jp>
Date: Sun, 25 Jan 2026 20:21:08 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: Ido Schimmel <idosch@...dia.com>, Jiri Pirko <jiri@...nulli.us>
Cc: Breno Leitao <leitao@...ian.org>, "David S. Miller"
<davem@...emloft.net>,
David Ahern <dsahern@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH] ipv4: don't call inetdev_init() if device is no longer
registered
On 2026/01/25 17:58, Ido Schimmel wrote:
> Thanks for the report and fix. You can reproduce with [1], but the
> proposed fix doesn't help. Problem is that NETDEV_UNREGISTER is first
> caught by inetdev_event(), which calls inetdev_destroy(), but then the
> team driver restores dummy1's MTU and initializes the idev again.
Thank you for the reproducer. I thought the proposed patch can prevent
the idev from initializing again, but your reproducer showed that it can't
because dev->reg_state == NETREG_REGISTERED.
We would need to update team driver side not to trigger dev_set_mtu().
Below diff passed the reproducer, but I don't know whether it is safe
to trigger dev_set_mtu() for team_uninit() and team_del_slave() and
the err_port_enter: label of team_port_add()...
drivers/net/team/team_core.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index c08a5c1bd6e4..30c89490545a 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -1292,7 +1292,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
static void __team_port_change_port_removed(struct team_port *port);
-static int team_port_del(struct team *team, struct net_device *port_dev)
+static int team_port_del(struct team *team, struct net_device *port_dev, bool no_restore)
{
struct net_device *dev = team->dev;
struct team_port *port;
@@ -1330,7 +1330,8 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
__team_port_change_port_removed(port);
team_port_set_orig_dev_addr(port);
- dev_set_mtu(port_dev, port->orig.mtu);
+ if (!no_restore)
+ dev_set_mtu(port_dev, port->orig.mtu);
kfree_rcu(port, rcu);
netdev_info(dev, "Port device %s removed\n", portname);
netdev_compute_master_upper_features(team->dev, true);
@@ -1634,7 +1635,7 @@ static void team_uninit(struct net_device *dev)
ASSERT_RTNL();
list_for_each_entry_safe(port, tmp, &team->port_list, list)
- team_port_del(team, port->dev);
+ team_port_del(team, port->dev, false);
__team_change_mode(team, NULL); /* cleanup */
__team_options_unregister(team, team_options, ARRAY_SIZE(team_options));
@@ -1933,7 +1934,16 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev)
ASSERT_RTNL();
- return team_port_del(team, port_dev);
+ return team_port_del(team, port_dev, false);
+}
+
+static int team_del_slave_no_restore(struct net_device *dev, struct net_device *port_dev)
+{
+ struct team *team = netdev_priv(dev);
+
+ ASSERT_RTNL();
+
+ return team_port_del(team, port_dev, true);
}
static netdev_features_t team_fix_features(struct net_device *dev,
@@ -2926,7 +2936,7 @@ static int team_device_event(struct notifier_block *unused,
!!netif_oper_up(port->dev));
break;
case NETDEV_UNREGISTER:
- team_del_slave(port->team->dev, dev);
+ team_del_slave_no_restore(port->team->dev, dev);
break;
case NETDEV_FEAT_CHANGE:
if (!port->team->notifier_ctx) {
Powered by blists - more mailing lists