From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4065A339863 for ; Tue, 24 Mar 2026 01:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316745; cv=none; b=k6gH+bPnlsJNkqEErQ3ChBx17N7vtKgfbATHAt/wv4ruKhVxcx0FlXT+moASvmUB/ZKGW17xIMbewT4rDp4qzY1aqEerJ7QNeQY1XN5ZLxwt7AVHGHR10RWE56iqOtwBEYd/IUq1hIFQPj9QeYtHshJR7gryzUVxMPRt67JEGto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774316745; c=relaxed/simple; bh=7197zyylyhbyfExzIW/Yxv7fatz1gEPm+HHyiIeHcdA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s4bT+/uSmUgpPvzapp67d/6YVflV5qeNmCDyGzByd4giEeTQyAmRJ143VEl5/4pRU7CLaieoMGSaTHmZKiNvYmgGKMfps8lUifvVtReDHhQt6fIINM1tP3L+niuJiZ10sKh25YusYWXBTZn4ce0Ivmb1QtYA3eYYpUVWhXBhwIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UTq3q854; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UTq3q854" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88CB8C4CEF7; Tue, 24 Mar 2026 01:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774316744; bh=7197zyylyhbyfExzIW/Yxv7fatz1gEPm+HHyiIeHcdA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UTq3q854RRIc87zQhIj1pUZ7fst8aGfaUlq52oEnIo74zy7wTpFyXXSS++6jKZmbc vL3F9gEd/uBk+VCWoGmTnJ7lUp2b1Rf5jfVcb2gzRyoIm0WczNqWk8QpPsfTLLL6c8 qr3IAiagmJPkZxv1396a2g+/JmwgiVI5p0tp98T4Q9qSXz5SK/KTr+ceneyxkhEGD4 uOcffa8mA5UOD6cQmJtHeOZtCa3S/jwLqAhhjNLgyHewrw56scu9hvIi6GydZzNLdD sP+Bg+jyYbYMIcdbekDnjG5zfYoHEN45ySi8LB+FAWCsBj4qBv+nJe1FrMD7BGA8Sr 9DbySAEhzVQnA== Date: Mon, 23 Mar 2026 18:45:43 -0700 From: Jakub Kicinski To: Antonio Quartulli Cc: netdev@vger.kernel.org, Hyunwoo Kim , Sabrina Dubroca , Paolo Abeni , Andrew Lunn , "David S. Miller" , Eric Dumazet Subject: Re: [PATCH net 1/1] ovpn: fix race between deleting interface and adding new peer Message-ID: <20260323184543.764a903e@kernel.org> In-Reply-To: <20260323184304.42c3930f@kernel.org> References: <20260320100351.2283994-1-antonio@openvpn.net> <20260320100351.2283994-2-antonio@openvpn.net> <20260323184304.42c3930f@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.