{"id":2230344,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230344/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/20260429151756.4157670-2-i.maximets@ovn.org/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/1.1/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs"},"msgid":"<20260429151756.4157670-2-i.maximets@ovn.org>","date":"2026-04-29T15:16:36","name":"[ovs-dev,net,1/2] openvswitch: vport: fix self-deadlock on release of tunnel ports","commit_ref":null,"pull_url":null,"state":"handled-elsewhere","archived":false,"hash":"57dfc576a267b0224ba92f1c523a39cbc024d30a","submitter":{"id":76798,"url":"http://patchwork.ozlabs.org/api/1.1/people/76798/?format=json","name":"Ilya Maximets","email":"i.maximets@ovn.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/20260429151756.4157670-2-i.maximets@ovn.org/mbox/","series":[{"id":502094,"url":"http://patchwork.ozlabs.org/api/1.1/series/502094/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=502094","date":"2026-04-29T15:16:35","name":"openvswitch: fix self-deadlock on release of tunnel vports","version":1,"mbox":"http://patchwork.ozlabs.org/series/502094/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230344/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230344/checks/","tags":{},"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp3.osuosl.org;\n dmarc=none (p=none dis=none) header.from=ovn.org"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5LXm0Dhrz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 01:18:15 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id CBD3F4241D;\n\tWed, 29 Apr 2026 15:18:13 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id vxDJIJpNYMoC; Wed, 29 Apr 2026 15:18:12 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id D6E1542415;\n\tWed, 29 Apr 2026 15:18:11 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id BCBCCC058F;\n\tWed, 29 Apr 2026 15:18:11 +0000 (UTC)","from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id DB27FC04FA\n for <dev@openvswitch.org>; Wed, 29 Apr 2026 15:18:10 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id C104D61631\n for <dev@openvswitch.org>; Wed, 29 Apr 2026 15:18:10 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 3qxLsYsqcvJI for <dev@openvswitch.org>;\n Wed, 29 Apr 2026 15:18:10 +0000 (UTC)","from mail-wm1-f65.google.com (mail-wm1-f65.google.com\n [209.85.128.65])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 8A3E46162D\n for <dev@openvswitch.org>; Wed, 29 Apr 2026 15:18:09 +0000 (UTC)","by mail-wm1-f65.google.com with SMTP id\n 5b1f17b1804b1-483487335c2so125692705e9.2\n for <dev@openvswitch.org>; Wed, 29 Apr 2026 08:18:09 -0700 (PDT)","from im-t490s.redhat.com (89-24-32-159.nat.epc.tmcz.cz.\n [89.24.32.159]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a7c2d3811sm32358165e9.3.2026.04.29.08.18.06\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 08:18:06 -0700 (PDT)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections -\n client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org D6E1542415","OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8A3E46162D"],"Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.65;\n helo=mail-wm1-f65.google.com; envelope-from=i.maximets.ovn@gmail.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp3.osuosl.org 8A3E46162D","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777475887; x=1778080687;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=wI/PIcTVy7eu/PfacjAoItlkhWbBUZ77v7uqcA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YKF4LoY1u5Hwfy/AXJ5tZpkk4UsrcjLGtyRM1HbF/niZtwM4CTiOvWs8K+C5VVQmw==","X-Received":"by 2002:a05:600c:1396:b0:48a:5565:ec3d with SMTP id\n 5b1f17b1804b1-48a77b1b85fmr132416975e9.22.1777475887157;\n Wed, 29 Apr 2026 08:18:07 -0700 (PDT)","From":"Ilya Maximets <i.maximets@ovn.org>","To":"netdev@vger.kernel.org","Date":"Wed, 29 Apr 2026 17:16:36 +0200","Message-ID":"<20260429151756.4157670-2-i.maximets@ovn.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260429151756.4157670-1-i.maximets@ovn.org>","References":"<20260429151756.4157670-1-i.maximets@ovn.org>","MIME-Version":"1.0","Subject":"[ovs-dev] [PATCH net 1/2] openvswitch: vport: fix self-deadlock on\n release of tunnel ports","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Cc":"dev@openvswitch.org, linux-kselftest@vger.kernel.org,\n Yuan Tan <tanyuan98@outlook.com>, linux-kernel@vger.kernel.org,\n Ilya Maximets <i.maximets@ovn.org>, Yang Yang <n05ec@lzu.edu.cn>,\n Eric Dumazet <edumazet@google.com>, stable@vger.kernel.org,\n Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>,\n Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,\n \"David S. Miller\" <davem@davemloft.net>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"},"content":"vports are used concurrently and protected by RCU, so netdev_put()\nmust happen after the RCU grace period.  So, either in an RCU call or\nafter the synchronize_net().  The rtnl_delete_link() must happen under\nRTNL and so can't be executed in RCU context.  Calling synchronize_net()\nwhile holding RTNL is not a good idea for performance and system\nstability under load in general, so calling netdev_put() in RCU call\nis the right solution here.\n\nHowever,\nwhen the device is deleted, rtnl_unlock() will call netdev_run_todo()\nand block until all the references are gone.  In the current code this\nmeans that we never reach the call_rcu() and the vport is never freed\nand the reference is never released, causing a self-deadlock on device\nremoval.\n\nFix that by moving the rcu_call() before the rtnl_unlock(), so the\nscheduled RCU callback will be executed when synchronize_net() is\ncalled from the rtnl_unlock()->netdev_run_todo() while the RTNL itself\nis already released.\n\nFixes: 6931d21f87bc (\"openvswitch: defer tunnel netdev_put to RCU release\")\nCc: stable@vger.kernel.org\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>\n---\n net/openvswitch/vport-netdev.c | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)","diff":"diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c\nindex 12055af832dc0..a1df551e915bc 100644\n--- a/net/openvswitch/vport-netdev.c\n+++ b/net/openvswitch/vport-netdev.c\n@@ -196,9 +196,13 @@ void ovs_netdev_tunnel_destroy(struct vport *vport)\n \t */\n \tif (vport->dev->reg_state == NETREG_REGISTERED)\n \t\trtnl_delete_link(vport->dev, 0, NULL);\n-\trtnl_unlock();\n \n+\t/* We can't put the device reference yet, since it can still be in\n+\t * use, but rtnl_unlock()->netdev_run_todo() will block until all\n+\t * the references are released, so the RCU call must be before it.\n+\t */\n \tcall_rcu(&vport->rcu, vport_netdev_free);\n+\trtnl_unlock();\n }\n EXPORT_SYMBOL_GPL(ovs_netdev_tunnel_destroy);\n \n","prefixes":["ovs-dev","net","1/2"]}