Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1145476pxv; Fri, 9 Jul 2021 19:27:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwclXWWUzC1dqVNTo1OiOSWaMxfZ0t9d54dl9VbuymBsdmrQl3iohmN5wzuFSixIUb3UPyI X-Received: by 2002:a17:906:7f95:: with SMTP id f21mr41364496ejr.548.1625884054789; Fri, 09 Jul 2021 19:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884054; cv=none; d=google.com; s=arc-20160816; b=OG1BOwtF+XeOoIIKI9Zp/52pXlLGPKVc97IK83nzCUrfJCWLWtiyHHQOUncGbAOyIq PxcuksmlS/c3MH6a9NKeGRQhD1tpuJxKx+JES4kbxHSCkyWE+K90o8ipgi7YQnCnaz/V vyyiufMGphbca7f/KdLY3VrSnyAzF7HKQO/L/dhZaZv/L5zKbJkLlC9hp8ihvpHD8j/9 2ZefgxWgMYNHx71hQnLBkLrbFvKCSzrApvRU4/ZBdPiwaXSXPr8C/etx2yrAqrYRMp7q HCfwTSksDurOE8wp8n/BbgCxsacW9CeeIykoYSO9KqVdn53lnchEV7BQvhOP6dgi6ywJ jNMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H8VlO82IOZxfzSSnF4oWi1rC/eAaibICI35lL97x82I=; b=tYva+Z0m1gIoTSlEGeuXqBwnPEZwEs+sOc/fmyWA2d6lJu25vK+Vrj6JH4kwvQIj29 BvMXXdpmscBB1GFxw2kLSxGVla6NBFKY3/tZaxwMnDtPg71X+nW3jIuymZ7c2hkw16UI uuGMHOD+iEot7wACL2C9E6e+mmQuYBEpPrJ4jTOtfNgWD4Ku0zlYbpMda4Fcv/nb1Je3 3FdfAwsrUdo+sGlQiGyVybBH9UrXa7+EyoD1P8ZD4fzDTRHkHnRbu1/2bR2B2AksJPMl kabIY/Gy81q3pXT9sLvh7zFWoZ7z5CETGMACIM4dTEA+2PUL8O+JMBzNVOVRcdwmNho2 6V5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QsN8rvnd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si9485522edd.237.2021.07.09.19.27.12; Fri, 09 Jul 2021 19:27:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QsN8rvnd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232609AbhGJC2m (ORCPT + 99 others); Fri, 9 Jul 2021 22:28:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbhGJC04 (ORCPT ); Fri, 9 Jul 2021 22:26:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A6B361413; Sat, 10 Jul 2021 02:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883846; bh=kHoNxcXkLQ7IZeRw/l1gGdNDWqkuAu2OTklmpYUs87A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsN8rvndpypw4cCD5G00YUSvCibigulwfeUxD8EPUl9uUVnQPAGM81nSv16cWZBgF 3AQHeZwTJZM+ti75gNlWIsloMojDRbNpOH0CUFkc/E3dHN641zTCyeKdgDJCrOouJg IZ9vr5A/aFs5WZUwCxaCQVHzrlAJrIkvoQMBOA3/ZmAJYOWhFziUp/CAYvoOmybbcL SY5HHfKhuMAIZmlwxe+txEL4ZjdcjdOb6gjp4R5NhvQS8Ax4m1U0g1wjxkowyIapIr yhya3oqMwO7rZqVHTNMgSdHnsQyS7r8ymSK/rc2Kxx6i2F4bOF2gcKGbXS3wxUxdrL p1as2ssZOcflA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Yingliang , Mark Brown , Sasha Levin , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.12 091/104] ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname() Date: Fri, 9 Jul 2021 22:21:43 -0400 Message-Id: <20210710022156.3168825-91-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit a2f6ed4a44721d3a9fdf4da7e0743cb13866bf61 ] It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210615013922.784296-10-yangyingliang@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/fsl_xcvr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index 6dd0a5fcd455..dc7f914816c6 100644 --- a/sound/soc/fsl/fsl_xcvr.c +++ b/sound/soc/fsl/fsl_xcvr.c @@ -1205,6 +1205,10 @@ static int fsl_xcvr_probe(struct platform_device *pdev) rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo"); tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo"); + if (!rx_res || !tx_res) { + dev_err(dev, "could not find rxfifo or txfifo resource\n"); + return -EINVAL; + } xcvr->dma_prms_rx.chan_name = "rx"; xcvr->dma_prms_tx.chan_name = "tx"; xcvr->dma_prms_rx.addr = rx_res->start; -- 2.30.2