Messages in this thread Patch in this message | | | From | Vitaly Bordug <> | Subject | [PATCH 3/3] FS_ENET: phydev pointer may be dereferenced without NULL check | Date | Wed, 21 Jun 2006 20:10:04 +0400 |
| |
When interface is down, phy is "disconnected" from the bus and phydev is NULL. But ethtool may try to get/set phy regs even at that time, which results in NULL pointer dereference and OOPS hereby.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com> ---
drivers/net/fs_enet/fs_enet-main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 302ecaa..e475e22 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -882,12 +882,16 @@ static void fs_get_regs(struct net_devic static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); + if (!fep->phydev) + return -EINVAL; return phy_ethtool_gset(fep->phydev, cmd); } static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); + if (!fep->phydev) + return -EINVAL; phy_ethtool_sset(fep->phydev, cmd); return 0; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |