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 58B713EDE71; Tue, 12 May 2026 17:59:25 +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=1778608765; cv=none; b=hu++N1arHA6oYNr32RmDjrpE9kAkBXsSI9nuszKXXxs9QHAn7/P881puXa//0cqo6zkFMitHwGlFtgNNOKtopgiJ5dEaExvZ2TA7Ga9i0UBRXrZM9ti1hvlj0JIZMFB4HzU+uCWETq6LgHkg4/zgoPeccoS3hoYm/V13uJy9hyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778608765; c=relaxed/simple; bh=7mFRZ9CeyOIOI6S9oNO3nzkH7CcbXDkCGFPbE9VBPzM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RUfyJIfvOjwuFqMKXx3LcSuDqQRtqJLgq3e0JPkLCvGgjEbUdvzGVOS2pM9JrdY99XokGX7QoPgc4R/IoT4i3w+k9i3xQGFpr39Rc0PaIFmJw2uJH1WHMrMwboBXxlZzzygI7an9uLO9svqb2wbSWMpKtQnSVspDjwJzSS92tKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MSewTweP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MSewTweP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E25F5C2BCB0; Tue, 12 May 2026 17:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778608765; bh=7mFRZ9CeyOIOI6S9oNO3nzkH7CcbXDkCGFPbE9VBPzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSewTwePEiF8I8f6lbY5MiNCD3aRhymHQ2joidUCTTgyo/Qj9aPHLHlMZumqsiCCc pkqqYNLLnva9Fxu4C/q5njf3mrfeAm5pZMVos1KPsnj7O4P9wzcK8VUeX5o7Lwxwd6 QQLNMkX8wPOvxoU65qW1Objifmsa3eJ+wq3ugOgk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eelco Chaudron , Ilya Maximets , Aaron Conole , Paolo Abeni Subject: [PATCH 6.18 169/270] openvswitch: vport: fix self-deadlock on release of tunnel ports Date: Tue, 12 May 2026 19:39:30 +0200 Message-ID: <20260512173942.007002428@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512173938.452574370@linuxfoundation.org> References: <20260512173938.452574370@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilya Maximets commit aa69918bd418e700309fdd08509dba324fb24296 upstream. vports are used concurrently and protected by RCU, so netdev_put() must happen after the RCU grace period. So, either in an RCU call or after the synchronize_net(). The rtnl_delete_link() must happen under RTNL and so can't be executed in RCU context. Calling synchronize_net() while holding RTNL is not a good idea for performance and system stability under load in general, so calling netdev_put() in RCU call is the right solution here. However, when the device is deleted, rtnl_unlock() will call netdev_run_todo() and block until all the references are gone. In the current code this means that we never reach the call_rcu() and the vport is never freed and the reference is never released, causing a self-deadlock on device removal. Fix that by moving the rcu_call() before the rtnl_unlock(), so the scheduled RCU callback will be executed when synchronize_net() is called from the rtnl_unlock()->netdev_run_todo() while the RTNL itself is already released. Fixes: 6931d21f87bc ("openvswitch: defer tunnel netdev_put to RCU release") Cc: stable@vger.kernel.org Acked-by: Eelco Chaudron Signed-off-by: Ilya Maximets Acked-by: Aaron Conole Link: https://patch.msgid.link/20260430233848.440994-2-i.maximets@ovn.org Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/vport-netdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/net/openvswitch/vport-netdev.c +++ b/net/openvswitch/vport-netdev.c @@ -196,9 +196,13 @@ void ovs_netdev_tunnel_destroy(struct vp */ if (vport->dev->reg_state == NETREG_REGISTERED) rtnl_delete_link(vport->dev, 0, NULL); - rtnl_unlock(); + /* We can't put the device reference yet, since it can still be in + * use, but rtnl_unlock()->netdev_run_todo() will block until all + * the references are released, so the RCU call must be before it. + */ call_rcu(&vport->rcu, vport_netdev_free); + rtnl_unlock(); } EXPORT_SYMBOL_GPL(ovs_netdev_tunnel_destroy);