Skip to content

Commit

Permalink
bridge: Fix double-free in br_add_if.
Browse files Browse the repository at this point in the history
There is a potential double-kfree in net/bridge/br_if.c.  If br_fdb_insert
fails, then the kobject is put back (which calls kfree due to the kobject
release), and then kfree is called again on the net_bridge_port.  This
patch fixes the crash.

Thanks to Stephen Hemminger for the one-line fix.

Signed-off-by: Jeff Hansen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jeff Hansen authored and davem330 committed Sep 28, 2009
1 parent 8823ad3 commit 30df94f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
br_fdb_delete_by_port(br, p, 1);
err1:
kobject_put(&p->kobj);
p = NULL; /* kobject_put frees */
err0:
dev_set_promiscuity(dev, -1);
put_back:
Expand Down

0 comments on commit 30df94f

Please sign in to comment.