]> git.baikalelectronics.ru Git - kernel.git/commit
sh_eth: Fix ethtool operation crash when net device is down
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Fri, 16 Jan 2015 17:51:25 +0000 (17:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Jan 2015 20:37:40 +0000 (15:37 -0500)
commit36695763db7ff9dc1929c1483bd6ec101a79c34c
tree685c3ae92315b1627d99a9b72e6906031f3baba8
parent344aef2a1e2f0e3c5bc39d3fb2e53c70afc07660
sh_eth: Fix ethtool operation crash when net device is down

The driver connects and disconnects the PHY device whenever the
net device is brought up and down.  The ethtool get_settings,
set_settings and nway_reset operations will dereference a null
or dangling pointer if called while it is down.

I think it would be preferable to keep the PHY connected, but there
may be good reasons not to.

As an immediate fix for this bug:
- Set the phydev pointer to NULL after disconnecting the PHY
- Change those three operations to return -ENODEV while the PHY is
  not connected

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c