Commit 3b47c9dc authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Mark Brown

ASoC: Intel: Skylake: Check for NHLT ACPI header signature

In certain buggy BIOS acpi_evaluate_dsm() may not return the correct
NHLT table, so check the NHLT table header signature before accessing
it.
Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f8e06652
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <linux/pci.h> #include <linux/pci.h>
#include "skl.h" #include "skl.h"
#define NHLT_ACPI_HEADER_SIG "NHLT"
/* Unique identification for getting NHLT blobs */ /* Unique identification for getting NHLT blobs */
static guid_t osc_guid = static guid_t osc_guid =
GUID_INIT(0xA69F886E, 0x6CEB, 0x4594, GUID_INIT(0xA69F886E, 0x6CEB, 0x4594,
...@@ -45,6 +47,13 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev) ...@@ -45,6 +47,13 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
memremap(nhlt_ptr->min_addr, nhlt_ptr->length, memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
MEMREMAP_WB); MEMREMAP_WB);
ACPI_FREE(obj); ACPI_FREE(obj);
if (nhlt_table && (strncmp(nhlt_table->header.signature,
NHLT_ACPI_HEADER_SIG,
strlen(NHLT_ACPI_HEADER_SIG)) != 0)) {
memunmap(nhlt_table);
dev_err(dev, "NHLT ACPI header signature incorrect\n");
return NULL;
}
return nhlt_table; return nhlt_table;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment