aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVolodymyr G Lukiianyk <volodymyrgl@gmail.com>2008-04-29 06:17:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-29 06:17:42 -0400
commit43af8532ecd74a61f9e7aeb27c026c1ee27915ca (patch)
treeb7a012195373a4ac2d43f949199199bab7e5e30d /net
parent9a732ed6d0e126d4c8a818f42a13f3df11755bee (diff)
bridge: fix error handling in br_add_if()
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>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_if.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 298e0f463c56..77a981a1ee52 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -411,9 +411,12 @@ err2:
411 br_fdb_delete_by_port(br, p, 1); 411 br_fdb_delete_by_port(br, p, 1);
412err1: 412err1:
413 kobject_del(&p->kobj); 413 kobject_del(&p->kobj);
414 return err; 414 goto put_back;
415err0: 415err0:
416 kobject_put(&p->kobj); 416 kobject_put(&p->kobj);
417
418put_back:
419 dev_put(dev);
417 return err; 420 return err;
418} 421}
419 422