From patchwork Wed Oct 19 08:33:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223941wrs; Wed, 19 Oct 2022 02:38:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oxzm1tFJyI4SJCajaI0U/3MlaeBvxxkvyuBBy4xGXOgtk8+FoaS48Hp883n5OPIJGhtjp X-Received: by 2002:a17:907:7292:b0:78e:2eb5:6af2 with SMTP id dt18-20020a170907729200b0078e2eb56af2mr6008511ejc.261.1666172332398; Wed, 19 Oct 2022 02:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172332; cv=none; d=google.com; s=arc-20160816; b=GDmPi/+GzW9+5FgLPuLz9bSF/tv1xkF8UxcX0OGpfABaV+WG+Djca1jPADXx+sbGjT KVlDoHj+RWLSPEJK1VuqC6/0pbNCvzc2sosXB14lW8gCZTbCoYwnjpD8R6soJlCewORv gJBKngFVahABEgW30ZDrJoUGyTpelTMsVfXJyIxKwv5TAOqPCQvOZ+kNO5jbp/w2cZBk EiIqcwp2DTkYEsY+NSeJSLW62oBUJy9xsL17lyr3Ev1xx5xAIX+iPew2ihavSbgv2Mg8 D0bqMIYv/C1Td+LEHq0ZPUEUXebjL1JeCr6TWKn1oH6u5vLsCGuZJ0H7yRxrKCXuEtIp QSlg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a1709061ec700b0078d4cf8de04si11943015ejj.380.2022.10.19.02.38.27; Wed, 19 Oct 2022 02:38:52 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108319328614659?= X-GMAIL-MSGID: =?utf-8?q?1747108319328614659?= 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; }