Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2403715ioo; Sat, 28 May 2022 12:32:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Oy+RrPJG+WU8l6OZv7/FYbJnsOIbvhkHYwlGVYgZFRr8tRh+VV65xEjKkv1FFVDRlmg4 X-Received: by 2002:a63:445d:0:b0:3fb:10da:f976 with SMTP id t29-20020a63445d000000b003fb10daf976mr12486179pgk.594.1653766339808; Sat, 28 May 2022 12:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766339; cv=none; d=google.com; s=arc-20160816; b=U1lUn4fK8t3v5E6dJnduvmVyOl/To/zNQ9k2bjd49cDMn/liJ1Bc+jmHmGv5RkZVza kIjjJHpvEGkQrHQvbuVHpMAdCdOeO3z1cRiVzLzuk46PhlqSHCu+1eEWsd8LDvzOFvu6 uxjLa4BqiePimzr4RkAHic+Ej8w10QeDsvD8c5/g4XrJWO0D1UrDQPNin8HL1GqBojOP /mrp5x8wUY+bBv9EtYS7i1x9HtsyT0191+Vf+O17diGm+xAfdT3xbqCqR5GilQ8KUwst rfwtOhH/iWgozA76BExuGTyyzXfczUwxLQzCMO7vpvSwrMc/NLQ+esAfYyd1AeTnFa12 Fdhw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=m/lvjxTIZ+Ygj6D7GoPluKCwa22EHyTs2E8wB9wrlUs=; b=QF54+6Hs6wPiJkloFUrxK0nFlRNL+Ama+3rl+4uxeIwHZfhf+6l7roHn0mYo99PHqi Piu2iyy3QWy6PNKP30biIKd1+oWxPpCNDzeH7GTW8tUAvVufLuZlmBLEQjlv5wxipN7n 7evh8JaOYZSE36b2RQDoOEPlGOzqBoBExyTKoGIFOfJWkFcsdgK8D2IuvhKhNw0Gh4Qz oArkhbX66j6/2c8jN/7sLzu8lIBUkDJ4pp1SY/gRemg6joCdgaDjNZnXcfkYL+ldq40g r+RwBjlzcEVSgQ44s9H+L31WqeH0UGwy9wTnaBgvduTkqvqjz7vh62TIRjOWgTP2NgQw xpVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J9dNX/CY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n21-20020a634d55000000b003c1fa069da0si10282507pgl.656.2022.05.28.12.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="J9dNX/CY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 761FF37A88; Sat, 28 May 2022 11:59:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244230AbiEZLBP (ORCPT + 99 others); Thu, 26 May 2022 07:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231377AbiEZLBN (ORCPT ); Thu, 26 May 2022 07:01:13 -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 8D7B31D0F3; Thu, 26 May 2022 04:01:11 -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 4821EB81F14; Thu, 26 May 2022 11:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCE33C385A9; Thu, 26 May 2022 11:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653562868; bh=hfcaxSjEVLVQ76sX/0B4km9ev5zJp72a68slPepbwZs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=J9dNX/CYol3rStXoipC4u3m65JQ/CVaYQLLeFR/i3em/BmWPkr6liFYFLsTB73x+2 AsmUaVFFeVz7ZNFGd1fXszmwZSbIzc9eBnFF5fLvfmUuJZGybocBoY+BaFL9uPpQAe ns25g2mHLQUqOlfyBZdCH7cHrwSN6s7nq7bUYiY00XpfTe5OmO3XJtHs0cFXqp6uPc r5iTZmfH515no5UYjI8tMSqvh8GPqn+Rffu8JwrjYtZvB+6eEbR+gl+TST/LgjdAyD /zyoM4tNT5p1h5DYZB/tt2QE43L7JUZZaXXKLXVcdTWOoaCcC4TE7SKVHlz5xygH6h fQZ4MpxI6Bd4w== Date: Thu, 26 May 2022 13:01:02 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Miaoqian Lin Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register Message-ID: <20220526130102.6c532648@dellmb> In-Reply-To: <20220526083748.39816-1-linmq006@gmail.com> References: <20220526083748.39816-1-linmq006@gmail.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Thu, 26 May 2022 12:37:48 +0400 Miaoqian Lin wrote: > of_get_child_by_name() returns a node pointer with refcount > incremented, we should use of_node_put() on it when done. > This function missing of_node_put() in an error path. > Add missing of_node_put() to avoid refcount leak. > > Signed-off-by: Miaoqian Lin > --- > drivers/net/dsa/mv88e6xxx/chip.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > index 5d2c57a7c708..0726df6aeb1f 100644 > --- a/drivers/net/dsa/mv88e6xxx/chip.c > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > @@ -3960,8 +3960,10 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, > */ > child = of_get_child_by_name(np, "mdio"); > err = mv88e6xxx_mdio_register(chip, child, false); > - if (err) > + if (err) { > + of_node_put(child); > return err; > + } > > /* Walk the device tree, and see if there are any other nodes > * which say they are compatible with the external mdio Fix needs Fixes tag so that it can be backported. Please add correct Fixes tag.