diff mbox series

ASoC: SOF: Fix potential NULL pointer dereference

Message ID 20220602135757.3335351-1-amadeuszx.slawinski@linux.intel.com
State Superseded
Headers show
Series ASoC: SOF: Fix potential NULL pointer dereference | expand

Commit Message

Amadeusz Sławiński June 2, 2022, 1:57 p.m. UTC
Cleanup path for sof_prepare_widgets_in_path() should check if unprepare
callback exists before calling it, instead it checks if it does not
exist. Fix the check.

Fixes: 370014c8197a ("ASoC: SOF: Add a prepare op to IPC topology widget ops")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/sof/sof-audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ranjani Sridharan June 3, 2022, 7:38 p.m. UTC | #1
On Thu, 2022-06-02 at 15:57 +0200, Amadeusz Sławiński wrote:
> Cleanup path for sof_prepare_widgets_in_path() should check if
> unprepare
> callback exists before calling it, instead it checks if it does not
> exist. Fix the check.
> 
> Fixes: 370014c8197a ("ASoC: SOF: Add a prepare op to IPC topology
> widget ops")
> Signed-off-by: Amadeusz Sławiński <
> amadeuszx.slawinski@linux.intel.com>
> ---
>  sound/soc/sof/sof-audio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM. Thanks for the fix.
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> 
> diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
> index cd41d0599cef..789d0a1f1a77 100644
> --- a/sound/soc/sof/sof-audio.c
> +++ b/sound/soc/sof/sof-audio.c
> @@ -323,7 +323,7 @@ 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->prepared) {
>  					widget_ops[widget-
> >id].ipc_unprepare(swidget);
>  					swidget->prepared = false;
>  				}
Mark Brown June 6, 2022, 11:31 a.m. UTC | #2
On Thu, Jun 02, 2022 at 03:57:57PM +0200, Amadeusz Sławiński wrote:
> Cleanup path for sof_prepare_widgets_in_path() should check if unprepare
> callback exists before calling it, instead it checks if it does not
> exist. Fix the check.
> 
> Fixes: 370014c8197a ("ASoC: SOF: Add a prepare op to IPC topology widget ops")

This commit does not exist.
Pierre-Louis Bossart June 6, 2022, 1:42 p.m. UTC | #3
On 6/6/22 06:31, Mark Brown wrote:
> On Thu, Jun 02, 2022 at 03:57:57PM +0200, Amadeusz Sławiński wrote:
>> Cleanup path for sof_prepare_widgets_in_path() should check if unprepare
>> callback exists before calling it, instead it checks if it does not
>> exist. Fix the check.
>>
>> Fixes: 370014c8197a ("ASoC: SOF: Add a prepare op to IPC topology widget ops")
> 
> This commit does not exist.

Indeed, this SHA was for the SOF tree, the upstream version is this:

66344c6d92113 ("ASoC: SOF: Add a prepare op to IPC topology widget ops")
Mark Brown June 7, 2022, 10:45 a.m. UTC | #4
On Thu, 2 Jun 2022 15:57:57 +0200, Amadeusz Sławiński wrote:
> Cleanup path for sof_prepare_widgets_in_path() should check if unprepare
> callback exists before calling it, instead it checks if it does not
> exist. Fix the check.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: Fix potential NULL pointer dereference
      commit: 2fe08216fda33bbc1f80133b8fd560ffd094b987

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index cd41d0599cef..789d0a1f1a77 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -323,7 +323,7 @@  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->prepared) {
 					widget_ops[widget->id].ipc_unprepare(swidget);
 					swidget->prepared = false;
 				}