public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bond_main.c: fix device deregistration in init exception path
@ 2005-09-18  6:15 Florin Malita
  2005-09-18  6:32 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Florin Malita @ 2005-09-18  6:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, ctindel, fubar

bond_init() is not releasing rtnl_sem after register_netdevice() and
before calling unregister_netdevice() (from bond_free_all()) in the
exception path. As the device registration is not completed
(dev->reg_state == NETREG_REGISTERING), the call to
unregister_netdevice() triggers BUG_ON(dev->reg_state != NETREG_REGISTERED).

Signed-off-by: Florin Malita <fmalita@gmail.com>
----
diff --git a/drivers/net/bonding/bond_main.c
b/drivers/net/bonding/bond_main.c
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5039,6 +5039,10 @@ static int __init bonding_init(void)
        return 0;

 out_err:
+       /* give register_netdevice() a chance to complete */
+       rtnl_unlock();
+       rtnl_lock();
+
        /* free and unregister all bonds that were successfully added */
        bond_free_all();

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

end of thread, other threads:[~2005-09-22  2:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-18  6:15 [PATCH] bond_main.c: fix device deregistration in init exception path Florin Malita
2005-09-18  6:32 ` Andrew Morton
2005-09-18  7:25   ` David S. Miller
2005-09-22  2:38   ` Jeff Garzik
2005-09-22  2:42     ` Andrew Morton
2005-09-22  2:43     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox