Skip to content

Commit

Permalink
bond: Get the rtnl_link_ops support correct
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Oct 30, 2009
1 parent ec87fd3 commit 6639104
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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);
Expand All @@ -5176,6 +5177,7 @@ static int __init bonding_init(void)
return res;
err:
rtnl_link_unregister(&bond_link_ops);
err_link:
unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops);
goto out;

Expand Down

0 comments on commit 6639104

Please sign in to comment.