The work function can run after the ncsi device is freed, resulting in use-after-free bugs or kernel panic.
Unified · Split
| @@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd) · 1953 unmodified lines | ||
| 1954 | 1954 | list_del_rcu(&ndp->node); |
| 1955 | 1955 | spin_unlock_irqrestore(&ncsi_dev_lock, flags); |
| 1956 | 1956 | |
| 1957 | + disable_work_sync(&ndp->work); | |
| 1958 | + | |
| 1957 | 1959 | kfree(ndp); |
| 1958 | 1960 | } |
| 1959 | 1961 | EXPORT_SYMBOL_GPL(ncsi_unregister_dev); |