]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: ath12k: change DMA direction while mapping reinjected packets
authorP Praneesh <quic_ppranees@quicinc.com>
Mon, 20 May 2024 07:00:43 +0000 (12:30 +0530)
committerKalle Valo <quic_kvalo@quicinc.com>
Sat, 25 May 2024 08:56:57 +0000 (11:56 +0300)
For fragmented packets, ath12k 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,
an invalid payload may be reinjected into the HW and
subsequently delivered to the host.

Given that arbitrary memory can be allocated to the skb buffer,
knowledge about the data contained in the reinjected buffer is lacking.
Consequently, there’s a risk of private information being leaked.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00209-QCAHKSWPL_SILICONZ-1

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Co-developed-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240520070045.631029-2-quic_ppranees@quicinc.com
drivers/net/wireless/ath/ath12k/dp_rx.c

index 000df6edf6b4e9041e041347f90b6d88cc0bea93..ffd3f003d0037a4cc3d383f0fb9de094d2dd658f 100644 (file)
@@ -3008,7 +3008,7 @@ static int ath12k_dp_rx_h_defrag_reo_reinject(struct ath12k *ar,
 
        buf_paddr = dma_map_single(ab->dev, defrag_skb->data,
                                   defrag_skb->len + skb_tailroom(defrag_skb),
-                                  DMA_FROM_DEVICE);
+                                  DMA_TO_DEVICE);
        if (dma_mapping_error(ab->dev, buf_paddr))
                return -ENOMEM;
 
@@ -3094,7 +3094,7 @@ err_free_desc:
        spin_unlock_bh(&dp->rx_desc_lock);
 err_unmap_dma:
        dma_unmap_single(ab->dev, buf_paddr, defrag_skb->len + skb_tailroom(defrag_skb),
-                        DMA_FROM_DEVICE);
+                        DMA_TO_DEVICE);
        return ret;
 }