bridge: fix error handling in br_add_if()
Subsystems (3)
PATCH 1/2 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 <[email protected]>
Signed-off-by Stephen Hemminger <[email protected]>
net/bridge/br_if.c +4 -1
@@ -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; }
From: Stephen Hemminger <[email protected]>
Date: Mon, 28 Apr 2008 17:29:25 -0700
Quoted 6 lines
When device is added to bridge its refcnt is incremented (in
new_nbp()), but if error occurs during furtherbr_add_if()operations this counter is not decremented back. Fix it by addingdev_put()call in the error path.Signed-off-by Volodymyr G Lukiianyk <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>
Applied.