[ovs-dev] [bridge 01/15] bridge: Always delete the correct interfaces in port_del_ifaces().
Ethan Jackson
ethan at nicira.com
Mon Mar 21 18:09:04 UTC 2011
Good catch. Looks Good.
On Mon, Mar 21, 2011 at 10:59 AM, Ben Pfaff <blp at nicira.com> wrote:
> 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 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index c082e5d..1bf4148 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++;
> }
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list