summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2024-09-25 10:55:23 -0500
committerPaolo Abeni <pabeni@redhat.com>2024-10-03 10:14:14 +0200
commita0ffa68c70b367358b2672cdab6fa5bc4c40de2c (patch)
tree7cc6b34de767b847bead2f5514b7ecc21d02b824 /net
parentfa7dfeae041c91e425db9fbb95fb3f57b821c386 (diff)
downloadlinux-stable-a0ffa68c70b367358b2672cdab6fa5bc4c40de2c.tar.gz
linux-stable-a0ffa68c70b367358b2672cdab6fa5bc4c40de2c.tar.bz2
linux-stable-a0ffa68c70b367358b2672cdab6fa5bc4c40de2c.zip
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@linux.ibm.com> Link: https://patch.msgid.link/20240925155523.1017097-1-eajames@linux.ibm.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/ncsi/ncsi-manage.c2
1 files changed, 2 insertions, 0 deletions
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);