Commit a0ffa68c authored by Eddie James's avatar Eddie James Committed by Paolo Abeni

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: 2d283bdd ("net/ncsi: Resource management")
Signed-off-by: default avatarEddie James <eajames@linux.ibm.com>
Link: https://patch.msgid.link/20240925155523.1017097-1-eajames@linux.ibm.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent fa7dfeae
...@@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd) ...@@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
list_del_rcu(&ndp->node); list_del_rcu(&ndp->node);
spin_unlock_irqrestore(&ncsi_dev_lock, flags); spin_unlock_irqrestore(&ncsi_dev_lock, flags);
disable_work_sync(&ndp->work);
kfree(ndp); kfree(ndp);
} }
EXPORT_SYMBOL_GPL(ncsi_unregister_dev); EXPORT_SYMBOL_GPL(ncsi_unregister_dev);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment