Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chengfeng Ye and committed by
Takashi Iwai
a0d21bb3 f917c04f

+2
+2
sound/isa/gus/gus_dma.c
··· 126 126 } 127 127 block = snd_gf1_dma_next_block(gus); 128 128 spin_unlock(&gus->dma_lock); 129 + if (!block) 130 + return; 129 131 snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd); 130 132 kfree(block); 131 133 #if 0