All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference
@ 2022-09-28 16:19 Mario Limonciello
  2022-09-28 16:19 ` [PATCH 2/2] ACPI: x86: s2idle: Add another ID to s2idle_dmi_table Mario Limonciello
  2022-09-28 19:36 ` [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Mario Limonciello @ 2022-09-28 16:19 UTC (permalink / raw)
  To: mario.limonciello, Philipp Zabel, Rafael J. Wysocki
  Cc: luke, Shyam-sundar.S-k, Richard Gong, Rafael J. Wysocki,
	Len Brown, linux-acpi, linux-kernel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ACPI: x86: s2idle: Add another ID to s2idle_dmi_table
  2022-09-28 16:19 [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference Mario Limonciello
@ 2022-09-28 16:19 ` 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
  1 sibling, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2022-09-28 16:19 UTC (permalink / raw)
  To: mario.limonciello, linux-kernel
  Cc: luke, Shyam-sundar.S-k, Rafael J. Wysocki, Len Brown, linux-acpi

It's reported that "ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW" has
non-functional fans after resume when using the AMD codepath.  This
issue is fixed using the Microsoft codepath.

Add the 3 variants of this system to the Microsoft codepath DMI table.
* GV601RW
* GV601RM
* GV601RE

Link: https://www.reddit.com/r/linuxhardware/comments/wh50nd/compatibility_report_asus_rog_flow_x16_gv601rm/
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2148#note_1571241
Reported-by: Luke Jones <luke@ljones.dev>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/x86/s2idle.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 3ae2ba74de92..0155c1d2d608 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -451,6 +451,17 @@ static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13 GV301"),
 		},
 	},
+	{
+		/*
+		 * ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW_GV601RW
+		 * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
+		 */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X16 GV601"),
+		},
+	},
 	{}
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference
  2022-09-28 16:19 [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference Mario Limonciello
  2022-09-28 16:19 ` [PATCH 2/2] ACPI: x86: s2idle: Add another ID to s2idle_dmi_table Mario Limonciello
@ 2022-09-28 19:36 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-09-28 19:36 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Philipp Zabel, Rafael J. Wysocki, Luke D. Jones,
	Shyam Sundar S K, Richard Gong, Rafael J. Wysocki, Len Brown,
	ACPI Devel Maling List, Linux Kernel Mailing List

On Wed, Sep 28, 2022 at 6:19 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> 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;
> --

Applied along with the [2/2], thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ACPI: x86: s2idle: Add another ID to s2idle_dmi_table
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Luke Jones @ 2022-09-29  1:00 UTC (permalink / raw)
  To: Mario Limonciello, linux-kernel
  Cc: Shyam-sundar.S-k, Rafael J. Wysocki, Len Brown, linux-acpi

On Wed, 2022-09-28 at 11:19 -0500, Mario Limonciello wrote:
> It's reported that "ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW" has
> non-functional fans after resume when using the AMD codepath.  This
> issue is fixed using the Microsoft codepath.
> 
> Add the 3 variants of this system to the Microsoft codepath DMI
> table.
> * GV601RW
> * GV601RM
> * GV601RE
> 
> Link:
> https://www.reddit.com/r/linuxhardware/comments/wh50nd/compatibility_report_asus_rog_flow_x16_gv601rm/
> Link:
> https://gitlab.freedesktop.org/drm/amd/-/issues/2148#note_1571241
> Reported-by: Luke Jones <luke@ljones.dev>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/acpi/x86/s2idle.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index 3ae2ba74de92..0155c1d2d608 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -451,6 +451,17 @@ static const struct dmi_system_id
> s2idle_dmi_table[] __initconst = {
>                         DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13
> GV301"),
>                 },
>         },
> +       {
> +               /*
> +                * ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW_GV601RW
> +                *
> https://gitlab.freedesktop.org/drm/amd/-/issues/2148
> +                */
> +               .callback = lps0_prefer_microsoft,
> +               .matches = {
> +                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER
> INC."),
> +                       DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X16
> GV601"),
> +               },
> +       },
>         {}
>  };
>  

Hi Mario,

related dts here
https://gitlab.com/asus-linux/reverse-engineering/-/tree/master/GV601R


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-29  1:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 16:19 [PATCH 1/2] ACPI: x86: s2idle: Fix a NULL pointer dereference Mario Limonciello
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

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.