lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 14 Jun 2020 12:59:12 -0400
From:   Zekun Shen <>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Zekun Shen <>,
        Jay Cliburn <>,
        Chris Snook <>,
        "David S. Miller" <>,
        Jakub Kicinski <>,,
Subject: [PATCH] net: alx: fix race condition in alx_remove

There is a race condition exist during termination. The path is
alx_stop and then alx_remove. An alx_schedule_link_check could be called
before alx_stop and invoke alx_link_check later. Alx_stop frees the
napis, and alx_remove cancels any pending works. If any of the work is
scheduled before termination and invoked before alx_remove, a
null-ptr-deref occurs because both expect alx->napis[i].

This patch fix the race condition by moving cancel_work_sync functions
before alx_free_napis inside alx_stop.

Signed-off-by: Zekun Shen <>
 drivers/net/ethernet/atheros/alx/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index b9b4edb91..1487d6765 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1249,6 +1249,9 @@ static int __alx_open(struct alx_priv *alx, bool resume)
 static void __alx_stop(struct alx_priv *alx)
+	cancel_work_sync(&alx->link_check_wk);
+	cancel_work_sync(&alx->reset_wk);
@@ -1855,9 +1858,6 @@ static void alx_remove(struct pci_dev *pdev)
 	struct alx_priv *alx = pci_get_drvdata(pdev);
 	struct alx_hw *hw = &alx->hw;
-	cancel_work_sync(&alx->link_check_wk);
-	cancel_work_sync(&alx->reset_wk);
 	/* restore permanent mac address */
 	alx_set_macaddr(hw, hw->perm_addr);

Powered by blists - more mailing lists