From: Jakub Kicinski <kuba@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: Leon Romanovsky <leon@kernel.org>, <netdev@vger.kernel.org>,
<yisen.zhuang@huawei.com>, <salil.mehta@huawei.com>,
<davem@davemloft.net>
Subject: Re: [PATCH net] net: hns: fix possible memory leak in hnae_ae_register()
Date: Thu, 20 Oct 2022 12:43:07 -0700 [thread overview]
Message-ID: <20221020124307.7822e881@kernel.org> (raw)
In-Reply-To: <3e9539a9-e3b9-1418-cd3b-426d2efeaef1@huawei.com>
On Thu, 20 Oct 2022 15:48:38 +0800 Yang Yingliang wrote:
> On 2022/10/20 8:28, Jakub Kicinski wrote:
> > On Tue, 18 Oct 2022 15:58:38 +0300 Leon Romanovsky wrote:
> >> The change itself is ok.
> >
> > Also the .release function is empty which is another bad smell?
>
> The upper device (struct dsaf_device *dsaf_dev) is allocated by
> devm_kzalloc(), so it's no need to free it in ->release().
Nah ah. devm_* is just for objects which tie their lifetime naturally
to the lifetime of the driver instance, IOW the device ->priv.
struct device allocated by the driver is not tied to that, it's
a properly referenced object. I don't think that just because
the driver that allocated it got ->remove()d you're safe to free
allocated struct devices.
next prev parent reply other threads:[~2022-10-20 19:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 12:24 [PATCH net] net: hns: fix possible memory leak in hnae_ae_register() Yang Yingliang
2022-10-18 12:58 ` Leon Romanovsky
2022-10-20 0:28 ` Jakub Kicinski
2022-10-20 7:48 ` Yang Yingliang
2022-10-20 19:43 ` Jakub Kicinski [this message]
2022-10-21 3:01 ` Yang Yingliang
2022-10-23 8:04 ` Leon Romanovsky
2022-10-20 7:45 ` Yang Yingliang
2022-10-23 7:59 ` Leon Romanovsky
2022-10-20 0:40 ` patchwork-bot+netdevbpf
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=20221020124307.7822e881@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=leon@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=yangyingliang@huawei.com \
--cc=yisen.zhuang@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 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).