Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp439718iog; Mon, 13 Jun 2022 06:03:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+iJfZ6urc8vpyZf1LxOL1k6o5MLEEWcgAtsSoWq9CC2yPEM704TD5Yw67N8VGADUpuOQp X-Received: by 2002:a17:907:1b1c:b0:6fe:f1a9:ef5a with SMTP id mp28-20020a1709071b1c00b006fef1a9ef5amr52862607ejc.233.1655125419571; Mon, 13 Jun 2022 06:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125419; cv=none; d=google.com; s=arc-20160816; b=lGP+dkGdOwIHQrQ6FcAeA1BfNy7c0uWeCKVonoLm4op4//VXIj1T0KPt54i9v/TCHW JkTKaJAyxDoAF/aqcr3Q5zObWUax7iFp3U9Hh87qIik0MxJvigOqnYKgTUo2oCtJJR5L koRRe8u3/CqeYDWTmeBKpyqyCfKgjI1MLKUfeR2d3GQWzOhwpL9uEwc4oyIcHcD/Plvb 179VmGG/g11vaI0gVqKkeklSw7lZDqSC9Xx9ezsnvTaZfNLlSSanSNShpPIjF27wjUC8 0gDuwVHGKjkGaILz66d0W5RUxPG1qc1Vau5slCyoWREuWlswOrkllu4SvFLzeXBucp0Y BEFA== 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=Bb/dmu+qkqxlKDm79UjQmRTT+MlWTMzW+oG2TYl5W5I=; b=uFWpIkiSpL02yp/56HSPHxchvbV+kAonGYz+0BeF+v8V7E5ZpHaCilTbsfICV6GNRJ 5KlF0o9a3qNIkz/CRpyhkDUJ8Rzby2ZgkcIpfr+w1cSNmsxWulqEDWxcb+pLwiP85mYU V8o0rQKQooeXtCis3lh6skdPGZNizSGu0GqZzbZzvLBmbcXVsHItzK52xoK7g63bQ4g6 cdFi2GOamnY6KsFxeFFS4aMjh6pIptj6yf2MMjUv07HzKNQp4Br6Kpqf/7JkMgAbQrgZ uvdR2syXmYs8qBfBVbsVfmEyz+G/jyIxgyOO7V9J+tLFMzE5F2nwbqFpXg5+XPQrFq41 ZWsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zGmh/rOc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt20-20020a1709072d9400b006feb8253446si9250948ejc.749.2022.06.13.06.03.12; Mon, 13 Jun 2022 06:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zGmh/rOc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236187AbiFMKTb (ORCPT + 99 others); Mon, 13 Jun 2022 06:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242282AbiFMKSS (ORCPT ); Mon, 13 Jun 2022 06:18:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0896ADF00; Mon, 13 Jun 2022 03:16:07 -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 99A0E614BF; Mon, 13 Jun 2022 10:16:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A144FC34114; Mon, 13 Jun 2022 10:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115366; bh=iT6aY+Ql7xXTk66FgNAFEfbUcnt+A+eNFO9WQN8pcgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zGmh/rOcejdUc6pYlVW8+/W91xTotb6A9Ac+jKSUaWJtw+akHScHYhlzQvrjBAsLw zprYc4yyZ5izwsE6WS+y28lKZH4SxHWk7SLLeYN1RQ/o+WLjUxjRBHK+LwtaDpEbKC O3oEdJ5rjAuW5ev0C6Ly0Z+0qLOib8r3Ie9hT77k= 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 4.9 048/167] drm/msm/hdmi: check return value after calling platform_get_resource_byname() Date: Mon, 13 Jun 2022 12:08:42 +0200 Message-Id: <20220613094852.247380218@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 a968cad509c2..48ab46726707 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -148,6 +148,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, -- 2.35.1