From: "Gao Feng" <gfree.wind@foxmail.com>
To: "'Xin Long'" <lucien.xin@gmail.com>
Cc: "'Gao Feng'" <gfree.wind@vip.163.com>,
"'davem'" <davem@davemloft.net>, <jarod@redhat.com>,
"'Stephen Hemminger'" <stephen@networkplumber.org>,
<dsa@cumulusnetworks.com>,
"'network dev'" <netdev@vger.kernel.org>
Subject: RE: [PATCH net v3] driver: veth: Fix one possbile memleak when fail to register_netdevice
Date: Wed, 3 May 2017 14:37:33 +0800 [thread overview]
Message-ID: <006101d2c3d7$bf814230$3e83c690$@foxmail.com> (raw)
In-Reply-To: <CADvbK_c32g2t-Azgf10da8qke5B+wgG4dw3jLTE2L+R2qR3xPA@mail.gmail.com>
> From: Xin Long [mailto:lucien.xin@gmail.com]
> Sent: Wednesday, May 3, 2017 1:38 PM
> On Wed, May 3, 2017 at 10:07 AM, Gao Feng <gfree.wind@foxmail.com>
> wrote:
> >> From: netdev-owner@vger.kernel.org
> >> [mailto:netdev-owner@vger.kernel.org]
> >> On Behalf Of Xin Long
> >> Sent: Wednesday, May 3, 2017 12:59 AM On Tue, May 2, 2017 at 7:03 PM,
> >> Gao Feng <gfree.wind@vip.163.com> wrote:
> >> >> From: Xin Long [mailto:lucien.xin@gmail.com]
> >> >> Sent: Tuesday, May 2, 2017 3:56 PM On Sat, Apr 29, 2017 at 11:51
> >> >> AM, <gfree.wind@foxmail.com> wrote:
> >> >> > From: Gao Feng <gfree.wind@foxmail.com>
[...]
> > The fix you mentioned change the original logic.
> > The dev->vstats is freed in advance in the ndo_uninit, not destructor.
> > It may break the backward.
> Sorry, I didn't get your "backward"
> I can't see there will be any problem caused by it.
> can you say this patch also break the 'backward' ?
> https://patchwork.ozlabs.org/patch/748964/
>
> It's really weird to do dev->reg_state check in ndo_unint ndo_unint is supposed
> to free the memory alloced in ndo_init.
>
I am not sure if it would break the backward, so I said it MAY break.
I assumed there may be someone would access the dev->vstats after ndo_uninit,
because current veth driver free the mem in the destructor.
I selected this approach because I don't want to bring new bugs during fix bug.
If you're sure it is safe to free dev->vstats in ndo_uninit, I would like to update it.
BTW there are too many drivers which have possible memleak.
You could find the list by https://www.mail-archive.com/netdev@vger.kernel.org/msg166629.html.
Some drivers allocate the resources in ndo_init, free some in ndo_uninit and free left in destructor.
I think there are some reasons.
We could not move all free in the ndo_uninit from destructor. What's your opinion?
Best Regards
Feng
next prev parent reply other threads:[~2017-05-03 6:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-29 3:51 [PATCH net v3] driver: veth: Fix one possbile memleak when fail to register_netdevice gfree.wind
2017-05-01 15:08 ` David Ahern
2017-05-02 10:51 ` Gao Feng
2017-05-02 7:55 ` Xin Long
2017-05-02 11:03 ` Gao Feng
2017-05-02 16:59 ` Xin Long
2017-05-03 2:07 ` Gao Feng
2017-05-03 5:37 ` Xin Long
2017-05-03 6:37 ` Gao Feng [this message]
2017-05-03 11:25 ` Xin Long
2017-05-03 13:17 ` 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='006101d2c3d7$bf814230$3e83c690$@foxmail.com' \
--to=gfree.wind@foxmail.com \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=gfree.wind@vip.163.com \
--cc=jarod@redhat.com \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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).