netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dborkman@redhat.com
Cc: netdev@vger.kernel.org, ebiederm@xmission.com,
	jesse.brandeburg@intel.com, xiyou.wangcong@gmail.com
Subject: Re: [PATCH net-next] net: vxlan: do not use vxlan_net before checking event type
Date: Fri, 17 Jan 2014 18:50:30 -0800 (PST)	[thread overview]
Message-ID: <20140117.185030.1516625575623978541.davem@davemloft.net> (raw)
In-Reply-To: <1389959706-30976-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Fri, 17 Jan 2014 12:55:06 +0100

> Jesse Brandeburg reported that commit acaf4e70997f caused a panic
> when adding a network namespace while vxlan module was present in
> the system:
 ...
> Apparently loopback device is being registered first and thus we
> receive an event notification when vxlan_net is not ready. Hence,
> when we call net_generic() and request vxlan_net_id, we seem to
> access garbage at that point in time. In setup_net() where we set
> up a newly allocated network namespace, we traverse the list of
> pernet ops ...
> 
> list_for_each_entry(ops, &pernet_list, list) {
> 	error = ops_init(ops, net);
> 	if (error < 0)
> 		goto out_undo;
> }
> 
> ... and loopback_net_init() is invoked first here, so in the middle
> of setup_net() we get this notification in vxlan. As currently we
> only care about devices that unregister, move access through
> net_generic() there. Fix is based on Cong Wang's proposal, but
> only changes what is needed here. It sucks a bit as we only work
> around the actual cure: right now it seems the only way to check if
> a netns actually finished traversing all init ops would be to check
> if it's part of net_namespace_list. But that I find quite expensive
> each time we go through a notifier callback. Anyway, did a couple
> of tests and it seems good for now.
> 
> Fixes: acaf4e70997f ("net: vxlan: when lower dev unregisters remove vxlan dev as well")
> Reported-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Applied, thanks.

  parent reply	other threads:[~2014-01-18  2:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17 11:55 [PATCH net-next] net: vxlan: do not use vxlan_net before checking event type Daniel Borkmann
2014-01-17 17:30 ` Cong Wang
2014-01-17 18:32   ` Daniel Borkmann
2014-01-18  3:50     ` Cong Wang
2014-01-18 17:18       ` Eric Dumazet
2014-01-18 17:57         ` Cong Wang
2014-01-18 19:47           ` Daniel Borkmann
2014-01-18 23:32             ` Cong Wang
2014-01-18 23:48               ` Cong Wang
2014-01-19  0:36                 ` Daniel Borkmann
2014-01-19  0:50                   ` Cong Wang
     [not found]           ` <1390072047.31367.543.camel@edumazet-glaptop2.roam.corp.google.com>
2014-01-18 23:38             ` Cong Wang
2014-01-19  2:01               ` Eric Dumazet
2014-01-17 18:20 ` Jesse Brandeburg
2014-01-18  2:50 ` David Miller [this message]
2014-01-20 21:51 ` Eric W. Biederman
2014-01-20 22:01   ` Daniel Borkmann

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=20140117.185030.1516625575623978541.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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 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).