aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2009-10-29 23:58:54 +0000
committerDavid S. Miller <davem@davemloft.net>2009-10-30 12:41:22 -0700
commit6639104bd826e0b1388c69a6b7564fffc636c8a8 (patch)
treea96951c923ca5c045e3e581849b3a9373fddac3e /drivers/net/bonding
parentec87fd3b4e111e8bc367d247a963e27e5b86df26 (diff)
bond: Get the rtnl_link_ops support correct
- Don't call rtnl_link_unregister if rtnl_link_register fails - Set .priv_size so we aren't stomping on uninitialized memory when we use netdev_priv, on bond devices created with ip link add type bond. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 208d2c4ef06..ecea6c29413 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5056,6 +5056,7 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
static struct rtnl_link_ops bond_link_ops __read_mostly = {
.kind = "bond",
+ .priv_size = sizeof(struct bonding),
.setup = bond_setup,
.validate = bond_validate,
};
@@ -5157,7 +5158,7 @@ static int __init bonding_init(void)
res = rtnl_link_register(&bond_link_ops);
if (res)
- goto err;
+ goto err_link;
for (i = 0; i < max_bonds; i++) {
res = bond_create(&init_net, NULL);
@@ -5176,6 +5177,7 @@ out:
return res;
err:
rtnl_link_unregister(&bond_link_ops);
+err_link:
unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops);
goto out;