Commit 0e888a74 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ALSA: pcm: unconditionally check if appl_ptr is in 0..boundary range

In some cases, the appl_ptr passed by userspace is not checked before
being used. This patch adds an unconditional check and returns an
error code should the appl_ptr exceed the ALSA 'boundary'.
Suggested-by: default avatarTakashi Iwai <tiwai@suse.de>
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211119230852.206310-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 65c16dd2
...@@ -2133,6 +2133,9 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream, ...@@ -2133,6 +2133,9 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
if (old_appl_ptr == appl_ptr) if (old_appl_ptr == appl_ptr)
return 0; return 0;
if (appl_ptr >= runtime->boundary)
return -EINVAL;
runtime->control->appl_ptr = appl_ptr; runtime->control->appl_ptr = appl_ptr;
if (substream->ops->ack) { if (substream->ops->ack) {
ret = substream->ops->ack(substream); ret = substream->ops->ack(substream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment