From patchwork Sat Oct 22 07:28:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106759wrr; Sat, 22 Oct 2022 01:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pQ51rktu/42rEkHFjouS7DnPhWN3mTKUOwD3pFo65ZzOkcsFgdnyCVZ+44lBKAjSfGfiI X-Received: by 2002:a17:907:788:b0:741:4d1a:595d with SMTP id xd8-20020a170907078800b007414d1a595dmr18843478ejb.737.1666427935457; Sat, 22 Oct 2022 01:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427935; cv=none; d=google.com; s=arc-20160816; b=oz20hSSpBuZnT/AB+kjoch1YKAIS311QJE+LPs1abnG3+hOPJzg+TU4NyZNIxwJJJH kew3ff8fqVHsxVzOHj+2p85ODYpxU4CNcZ665kqw+5x3ZdgMeedRUPzcxc7nHp/sW40C RFI/o91HPl5033NnI9Hyyrp2V2BuvCoNlga2tPlPnpcib/trc1UIIjRzc6O14mo1rzzj M6emH2VjZp4y3Gl7nhYEkSgq0qgUYnl5pcJd/Dxi8v6B6EbL+LUwCBXN5CEA0ZMUi0DA dwrHIr8soQtGRePX3WH/OnUZJ4NnYPMtgW+8mTvZWPUoPTN1UaxzBhfXzDeUphkoY5jE E/wQ== 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=jI+SEWVfgYFxaGTA+7Axbfg357KRHEdw6H4GSjcYGKE=; b=ByXCmFNIq9gR+Lxl7q0jAZzCgJ5xUhFZT2BAw1yWwrzjIbN0tVm/HmYw9of02xHvDC VKRpAdj9t1xU/80rHeTpvre+VH1ZC65I9AzrtwyyxMFxhuRo8beJ23lvFVa7x0EWkmun hLqtn1h/OmxHBC/+cAokjHMMnNoPUzumLZooHE0ZOAXTYHRoNZmuxMwJ/pGWpkmj8KOu EbB30j2q+i/gLIfrTRpGCohopYnY3SNGqqEp6YcxDqT05gXPLdbI9L5+JucIcs5QrVwz dSBboU+pxbnCzKPqmkMHu2ZK8z7xuQiJH1E8Itxg4flNOEGleWPvUphsZt7Wvc7TBUye ApaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rz6oxefb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a50cb84000000b00453688643fasi19920754edi.260.2022.10.22.01.38.27; Sat, 22 Oct 2022 01:38:55 -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=Rz6oxefb; 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 S234015AbiJVIgH (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbiJVIau (ORCPT ); Sat, 22 Oct 2022 04:30:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E8C2D0829; Sat, 22 Oct 2022 01:02:53 -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 D04D7B82E03; Sat, 22 Oct 2022 08:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF6CC433C1; Sat, 22 Oct 2022 08:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425743; bh=MaQazHfFY/HDy6I/LWmFBbykNt6P66Lp3uE6fOgsq4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rz6oxefbpHORsr70LlnTVTKAgUlduKYUaO/SxrdQtn4mveQYUaBwjTOvrihSRDSmh meWSjhUenFKBCT5ZTa0fL0wgsGHo7aO2XZWD13/SrA1HgAi+6DlK3E1l2u5PkS0GWT c3g5NAejUEwWPVuGUyN3cOsYTl+Kf2sbSh1SeMOY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeng Jingxiang , Robert Foss , Sasha Levin Subject: [PATCH 5.19 602/717] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Sat, 22 Oct 2022 09:28:01 +0200 Message-Id: <20221022072525.082141625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376338855832113?= X-GMAIL-MSGID: =?utf-8?q?1747376338855832113?= 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 c0b182d1374e..7f688ebd36eb 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -807,13 +807,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; }