OSDN Git Service

wcn36xx: add proper DMA memory barriers in rx path
authorBenjamin Li <benl@squareup.com>
Sat, 23 Oct 2021 00:15:28 +0000 (17:15 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 27 Oct 2021 07:44:16 +0000 (10:44 +0300)
commit9bfe38e064af5decba2ffce66a2958ab8b10eaa4
tree24a4d52bbfeb32476ff5e581c07c5529d7efd2b3
parent960ae77f25631bbe4e3aafefe209b52e044baf31
wcn36xx: add proper DMA memory barriers in rx path

This is essentially exactly following the dma_wmb()/dma_rmb() usage
instructions in Documentation/memory-barriers.txt.

The theoretical races here are:

1. DXE (the DMA Transfer Engine in the Wi-Fi subsystem) seeing the
dxe->ctrl & WCN36xx_DXE_CTRL_VLD write before the dxe->dst_addr_l
write, thus performing DMA into the wrong address.

2. CPU reading dxe->dst_addr_l before DXE unsets dxe->ctrl &
WCN36xx_DXE_CTRL_VLD. This should generally be harmless since DXE
doesn't write dxe->dst_addr_l (no risk of freeing the wrong skb).

Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Benjamin Li <benl@squareup.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211023001528.3077822-1-benl@squareup.com
drivers/net/wireless/ath/wcn36xx/dxe.c