All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florin Malita <fmalita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, ctindel@users.sourceforge.net, fubar@us.ibm.com
Subject: [PATCH] bond_main.c: fix device deregistration in init exception path
Date: Sun, 18 Sep 2005 02:15:46 -0400	[thread overview]
Message-ID: <432D0612.7070408@gmail.com> (raw)

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();

             reply	other threads:[~2005-09-18  6:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-18  6:15 Florin Malita [this message]
2005-09-18  6:32 ` [PATCH] bond_main.c: fix device deregistration in init exception path 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=432D0612.7070408@gmail.com \
    --to=fmalita@gmail.com \
    --cc=akpm@osdl.org \
    --cc=ctindel@users.sourceforge.net \
    --cc=fubar@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.