Skip to content

Commit 7a0d59f

Browse files
Wer-Wolfrafaeljw
authored andcommitted
ACPI: EC: Ignore ECDT tables with an invalid ID string
On the MSI Modern 14 C5M the ECDT table contains invalid data: UID : 00000000 GPE Number : 00 /* Invalid, 03 would be correct */ Namepath : "" /* Invalid, "\_SB.PCI0.SBRG.EC" would * be correct */ This slows down the EC access as the wrong GPE event is used for communication. Additionally the ID string is invalid. Ignore such faulty ECDT tables by verifying that the ID string has a valid format. Tested-by: [email protected] Signed-off-by: Armin Wolf <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 19272b3 commit 7a0d59f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/acpi/ec.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
#include <linux/delay.h>
2424
#include <linux/interrupt.h>
2525
#include <linux/list.h>
26+
#include <linux/printk.h>
2627
#include <linux/spinlock.h>
2728
#include <linux/slab.h>
29+
#include <linux/string.h>
2830
#include <linux/suspend.h>
2931
#include <linux/acpi.h>
3032
#include <linux/dmi.h>
@@ -2031,6 +2033,21 @@ void __init acpi_ec_ecdt_probe(void)
20312033
goto out;
20322034
}
20332035

2036+
if (!strstarts(ecdt_ptr->id, "\\")) {
2037+
/*
2038+
* The ECDT table on some MSI notebooks contains invalid data, together
2039+
* with an empty ID string ("").
2040+
*
2041+
* Section 5.2.15 of the ACPI specification requires the ID string to be
2042+
* a "fully qualified reference to the (...) embedded controller device",
2043+
* so this string always has to start with a backslash.
2044+
*
2045+
* By verifying this we can avoid such faulty ECDT tables in a safe way.
2046+
*/
2047+
pr_err(FW_BUG "Ignoring ECDT due to invalid ID string \"%s\"\n", ecdt_ptr->id);
2048+
goto out;
2049+
}
2050+
20342051
ec = acpi_ec_alloc();
20352052
if (!ec)
20362053
goto out;

0 commit comments

Comments
 (0)