Commit 403c5210 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: mixart: Add sanity check for timer notify streams

The miXart timer notification is a variable length, and if a hardware
is screwed up, we may access over the actual data size.  Let's add a
sanity check and bail out if an invalid value is received.

Link: https://lore.kernel.org/r/20211207153323.27098-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a98478f8
...@@ -443,6 +443,8 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id) ...@@ -443,6 +443,8 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)
notify = (struct mixart_timer_notify *)mixart_msg_data; notify = (struct mixart_timer_notify *)mixart_msg_data;
BUILD_BUG_ON(sizeof(notify) > sizeof(mixart_msg_data)); BUILD_BUG_ON(sizeof(notify) > sizeof(mixart_msg_data));
if (snd_BUG_ON(notify->stream_count > ARRAY_SIZE(notify->streams)))
break;
for(i=0; i<notify->stream_count; i++) { for(i=0; i<notify->stream_count; i++) {
u32 buffer_id = notify->streams[i].buffer_id; u32 buffer_id = notify->streams[i].buffer_id;
......
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