All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nihal Kumar Gupta" <nihal.gupta@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v3 2/2] media: qcom: camss: Add Glymur-specific resources
Date: Thu, 19 Nov 2026 15:20:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-223366@kernel.org> (raw)
In-Reply-To: <20261119-glymur_camss-v3-2-71ab966c41c9@oss.qualcomm.com>

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

commit d70c41f9364c13281ae9244b3389299002ad38d7
Author: Nihal Kumar Gupta <nihal.gupta@oss.qualcomm.com>

media: qcom: camss: Add Glymur-specific resources

This commit adds Glymur-specific CSIPHY and CAMSS resources so that ports
0, 1 and 2 map to hardware PHY IDs 0, 1 and 4 while reusing X1E80100
resources for the remaining blocks.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index f8e5cf9f3ff09..f3cab9ecef042 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -4103,6 +4103,30 @@ static const struct resources_icc icc_res_sa8775p[] = {
>  	},
>  };
>  
> +static const struct camss_subdev_resources csiphy_res_glymur[] = {
> +	/* CSIPHY0 */
> +	{
> +		.csiphy = {
> +			.id = 0,
> +			.formats = &csiphy_formats_sdm845
> +		},
> +	},
> +	/* CSIPHY1 */
> +	{
> +		.csiphy = {
> +			.id = 1,
> +			.formats = &csiphy_formats_sdm845
> +		},
> +	},
> +	/* CSIPHY4 */
> +	{
> +		.csiphy = {
> +			.id = 4,
> +			.formats = &csiphy_formats_sdm845
> +		},
> +	},
> +};

[Severity: High]
Can probing qcom,glymur-camss trigger a NULL pointer dereference in
msm_csiphy_subdev_init_legacy() when no CSI2 PHY remote-endpoint is
connected in Device Tree?

csiphy_res_glymur leaves .csiphy.hw_ops NULL.  In camss_init_subdevices(),
camss_detect_legacy_phy() defaults camss->legacy_phy to true and only sets
it to false if it finds an endpoint with a remote port parent named "phy":

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) {
		remote = of_graph_get_remote_port_parent(ep);
		if (!remote)
			continue;

		camss->legacy_phy = !of_node_name_eq(remote, "phy");
		of_node_put(remote);
		of_node_put(ep);
		break;
	}
}

Because endpoints under ports are optional (for example when using only
the internal TPGs or before board endpoints are wired up),
camss->legacy_phy remains true when none are present.
camss_init_subdevices() then calls msm_csiphy_subdev_init_legacy(), which
unconditionally calls csiphy->res->hw_ops->init(csiphy).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-glymur_camss-v3-0-71ab966c41c9@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-19 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 15:04 [PATCH v3 0/2] media: qcom: camss: Fix Glymur CSIPHY topology Nihal Kumar Gupta
2026-11-19 15:04 ` [PATCH v3 1/2] dt-bindings: media: qcom,glymur-camss: Use linear CSI ports Nihal Kumar Gupta
2026-11-19 15:04 ` [PATCH v3 2/2] media: qcom: camss: Add Glymur-specific resources Nihal Kumar Gupta
2026-11-19 15:20   ` sashiko-bot [this message]
2026-11-20  5:10     ` Nihal Kumar Gupta
2026-11-20  8:30   ` Loic Poulain
2026-11-20 17:41   ` Jesse Casco

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-223366@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=nihal.gupta@oss.qualcomm.com \
    --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 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.