ath9k: fix tx99 use after free
authorMiaoqing Pan <miaoqing@codeaurora.org>
Tue, 27 Jun 2017 14:31:49 +0000 (17:31 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 28 Jun 2017 16:52:21 +0000 (19:52 +0300)
commitcf8ce1ea61b75712a154c93e40f2a5af2e4dd997
tree89c4109e7934e3078e503e9055ba5f3afd2348fc
parent57c00f2fac512837f8de73474ec1f54020015bae
ath9k: fix tx99 use after free

One scenario that could lead to UAF is two threads writing
simultaneously to the "tx99" debug file. One of them would
set the "start" value to true and follow to ath9k_tx99_init().
Inside the function it would set the sc->tx99_state to true
after allocating sc->tx99skb. Then, the other thread would
execute write_file_tx99() and call ath9k_tx99_deinit().
sc->tx99_state would be freed. After that, the first thread
would continue inside ath9k_tx99_init() and call
r = ath9k_tx99_send(sc, sc->tx99_skb, &txctl);
that would make use of the freed sc->tx99_skb memory.

Cc: <stable@vger.kernel.org>
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath9k/tx99.c