]> Git Repo - linux.git/commitdiff
net/ncsi: Disable the ncsi work before freeing the associated structure
authorEddie James <[email protected]>
Wed, 25 Sep 2024 15:55:23 +0000 (10:55 -0500)
committerPaolo Abeni <[email protected]>
Thu, 3 Oct 2024 08:14:14 +0000 (10:14 +0200)
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 <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
net/ncsi/ncsi-manage.c

index 5ecf611c882009d647909e52a686286e090ba6c3..5cf55bde366d1813865ac5da17d232b5eadb2a3e 100644 (file)
@@ -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);
This page took 0.05618 seconds and 4 git commands to generate.