* [PATCH] net: macb: add check for dma mapping error in start_xmit()
@ 2016-11-18 22:40 Alexey Khoroshilov
2016-11-19 15:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2016-11-18 22:40 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: Alexey Khoroshilov, netdev, linux-kernel, ldv-project
at91ether_start_xmit() does not check for dma mapping errors.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/net/ethernet/cadence/macb.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index b32444a3ed79..533653bd7aec 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2673,6 +2673,12 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
lp->skb_length = skb->len;
lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len,
DMA_TO_DEVICE);
+ if (dma_mapping_error(NULL, lp->skb_physaddr)) {
+ dev_kfree_skb_any(skb);
+ dev->stats.tx_dropped++;
+ netdev_err(dev, "%s: DMA mapping error\n", __func__);
+ return NETDEV_TX_OK;
+ }
/* Set address of the data in the Transmit Address register */
macb_writel(lp, TAR, lp->skb_physaddr);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: macb: add check for dma mapping error in start_xmit()
2016-11-18 22:40 [PATCH] net: macb: add check for dma mapping error in start_xmit() Alexey Khoroshilov
@ 2016-11-19 15:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-11-19 15:29 UTC (permalink / raw)
To: khoroshilov; +Cc: nicolas.ferre, netdev, linux-kernel, ldv-project
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 19 Nov 2016 01:40:10 +0300
> at91ether_start_xmit() does not check for dma mapping errors.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-19 15:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 22:40 [PATCH] net: macb: add check for dma mapping error in start_xmit() Alexey Khoroshilov
2016-11-19 15:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).