From patchwork Mon Oct 24 11:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527540wru; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Jx5k5If2vJi2nuSSwtBdzKlmNpndcFK98vu9syBiyOgvI27kMQ7eQermPVrc1HbnVRobB X-Received: by 2002:a17:90b:3103:b0:213:2578:e5c5 with SMTP id gc3-20020a17090b310300b002132578e5c5mr3065868pjb.217.1666627260578; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627260; cv=none; d=google.com; s=arc-20160816; b=CByr4dwz2s3YwD8StLG4h7Nwvx3XL6SZP4b2eWZvTVFlZhVqoRsExdsq9Xz9kZ7xes RnNiHlJ1UIYTg6X7KrWJilSng9uqbSKSjVeyyUmRlzfMOst1293XdGg1v+E4wPgSkjtX UlAFx0QqrlmMEuYAIJTpLrbUPBIjs3jJC5bkWYsjsYL3mUPYzyyp8m5xWiIwvrkzda6t Tyf6RvyVTdHTwQ8bu+poKtYEFoe/zjIiCubficvX7hSFsvQon62t9MzhOPCGGNnXnBhR uOIwOcLMRvNbuu+6RzHDVxhYJIifGcChpR4PVqMzVqTRRFLocw6RZAfZtaMo1y3iu7ju BbMg== 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=rD6GdvCaKRta4xu+kFCvhVMiDBDwxff3Sg0qJX0RMFIfrxlerize75qKnMEnYUpUBP jiE8dYZP13JgGUfqIj2IqdcN06tkfBp6GhS3CzG9Oprwqvssvnk/PPYiOPzsaSjrmsXJ WxKJuE6Fe35pycEH1a4l4/gOxey4OWbUMm3TIljbaBV0kJ06nUMIO/k3QcFoG21T/GJJ /+QwxMspTusnMSmW3V+IL/d32brlNgdOHN8mmpEuVcRl1tepwvFM3FGF5vSbS05ErDFa /lEyPi9CK0V6AlyijfGgA4GpAzhO9ZcNP4VkKL3KJQJyk/o1SkfPuKlXRPd1ZVAnUXZB VuRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pCjIGIDU; 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 s17-20020a632c11000000b0046f0b3f7dbesi4168349pgs.408.2022.10.24.09.00.25; Mon, 24 Oct 2022 09:01:00 -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=pCjIGIDU; 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 S231638AbiJXP60 (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231610AbiJXP5h (ORCPT ); Mon, 24 Oct 2022 11:57:37 -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 F2C1575491; Mon, 24 Oct 2022 07:52:56 -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 4748FB816A3; Mon, 24 Oct 2022 12:30:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A516EC433C1; Mon, 24 Oct 2022 12:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614613; bh=/NdS3g71STJA3Pftdp1Yvvm9X41utaI30ce2S5p5+E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pCjIGIDUoMFnuZXSwQokhuRzWF76MvBlU2NdzTZ5E2i1BBipVnWBRY2CdI6YU0s9L ZwHijxtU6mw45ki86vTJwRi4UU6JXIi/I3TdwtoX7c1SpiCW0mHMDbbSi3yKgQUkHm +TQWrWh7yM/RRZqaORVqNG/zMh/Y8xW0XlyRRugE= 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.10 328/390] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Mon, 24 Oct 2022 13:32:05 +0200 Message-Id: <20221024113036.976751511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747585346697383614?= X-GMAIL-MSGID: =?utf-8?q?1747585346697383614?= 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; }