Commit c4ebc66a authored by Jay Vosburgh's avatar Jay Vosburgh Committed by Jeff Garzik

bonding: fix error unwind in bonding_store_bonds

	Fixed an error unwind in bonding_store_bonds that didn't release
the locks it held, and consolidated unwinds into a common block at the
end of the function.  Bug reported by Pavel Emelyanov <xemul@openvz.org>,
who provided a different fix.
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 822973ba
...@@ -146,29 +146,29 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t ...@@ -146,29 +146,29 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
": Unable remove bond %s due to open references.\n", ": Unable remove bond %s due to open references.\n",
ifname); ifname);
res = -EPERM; res = -EPERM;
goto out; goto out_unlock;
} }
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s is being deleted...\n", ": %s is being deleted...\n",
bond->dev->name); bond->dev->name);
bond_destroy(bond); bond_destroy(bond);
up_write(&bonding_rwsem); goto out_unlock;
rtnl_unlock();
goto out;
} }
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": unable to delete non-existent bond %s\n", ifname); ": unable to delete non-existent bond %s\n", ifname);
res = -ENODEV; res = -ENODEV;
up_write(&bonding_rwsem); goto out_unlock;
rtnl_unlock();
goto out;
} }
err_no_cmd: err_no_cmd:
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": no command found in bonding_masters. Use +ifname or -ifname.\n"); ": no command found in bonding_masters. Use +ifname or -ifname.\n");
res = -EPERM; return -EPERM;
out_unlock:
up_write(&bonding_rwsem);
rtnl_unlock();
/* Always return either count or an error. If you return 0, you'll /* Always return either count or an error. If you return 0, you'll
* get called forever, which is bad. * get called forever, which is bad.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment