Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
ACPI: x86: s2idle: Fix a NULL pointer dereference
Browse files Browse the repository at this point in the history
Ryzen 7000 (Raphael) introduced AMDI0008 for _HID.  This ID was added
in commit ed470fe ("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 fd894f0 ("ACPI: x86: s2idle: If a
new AMD _HID is missing assume Rembrandt").

Unfortunately there was a mistake in commit 100a573 ("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: 100a573 ("ACPI: x86: s2idle: Move _HID handling for AMD systems into structures")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
superm1 authored and rafaeljw committed Sep 28, 2022
1 parent 631b545 commit 39f8177
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/acpi/x86/s2idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39f8177

Please sign in to comment.