Skip to content

Commit 86a03da

Browse files
Baochen QiangKalle Valo
authored andcommitted
ath11k: Change DMA_FROM_DEVICE to DMA_TO_DEVICE when map reinjected packets
For fragmented packets, ath11k reassembles each fragment as a normal packet and then reinjects it into HW ring. In this case, the DMA direction should be DMA_TO_DEVICE, not DMA_FROM_DEVICE, otherwise invalid payload will be reinjected to HW and then delivered to host. What is more, since arbitrary memory could be allocated to the frame, we don't know what kind of data is contained in the buffer reinjected. Thus, as a bad result, private info may be leaked. Note that this issue is only found on Intel platform. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Baochen Qiang <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6f4d703 commit 86a03da

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,7 +3402,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti
34023402

34033403
paddr = dma_map_single(ab->dev, defrag_skb->data,
34043404
defrag_skb->len + skb_tailroom(defrag_skb),
3405-
DMA_FROM_DEVICE);
3405+
DMA_TO_DEVICE);
34063406
if (dma_mapping_error(ab->dev, paddr))
34073407
return -ENOMEM;
34083408

@@ -3467,7 +3467,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti
34673467
spin_unlock_bh(&rx_refill_ring->idr_lock);
34683468
err_unmap_dma:
34693469
dma_unmap_single(ab->dev, paddr, defrag_skb->len + skb_tailroom(defrag_skb),
3470-
DMA_FROM_DEVICE);
3470+
DMA_TO_DEVICE);
34713471
return ret;
34723472
}
34733473

0 commit comments

Comments
 (0)