]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: ath12k: Correct tid cleanup when tid setup fails
authorSarika Sharma <quic_sarishar@quicinc.com>
Mon, 21 Jul 2025 06:17:49 +0000 (11:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:41:06 +0000 (18:41 +0200)
[ Upstream commit 4a2bf707270f897ab8077baee8ed5842a5321686 ]

Currently, if any error occurs during ath12k_dp_rx_peer_tid_setup(),
the tid value is already incremented, even though the corresponding
TID is not actually allocated. Proceed to
ath12k_dp_rx_peer_tid_delete() starting from unallocated tid,
which might leads to freeing unallocated TID and cause potential
crash or out-of-bounds access.

Hence, fix by correctly decrementing tid before cleanup to match only
the successfully allocated TIDs.

Also, remove tid-- from failure case of ath12k_dp_rx_peer_frag_setup(),
as decrementing the tid before cleanup in loop will take care of this.

Compile tested only.

Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250721061749.886732-1-quic_sarishar@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath12k/dp.c

index 6317c6d4c043719a2cbcd34c3325b9ecf36b8499..dd26ed8d7d9684f8a8108ea70be724a40d00f7f6 100644 (file)
@@ -101,7 +101,7 @@ peer_clean:
                return -ENOENT;
        }
 
-       for (; tid >= 0; tid--)
+       for (tid--; tid >= 0; tid--)
                ath12k_dp_rx_peer_tid_delete(ar, peer, tid);
 
        spin_unlock_bh(&ab->base_lock);