Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp64538rwi; Sun, 9 Oct 2022 18:34:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50D/AkIfbLeXZVoVBH8ZL51tINAbksA0D7jMCi2pEodeFWfxITWnSzekrWB2ZVhTB4f5US X-Received: by 2002:a17:902:ce87:b0:181:e55d:2d4 with SMTP id f7-20020a170902ce8700b00181e55d02d4mr5397858plg.13.1665365689764; Sun, 09 Oct 2022 18:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665365689; cv=none; d=google.com; s=arc-20160816; b=u0Mp4c0NTpLPmDKVXiwKsADFfHwipk7vm6ildQwCxAaZAkpnU4KpQGCPw2tA99Z1wR IAYvqUu1vCZb0Qra5w5FA3MLPA+3yKmqpOah94zWy3qD1mhFp7gD6H2We8Jo1ZUV5+ga RDkE2Z3b5s5Fmzf6p8iH5kVa6gVAljoNFCOX3KUAiRh8CmXg+G8cC3a1PV+HkeEwcuuo lneIWjHDVa0WfSlw7uZNd1cecUjZxe7OHyJFC//pIKx2VJiH0pEbh5/A0kp+w7RgRmDR bNcZwi2kSHWPQL6785AdLOuegwn0KNxb7NlkjIDqo7gw1+sd4hOnfgiZCVFSrknm5WcW 3NoA== 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=goENrzwVvX4mMIGK699+yLO8Wevp3RuRLdAuzp2MWvg=; b=sAnz29ziXbqOBBsZnRVJyXKxRTsYYu+o6BTsN/FPZUcFrKLTPKBRh+X0njwfIwE9AG WDL+LoqandimJHZFTX5Grnd7wnv62c1FzOfqvPUfs7mLn78QddZl9i6bdijr1sJ7gc8H J29pNTGQIEIjc2ZCN9gF+EgM5eQ3c2wIuwc5RRU+hOLkMdSoUNSll9nLUCwOfeize1NV u53quQ54cBcoSg2RDfjarRxlPE9JkGhloNjuG85xpeQhlFJNNoEDwBA8rtYidQtZTclg cMMw8DqHG2ocoea+4az/FtIhrBqJBHAVJY6v7+0ksF3r+yIiI8ybVgL/xwOf9Z12K5V1 eqHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SIqRdbzD; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170903234c00b00176e9de1f46si11896223plh.154.2022.10.09.18.34.38; Sun, 09 Oct 2022 18:34:49 -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=@kernel.org header.s=k20201202 header.b=SIqRdbzD; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbiJJAZ4 (ORCPT + 99 others); Sun, 9 Oct 2022 20:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbiJJAWU (ORCPT ); Sun, 9 Oct 2022 20:22:20 -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 7F3CA12081; Sun, 9 Oct 2022 16:56:14 -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 1C74460DD4; Sun, 9 Oct 2022 23:56:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E20FC43141; Sun, 9 Oct 2022 23:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665359773; bh=/NdS3g71STJA3Pftdp1Yvvm9X41utaI30ce2S5p5+E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SIqRdbzDJT9DY1yaEhtOzsdtqmC+q00EbRMZhHxyDTu5JQS9pXCu5aHcw5Xwn0R7E 2Q7WSx+3AzaW4Q3SnKgdwwbivni0wdxs6D5LfH6W8eMg56goo3QYqO9CwWL6y0OvKd pFUUmgufWfmlb2a4JtHNEcMRoTrs2sgvt4YaRNDaULC+gb4LZov/oQLNuGQ97JoaDM mvNdbTxtS7prlubXcEVBQ9Zh7XjSB8eAhEXkssKxbb8NCG1+xsQ0ZldAPiQX4unyHD tJPtIFdYRa7y5s9eerBmQnrK45CgD9c6MwqOH5Vive0VTikghPevkkgtoIJfJoyXH+ Z4Su3GdCkjmIw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zeng Jingxiang , Robert Foss , Sasha Levin , andrzej.hajda@intel.com, neil.armstrong@linaro.org, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.10 04/22] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Sun, 9 Oct 2022 19:55:22 -0400 Message-Id: <20221009235540.1231640-4-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009235540.1231640-1-sashal@kernel.org> References: <20221009235540.1231640-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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: Zeng Jingxiang [ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ] A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check. 812 if (!bridge->encoder) { Dereference the pointer bridge->encoder. 810 drm_connector_attach_encoder(<9611->connector, bridge->encoder); Signed-off-by: Zeng Jingxiang Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220727073119.1578972-1-zengjx95@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 29b1ce2140ab..1dcc28a4d853 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -816,13 +816,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961 drm_connector_helper_add(<9611->connector, <9611_bridge_connector_helper_funcs); - drm_connector_attach_encoder(<9611->connector, bridge->encoder); if (!bridge->encoder) { DRM_ERROR("Parent encoder object not found"); return -ENODEV; } + drm_connector_attach_encoder(<9611->connector, bridge->encoder); + return 0; } -- 2.35.1