All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: check master device before put
@ 2017-10-23 18:01 Vivien Didelot
  2017-10-23 18:49 ` Florian Fainelli
  2017-10-24  9:43 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Vivien Didelot @ 2017-10-23 18:01 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

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>
---
 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;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: dsa: check master device before put
  2017-10-23 18:01 [PATCH net-next] net: dsa: check master device before put Vivien Didelot
@ 2017-10-23 18:49 ` Florian Fainelli
  2017-10-23 18:58   ` Vivien Didelot
  2017-10-24  9:43 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2017-10-23 18:49 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: dsa: check master device before put
  2017-10-23 18:49 ` Florian Fainelli
@ 2017-10-23 18:58   ` Vivien Didelot
  0 siblings, 0 replies; 4+ messages in thread
From: Vivien Didelot @ 2017-10-23 18:58 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, netdev
  Cc: linux-kernel, kernel, Andrew Lunn

Hi Florian, David,

Florian Fainelli <f.fainelli@gmail.com> writes:

> 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?

I wasn't sure if it was a good candidate for it.

If it is, David can you apply this patch on both trees or do you prefer
me to send a copy to -net?


Thanks,

        Vivien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: dsa: check master device before put
  2017-10-23 18:01 [PATCH net-next] net: dsa: check master device before put Vivien Didelot
  2017-10-23 18:49 ` Florian Fainelli
@ 2017-10-24  9:43 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-10-24  9:43 UTC (permalink / raw)
  To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, f.fainelli, andrew

From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Mon, 23 Oct 2017 14:01:41 -0400

> 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>

Please submit a 'net' version of this patch and then please patiently
wait for it to be properly merged and propagated into 'net-next'.

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-24  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-23 18:01 [PATCH net-next] net: dsa: check master device before put Vivien Didelot
2017-10-23 18:49 ` Florian Fainelli
2017-10-23 18:58   ` Vivien Didelot
2017-10-24  9:43 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.