From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "wanghai (M)" <wanghai26@huawei.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
davem@davemloft.net, idosch@mellanox.com,
alexander.h.duyck@intel.com, tyhicks@canonical.com,
f.fainelli@gmail.com, amritha.nambiar@intel.com, joe@perches.com,
dmitry.torokhov@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net-sysfs: Fix memory leak in netdev_register_kobject
Date: Tue, 19 Mar 2019 12:30:37 +0200 [thread overview]
Message-ID: <20190319103037.GD9224@smile.fi.intel.com> (raw)
In-Reply-To: <c1c266af-7aaa-00a7-aa7a-e61c65665741@huawei.com>
On Tue, Mar 19, 2019 at 11:19:24AM +0800, wanghai (M) wrote:
>
> 在 2019/3/19 0:19, Andy Shevchenko 写道:
> > On Mon, Mar 18, 2019 at 08:57:24AM -0700, Stephen Hemminger wrote:
> > > On Tue, 19 Mar 2019 01:06:57 -0400
> > > Wang Hai <wanghai26@huawei.com> wrote:
> > > This looks a bug in device_add() not here.
> > > In general, it is better for an api to clean up after itself.
> > > Since dev->kobj.name is created in device_add and normally freed
> > > in device_del; why is device_add leaving it behind?
> > It's more likely the bug in syzkaller.
> >
> > Look at the kobject_cleanup() last lines of code...
> If device_add(dev) or register_queue_kobjects(ndev) fails,
> In register_netdevice(), dev-> reg_state = NETREG_UNINITIALIZED and returns
> an error, causing put_device(&dev-> dev) -> ..-> kobject_cleanup() not to be
> called.
OK, that's true, but your patch is wrong.
See error handling in device_create_groups_vargs() for example.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-03-19 10:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 5:06 [PATCH] net-sysfs: Fix memory leak in netdev_register_kobject Wang Hai
2019-03-18 15:57 ` Stephen Hemminger
2019-03-18 16:19 ` Andy Shevchenko
[not found] ` <c1c266af-7aaa-00a7-aa7a-e61c65665741@huawei.com>
2019-03-19 10:30 ` Andy Shevchenko [this message]
[not found] ` <18553079-7bbd-fcfe-ef1c-6717e963e0a5@huawei.com>
2019-03-19 14:00 ` Andy Shevchenko
2019-03-19 15:44 ` Stephen Hemminger
2019-03-19 3:03 ` wanghai (M)
2019-03-19 3:15 ` Stephen Hemminger
2019-03-19 3:39 ` wanghai (M)
2019-03-19 10:22 ` Andy Shevchenko
2019-03-18 18:02 ` Eric Dumazet
2019-03-19 3:47 ` wanghai (M)
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=20190319103037.GD9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexander.h.duyck@intel.com \
--cc=amritha.nambiar@intel.com \
--cc=davem@davemloft.net \
--cc=dmitry.torokhov@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=tyhicks@canonical.com \
--cc=wanghai26@huawei.com \
/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.