iwlwifi: avoid race condition in channel change
authorShanyu Zhao <shanyu.zhao@intel.com>
Wed, 28 Jul 2010 20:40:39 +0000 (13:40 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Aug 2010 20:32:01 +0000 (16:32 -0400)
commitaa2dc6b529d781a375f7ad3185198f6315865b06
tree86941fc4b57927321c2f8f96630aec4574b1212d
parent81e95430aaa898799421617c2db2882386bab69a
iwlwifi: avoid race condition in channel change

When iwl_mac_config() is called by mac80211, the channel pointer
hw->conf->channel can potentially change, resulting in mismatch
band and channel number when configuring RXON command. To avoid
this situation, save the channel pointer in local variables
and validate the channel before using it. Note that priv->mutex
is locked during the whole function so the local variables are safe.

Same change is applied to iwl_mac_channel_switch() since basically
it copies code from iwl_mac_config().

Also removed an outdated comment in the flow.

Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c