Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2883224rwb; Mon, 15 Aug 2022 13:15:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR64auEyETEiGMHx1z0bi/uy6ogZ2AzK7JhqniflYCbMwoJ8eU8otsJYQJsVxZ5XOibEMGTE X-Received: by 2002:a17:90a:ac0e:b0:1f3:2507:b532 with SMTP id o14-20020a17090aac0e00b001f32507b532mr20635468pjq.48.1660594525093; Mon, 15 Aug 2022 13:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594525; cv=none; d=google.com; s=arc-20160816; b=nnEFVoORbJyVuNe3AC7JBjMcvr0Z0+zTeVXARDAlUlQirTvLH+wJjs+Yu2kEti1tUv RnK61hlY+FFYu2J621PxxPOeTHdy/gQRdL84q8UN6vBxmhsv2GAqLEYDET9geddUVDb6 IsOrxrmrNHOHWoa6mxrgnK1FANFQjMqGTNdgw1CxYqkXFYat0CovBjOJPgNFBsTXhpDX 0INwv9Qcdlq9ot1hB+4upjYbpAHqPJzPwbnJ9dtDYR0EnQAFYhfyO/fdVj+jKzmKTVaU KpJ321NJMlR9LNF4LzNkLOWPBDcMGht3xsDWe5GG2+AUEoM2nJ2KwPxZkbHcAtivy/3k Lpyw== 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=GpYNJmM3gpRZFQv9xT+/QYpeRrhGyxhoG3aS/d7g5TU=; b=wQ/ytj0/JgS6iaQWRqAnfyn6zDC5PMBq8/xkuzTmornPkCrGVZZsvYLAF8VIEJYpTL HBpJSBJl7ZuTwPxoIyEiAipwILsFqojnzwSWXUNABj6lm/LrKHeOKf4/7hwQAeWLnF3c 79IPBk8JyYaUjRtbV5JjbHmqru3ybWPES8LDvGjBhoClS8wE9KVZ7kinAx7Jf/heJX3J 1wWw7DIEwiVL7fr/PYZkSCP7Xa884oijZZo4nvaaDp+XVm/MGHfTQGR2/z0eqwAwZhZ4 fL/9BFAFIMM8kZFuFyzjwNIc9MnkwyWeoah/nQFFUcCxgYamAe/Q821gpeVkHrHkVOgQ RgDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gORTQe58; 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 w15-20020a63f50f000000b0041bdf3cfd82si10414130pgh.171.2022.08.15.13.15.13; Mon, 15 Aug 2022 13:15:25 -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=gORTQe58; 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 S244276AbiHOSq7 (ORCPT + 99 others); Mon, 15 Aug 2022 14:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244095AbiHOSmI (ORCPT ); Mon, 15 Aug 2022 14:42:08 -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 64C072F3B8; Mon, 15 Aug 2022 11:25: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 0277EB80F99; Mon, 15 Aug 2022 18:25:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B5BDC433D6; Mon, 15 Aug 2022 18:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587953; bh=jVXleNbYzX0yrVfrIObxlmms/7Qv6oFGmQoqOUB/KoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gORTQe58n3/uS5Fc6dtwxZGBlvDceqAXlbF/FQN3OUTsYRGDQp7psFoRJJpbJE8Mn 4gCnf/ibVYHst8mGeDgtlZn/F5Xt5mg0l6RE0Z/dsn43Ugb2rb6PJXKgKKNPkOyAA/ 2OlKXmt6xNJc3FZtbacelkUbOB2Y47KF0294iJd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 248/779] drm/meson: encoder_hdmi: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:58:12 +0200 Message-Id: <20220815180347.937220300@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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.1 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,T_SCC_BODY_TEXT_LINE 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: Miaoqian Lin [ Upstream commit d82a5a4aae9d0203234737caed1bf470aa317568 ] of_graph_get_remote_node() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: e67f6037ae1b ("drm/meson: split out encoder from meson_dw_hdmi") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220601033927.47814-3-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index 5e306de6f485..0d532e8e8cca 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -365,7 +365,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->next_bridge = of_drm_find_bridge(remote); if (!meson_encoder_hdmi->next_bridge) { dev_err(priv->dev, "Failed to find HDMI transceiver bridge\n"); - return -EPROBE_DEFER; + ret = -EPROBE_DEFER; + goto err_put_node; } /* HDMI Encoder Bridge */ @@ -383,7 +384,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_MODE_ENCODER_TMDS); if (ret) { dev_err(priv->dev, "Failed to init HDMI encoder: %d\n", ret); - return ret; + goto err_put_node; } meson_encoder_hdmi->encoder.possible_crtcs = BIT(0); @@ -393,7 +394,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); - return ret; + goto err_put_node; } /* Initialize & attach Bridge Connector */ @@ -401,7 +402,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) &meson_encoder_hdmi->encoder); if (IS_ERR(meson_encoder_hdmi->connector)) { dev_err(priv->dev, "Unable to create HDMI bridge connector\n"); - return PTR_ERR(meson_encoder_hdmi->connector); + ret = PTR_ERR(meson_encoder_hdmi->connector); + goto err_put_node; } drm_connector_attach_encoder(meson_encoder_hdmi->connector, &meson_encoder_hdmi->encoder); @@ -428,6 +430,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->connector->ycbcr_420_allowed = true; pdev = of_find_device_by_node(remote); + of_node_put(remote); if (pdev) { struct cec_connector_info conn_info; struct cec_notifier *notifier; @@ -444,4 +447,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) dev_dbg(priv->dev, "HDMI encoder initialized\n"); return 0; + +err_put_node: + of_node_put(remote); + return ret; } -- 2.35.1