From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> To: lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, error27@gmail.com, angelogioacchino.delregno@collabora.com, linux-mm@kvack.org, oe-kbuild-all@lists.linux.dev Subject: [PATCH] ASoC: SOF: sof-audio: prepare_widgets: Check swidget for NULL on sink failure Date: Fri, 20 Jan 2023 12:21:25 +0200 [thread overview] Message-ID: <20230120102125.30653-1-peter.ujfalusi@linux.intel.com> (raw) If the swidget is NULL we skip the preparing of the widget and jump to handle the sink path of the widget. If the prepare fails in this case we would undo the prepare but the swidget is NULL (we skipped the prepare for the widget). To avoid NULL pointer dereference in this case we must check swidget against NULL pointer once again. Fixes: 0ad84b11f2f8 ("ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> --- sound/soc/sof/sof-audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index f17d405a9da9..2dff3ae25d27 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -334,7 +334,8 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget p->walking = false; if (ret < 0) { /* unprepare the source widget */ - if (widget_ops[widget->id].ipc_unprepare && swidget->prepared) { + if (widget_ops[widget->id].ipc_unprepare && + swidget && swidget->prepared) { widget_ops[widget->id].ipc_unprepare(swidget); swidget->prepared = false; } -- 2.39.0
WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> To: lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, error27@gmail.com, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, linux-mm@kvack.org, oe-kbuild-all@lists.linux.dev, angelogioacchino.delregno@collabora.com Subject: [PATCH] ASoC: SOF: sof-audio: prepare_widgets: Check swidget for NULL on sink failure Date: Fri, 20 Jan 2023 12:21:25 +0200 [thread overview] Message-ID: <20230120102125.30653-1-peter.ujfalusi@linux.intel.com> (raw) If the swidget is NULL we skip the preparing of the widget and jump to handle the sink path of the widget. If the prepare fails in this case we would undo the prepare but the swidget is NULL (we skipped the prepare for the widget). To avoid NULL pointer dereference in this case we must check swidget against NULL pointer once again. Fixes: 0ad84b11f2f8 ("ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> --- sound/soc/sof/sof-audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index f17d405a9da9..2dff3ae25d27 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -334,7 +334,8 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget p->walking = false; if (ret < 0) { /* unprepare the source widget */ - if (widget_ops[widget->id].ipc_unprepare && swidget->prepared) { + if (widget_ops[widget->id].ipc_unprepare && + swidget && swidget->prepared) { widget_ops[widget->id].ipc_unprepare(swidget); swidget->prepared = false; } -- 2.39.0
next reply other threads:[~2023-01-20 10:21 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-20 10:21 Peter Ujfalusi [this message] 2023-01-20 10:21 ` [PATCH] ASoC: SOF: sof-audio: prepare_widgets: Check swidget for NULL on sink failure Peter Ujfalusi 2023-01-20 11:02 ` AngeloGioacchino Del Regno 2023-01-20 11:02 ` AngeloGioacchino Del Regno 2023-01-20 15:43 ` Mark Brown 2023-01-20 15:43 ` Mark Brown
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=20230120102125.30653-1-peter.ujfalusi@linux.intel.com \ --to=peter.ujfalusi@linux.intel.com \ --cc=alsa-devel@alsa-project.org \ --cc=angelogioacchino.delregno@collabora.com \ --cc=broonie@kernel.org \ --cc=error27@gmail.com \ --cc=kai.vehmanen@linux.intel.com \ --cc=lgirdwood@gmail.com \ --cc=linux-mm@kvack.org \ --cc=oe-kbuild-all@lists.linux.dev \ --cc=pierre-louis.bossart@linux.intel.com \ --cc=ranjani.sridharan@linux.intel.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.