diff options
author | Timur Tabi <timur@codeaurora.org> | 2017-07-13 22:45:41 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-14 17:55:32 +0200 |
commit | c98b0537f0d962b46c62c27b6c2d783257f7400f (patch) | |
tree | 3c5848d0ddded930eb02991aeec1d21b08b5d31b /drivers/net/ethernet/qualcomm/emac | |
parent | smsc95xx: use ethtool_op_get_ts_info() (diff) | |
download | linux-c98b0537f0d962b46c62c27b6c2d783257f7400f.tar.xz linux-c98b0537f0d962b46c62c27b6c2d783257f7400f.zip |
net: qcom/emac: fix double free of SGMII IRQ during shutdown
If the interface is not up, then don't try to close it during a
shutdown. This avoids possible double free of the IRQ, which
can happen during a shutdown.
Fixes: 03eb3eb4d4d5 ("net: qcom/emac: add shutdown function")
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac')
-rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 746d94e28470..60850bfa3d32 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -766,11 +766,13 @@ static void emac_shutdown(struct platform_device *pdev) struct emac_adapter *adpt = netdev_priv(netdev); struct emac_sgmii *sgmii = &adpt->phy; - /* Closing the SGMII turns off its interrupts */ - sgmii->close(adpt); + if (netdev->flags & IFF_UP) { + /* Closing the SGMII turns off its interrupts */ + sgmii->close(adpt); - /* Resetting the MAC turns off all DMA and its interrupts */ - emac_mac_reset(adpt); + /* Resetting the MAC turns off all DMA and its interrupts */ + emac_mac_reset(adpt); + } } static struct platform_driver emac_platform_driver = { |