diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-02-21 00:04:25 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:56 -0500 |
commit | 761cf7ecffc4bc079679e65c3b1ab107c1c1fb56 (patch) | |
tree | bd9ff2715f6f191c31368c9efc534fdc68187705 /net/wireless/reg.c | |
parent | bcf4f99b7b1e0971b79e8df40331e77fc1744049 (diff) |
cfg80211: add assert_cfg80211_lock() to ensure proper protection
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 47d505616a4b..e49ac9b2adac 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -276,6 +276,8 @@ static bool alpha2_equal(const char *alpha2_x, const char *alpha2_y) | |||
276 | 276 | ||
277 | static bool regdom_changed(const char *alpha2) | 277 | static bool regdom_changed(const char *alpha2) |
278 | { | 278 | { |
279 | assert_cfg80211_lock(); | ||
280 | |||
279 | if (!cfg80211_regdomain) | 281 | if (!cfg80211_regdomain) |
280 | return true; | 282 | return true; |
281 | if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) | 283 | if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) |
@@ -830,6 +832,8 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
830 | struct ieee80211_supported_band *sband; | 832 | struct ieee80211_supported_band *sband; |
831 | struct ieee80211_channel *chan; | 833 | struct ieee80211_channel *chan; |
832 | 834 | ||
835 | assert_cfg80211_lock(); | ||
836 | |||
833 | sband = wiphy->bands[band]; | 837 | sband = wiphy->bands[band]; |
834 | BUG_ON(chan_idx >= sband->n_channels); | 838 | BUG_ON(chan_idx >= sband->n_channels); |
835 | chan = &sband->channels[chan_idx]; | 839 | chan = &sband->channels[chan_idx]; |
@@ -1042,6 +1046,9 @@ static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd, | |||
1042 | static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | 1046 | static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, |
1043 | const char *alpha2) | 1047 | const char *alpha2) |
1044 | { | 1048 | { |
1049 | |||
1050 | assert_cfg80211_lock(); | ||
1051 | |||
1045 | /* All initial requests are respected */ | 1052 | /* All initial requests are respected */ |
1046 | if (!last_request) | 1053 | if (!last_request) |
1047 | return 0; | 1054 | return 0; |
@@ -1122,6 +1129,8 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | |||
1122 | bool intersect = false; | 1129 | bool intersect = false; |
1123 | int r = 0; | 1130 | int r = 0; |
1124 | 1131 | ||
1132 | assert_cfg80211_lock(); | ||
1133 | |||
1125 | r = ignore_request(wiphy, set_by, alpha2); | 1134 | r = ignore_request(wiphy, set_by, alpha2); |
1126 | 1135 | ||
1127 | if (r == REG_INTERSECT) { | 1136 | if (r == REG_INTERSECT) { |
@@ -1217,6 +1226,8 @@ EXPORT_SYMBOL(regulatory_hint); | |||
1217 | static bool reg_same_country_ie_hint(struct wiphy *wiphy, | 1226 | static bool reg_same_country_ie_hint(struct wiphy *wiphy, |
1218 | u32 country_ie_checksum) | 1227 | u32 country_ie_checksum) |
1219 | { | 1228 | { |
1229 | assert_cfg80211_lock(); | ||
1230 | |||
1220 | if (!last_request->wiphy) | 1231 | if (!last_request->wiphy) |
1221 | return false; | 1232 | return false; |
1222 | if (likely(last_request->wiphy != wiphy)) | 1233 | if (likely(last_request->wiphy != wiphy)) |
@@ -1583,6 +1594,8 @@ int set_regdom(const struct ieee80211_regdomain *rd) | |||
1583 | { | 1594 | { |
1584 | int r; | 1595 | int r; |
1585 | 1596 | ||
1597 | assert_cfg80211_lock(); | ||
1598 | |||
1586 | /* Note that this doesn't update the wiphys, this is done below */ | 1599 | /* Note that this doesn't update the wiphys, this is done below */ |
1587 | r = __set_regdom(rd); | 1600 | r = __set_regdom(rd); |
1588 | if (r) { | 1601 | if (r) { |
@@ -1605,6 +1618,8 @@ int set_regdom(const struct ieee80211_regdomain *rd) | |||
1605 | /* Caller must hold cfg80211_mutex */ | 1618 | /* Caller must hold cfg80211_mutex */ |
1606 | void reg_device_remove(struct wiphy *wiphy) | 1619 | void reg_device_remove(struct wiphy *wiphy) |
1607 | { | 1620 | { |
1621 | assert_cfg80211_lock(); | ||
1622 | |||
1608 | kfree(wiphy->regd); | 1623 | kfree(wiphy->regd); |
1609 | if (!last_request || !last_request->wiphy) | 1624 | if (!last_request || !last_request->wiphy) |
1610 | return; | 1625 | return; |