summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-12-01 08:36:06 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-14 10:04:48 +0100
commit3d9b92b3b14690e8991b506961fdbe60bd3e49f5 (patch)
tree34108f3ee7096c43f672eb0fda00ba7dbdeff4e2
parentb02a41eebcc36d4f07196780f2e165ca2c499257 (diff)
downloadlinux-3d9b92b3b14690e8991b506961fdbe60bd3e49f5.tar.gz
linux-3d9b92b3b14690e8991b506961fdbe60bd3e49f5.tar.bz2
linux-3d9b92b3b14690e8991b506961fdbe60bd3e49f5.zip
ALSA: pcm: oss: Handle missing errors in snd_pcm_oss_change_params*()
commit 6665bb30a6b1a4a853d52557c05482ee50e71391 upstream. A couple of calls in snd_pcm_oss_change_params_locked() ignore the possible errors. Catch those errors and abort the operation for avoiding further problems. Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20211201073606.11660-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/core/oss/pcm_oss.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a765b46b1a8c..0ce3f42721c4 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -910,8 +910,15 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
err = -EINVAL;
goto failure;
}
- choose_rate(substream, sparams, runtime->oss.rate);
- snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL);
+
+ err = choose_rate(substream, sparams, runtime->oss.rate);
+ if (err < 0)
+ goto failure;
+ err = snd_pcm_hw_param_near(substream, sparams,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ runtime->oss.channels, NULL);
+ if (err < 0)
+ goto failure;
format = snd_pcm_oss_format_from(runtime->oss.format);