Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDE1C433F5 for ; Tue, 9 Nov 2021 22:31:49 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CAF5F6109F for ; Tue, 9 Nov 2021 22:31:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CAF5F6109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 395BA16B0; Tue, 9 Nov 2021 23:30:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 395BA16B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1636497107; bh=tYjtW025gHLRr8426PhlfQYECjhcjlWc5ctzxhuJJ2o=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PQV93asywifHR8FPD3pVefg6jeG45XdWFkQcy/otYs+bCiYdA3+a4aFSntbegpAc2 lsP8xSy5psuNOvAf4FeySY/PXEYmbBWmp54GcGWeG99EyX5DzWCsV395zF6bIy42+K gRw0xk6g3W30l/Wo+4hbShgJIvnnaQlauGz5BJQE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 68DC6F80506; Tue, 9 Nov 2021 23:23:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 73649F80542; Tue, 9 Nov 2021 23:23:52 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1A05F805B1 for ; Tue, 9 Nov 2021 23:23:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1A05F805B1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ponmLuvQ" Received: by mail.kernel.org (Postfix) with ESMTPSA id E035761B1C; Tue, 9 Nov 2021 22:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636496621; bh=tYjtW025gHLRr8426PhlfQYECjhcjlWc5ctzxhuJJ2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ponmLuvQfoM/ZCSHDR5SWTq++XUmF8J2JLlLuTT/UDH+qzqYYy73USl3pvMp4NcUG eVyOQdCohmLYfiVoR/VDFdEXfO9kVVJNyvhxBZJD395io4bs/orF3G9znIsnV8XsbX BplBcDSh9Y5ICiaB7QZX5mr+QbSfC6xeHaGqPWrxPW7bySzn7/acXrew+ZYNLS+piv tq2mf709gD6uLaC5XfccGq1+UGRBY4dnEuxXg8jzrApO81rM79Tu0rYLMSad24+6SW WRIcozFY2v/pylh7s7iZ9tnOR9F8uKD9+bftsXALOXiUj0CBo3NrdEKRtzl4aJwC7i uVKA5jVssC6fg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 20/21] ALSA: gus: fix null pointer dereference on pointer block Date: Tue, 9 Nov 2021 17:23:09 -0500 Message-Id: <20211109222311.1235686-20-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109222311.1235686-1-sashal@kernel.org> References: <20211109222311.1235686-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Sasha Levin , alsa-devel@alsa-project.org, Takashi Iwai , tiwai@suse.com, Chengfeng Ye X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Chengfeng Ye [ 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 Link: https://lore.kernel.org/r/20211024104611.9919-1-cyeaa@connect.ust.hk Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- 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 7f95f452f1064..48e76b8fede41 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