ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
PATCH 1/1 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
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().
--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/pcm_compat.c +6 -2
@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Signature · 1 line
2.35.3
Hi,
Quoted 9 lines · Takashi Iwai
The update of rate_num/den and msbits were factored out to
fixup_unreferenced_params()function to be called explicitly after thehw_refineorhw_paramsprocedure. It's called fromsnd_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().
Quoted 7 lines
Reported-by [email protected]Fixes f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Indeed. I did overlook PCM compat layer. The branch for hw refine compat ioctl should call the fixup, while the branch for hw params has no need since the helper function call the fixup.
Quoted 23 lines
sound/core/pcm_compat.c +6
-2@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||Signature · 1 line
2.35.3
Regards
Takashi Sakamoto
Quoted 28 lines · Takashi Iwai
The update of rate_num/den and msbits were factored out to
fixup_unreferenced_params()function to be called explicitly after thehw_refineorhw_paramsprocedure. It's called fromsnd_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 [email protected]Fixes f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)sound/core/pcm_compat.c +1
-1@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data);
sound/core/pcm_compat.c static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, · line 266
Quoted 10 lines
sound/core/pcm_compat.c +5
-1-else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.