From patchwork Mon Oct 24 11:33:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp653787wru; Mon, 24 Oct 2022 14:10:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54LQtDqmmoa+7ghIoLit+MzvGKJHlBVweRfkZlXEP58z+HdYEERtugKGy3B50f+85aJ7IB X-Received: by 2002:a17:907:728b:b0:7a1:b545:b39b with SMTP id dt11-20020a170907728b00b007a1b545b39bmr10889032ejc.661.1666645851601; Mon, 24 Oct 2022 14:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645851; cv=none; d=google.com; s=arc-20160816; b=djt/ATUChqTvt37MfaHWkJjJEYissV/6bCPmyLEvsUUISS00ajVK9W8b0iMCcwLEnk cXcQkWuH88SGfspFg//sXjL/Fz8DyiXJkeCvHhkVbpNHxcvHlG9ixop5XVPFhtrZysT2 38MqYzpTnuHEJ0Gutm4DucGwvQzuD2b39Lqafr1QR8xPvAGtXWWqiNnlSnVZ9UBRUSeQ c7BJp+/SqVuZM1WocWkuv0+3594+yW4gsvI/JLFbgaRZaP8UCcTY8qCtIBpOxLbSCDmW tX4fus8KM6u57s/gm6cVoWTbT6WiEqcpks09sy5lLuIsYVdcrt+cfoDcSpMgRK+oEeFM 1C/w== 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=goENrzwVvX4mMIGK699+yLO8Wevp3RuRLdAuzp2MWvg=; b=inVJiUY8VFpWJNJG2vL0BWIQ11/UAvXjS0VtDHIyT1VBPKPFJknwONM9b0nUzy1SP8 +w7EFuz3Dx6qiVMkb8ory0D1aA1IiDJ5gL+/j77dbHPC8OKjyYTfuuDkKsPCtRqYMQQ/ 8iLfEZj1d820UJpEOLxTYJJyfSm57P+evygBPvPJCenQKfujne+G6kEVGqK4hdVbuHpg KkFHtNRMY02Y4zUqcJbQ45ous9d+lRrUoCkeyp4GdHoCZrtXqbL26VlgUq36W15aVP4i 4zZ6vehgizcP8vah9V8ZQ5ZWMb6SiiJWKeA5lc2aEVqSQXF1f1odxGezM33sOUGAx3tl p/lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Hua/qtRj"; 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 l8-20020aa7c3c8000000b00461cb25bdefsi693917edr.254.2022.10.24.14.10.26; Mon, 24 Oct 2022 14:10:51 -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="Hua/qtRj"; 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 S233807AbiJXUym (ORCPT + 99 others); Mon, 24 Oct 2022 16:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234761AbiJXUxe (ORCPT ); Mon, 24 Oct 2022 16:53:34 -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 A45F5A4BB8; Mon, 24 Oct 2022 12:00:11 -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 8A4B86134F; Mon, 24 Oct 2022 12:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C23DC433C1; Mon, 24 Oct 2022 12:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615958; bh=/NdS3g71STJA3Pftdp1Yvvm9X41utaI30ce2S5p5+E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hua/qtRjdvwkzSqG4FAn/nOd4zq0Kng152aokRXafu+QLqg6BTLSdrT6YoledjzG2 PGSRxUs24TARzv6VUs590LHJOvdwoCHc+nhrm79cQC9nxdfD1bt9jp9nIfXMLr924+ pn/WMA7oRBVGRGw5tG5vi6EDFVJARPqLXgI3ulmQ= 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.15 447/530] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Mon, 24 Oct 2022 13:33:11 +0200 Message-Id: <20221024113105.273274733@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747604840396131776?= X-GMAIL-MSGID: =?utf-8?q?1747604840396131776?= 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; }