aboutsummaryrefslogtreecommitdiff
path: root/sound/core/timer.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-03-20 12:03:13 +0800
committerAlex Shi <alex.shi@linaro.org>2017-03-20 12:03:13 +0800
commit89e7fad96be88f30f491bf227d864bf5e8e701b2 (patch)
tree6316161ebd26b780991ff8632471fbbfa3af7ea8 /sound/core/timer.c
parent5b0250d2571ee75ca3c0b34579c3e90bc2bd9c6a (diff)
parent1c563c0006661025d7a6c9bc85fc889a4e8a1c06 (diff)
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index ae4ea2e2e7fe..278a332f97bd 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1700,9 +1700,21 @@ static int snd_timer_user_params(struct file *file,
return -EBADFD;
if (copy_from_user(&params, _params, sizeof(params)))
return -EFAULT;
- if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE) && params.ticks < 1) {
- err = -EINVAL;
- goto _end;
+ if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE)) {
+ u64 resolution;
+
+ if (params.ticks < 1) {
+ err = -EINVAL;
+ goto _end;
+ }
+
+ /* Don't allow resolution less than 1ms */
+ resolution = snd_timer_resolution(tu->timeri);
+ resolution *= params.ticks;
+ if (resolution < 1000000) {
+ err = -EINVAL;
+ goto _end;
+ }
}
if (params.queue_size > 0 &&
(params.queue_size < 32 || params.queue_size > 1024)) {