Skip to content

Commit 06fcf12

Browse files
jhovoldgregkh
authored andcommitted
wifi: ath12k: fix source ring-buffer corruption
commit e834da4 upstream. Add the missing memory barrier to make sure that LMAC source ring descriptors are written before updating the head pointer to avoid passing stale data to the firmware on weakly ordered architectures like aarch64. Note that non-LMAC rings use MMIO write accessors which have the required write memory barrier. Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: d889913 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Cc: stable@vger.kernel.org # 6.3 Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com> Link: https://patch.msgid.link/20250617084402.14475-4-johan+linaro@kernel.org Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c2e3873 commit 06fcf12

File tree

1 file changed

+9
-1
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+9
-1
lines changed

drivers/net/wireless/ath/ath12k/hal.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,11 @@ void ath12k_hal_srng_access_end(struct ath12k_base *ab, struct hal_srng *srng)
21782178
if (srng->ring_dir == HAL_SRNG_DIR_SRC) {
21792179
srng->u.src_ring.last_tp =
21802180
*(volatile u32 *)srng->u.src_ring.tp_addr;
2181-
*srng->u.src_ring.hp_addr = srng->u.src_ring.hp;
2181+
/* Make sure descriptor is written before updating the
2182+
* head pointer.
2183+
*/
2184+
dma_wmb();
2185+
WRITE_ONCE(*srng->u.src_ring.hp_addr, srng->u.src_ring.hp);
21822186
} else {
21832187
srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr;
21842188
*srng->u.dst_ring.tp_addr = srng->u.dst_ring.tp;
@@ -2187,6 +2191,10 @@ void ath12k_hal_srng_access_end(struct ath12k_base *ab, struct hal_srng *srng)
21872191
if (srng->ring_dir == HAL_SRNG_DIR_SRC) {
21882192
srng->u.src_ring.last_tp =
21892193
*(volatile u32 *)srng->u.src_ring.tp_addr;
2194+
/* Assume implementation use an MMIO write accessor
2195+
* which has the required wmb() so that the descriptor
2196+
* is written before the updating the head pointer.
2197+
*/
21902198
ath12k_hif_write32(ab,
21912199
(unsigned long)srng->u.src_ring.hp_addr -
21922200
(unsigned long)ab->mem,

0 commit comments

Comments
 (0)