From: Sven Eckelmann <sven@narfation.org>
To: Gao Feng <gfree.wind@foxmail.com>
Cc: mareklindner@neomailbox.ch, netdev@vger.kernel.org,
b.a.t.m.a.n@lists.open-mesh.org, a@unstable.cc,
'Gao Feng' <fgao@ikuai8.com>,
davem@davemloft.net
Subject: Re: [B.A.T.M.A.N.] [PATCH net] net: batman-adv: Fix possible memleaks when fail to register_netdevice
Date: Wed, 26 Apr 2017 07:57:44 +0200 [thread overview]
Message-ID: <3994535.Z9kqCnttI2@bentobox> (raw)
In-Reply-To: <002901d2be25$d9092bd0$8b1b8370$@foxmail.com>
[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]
On Mittwoch, 26. April 2017 08:41:30 CEST Gao Feng wrote:
> On Dienstag, 25. April 2017 20:03:20 CEST gfree.wind@foxmail.com wrote:
> > From: Gao Feng <fgao@ikuai8.com>
> >
> > Because the func batadv_softif_init_late allocate some resources and
> > it would be invoked in register_netdevice. So we need to invoke the
> > func batadv_softif_free instead of free_netdev to cleanup when fail
> > to register_netdevice.
>
> I could be wrong, but shouldn't the destructor be replaced with free_netdevice
> and the batadv_softif_free (without the free_netdev) used as ndo_uninit? The
> line you've changed should then be kept as free_netdevice.
>
> At least this seems to be important when using rtnl_newlink() instead of the
> legacy sysfs netdev stuff from batman-adv. rtnl_newlink() would also only call
> free_netdevice and thus also not run batadv_softif_free. This seems to be only
> fixable by calling ndo_uninit.
>
> Sorry, I don't get you.
> The net_dev is created in this func batadv_softif_create.
> Why couldn't invoke batadv_softif_free to cleanup when fail to
> register_netdevice?
>
Because it is the legacy way to create the batadv interfaces and there is a
"new" one. The new way is to use rtnl link (see batadv_link_ops).
The rtnl linke (rtnl_newlink) would not benefit from your fix and therefore
still show the old behavior. I think a different fix is necessary to solve the
problem for both ways to create an batadv interface.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
To: Gao Feng <gfree.wind-H32Fclmsjq1BDgjK7y7TUQ@public.gmane.org>
Cc: mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
a@unstable.cc,
'Gao Feng' <fgao-KlmEoCYek3zQT0dZR+AlfA@public.gmane.org>,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [PATCH net] net: batman-adv: Fix possible memleaks when fail to register_netdevice
Date: Wed, 26 Apr 2017 07:57:44 +0200 [thread overview]
Message-ID: <3994535.Z9kqCnttI2@bentobox> (raw)
In-Reply-To: <002901d2be25$d9092bd0$8b1b8370$@foxmail.com>
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
On Mittwoch, 26. April 2017 08:41:30 CEST Gao Feng wrote:
> On Dienstag, 25. April 2017 20:03:20 CEST gfree.wind-H32Fclmsjq1BDgjK7y7TUQ@public.gmane.org wrote:
> > From: Gao Feng <fgao-KlmEoCYek3zQT0dZR+AlfA@public.gmane.org>
> >
> > Because the func batadv_softif_init_late allocate some resources and
> > it would be invoked in register_netdevice. So we need to invoke the
> > func batadv_softif_free instead of free_netdev to cleanup when fail
> > to register_netdevice.
>
> I could be wrong, but shouldn't the destructor be replaced with free_netdevice
> and the batadv_softif_free (without the free_netdev) used as ndo_uninit? The
> line you've changed should then be kept as free_netdevice.
>
> At least this seems to be important when using rtnl_newlink() instead of the
> legacy sysfs netdev stuff from batman-adv. rtnl_newlink() would also only call
> free_netdevice and thus also not run batadv_softif_free. This seems to be only
> fixable by calling ndo_uninit.
>
> Sorry, I don't get you.
> The net_dev is created in this func batadv_softif_create.
> Why couldn't invoke batadv_softif_free to cleanup when fail to
> register_netdevice?
>
Because it is the legacy way to create the batadv interfaces and there is a
"new" one. The new way is to use rtnl link (see batadv_link_ops).
The rtnl linke (rtnl_newlink) would not benefit from your fix and therefore
still show the old behavior. I think a different fix is necessary to solve the
problem for both ways to create an batadv interface.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-04-26 5:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 12:03 [B.A.T.M.A.N.] [PATCH net] net: batman-adv: Fix possible memleaks when fail to register_netdevice gfree.wind
2017-04-25 12:03 ` gfree.wind
2017-04-25 13:53 ` [B.A.T.M.A.N.] " Sven Eckelmann
2017-04-25 13:53 ` Sven Eckelmann
2017-04-26 0:41 ` [B.A.T.M.A.N.] " Gao Feng
2017-04-26 0:41 ` Gao Feng
2017-04-26 5:57 ` Sven Eckelmann [this message]
2017-04-26 5:57 ` Sven Eckelmann
2017-04-26 6:44 ` [B.A.T.M.A.N.] " Gao Feng
2017-04-26 6:44 ` Gao Feng
2017-04-26 7:16 ` [B.A.T.M.A.N.] " Sven Eckelmann
2017-04-26 7:16 ` Sven Eckelmann
2017-04-26 7:28 ` [B.A.T.M.A.N.] " Gao Feng
2017-04-26 7:28 ` Gao Feng
2017-06-09 7:23 ` [B.A.T.M.A.N.] " Sven Eckelmann
2017-06-09 7:26 ` 高峰
2017-06-09 7:26 ` 高峰
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=3994535.Z9kqCnttI2@bentobox \
--to=sven@narfation.org \
--cc=a@unstable.cc \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=fgao@ikuai8.com \
--cc=gfree.wind@foxmail.com \
--cc=mareklindner@neomailbox.ch \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.