* [PATCH] [for 4.13] net: qcom/emac: fix double free of SGMII IRQ during shutdown
@ 2017-07-13 20:45 Timur Tabi
2017-07-14 15:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2017-07-13 20:45 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: timur
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>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 746d94e..60850bf 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 = {
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [for 4.13] net: qcom/emac: fix double free of SGMII IRQ during shutdown
2017-07-13 20:45 [PATCH] [for 4.13] net: qcom/emac: fix double free of SGMII IRQ during shutdown Timur Tabi
@ 2017-07-14 15:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-14 15:55 UTC (permalink / raw)
To: timur; +Cc: netdev
From: Timur Tabi <timur@codeaurora.org>
Date: Thu, 13 Jul 2017 15:45:41 -0500
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-14 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 20:45 [PATCH] [for 4.13] net: qcom/emac: fix double free of SGMII IRQ during shutdown Timur Tabi
2017-07-14 15:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).