* [PATCH net] openvswitch: defer tunnel netdev_put to RCU release
@ 2026-03-19 7:42 Yang Yang
2026-03-19 11:03 ` Ilya Maximets
2026-03-21 1:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yang Yang @ 2026-03-19 7:42 UTC (permalink / raw)
To: aconole, echaudro, i.maximets
Cc: davem, edumazet, kuba, pabeni, horms, pshelar, tgraf, netdev, dev,
linux-kernel, yifanwucs, tomapufckgml, tanyuan98, bird, n05ec
ovs_netdev_tunnel_destroy() may run after NETDEV_UNREGISTER already
detached the device. Dropping the netdev reference in destroy can race
with concurrent readers that still observe vport->dev.
Do not release vport->dev in ovs_netdev_tunnel_destroy(). Instead, let
vport_netdev_free() drop the reference from the RCU callback, matching
the non-tunnel destroy path and avoiding additional synchronization
under RTNL.
Fixes: a9020fde67a6 ("openvswitch: Move tunnel destroy function to oppenvswitch module.")
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Tested-by: Ao Zhou <n05ec@lzu.edu.cn>
Co-developed-by: Yuan Tan <tanyuan98@outlook.com>
Signed-off-by: Yuan Tan <tanyuan98@outlook.com>
Suggested-by: Xin Liu <bird@lzu.edu.cn>
Signed-off-by: Yang Yang <n05ec@lzu.edu.cn>
---
net/openvswitch/vport-netdev.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 6574f9bcdc026..44dbe8a9b0778 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -189,8 +189,6 @@ void ovs_netdev_tunnel_destroy(struct vport *vport)
*/
if (vport->dev->reg_state == NETREG_REGISTERED)
rtnl_delete_link(vport->dev, 0, NULL);
- netdev_put(vport->dev, &vport->dev_tracker);
- vport->dev = NULL;
rtnl_unlock();
call_rcu(&vport->rcu, vport_netdev_free);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] openvswitch: defer tunnel netdev_put to RCU release
2026-03-19 7:42 [PATCH net] openvswitch: defer tunnel netdev_put to RCU release Yang Yang
@ 2026-03-19 11:03 ` Ilya Maximets
2026-03-21 1:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Ilya Maximets @ 2026-03-19 11:03 UTC (permalink / raw)
To: Yang Yang, aconole, echaudro
Cc: i.maximets, davem, edumazet, kuba, pabeni, horms, tgraf, netdev,
dev, linux-kernel, yifanwucs, tomapufckgml, tanyuan98, bird
On 3/19/26 8:42 AM, Yang Yang wrote:
> ovs_netdev_tunnel_destroy() may run after NETDEV_UNREGISTER already
> detached the device. Dropping the netdev reference in destroy can race
> with concurrent readers that still observe vport->dev.
>
> Do not release vport->dev in ovs_netdev_tunnel_destroy(). Instead, let
> vport_netdev_free() drop the reference from the RCU callback, matching
> the non-tunnel destroy path and avoiding additional synchronization
> under RTNL.
>
> Fixes: a9020fde67a6 ("openvswitch: Move tunnel destroy function to oppenvswitch module.")
> Reported-by: Yifan Wu <yifanwucs@gmail.com>
> Reported-by: Juefei Pu <tomapufckgml@gmail.com>
> Tested-by: Ao Zhou <n05ec@lzu.edu.cn>
> Co-developed-by: Yuan Tan <tanyuan98@outlook.com>
> Signed-off-by: Yuan Tan <tanyuan98@outlook.com>
> Suggested-by: Xin Liu <bird@lzu.edu.cn>
> Signed-off-by: Yang Yang <n05ec@lzu.edu.cn>
> ---
>
> net/openvswitch/vport-netdev.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
> index 6574f9bcdc026..44dbe8a9b0778 100644
> --- a/net/openvswitch/vport-netdev.c
> +++ b/net/openvswitch/vport-netdev.c
> @@ -189,8 +189,6 @@ void ovs_netdev_tunnel_destroy(struct vport *vport)
> */
> if (vport->dev->reg_state == NETREG_REGISTERED)
> rtnl_delete_link(vport->dev, 0, NULL);
> - netdev_put(vport->dev, &vport->dev_tracker);
> - vport->dev = NULL;
> rtnl_unlock();
>
> call_rcu(&vport->rcu, vport_netdev_free);
This should solve the issue indeed. I ran OVS testsuite with
this as well, and it works fine. Thanks!
Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] openvswitch: defer tunnel netdev_put to RCU release
2026-03-19 7:42 [PATCH net] openvswitch: defer tunnel netdev_put to RCU release Yang Yang
2026-03-19 11:03 ` Ilya Maximets
@ 2026-03-21 1:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-21 1:40 UTC (permalink / raw)
To: Yang Yang
Cc: aconole, echaudro, i.maximets, davem, edumazet, kuba, pabeni,
horms, pshelar, tgraf, netdev, dev, linux-kernel, yifanwucs,
tomapufckgml, tanyuan98, bird
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 19 Mar 2026 07:42:41 +0000 you wrote:
> ovs_netdev_tunnel_destroy() may run after NETDEV_UNREGISTER already
> detached the device. Dropping the netdev reference in destroy can race
> with concurrent readers that still observe vport->dev.
>
> Do not release vport->dev in ovs_netdev_tunnel_destroy(). Instead, let
> vport_netdev_free() drop the reference from the RCU callback, matching
> the non-tunnel destroy path and avoiding additional synchronization
> under RTNL.
>
> [...]
Here is the summary with links:
- [net] openvswitch: defer tunnel netdev_put to RCU release
https://git.kernel.org/netdev/net/c/6931d21f87bc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-21 1:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 7:42 [PATCH net] openvswitch: defer tunnel netdev_put to RCU release Yang Yang
2026-03-19 11:03 ` Ilya Maximets
2026-03-21 1:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox