Thread (13 messages) 13 messages, 4 authors, 2017-08-11

Re: [PATCH] wan: dscc4: add checks for dma mapping errors

flat view

From: David Miller <davem@davemloft.net>
Date: 2017-08-07 21:06:43
Also in: lkml

From: Alexey Khoroshilov <redacted>
Date: Fri,  4 Aug 2017 23:23:24 +0300
The driver does not check if mapping dma memory succeed.
The patch adds the checks and failure handling.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <redacted>
This is a great example of why it can be irritating to see these
mechanical "bug fixes" for drivers very few people use and actually
test, which introduces new bugs.
quoted hunk ↗ jump to hunk
@@ -522,19 +522,27 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
 	struct RxFD *rx_fd = dpriv->rx_fd + dirty;
 	const int len = RX_MAX(HDLC_MAX_MRU);
 	struct sk_buff *skb;
-	int ret = 0;
+	dma_addr_t addr;
 
 	skb = dev_alloc_skb(len);
 	dpriv->rx_skbuff[dirty] = skb;
skb recorded here.
+err_free_skb:
+	dev_kfree_skb_any(skb);
Yet freed here in the error path.

dpriv->rx_skbuff[dirty] should not be set to 'skb' until all possibile
failure tests have passed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help