From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D1E5C35280 for ; Wed, 4 May 2022 17:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358929AbiEDRf2 (ORCPT ); Wed, 4 May 2022 13:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357038AbiEDRJx (ORCPT ); Wed, 4 May 2022 13:09:53 -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 466EF4889D; Wed, 4 May 2022 09:56:59 -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 0BDDAB827C2; Wed, 4 May 2022 16:56:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF0EAC385B0; Wed, 4 May 2022 16:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683416; bh=SRazH2uyyXomn+ZtPfi6A/TGv9uvTaddlbbFfB3+IhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QeNqCzQEBnJzlIzPtDTbuMOgY9enyXH5M2WQ35anVRvnktn4Yj9cX0WtzFdqaThLk qYPu1J3T+1i2pkKKJknMjAkD8gMzX99HQ3mjRRwS/uPyMkZyucba9H3E5Dp/gQsgYs paQdFckxfibP/EM0ybqb+i4rdBI3UXNqloR6gaQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , "David S. Miller" , Sasha Levin Subject: [PATCH 5.17 101/225] net: dsa: Add missing of_node_put() in dsa_port_link_register_of Date: Wed, 4 May 2022 18:45:39 +0200 Message-Id: <20220504153119.734641238@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit fc06b2867f4cea543505acfb194c2be4ebf0c7d3 ] The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. of_node_put() will check for NULL value. Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") Signed-off-by: Miaoqian Lin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/dsa/port.c b/net/dsa/port.c index 1a40c52f5a42..4368fd32c4a5 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1240,8 +1240,10 @@ int dsa_port_link_register_of(struct dsa_port *dp) if (ds->ops->phylink_mac_link_down) ds->ops->phylink_mac_link_down(ds, port, MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); + of_node_put(phy_np); return dsa_port_phylink_register(dp); } + of_node_put(phy_np); return 0; } -- 2.35.1