mac80211: prevent possible crypto tx tailroom corruption
authorMichal Kazior <michal.kazior@tieto.com>
Fri, 22 May 2015 08:22:40 +0000 (10:22 +0200)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:09:28 +0000 (13:09 +0000)
commit802639fb788d09c523bffef4b808aaeb48b03292
treed5a6315262adbd3e39f7d08545dae52cc7dcb71e
parente818f6a6785eef9fd666dd92ef74393b3f6229e8
mac80211: prevent possible crypto tx tailroom corruption

commit ab499db80fcf07c18e4053f91a619500f663e90e upstream.

There was a possible race between
ieee80211_reconfig() and
ieee80211_delayed_tailroom_dec(). This could
result in inability to transmit data if driver
crashed during roaming or rekeying and subsequent
skbs with insufficient tailroom appeared.

This race was probably never seen in the wild
because a device driver would have to crash AND
recover within 0.5s which is very unlikely.

I was able to prove this race exists after
changing the delay to 10s locally and crashing
ath10k via debugfs immediately after GTK
rekeying. In case of ath10k the counter went below
0. This was harmless but other drivers which
actually require tailroom (e.g. for WEP ICV or
MMIC) could end up with the counter at 0 instead
of >0 and introduce insufficient skb tailroom
failures because mac80211 would not resize skbs
appropriately anymore.

Fixes: 8d1f7ecd2af5 ("mac80211: defer tailroom counter manipulation when roaming")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mac80211/main.c