Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4628341iob; Sun, 8 May 2022 19:48:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyS1kgGYVt/G+/ZDm6UgkWYLNUw27AI62ZL7Knbk3SfTHV0uN9Af2OPydbo8no/pDUs+nxQ X-Received: by 2002:a17:90b:1a8b:b0:1dc:e565:3238 with SMTP id ng11-20020a17090b1a8b00b001dce5653238mr13122016pjb.64.1652064504810; Sun, 08 May 2022 19:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652064504; cv=none; d=google.com; s=arc-20160816; b=FyLJ9kcPdwFDgsjPqg66K+4jHnQuHMYzHRAII9LF1SN+eEa0pWyiOON6f1OzOSCNzT dNgNWY6iHWrry/OY7hT+k8jpoIgflwpIhMw8pL1089IzXu+tJzhVg1ksH7NNCwdlopou 0nBxFyljnfAt2Sxz9dEE14MvWec1UPvvgBFQoYmCjdzJsoNtDRvsWPRcZwp9g78HNe/A nww/JxgyyEqUVP5GlU928PIHJd6DtuLBBCXcFSTYD2GSbnt657VSXVUG1eatu+fu+8V4 oOFKn5Sl28PnMK7CPziVoksR7gJTuFxLIZN0b34q9EEEH1FAUo3I/7eiW6ODSEydU+up OhkQ== 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=5yjZOnedyr1JfTS+NkHM5IyznP3++QOKPt8duqDx3SM=; b=pbW6ZFIs8gN2U/PwOWYW2PNTOIMbVjyUuYu3vALzEGWuCwJf0zND9nArGB+iJPLhyw UkLRruZ6/L4G1JYu/X82Ju5YBeTNW98rUrJyn+ysTsq8VuuQ3R7/zQJdUNU9LFoTZRZc VEvRaXuSBaakq3ewnR8QymBfEGRea9XTiZ+FEGwetoDz+PmXc+QD0Kb7IIH4/h02/scL 5jblKqQJHnAEEkrLIAc1KFKW/AIIE01U9mVYlFXuUNgigrMIAe4exTo8t1AH7mKAn9Ht erx+slAW6hhxD71jBLmXMnzPyxm32uks7RsuPPjG5B6n13QMlDnROl6Vdu59Iy3bln4g qG5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FkxnUdje; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s13-20020a63f04d000000b003c62f2b74b3si11366551pgj.877.2022.05.08.19.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:48:24 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FkxnUdje; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 603587CB25; Sun, 8 May 2022 19:48:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358041AbiEDRUT (ORCPT + 99 others); Wed, 4 May 2022 13:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355959AbiEDREs (ORCPT ); Wed, 4 May 2022 13:04:48 -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 051C64F46F; Wed, 4 May 2022 09:53:36 -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 DB645617DE; Wed, 4 May 2022 16:53:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BF11C385AA; Wed, 4 May 2022 16:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683215; bh=Ar5oqbUC5hoxxIpXqcghvo8zzA6Nwxw+7dgjprTBSD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FkxnUdjeM8A8zAV/HaP6nz/gI4YumFtbvowdjodK+iRFBZiBjgSaeIv6kzFc6nLEH Z678/X9DpI50FM9xFNpG+4lj04q2sl9hdOY1SPul7nnOP2ijmu7STERQ60Li/1xW/L bHBsgyRhzQGrMIPrTi7AZFTFlA2ww4bbQGsKO+Kk= 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.15 080/177] net: dsa: Add missing of_node_put() in dsa_port_link_register_of Date: Wed, 4 May 2022 18:44:33 +0200 Message-Id: <20220504153100.227369061@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 616330a16d31..63e88de96393 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1201,8 +1201,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