From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03012C3601B for ; Thu, 3 Apr 2025 19:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RMGbq5yPCMkuCsYrEK7jSsKz9T5viol6VLVNAJr0ONQ=; b=y+wF7n2DKUzVIInO0R4+2ZzbC1 vLN3YvFG/MzV3Fubjo2MwvtzOQadFjEt/5rYKUfvxCnfsFHGdkTYQjg8of2TH2ExWMxHAAyvWx8Xz vw34RX3Yy+BMEIKdy7jf8KQ8/UshN5T+8LR1n0d8neo10HhCh7inAxA83jMAGnnAzrPSufFVBbOxK bwlJNSdz+NfBoKShzdwK6rhv6ljTjxNU9g+0/+dgY9SiijPMK1LJOtzI0vyFn2E+Xehnc6FfSfEjX N9wfwsNPkZyW5hlIKtpHrlW1vRukPSJC2GlsX2tsTXs6ReON9S6f0j2Yn9LUDSxEVVmFoJNqSmgHH ei93YA7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0Py6-00000009fOA-2CRl for ath12k@archiver.kernel.org; Thu, 03 Apr 2025 19:11:14 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0Pt8-00000009e5s-1PLw for ath12k@lists.infradead.org; Thu, 03 Apr 2025 19:06:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 8EB8044BE6; Thu, 3 Apr 2025 19:06:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2855DC4CEE8; Thu, 3 Apr 2025 19:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743707166; bh=gHL983/4Paj9RUeaojNW1KJ40fSB9x+SqPIDpBipqS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZwEADBHdWwVHJmhDx9A6TTCCSRAdopqk8EtLs07q14YiECGwqBiAXVhXd30MEOEP sFHPranqZ9EfbP/fGLcKrB1CvVHvhUgJd5yQ6QLKPhB0mQ2NKfVYl3UYisY4Pg2G4b bkXczulmnAgXDHy6uxZLyDQ/heukxHQU998iIpssB8vPtC9+1DrnEe6g3762wL5a8e yWGnrjFezicq3sNgvsDSWVSkrw53lJS0Dlb9CvIcWc1xKURahhrr9Nb57cX1Ke/hu5 VaMSjQr/cHFKngweOPY6QB5ZOQLP6jzZV2IkF8mX/nGrP3557dB2ZIVEF/HLCdCGjH g4LyHXTvmRbFw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: P Praneesh , Jeff Johnson , Sasha Levin , jjohnson@kernel.org, ath12k@lists.infradead.org Subject: [PATCH AUTOSEL 6.12 04/47] wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process Date: Thu, 3 Apr 2025 15:05:12 -0400 Message-Id: <20250403190555.2677001-4-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250403190555.2677001-1-sashal@kernel.org> References: <20250403190555.2677001-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.12.21 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250403_120606_395124_6C52A2EF X-CRM114-Status: GOOD ( 12.21 ) X-BeenThere: ath12k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath12k" Errors-To: ath12k-bounces+ath12k=archiver.kernel.org@lists.infradead.org From: P Praneesh [ Upstream commit 63fdc4509bcf483e79548de6bc08bf3c8e504bb3 ] Currently, ath12k_dp_mon_srng_process uses ath12k_hal_srng_src_get_next_entry to fetch the next entry from the destination ring. This is incorrect because ath12k_hal_srng_src_get_next_entry is intended for source rings, not destination rings. This leads to invalid entry fetches, causing potential data corruption or crashes due to accessing incorrect memory locations. This happens because the source ring and destination ring have different handling mechanisms and using the wrong function results in incorrect pointer arithmetic and ring management. To fix this issue, replace the call to ath12k_hal_srng_src_get_next_entry with ath12k_hal_srng_dst_get_next_entry in ath12k_dp_mon_srng_process. This ensures that the correct function is used for fetching entries from the destination ring, preventing invalid memory accesses. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh Link: https://patch.msgid.link/20241223060132.3506372-7-quic_ppranees@quicinc.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath12k/dp_mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c index 5c6749bc4039d..1706ec27eb9c0 100644 --- a/drivers/net/wireless/ath/ath12k/dp_mon.c +++ b/drivers/net/wireless/ath/ath12k/dp_mon.c @@ -2533,7 +2533,7 @@ int ath12k_dp_mon_rx_process_stats(struct ath12k *ar, int mac_id, dest_idx = 0; move_next: ath12k_dp_mon_buf_replenish(ab, buf_ring, 1); - ath12k_hal_srng_src_get_next_entry(ab, srng); + ath12k_hal_srng_dst_get_next_entry(ab, srng); num_buffs_reaped++; } -- 2.39.5