wifi: cfg80211: fix potential requested_regd leak

If a custom regdomain is registered by a driver by
calling regulatory_set_wiphy_regd() (the async one)
before the wiphy is registered, and then registration
fails or it's unregistered before the worker ran, we
leak the regdomain. Free it on wiphy free.

Link: https://patch.msgid.link/20261013151817.9c197c4779d4.I983cf65a625fbc99e13b0a2710167157c34b6cd9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2026-10-13 15:18:17 +02:00
parent 7a79160f35
commit a4190accbf

View File

@ -1461,6 +1461,7 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
* can just free it here.
*/
kfree(rcu_dereference_raw(rdev->wiphy.regd));
kfree(rdev->requested_regd);
kfree(rdev);
}