Skip to content

Commit

Permalink
bridge: fix error handling in br_add_if()
Browse files Browse the repository at this point in the history
When device is added to bridge its refcnt is incremented (in new_nbp()), but if
error occurs during further br_add_if() operations this counter is not
decremented back. Fix it by adding dev_put() call in the error path.

Signed-off-by: Volodymyr G Lukiianyk <volodymyrgl@gmail.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Volodymyr G Lukiianyk authored and David S. Miller committed Apr 29, 2008
1 parent 9a732ed commit 43af853
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,12 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
br_fdb_delete_by_port(br, p, 1);
err1:
kobject_del(&p->kobj);
return err;
goto put_back;
err0:
kobject_put(&p->kobj);

put_back:
dev_put(dev);
return err;
}

Expand Down

0 comments on commit 43af853

Please sign in to comment.