Changeset 35512


Ignore:
Timestamp:
2013-02-07T16:18:34+01:00 (5 years ago)
Author:
juhosg
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/mvswitch.c

    r31637 r35512  
    349349 
    350350static void 
    351 mvswitch_remove(struct phy_device *pdev) 
     351mvswitch_detach(struct phy_device *pdev) 
    352352{ 
    353353        struct mvswitch_priv *priv = to_mvsw(pdev); 
    354354        struct net_device *dev = pdev->attached_dev; 
     355 
     356        if (!dev) 
     357                return; 
    355358 
    356359        dev->phy_ptr = NULL; 
     
    359362        dev->features = priv->orig_features; 
    360363        dev->priv_flags &= ~IFF_NO_IP_ALIGN; 
     364} 
     365 
     366static void 
     367mvswitch_remove(struct phy_device *pdev) 
     368{ 
     369        struct mvswitch_priv *priv = to_mvsw(pdev); 
     370 
    361371        kfree(priv); 
    362372} 
     
    400410        .probe          = &mvswitch_probe, 
    401411        .remove         = &mvswitch_remove, 
     412        .detach         = &mvswitch_detach, 
    402413        .config_init    = &mvswitch_config_init, 
    403414        .config_aneg    = &mvswitch_config_aneg, 
Note: See TracChangeset for help on using the changeset viewer.