Skip to contentSkip to conversation

bonding: Two small fixes

PATCH In review Jay Vosburgh 3 participants 5 messages Nov 6, 2007 – Nov 8, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover bonding: Two small fixes

Two small fixes to bonding for the mainline.

1: Mishandling of RTNL due to what looks like a merge error.

2: Turn off the new validate_addr check when devices are set
up. For backwards compatibility, the bonding master must be able to be set up with a MAC address of all zeroes.

Patches are against linux-2.6, and apply cleanly
to netdev-2.6#upstream-linus. Please apply for 2.6.24.

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]

#1 lore raw

PATCH 1/2 bonding: fix rtnl locking merge error

Looks like I incorrectly merged one of the rtnl lock changes,
so that one function, bonding_show_active_slave, held rtnl but didn't release it, and another, bonding_store_active_slave, never held rtnl but did release it.

Fixed so the first function doesn't mess with rtnl, and the
second correctly acquires and releases rtnl.

Bug reported by Moni Shoua <[email protected]>

---
 drivers/net/bonding/bond_sysfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_sysfs.c +2 -2
index 7a06ade..b29330d 100644
@@ -1193,8 +1193,6 @@ static ssize_t bonding_show_active_slave(struct device *d,
 	struct bonding *bond = to_bond(d);
 	int count;
 
-	rtnl_lock();
-
 	read_lock(&bond->curr_slave_lock);
 	curr = bond->curr_active_slave;
 	read_unlock(&bond->curr_slave_lock);
@@ -1216,7 +1214,9 @@ static ssize_t bonding_store_active_slave(struct device *d,
         struct slave *new_active = NULL;
 	struct bonding *bond = to_bond(d);
 
+	rtnl_lock();
 	write_lock_bh(&bond->lock);
+
 	if (!USES_PRIMARY(bond->params.mode)) {
 		printk(KERN_INFO DRV_NAME
 		       ": %s: Unable to change active slave; %s is in mode %d\n",
Signature · 1 line
1.5.3.4.206.g58ba4-dirty
#2 lore raw

PATCH 2/2 bonding: don't validate address at device open

The standard validate_addr handler refuses to accept the all zeroes address as valid. However, it's common historical practice for the bonding master to be configured up prior to having any slaves, at which time the master will have a MAC address of all zeroes.

Resolved by setting the dev->validate_addr to NULL. The master still can't end up with an invalid address, as the set_mac_address function tests for validity.

---
 drivers/net/bonding/bond_main.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_main.c +1 -0
index 6937ef0..a198404 100644
@@ -4405,6 +4405,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
 	bond_dev->set_multicast_list = bond_set_multicast_list;
 	bond_dev->change_mtu = bond_change_mtu;
 	bond_dev->set_mac_address = bond_set_mac_address;
+	bond_dev->validate_addr = NULL;
 
 	bond_set_mode_ops(bond, bond->params.mode);
 
Signature · 1 line
1.5.3.4.206.g58ba4-dirty
#3 lore raw

Re: [PATCH 1/2] bonding: fix rtnl locking merge error

In reply to Jay Vosburgh
Quoted 9 lines · Jay Vosburgh

Looks like I incorrectly merged one of the rtnl lock changes,
so that one function, bonding_show_active_slave, held rtnl but didn't release it, and another, bonding_store_active_slave, never held rtnl but did release it.

Fixed so the first function doesn't mess with rtnl, and the
second correctly acquires and releases rtnl.

Bug reported by Moni Shoua <[email protected]>

I ran some shallow tests and it seems that the patch fixes the problem.

thanks

#4 lore raw

Re: [PATCH 1/2] bonding: fix rtnl locking merge error

In reply to Jay Vosburgh
Quoted 5 lines · Jay Vosburgh

Looks like I incorrectly merged one of the rtnl lock changes,
so that one function, bonding_show_active_slave, held rtnl but didn't release it, and another, bonding_store_active_slave, never held rtnl but did release it.

Quoted 7 lines

Fixed so the first function doesn't mess with rtnl, and the
second correctly acquires and releases rtnl.

Bug reported by Moni Shoua <[email protected]>

applied 1-2