diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-01-08 14:05:55 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-01-12 17:45:33 -0500 |
commit | dfd9a421bed2325059fae04f810769b648fa1302 (patch) | |
tree | b9c5cc3fc2b967625a2272812d0983925f1d5781 /drivers/net | |
parent | 9ea7d6cb9c223e8b0887b8b0355470acb947a1c9 (diff) |
fs_enet: check for phydev existence in the ethtool handlers
Otherwise oops will happen if ethernet device has not been opened:
Unable to handle kernel paging request for data at address 0x0000014c
Faulting instruction address: 0xc016f7f0
Oops: Kernel access of bad area, sig: 11 [#1]
MPC85xx
NIP: c016f7f0 LR: c01722a0 CTR: 00000000
REGS: c79ddc70 TRAP: 0300 Not tainted (2.6.24-rc3-g820a386b)
MSR: 00029000 <EE,ME> CR: 20004428 XER: 20000000
DEAR: 0000014c, ESR: 00000000
TASK = c789f5e0[999] 'snmpd' THREAD: c79dc000
GPR00: c01aceb8 c79ddd20 c789f5e0 00000000 c79ddd3c 00000000 c79ddd64 00000000
GPR08: 00000000 c7845b60 c79dde3c c01ace80 20004422 200249fc 000002a0 100da728
GPR16: 100c0000 00000000 00000000 00000000 20022078 00000009 200220e0 bfc85558
GPR24: c79ddd3c 00000000 00000000 c02e0e70 c022fc64 ffffffff c7845800 bfc85498
NIP [c016f7f0] phy_ethtool_gset+0x0/0x4c
LR [c01722a0] fs_get_settings+0x18/0x28
Call Trace:
[c79ddd20] [c79dde38] 0xc79dde38 (unreliable)
[c79ddd30] [c01aceb8] dev_ethtool+0x294/0x11ec
[c79dde30] [c01aaa44] dev_ioctl+0x454/0x6a8
[c79ddeb0] [c019b9d4] sock_ioctl+0x84/0x230
[c79dded0] [c007ded8] do_ioctl+0x34/0x8c
[c79ddee0] [c007dfbc] vfs_ioctl+0x8c/0x41c
[c79ddf10] [c007e38c] sys_ioctl+0x40/0x74
[c79ddf40] [c000d4c0] ret_from_syscall+0x0/0x3c
Instruction dump:
81630000 800b0030 2f800000 419e0010 7c0803a6 4e800021 7c691b78 80010014
7d234b78 38210010 7c0803a6 4e800020 <8003014c> 7c6b1b78 38600000 90040004
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 3e1a57a42f11..c83bd6560088 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -894,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
894 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 894 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
895 | { | 895 | { |
896 | struct fs_enet_private *fep = netdev_priv(dev); | 896 | struct fs_enet_private *fep = netdev_priv(dev); |
897 | |||
898 | if (!fep->phydev) | ||
899 | return -ENODEV; | ||
900 | |||
897 | return phy_ethtool_gset(fep->phydev, cmd); | 901 | return phy_ethtool_gset(fep->phydev, cmd); |
898 | } | 902 | } |
899 | 903 | ||
900 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 904 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
901 | { | 905 | { |
902 | struct fs_enet_private *fep = netdev_priv(dev); | 906 | struct fs_enet_private *fep = netdev_priv(dev); |
903 | phy_ethtool_sset(fep->phydev, cmd); | 907 | |
904 | return 0; | 908 | if (!fep->phydev) |
909 | return -ENODEV; | ||
910 | |||
911 | return phy_ethtool_sset(fep->phydev, cmd); | ||
905 | } | 912 | } |
906 | 913 | ||
907 | static int fs_nway_reset(struct net_device *dev) | 914 | static int fs_nway_reset(struct net_device *dev) |