Skip to contentSkip to conversation

ACPI: x86: Add adev NULL check to acpi_quirk_skip_serdev_enumeration()

PATCH Applied Hans de Goede 2 participants 2 messages Nov 9, 2024 – Nov 12, 2024 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: x86: Add adev NULL check to acpi_quirk_skip_serdev_enumeration()

acpi_dev_hid_match() does not check for adev == NULL, dereferencing it unconditional.

Add a check for adev being NULL before calling acpi_dev_hid_match().

At the moment acpi_quirk_skip_serdev_enumeration() is never called with a controller_parent without an ACPI companion, but better safe than sorry.

---
 drivers/acpi/x86/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/x86/utils.c +1 -1
index 3eec889d4f5f..423565c31d5e 100644
@@ -536,7 +536,7 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 	 * Set skip to true so that the tty core creates a serdev ctrl device.
 	 * The backlight driver will manually create the serdev client device.
 	 */
-	if (acpi_dev_hid_match(adev, "DELL0501")) {
+	if (adev && acpi_dev_hid_match(adev, "DELL0501")) {
 		*skip = true;
 		/*
 		 * Create a platform dev for dell-uart-backlight to bind to.
Signature · 1 line
2.47.0
maintainer Applied
#1 lore raw
Quoted 19 lines · Hans de Goede

acpi_dev_hid_match() does not check for adev == NULL, dereferencing it unconditional.

Add a check for adev being NULL before calling acpi_dev_hid_match().

At the moment acpi_quirk_skip_serdev_enumeration() is never called with a controller_parent without an ACPI companion, but better safe than sorry.

---
 drivers/acpi/x86/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/x86/utils.c +0 -0
index 3eec889d4f5f..423565c31d5e 100644

drivers/acpi/x86/utils.c int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s

Quoted 9 lines
drivers/acpi/x86/utils.c +1 -2
@@ -536,7 +536,7 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
         * Set skip to true so that the tty core creates a serdev ctrl device.
         * The backlight driver will manually create the serdev client device.
         */
-       if (acpi_dev_hid_match(adev, "DELL0501")) {
+       if (adev && acpi_dev_hid_match(adev, "DELL0501")) {
                *skip = true;
                /*
                 * Create a platform dev for dell-uart-backlight to bind to.
--

Applied as 6.13 material, thanks!