ALSA: hda: ignore invalid NHLT table
PATCH 1/1 ALSA: hda: ignore invalid NHLT table
On some Lenovo systems if the microphone is disabled in the BIOS only the NHLT table header is created, with no data. This means the endpoints field is not correctly set to zero - leading to an unintialised variable and hence invalid descriptors are parsed leading to page faults.
The Lenovo firmware team is addressing this, but adding a check preventing invalid tables being parsed is worthwhile.
Tested on a Lenovo T14.
Tested-by Philipp Leskovitz <[email protected]>
Reported-by Philipp Leskovitz <[email protected]>
Signed-off-by Mark Pearson <[email protected]>
--- sound/hda/intel-nhlt.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/hda/intel-nhlt.c +5 -0
@@ -37,6 +37,11 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt)if (!nhlt)return 0 ; +if (nhlt->header.length <=sizeof (struct acpi_table_header )) { +dev_warn (dev,"Invalid DMIC description table\n" ); +return 0 ; + } + epnt = (struct nhlt_endpoint *)nhlt->desc;for (j =0 ; j < nhlt->endpoint_count; j++) {
Signature · 1 line
2.29.2