From: "Gao Feng" <gfree.wind@vip•163.com>
To: "'Xin Long'" <lucien.xin@gmail•com>
Cc: "'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: Tue, 2 May 2017 19:03:02 +0800 [thread overview]
Message-ID: <000601d2c333$abb526d0$031f7470$@vip.163.com> (raw)
In-Reply-To: <CADvbK_cEHXTSXx5Qa17TfeUXnYiBq8ptR+=5e-fbzPF0r4DNhQ@mail.gmail.com>
> 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>
[...]
> > -static void veth_dev_free(struct net_device *dev)
> > +static void veth_destructor_free(struct net_device *dev)
> > {
> > free_percpu(dev->vstats);
> > +}
> not sure why you needed to add this function.
> to use free_percpu() directly may be clearer.
Because both of ndo_uninit and destructor need to perform same free statements.
It is good at maintain the codes with the common function.
>
> > +
> > +static void veth_dev_uninit(struct net_device *dev) {
> call free_percpu() here, no need to check dev->reg_state.
> free_percpu will just return if dev->vstats is NULL.
It would break the original design if don't check the reg_state.
The original logic is that free the resources in the destructor, not in ndo_init.
BTW, because I send multiple patches too fast today, the email server blocks my account.
So I have to reply you with a different email account. Sorry.
Best Regards
Feng
>
[...]
next prev parent reply other threads:[~2017-05-02 11:03 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 [this message]
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
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='000601d2c333$abb526d0$031f7470$@vip.163.com' \
--to=gfree.wind@vip$(echo .)163.com \
--cc=davem@davemloft$(echo .)net \
--cc=dsa@cumulusnetworks$(echo .)com \
--cc=jarod@redhat$(echo .)com \
--cc=lucien.xin@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=stephen@networkplumber$(echo .)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