Commit a7b2c7ffae7c8a48a2064adfea0eecfadc042b08
Committed by
Greg Kroah-Hartman
1 parent
0a57c26d64
cfg80211: avoid mem leak on driver hint set
commit 34f05f543f02350e920bddb7660ffdd4697aaf60 upstream. In the already-set and intersect case of a driver-hint, the previous wiphy regdomain was not freed before being reset with a copy of the cfg80211 regdomain. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Acked-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
net/wireless/reg.c
... | ... | @@ -1760,7 +1760,7 @@ |
1760 | 1760 | reg_process_hint_driver(struct wiphy *wiphy, |
1761 | 1761 | struct regulatory_request *driver_request) |
1762 | 1762 | { |
1763 | - const struct ieee80211_regdomain *regd; | |
1763 | + const struct ieee80211_regdomain *regd, *tmp; | |
1764 | 1764 | enum reg_request_treatment treatment; |
1765 | 1765 | |
1766 | 1766 | treatment = __reg_process_hint_driver(driver_request); |
1767 | 1767 | |
... | ... | @@ -1780,7 +1780,10 @@ |
1780 | 1780 | reg_free_request(driver_request); |
1781 | 1781 | return REG_REQ_IGNORE; |
1782 | 1782 | } |
1783 | + | |
1784 | + tmp = get_wiphy_regdom(wiphy); | |
1783 | 1785 | rcu_assign_pointer(wiphy->regd, regd); |
1786 | + rcu_free_regdom(tmp); | |
1784 | 1787 | } |
1785 | 1788 | |
1786 | 1789 |