[PATCH] ASoC: Intel: skl_hda_dsp_generic: Fix NULLptr dereference in autosuspend delay
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Wed Jul 22 20:24:19 CEST 2020
On 7/22/20 12:35 PM, Mateusz Gorski wrote:
> Different modules for HDMI codec are used depending on the
> "hda_codec_use_common_hdmi" option being enabled or not. Driver private
> context for both of them is different.
> This leads to null-pointer dereference error when driver tries to set
> autosuspend delay for HDMI codec while the option is off (hdac_hdmi
> module is used for HDMI).
>
> Change the string in conditional statement to "ehdaudio0D0" to ensure
> that only the HDAudio codec is handled by this function.
I am not sure this is correct.
I may be wrong, but my understanding is the following:
Before 5bf73b1b1dec, the driver would use the first dailink of the card,
and in the case of devices without an HDaudio codec (e.g. Up2 board) it
would set the auto suspend delay using that first dailink. See the code
in skl_hda_fill_card_info(), it reorders the dailinks when HDaudio
codecs are not present so if you test for 'edhaudio00' you no longer
allow for this HDMI-only case to be handled with autosuspend.
Kai would need to review this, so this will have to wait I am afraid.
>
> Fixes: 5bf73b1b1dec ("ASoC: intel/skl/hda - fix oops on systems without i915 audio codec")
> Signed-off-by: Mateusz Gorski <mateusz.gorski at linux.intel.com>
> ---
> sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c
> index ca4900036ead..bc50eda297ab 100644
> --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c
> +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c
> @@ -181,7 +181,7 @@ static void skl_set_hda_codec_autosuspend_delay(struct snd_soc_card *card)
> struct snd_soc_dai *dai;
>
> for_each_card_rtds(card, rtd) {
> - if (!strstr(rtd->dai_link->codecs->name, "ehdaudio"))
> + if (!strstr(rtd->dai_link->codecs->name, "ehdaudio0D0"))
> continue;
> dai = asoc_rtd_to_codec(rtd, 0);
> hda_pvt = snd_soc_component_get_drvdata(dai->component);
>
More information about the Alsa-devel
mailing list