From: Ben Pfaff Date: Fri, 18 Mar 2011 17:56:28 +0000 (-0700) Subject: bridge: Always delete the correct interfaces in port_del_ifaces(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13f5f5b05ac13bc9614a63593a026ca7c19e4568;p=openvswitch bridge: Always delete the correct interfaces in port_del_ifaces(). This code was checking a name from cfg->interfaces[i] but using the result to decide whether to delete port->ifaces[i]. The two arrays aren't necessarily in the same order so this code could delete the wrong iface. Found by inspection. This is probably not a common problem in practice because I imagine that deleting an interface from a bond, without deleting the bond itself, is a rare operation. The problem would also be intermittent--after a few switch reconfiguration cycles I imagine that the problem would resolve. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index c082e5da..1bf4148f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3962,8 +3962,9 @@ port_del_ifaces(struct port *port, const struct ovsrec_port *cfg) /* Get rid of deleted interfaces. */ for (i = 0; i < port->n_ifaces; ) { - if (!shash_find(&new_ifaces, cfg->interfaces[i]->name)) { - iface_destroy(port->ifaces[i]); + struct iface *iface = port->ifaces[i]; + if (!shash_find(&new_ifaces, iface->name)) { + iface_destroy(iface); } else { i++; }