From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795057802; b=Y+JU9SowtrmZCEmWw3KHvkkwUngR3ZrA9foLIQtZV+i6ecqLlXdaWGEH1cDV1X9GcQiV r6ctZf4WoM85StoiMEKIipKCJUw9mHriZkjDAP6jwO9Cp/4fN1kIKgxW1xDy1Wz31io/Y jh9Bcdfx+xGGtV73TuvCyk59QKt60NnCDIhReMJ0o0p5hjG/4sJm6OwnXY7qA3131DQcu 89ZzE6ZvaYRwc5O0MF525BFuG3MsNdavm6xJ25G4WRDtRBTZol3xp8wtYUJz7XnvmariB dOi2uItXkoQIbnFLmW8aSPV8Xwzulu/27KucIxZzoytMAKxVgJcUGH2rLZ78K7MXdmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795057802; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=MeMSGS4W+wxslU1/AFx4kaLn1aH4qU1gB5ND5xjpoEo=; b=3ffIWk9ngHJ+zlqozjXNrJ4V4pZLgSiUj9qvKdaUIc/QiWNoctfmCN53N8qMwUuSD9sR sTJl5X3E0Tzt5aO4ZD34CtjlA+FH6+Bsni91GWBSlH8JrlfwLd3yRXLhsk8fL2AB/27W+ yMFOYEgFWhETI2SsEGQQSlTSvRca5Mn3EcokZT5EKztzhmHkwIvkDzHVcQnzhbmsrQ2vq mV/5pByFqxY5VZtZVxV+I6c8DfpcKtlAwTDkHTUe1pOXZSsEEbfZ9l2/8ujVyCed4ElCS LQWSKLsYjaXoHfmURHE8QqYM6L+EBg6Zwi/KN+2iIABWlhB2BrgUAuNEqFX+39QBONQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="pLu/nNL6"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0667606A320; Thu, 19 Nov 2026 03:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=pLu/nNL6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DE811F000C4; Thu, 19 Nov 2026 03:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795057802; bh=MeMSGS4W+wxslU1/AFx4kaLn1aH4qU1gB5ND5xjpoEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pLu/nNL6QHdUAEZxP6GSONalGjkbQvyVCTNB6ajJLRhDru1ilKN3n/vmXQj4/8HLw lf0R/DxvyuBXPbc+C98CeZWxoTYX0mpfG24tH/+cETL2hEB8TbntAE9txsXpybp7wh 2w1SnX/cJK9W5zkOwXIilpBC8MbeJa9HeFClq+iw= 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 , Harshit Mogalapalli , Sasha Levin Subject: [PATCH 5.10 0222/1848] openvswitch: vport: fix self-deadlock on release of tunnel ports Date: Wed, 18 Nov 2026 15:37:40 +0100 Message-ID: <20261118145921.264000895@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118145911.150052362@linuxfoundation.org> References: <20261118145911.150052362@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilya Maximets [ Upstream commit aa69918bd418e700309fdd08509dba324fb24296 ] 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 (cherry picked from commit aa69918bd418e700309fdd08509dba324fb24296) [Harshit: Resolved minor conflicts because 5.10.y has one-argument rtnl_delete_link() call.] Signed-off-by: Harshit Mogalapalli Signed-off-by: Sasha Levin --- net/openvswitch/vport-netdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c index 8cbf787d1fcb6..ab8e4ebedd332 100644 --- a/net/openvswitch/vport-netdev.c +++ b/net/openvswitch/vport-netdev.c @@ -191,9 +191,13 @@ void ovs_netdev_tunnel_destroy(struct vport *vport) */ if (vport->dev->reg_state == NETREG_REGISTERED) rtnl_delete_link(vport->dev); - 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); -- 2.53.0