Skip to content

Commit 64e4c45

Browse files
jmberg-intelgregkh
authored andcommitted
wifi: cfg80211: clear wdev->cqm_config pointer on free
commit d5fee26 upstream. When we free wdev->cqm_config when unregistering, we also need to clear out the pointer since the same wdev/netdev may get re-registered in another network namespace, then destroyed later, running this code again, which results in a double-free. Reported-by: [email protected] Fixes: 37c20b2 ("wifi: cfg80211: fix cqm_config access race") Cc: [email protected] Link: https://patch.msgid.link/20241022161742.7c34b2037726.I121b9cdb7eb180802eafc90b493522950d57ee18@changeid Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2f6f1e2 commit 64e4c45

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/wireless/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
12361236
/* deleted from the list, so can't be found from nl80211 any more */
12371237
cqm_config = rcu_access_pointer(wdev->cqm_config);
12381238
kfree_rcu(cqm_config, rcu_head);
1239+
RCU_INIT_POINTER(wdev->cqm_config, NULL);
12391240

12401241
/*
12411242
* Ensure that all events have been processed and

0 commit comments

Comments
 (0)