Commit c587aea9 authored by Xiaotian Feng's avatar Xiaotian Feng Committed by David S. Miller

net/bridge: use kobject_put to release kobject in br_add_if error path

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: default avatarXiaotian Feng <dfeng@redhat.com>
Acked-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4a29f396
...@@ -424,7 +424,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) ...@@ -424,7 +424,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
err2: err2:
br_fdb_delete_by_port(br, p, 1); br_fdb_delete_by_port(br, p, 1);
err1: err1:
kobject_del(&p->kobj); kobject_put(&p->kobj);
err0: err0:
dev_set_promiscuity(dev, -1); dev_set_promiscuity(dev, -1);
put_back: put_back:
......
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