From: Ben Hutchings Date: Tue, 27 Jan 2015 00:49:47 +0000 (+0000) Subject: sh_eth: Check for DMA mapping errors on transmit X-Git-Tag: submit/tizen/20160607.132125~3141^2~5^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa3933b87309c61b4fa4bb93c1ad4c3f08afb1b8;p=sdk%2Femulator%2Femulator-kernel.git sh_eth: Check for DMA mapping errors on transmit dma_map_single() may fail if an IOMMU or swiotlb is in use, so we need to check for this. Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 245166bbccfd..4a085da57188 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2174,6 +2174,10 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) skb->len + 2); txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, DMA_TO_DEVICE); + if (dma_mapping_error(&ndev->dev, txdesc->addr)) { + kfree_skb(skb); + return NETDEV_TX_OK; + } txdesc->buffer_length = skb->len; if (entry >= mdp->num_tx_ring - 1)