From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A5901F560B; Tue, 26 Aug 2025 11:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756208307; cv=none; b=GaxL1jmSRrDpJoMCz3KMsiOUTtEgwI4qF6n0OURvSAhluzz6TDqmU38mNRtSWpmilcis3iIbJoIEPai7NmKX8FuMrUzPjnc7e6BZDyq2evpcpM3rtOWZjS3+4EEI+AibuApkEKVjCEqr0uLhE0iounpYfOsKrri0PBnLNK2Hu1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756208307; c=relaxed/simple; bh=dS7UhcuMlzen88NMEKgNHQtzuVkx4lwLNQdbkYSI9RA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FpCylTeYf6Usn3pqPN+LotpUXxJUGtHOqcmskbsPCxI1QHxQtd6jC8vYdDvZBaVi6Yl9+zKDdMsS6ONYGauyJAQ6cK9DQ9roV6tmA8WEav4uPd6Mmz2FtiQZq92MmwHETav/PlfGl1xuDKgmkbFuQDLW8/OUgKDgKwmEgQtzynE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FO1O8oKL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FO1O8oKL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F79BC4CEF1; Tue, 26 Aug 2025 11:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756208307; bh=dS7UhcuMlzen88NMEKgNHQtzuVkx4lwLNQdbkYSI9RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FO1O8oKLbx1T2oDp6upO2/+IUDLUOV+BRbokX5l5c50UvBPZq/U9nLGvNT44N1pAc MCCbA7Bk/O88cRAePrkY6QWgTu6YXZIOnNxApFITJCWMWYm6brycRBBGCGSgXHhu9d 6QIL6uVDiDMKOrMo8YzQ2wIu23YTrC5Leb4Fh5Mo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold , Baochen Qiang , Jeff Johnson Subject: [PATCH 6.12 061/322] wifi: ath12k: fix dest ring-buffer corruption when ring is full Date: Tue, 26 Aug 2025 13:07:56 +0200 Message-ID: <20250826110917.048710703@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110915.169062587@linuxfoundation.org> References: <20250826110915.169062587@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit ed32169be1ccb9b1a295275ba7746dc6bf103e80 upstream. Add the missing memory barriers to make sure that destination ring descriptors are read before updating the tail pointer (and passing ownership to the device) to avoid memory corruption on weakly ordered architectures like aarch64 when the ring is full. Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Cc: stable@vger.kernel.org # 6.3 Signed-off-by: Johan Hovold Reviewed-by: Baochen Qiang Link: https://patch.msgid.link/20250617084402.14475-5-johan+linaro@kernel.org Signed-off-by: Jeff Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath12k/hal.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/ath/ath12k/hal.c +++ b/drivers/net/wireless/ath/ath12k/hal.c @@ -2134,7 +2134,6 @@ void ath12k_hal_srng_access_end(struct a { lockdep_assert_held(&srng->lock); - /* TODO: See if we need a write memory barrier here */ if (srng->flags & HAL_SRNG_FLAGS_LMAC_RING) { /* For LMAC rings, ring pointer updates are done through FW and * hence written to a shared memory location that is read by FW @@ -2149,7 +2148,11 @@ void ath12k_hal_srng_access_end(struct a WRITE_ONCE(*srng->u.src_ring.hp_addr, srng->u.src_ring.hp); } else { srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr; - *srng->u.dst_ring.tp_addr = srng->u.dst_ring.tp; + /* Make sure descriptor is read before updating the + * tail pointer. + */ + dma_mb(); + WRITE_ONCE(*srng->u.dst_ring.tp_addr, srng->u.dst_ring.tp); } } else { if (srng->ring_dir == HAL_SRNG_DIR_SRC) { @@ -2165,6 +2168,10 @@ void ath12k_hal_srng_access_end(struct a srng->u.src_ring.hp); } else { srng->u.dst_ring.last_hp = *srng->u.dst_ring.hp_addr; + /* Make sure descriptor is read before updating the + * tail pointer. + */ + mb(); ath12k_hif_write32(ab, (unsigned long)srng->u.dst_ring.tp_addr - (unsigned long)ab->mem,