]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mwl8k: Add missing check after DMA map
authorThomas Fourier <fourier.thomas@gmail.com>
Wed, 9 Jul 2025 11:13:34 +0000 (13:13 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 15 Jul 2025 08:59:28 +0000 (10:59 +0200)
The DMA map functions can fail and should be tested for errors.
If the mapping fails, unmap and return an error.

Fixes: 788838ebe8a4 ("mwl8k: use pci_unmap_addr{,set}() to keep track of unmap addresses on rx")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://patch.msgid.link/20250709111339.25360-2-fourier.thomas@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/marvell/mwl8k.c

index bc34a025acd6bc94f489085686cde8c8476101b9..891e125ad30b53bda0c1dfb9eb08971f07ec9d44 100644 (file)
@@ -1227,6 +1227,10 @@ static int rxq_refill(struct ieee80211_hw *hw, int index, int limit)
 
                addr = dma_map_single(&priv->pdev->dev, skb->data,
                                      MWL8K_RX_MAXSZ, DMA_FROM_DEVICE);
+               if (dma_mapping_error(&priv->pdev->dev, addr)) {
+                       kfree_skb(skb);
+                       break;
+               }
 
                rxq->rxd_count++;
                rx = rxq->tail++;