From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>, jouni.hogander@unikie.com
Cc: netdev@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH] net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
Date: Wed, 20 Nov 2019 19:12:24 -0800 [thread overview]
Message-ID: <ff662def-67dc-8e54-80eb-cfe7a98767ae@gmail.com> (raw)
In-Reply-To: <20191120.121013.1898975725512803153.davem@davemloft.net>
On 11/20/19 12:10 PM, David Miller wrote:
> From: jouni.hogander@unikie.com
> Date: Wed, 20 Nov 2019 09:08:16 +0200
>
>> From: Jouni Hogander <jouni.hogander@unikie.com>
>>
>> kobject_init_and_add takes reference even when it fails. This has
>> to be given up by the caller in error handling. Otherwise memory
>> allocated by kobject_init_and_add is never freed. Originally found
>> by Syzkaller:
>>
>> BUG: memory leak
> ...
>> Signed-off-by: Jouni Hogander <jouni.hogander@unikie.com>
>
> Applied, thank you.
>
I am late to the party, sorry.
But I do not see a Fixes: tag, and the patch seems buggy.
I question how it was really tested ? Please Jouni share your drugs :)
I would rather see this stuff for net-next, because whatever memory leak
we had for years has not raised serious concerns.
I will submit this fix, I guess...
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 4f404bf33e44c977c1a8ba00706817b76215b75c..ae3bcb1540ec57df311dac6847323a23a74ec960 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1474,6 +1474,7 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)
#endif
kobject_uevent(kobj, KOBJ_ADD);
+ return 0;
err:
kobject_put(kobj);
next prev parent reply other threads:[~2019-11-21 3:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 7:08 [PATCH] net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject jouni.hogander
2019-11-20 20:10 ` David Miller
2019-11-21 3:12 ` Eric Dumazet [this message]
2019-11-25 9:17 ` [net] b5c318e8c0: BUG:kernel_NULL_pointer_dereference,address kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2019-11-19 9:51 [PATCH] net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject jouni.hogander
2019-11-20 1:13 ` David Miller
2019-11-20 6:59 ` Jouni Högander
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=ff662def-67dc-8e54-80eb-cfe7a98767ae@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jouni.hogander@unikie.com \
--cc=lukas.bulwahn@gmail.com \
--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 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).