netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] about net: Fix inconsistent teardown and release of private netdev state.
Date: Fri, 18 Aug 2017 15:58:35 -0700 (PDT)	[thread overview]
Message-ID: <20170818.155835.2053259542629638150.davem@davemloft.net> (raw)
In-Reply-To: <1503062029.4936.173.camel@edumazet-glaptop3.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 18 Aug 2017 06:13:49 -0700

> On Thu, 2017-08-17 at 22:21 -0700, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Thu, 17 Aug 2017 15:30:40 -0700
>> 
>> > So we do not really know if we need to clean up or not.
>> 
>> We always know, the answer is that whenever register_netdev() fails we
>> never need to perform any cleanup which is done by priv_destructor.
>> 
>> > Any idea how to fix the issue ?
>> 
>> Your patch is exactly how we should fix this, but without the comment.
>> The logic is straightforward.
>> 
>> If register_netdevice() fails any resources handled by priv_destructor
>> are cleaned up, it is guaranteed.
> 
> Not in current code.
> 
> There are some failures which do a "goto out;" 
> 
> out:
> 	return ret;
> 
> 
> In these cases, priv_destructor is not called.
> 
> So we need multiple fixes I think :/

I don't think so.

The cases that "goto out;" in register_netdevce() are those that
execute before ->ndo_init() succeeds.

Only if ->ndo_succeeds() runs successfully should ->priv_destructor()
need execute.

So everything is fine as far as I can see.

  reply	other threads:[~2017-08-18 22:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 22:30 [RFC] about net: Fix inconsistent teardown and release of private netdev state Eric Dumazet
2017-08-18  5:21 ` David Miller
2017-08-18 13:13   ` Eric Dumazet
2017-08-18 22:58     ` David Miller [this message]
2017-08-19  3:40       ` Eric Dumazet
2017-08-21 21:13         ` David Miller
2017-08-25 14:57           ` Eric Dumazet

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=20170818.155835.2053259542629638150.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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 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).