]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: fix TKIP races, make API easier to use
authorJohannes Berg <johannes.berg@intel.com>
Thu, 7 Jul 2011 20:28:01 +0000 (22:28 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 8 Jul 2011 15:11:19 +0000 (11:11 -0400)
commit05baba432f56ea1e6b315290628a51d6c224322b
treea11f69f05cdfb457a42b2866e33e73937c35ec1e
parentb8e126b3d1c98ebf3837d61dee63bcd3265f58c2
mac80211: fix TKIP races, make API easier to use

Our current TKIP code races against itself on TX
since we can process multiple packets at the same
time on different ACs, but they all share the TX
context for TKIP. This can lead to bad IVs etc.

Also, the crypto offload helper code just obtains
the P1K/P2K from the cache, and can update it as
well, but there's no guarantee that packets are
really processed in order.

To fix these issues, first introduce a spinlock
that will protect the IV16/IV32 values in the TX
context. This first step makes sure that we don't
assign the same IV multiple times or get confused
in other ways.

Secondly, change the way the P1K cache works. I
add a field "p1k_iv32" that stores the value of
the IV32 when the P1K was last recomputed, and
if different from the last time, then a new P1K
is recomputed. This can cause the P1K computation
to flip back and forth if packets are processed
out of order. All this also happens under the new
spinlock.

Finally, because there are argument differences,
split up the ieee80211_get_tkip_key() API into
ieee80211_get_tkip_p1k() and ieee80211_get_tkip_p2k()
and give them the correct arguments.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/xmit.c
drivers/net/wireless/iwlegacy/iwl-4965-tx.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
include/net/mac80211.h
net/mac80211/key.c
net/mac80211/key.h
net/mac80211/tkip.c
net/mac80211/tkip.h
net/mac80211/wpa.c