History

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.

Eddie James committed 2 years ago

Commit a0ffa681 parent fa7dfea1 file · +2 −0Browse files

Unified · Split

net/ncsi/ncsi-manage.c+2−0
@@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd) · 1953 unmodified lines
19541954 list_del_rcu(&ndp->node);
19551955 spin_unlock_irqrestore(&ncsi_dev_lock, flags);
19561956
1957+ disable_work_sync(&ndp->work);
1958+
19571959 kfree(ndp);
19581960 }
19591961 EXPORT_SYMBOL_GPL(ncsi_unregister_dev);