]> git.itanic.dy.fi Git - linux-stable/commitdiff
acpi/x86: ignore unspecified bit positions in the ACPI global lock field
authorJan Engelhardt <jengelh@inai.de>
Thu, 5 Mar 2020 12:24:25 +0000 (13:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Apr 2020 05:58:53 +0000 (07:58 +0200)
commit ecb9c790999fd6c5af0f44783bd0217f0b89ec2b upstream.

The value in "new" is constructed from "old" such that all bits defined
as reserved by the ACPI spec[1] are left untouched. But if those bits
do not happen to be all zero, "new < 3" will not evaluate to true.

The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
garbage inside the "FACS" ACPI table. The starting value is
old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
the reserved bits.

[1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206553
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/acpi/boot.c

index 0a1e8a67cc998a5c2f0bca55a40a38b4a837e706..c3fba8b5275306d1769e18795b0c9bdee0e15e60 100644 (file)
@@ -1717,7 +1717,7 @@ int __acpi_acquire_global_lock(unsigned int *lock)
                new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
                val = cmpxchg(lock, old, new);
        } while (unlikely (val != old));
-       return (new < 3) ? -1 : 0;
+       return ((new & 0x3) < 3) ? -1 : 0;
 }
 
 int __acpi_release_global_lock(unsigned int *lock)