Skip to content

Commit 6e179b9

Browse files
committed
wifi: cfg80211: cancel wiphy_work before freeing wiphy
jira LE-3262 cve CVE-2025-21979 Rebuild_History Non-Buildable kernel-5.14.0-570.22.1.el9_6 commit-author Miri Korenblit <[email protected]> commit 72d5204 A wiphy_work can be queued from the moment the wiphy is allocated and initialized (i.e. wiphy_new_nm). When a wiphy_work is queued, the rdev::wiphy_work is getting queued. If wiphy_free is called before the rdev::wiphy_work had a chance to run, the wiphy memory will be freed, and then when it eventally gets to run it'll use invalid memory. Fix this by canceling the work before freeing the wiphy. Fixes: a3ee4dc ("wifi: cfg80211: add a work abstraction with special semantics") Signed-off-by: Miri Korenblit <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Link: https://patch.msgid.link/20250306123626.efd1d19f6e07.I48229f96f4067ef73f5b87302335e2fd750136c9@changeid Signed-off-by: Johannes Berg <[email protected]> (cherry picked from commit 72d5204) Signed-off-by: Jonathan Maple <[email protected]>
1 parent a5e6199 commit 6e179b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net/wireless/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,13 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
11981198
{
11991199
struct cfg80211_internal_bss *scan, *tmp;
12001200
struct cfg80211_beacon_registration *reg, *treg;
1201+
unsigned long flags;
1202+
1203+
spin_lock_irqsave(&rdev->wiphy_work_lock, flags);
1204+
WARN_ON(!list_empty(&rdev->wiphy_work_list));
1205+
spin_unlock_irqrestore(&rdev->wiphy_work_lock, flags);
1206+
cancel_work_sync(&rdev->wiphy_work);
1207+
12011208
rfkill_destroy(rdev->wiphy.rfkill);
12021209
list_for_each_entry_safe(reg, treg, &rdev->beacon_registrations, list) {
12031210
list_del(&reg->list);

0 commit comments

Comments
 (0)