Subject: Re: [PATCH net 1/1] ovpn: fix race between deleting interface and adding new peer

From: Jakub Kicinski <[email-masked]>
Date: Mon, 23 Mar 2026 18:45:43 -0700

On Mon, 23 Mar 2026 18:43:04 -0700 Jakub Kicinski wrote:
> On Fri, 20 Mar 2026 11:03:51 +0100 Antonio Quartulli wrote:
> > While deleting an existing ovpn interface, there is a very
> > narrow window where adding a new peer via netlink may cause
> > the netdevice to hang and prevent its unregistration.
> > 
> > It may happen during ovpn_dellink(), when all existing peers are
> > freed and the device is queued for deregistration, but a
> > CMD_PEER_NEW message comes in adding a new peer that takes again
> > a reference to the netdev.
> > 
> > At this point there is no way to release the device because we are
> > under the assumption that all peers were already released.
> > 
> > Fix the race condition by releasing all peers in ndo_uninit(),
> > when the netdevice has already been removed from the netdev
> > list and thus an incoming CMD_PEER_NEW cannot have any effect
> > anymore.
> > 
> > At this point ovpn_dellink() becomes empty and can just be
> > removed.  
> 
> This looks like a step in the right direction but AI points out that
> it's not enough:

On second thought I wonder if the fix will not be to move the flush
even later. So please fix the AI-reported issue in the same submission.