netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gao Feng" <gfree.wind@foxmail.com>
To: "'Herbert Xu'" <herbert@gondor.apana.org.au>
Cc: <jiri@resnulli.us>, <davem@davemloft.net>, <kuznet@ms2.inr.ac.ru>,
	<jmorris@namei.org>, <yoshfuji@linux-ipv6.org>, <kaber@trash.net>,
	<steffen.klassert@secunet.com>, <netdev@vger.kernel.org>,
	"'Gao Feng'" <fgao@ikuai8.com>
Subject: RE: [PATCH net] driver/net: Fix possible memleaks when fail to register_netdevice
Date: Thu, 27 Apr 2017 16:33:09 +0800	[thread overview]
Message-ID: <007001d2bf30$e751f850$b5f5e8f0$@foxmail.com> (raw)
In-Reply-To: <20170427081559.GA1058@gondor.apana.org.au>

> From: Herbert Xu [mailto:herbert@gondor.apana.org.au]
> Sent: Thursday, April 27, 2017 4:16 PM
> On Tue, Apr 25, 2017 at 08:01:50PM +0800, gfree.wind@foxmail.com wrote:
> > From: Gao Feng <fgao@ikuai8.com>
> >
[...]
> 
> This has the potential of creating future bugs, because there is no
guarantee
> that the ndo_init function has been invoked at all.
> 
> Wouldn't it be safer to move the freeing from the destructors into their
> ndo_uninit functions instead?

I considered about this solution, I am not sure if it is safe to move the
freeing from destructors into ndo_uninit.
Because when the free action is done in ndo_uninit, it is earlier than
destructor. 
I am not sure if it break the design of original driver.

I just tested the team driver before. It is ok to free all mems in
ndo_uninit.
Is it possible that anyone are using the net_dev after ndo_uninit ?

If no one, i would like to update the patch. 
Could you give me some guide please?

Regards
Feng

> 
> Thanks,
> --

  reply	other threads:[~2017-04-27  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 12:01 [PATCH net] driver/net: Fix possible memleaks when fail to register_netdevice gfree.wind
2017-04-25 12:51 ` Gao Feng
2017-04-27  8:15 ` Herbert Xu
2017-04-27  8:33   ` Gao Feng [this message]
2017-04-28  0:27   ` Gao Feng

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='007001d2bf30$e751f850$b5f5e8f0$@foxmail.com' \
    --to=gfree.wind@foxmail.com \
    --cc=davem@davemloft.net \
    --cc=fgao@ikuai8.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jiri@resnulli.us \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=yoshfuji@linux-ipv6.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).