* [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
@ 2019-02-06 15:35 Dan Carpenter
2019-02-06 17:42 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-02-06 15:35 UTC (permalink / raw)
To: Andrew Lunn
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
kernel-janitors
This function can't succeed if dp->pl is NULL. It will Oops inside the
call to return phylink_ethtool_get_eee(dp->pl, e);
Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/dsa/slave.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 91de3a663226..9384f95e04d5 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -639,7 +639,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
int ret;
/* Port's PHY and MAC both need to be EEE capable */
- if (!dev->phydev && !dp->pl)
+ if (!dev->phydev || !dp->pl)
return -ENODEV;
if (!ds->ops->set_mac_eee)
@@ -659,7 +659,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
int ret;
/* Port's PHY and MAC both need to be EEE capable */
- if (!dev->phydev && !dp->pl)
+ if (!dev->phydev || !dp->pl)
return -ENODEV;
if (!ds->ops->get_mac_eee)
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
2019-02-06 15:35 [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee() Dan Carpenter
@ 2019-02-06 17:42 ` Florian Fainelli
2019-02-06 17:48 ` Vivien Didelot
2019-02-06 22:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2019-02-06 17:42 UTC (permalink / raw)
To: Dan Carpenter, Andrew Lunn
Cc: Vivien Didelot, David S. Miller, netdev, kernel-janitors
On 2/6/19 7:35 AM, Dan Carpenter wrote:
> This function can't succeed if dp->pl is NULL. It will Oops inside the
> call to return phylink_ethtool_get_eee(dp->pl, e);
>
> Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
thanks Dan!
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
2019-02-06 15:35 [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee() Dan Carpenter
2019-02-06 17:42 ` Florian Fainelli
@ 2019-02-06 17:48 ` Vivien Didelot
2019-02-06 22:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Vivien Didelot @ 2019-02-06 17:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Lunn, Florian Fainelli, David S. Miller, netdev, kernel-janitors
On Wed, 6 Feb 2019 18:35:15 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This function can't succeed if dp->pl is NULL. It will Oops inside the
> call to return phylink_ethtool_get_eee(dp->pl, e);
>
> Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
2019-02-06 15:35 [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee() Dan Carpenter
2019-02-06 17:42 ` Florian Fainelli
2019-02-06 17:48 ` Vivien Didelot
@ 2019-02-06 22:03 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-06 22:03 UTC (permalink / raw)
To: dan.carpenter; +Cc: andrew, vivien.didelot, f.fainelli, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 6 Feb 2019 18:35:15 +0300
> This function can't succeed if dp->pl is NULL. It will Oops inside the
> call to return phylink_ethtool_get_eee(dp->pl, e);
>
> Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-06 22:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 15:35 [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee() Dan Carpenter
2019-02-06 17:42 ` Florian Fainelli
2019-02-06 17:48 ` Vivien Didelot
2019-02-06 22:03 ` David Miller
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).