Skip to content

Commit

Permalink
ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1866403

[ Upstream commit 921162c ]

When the PCM_PARAM IPC fails while configuring the FE, the kernel
oopses in the HDaudio link DMA .hw_free operation. The root cause is a
NULL dma_data since the BE .hw_params was never called by the SOC
core.

This error can also happen if the HDaudio link DMA configuration IPC
fails in the BE .hw_params.

This patches makes sure the dma_data is properly saved in .hw_params,
and tested before being use in hw_free.

GitHub issue: thesofproject#1417

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191218000518.5830-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
  • Loading branch information
plbossart authored and kelmously committed Mar 13, 2020
1 parent ee374dc commit 75386ba
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sound/soc/sof/intel/hda-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream,
if (!link_dev)
return -EBUSY;

snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);

stream_tag = hdac_stream(link_dev)->stream_tag;

hda_stream = hstream_to_sof_hda_stream(link_dev);
Expand All @@ -224,8 +226,6 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream,
if (ret < 0)
return ret;

snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);

hda_stream->hw_params_upon_resume = 0;

link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name);
Expand Down Expand Up @@ -357,6 +357,13 @@ static int hda_link_hw_free(struct snd_pcm_substream *substream,
bus = hstream->bus;
rtd = snd_pcm_substream_chip(substream);
link_dev = snd_soc_dai_get_dma_data(dai, substream);

if (!link_dev) {
dev_dbg(dai->dev,
"%s: link_dev is not assigned\n", __func__);
return -EINVAL;
}

hda_stream = hstream_to_sof_hda_stream(link_dev);

/* free the link DMA channel in the FW */
Expand Down

0 comments on commit 75386ba

Please sign in to comment.