Skip to content

Commit 31cd5ed

Browse files
tiwairoxanan1996
authored andcommitted
ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
BugLink: https://bugs.launchpad.net/bugs/2041702 commit 358040e upstream. The update of rate_num/den and msbits were factored out to fixup_unreferenced_params() function to be called explicitly after the hw_refine or hw_params procedure. It's called from snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl. This ended up with the incomplete rate_num/den and msbits parameters when 32bit compat ioctl is used. This patch adds the missing call in snd_pcm_ioctl_hw_params_compat(). Reported-by: Meng_Cai@novatek.com.cn Fixes: f9a076b ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible") Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Reviewed-by: Jaroslav Kysela <perex@perex.cz> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20230829134344.31588-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent bc1fe94 commit 31cd5ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sound/core/pcm_compat.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
253253
goto error;
254254
}
255255

256-
if (refine)
256+
if (refine) {
257257
err = snd_pcm_hw_refine(substream, data);
258-
else
258+
if (err < 0)
259+
goto error;
260+
err = fixup_unreferenced_params(substream, data);
261+
} else {
259262
err = snd_pcm_hw_params(substream, data);
263+
}
260264
if (err < 0)
261265
goto error;
262266
if (copy_to_user(data32, data, sizeof(*data32)) ||

0 commit comments

Comments
 (0)