Skip to content

Commit

Permalink
bonding: fix error unwind in bonding_store_bonds
Browse files Browse the repository at this point in the history
	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: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Jay Vosburgh authored and Jeff Garzik committed May 6, 2008
1 parent 822973b commit c4ebc66
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/bonding/bond_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
ifname);
res = -EPERM;
goto out;
goto out_unlock;
}
printk(KERN_INFO DRV_NAME
": %s is being deleted...\n",
bond->dev->name);
bond_destroy(bond);
up_write(&bonding_rwsem);
rtnl_unlock();
goto out;
goto out_unlock;
}

printk(KERN_ERR DRV_NAME
": unable to delete non-existent bond %s\n", ifname);
res = -ENODEV;
up_write(&bonding_rwsem);
rtnl_unlock();
goto out;
goto out_unlock;
}

err_no_cmd:
printk(KERN_ERR DRV_NAME
": 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
* get called forever, which is bad.
Expand Down

0 comments on commit c4ebc66

Please sign in to comment.