From: Mario Limonciello <mario.limonciello@amd.com>
To: <mario.limonciello@amd.com>,
Philipp Zabel <philipp.zabel@gmail.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: <luke@ljones.dev>, <Shyam-sundar.S-k@amd.com>,
Richard Gong <Richard.Gong@amd.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, <linux-acpi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference
Date: Wed, 28 Sep 2022 11:19:34 -0500 [thread overview]
Message-ID: <20220928161935.31913-1-mario.limonciello@amd.com> (raw)
Ryzen 7000 (Raphael) introduced AMDI0008 for _HID. This ID was added
in commit ed470febf837 ("ACPI: PM: s2idle: Add support for upcoming AMD
uPEP HID AMDI008"), but then removed in favor of aligning all new IDs
to Rembrandt support in commit fd894f05cf30 ("ACPI: x86: s2idle: If a
new AMD _HID is missing assume Rembrandt").
Unfortunately there was a mistake in commit 100a57379380 ("ACPI: x86:
s2idle: Move _HID handling for AMD systems into structures") that can
lead to a NULL pointer dereference accessing `dev_id->driver_data` in
the sentinel of `amd_hid_ids`. Fix this dereference.
Reported-by: Richard Gong <Richard.Gong@amd.com>
Fixes: 100a57379380 ("ACPI: x86: s2idle: Move _HID handling for AMD systems into structures")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/acpi/x86/s2idle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index eedd21d8a284..3ae2ba74de92 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -470,7 +470,7 @@ static int lps0_device_attach(struct acpi_device *adev,
for (dev_id = &amd_hid_ids[0]; dev_id->id[0]; dev_id++)
if (acpi_dev_hid_uid_match(adev, dev_id->id, NULL))
break;
- if (dev_id)
+ if (dev_id->id[0])
data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data;
else
data = &amd_rembrandt;
--
2.34.1
next reply other threads:[~2022-09-28 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 16:19 Mario Limonciello [this message]
2022-09-28 16:19 ` [PATCH 2/2] ACPI: x86: s2idle: Add another ID to s2idle_dmi_table Mario Limonciello
2022-09-29 1:00 ` Luke Jones
2022-09-28 19:36 ` [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference Rafael J. Wysocki
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=20220928161935.31913-1-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Richard.Gong@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=philipp.zabel@gmail.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@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
all inboxes | Powered by JetHome®