[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240925155523.1017097-1-eajames@linux.ibm.com>
Date: Wed, 25 Sep 2024 10:55:23 -0500
From: Eddie James <eajames@...ux.ibm.com>
To: sam@...dozajonas.com
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, gwshan@...ux.vnet.ibm.com, joel@....id.au,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Eddie James <eajames@...ux.ibm.com>
Subject: [PATCH v2] net/ncsi: Disable the ncsi work before freeing the associated structure
The work function can run after the ncsi device is freed, resulting
in use-after-free bugs or kernel panic.
Fixes: 2d283bdd079c ("net/ncsi: Resource management")
Signed-off-by: Eddie James <eajames@...ux.ibm.com>
---
Changes since v1:
- Use disable_work_sync instead of cancel_work_sync
net/ncsi/ncsi-manage.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 5ecf611c8820..5cf55bde366d 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
list_del_rcu(&ndp->node);
spin_unlock_irqrestore(&ncsi_dev_lock, flags);
+ disable_work_sync(&ndp->work);
+
kfree(ndp);
}
EXPORT_SYMBOL_GPL(ncsi_unregister_dev);
--
2.43.0
Powered by blists - more mailing lists