Skip to content

Commit 371b340

Browse files
Sarika Sharmagregkh
authored andcommitted
wifi: ath12k: fix invalid access to memory
[ Upstream commit 9f17747 ] In ath12k_dp_rx_msdu_coalesce(), rxcb is fetched from skb and boolean is_continuation is part of rxcb. Currently, after freeing the skb, the rxcb->is_continuation accessed again which is wrong since the memory is already freed. This might lead use-after-free error. Hence, fix by locally defining bool is_continuation from rxcb, so that after freeing skb, is_continuation can be used. Compile tested only. Fixes: d889913 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Link: https://patch.msgid.link/20250408045327.1632222-1-quic_sarishar@quicinc.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bba2433 commit 371b340

File tree

1 file changed

+4
-2
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,7 @@ static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
17621762
struct hal_rx_desc *ldesc;
17631763
int space_extra, rem_len, buf_len;
17641764
u32 hal_rx_desc_sz = ar->ab->hal.hal_desc_sz;
1765+
bool is_continuation;
17651766

17661767
/* As the msdu is spread across multiple rx buffers,
17671768
* find the offset to the start of msdu for computing
@@ -1810,7 +1811,8 @@ static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
18101811
rem_len = msdu_len - buf_first_len;
18111812
while ((skb = __skb_dequeue(msdu_list)) != NULL && rem_len > 0) {
18121813
rxcb = ATH12K_SKB_RXCB(skb);
1813-
if (rxcb->is_continuation)
1814+
is_continuation = rxcb->is_continuation;
1815+
if (is_continuation)
18141816
buf_len = DP_RX_BUFFER_SIZE - hal_rx_desc_sz;
18151817
else
18161818
buf_len = rem_len;
@@ -1828,7 +1830,7 @@ static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
18281830
dev_kfree_skb_any(skb);
18291831

18301832
rem_len -= buf_len;
1831-
if (!rxcb->is_continuation)
1833+
if (!is_continuation)
18321834
break;
18331835
}
18341836

0 commit comments

Comments
 (0)