netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2]  bridge: fix error handling in br_add_if()
@ 2008-04-29  0:29 Stephen Hemminger
  2008-04-29 10:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2008-04-29  0:29 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Volodymyr G Lukiianyk

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>

--- a/net/bridge/br_if.c	2008-04-28 15:27:06.000000000 -0700
+++ b/net/bridge/br_if.c	2008-04-28 15:31:18.000000000 -0700
@@ -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;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-29 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29  0:29 [PATCH 1/2] bridge: fix error handling in br_add_if() Stephen Hemminger
2008-04-29 10:17 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).