[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211109222426.1236575-11-sashal@kernel.org>
Date: Tue, 9 Nov 2021 17:24:25 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Chengfeng Ye <cyeaa@...nect.ust.hk>, Takashi Iwai <tiwai@...e.de>,
Sasha Levin <sashal@...nel.org>, perex@...ex.cz,
tiwai@...e.com, alsa-devel@...a-project.org
Subject: [PATCH AUTOSEL 4.4 11/12] ALSA: gus: fix null pointer dereference on pointer block
From: Chengfeng Ye <cyeaa@...nect.ust.hk>
[ Upstream commit a0d21bb3279476c777434c40d969ea88ca64f9aa ]
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@...nect.ust.hk>
Link: https://lore.kernel.org/r/20211024104611.9919-1-cyeaa@connect.ust.hk
Signed-off-by: Takashi Iwai <tiwai@...e.de>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 36c27c8323601..2e27cd3427c87 100644
--- a/sound/isa/gus/gus_dma.c
+++ b/sound/isa/gus/gus_dma.c
@@ -141,6 +141,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.33.0
Powered by blists - more mailing lists