public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: Jiri Pirko <jpirko@redhat•com>
Cc: netdev@vger•kernel.org, davem@davemloft•net
Subject: Re: [PATCH net-2.6] netns: assign NULL after pernet memory is freed
Date: Mon, 26 Apr 2010 11:05:25 -0700	[thread overview]
Message-ID: <m18w8af5sq.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100426133020.GE2941@psychotron.lab.eng.brq.redhat.com> (Jiri Pirko's message of "Mon\, 26 Apr 2010 15\:30\:20 +0200")

Jiri Pirko <jpirko@redhat•com> writes:

> Mon, Apr 26, 2010 at 02:07:17PM CEST, jpirko@redhat•com wrote:
>>Mon, Apr 26, 2010 at 01:18:07PM CEST, jpirko@redhat•com wrote:
>>>This is needed to let know appropriate code (driver) know that pernet memory
>>>chunk  was freed already. For example when driver has also registered netdev
>>>notifier, it can be called after memory is freed which could eventually lead
>>>to panic. Also a null check should be present in these notifiers.
>>>
>>>For example, previously, when drivers were responsible for pernet memory
>>>allocation/freeing, in pppoe this assign was done in pppoe_exit_net() right
>>>after pernet memory was freed. The check in notifier stayed (in pppoe_flush_dev
>>>called from pppoe_device_event) but makes no sense now without this patch.
>>
>>Hmm, thinking about this, since the life of pernet memories is directly connected
>>with the life of net, as described by Eric, this should not be needed. So please
>>scrach this one too. Sorry.
>>
>>Anyway, I'm still wondering how to prevent netdev_notifiers from using this when
>>net is gone. Going to do more research, I'm probably missing something.
>
> Right, it becomes part of init_ns then. So this looks good then. One thing I can
> still imagine what may cause problem, since netdev_notifier is registered before
> register_pernet_device, the notifier can be called in between. So I think this
> should be reordered, am I right?

No.  We guarantee that all network devices are either destroyed or moved
to init_net with the appropriate notifications sent.  Before we tear down
the network namespace.  This guarantees we won't have packets in flight when
destroying the network subsystems.

The moving and destroying of network devices should simply look like normal
events, that don't need special handling.

Eric

  reply	other threads:[~2010-04-26 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 11:18 [PATCH net-2.6] netns: assign NULL after pernet memory is freed Jiri Pirko
2010-04-26 12:07 ` Jiri Pirko
2010-04-26 13:30   ` Jiri Pirko
2010-04-26 18:05     ` Eric W. Biederman [this message]
2010-04-26 18:01   ` 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=m18w8af5sq.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=jpirko@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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