diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2013-02-04 15:33:44 -0600 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-02-11 18:44:41 +0100 |
commit | b7566fc363e23f0efd3fa1e1460f9421cdc0d77e (patch) | |
tree | 2a9c044f8771292ef942cdeab9b0636d676140d8 /net/wireless | |
parent | 78f42aee884dedfd157f79d01f069550edbc95cf (diff) | |
download | blackbird-op-linux-b7566fc363e23f0efd3fa1e1460f9421cdc0d77e.tar.gz blackbird-op-linux-b7566fc363e23f0efd3fa1e1460f9421cdc0d77e.zip |
cfg80211: Fix memory leak
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>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/reg.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 6ea626b30a2a..08d3da2c70ab 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -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; |