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 7CC611D47B4; Tue, 26 Aug 2025 13:05:06 +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=1756213506; cv=none; b=eqROvMA9d8SVZvWYzXat3Tu3nftQj/VTgnQoDLrJNarJvJO+cVwETIF+1FIOvnTOveYpZGmxyPzNnSIOyOkdiF7wsLtZ0eumCKRh+j813JYXyjyocwED7N6dekjq61Zdpr7a+jjSCLlq6nFm2xCCFiCubfrcdBNIrZ3SOvBYjas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756213506; c=relaxed/simple; bh=NqHHQ/pWD6/i3WVaS5NOKqRuCgII4b4UuuCTj+pAu4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ezheFnWOn3e2AS4Xsbh+VR9XwqalLEw1ps6IKt0RHj04hfhE3mAfPvu/innb6qMpGm/Ij08QEWz/I4YBCknHJxOg8aM1iNXYLy58n4EpsFrZhZw4kZD0kRg35j48HCid1ueNGvUcAedxQyKgbUDtsV4vjfdR2G1reY/dmdi2WZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wibRIE49; 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="wibRIE49" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05710C4CEF1; Tue, 26 Aug 2025 13:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756213506; bh=NqHHQ/pWD6/i3WVaS5NOKqRuCgII4b4UuuCTj+pAu4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wibRIE49BXZIC/BU/RgpPVOOVMokBDe1d5USl4MRPU9Axzn1xE26Dz5/zr2uL17rf sCRd0irsgVfFEkEZacWndbJvRC82xdJYp+S+hCJ0WFAjclKPRE5H6X1hHI42oU6uRL QugKski7f//7KQszHQMZbpSmCH361C56ZGHJTR4k= 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.6 372/587] wifi: ath12k: fix dest ring-buffer corruption when ring is full Date: Tue, 26 Aug 2025 13:08:41 +0200 Message-ID: <20250826111002.369306670@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110952.942403671@linuxfoundation.org> References: <20250826110952.942403671@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.6-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 @@ -1755,7 +1755,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 @@ -1770,7 +1769,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) { @@ -1786,6 +1789,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,