Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3197295pxp; Mon, 14 Mar 2022 13:06:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJprj+vImt5fFAOSEAhFFNjmxDb6MhBLnd/mDW0JyZ4KGGcmwY1eUIGsxE3+R+V481pyUX X-Received: by 2002:a17:902:744c:b0:153:29de:55aa with SMTP id e12-20020a170902744c00b0015329de55aamr21221117plt.2.1647288408254; Mon, 14 Mar 2022 13:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647288408; cv=none; d=google.com; s=arc-20160816; b=pW0a3os78ii5nw1rC0iiRMHfoDccBsZ/q36V1AbXA/1dyWKhUZ/FBab2IXiCLp/K5Z cEn/jv4RlHglpTnwH0a8YWW0u16WMrox3IElK2IYCKspm293DyxUpkzocqE3+B/ztTwz 5SQ9Pg+fGIGW5ln/tBVJM/yoRM/iiLgM/v1MCbpcXj+vzTo+OOLbi6rYto7aH25NKToC s1o1MZHpLhCuGQkMjkM/QrS/i/QsHQqJ+4K3cfdI+6uIu2PJuo/NNnXO8Jej76SqAVsU QeN/xcmAWXSvlF0qko49NlOvumuf0agdH1wvKwPXM2kgloATaAkmkIbZPPl7pWwtq7Dx OnuQ== 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=8OvNg8v2VtgYDuYrPX5a0khdFvYpLoyYv0nh+7TqdHQ=; b=ZKOWiYz/QLil1P4SbFIYyYcZJ2HYEVhEhYxbi11V/ykGmi3Q3EC2Jj9X4bQuUyjmlw ddCQnxPX7Qetn7xAnbxW7Gn63xg+AxR+E34XQMnLObQ3YrdhJYlpa/kMabvcrXGCRgDA g2bgoak9BhrTsGb2pOh8uqNw+ZyWm3tS5DInMMvFTDcFhhuFg2oAoVvQHoIMTR4Jvex5 SHxwlShVFDm1hjMLEbaeukGndHO1bJa1X/T9T/E5EoWvX+hVnBPzlwmhxftrpveIChAc blU+TR70NVhWfWsMek4PqbKEOwoMtNGF5e2lDANLkG2rPvKD8gtWjL7mhzX65Sbeki8Q EEiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vZ2Ir2SU; 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 s1-20020a63af41000000b003802ff5d0c8si16915156pgo.603.2022.03.14.13.06.34; Mon, 14 Mar 2022 13:06:48 -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=vZ2Ir2SU; 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 S239449AbiCNLkY (ORCPT + 99 others); Mon, 14 Mar 2022 07:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239451AbiCNLjb (ORCPT ); Mon, 14 Mar 2022 07:39:31 -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 DC72641318; Mon, 14 Mar 2022 04:37: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 6AC7061189; Mon, 14 Mar 2022 11:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A845C340EC; Mon, 14 Mar 2022 11:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647257874; bh=YCUFzadyaHoFzSjHrge+ZnugCfMoDuKERu5OMjmewMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZ2Ir2SUDBqiY0BGc97h8XuQ+vuWVzUC0dEnIqJ0wodtXw6B3lhuIDsH2b9ibmZ01 zKUU2ph2Ea0FuUj3uFlqN47Bl799ZBPSq30s88CDUZ1J/3zv10C52JvncKthF6UwdZ ERISMV7IM7WalefMsUuw4HLr8cC3Jzn8yEFmE4KE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Jesse Brandeburg , Claudiu Manoil , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 10/30] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info Date: Mon, 14 Mar 2022 12:34:28 +0100 Message-Id: <20220314112732.080037634@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112731.785042288@linuxfoundation.org> References: <20220314112731.785042288@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.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,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 2ac5b58e645c66932438bb021cb5b52097ce70b0 ] The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount. Fixes: 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata") Signed-off-by: Miaoqian Lin Reviewed-by: Jesse Brandeburg Reviewed-by: Claudiu Manoil Link: https://lore.kernel.org/r/20220310015313.14938-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 395a5266ea30..0cddaaaf48aa 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -1528,6 +1528,7 @@ static int gfar_get_ts_info(struct net_device *dev, ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp"); if (ptp_node) { ptp_dev = of_find_device_by_node(ptp_node); + of_node_put(ptp_node); if (ptp_dev) ptp = platform_get_drvdata(ptp_dev); } -- 2.34.1