[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220311230438.2caa4673@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 11 Mar 2022 23:04:38 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: 3chas3@...il.com, linux-atm-general@...ts.sourceforge.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] atm: eni: Add check for dma_map_single
On Fri, 11 Mar 2022 15:16:56 +0800 Jiasheng Jiang wrote:
> 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@...as.ac.cn>
> ---
> drivers/atm/eni.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
> index 422753d52244..96c2d8f5646b 100644
> --- a/drivers/atm/eni.c
> +++ b/drivers/atm/eni.c
> @@ -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_jam;
Probably better to drop the packet if mapping fails.
> ENI_PRV_PADDR(skb) = paddr;
> /* prepare DMA queue entries */
> j = 0;
Powered by blists - more mailing lists