[SRU] [Bionic/OEM-A] [PATCH 2/2] net: aquantia: oops when shutdown on already stopped device
Kai-Heng Feng
kai.heng.feng at canonical.com
Wed May 2 04:59:03 UTC 2018
From: Igor Russkikh <igor.russkikh at aquantia.com>
BugLink: https://bugs.launchpad.net/bugs/1767088
In case netdev is closed at the moment of pci shutdown, aq_nic_stop
gets called second time. napi_disable in that case hangs indefinitely.
In other case, if device was never opened at all, we get oops because
of null pointer access.
We should invoke aq_nic_stop conditionally, only if device is running
at the moment of shutdown.
Reported-by: David Arcari <darcari at redhat.com>
Fixes: 90869ddfefeb ("net: aquantia: Implement pci shutdown callback")
Signed-off-by: Igor Russkikh <igor.russkikh at aquantia.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 9a11aff25fd43d5bd2660ababdc9f564b0ba183a)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index c96a92118b8b..32f6d2e24d66 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -951,9 +951,11 @@ void aq_nic_shutdown(struct aq_nic_s *self)
netif_device_detach(self->ndev);
- err = aq_nic_stop(self);
- if (err < 0)
- goto err_exit;
+ if (netif_running(self->ndev)) {
+ err = aq_nic_stop(self);
+ if (err < 0)
+ goto err_exit;
+ }
aq_nic_deinit(self);
err_exit:
--
2.17.0
More information about the kernel-team
mailing list