From 19b97684fd2a18fa486209a30a75cfca6aa97bde Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 30 Jan 2021 16:30:12 +0100 Subject: [PATCH] 4.4-stable patches added patches: acpi-sysfs-prefer-compatible-modalias.patch --- ...cpi-sysfs-prefer-compatible-modalias.patch | 65 +++++++++++++++++++ queue-4.4/series | 1 + 2 files changed, 66 insertions(+) create mode 100644 queue-4.4/acpi-sysfs-prefer-compatible-modalias.patch create mode 100644 queue-4.4/series diff --git a/queue-4.4/acpi-sysfs-prefer-compatible-modalias.patch b/queue-4.4/acpi-sysfs-prefer-compatible-modalias.patch new file mode 100644 index 00000000000..89f79812120 --- /dev/null +++ b/queue-4.4/acpi-sysfs-prefer-compatible-modalias.patch @@ -0,0 +1,65 @@ +From 36af2d5c4433fb40ee2af912c4ac0a30991aecfc Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Fri, 22 Jan 2021 20:53:02 +0800 +Subject: ACPI: sysfs: Prefer "compatible" modalias + +From: Kai-Heng Feng + +commit 36af2d5c4433fb40ee2af912c4ac0a30991aecfc upstream. + +Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when +"compatible" is present") may create two "MODALIAS=" in one uevent +file if specific conditions are met. + +This breaks systemd-udevd, which assumes each "key" in one uevent file +to be unique. The internal implementation of systemd-udevd overwrites +the first MODALIAS with the second one, so its kmod rule doesn't load +the driver for the first MODALIAS. + +So if both the ACPI modalias and the OF modalias are present, use the +latter to ensure that there will be only one MODALIAS. + +Link: https://github.com/systemd/systemd/pull/18163 +Suggested-by: Mika Westerberg +Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present") +Signed-off-by: Kai-Heng Feng +Reviewed-by: Mika Westerberg +Reviewed-by: Greg Kroah-Hartman +Cc: 4.1+ # 4.1+ +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/device_sysfs.c | 20 ++++++-------------- + 1 file changed, 6 insertions(+), 14 deletions(-) + +--- a/drivers/acpi/device_sysfs.c ++++ b/drivers/acpi/device_sysfs.c +@@ -259,20 +259,12 @@ int __acpi_device_uevent_modalias(struct + if (add_uevent_var(env, "MODALIAS=")) + return -ENOMEM; + +- len = create_pnp_modalias(adev, &env->buf[env->buflen - 1], +- sizeof(env->buf) - env->buflen); +- if (len < 0) +- return len; +- +- env->buflen += len; +- if (!adev->data.of_compatible) +- return 0; +- +- if (len > 0 && add_uevent_var(env, "MODALIAS=")) +- return -ENOMEM; +- +- len = create_of_modalias(adev, &env->buf[env->buflen - 1], +- sizeof(env->buf) - env->buflen); ++ if (adev->data.of_compatible) ++ len = create_of_modalias(adev, &env->buf[env->buflen - 1], ++ sizeof(env->buf) - env->buflen); ++ else ++ len = create_pnp_modalias(adev, &env->buf[env->buflen - 1], ++ sizeof(env->buf) - env->buflen); + if (len < 0) + return len; + diff --git a/queue-4.4/series b/queue-4.4/series new file mode 100644 index 00000000000..4b46c783980 --- /dev/null +++ b/queue-4.4/series @@ -0,0 +1 @@ +acpi-sysfs-prefer-compatible-modalias.patch -- 2.47.3