Commit 749e3efc authored by Michal Kazior's avatar Michal Kazior Committed by Luis Henriques

mac80211: prevent possible crypto tx tailroom corruption

commit ab499db8 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: 8d1f7ecd ("mac80211: defer tailroom counter manipulation when roaming")
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent ced5ded3
...@@ -248,6 +248,7 @@ static void ieee80211_restart_work(struct work_struct *work) ...@@ -248,6 +248,7 @@ static void ieee80211_restart_work(struct work_struct *work)
{ {
struct ieee80211_local *local = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, restart_work); container_of(work, struct ieee80211_local, restart_work);
struct ieee80211_sub_if_data *sdata;
/* wait for scan work complete */ /* wait for scan work complete */
flush_workqueue(local->workqueue); flush_workqueue(local->workqueue);
...@@ -256,6 +257,8 @@ static void ieee80211_restart_work(struct work_struct *work) ...@@ -256,6 +257,8 @@ static void ieee80211_restart_work(struct work_struct *work)
"%s called with hardware scan in progress\n", __func__); "%s called with hardware scan in progress\n", __func__);
rtnl_lock(); rtnl_lock();
list_for_each_entry(sdata, &local->interfaces, list)
flush_delayed_work(&sdata->dec_tailroom_needed_wk);
ieee80211_scan_cancel(local); ieee80211_scan_cancel(local);
ieee80211_reconfig(local); ieee80211_reconfig(local);
rtnl_unlock(); rtnl_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment