cfg80211: hold reg_mutex when updating regulatory
The function wiphy_update_regulatory() uses the static variable last_request and thus needs to be called with reg_mutex held. This is the case for all users in reg.c, but the function was exported for use by wiphy_register(), from where it is called without the lock being held. Fix this by making wiphy_update_regulatory() private and introducing regulatory_update() as a wrapper that acquires and holds the lock. Signed-off-by: Sven Neumann <s.neumann@raumfeld.com> Cc: John W. Linville <linville@tuxdriver.com> Cc: Luis R. Rodriguez <mcgrof@gmail.com> Cc: Daniel Mack <daniel@zonque.org> Cc: linux-wireless@vger.kernel.org Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
56e6786e59
commit
eac03e3819
@@ -101,6 +101,9 @@ struct reg_beacon {
|
||||
struct ieee80211_channel chan;
|
||||
};
|
||||
|
||||
static void wiphy_update_regulatory(struct wiphy *wiphy,
|
||||
enum nl80211_reg_initiator initiator);
|
||||
|
||||
static void reg_todo(struct work_struct *work);
|
||||
static DECLARE_WORK(reg_work, reg_todo);
|
||||
|
||||
@@ -1118,11 +1121,13 @@ static void reg_process_ht_flags(struct wiphy *wiphy)
|
||||
|
||||
}
|
||||
|
||||
void wiphy_update_regulatory(struct wiphy *wiphy,
|
||||
enum nl80211_reg_initiator initiator)
|
||||
static void wiphy_update_regulatory(struct wiphy *wiphy,
|
||||
enum nl80211_reg_initiator initiator)
|
||||
{
|
||||
enum ieee80211_band band;
|
||||
|
||||
assert_reg_lock();
|
||||
|
||||
if (ignore_reg_update(wiphy, initiator))
|
||||
return;
|
||||
|
||||
@@ -1137,6 +1142,14 @@ void wiphy_update_regulatory(struct wiphy *wiphy,
|
||||
wiphy->reg_notifier(wiphy, last_request);
|
||||
}
|
||||
|
||||
void regulatory_update(struct wiphy *wiphy,
|
||||
enum nl80211_reg_initiator setby)
|
||||
{
|
||||
mutex_lock(®_mutex);
|
||||
wiphy_update_regulatory(wiphy, setby);
|
||||
mutex_unlock(®_mutex);
|
||||
}
|
||||
|
||||
static void handle_channel_custom(struct wiphy *wiphy,
|
||||
enum ieee80211_band band,
|
||||
unsigned int chan_idx,
|
||||
|
Reference in New Issue
Block a user