All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@oss.qualcomm.com>
Cc: neil.armstrong@linaro.org, robh@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org, media-ci@linuxtv.org
Subject: Re: [PATCH v21 06/14] media: qcom: camss: Add Kaanapali compatible
Date: Mon, 12 Oct 2026 07:00:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-167761@kernel.org> (raw)
In-Reply-To: <20261011-kaanapali-camss-v21-6-04fd28d815c6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: camss: missing DT port bounds check causes OOB array access on csiphy
- [High] media: camss: dev_pm_domain_detach() NULL pointer dereference on cleanup
--

commit 226a568dbea1991f8bda4c0b73de0c31f612545e
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: Add Kaanapali compatible

Add CAMSS_KAANAPALI enum, Kaanapali compatible and Kaanapali CAMSS driver
private data. The private data currently includes only basic information.
Later changes will add CSIPHY, TPG, CSID and VFE resources.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index c54185c93a8a9..fca3de214a922 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c

[ ... ]

> @@ -5576,6 +5590,13 @@ static void camss_remove(struct platform_device *pdev)
>  	camss_genpd_cleanup(camss);
>  }
>  
> +static const struct camss_resources kaanapali_resources = {
> +	.version = CAMSS_KAANAPALI,
> +	.pd_name = "top",
> +	.icc_res = icc_res_kaanapali,
> +	.icc_path_num = ARRAY_SIZE(icc_res_kaanapali),
> +};
> +

[Severity: High]
Can this empty csiphy configuration lead to an out-of-bounds array access on
the csiphy array?

In camss_parse_endpoint_node(), the device tree port number is assigned
directly to the interface ID without bounds checking against
camss->res->csiphy_num:

	csd->interface.csiphy_id = vep.base.port;

Since kaanapali_resources omits csiphy_num, it defaults to 0. This causes
the camss->csiphy array to be dynamically allocated as a ZERO_SIZE_PTR.

If a device tree specifies an endpoint (even port = <0>), it evaluates to an
out-of-bounds access when the async subdevice binds in
camss_subdev_notifier_bound():

	u8 id = csd->interface.csiphy_id;
	struct csiphy_device *csiphy = &camss->csiphy[id];

	csiphy->cfg.csi2 = &csd->interface.csi2;

Could this cause a regression leading to a kernel panic if the driver
processes a device tree containing endpoints for this compatible?

[Severity: High]
Can omitting vfe_num here lead to a NULL pointer dereference during power
domain cleanup?

During probe failure or driver removal, camss_genpd_cleanup() handles power
domain cleanup:

	if (camss->genpd_num == 1)
		return;

	...
	dev_pm_domain_detach(camss->genpd, true);

If the driver is booted with a device tree lacking PM domains, genpd_num
could be 0. This means camss_genpd_cleanup() will not exit early.

If camss->genpd was never successfully attached (for example, due to having
zero VFEs or no PM domains configured), it remains NULL.

Because dev_pm_domain_detach() lacks a check for a NULL dev pointer before
dereferencing dev->pm_domain, could this unconditional call cause a regression
when cleaning up?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-kaanapali-camss-v21-0-04fd28d815c6@oss.qualcomm.com?part=6

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@oss.qualcomm.com>
Cc: neil.armstrong@linaro.org, robh@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org, media-ci@linuxtv.org
Subject: Re: [PATCH v21 06/14] media: qcom: camss: Add Kaanapali compatible
Date: Mon, 12 Oct 2026 07:00:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-167761@kernel.org> (raw)
In-Reply-To: <20261011-kaanapali-camss-v21-6-04fd28d815c6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: camss: missing DT port bounds check causes OOB array access on csiphy
- [High] media: camss: dev_pm_domain_detach() NULL pointer dereference on cleanup
--

commit 226a568dbea1991f8bda4c0b73de0c31f612545e
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: Add Kaanapali compatible

Add CAMSS_KAANAPALI enum, Kaanapali compatible and Kaanapali CAMSS driver
private data. The private data currently includes only basic information.
Later changes will add CSIPHY, TPG, CSID and VFE resources.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index c54185c93a8a9..fca3de214a922 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c

[ ... ]

> @@ -5576,6 +5590,13 @@ static void camss_remove(struct platform_device *pdev)
>  	camss_genpd_cleanup(camss);
>  }
>  
> +static const struct camss_resources kaanapali_resources = {
> +	.version = CAMSS_KAANAPALI,
> +	.pd_name = "top",
> +	.icc_res = icc_res_kaanapali,
> +	.icc_path_num = ARRAY_SIZE(icc_res_kaanapali),
> +};
> +

[Severity: High]
Can this empty csiphy configuration lead to an out-of-bounds array access on
the csiphy array?

In camss_parse_endpoint_node(), the device tree port number is assigned
directly to the interface ID without bounds checking against
camss->res->csiphy_num:

	csd->interface.csiphy_id = vep.base.port;

Since kaanapali_resources omits csiphy_num, it defaults to 0. This causes
the camss->csiphy array to be dynamically allocated as a ZERO_SIZE_PTR.

If a device tree specifies an endpoint (even port = <0>), it evaluates to an
out-of-bounds access when the async subdevice binds in
camss_subdev_notifier_bound():

	u8 id = csd->interface.csiphy_id;
	struct csiphy_device *csiphy = &camss->csiphy[id];

	csiphy->cfg.csi2 = &csd->interface.csi2;

Could this cause a regression leading to a kernel panic if the driver
processes a device tree containing endpoints for this compatible?

[Severity: High]
Can omitting vfe_num here lead to a NULL pointer dereference during power
domain cleanup?

During probe failure or driver removal, camss_genpd_cleanup() handles power
domain cleanup:

	if (camss->genpd_num == 1)
		return;

	...
	dev_pm_domain_detach(camss->genpd, true);

If the driver is booted with a device tree lacking PM domains, genpd_num
could be 0. This means camss_genpd_cleanup() will not exit early.

If camss->genpd was never successfully attached (for example, due to having
zero VFEs or no PM domains configured), it remains NULL.

Because dev_pm_domain_detach() lacks a check for a NULL dev pointer before
dereferencing dev->pm_domain, could this unconditional call cause a regression
when cleaning up?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-kaanapali-camss-v21-0-04fd28d815c6@oss.qualcomm.com?part=6

  reply	other threads:[~2026-10-12  7:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  6:45 [PATCH v21 00/14] media: qcom: camss: Add Kaanapali support Hangxiang Ma
2026-10-12  6:45 ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 01/14] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Kaanapali CSI2 PHY Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 02/14] phy: qcom-mipi-csi2: Parametrise the common status register offset Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 03/14] phy: qcom-mipi-csi2: Add Kaanapali support Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 04/14] media: qcom: camss: Issue stream-on REG_UPDATE from CSID Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:01   ` sashiko-bot
2026-10-12  7:01     ` sashiko-bot
2026-10-12  7:20     ` Hangxiang Ma
2026-10-12  7:20       ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 05/14] media: dt-bindings: Add CAMSS device for Kaanapali Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 06/14] media: qcom: camss: Add Kaanapali compatible Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:00   ` sashiko-bot [this message]
2026-10-12  7:00     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 07/14] media: qcom: camss: csiphy: Add support for v2.4.0 two-phase CSIPHY Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:07   ` sashiko-bot
2026-10-12  7:07     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 08/14] media: qcom: camss: csid: Add support for CSID 1080 Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:59   ` sashiko-bot
2026-10-12  6:59     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 09/14] media: qcom: camss: vfe: Add support for VFE 1080 Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:00   ` sashiko-bot
2026-10-12  7:00     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 10/14] media: qcom: camss: tpg: Add support for v2.4.0 TPG Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:01   ` sashiko-bot
2026-10-12  7:01     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 11/14] arm64: dts: qcom: kaanapali: Add CAMSS and CSIPHY block definitions Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 12/14] arm64: dts: qcom: kaanapali: Add CCI controller nodes Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 13/14] arm64: dts: qcom: kaanapali: Add camera MCLK pinctrl Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 14/14] arm64: dts: qcom: kaanapali-mtp-camera-s5kjn5: Add DT overlay Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:57   ` sashiko-bot
2026-10-12  6:57     ` sashiko-bot
2026-10-12  6:59     ` Hangxiang Ma
2026-10-12  6:59       ` Hangxiang Ma

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=sashiko-outbox-167761@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hangxiang.ma@oss.qualcomm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.