From: sashiko-bot@kernel.org
To: "Praveen Talari" <praveen.talari@oss.qualcomm.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 3/9] soc: qcom: geni-se: Add helper to set SE clock rate via OPP
Date: Thu, 27 Aug 2026 18:14:11 +0000 [thread overview]
Message-ID: <20260827181412.53ADC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-derive_clk_perf_tbl_from_perf_domain_opp_table-v2-3-091697dbeb02@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Double free and use-after-free of `port->se.pd_list` via devres cleanup in `qcom_geni_serial_probe` error path and `qcom_geni_serial_remove`.
--
commit 6ff6aaccb1d04a9b68e796b58d89553fda0f613b
Author: Praveen Talari <praveen.talari@oss.qualcomm.com>
soc: qcom: geni-se: Add helper to set SE clock rate via OPP
GENI protocol drivers need a common way to scale the SE source clock
through the OPP framework. The new helper automatically selects the
performance-domain device when power domains are attached and falls back
to the SE device otherwise.
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index 447b9cc6babf6..04f58a6f26fff 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c
> @@ -1149,6 +1149,28 @@ int geni_se_set_perf_opp(struct geni_se *se, unsigned long clk_freq)
> }
> EXPORT_SYMBOL_GPL(geni_se_set_perf_opp);
>
[ ... ]
[Severity: Critical]
This isn't a bug introduced by this patch, but could the manual detach calls
in drivers/tty/serial/qcom_geni_serial.c result in a double free and
use-after-free?
In qcom_geni_serial_probe(), the code calls port->dev_data->resources_init().
For configurations that map this to geni_se_domain_attach(), it allocates and
attaches power domains using the managed API devm_pm_domain_attach_list().
This registers a cleanup action that will automatically detach and free the
list on probe failure or driver unbind.
However, the error path manually frees the list:
drivers/tty/serial/qcom_geni_serial.c:qcom_geni_serial_probe()
...
error:
if (port->rx_dma_addr) {
dma_unmap_single(pdev->dev.parent, port->rx_dma_addr,
DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
port->rx_dma_addr = 0;
}
dev_pm_domain_detach_list(port->se.pd_list);
return ret;
}
The manual call to dev_pm_domain_detach_list() immediately frees the list,
but since the manual detach bypasses devres, the devres subsystem will
automatically invoke its cleanup action on the exact same, already-freed
pointer when the probe returns an error.
The same manual detach is also present in qcom_geni_serial_remove():
drivers/tty/serial/qcom_geni_serial.c:qcom_geni_serial_remove()
...
if (port->rx_dma_addr) {
dma_unmap_single(pdev->dev.parent, port->rx_dma_addr,
DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
port->rx_dma_addr = 0;
}
dev_pm_domain_detach_list(port->se.pd_list);
}
Could this cause memory corruption or a kernel panic when devres double-frees
the list as soon as the remove function finishes?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-derive_clk_perf_tbl_from_perf_domain_opp_table-v2-0-091697dbeb02@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-08-27 18:14 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 17:59 [PATCH v2 0/9] soc: qcom: geni: Derive SE clock configuration from OPP table on SA8255P Praveen Talari
2026-08-27 17:59 ` [PATCH v2 1/9] pmdomain: arm: Fix -EINVAL from scmi_pd_set_perf_state() on state 0 Praveen Talari
2026-08-27 18:16 ` sashiko-bot
2026-09-01 14:31 ` Ulf Hansson
2026-08-27 17:59 ` [PATCH v2 2/9] soc: qcom: geni-se: Populate clk_perf_tbl with SE source clock frequencies from perf OPP table Praveen Talari
2026-08-27 18:16 ` sashiko-bot
2026-08-27 17:59 ` [PATCH v2 3/9] soc: qcom: geni-se: Add helper to set SE clock rate via OPP Praveen Talari
2026-08-27 18:14 ` sashiko-bot [this message]
2026-09-04 9:01 ` Konrad Dybcio
2026-08-27 17:59 ` [PATCH v2 4/9] soc: qcom: geni-se: Remove OPP rate reset from resource deactivation Praveen Talari
2026-08-27 18:14 ` sashiko-bot
2026-09-04 8:49 ` Konrad Dybcio
2026-09-11 17:13 ` Praveen Talari
2026-08-27 17:59 ` [PATCH v2 5/9] serial: qcom-geni: Use geni_se_set_rate() for source clock configuration Praveen Talari
2026-08-27 18:12 ` sashiko-bot
2026-08-27 17:59 ` [PATCH v2 6/9] spi: qcom-geni: Use geni_se_set_rate() for setting source clock frequency Praveen Talari
2026-08-27 18:12 ` sashiko-bot
2026-08-27 17:59 ` [PATCH v2 7/9] i2c: qcom-geni: Vote for SE clock rate using OPP Praveen Talari
2026-08-27 18:11 ` sashiko-bot
2026-09-04 8:52 ` Konrad Dybcio
2026-09-11 17:42 ` Praveen Talari
2026-08-27 17:59 ` [PATCH v2 8/9] i2c: qcom-geni: Use common GENI resource initialization helper Praveen Talari
2026-08-27 18:16 ` sashiko-bot
2026-08-27 17:59 ` [PATCH v2 9/9] i2c: qcom-geni: Use geni_se_set_rate() for setting source clock frequency Praveen Talari
2026-08-27 18:25 ` sashiko-bot
2026-09-01 14:52 ` [PATCH v2 0/9] soc: qcom: geni: Derive SE clock configuration from OPP table on SA8255P Ulf Hansson
2026-09-01 16:48 ` Praveen Talari
2026-09-04 7:56 ` Ulf Hansson
2026-09-04 9:00 ` Konrad Dybcio
2026-09-11 17:33 ` Praveen Talari
2026-09-09 6:32 ` Praveen Talari
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=20260827181412.53ADC1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=praveen.talari@oss.qualcomm.com \
--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