From c2fe4be578083800dce3f6a927569c2d46b2a1a5 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 9 Jan 2009 15:18:36 -0800 Subject: [PATCH] vswitchd: Delete 'ifaces' pointer to interface when deleting interface. Otherwise we dereference a dangling pointer to the interface when we look up the interface by datapath port index, causing a segfault. Introduced in commit 150ac45, "vswitchd: Eliminate "can't forward to bad port" when interfaces disappear," which deletes an interface that is known to be in the datapath port index table. --- vswitchd/bridge.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 78a83504..f4735c76 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2552,9 +2552,14 @@ iface_destroy(struct iface *iface) { if (iface) { struct port *port = iface->port; + struct bridge *br = port->bridge; bool del_active = port->active_iface == iface->port_ifidx; struct iface *del; + if (iface->dp_ifidx >= 0) { + port_array_set(&br->ifaces, iface->dp_ifidx, NULL); + } + del = port->ifaces[iface->port_ifidx] = port->ifaces[--port->n_ifaces]; del->port_ifidx = iface->port_ifidx; -- 2.30.2