From: Ben Pfaff Date: Thu, 21 May 2009 18:10:19 +0000 (-0700) Subject: brcompat refactoring fixes X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=141b9f715e7ed92d47d58aebaf6fbd01a7a1336a;p=openvswitch brcompat refactoring fixes --- diff --git a/datapath/brcompat.c b/datapath/brcompat.c index 39584590..4175ad1c 100644 --- a/datapath/brcompat.c +++ b/datapath/brcompat.c @@ -146,14 +146,20 @@ static int brc_add_del_port(struct net_device *dev, int port_ifindex, int add) { struct net_device *port; + char dev_name[IFNAMSIZ], port_name[IFNAMSIZ]; int err; port = __dev_get_by_index(&init_net, port_ifindex); if (!port) return -EINVAL; + /* Save name of dev and port because there's a race between the + * rtnl_unlock() and the brc_send_command(). */ + strcpy(dev_name, dev->name); + strcpy(port_name, port->name); + rtnl_unlock(); - err = brc_send_command(dev->name, port->name, + err = brc_send_command(dev_name, port_name, add ? BRC_GENL_C_PORT_ADD : BRC_GENL_C_PORT_DEL); rtnl_lock();