Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Mark Pearson <markpearson@lenovo.com>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
	"Rojewski, Cezary" <cezary.rojewski@intel.com>,
	Mark Brown <broonie@kernel.org>,
	Philipp Leskovitz <philipp.leskovitz@secunet.com>
Subject: Re: [PATCH] ALSA: hda: ignore invalid NHLT table
Date: Tue, 2 Mar 2021 08:46:06 -0600	[thread overview]
Message-ID: <420b9b48-0a80-634b-9a98-973c6bdb544c@linux.intel.com> (raw)
In-Reply-To: <20210302141003.7342-1-markpearson@lenovo.com>

Adding Mark, Takashi, Jaroslav and Cezary in Cc:

On 3/2/21 8:10 AM, Mark Pearson wrote:
> 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 <philipp.leskovitz@secunet.com>
> Reported-by: Philipp Leskovitz <philipp.leskovitz@secunet.com>
> Signed-off-by: Mark Pearson <markpearson@lenovo.com>

The change looks good to me

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Out of curiosity, does this impact Kabylake or CometLake+ systems?

Thanks!

> ---
>   sound/hda/intel-nhlt.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c
> index 059aaf04f..0889f2cc5 100644
> --- a/sound/hda/intel-nhlt.c
> +++ b/sound/hda/intel-nhlt.c
> @@ -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++) {
> 

  reply	other threads:[~2021-03-02 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 14:10 [PATCH] ALSA: hda: ignore invalid NHLT table Mark Pearson
2021-03-02 14:46 ` Pierre-Louis Bossart [this message]
2021-03-02 15:57   ` [External] " Mark Pearson
2021-03-04  8:27     ` Takashi Iwai
2021-03-04 14:30       ` Mark Pearson
  -- strict thread matches above, loose matches on Subject: below --
2021-03-02 14:41 Mark Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=420b9b48-0a80-634b-9a98-973c6bdb544c@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=markpearson@lenovo.com \
    --cc=philipp.leskovitz@secunet.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox