From: jouni.hogander@unikie.com (Jouni Högander)
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH] drivers/base: Fix memory leak in error paths
Date: Fri, 15 Nov 2019 12:32:31 +0200 [thread overview]
Message-ID: <87y2wh8m68.fsf@unikie.com> (raw)
In-Reply-To: <20191115101902.GB337025@kroah.com> (Greg Kroah-Hartman's message of "Fri, 15 Nov 2019 18:19:02 +0800")
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>>
>> Ok, did some more debugging on
>> this. net/core/net-sysfs.c:netdev_register_kobject is doing
>> device_initialize(dev). This is in
>> drivers/base/core.c:device_initialize:
>>
>> * NOTE: Use put_device() to give up your reference instead of freeing
>> * @dev directly once you have called this function.
>>
>> My understanding is that remaining reference on error path is taken by
>> device_initialize and as instructed in the note above it should be given
>> up using put_device?
>
> Yes, that is correct.
>
>> Tested this and it's fixing the memory leak I found in my Syzkaller
>> exercise. Addition to that it seems to be fixing also this one:
>>
>> https://syzkaller.appspot.com/bug?id=f5f4af9fb9ffb3112ad6e30f717f769decdccdfc
>
> Great! Care to submit a patch for this?
I will submit another patch and Cc you there. This patch should be ignored.
BR,
Jouni Högander
prev parent reply other threads:[~2019-11-15 10:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 12:18 [PATCH] drivers/base: Fix memory leak in error paths jouni.hogander
2019-11-15 3:26 ` Greg Kroah-Hartman
2019-11-15 7:59 ` Jouni Högander
2019-11-15 8:20 ` Greg Kroah-Hartman
2019-11-15 10:05 ` Jouni Högander
2019-11-15 10:19 ` Greg Kroah-Hartman
2019-11-15 10:32 ` Jouni Högander [this message]
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=87y2wh8m68.fsf@unikie.com \
--to=jouni.hogander@unikie.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=rafael@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 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).