* [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
@ 2023-08-29 13:43 Takashi Iwai
2023-08-29 13:52 ` Takashi Sakamoto
2023-08-29 13:58 ` Jaroslav Kysela
0 siblings, 2 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-08-29 13:43 UTC (permalink / raw)
To: alsa-devel; +Cc: Meng_Cai
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: f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/pcm_compat.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 42c2ada8e888..c96483091f30 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -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)) ||
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
2023-08-29 13:43 [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl Takashi Iwai
@ 2023-08-29 13:52 ` Takashi Sakamoto
2023-08-29 13:58 ` Jaroslav Kysela
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Sakamoto @ 2023-08-29 13:52 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Meng_Cai
Hi,
On Tue, Aug 29, 2023 at 03:43:44PM +0200, Takashi Iwai wrote:
> 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: f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> 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.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
> index 42c2ada8e888..c96483091f30 100644
> --- a/sound/core/pcm_compat.c
> +++ b/sound/core/pcm_compat.c
> @@ -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)) ||
> --
> 2.35.3
Regards
Takashi Sakamoto
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
2023-08-29 13:43 [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl Takashi Iwai
2023-08-29 13:52 ` Takashi Sakamoto
@ 2023-08-29 13:58 ` Jaroslav Kysela
1 sibling, 0 replies; 3+ messages in thread
From: Jaroslav Kysela @ 2023-08-29 13:58 UTC (permalink / raw)
To: Takashi Iwai, alsa-devel; +Cc: Meng_Cai
On 29. 08. 23 15:43, Takashi Iwai wrote:
> 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: f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/core/pcm_compat.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
> index 42c2ada8e888..c96483091f30 100644
> --- a/sound/core/pcm_compat.c
> +++ b/sound/core/pcm_compat.c
> @@ -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)) ||
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-29 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-29 13:43 [PATCH] ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl Takashi Iwai
2023-08-29 13:52 ` Takashi Sakamoto
2023-08-29 13:58 ` Jaroslav Kysela
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.