aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2013-02-04 16:33:44 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-11 12:44:41 -0500
commitb7566fc363e23f0efd3fa1e1460f9421cdc0d77e (patch)
tree2a9c044f8771292ef942cdeab9b0636d676140d8
parent78f42aee884dedfd157f79d01f069550edbc95cf (diff)
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>
-rw-r--r--net/wireless/reg.c9
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)
2189 * However if a driver requested this specific regulatory 2189 * However if a driver requested this specific regulatory
2190 * domain we keep it for its private use 2190 * domain we keep it for its private use
2191 */ 2191 */
2192 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER) 2192 if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER) {
2193 const struct ieee80211_regdomain *tmp;
2194
2195 tmp = get_wiphy_regdom(request_wiphy);
2193 rcu_assign_pointer(request_wiphy->regd, rd); 2196 rcu_assign_pointer(request_wiphy->regd, rd);
2194 else 2197 rcu_free_regdom(tmp);
2198 } else {
2195 kfree(rd); 2199 kfree(rd);
2200 }
2196 2201
2197 rd = NULL; 2202 rd = NULL;
2198 2203