Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928334rwb; Mon, 15 Aug 2022 14:13:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4G+8TwGNueNxsTsoK+fFV3y+PBdJE20tq8/+cQ/bx/v0s5e9yf8pZJOFLrfTywvEJkxmEA X-Received: by 2002:a63:6a46:0:b0:41a:3e67:67cd with SMTP id f67-20020a636a46000000b0041a3e6767cdmr15533747pgc.94.1660598037212; Mon, 15 Aug 2022 14:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598037; cv=none; d=google.com; s=arc-20160816; b=sDAbJLm2LoqqH1gdsKV9E0PdgY3tAPBSqnNMVDosegeS9/jLPXGukEsJbONc/cDVLR bEEzCrzzPxGyouBJ+h7pc4WXvFTdZ6RAqEj4/aY9owomTG6aYgzg02Pi56h//wfp7a+o w9nSwAJjKnz1XfuP2ILG5j/cUpONqHRWDD1fhk3/8LhA4PNFnhYz93cbBvgmM/s16qQY DVukf1QOTO1hwu34umTBsAWSKxSM6wMMdMaVMniDD0L0SVT4S5Xq6IUun4mnQHidXlxD K29o9nJdoJeAm+Y6eXTMpiTJPYV8s8iU5cMQCHDsXlzxtwNqIPY1L+1wtaZhVJ7Slban DJWw== 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=+oLPTX3ZvQi/c8/Q1MjxpwWS8EA1McH3HvasOIsVhHU=; b=gG3l6XHPuvVPTm2BbWcQfHOTT2O3H2X9Tt7wceCzR+5k0ow/TcoAoXWtzk9pwS4S62 93Yoknql9vMpB3hLWu3Z2cMFrylX+XJJip0ZDQbK0T5Q9Z/19xHuoXue75PoDGVAPiQ9 O2aHWriU9OH5UEeTe4o3Fu45HuWK+EM4y5V35r2XeYeEnnfrxRPzl8F5ZHJZMqD0A1fs +nNxJP+Gy8UM0Ie69QbImAu9vI50fsUV4J+dtV0mMI91dkMrRXwufGkOQWIkMZ7guFWa 2FDfZbS9ihVMNWhLiN/zzTTtrTse6oOHqDe7xM0DVmpcSCzvhsZbOIKmIp8YPuEB3DRy r7EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GqLDgwQC; 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 i3-20020aa78b43000000b005286cc2b29bsi11220853pfd.253.2022.08.15.14.13.45; Mon, 15 Aug 2022 14:13:57 -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=GqLDgwQC; 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 S1346260AbiHOUzA (ORCPT + 99 others); Mon, 15 Aug 2022 16:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346180AbiHOUyG (ORCPT ); Mon, 15 Aug 2022 16:54:06 -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 49391A8966; Mon, 15 Aug 2022 12:10:55 -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 8A6AE60ACE; Mon, 15 Aug 2022 19:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91718C433C1; Mon, 15 Aug 2022 19:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590648; bh=N836QlaP8EZTDQ0E+HF1nAvtsij5ua2T/dw7TqgbLH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqLDgwQC9AdglK0AhRfAmYBdGeBuXC4ZgkzHOEzK0tsiZKVVxTa1MB1Z8cJWtJw6D B5Zmq9+WMxNB/HWaSaIxN4f9wCc55xB83oXbNVYEF+iWdXBNot26iycXd8c9qwtAJy fPO4fWWahLAE0ke2z3aoO8iuLDKSno1kAdxvTwDg= 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.18 0325/1095] drm/meson: encoder_hdmi: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:55:24 +0200 Message-Id: <20220815180443.235697319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 de87f02cd388..a7692584487c 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; @@ -446,4 +449,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