All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: davem <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	ebiederm <ebiederm@xmission.com>
Cc: Dave Jones <davej@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: net: kernel BUG() in net/netns/generic.h:45
Date: Thu, 05 Apr 2012 18:20:46 -0400	[thread overview]
Message-ID: <1333664446.3538.12.camel@lappy> (raw)

Hi all,

When an initialization of a network namespace in setup_net() fails, we
try to undo everything by executing each of the exit callbacks of every
namespace in the network.

The problem is, it might be possible that the net_generic array wasn't
initialized before we fail and try to undo everything. At that point,
some of the networks assume that since we're already calling the exit
callback, the net_generic structure is initialized and we hit the BUG()
in net/netns/generic.h:45 .

I'm not quite sure whether the right fix from the following three
options is, and would be happy to figure it out before fixing it:

 1. Don't assume net_generic was initialized in the exit callback, which
is a bit problematic since we can't query that nicely anyway (a
sub-option here would be adding an API to query whether the net_generic
structure is initialized.

 2. Remove the BUG(), switch it to a WARN() and let each subsystem
handle the case of NULL on it's own. While it sounds a bit wrong, it's
worth mentioning that that BUG() was initially added in an attempt to
fix an issue in CAIF, which was fixed in a completely different way
afterwards, so it's not strictly necessary here.

 3. Only call the exit callback for subsystems we have called the init
callback for.

Thanks!

-- 

Sasha.


             reply	other threads:[~2012-04-05 19:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 22:20 Sasha Levin [this message]
2012-04-05 23:53 ` net: kernel BUG() in net/netns/generic.h:45 Eric W. Biederman
2012-04-06  9:04   ` Sasha Levin
2012-04-07  1:16     ` Eric W. Biederman
2012-04-07  1:31       ` [PATCH 1/2], net:In, unregister_netdevice_notifier, unregister, the, netdevices.
2012-04-07  1:33       ` [PATCH 1/2] net: In unregister_netdevice_notifier unregister the netdevices Eric W. Biederman
2012-04-07  1:35         ` [PATCH 2/2] phonet: Sort out initiailziation and cleanup code Eric W. Biederman
2012-04-10  6:39           ` Rémi Denis-Courmont
2012-04-10 10:47           ` Sasha Levin
2012-04-13 15:05           ` David Miller
2012-04-13 15:05         ` [PATCH 1/2] net: In unregister_netdevice_notifier unregister the netdevices David Miller
2012-04-14  0:03           ` Eric W. Biederman

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=1333664446.3538.12.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=ericvh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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.