From 141b9f715e7ed92d47d58aebaf6fbd01a7a1336a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 21 May 2009 11:10:19 -0700 Subject: [PATCH] brcompat refactoring fixes --- datapath/brcompat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(); -- 2.30.2