[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250115061820.4d6d03a9@kernel.org>
Date: Wed, 15 Jan 2025 06:18:20 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: <andrew+netdev@...n.ch>, <davem@...emloft.net>, <edumazet@...gle.com>,
<horms@...nel.org>, <jdamato@...tly.com>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>
Subject: Re: [PATCH net-next v2 02/11] net: make netdev_lock() protect
netdev->reg_state
On Wed, 15 Jan 2025 17:30:23 +0900 Kuniyuki Iwashima wrote:
> > @@ -10668,7 +10668,9 @@ int register_netdevice(struct net_device *dev)
> >
> > ret = netdev_register_kobject(dev);
> >
> > + netdev_lock(dev);
> > WRITE_ONCE(dev->reg_state, ret ? NETREG_UNREGISTERED : NETREG_REGISTERED);
> > + netdev_unlock(dev);
>
> Do we need the lock before list_netdevice() ?
Fair point, we don't. I couldn't decide whether it's more logical
to skip the locking since device is not listed, or lock it, just
because we say that @reg_state is supposed to be write protected.
Powered by blists - more mailing lists