diff options
author | Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> | 2017-11-07 05:46:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-11-08 13:56:21 -0500 |
commit | 3b47c9dc75be097bc0e2f3ac4b176fbf3eed85f2 (patch) | |
tree | 1274157fa5fea9715a5af8a2e57be3cd047f6704 | |
parent | f8e066521192c7debe59127d90abbe2773577e25 (diff) |
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: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/skylake/skl-nhlt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index e7d766d56c8e..d14c50a60289 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
21 | #include "skl.h" | 21 | #include "skl.h" |
22 | 22 | ||
23 | #define NHLT_ACPI_HEADER_SIG "NHLT" | ||
24 | |||
23 | /* Unique identification for getting NHLT blobs */ | 25 | /* Unique identification for getting NHLT blobs */ |
24 | static guid_t osc_guid = | 26 | static guid_t osc_guid = |
25 | GUID_INIT(0xA69F886E, 0x6CEB, 0x4594, | 27 | GUID_INIT(0xA69F886E, 0x6CEB, 0x4594, |
@@ -45,6 +47,13 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev) | |||
45 | memremap(nhlt_ptr->min_addr, nhlt_ptr->length, | 47 | memremap(nhlt_ptr->min_addr, nhlt_ptr->length, |
46 | MEMREMAP_WB); | 48 | MEMREMAP_WB); |
47 | ACPI_FREE(obj); | 49 | ACPI_FREE(obj); |
50 | if (nhlt_table && (strncmp(nhlt_table->header.signature, | ||
51 | NHLT_ACPI_HEADER_SIG, | ||
52 | strlen(NHLT_ACPI_HEADER_SIG)) != 0)) { | ||
53 | memunmap(nhlt_table); | ||
54 | dev_err(dev, "NHLT ACPI header signature incorrect\n"); | ||
55 | return NULL; | ||
56 | } | ||
48 | return nhlt_table; | 57 | return nhlt_table; |
49 | } | 58 | } |
50 | 59 | ||