Netdev List
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next] net: dsa: check master device before put
Date: Mon, 23 Oct 2017 11:49:08 -0700	[thread overview]
Message-ID: <cda226ca-a1c5-107f-d44f-7b6e93459b51@gmail.com> (raw)
In-Reply-To: <20171023180141.3674-1-vivien.didelot@savoirfairelinux.com>

On 10/23/2017 11:01 AM, Vivien Didelot wrote:
> In the case of pdata, the dsa_cpu_parse function calls dev_put() before
> making sure it isn't NULL. Fix this.
> 
> Fixes: 71e0bbde0d88 ("net: dsa: Add support for platform data")
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Did not you want to target 'net' for that though?

> ---
>  net/dsa/dsa2.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index 9e8b8aab049d..908c06e32520 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -489,14 +489,15 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
>  		if (!ethernet)
>  			return -EINVAL;
>  		ethernet_dev = of_find_net_device_by_node(ethernet);
> +		if (!ethernet_dev)
> +			return -EPROBE_DEFER;
>  	} else {
>  		ethernet_dev = dsa_dev_to_net_device(ds->cd->netdev[index]);
> +		if (!ethernet_dev)
> +			return -EPROBE_DEFER;
>  		dev_put(ethernet_dev);
>  	}
>  
> -	if (!ethernet_dev)
> -		return -EPROBE_DEFER;
> -
>  	if (!dst->cpu_dp) {
>  		dst->cpu_dp = port;
>  		dst->cpu_dp->master = ethernet_dev;
> 


-- 
Florian

  reply	other threads:[~2017-10-23 18:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 18:01 [PATCH net-next] net: dsa: check master device before put Vivien Didelot
2017-10-23 18:49 ` Florian Fainelli [this message]
2017-10-23 18:58   ` Vivien Didelot
2017-10-24  9:43 ` David Miller

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=cda226ca-a1c5-107f-d44f-7b6e93459b51@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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