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 <[email protected]>
---
sound/isa/gus/gus_dma.c | 2 ++
1 file changed, 2 insertions(+)
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
--
2.17.1
On Sun, 24 Oct 2021 12:46:11 +0200,
Chengfeng Ye wrote:
>
> 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 <[email protected]>
Thanks, applied.
Takashi
Thanks so much,
-Chengfeng
-----?ʼ?ԭ??-----
??????: Takashi Iwai <[email protected]>
????ʱ??: 2021??10??26?? 14:02
?ռ???: YE Chengfeng <[email protected]>
????: [email protected]; [email protected]; [email protected]; [email protected]
????: Re: [PATCH] sound/isa/gus: fix null pointer dereference on pointer block
On Sun, 24 Oct 2021 12:46:11 +0200,
Chengfeng Ye wrote:
>
> 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 <[email protected]>
Thanks, applied.
Takashi