From: sashiko-bot@kernel.org
To: "Geetha sowjanya" <gakula@marvell.com>
Cc: conor+dt@kernel.org, linux-perf-users@vger.kernel.org,
devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v7 2/2] perf: marvell: Add CN20K DDR PMU support
Date: Wed, 27 May 2026 16:53:32 +0000 [thread overview]
Message-ID: <20260527165333.B50F11F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260527154118.12884-3-gakula@marvell.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The PMU driver unregisters the PMU but fails to cancel the hrtimer during device removal, leading to a Use-After-Free when the device memory is freed.
--
commit d18b18c0fd01da6bd683596bdd96464d25ed18a9
Author: Geetha sowjanya <gakula@marvell.com>
perf: marvell: Add CN20K DDR PMU support
The CN20K DRAM Subsystem exposes performance counters for DDR traffic.
This commit adds CN20K register offsets, event maps, and sysfs attributes,
and matches the device via OF and ACPI. Platform data is updated to use
silicon flags to reuse the CN10K PMU code path.
> diff --git a/drivers/perf/marvell_cn10k_ddr_pmu.c b/drivers/perf/marvell_cn10k_ddr_pmu.c
> index 72ac17efd846a..6f638dfe829b8 100644
> --- a/drivers/perf/marvell_cn10k_ddr_pmu.c
> +++ b/drivers/perf/marvell_cn10k_ddr_pmu.c
[ ... ]
> @@ -1098,6 +1294,7 @@ static void cn10k_ddr_perf_remove(struct platform_device *pdev)
[Severity: High]
This is a pre-existing issue, but does this function need to cancel the
hrtimer before returning?
Looking at how the driver manages memory, struct cn10k_ddr_pmu is allocated
with devm_kzalloc() in cn10k_ddr_perf_probe(). This means the memory will be
automatically freed by devres immediately after cn10k_ddr_perf_remove()
finishes.
If the device is unbound via sysfs while a perf event is still active, the
hrtimer could still be running or queued. Because perf_pmu_unregister() does
not stop the PMU's internal timers, would the timer callback
(cn10k_ddr_pmu_timer_handler) execute after the devres cleanup and cause a
use-after-free on the freed ddr_pmu structure?
Could we add hrtimer_cancel(&ddr_pmu->hrtimer) to cn10k_ddr_perf_remove()
to prevent this?
> #ifdef CONFIG_OF
> static const struct of_device_id cn10k_ddr_pmu_of_match[] = {
> { .compatible = "marvell,cn10k-ddr-pmu", .data = &cn10k_ddr_pmu_pdata },
> + { .compatible = "marvell,cn20k-ddr-pmu", .data = &cn20k_ddr_pmu_pdata },
> { },
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260527154118.12884-1-gakula@marvell.com?part=2
next prev parent reply other threads:[~2026-05-27 16:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 15:41 [PATCH v7 0/2] perf: marvell: Add CN20K DDR PMU support Geetha sowjanya
2026-05-27 15:41 ` [PATCH v7 1/2] dt-bindings: perf: marvell: Add CN20K DDR PMU binding Geetha sowjanya
2026-05-28 7:49 ` Krzysztof Kozlowski
2026-05-27 15:41 ` [PATCH v7 2/2] perf: marvell: Add CN20K DDR PMU support Geetha sowjanya
2026-05-27 16:53 ` sashiko-bot [this message]
2026-05-28 7:45 ` [EXTERNAL] " Geethasowjanya Akula
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=20260527165333.B50F11F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gakula@marvell.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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