xen/acpi: off by one in read_acpi_id()
Subsystems (2)
PATCH 1/1 xen/acpi: off by one in read_acpi_id()
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_cst_present);
drivers/xen/xen-acpi-processor.c +1 -1
@@ -364,7 +364,7 @@ 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) { +if (acpi_id >= nr_acpi_bits) {pr_debug ("We only have %u, trying to set %u\n" , nr_acpi_bits, acpi_id);return AE_OK ;
Quoted 12 lines · Dan Carpenter
If
acpi_idis =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_cst_present);Fixes 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")Signed-off-by Dan Carpenter <[email protected]>drivers/xen/xen-acpi-processor.c +0
-0
drivers/xen/xen-acpi-processor.c read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv) · line 369
Quoted 7 lines
drivers/xen/xen-acpi-processor.c +1
-1@@ -364,7 +364,7 @@ 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) { +if (acpi_id >= nr_acpi_bits) {pr_debug ("We only have %u, trying to set %u\n" , nr_acpi_bits, acpi_id);
Can you please modify this message, too? E.g. something like:
pr_debug("max acpi id %u, trying to set %u\n",
nr_acpi_bits - 1, acpi_id);
With that:
Juergen
Quoted 23 lines · Juergen Gross
Quoted 12 lines · Dan Carpenter
If
acpi_idis =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_cst_present);Fixes 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")Signed-off-by Dan Carpenter <[email protected]>drivers/xen/xen-acpi-processor.c +0
-0drivers/xen/xen-acpi-processor.c read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv) · line 369
Quoted 7 lines
drivers/xen/xen-acpi-processor.c +1
-1@@ -364,7 +364,7 @@ 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) { +if (acpi_id >= nr_acpi_bits) {pr_debug ("We only have %u, trying to set %u\n" , nr_acpi_bits, acpi_id);Can you please modify this message, too? E.g. something like:
Quoted 7 lines
pr_debug("max acpi id %u, trying to set %u\n",
nr_acpi_bits - 1, acpi_id);With that:
Reviewed-by Juergen Gross <[email protected]>
Sure, let me resend.
regards,
dan carpenter
Quoted 4 lines · Dan Carpenter
If
acpi_idis =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_cst_present);
... or even acpi_id_present (which comes right after the condition you're fixing).
Quoted 3 lines
Fixes 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")Signed-off-by Dan Carpenter <[email protected]>
FWIW,
Quoted 14 lines
drivers/xen/xen-acpi-processor.c +1
-1@@ -364,7 +364,7 @@ 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) { +if (acpi_id >= nr_acpi_bits) {pr_debug ("We only have %u, trying to set %u\n" , nr_acpi_bits, acpi_id);return AE_OK ;
PATCH v2 1/1 xen/acpi: off by one in read_acpi_id()
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);
drivers/xen/xen-acpi-processor.c +3 -3
@@ -364,9 +364,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 */
Boris Ostrovsky
AppliedQuoted 8 lines · Dan Carpenter
If
acpi_idis =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 <[email protected]>Reviewed-by Joao Martins <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Applied to for-linus-4.17
-boris