[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728085859.899-12-irusskikh@marvell.com>
Date: Tue, 28 Jul 2020 11:58:59 +0300
From: Igor Russkikh <irusskikh@...vell.com>
To: <netdev@...r.kernel.org>
CC: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Ariel Elior <aelior@...vell.com>,
Michal Kalderon <mkalderon@...vell.com>,
Igor Russkikh <irusskikh@...vell.com>,
"Alexander Lobakin" <alobakin@...vell.com>,
Michal Kalderon <michal.kalderon@...vell.com>
Subject: [PATCH v2 net-next 11/11] qede: make driver reliable on unload after failures
First, we check cdev for null on dev close. That could be a case
if recovery was not successful.
Next, we nullify cdev if something bad happens on recovery, to
not to access freed memory accidentially.
Signed-off-by: Igor Russkikh <irusskikh@...vell.com>
Signed-off-by: Alexander Lobakin <alobakin@...vell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@...vell.com>
---
drivers/net/ethernet/qlogic/qede/qede_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 937d8e69ad39..03b0c943b759 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1244,6 +1244,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
qed_ops->common->slowpath_stop(cdev);
err1:
qed_ops->common->remove(cdev);
+ edev->cdev = NULL;
err0:
return rc;
}
@@ -2474,7 +2475,8 @@ static int qede_close(struct net_device *ndev)
qede_unload(edev, QEDE_UNLOAD_NORMAL, false);
- edev->ops->common->update_drv_state(edev->cdev, false);
+ if (edev->cdev)
+ edev->ops->common->update_drv_state(edev->cdev, false);
return 0;
}
--
2.17.1
Powered by blists - more mailing lists