diff options
| author | David Rivshin <drivshin@allworx.com> | 2016-04-27 21:32:31 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-26 08:35:10 +0200 |
| commit | 30eee1c68c52a02ec54730bfbe3ba4e3ff3a7d6e (patch) | |
| tree | 6bc71667cbe6e1cfa68c078cd059562c80232423 /lib/list_debug.c | |
| parent | 24328b80de178d4ece8175481349ae33ba3ca65f (diff) | |
drivers: net: cpsw: fix segfault in case of bad phy-handle
commit d733f7542ad47cf73e033c90cf55158587e1d060 upstream.
If an emac node has a phy-handle property that points to something
which is not a phy, then a segmentation fault will occur when the
interface is brought up. This is because while phy_connect() will
return ERR_PTR() on failure, of_phy_connect() will return NULL.
The common error check uses IS_ERR(), and so missed when
of_phy_connect() fails. The NULL pointer is then dereferenced.
Also, the common error message referenced slave->data->phy_id,
which would be empty in the case of phy-handle. Instead, use the
name of the device_node as a useful identifier. And in the phy_id
case add the error code for completeness.
Fixes: 9e42f715264f ("drivers: net: cpsw: add phy-handle parsing")
Signed-off-by: David Rivshin <drivshin@allworx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[SZ Lin (林上智): Tweak the patch to use original print function of dev_info()]
Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/list_debug.c')
0 files changed, 0 insertions, 0 deletions
