Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp883639yba; Thu, 18 Apr 2019 11:09:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPoUFyV7db/onRdIJA0jFG4US+pjJswa/F0T71ROdINlVWnRECuClQGgc6u7ERhLARQelZ X-Received: by 2002:a63:1203:: with SMTP id h3mr91449604pgl.164.1555610992855; Thu, 18 Apr 2019 11:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555610992; cv=none; d=google.com; s=arc-20160816; b=n8FyaVHmKqt96R200FaZYj3nvBXV/pWyCx2mNSVG3KR1R3s2sIxN/fmDP288QXDaQM pdDukmFofUpI8EPiyU5F1ayDdEiQXm1u7KluDY0nBBDzeir+RmWmmWsvawooard3S0mN doNfH6ebieR8olT3KuXYgZjah3mlAOU/mVV+UBCu4GqDZpnAU3vaZPUiQwAJQT3qu+eO 0HYW+n6rp3ndWkbSU1kcQkVU52GlICIn6Csr2+CyDmOMoYz302SB4irDsMcLLM7jE6FE 2F+GUwgiHC2W1mnnQXHRiAvaQ5OO0NGAHh/j/lF7Sa/eZUQWAZ8Z95XxKaRT4+i34a42 5pIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CeYdcPVlz3yjabDRHuVCmhw9IVXH3BztA2RSYmY9fjo=; b=MiJN26cGmsmaPx84oUORBfHWyCiQ4T8H8wWPRcG5zTrI+0PTPtj7Z2fJmWrlN5eBb3 AXepvJar3VqIupFKW2Ty5DMOwphloivRzCxZQQQc+xDQW8TOwavfqC5ia4eL3Z3K66pM WHaG2+VWLbtlnYe/9deOpma6iFrje3CsWpWMLJPxtLVown8kT2mxjWjlyHkdenwn4mqs rUGQtgauutIWWebhwq47ai3EUsbq29L2e9v+IULkfDsFgeTpXM8RVm+HEfD71AyaXO0A LhQ1GHyFyoK9BPgOvuDklWXtRsggI1/IwD1SmttUgNJ5gPq+IgyUngyN5/GZZls83cPG AXwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HhhmvCSh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h26si2451135pgl.21.2019.04.18.11.09.37; Thu, 18 Apr 2019 11:09:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HhhmvCSh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391696AbfDRSH6 (ORCPT + 99 others); Thu, 18 Apr 2019 14:07:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:38930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389862AbfDRSH4 (ORCPT ); Thu, 18 Apr 2019 14:07:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 964B5217FA; Thu, 18 Apr 2019 18:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610876; bh=QOPhOtsI890217ZLprqm3dHIJaVXc4IHks0T7uj9qLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhhmvCSh/oRuUewyOmKd+Bg5NRqawk6+rAsZBQyoiPtVlEVR3b6VNTqUZi6Y966HY LOQea0iUUbsd5PkqYdWDERLAImM4xxRUT8CxfVRhNKFe/JRQ5xtYbo+KhW86m1Fj/l fxWTuSNCKSXz3EezoI6TuAA1vAY3SVlSBhEZlFtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Takashi Iwai , Sasha Levin Subject: [PATCH 4.9 05/50] ALSA: echoaudio: add a check for ioremap_nocache Date: Thu, 18 Apr 2019 19:57:16 +0200 Message-Id: <20190418160423.565942478@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 6ade657d6125ec3ec07f95fa51e28138aef6208f ] In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/echoaudio/echoaudio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 286f5e3686a3..d73ee11a32bd 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1953,6 +1953,11 @@ static int snd_echo_create(struct snd_card *card, } chip->dsp_registers = (volatile u32 __iomem *) ioremap_nocache(chip->dsp_registers_phys, sz); + if (!chip->dsp_registers) { + dev_err(chip->card->dev, "ioremap failed\n"); + snd_echo_free(chip); + return -ENOMEM; + } if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip)) { -- 2.19.1