cfg80211: Fix memory leak
Subsystems (3)
PATCH 1/1 cfg80211: Fix memory leak
From: Johannes Berg <[email protected]>
When a driver requests a specific regulatory domain after cfg80211 already has one, a struct ieee80211_regdomain is leaked.
---
Johannes,
I added a From: for you as the content of this patch is yours.
Larry
---
net/wireless/reg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/wireless/reg.c +6 -2
@@ -2189,10 +2189,14 @@ 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 = +get_wiphy_regdom (request_wiphy);rcu_assign_pointer (request_wiphy->regd, rd); -else +rcu_free_regdom (tmp); + }else {kfree (rd); + } rd =NULL ;
Signature · 1 line
1.8.1
A message that is not in the archive (sent off-list or not yet received): 1360013624-4973-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org
Quoted 4 lines · Larry Finger
From: Johannes Berg <[email protected]>
When a driver requests a specific regulatory domain after cfg80211 already has one, a struct
ieee80211_regdomainis leaked.
Thanks Larry!
Quoted 3 lines
Johannes,
I added a From: for you as the content of this patch is yours.
I changed it back, it's really your patch, I only suggested a bit of the code :-)
net/wireless/reg.c static int __set_regdom(const struct ieee80211_regdomain *rd) · line 2196
Quoted 13 lines
net/wireless/reg.c +4
-2@@ -2189,10 +2189,14 @@ 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 = +get_wiphy_regdom (request_wiphy);rcu_assign_pointer (request_wiphy->regd, rd); -else +rcu_free_regdom (tmp);
Luis, when you get back can you please audit the other places? I'm not convinced that there aren't more places that need to free the regdom, but I don't really want to dig into the code right now.
johannes