From: "Nelson, Shannon" <shannon.nelson@amd.com>
To: Abdun Nihaal <abdun.nihaal@gmail.com>
Cc: brett.creeley@amd.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] pds_core: fix memory leak in pdsc_debugfs_add_qcq()
Date: Wed, 9 Apr 2025 10:18:10 -0700 [thread overview]
Message-ID: <a59eac7c-870b-4edf-9590-5aef07a64d7b@amd.com> (raw)
In-Reply-To: <20250409054450.48606-1-abdun.nihaal@gmail.com>
On 4/8/2025 10:44 PM, Abdun Nihaal wrote:
>
> The memory allocated for intr_ctrl_regset, which is passed to
> debugfs_create_regset32() may not be cleaned up when the driver is
> removed. Fix that by using device managed allocation for it.
>
> Fixes: 45d76f492938 ("pds_core: set up device and adminq")
> Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Thanks!
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
> drivers/net/ethernet/amd/pds_core/debugfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c
> index ac37a4e738ae..04c5e3abd8d7 100644
> --- a/drivers/net/ethernet/amd/pds_core/debugfs.c
> +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c
> @@ -154,8 +154,9 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
> debugfs_create_u32("index", 0400, intr_dentry, &intr->index);
> debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector);
>
> - intr_ctrl_regset = kzalloc(sizeof(*intr_ctrl_regset),
> - GFP_KERNEL);
> + intr_ctrl_regset = devm_kzalloc(pdsc->dev,
> + sizeof(*intr_ctrl_regset),
> + GFP_KERNEL);
> if (!intr_ctrl_regset)
> return;
> intr_ctrl_regset->regs = intr_ctrl_regs;
> --
> 2.47.2
>
next prev parent reply other threads:[~2025-04-09 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 5:44 Abdun Nihaal
2025-04-09 6:44 ` Michal Swiatkowski
2025-04-09 17:18 ` Nelson, Shannon [this message]
2025-04-12 1: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=a59eac7c-870b-4edf-9590-5aef07a64d7b@amd.com \
--to=shannon.nelson@amd.com \
--cc=abdun.nihaal@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®