From: Ben Pfaff Date: Fri, 9 Jan 2009 23:18:36 +0000 (-0800) Subject: vswitchd: Delete 'ifaces' pointer to interface when deleting interface. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2fe4be578083800dce3f6a927569c2d46b2a1a5;p=openvswitch 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. --- 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;