Skip to content

Commit 403c521

Browse files
committed
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.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a98478f commit 403c521

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sound/pci/mixart/mixart_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)
443443
notify = (struct mixart_timer_notify *)mixart_msg_data;
444444

445445
BUILD_BUG_ON(sizeof(notify) > sizeof(mixart_msg_data));
446+
if (snd_BUG_ON(notify->stream_count > ARRAY_SIZE(notify->streams)))
447+
break;
446448
for(i=0; i<notify->stream_count; i++) {
447449

448450
u32 buffer_id = notify->streams[i].buffer_id;

0 commit comments

Comments
 (0)