From: jouni.hogander@unikie.com (Jouni Högander)
To: David Miller <davem@davemloft.net>
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 08:59:26 +0200 [thread overview]
Message-ID: <87wobvqbht.fsf@unikie.com> (raw)
In-Reply-To: <20191119.171333.624799505921966746.davem@davemloft.net> (David Miller's message of "Tue, 19 Nov 2019 17:13:33 -0800 (PST)")
David Miller <davem@davemloft.net> writes:
> From: jouni.hogander@unikie.com
> Date: Tue, 19 Nov 2019 11:51:21 +0200
>
>> kobject_init_and_add takes reference even when it fails.
>
> I see this in the comment above kobject_init_and_add() but not in the
> code.
>
> Where does the implementation of kobject_init_and_add() actually take
> such a reference?
kobject_init_and_add -> kobject_init -> kobject_init_internal -> kref_init
kref_init initializes ref_count as 1.
>
> Did you discover this by code inspection, or by an actual bug that was
> triggered? If by an actual bug, please provide the OOPS and/or checker
> trace that indicated a leak was happening here.
Originally found it via memory leak identified by Syzkaller. I will
submit new one with memleak dump.
>
> I don't see anything actually wrong here because kobject_init_and_add()
> doesn't actually seem to do what it's comment suggests...
See the code path above.
BR,
Jouni Högander
next prev parent reply other threads:[~2019-11-20 6:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-11-20 7:08 jouni.hogander
2019-11-20 20:10 ` David Miller
2019-11-21 3:12 ` Eric Dumazet
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=87wobvqbht.fsf@unikie.com \
--to=jouni.hogander@unikie.com \
--cc=davem@davemloft.net \
--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 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.