summaryrefslogtreecommitdiffstats
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorDavid Arcari <darcari@redhat.com>2018-08-27 15:19:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-13 11:08:18 -0800
commit316f31f13f3c5a339c9874575aeeb405ae26a148 (patch)
tree1540cbc5fd9d3024c1f14d48ea6172bbbafcf85f /drivers/mailbox
parent8e071518d17a61ef07a388b5e3c4363e771225c1 (diff)
downloadlinux-stable-316f31f13f3c5a339c9874575aeeb405ae26a148.tar.gz
linux-stable-316f31f13f3c5a339c9874575aeeb405ae26a148.tar.bz2
linux-stable-316f31f13f3c5a339c9874575aeeb405ae26a148.zip
mailbox: PCC: handle parse error
commit afd0b1fb22269f48d68fdf269891c653818c8047 upstream. acpi_pcc_probe() calls acpi_table_parse_entries_array() but fails to check for an error return. This in turn can result in calling kcalloc() with a negative count as well as emitting the following misleading erorr message: [ 2.642015] Could not allocate space for PCC mbox channels Fixes: 8f8027c5f935 (mailbox: PCC: erroneous error message when parsing ACPI PCCT) Signed-off-by: David Arcari <darcari@redhat.com> Reviewed-by: Al Stone <ahs3@redhat.com> Cc: 4.18+ <stable@vger.kernel.org> # 4.18+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/pcc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 311e91b1a14f..256f18b67e8a 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -461,8 +461,11 @@ static int __init acpi_pcc_probe(void)
count = acpi_table_parse_entries_array(ACPI_SIG_PCCT,
sizeof(struct acpi_table_pcct), proc,
ACPI_PCCT_TYPE_RESERVED, MAX_PCC_SUBSPACES);
- if (count == 0 || count > MAX_PCC_SUBSPACES) {
- pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
+ if (count <= 0 || count > MAX_PCC_SUBSPACES) {
+ if (count < 0)
+ pr_warn("Error parsing PCC subspaces from PCCT\n");
+ else
+ pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
return -EINVAL;
}