mirror of https://github.com/hak5/openwrt-owl.git
generic: mvswitch: add detach callback
Use the detach callback to disable packet mangling to avoid possible NULL pointer dereference. Compile tested only. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35512owl
parent
4be8c22e74
commit
c130a3feac
|
@ -348,16 +348,26 @@ mvswitch_config_aneg(struct phy_device *phydev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mvswitch_remove(struct phy_device *pdev)
|
mvswitch_detach(struct phy_device *pdev)
|
||||||
{
|
{
|
||||||
struct mvswitch_priv *priv = to_mvsw(pdev);
|
struct mvswitch_priv *priv = to_mvsw(pdev);
|
||||||
struct net_device *dev = pdev->attached_dev;
|
struct net_device *dev = pdev->attached_dev;
|
||||||
|
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
dev->phy_ptr = NULL;
|
dev->phy_ptr = NULL;
|
||||||
dev->eth_mangle_rx = NULL;
|
dev->eth_mangle_rx = NULL;
|
||||||
dev->eth_mangle_tx = NULL;
|
dev->eth_mangle_tx = NULL;
|
||||||
dev->features = priv->orig_features;
|
dev->features = priv->orig_features;
|
||||||
dev->priv_flags &= ~IFF_NO_IP_ALIGN;
|
dev->priv_flags &= ~IFF_NO_IP_ALIGN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mvswitch_remove(struct phy_device *pdev)
|
||||||
|
{
|
||||||
|
struct mvswitch_priv *priv = to_mvsw(pdev);
|
||||||
|
|
||||||
kfree(priv);
|
kfree(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +409,7 @@ static struct phy_driver mvswitch_driver = {
|
||||||
.features = PHY_BASIC_FEATURES,
|
.features = PHY_BASIC_FEATURES,
|
||||||
.probe = &mvswitch_probe,
|
.probe = &mvswitch_probe,
|
||||||
.remove = &mvswitch_remove,
|
.remove = &mvswitch_remove,
|
||||||
|
.detach = &mvswitch_detach,
|
||||||
.config_init = &mvswitch_config_init,
|
.config_init = &mvswitch_config_init,
|
||||||
.config_aneg = &mvswitch_config_aneg,
|
.config_aneg = &mvswitch_config_aneg,
|
||||||
.read_status = &mvswitch_read_status,
|
.read_status = &mvswitch_read_status,
|
||||||
|
|
Loading…
Reference in New Issue