wcn36xx: Fix firmware crash due to corrupted buffer address
authorLoic Poulain <loic.poulain@linaro.org>
Tue, 27 Mar 2018 08:26:57 +0000 (11:26 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Mar 2018 08:57:19 +0000 (11:57 +0300)
commite5f9908155c96d945b6d1053701b6168c4e8decc
tree8db4be4b6eb3c1940ef73d71045669d1f218ddf5
parentee35eecb08220978f68a6987f71c5132f40d4a10
wcn36xx: Fix firmware crash due to corrupted buffer address

wcn36xx_start_tx function retrieves the buffer descriptor from the
channel control queue to start filling tx buffer information. However,
nothing prevents this same buffer to be concurrently accessed in a
concurent tx call, leading to potential buffer coruption and firmware
crash (observed during iperf test). The channel control queue should
only be accessed and updated with the channel lock.

Fix this issue by using a local buffer descriptor which will be copied
in the thread-safe wcn36xx_dxe_tx_frame.

Note that buffer descriptor size is few bytes so the introduced copy
overhead is insignificant. Moreover, this allows to keep the locked
section minimal.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Ramon Fried <rfried@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wcn36xx/dxe.c
drivers/net/wireless/ath/wcn36xx/dxe.h
drivers/net/wireless/ath/wcn36xx/txrx.c