Skip to content
Commit d733f754 authored by David Rivshin's avatar David Rivshin Committed by David S. Miller
Browse files

drivers: net: cpsw: fix segfault in case of bad phy-handle

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: 9e42f715

 ("drivers: net: cpsw: add phy-handle parsing")
Signed-off-by: default avatarDavid Rivshin <drivshin@allworx.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 552165bc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment