netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liang He" <windhl@126.com>
To: "Vladimir Oltean" <olteanv@gmail.com>
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com,
	netdev@vger.kernel.org
Subject: Re:Re: [PATCH] net: dsa: microchip: ksz_common: Fix refcount leak bug
Date: Thu, 14 Jul 2022 23:18:53 +0800 (CST)	[thread overview]
Message-ID: <771aac42.76b6.181fd4a97fc.Coremail.windhl@126.com> (raw)
In-Reply-To: <20220714145956.pnq5yulgete4xc2g@skbuf>









At 2022-07-14 22:59:56, "Vladimir Oltean" <olteanv@gmail.com> wrote:
>On Wed, Jul 13, 2022 at 07:54:28PM +0800, Liang He wrote:
>> In ksz_switch_register(), we should call of_node_put() for the
>> reference returned by of_get_child_by_name() which has increased
>> the refcount.
>> 
>> Fixes: 44e53c88828f ("net: dsa: microchip: support for "ethernet-ports" node")
>
>I disagree with the git blame resolution, it should be:
>
>Fixes: 912aae27c6af ("net: dsa: microchip: really look for phy-mode in port nodes")
>
>Please resend with that line changed.

>
Thanks, 


I will resend with correct fix tag soon!


Liang

>> Signed-off-by: Liang He <windhl@126.com>
>> ---
>>  
>>  drivers/net/dsa/microchip/ksz_common.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
>> index 9ca8c8d7740f..92a500e1ccd2 100644
>> --- a/drivers/net/dsa/microchip/ksz_common.c
>> +++ b/drivers/net/dsa/microchip/ksz_common.c
>> @@ -1038,18 +1038,21 @@ int ksz_switch_register(struct ksz_device *dev,
>>  		ports = of_get_child_by_name(dev->dev->of_node, "ethernet-ports");
>>  		if (!ports)
>>  			ports = of_get_child_by_name(dev->dev->of_node, "ports");
>> -		if (ports)
>> +		if (ports) {
>>  			for_each_available_child_of_node(ports, port) {
>>  				if (of_property_read_u32(port, "reg",
>>  							 &port_num))
>>  					continue;
>>  				if (!(dev->port_mask & BIT(port_num))) {
>>  					of_node_put(port);
>> +					of_node_put(ports);
>>  					return -EINVAL;
>>  				}
>>  				of_get_phy_mode(port,
>>  						&dev->ports[port_num].interface);
>>  			}
>> +			of_node_put(ports);
>> +		}
>>  		dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
>>  							 "microchip,synclko-125");
>>  		dev->synclko_disable = of_property_read_bool(dev->dev->of_node,
>> -- 
>> 2.25.1
>> 

      reply	other threads:[~2022-07-14 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 11:54 [PATCH] net: dsa: microchip: ksz_common: Fix refcount leak bug Liang He
2022-07-14 14:59 ` Vladimir Oltean
2022-07-14 15:18   ` Liang He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=771aac42.76b6.181fd4a97fc.Coremail.windhl@126.com \
    --to=windhl@126.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).