summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-12-07 16:33:23 +0100
committerTakashi Iwai <tiwai@suse.de>2021-12-07 16:35:58 +0100
commit403c521003a1364fd2d7c01a2a1f66ed025fb94a (patch)
treed7475ab7ab9268a15e3b889e05d4a50964ed4449 /sound/pci
parentALSA: ppc: beep: fix clang -Wimplicit-fallthrough (diff)
downloadlinux-403c521003a1364fd2d7c01a2a1f66ed025fb94a.tar.xz
linux-403c521003a1364fd2d7c01a2a1f66ed025fb94a.zip
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>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/mixart/mixart_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 853083dd4bad..a047ed0f84e9 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -443,6 +443,8 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)
notify = (struct mixart_timer_notify *)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++) {
u32 buffer_id = notify->streams[i].buffer_id;