Skip to content

Commit e5a70cb

Browse files
committed
wifi: cfg80211: cancel wiphy_work before freeing wiphy
JIRA: https://issues.redhat.com/browse/RHEL-79791 CVE: CVE-2025-21979 commit 72d5204 Author: Miri Korenblit <miriam.rachel.korenblit@intel.com> Date: Thu Mar 6 12:37:59 2025 +0200 wifi: cfg80211: cancel wiphy_work before freeing wiphy 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 <miriam.rachel.korenblit@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20250306123626.efd1d19f6e07.I48229f96f4067ef73f5b87302335e2fd750136c9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent 407c01a commit e5a70cb

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
@@ -1194,6 +1194,13 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
11941194
{
11951195
struct cfg80211_internal_bss *scan, *tmp;
11961196
struct cfg80211_beacon_registration *reg, *treg;
1197+
unsigned long flags;
1198+
1199+
spin_lock_irqsave(&rdev->wiphy_work_lock, flags);
1200+
WARN_ON(!list_empty(&rdev->wiphy_work_list));
1201+
spin_unlock_irqrestore(&rdev->wiphy_work_lock, flags);
1202+
cancel_work_sync(&rdev->wiphy_work);
1203+
11971204
rfkill_destroy(rdev->wiphy.rfkill);
11981205
list_for_each_entry_safe(reg, treg, &rdev->beacon_registrations, list) {
11991206
list_del(&reg->list);

0 commit comments

Comments
 (0)