[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iK_2YSXGU=A6RyyDHaHQg4-tFYjP+3u=uR0aJDn5EiyLA@mail.gmail.com>
Date: Tue, 14 Jan 2025 14:05:36 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, pabeni@...hat.com,
andrew+netdev@...n.ch, horms@...nel.org, jdamato@...tly.com
Subject: Re: [PATCH net-next 03/11] net: make netdev_lock() protect netdev->reg_state
On Tue, Jan 14, 2025 at 4:51 AM Jakub Kicinski <kuba@...nel.org> 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.
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists