Skip to contentSkip to conversation

sound/isa/gus: fix null pointer dereference on pointer block

PATCH Applied Chengfeng Ye 2 participants 3 messages Oct 24, 2021 – Oct 26, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sound/isa/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.

---
 sound/isa/gus/gus_dma.c | 2 ++
 1 file changed, 2 insertions(+)
sound/isa/gus/gus_dma.c +2 -0
index a1c770d826dd..6d664dd8dde0 100644
@@ -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
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 6 lines · Chengfeng Ye

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.

Thanks, applied.

Takashi

author Applied
#2 lore raw

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

Quoted 6 lines · Chengfeng Ye

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.

Thanks, applied.

Takashi