From: Volodymyr G Lukiianyk Date: Tue, 29 Apr 2008 10:17:42 +0000 (-0700) Subject: bridge: fix error handling in br_add_if() X-Git-Tag: v2.6.26-rc1~104^2~13 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=43af8532ecd74a61f9e7aeb27c026c1ee27915ca;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 298e0f463c5..77a981a1ee5 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -411,9 +411,12 @@ err2: 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; }