From: sashiko-bot@kernel.org
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: linux-clk@vger.kernel.org, media-ci@linuxtv.org,
devicetree@vger.kernel.org, olteanv@gmail.com,
linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
vkoul@kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v17 5/5] media: qcom: camss: Use data-lanes starting at 1 for new CSIPHY mode
Date: Sun, 06 Sep 2026 14:28:55 +0000 [thread overview]
Message-ID: <20260906142855.A65671F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v17-5-e2197a3e2551@linaro.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect bounds check for physical lane index against the active lane count breaks sparse lane configurations.
- [Medium] Missing `phy_exit()` calls for successfully initialized PHYs on error paths.
--
commit 9ffe4c10c666d01e0522334082dfc8cfc1e9b25b
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
media: qcom: camss: Use data-lanes starting at 1 for new CSIPHY mode
This patch updates the camss driver to support indexing data-lanes starting at
1 for the new CSIPHY mode. It introduces a flag to differentiate between the
legacy 0-based indexing and the new 1-based indexing, normalizing the inputs
for the CSID decoder.
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 84097d82d99c9..07b3cddca5840 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -4777,7 +4778,14 @@ static int camss_parse_endpoint_node(struct device *dev,
> return -ENOMEM;
>
> for (i = 0; i < lncfg->num_data; i++) {
> - lncfg->data[i].pos = mipi_csi2->data_lanes[i];
> + u8 lane = mipi_csi2->data_lanes[i];
> +
> + if (lane < lane_base || lane - lane_base >= lncfg->num_data) {
[Severity: High]
Does this bounds check erroneously reject valid sparse data-lane
configurations?
If a device tree specifies non-contiguous lanes, the physical lane index
can be greater than or equal to the total count of active lanes. For example,
if data-lanes = <0 2>, num_data is 2, but the lane index is 2, which triggers
the 2 >= 2 condition.
Will this unconditionally return -EINVAL and break the device probe for valid
sparse configurations?
> + dev_err(dev, "invalid data-lane %u\n", lane);
> + return -EINVAL;
> + }
> +
> + lncfg->data[i].pos = mipi_csi2->data_lanes[i] - lane_base;
> lncfg->data[i].pol = mipi_csi2->lane_polarities[i + 1];
> }
[ ... ]
Can initialized PHY clocks and regulators leak on error paths?
Looking at camss_init_subdevices():
drivers/media/platform/qcom/camss/camss.c:camss_init_subdevices() {
...
for (i = 0; i < camss->res->csiphy_num; i++) {
...
if (ret < 0) {
dev_err(camss->dev, "csiphy %d init fail\n",
res->csiphy_res[i].csiphy.id);
return ret;
}
}
...
}
[Severity: Medium]
If msm_csiphy_subdev_init() fails for a CSIPHY instance after the first, does
this error path return immediately without calling phy_exit() to clean up the
clocks and regulators for PHYs that were successfully initialized (from index
0 to i-1)?
This also appears to happen during registration fallback:
drivers/media/platform/qcom/camss/camss.c:camss_register_entities() {
...
err_reg_csiphy:
for (i--; i >= 0; i--) {
if (csiphy_enabled(camss, &camss->csiphy[i]))
msm_csiphy_unregister_entity(&camss->csiphy[i]);
}
...
}
[Severity: Medium]
When CSIPHY registration fails, this rollback loop only cleans up the PHYs
that were successfully registered to V4L2.
Because all PHYs were previously initialized by camss_init_subdevices(), do
the PHYs from the failing index onwards leak their clocks and regulators since
their phy_exit() is never called?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260906-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v17-0-e2197a3e2551@linaro.org?part=5
next prev parent reply other threads:[~2026-09-06 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 14:17 [PATCH v17 0/5] Add phy_get_by_of_node and devm helper Bryan O'Donoghue
2026-09-06 14:17 ` [PATCH v17 1/5] phy: core: Fix use-after-free in phy_get paths Bryan O'Donoghue
2026-09-06 14:17 ` [PATCH v17 2/5] phy: core: Add phy_get_by_of_node() Bryan O'Donoghue
2026-09-06 14:31 ` sashiko-bot
2026-09-06 14:17 ` [PATCH v17 3/5] phy: core: Add devm_phy_get_by_of_node() Bryan O'Donoghue
2026-09-06 14:17 ` [PATCH v17 4/5] media: qcom: camss: Add support for PHY API devices Bryan O'Donoghue
2026-09-06 14:32 ` sashiko-bot
2026-09-06 14:17 ` [PATCH v17 5/5] media: qcom: camss: Use data-lanes starting at 1 for new CSIPHY mode Bryan O'Donoghue
2026-09-06 14:28 ` sashiko-bot [this message]
2026-09-06 15:47 ` Nihal Kumar Gupta
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=20260906142855.A65671F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=media-ci@linuxtv.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox