devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cunyuan Liu" <cunyuan.liu@cixtech.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, ojeda@kernel.org,
	gary@garyguo.net
Subject: Re: [PATCH 2/3] drm/panthor: Add initial support for CIX Sky1
Date: Fri, 06 Nov 2026 10:58:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-201259@kernel.org> (raw)
In-Reply-To: <20261106104735.1651267-3-cunyuan.liu@cixtech.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/panthor: memory leak and use-after-free in
  panthor_devfreq_init() [1]
--

commit a4d7e2c7598493163cc0be92c3c3410ed211540f
Author: Cunyuan Liu <cunyuan.liu@cixtech.com>

drm/panthor: Add initial support for CIX Sky1

This commit adds SoC data and driver handling for CIX Sky1 to perform an
external GPU reset on initial resume, program SYSC_ALLOC registers before
L2 power-on, and skip devfreq initialization.

> diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c b/drivers/gpu/drm/panthor/panthor_devfreq.c
> index 2249b41ca4afe..1914549f7b1fb 100644
> --- a/drivers/gpu/drm/panthor/panthor_devfreq.c
> +++ b/drivers/gpu/drm/panthor/panthor_devfreq.c
> @@ -154,6 +154,12 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
>  
>  	ptdev->devfreq = pdevfreq;
>  
> +	/* Keep the firmware clock settings until Sky1 devfreq is supported. */
> +	if (ptdev->soc_data && ptdev->soc_data->skip_devfreq) {
> +		ptdev->fast_rate = clk_get_rate(ptdev->clks.core);
> +		return 0;
> +	}
> +
>  	/*
>  	 * The power domain associated with the GPU may have already added an
>  	 * OPP table, complete with OPPs, as part of the platform bus

[Severity: Critical]
This problem wasn't introduced by this patch, but does panthor_devfreq_init()
leak the cooling device [1] and leave a dangling pointer to
pdevfreq->devfreq on unbind?

drivers/gpu/drm/panthor/panthor_devfreq.c:panthor_devfreq_init() {
	...
	pdevfreq->devfreq = devm_devfreq_add_device(dev, &panthor_devfreq_profile,
						    DEVFREQ_GOV_SIMPLE_ONDEMAND,
						    &pdevfreq->gov_data);
	...
	cooling = devfreq_cooling_em_register(pdevfreq->devfreq, NULL);
	if (IS_ERR(cooling))
		DRM_DEV_INFO(dev, "Failed to register cooling device\n");

	return 0;
}

cooling is registered with non-devm devfreq_cooling_em_register() and
never saved or unregistered, while pdevfreq->devfreq is managed by devres
and freed when the device is unbound.  Any subsequent thermal governor or
sysfs access to the cooling device will dereference the freed devfreq
instance.

[1] https://sashiko.dev/#/bug/linux-aae5bae7-91d6-4e9e-9c28-1cbf604c1457

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106104735.1651267-1-cunyuan.liu@cixtech.com?part=2

  reply	other threads:[~2026-11-06 10:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 10:47 [PATCH 0/3] Add initial GPU support for CIX Sky1 Cunyuan Liu
2026-11-06 10:47 ` [PATCH 1/3] dt-bindings: gpu: Add CIX Sky1 Mali support Cunyuan Liu
2026-11-06 10:54   ` sashiko-bot
2026-11-06 17:17   ` Conor Dooley
2026-11-06 10:47 ` [PATCH 2/3] drm/panthor: Add initial support for CIX Sky1 Cunyuan Liu
2026-11-06 10:58   ` sashiko-bot [this message]
2026-11-06 12:04   ` Philipp Zabel
2026-11-06 13:02     ` Cunyuan Liu (刘存原)
2026-11-06 10:47 ` [PATCH 3/3] arm64: dts: cix: Add GPU support for Sky1 Orion O6 Cunyuan Liu

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-201259@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cunyuan.liu@cixtech.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=ojeda@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).