Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp892228yba; Thu, 18 Apr 2019 11:18:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzL3fy+mE7KiKsY8irgS8t79DXsvWJ+FF+orP/U+YnAJvTm+nSSb1BDWDTRXJV98YjDAz/W X-Received: by 2002:a17:902:e809:: with SMTP id cq9mr3245064plb.70.1555611520918; Thu, 18 Apr 2019 11:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611520; cv=none; d=google.com; s=arc-20160816; b=oiWjUmGgUP1Ky1RGfjCo8U1M7bZWqCZ1hx2dyyX6J4ixi5SIyEmYmnz6iASZev55x1 KjPlB5mdMx6blDbE3NubAOPfEemmvmSSzzH3YF/zbrWC+9rCipTnoNzQwtG0RsvMdziQ MBsZyjDIomrqwxjJnUxskWEuJzcArlaq16NUQEGqsH6ERRrSGBVGOTRHylyeh/O5XADs 31x9p8/AIwRgFJ47NxVOS5sJK5/13CNp7FOgzR+EGBhHXSkb42QH3wWUkuggB2Rxk+4C JYYwg+qC3pMrLrBlAgSF4wKJruKJAvyqHAyBG3515LfpsYuNDrStYnD8Cfmm++KXcYPw EzfQ== 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=Pv5xdJZ0z/BLivEkorXr5U1yhI43yWwOGZvjyHlMrO0=; b=HFfXiQTwCuK1eduT4OyHXcNRmZRgDa1OrdfXiOYaoTURwqmOwWAC8xv0P+oCNxBaWB PZPKE8OgpIBvRS986QPILRQImXbR1uIDMWC9agT7sGSsLVnNIiDVvza0PCz++deVX0qW FYmHKQRUBSaoI7xBzJAZKSSUK9d6WAob5ZuQnUm7KKe4MGDLhVPQ2pWL+lePV7gK0E7e pj79whHvMHEf49rh1PPQWUrB0q8wHhLU9pn6m6I8Mlf2Z/2jHUndU4PdF9Q1LGQuu6Cq 9CUh3p0dGWEna7rVPATEqtf4IT5qjwwl9usBeok255TceOJMGktQhAQgEdPRMA8OZWRi WVoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aDWPzT5m; 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 d3si2895538pfc.278.2019.04.18.11.18.25; Thu, 18 Apr 2019 11:18:40 -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=aDWPzT5m; 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 S2403927AbfDRSLf (ORCPT + 99 others); Thu, 18 Apr 2019 14:11:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:41200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403966AbfDRSJc (ORCPT ); Thu, 18 Apr 2019 14:09:32 -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 9322620652; Thu, 18 Apr 2019 18:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610972; bh=+DHJI8oZgnH3BYAHpcucBUH9XQlh9R11NVANIMoaBYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aDWPzT5mc9baRwgpsIhdqqIxfFNWOSibkLEKGPByHI0qSxKXJWabJxa3ApS7KivHK Sd8lk3Rv6g/Uw9+yfcNGTToNARe7DmI3jU3g45q/A7iA9wCMABRLB0ssVDXAlT3n32 y4258263IE1IDsD3fTD5424qtsQ16dUegFjcLwkU= 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 5.0 10/93] ALSA: echoaudio: add a check for ioremap_nocache Date: Thu, 18 Apr 2019 19:56:48 +0200 Message-Id: <20190418160437.988728753@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@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 907cf1a46712..3ef2b27ebbe8 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1954,6 +1954,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