Native tunnel translation calls tnl_port_send() and later
tnl_port_build_header().  Each function independently holds the tunnel
module lock.  If the port is removed after tnl_port_send() releases the
lock, tnl_port_build_header() no longer finds it and aborts the entire
ovs-vswitchd process.

This was observed during tunnel port reconfiguration in both PMD and
revalidator threads.

Return ENODEV instead.  The caller already converts build failures into
XLATE_TUNNEL_HEADER_BUILD_FAILED, dropping the affected output while
allowing ovs-vswitchd to continue.

Fixes: a36de779d739 ("openvswitch: Userspace tunneling.")

Assisted-by: GPT-5, OpenAI Codex
Signed-off-by: Tim Rozet <[email protected]>
---
 ofproto/tunnel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index d8a289548..97c1a4b70 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -753,7 +753,10 @@ tnl_port_build_header(const struct ofport_dpif *ofport,
 
     fat_rwlock_rdlock(&rwlock);
     tnl_port = tnl_find_ofport(ofport);
-    ovs_assert(tnl_port);
+    if (!tnl_port) {
+        fat_rwlock_unlock(&rwlock);
+        return ENODEV;
+    }
     res = netdev_build_header(tnl_port->netdev, data, params);
     fat_rwlock_unlock(&rwlock);
 
-- 
2.55.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to