Skip to content

Commit

Permalink
cfg80211: Fix memory leak
Browse files Browse the repository at this point in the history
When a driver requests a specific regulatory domain after cfg80211 already
has one, a struct ieee80211_regdomain is leaked.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Larry Finger authored and Johannes Berg committed Feb 11, 2013
1 parent 78f42ae commit b7566fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2189,10 +2189,15 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
* However if a driver requested this specific regulatory
* domain we keep it for its private use
*/
if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER)
if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER) {
const struct ieee80211_regdomain *tmp;

tmp = get_wiphy_regdom(request_wiphy);
rcu_assign_pointer(request_wiphy->regd, rd);
else
rcu_free_regdom(tmp);
} else {
kfree(rd);
}

rd = NULL;

Expand Down

0 comments on commit b7566fc

Please sign in to comment.