Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@oss.qualcomm.com>
Cc: media-ci@linuxtv.org, devicetree@vger.kernel.org,
	conor+dt@kernel.org, neil.armstrong@linaro.org,
	olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org, robh@kernel.org
Subject: Re: [PATCH v20 06/13] media: qcom: camss: csiphy: Add support for v2.4.0 two-phase CSIPHY
Date: Sat, 10 Oct 2026 16:23:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-166734@kernel.org> (raw)
In-Reply-To: <20261010-kaanapali-camss-v20-6-63e98ce9ac0c@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: qcom: camss: NULL deref in msm_csiphy_subdev_init_legacy() on malformed DT
--

commit 08f91d74b650b5a3e039a9cddfa9acbe4783d78b
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: csiphy: Add support for v2.4.0 two-phase CSIPHY

Add support for the v2.4.0 two-phase CSIPHY found on Kaanapali, where
the PHY is driven by the standalone phy-qcom-mipi-csi2 DPHY driver
rather than by CAMSS.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index fca3de214a922..eeceb79c1e863 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -38,6 +38,51 @@
>  
>  static const struct parent_dev_ops vfe_parent_dev_ops;
>  
> +static const struct camss_subdev_resources csiphy_res_kaanapali[] = {
> +	/* CSIPHY0 */
> +	{
> +		.csiphy = {
> +			.id = 0,
> +			.formats = &csiphy_formats_sdm845
> +		},
> +	},

[Severity: High]
Does this configuration cause a NULL pointer dereference if the Device Tree
is malformed?

Since .hw_ops is intentionally omitted for this configuration, it expects to
use the standalone driver. However, if the Device Tree is malformed and lacks
endpoints (for example, if an overlay is missing or incorrectly configured),
camss_detect_legacy_phy() does not execute its loop and legacy_phy remains
true:

drivers/media/platform/qcom/camss/camss.c:camss_detect_legacy_phy() {
    ...
    camss->legacy_phy = true;

    /* Find first remote-endpoint and determine if its a PHY */
    for_each_endpoint_of_node(camss->dev->of_node, ep) {
    ...
}

This true value forces the probe to take the fallback legacy path and call
msm_csiphy_subdev_init_legacy(), which unconditionally dereferences
hw_ops->init:

drivers/media/platform/qcom/camss/camss-csiphy.c:msm_csiphy_subdev_init_legacy() {
    ...
    csiphy->res = &res->csiphy;

    ret = csiphy->res->hw_ops->init(csiphy);
    ...
}

Should untrusted or malformed configurations be handled without panicking the
kernel?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261010-kaanapali-camss-v20-0-63e98ce9ac0c@oss.qualcomm.com?part=6

  reply	other threads:[~2026-10-10 16:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 16:01 [PATCH v20 00/13] media: qcom: camss: Add Kaanapali support Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 01/13] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Kaanapali CSI2 PHY Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 02/13] phy: qcom-mipi-csi2: Parametrise the common status register offset Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 03/13] phy: qcom-mipi-csi2: Add Kaanapali support Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 04/13] media: dt-bindings: Add CAMSS device for Kaanapali Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 05/13] media: qcom: camss: Add Kaanapali compatible Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 06/13] media: qcom: camss: csiphy: Add support for v2.4.0 two-phase CSIPHY Hangxiang Ma
2026-10-10 16:23   ` sashiko-bot [this message]
2026-10-10 16:01 ` [PATCH v20 07/13] media: qcom: camss: csid: Add support for CSID 1080 Hangxiang Ma
2026-10-10 16:22   ` sashiko-bot
2026-10-10 16:01 ` [PATCH v20 08/13] media: qcom: camss: vfe: Add support for VFE 1080 Hangxiang Ma
2026-10-10 16:25   ` sashiko-bot
2026-10-11  8:56   ` Bryan O'Donoghue
2026-10-12  1:25     ` hangxiang.ma
2026-10-10 16:01 ` [PATCH v20 09/13] media: qcom: camss: tpg: Add support for v2.4.0 TPG Hangxiang Ma
2026-10-10 16:19   ` sashiko-bot
2026-10-10 16:01 ` [PATCH v20 10/13] arm64: dts: qcom: kaanapali: Add CAMSS and CSIPHY block definitions Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 11/13] arm64: dts: qcom: kaanapali: Add CCI controller nodes Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 12/13] arm64: dts: qcom: kaanapali: Add camera MCLK pinctrl Hangxiang Ma
2026-10-10 16:01 ` [PATCH v20 13/13] arm64: dts: qcom: kaanapali-mtp-camera-s5kjn5: Add DT overlay Hangxiang Ma
2026-10-10 16:21   ` sashiko-bot

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-166734@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox