Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp593255iog; Mon, 13 Jun 2022 08:46:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZPeO/saPdJjE00J+BW3if0eVvOV4HxiLBveNSQc6DEIwDp8AmvDjexyY1T1BhoRYFYkoE X-Received: by 2002:a63:35ce:0:b0:3fd:fb5a:a1c3 with SMTP id c197-20020a6335ce000000b003fdfb5aa1c3mr212040pga.85.1655135214971; Mon, 13 Jun 2022 08:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655135214; cv=none; d=google.com; s=arc-20160816; b=xP5egXJ5yLgFoz99LIIg7ADWTeKU9h79nVxsU30xM0+e9uUAvVHm5NRL2Bs9PJD5O0 FFJ+Hdina44ldP+LaJcw58bLJM5mEwKhGCM8aSJWm1Q39VlhTunJNg867BKYPu236N5G l8dVilTIEqQ0Tfer5NCBL8iixNIpfahDWaD1oAA4jwaQT35xEG3uV5jR8kuIq0Nh/OXJ 34T5vJY6DrvQCdyDqn96P7yh+b4nVuweGbPjzHuKGmrRpyc/cpmKTa4xIt+D7cfq7sry 99f7qtny2LhikTa7bWQYJITitNT8zdo0IqGa3ltH4ZEzp2WIo1PPDZhJv8HPu5lAWO6i tixw== 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=exRSXC4jsogRXYsQBQajcO++GEXM5h0MRIKCz/YSwZ8=; b=WprRcSVAEGKHq1APpoidsphBDvqpoq3vInIOOvSY+jOlF0PLkXQIu8dTgEgX/g/Ere XBxsRKrsyRhTscCDhKLN4aI7P9Cd97DIs0onBkng2cnuSt9X2Hcomljt0hbkmtu0j9uH QwnLcxUqXY5vwadu3U1wOt1OjNKcUc3CewsoZfe3G5a9pq+tW4rayRHiN/3JBcchWOgJ OFD8ukjtG5V+fdYrOvKkiBWehRw0RKyFDDVba0IPiHOWzJ7O7RMInax+q9Gnn4hBnYe1 LiqDRVGgeLujuokIOLpHl3Wx8yOj1DAzR3E3gS0e6nFfmK1I2KhYxhNrr6oFt41CR8Bw DiWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="w/pG/8vf"; 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 e10-20020a63690a000000b0040173796e83si9912478pgc.824.2022.06.13.08.46.42; Mon, 13 Jun 2022 08:46:54 -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="w/pG/8vf"; 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 S243600AbiFMKrk (ORCPT + 99 others); Mon, 13 Jun 2022 06:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347299AbiFMKnv (ORCPT ); Mon, 13 Jun 2022 06:43:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FD3201A8; Mon, 13 Jun 2022 03:25: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 ams.source.kernel.org (Postfix) with ESMTPS id 7E9C3B80E90; Mon, 13 Jun 2022 10:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E59D1C34114; Mon, 13 Jun 2022 10:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115905; bh=9ythTDZkGeWLz6qsU2TVMuvmR0x6chpVk0Z79NBNNjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w/pG/8vfTb0+tpDwp4ra9ZsAYK2f588/Z8bq4kCuPauqe4U+J7GQbaAelsrYVb6kP WXqmhV/IdoMX4g9VcBbot+Ghvy4kz8pmcGSCzNNUZoa6MB3Ocp6GNE0rXXuN+QBeZI koqLHyLghxUVrHokfMRqEmSgDJbBjbWraSkQyKoE= 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.14 063/218] drm/msm/hdmi: check return value after calling platform_get_resource_byname() Date: Mon, 13 Jun 2022 12:08:41 +0200 Message-Id: <20220613094921.683399799@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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 17e069a133a4..0df62c9c2856 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