From 13f5f5b05ac13bc9614a63593a026ca7c19e4568 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 18 Mar 2011 10:56:28 -0700 Subject: [PATCH] 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. --- vswitchd/bridge.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++; } -- 2.30.2