Skip to content

Commit

Permalink
net/bridge: use kobject_put to release kobject in br_add_if error path
Browse files Browse the repository at this point in the history
kobject_init_and_add will alloc memory for kobj->name, so in br_add_if
error path, simply use kobject_del will not free memory for kobj->name.
Fix by using kobject_put instead, kobject_put will internally calls
kobject_del and frees memory for kobj->name.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xiaotian Feng authored and David S. Miller committed Jul 27, 2009
1 parent 4a29f39 commit c587aea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
err2:
br_fdb_delete_by_port(br, p, 1);
err1:
kobject_del(&p->kobj);
kobject_put(&p->kobj);
err0:
dev_set_promiscuity(dev, -1);
put_back:
Expand Down

0 comments on commit c587aea

Please sign in to comment.