Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1828401imm; Mon, 3 Sep 2018 10:29:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYJdJ1bgX0huwjAcb6WrHC4R7s8e9XEzgP+oVdpWxIJLYu3fqxBPknBUTgrS/4QSzZui7Ks X-Received: by 2002:a62:23c2:: with SMTP id q63-v6mr30607927pfj.116.1535995747404; Mon, 03 Sep 2018 10:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995747; cv=none; d=google.com; s=arc-20160816; b=0Tg9Bt13Oq4KPtQUeysXYhNxsiEXtbg5Mw65WkuqN13UZf82HPnvmFZS3tFcCNNLCb Tbi8gkX2OuMylaLd9Qo2fDteO3igRZJUZhT1xZA3cHsoI1a3IAwdomkNmIIHoztCDx04 8NvzDPJhzkIaz2hjH8wFbm/1+Udtb0rFmwuHhB1UavsM/2kkqsU0oYWJlY+oOAgCLo8q dv7bB0C+ECus8M1a887al8BkAEvpunXEviNLVY5NQVTuATfXIfMb3wQjQ/TlG/Nptzml iEQemPnbwRMFEPeRzvPQmEX+Nb2PBd5X/tFNk2rsImedl1DAO0WJH+I2pzkDrgtLyF8m Mp6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=En7EuHNu0tUnp4MIKdavggQmpUVYwaasCOcm9fXnEW4=; b=CSwBWXCemE56Eayl1w/ZSH+95QQ4tss0vo2EHx+QWZlAAwlNJUdsUNOgQhiJUhqfAy o3slf9MIKXy80X5kuwS0xcWSTXou5yNl8NVLKiEzYOtontO9bBRmeFMGiJGHnk78TJH7 kDViF7USE0dCbXXS+NMeyKn61DK8L82xakyrrIybf3+uH13h8KOcAiIv4x3WBR2yphiK 6JzI6p6vJYIDskqURmMstHUt4g/JSJZwMc5sjMsyc8YKPs5gq0CsUlFWCVineBwh1Oev MDqtQ8S2fh5RWMSqbCrOGitqbFnU8Xy4Yrb8dN6P3i34xo/QwEYsrLkWp/gqclXSpfko pQng== ARC-Authentication-Results: i=1; mx.google.com; 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 5-v6si18137503pgf.18.2018.09.03.10.28.52; Mon, 03 Sep 2018 10:29:07 -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; 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 S1731028AbeICVse (ORCPT + 99 others); Mon, 3 Sep 2018 17:48:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46266 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbeICVsd (ORCPT ); Mon, 3 Sep 2018 17:48:33 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0EFDBD10; Mon, 3 Sep 2018 17:27:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Mark Brown Subject: [PATCH 4.14 133/165] ASoC: sirf: Fix potential NULL pointer dereference Date: Mon, 3 Sep 2018 18:56:59 +0200 Message-Id: <20180903165702.223840438@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gustavo A. R. Silva commit ae1c696a480c67c45fb23b35162183f72c6be0e1 upstream. There is a potential execution path in which function platform_get_resource() returns NULL. If this happens, we will end up having a NULL pointer dereference. Fix this by replacing devm_ioremap with devm_ioremap_resource, which has the NULL check and the memory region request. This code was detected with the help of Coccinelle. Cc: stable@vger.kernel.org Fixes: 2bd8d1d5cf89 ("ASoC: sirf: Add audio usp interface driver") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/sirf/sirf-usp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/sound/soc/sirf/sirf-usp.c +++ b/sound/soc/sirf/sirf-usp.c @@ -370,10 +370,9 @@ static int sirf_usp_pcm_probe(struct pla platform_set_drvdata(pdev, usp); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap(&pdev->dev, mem_res->start, - resource_size(mem_res)); - if (base == NULL) - return -ENOMEM; + base = devm_ioremap_resource(&pdev->dev, mem_res); + if (IS_ERR(base)) + return PTR_ERR(base); usp->regmap = devm_regmap_init_mmio(&pdev->dev, base, &sirf_usp_regmap_config); if (IS_ERR(usp->regmap))