[Sound-open-firmware] [PATCH] ASoC: sof: Fix oops due to trace_sleep use before init
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Tue Mar 20 00:28:44 CET 2018
Thanks Daniel for the patch.
I'd need Liam and Yan to chime in since the error handling would be a
bit different from what it is today, see below.
On 3/19/18 3:47 PM, Daniel Baluta wrote:
> Access happens on the following path:
>
> 1) sof_ipc_tx_message
> => tx_wait_done
> => snd_sof_trace_notify_for_error
> => wake_up(&sdev->trace_sleep)
>
> where sdev->trace_sleep is not yet initialized.
>
> While at it also move initialization of sdev->host_offset
> before starting working with sdev struct.
>
> Signed-off-by: Daniel Baluta <daniel.baluta at gmail.com>
> ---
> sound/soc/sof/trace.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c
> index 744d75b..2772cbee 100644
> --- a/sound/soc/sof/trace.c
> +++ b/sound/soc/sof/trace.c
> @@ -245,6 +245,9 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev)
> params.buffer.offset = 0;
> params.buffer.pages = sdev->dma_trace_pages;
>
> + init_waitqueue_head(&sdev->trace_sleep);
> + sdev->host_offset = 0;
> +
> /* send IPC to the DSP */
> ret = sof_ipc_tx_message(sdev->ipc,
> params.hdr.cmd, ¶ms, sizeof(params),
> @@ -255,8 +258,6 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev)
> goto table_err;
if for some reason this IPC fails, then we end-end with the trace_sleep
and host_offset initialized. Is this ok?
> }
>
> - init_waitqueue_head(&sdev->trace_sleep);
> - sdev->host_offset = 0;
> return 0;
>
> table_err:
>
More information about the Sound-open-firmware
mailing list