From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B619E26F288; Sat, 30 May 2026 17:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160520; cv=none; b=csnwoIJMYQxIGHfAJ3nwLFa+tzCck4iC0qObGK/OngHz7ykbiOvk3sx8ymQc3xaYTir3g6hT7NIeRLg42oYGGrNEHhXFHNCadnetoLrccPaNRKR/DE5fk/K36TzxQO9aNtH6IHWmDc4IHtTike7r+qruCdWpnxEqz0Y5jQSuZj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160520; c=relaxed/simple; bh=iu9Rc1PXsqL+YudGhKC5sMWkiYe7HQJr/vrtkRG7/XI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lktOmBVxyi+lEyyWeSar7D3dp2uUEkIQbhZyt7ZskeKpt+f9b5KepiaLvgJgqWX7yMwM3zciyJobr1BZXRfe8IpEZlCLA1nP1DRgZMcndAdyMZmC9H0RdgpwFILVgfV9J4Nx0TZK5DkFp4CZLxCpYIe9aAVPHOKXcmGOYNoKu8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TEYAnNpB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TEYAnNpB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0775F1F00893; Sat, 30 May 2026 17:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160519; bh=bi7IedU5yDQnGZkn0d+HCzbQG1R4Q/+0RVGalfaXfNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TEYAnNpBbp28qYFy3ILkFBsW8tYFMUN5aAqj09gLQ6dZZA+mBTxP0rvfhvu429uaC hPGWQi/yhregowpSU0J06kU/Fer7HRRuEXIkBWi1NTCh+kwvmlbKAu5AHKPzwOYqXz 68GeAr/fVQN51n9hD01ooVkaB67Q+1wWyuFN5fP4= 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.1 360/969] openvswitch: vport: fix self-deadlock on release of tunnel ports Date: Sat, 30 May 2026 17:58:04 +0200 Message-ID: <20260530160310.274695218@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@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.1-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 @@ -189,9 +189,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);