Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1146017pxv; Fri, 9 Jul 2021 19:28:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPfTkn5q3Z4SijCZcxxfnLN8jKitqlAgIzK12B55quMiiqyI/PAiaTpShsxIGvqIHF68Bj X-Received: by 2002:a17:907:990f:: with SMTP id ka15mr40869700ejc.132.1625884125264; Fri, 09 Jul 2021 19:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884125; cv=none; d=google.com; s=arc-20160816; b=DDSe48e/j5vf3EMECYJz/WiadnT9TnYC/hWnPz3wV3fWw1zFGt4rKNRJXrwqZwSyxh glKGwSIZk1KQulLVzudbAvsN82klTZKmehhm+FjzpAEoF7EGLDUALNoRF/hO0M4IVfCI 57ElhhMDJupP2yyacG1qNiV7NlHL35cdiXm8O8Gy2spGEGj7aCt4etKB598NFZ++4hX+ b5Jtypp8LNr5UCHqPg5nWg64IABsNGScH3MIIZpKhDdyaD4kORAS4YGZLg7HBVX9UmG0 EbtfJU4EfSgnqpxreyJcifXtsSKyYzCc3T1XQowO2TUzbXVgbBsiNILQgoAuj8YzvEkA jkJw== 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=T/DRambtvAUXMH9d6WDtKBvV7X0PPvvfY+kak+Oo98s=; b=Z4+BPQLuiVWQ+X1upLUxOEQhqnsUVAD1x7dRottk1JYUTsUHROHgEYuLtjYg25wiKd 8KQS9nsLjoGaazSMYXvj58ZEGrPeQ2CpUSfzaqZDb7t2MnXqWnDtPlflA8yLyKhiYU9V CpJz6ZbxjKiqBfQgKI3niej53QcPjMxsy5Ih4JHHhaQzhlRsJBC4/KtfhEjMHyiU6Ziw NHf/uB2WnflgboRdzXPDWDzurv8ypSA56Co31ZopzNV7Np5U0HDhnB29W8QVuN6LA4aO N0Zg1eQohNDKbIr0lN1d05y7cwJl7KlWUNe6YRJgunk3MNpwfsouDK9ofqe9a4QlzV8g UeEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QlJ7/5hp"; 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 b20si2425338edy.219.2021.07.09.19.28.21; Fri, 09 Jul 2021 19:28:45 -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="QlJ7/5hp"; 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 S232327AbhGJC1U (ORCPT + 99 others); Fri, 9 Jul 2021 22:27:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:42146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbhGJC0G (ORCPT ); Fri, 9 Jul 2021 22:26:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90C71613F5; Sat, 10 Jul 2021 02:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883798; bh=1BWtIQ+bDDju4B6IewjLGl2AaJcRH26LIim6FejbrmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QlJ7/5hpWyftET1sIKSPHj7x0KOKyT+x9VqcjDg9FEY6c+izpjYswKB+u0VahFaIP hp9NdSCTOZXpLiSL2Uoth0UpR/9SxWpbaMXvGL1BDwcGxoveDXFyQDJ0S2s2gL3jBQ 3/Y81a6te2m8COBprCNeW6bZZcz8TWtDmfK5lvN8lwn525R0nyRM4335TldR19mJKx lbj3xeE2nxw3z3/pFc7hBeSOBCcxiZWVvUC4ugV+ff4Gt7aztXq5ZRPeGbhpIZje0g 63buXgb2UHsZ4+e0/+Rq1FcyO0Qn2j0tw6gFuPbiQU3HK8J8r7jcYEa7pvu9qr3Xe2 Dc8tyOPHXnuWw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Yingliang , Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.12 062/104] ALSA: n64: check return value after calling platform_get_resource() Date: Fri, 9 Jul 2021 22:21:14 -0400 Message-Id: <20210710022156.3168825-62-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 be471fe332f7f14aa6828010b220d7e6902b91a0 ] It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210610124958.116142-1-yangyingliang@huawei.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/mips/snd-n64.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c index e35e93157755..463a6fe589eb 100644 --- a/sound/mips/snd-n64.c +++ b/sound/mips/snd-n64.c @@ -338,6 +338,10 @@ static int __init n64audio_probe(struct platform_device *pdev) strcpy(card->longname, "N64 Audio"); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + err = -EINVAL; + goto fail_dma_alloc; + } if (devm_request_irq(&pdev->dev, res->start, n64audio_isr, IRQF_SHARED, "N64 Audio", priv)) { err = -EBUSY; -- 2.30.2