]> git.baikalelectronics.ru Git - kernel.git/commitdiff
atm: eni: Add check for dma_map_single
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 14 Mar 2022 01:34:48 +0000 (09:34 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Mar 2022 11:01:52 +0000 (11:01 +0000)
As the potential failure of the dma_map_single(),
it should be better to check it and return error
if fails.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/eni.c

index 422753d52244bd446664e2b68f427f9a3a6ff32b..a31ffe16e626f71b9ef89fa7ee376c97c1aabfe1 100644 (file)
@@ -1112,6 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags);
        skb_data3 = skb->data[3];
        paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len,
                               DMA_TO_DEVICE);
+       if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr))
+               return enq_next;
        ENI_PRV_PADDR(skb) = paddr;
        /* prepare DMA queue entries */
        j = 0;