[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z4brx7KmFkSAylkR@LQ3V64L9R2>
Date: Tue, 14 Jan 2025 14:57:11 -0800
From: Joe Damato <jdamato@...tly.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org
Subject: Re: [PATCH net-next 03/11] net: make netdev_lock() protect
netdev->reg_state
On Mon, Jan 13, 2025 at 07:51:09PM -0800, Jakub Kicinski wrote:
> Protect writes to netdev->reg_state with netdev_lock().
> From now on holding netdev_lock() is sufficient to prevent
> the net_device from getting unregistered, so code which
> wants to hold just a single netdev around no longer needs
> to hold rtnl_lock.
>
> We do not protect the NETREG_UNREGISTERED -> NETREG_RELEASED
> transition. We'd need to move mutex_destroy(netdev->lock)
> to .release, but the real reason is that trying to stop
> the unregistration process mid-way would be unsafe / crazy.
> Taking references on such devices is not safe, either.
> So the intended semantics are to lock REGISTERED devices.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> include/linux/netdevice.h | 2 +-
> net/core/dev.c | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Joe Damato <jdamato@...tly.com>
Powered by blists - more mailing lists