Skip to content

Commit

Permalink
ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: f9a076b ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
Reviewed-by: Takashi Sakamoto <[email protected]>
Reviewed-by: Jaroslav Kysela <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tiwai authored and gregkh committed Sep 13, 2023
1 parent 6b171ad commit d8c6fc8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sound/core/pcm_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ||
Expand Down

0 comments on commit d8c6fc8

Please sign in to comment.