From: Greg Kroah-Hartman Date: Mon, 4 Apr 2022 08:11:32 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.17.2~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=831bf3e83e5cd7db45664433bcd44c1658d2b01f;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: asoc-soc-compress-change-the-check-for-codec_dai.patch --- diff --git a/queue-5.4/asoc-soc-compress-change-the-check-for-codec_dai.patch b/queue-5.4/asoc-soc-compress-change-the-check-for-codec_dai.patch new file mode 100644 index 00000000000..6ea53ccc85f --- /dev/null +++ b/queue-5.4/asoc-soc-compress-change-the-check-for-codec_dai.patch @@ -0,0 +1,54 @@ +From ccb4214f7f2a8b75acf493f31128e464ee1a3536 Mon Sep 17 00:00:00 2001 +From: Jiasheng Jiang +Date: Thu, 10 Mar 2022 11:00:41 +0800 +Subject: ASoC: soc-compress: Change the check for codec_dai + +From: Jiasheng Jiang + +commit ccb4214f7f2a8b75acf493f31128e464ee1a3536 upstream. + +It should be better to reverse the check on codec_dai +and returned early in order to be easier to understand. + +Fixes: de2c6f98817f ("ASoC: soc-compress: prevent the potentially use of null pointer") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Jiasheng Jiang +Reviewed-by: Charles Keepax +Link: https://lore.kernel.org/r/20220310030041.1556323-1-jiasheng@iscas.ac.cn +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/soc-compress.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/sound/soc/soc-compress.c ++++ b/sound/soc/soc-compress.c +@@ -871,16 +871,19 @@ int snd_soc_new_compress(struct snd_soc_ + return -EINVAL; + } + +- /* check client and interface hw capabilities */ +- if (codec_dai) { +- if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && +- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) +- playback = 1; +- if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) && +- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) +- capture = 1; ++ if (!codec_dai) { ++ dev_err(rtd->card->dev, "Missing codec\n"); ++ return -EINVAL; + } + ++ /* check client and interface hw capabilities */ ++ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && ++ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) ++ playback = 1; ++ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) && ++ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) ++ capture = 1; ++ + /* + * Compress devices are unidirectional so only one of the directions + * should be set, check for that (xor) diff --git a/queue-5.4/series b/queue-5.4/series index e2214cd857b..c3c394f3797 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -352,3 +352,4 @@ ubi-fix-race-condition-between-ctrl_cdev_ioctl-and-ubi_cdev_ioctl.patch arm-iop32x-offset-irq-numbers-by-1.patch acpi-cppc-avoid-out-of-bounds-access-when-parsing-_cpc-data.patch powerpc-kasan-fix-early-region-not-updated-correctly.patch +asoc-soc-compress-change-the-check-for-codec_dai.patch