]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
xen/acpi: off by one in read_acpi_id()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Mar 2018 09:01:53 +0000 (12:01 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ]

If acpi_id is == nr_acpi_bits, then we access one element beyond the end
of the acpi_psd[] array or we set one bit beyond the end of the bit map
when we do __set_bit(acpi_id, acpi_id_present);

Fixes: 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/xen/xen-acpi-processor.c

index 23e391d3ec015d0c5b38b21619898c282826f59c..22863f5f247419ebf7524d7a4d1b8d50ffa62370 100644 (file)
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv)
        }
        /* There are more ACPI Processor objects than in x2APIC or MADT.
         * This can happen with incorrect ACPI SSDT declerations. */
-       if (acpi_id > nr_acpi_bits) {
-               pr_debug("We only have %u, trying to set %u\n",
-                        nr_acpi_bits, acpi_id);
+       if (acpi_id >= nr_acpi_bits) {
+               pr_debug("max acpi id %u, trying to set %u\n",
+                        nr_acpi_bits - 1, acpi_id);
                return AE_OK;
        }
        /* OK, There is a ACPI Processor object */