netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Net: DSA: Fix checking for get_phy_flags function
@ 2014-10-19  0:13 Andrew Lunn
  2014-10-19  3:08 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lunn @ 2014-10-19  0:13 UTC (permalink / raw)
  To: davem; +Cc: f.fainelli, netdev, Andrew Lunn

The check for the presence or not of the optional switch function
get_phy_flags() called the function, rather than checking to see if it
is a NULL pointer. This causes a derefernce of a NULL pointer on all
switch chips except the sf2, the only switch to implement this call.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 6819563e646a "net: dsa: allow switch drivers to ...
Cc: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 9d3b12b4e03c..fbcba4bc4e08 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -596,7 +596,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 	netif_carrier_off(slave_dev);
 
 	if (p->phy != NULL) {
-		if (ds->drv->get_phy_flags(ds, port))
+		if (ds->drv->get_phy_flags)
 			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
 
 		phy_attach(slave_dev, dev_name(&p->phy->dev),
-- 
2.1.1

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

* Re: [PATCH] Net: DSA: Fix checking for get_phy_flags function
  2014-10-19  0:13 [PATCH] Net: DSA: Fix checking for get_phy_flags function Andrew Lunn
@ 2014-10-19  3:08 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2014-10-19  3:08 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: David Miller, netdev

2014-10-18 17:13 GMT-07:00 Andrew Lunn <andrew@lunn.ch>:
> The check for the presence or not of the optional switch function
> get_phy_flags() called the function, rather than checking to see if it
> is a NULL pointer. This causes a derefernce of a NULL pointer on all
> switch chips except the sf2, the only switch to implement this call.

Sorry about this one, good catch.

>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Fixes: 6819563e646a "net: dsa=: allow switch drivers to ...

Could you resubmit without stripping the "Fixes" subject?

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

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

> ---
>  net/dsa/slave.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 9d3b12b4e03c..fbcba4bc4e08 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -596,7 +596,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>         netif_carrier_off(slave_dev);
>
>         if (p->phy != NULL) {
> -               if (ds->drv->get_phy_flags(ds, port))
> +               if (ds->drv->get_phy_flags)
>                         p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
>
>                 phy_attach(slave_dev, dev_name(&p->phy->dev),
> --
> 2.1.1
>



-- 
Florian

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

end of thread, other threads:[~2014-10-19  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-19  0:13 [PATCH] Net: DSA: Fix checking for get_phy_flags function Andrew Lunn
2014-10-19  3:08 ` Florian Fainelli

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