Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2147705iof; Tue, 7 Jun 2022 21:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZc3zag/B0szuLbPY83O2/ipfK/VDKtOzKiR+sn5f+df51CHhm70H0yjtvzebcSTMNrVQA X-Received: by 2002:a65:6bc4:0:b0:3c2:2f7c:cc74 with SMTP id e4-20020a656bc4000000b003c22f7ccc74mr28348681pgw.307.1654662025200; Tue, 07 Jun 2022 21:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662025; cv=none; d=google.com; s=arc-20160816; b=BK5RW02aOuPhxLX5LU6wywVTPDN1WDVr31QJEaeV+Pdvf3V79Sve/2gzfpqIzc8xJT z3mg6YQJRkfl6H3PfxFiy8W5il//eOgZDTAgAoNVNbrpBsT4VZLlFv2z4PzIUCdzmNFv /3tBlrQtUALkOvf2n6xE9TtU4znpz9KEE2avLJz25nWJ4DcQCxGOxlj4adzaTq01s7Xl WDmn3y20OmZcITfBOSa3dn4U/ozhMwzxoWa0St8/qXtDdLenBZl3Gkk+6o7mF7FCrFZV dwUd1Yv4ILf6FkgNTeY+AFuv8cJKVpPFQlh9wYL0GQquzXBH77WaqkA949CT+Qx5T66F Et6w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qka/Ej69q8G7B3ctQvyK2ZWK75ze4i8F8D1k4y40APw=; b=P3BEv2JXOyCQ5xbpvrd8zwUx7zQnlYgfk3dJTThJPUaIQ/Nutk1/qLolJAiwNSGfvx dwzU+L2exyVOTfDzpdbOrSmGzMXatqMHgrdz2qfaEeu6zmgZtcbbA4R0zWLyLJH+nZiS sqnRwpSymmFoFmo5NxkgelDSlkdIiWjlQZqLyl5QEMDYGDe3rEDhCvIlD2EODBrsG5M6 sW5cNZV8M+wS/YdhnuSKil5bM1zml2jsGTPgwkt5MFPQPlTr28mXthqy1AVXcBY/6I2Q WalNmYfXOSm73vroAqDJ9Sw14pEzrB/ArqjIWmsUhj915thtmFOrntmK/+Qxcgz2NZBm eu+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DYmJbysT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n14-20020a170902d2ce00b00163b1bfff0bsi32045724plc.232.2022.06.07.21.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DYmJbysT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5AA3140A8A9; Tue, 7 Jun 2022 20:51:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385663AbiFGWqN (ORCPT + 99 others); Tue, 7 Jun 2022 18:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380386AbiFGVfN (ORCPT ); Tue, 7 Jun 2022 17:35:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7196216FEC6; Tue, 7 Jun 2022 12:04:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49F316181D; Tue, 7 Jun 2022 19:04:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FAD6C385A2; Tue, 7 Jun 2022 19:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628675; bh=vIbHXWTCunfDVHksPQ0wtzLN71S1U5ekmwl3o5FqcFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DYmJbysTPZ9NNuYOVA5kO9dE3VNst/PVhEMMt9NDw8iJKpBH0iiC4dOnejTEPwdiJ jzER010kH3n9h7yMn15eBogoscu52VHJTkhAfDYWhH1BA9xOkgzwolsIeLIPEtHx+c CT2qDI/mLBz5/FTlmanmWj46MsKUw75Kht48fPZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.18 374/879] drm/msm/hdmi: check return value after calling platform_get_resource_byname() Date: Tue, 7 Jun 2022 18:58:12 +0200 Message-Id: <20220607165013.727093488@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit a36e506711548df923ceb7ec9f6001375be799a5 ] It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Fixes: c6a57a50ad56 ("drm/msm/hdmi: add hdmi hdcp support (V3)") Signed-off-by: Yang Yingliang Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/482992/ Link: https://lore.kernel.org/r/20220422032227.2991553-1-yangyingliang@huawei.com Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ec324352e862..07e2ad527af9 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -142,6 +142,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev) /* HDCP needs physical address of hdmi register */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, config->mmio_name); + if (!res) { + ret = -EINVAL; + goto fail; + } hdmi->mmio_phy_addr = res->start; hdmi->qfprom_mmio = msm_ioremap(pdev, config->qfprom_mmio_name); -- 2.35.1