Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:27 +0100
committerJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:36 +0100
commitf0700759f0d88840fdae004e3fee7bb6acb76d36 (patch)
tree97e3ad115f299ae4418652d4e8770c3a0e711c71
parent037f912a1a92b6c1aaa9632ff31b8a3aa7e1f71b (diff)
ACPI: power: Skip duplicate power resource references in _PRx
-rw-r--r--patches.kernel.org/4.20.3-031-ACPI-power-Skip-duplicate-power-resource-refer.patch92
-rw-r--r--series.conf1
2 files changed, 93 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.3-031-ACPI-power-Skip-duplicate-power-resource-refer.patch b/patches.kernel.org/4.20.3-031-ACPI-power-Skip-duplicate-power-resource-refer.patch
new file mode 100644
index 0000000000..0aa69f4e9f
--- /dev/null
+++ b/patches.kernel.org/4.20.3-031-ACPI-power-Skip-duplicate-power-resource-refer.patch
@@ -0,0 +1,92 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Sun, 30 Dec 2018 18:25:00 +0100
+Subject: [PATCH] ACPI: power: Skip duplicate power resource references in _PRx
+References: bnc#1012628
+Patch-mainline: 4.20.3
+Git-commit: 7d7b467cb95bf29597b417d4990160d4ea6d69b9
+
+commit 7d7b467cb95bf29597b417d4990160d4ea6d69b9 upstream.
+
+Some ACPI tables contain duplicate power resource references like this:
+
+ Name (_PR0, Package (0x04) // _PR0: Power Resources for D0
+ {
+ P28P,
+ P18P,
+ P18P,
+ CLK4
+ })
+
+This causes a WARN_ON in sysfs_add_link_to_group() because we end up
+adding a link to the same acpi_device twice:
+
+sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/808622C1:00/OVTI2680:00/power_resources_D0/LNXPOWER:0a'
+CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.12-301.fc29.x86_64 #1
+Hardware name: Insyde CherryTrail/Type2 - Board Product Name, BIOS jumperx.T87.KFBNEEA02 04/13/2016
+Call Trace:
+ dump_stack+0x5c/0x80
+ sysfs_warn_dup.cold.3+0x17/0x2a
+ sysfs_do_create_link_sd.isra.2+0xa9/0xb0
+ sysfs_add_link_to_group+0x30/0x50
+ acpi_power_expose_list+0x74/0xa0
+ acpi_power_add_remove_device+0x50/0xa0
+ acpi_add_single_object+0x26b/0x5f0
+ acpi_bus_check_add+0xc4/0x250
+ ...
+
+To address this issue, make acpi_extract_power_resources() check for
+duplicates and simply skip them when found.
+
+Cc: All applicable <stable@vger.kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+[ rjw: Subject & changelog, comments ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/acpi/power.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
+index 1b475bc1ae16..665e93ca0b40 100644
+--- a/drivers/acpi/power.c
++++ b/drivers/acpi/power.c
+@@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list)
+ }
+ }
+
++static bool acpi_power_resource_is_dup(union acpi_object *package,
++ unsigned int start, unsigned int i)
++{
++ acpi_handle rhandle, dup;
++ unsigned int j;
++
++ /* The caller is expected to check the package element types */
++ rhandle = package->package.elements[i].reference.handle;
++ for (j = start; j < i; j++) {
++ dup = package->package.elements[j].reference.handle;
++ if (dup == rhandle)
++ return true;
++ }
++
++ return false;
++}
++
+ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
+ struct list_head *list)
+ {
+@@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
+ err = -ENODEV;
+ break;
+ }
++
++ /* Some ACPI tables contain duplicate power resource references */
++ if (acpi_power_resource_is_dup(package, start, i))
++ continue;
++
+ err = acpi_add_power_resource(rhandle);
+ if (err)
+ break;
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index f9af9b5ff2..596f0456dc 100644
--- a/series.conf
+++ b/series.conf
@@ -268,6 +268,7 @@
patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch
patches.kernel.org/4.20.3-029-mm-usercopy.c-no-check-page-span-for-stack-obj.patch
patches.kernel.org/4.20.3-030-mm-memcg-fix-reclaim-deadlock-with-writeback.patch
+ patches.kernel.org/4.20.3-031-ACPI-power-Skip-duplicate-power-resource-refer.patch
########################################################
# Build fixes that apply to the vanilla kernel too.