android_kernel_google_msm/net/mac80211
Emmanuel Grumbach 7b70d4f31c mac80211: fix AP powersave TX vs. wakeup race
There is a race between the TX path and the STA wakeup: while
a station is sleeping, mac80211 buffers frames until it wakes
up, then the frames are transmitted. However, the RX and TX
path are concurrent, so the packet indicating wakeup can be
processed while a packet is being transmitted.

This can lead to a situation where the buffered frames list
is emptied on the one side, while a frame is being added on
the other side, as the station is still seen as sleeping in
the TX path.

As a result, the newly added frame will not be send anytime
soon. It might be sent much later (and out of order) when the
station goes to sleep and wakes up the next time.

Additionally, it can lead to the crash below.

Fix all this by synchronising both paths with a new lock.
Both path are not fastpath since they handle PS situations.

In a later patch we'll remove the extra skb queue locks to
reduce locking overhead.

BUG: unable to handle kernel
NULL pointer dereference at 000000b0
IP: [<ff6f1791>] ieee80211_report_used_skb+0x11/0x3e0 [mac80211]
*pde = 00000000
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
EIP: 0060:[<ff6f1791>] EFLAGS: 00210282 CPU: 1
EIP is at ieee80211_report_used_skb+0x11/0x3e0 [mac80211]
EAX: e5900da0 EBX: 00000000 ECX: 00000001 EDX: 00000000
ESI: e41d00c0 EDI: e5900da0 EBP: ebe458e4 ESP: ebe458b0
 DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 8005003b CR2: 000000b0 CR3: 25a78000 CR4: 000407d0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process iperf (pid: 3934, ti=ebe44000 task=e757c0b0 task.ti=ebe44000)
iwlwifi 0000:02:00.0: I iwl_pcie_enqueue_hcmd Sending command LQ_CMD (#4e), seq: 0x0903, 92 bytes at 3[3]:9
Stack:
 e403b32c ebe458c4 00200002 00200286 e403b338 ebe458cc c10960bb e5900da0
 ff76a6ec ebe458d8 00000000 e41d00c0 e5900da0 ebe458f0 ff6f1b75 e403b210
 ebe4598c ff723dc1 00000000 ff76a6ec e597c978 e403b758 00000002 00000002
Call Trace:
 [<ff6f1b75>] ieee80211_free_txskb+0x15/0x20 [mac80211]
 [<ff723dc1>] invoke_tx_handlers+0x1661/0x1780 [mac80211]
 [<ff7248a5>] ieee80211_tx+0x75/0x100 [mac80211]
 [<ff7249bf>] ieee80211_xmit+0x8f/0xc0 [mac80211]
 [<ff72550e>] ieee80211_subif_start_xmit+0x4fe/0xe20 [mac80211]
 [<c149ef70>] dev_hard_start_xmit+0x450/0x950
 [<c14b9aa9>] sch_direct_xmit+0xa9/0x250
 [<c14b9c9b>] __qdisc_run+0x4b/0x150
 [<c149f732>] dev_queue_xmit+0x2c2/0xca0

Cc: stable@vger.kernel.org
Reported-by: Yaara Rozenblum <yaara.rozenblum@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
[reword commit log, use a separate lock]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

CVE-2014-2706

Change-Id: I555e82d71add385f300ecc20af5d5d8b69246c52
(cherry picked from commit 1d147bfa64)
2017-04-04 09:44:43 -06:00
..
aes_ccm.c
aes_ccm.h
aes_cmac.c
aes_cmac.h
agg-rx.c mac80211: fix possible tid_rx->reorder_timer use after free 2012-03-26 15:07:29 -04:00
agg-tx.c
cfg.c cfg80211: Pass TDLS peer's QoS/HT/VHT information during set_station 2013-09-04 12:43:26 -07:00
cfg.h
chan.c mac80211: Don't let regulatory make us deaf 2012-03-13 14:55:53 -04:00
debugfs.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debugfs.h simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debugfs_key.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debugfs_key.h
debugfs_netdev.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debugfs_netdev.h
debugfs_sta.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
debugfs_sta.h
driver-ops.h mac80211: remove tx_sync 2012-03-12 14:19:38 -04:00
driver-trace.c
driver-trace.h mac80211: rename bss_conf timestamp to last_tsf 2012-03-13 14:54:20 -04:00
event.c
ht.c
ibss.c mac80211: fix logic error in ibss channel type check 2012-04-17 14:17:04 -04:00
ieee80211_i.h mac80211: VHT (11ac) association 2013-09-04 12:43:31 -07:00
iface.c mac80211: call ieee80211_mgd_stop() on interface stop 2012-04-24 14:42:42 -04:00
Kconfig
key.c mac80211: clean up asm/unaligned.h inclusion 2012-02-27 14:06:32 -05:00
key.h
led.c
led.h
main.c ieee80211: Rename VHT cap struct 2013-09-04 12:43:32 -07:00
Makefile mac80211: redesign auth/assoc 2012-02-06 14:50:37 -05:00
mesh.c mac80211: use compare_ether_addr on MAC addresses instead of memcmp 2012-03-05 15:38:31 -05:00
mesh.h mac80211: Fix the generation of PREQs in proactive RANN mechanism of HWMP 2012-03-05 15:23:14 -05:00
mesh_hwmp.c mac80211: fix mesh airtime link metric estimating 2012-03-06 15:16:17 -05:00
mesh_pathtbl.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-03-20 21:04:47 -07:00
mesh_plink.c mac80211: Fix potential null pointer dereferencing 2012-03-07 13:51:47 -05:00
michael.c
michael.h
mlme.c ieee80211: Rename VHT cap struct 2013-09-04 12:43:32 -07:00
offchannel.c
pm.c mac80211: use proper sub_if_data on suspend path 2012-02-27 14:06:40 -05:00
rate.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
rate.h mac80211: do not call rate control .tx_status before .rate_init 2012-02-15 13:56:06 -05:00
rc80211_minstrel.c
rc80211_minstrel.h
rc80211_minstrel_debugfs.c
rc80211_minstrel_ht.c mac80211: Don't sample max throughput rate in minstrel_ht 2012-03-15 13:40:33 -04:00
rc80211_minstrel_ht.h
rc80211_minstrel_ht_debugfs.c
rc80211_pid.h
rc80211_pid_algo.c
rc80211_pid_debugfs.c
rx.c mac80211: fix truncated packets in cooked monitor rx 2012-04-17 14:17:04 -04:00
scan.c mac80211: fix oper channel timestamp updation 2012-03-28 14:25:37 -04:00
spectmgmt.c
sta_info.c mac80211: fix AP powersave TX vs. wakeup race 2017-04-04 09:44:43 -06:00
sta_info.h mac80211: fix AP powersave TX vs. wakeup race 2017-04-04 09:44:43 -06:00
status.c mac80211: use compare_ether_addr on MAC addresses instead of memcmp 2012-03-05 15:38:31 -05:00
tkip.c
tkip.h
tx.c mac80211: fix AP powersave TX vs. wakeup race 2017-04-04 09:44:43 -06:00
util.c ieee80211: Rename VHT cap struct 2013-09-04 12:43:32 -07:00
wep.c mac80211: linearize SKBs as needed for crypto 2012-03-13 14:54:17 -04:00
wep.h mac80211: move RX WEP weak IV counting 2012-03-13 14:54:16 -04:00
wme.c
wme.h
work.c mac80211: redesign auth/assoc 2012-02-06 14:50:37 -05:00
wpa.c mac80211: linearize SKBs as needed for crypto 2012-03-13 14:54:17 -04:00
wpa.h mac80211: fix tx->skb NULL pointer dereference 2012-01-16 15:01:16 -05:00