From: "Nirujogi, Pratap" <pnirujog@amd.com>
To: Xueqin Luo <luoxueqin@kylinos.cn>,
hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: pratap.nirujogi@amd.com, mario.limonciello@amd.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: Fix NULL deref in amd_isp_probe
Date: Mon, 10 Aug 2026 17:52:44 -0400 [thread overview]
Message-ID: <7ad7533f-c55c-44ec-91a1-53153d632fb3@amd.com> (raw)
In-Reply-To: <20260810032450.692844-1-luoxueqin@kylinos.cn>
On 8/9/2026 11:24 PM, Xueqin Luo wrote:
> [You don't often get email from luoxueqin@kylinos.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> amd_isp_probe() uses ACPI_COMPANION() without NULL check. Add it to
> prevent crash when driver_override matches a device without ACPI
> companion.
>
> Fixes: e1af6f0146d6 ("platform/x86: Update swnode graph for amd isp4")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
> drivers/platform/x86/amd/amd_isp4.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/platform/x86/amd/amd_isp4.c b/drivers/platform/x86/amd/amd_isp4.c
> index 0d494899502c..0026d6663c5c 100644
> --- a/drivers/platform/x86/amd/amd_isp4.c
> +++ b/drivers/platform/x86/amd/amd_isp4.c
> @@ -379,6 +379,11 @@ static int amd_isp_probe(struct platform_device *pdev)
> goto error_unregister_sw_node;
>
> adev = ACPI_COMPANION(&pdev->dev);
> + if (!adev) {
> + ret = -ENODEV;
> + goto error_unregister_notifier;
> + }
> +
> /* initialize root amd_camera_node */
> adev->driver_data = (void *)pinfo->swnodes[0];
>
> @@ -388,6 +393,8 @@ static int amd_isp_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, isp4_platform);
> return 0;
>
> +error_unregister_notifier:
> + bus_unregister_notifier(&i2c_bus_type, &isp4_platform->i2c_nb);
> error_unregister_sw_node:
> software_node_unregister_node_group(isp4_platform->pinfo->swnodes);
> return ret;
LGTM. I agree that adding the NULL check is good practice. That said, I
believe it's not strictly needed as the device_get_match_data() in
line#366 is expected to fail if there is no ACPI companion.
https://github.com/torvalds/linux/blob/master/drivers/platform/x86/amd/amd_isp4.c#L366
Reviewed-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-08-10 21:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 3:24 Xueqin Luo
2026-08-10 21:52 ` Nirujogi, Pratap [this message]
2026-08-11 15:37 ` Mario Limonciello
2026-09-15 20:24 ` Ilpo Järvinen
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=7ad7533f-c55c-44ec-91a1-53153d632fb3@amd.com \
--to=pnirujog@amd.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luoxueqin@kylinos.cn \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=pratap.nirujogi@amd.com \
/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
all inboxes | Powered by JetHome®