Date: Thu, 19 Mar 2026 15:35:03 +0100 From: Sabrina Dubroca Message-ID: References: <20260317141916.437559-1-a@...2181...> MIME-Version: 1.0 In-Reply-To: <20260317141916.437559-1-a@...2181...> Subject: Re: [Openvpn-devel] [PATCH ovpn net] ovpn: fix race between deleting interface and adding new peer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline To: Antonio Quartulli Cc: openvpn-devel@lists.sourceforge.net, Antonio Quartulli , Hyunwoo Kim 2026-03-17, 15:19:16 +0100, Antonio Quartulli wrote: > From: Antonio Quartulli > > 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. > > Reported-by: Hyunwoo Kim > Closes: https://lore.kernel.org/netdev/aaVgJ16edTfQkYbx@...3012.../ > Suggested-by: Sabrina Dubroca > Fixes: 80747caef33d ("ovpn: introduce the ovpn_peer object") > Signed-off-by: Antonio Quartulli > --- > drivers/net/ovpn/main.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) Reviewed-by: Sabrina Dubroca Thanks. This issue probably got introduced when I made you move some stuff from the UNREGISTER notifier into deletion, during the initial review. -- Sabrina