Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp878580rwi; Wed, 19 Oct 2022 04:13:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54q2sQWIRu6pcIyxNlcVhZc4dRAr6SlCDi+BFuyVFm26OYDPyCuKLo08vUvQ1APjJ1be4s X-Received: by 2002:a63:1450:0:b0:439:3806:9b91 with SMTP id 16-20020a631450000000b0043938069b91mr6729183pgu.407.1666178017742; Wed, 19 Oct 2022 04:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178017; cv=none; d=google.com; s=arc-20160816; b=cAZcnIacvxG4uRZmffi2cYCft2UBWext4VcnszwmmnwuQhwqBmIezEw6aKj4j26jXz uEwWTLiifjX3O3IFaYU13150cdILHzdX/MPV03reu9QFGAXS1xdqhGwmKYVANTg+ooH9 XKLwFqhaY9+oBXM3Hgs9XmkJ5EZMn5jDNS4lDO+XuW+cJLZ53AG3EhCEpzJV4EdaREr+ 5XfYuH15tc7vXSWiO/kTj89ZNNK4R7laEir4wzldDHZGPNJTNa7W+ryPiggzpxg6AaYZ NF3ZGXpNkQECrJ4YvuKAnZyLnsfSFglr6AEFgvBpoysJtRM1bgBhvNWrwFVUfbvX8naS frug== 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=H+z4HvNPynwS3nx5IAIbiDv73MJKdhHjdjHbHBZcu00=; b=QjcieRUS6Se1wI+0kPPgfI32XUgqZS7Uv6zI35Woge3iB6d5s2ctBJLJ5FbOWjkTKP cgq02g3I4LuErRLMGKfZD3QVCjkEXKJkXJS1+pbtnseIwOXhtUuoKRFfP9cea2oIFl93 BvTr1fF6uFDTsj+6ponBPISalE7yIarMtSPPwm2TOxO++03KuJb5gZ8wEVROMvFg1mSq T3Qlr45ZHRM2qpsnNknrFtel7+EBqHXnGr4eFHkwygCKB6EAskbmB1LQY79zLF9AafW5 USoriWK7sjeh6ySj/iUafbGCqAC4pT/Zli2QpCMEF6rBXtfaXqKVSELk3GjdPVONzPij BhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uNnDSRxq; 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 j4-20020a170902da8400b0017f6557bf88si21735014plx.588.2022.10.19.04.13.25; Wed, 19 Oct 2022 04:13:37 -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=uNnDSRxq; 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 S233577AbiJSJ2d (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbiJSJ0z (ORCPT ); Wed, 19 Oct 2022 05:26:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C89EE6F79; Wed, 19 Oct 2022 02:12:17 -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 1403B6178B; Wed, 19 Oct 2022 09:10:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25715C433D6; Wed, 19 Oct 2022 09:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170642; bh=/7mFFmnD5ORcDhB0aTlr6PsMjGLmulXKt1omuQvE+lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNnDSRxqvjLifKyXk3QzyZ1IxZmiz2WHIK96ajaO9Na6v1I7u0GiInrQqq2AaveUb 0463bJl4NERKZ5e4kxJo1v8mdSf8OhvYesnJZisz2L3H0nG6DwYi+Cvuo+dUNiD0Ay SLtSnM1v1FKHL2OGRGNeWOO7q1f/CbWJRT3KsciA= 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 6.0 732/862] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Wed, 19 Oct 2022 10:33:39 +0200 Message-Id: <20221019083322.286124999@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 8a60e83482a0..5fccacc159f0 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -813,13 +813,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