diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-11-05 10:07:43 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-11-06 10:41:24 +0100 |
commit | 9b7d869ee5a77ed4a462372bb89af622e705bfb8 (patch) | |
tree | 8151b57ebb526eac4c1bf711aa01bfe0972eecaa /include | |
parent | ALSA: usb-audio: support new Amanero Combo384 firmware version (diff) | |
download | linux-9b7d869ee5a77ed4a462372bb89af622e705bfb8.tar.xz linux-9b7d869ee5a77ed4a462372bb89af622e705bfb8.zip |
ALSA: timer: Limit max instances per timer
Currently we allow unlimited number of timer instances, and it may
bring the system hogging way too much CPU when too many timer
instances are opened and processed concurrently. This may end up with
a soft-lockup report as triggered by syzkaller, especially when
hrtimer backend is deployed.
Since such insane number of instances aren't demanded by the normal
use case of ALSA sequencer and it merely opens a risk only for abuse,
this patch introduces the upper limit for the number of instances per
timer backend. As default, it's set to 1000, but for the fine-grained
timer like hrtimer, it's set to 100.
Reported-by: syzbot
Tested-by: Jérôme Glisse <jglisse@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/timer.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/timer.h b/include/sound/timer.h index c4d76ff056c6..7ae226ab6990 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h @@ -90,6 +90,8 @@ struct snd_timer { struct list_head ack_list_head; struct list_head sack_list_head; /* slow ack list head */ struct tasklet_struct task_queue; + int max_instances; /* upper limit of timer instances */ + int num_instances; /* current number of timer instances */ }; struct snd_timer_instance { |