net/bridge: use kobject_put to release kobject in br_add_if error path
authorXiaotian Feng <dfeng@redhat.com>
Thu, 23 Jul 2009 23:06:32 +0000 (23:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2009 02:20:51 +0000 (19:20 -0700)
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>
net/bridge/br_if.c

index 8a96672e2c5c462fb3f575df3ba4d8c25a03727d..eb404dc3ed6e213e4148ba1f7b13bb1d0570a4e1 100644 (file)
@@ -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: