summaryrefslogtreecommitdiff
path: root/sound/isa/gus
diff options
context:
space:
mode:
authorChengfeng Ye <cyeaa@connect.ust.hk>2021-10-24 13:46:11 +0300
committerTakashi Iwai <tiwai@suse.de>2021-10-26 09:02:16 +0300
commita0d21bb3279476c777434c40d969ea88ca64f9aa (patch)
treea710bb3a32acc98345c92374c5aa9bb4dcfd747c /sound/isa/gus
parentf917c04fac45b70ff38633675f86ab4b51782205 (diff)
downloadlinux-a0d21bb3279476c777434c40d969ea88ca64f9aa.tar.xz
ALSA: gus: fix null pointer dereference on pointer block
The pointer block return from snd_gf1_dma_next_block could be null, so there is a potential null pointer dereference issue. Fix this by adding a null check before dereference. Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk> Link: https://lore.kernel.org/r/20211024104611.9919-1-cyeaa@connect.ust.hk Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/gus')
-rw-r--r--sound/isa/gus/gus_dma.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
index a1c770d826dd..6d664dd8dde0 100644
--- a/sound/isa/gus/gus_dma.c
+++ b/sound/isa/gus/gus_dma.c
@@ -126,6 +126,8 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
}
block = snd_gf1_dma_next_block(gus);
spin_unlock(&gus->dma_lock);
+ if (!block)
+ return;
snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd);
kfree(block);
#if 0