Patchwork [v2.6.29,02/14] gianfar: Fix skb allocation error

login
register
mail settings
Submitter Andy Fleming
Date Dec. 16, 2008, 11:20 p.m.
Message ID <1229469667-25002-3-git-send-email-afleming@freescale.com>
Download mbox | patch
Permalink /patch/14361/
State Rejected
Delegated to: David Miller
Headers show

Comments

Andy Fleming - Dec. 16, 2008, 11:20 p.m.
We don't want to unmap the skb if we've decided to use the old one, so we only
unmap it if we're *not* using the old one.

Signed-off-by: Andy Fleming <afleming@freescale.com>
---
 drivers/net/gianfar.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
David Miller - Dec. 16, 2008, 11:28 p.m.
From: Andy Fleming <afleming@freescale.com>
Date: Tue, 16 Dec 2008 17:20:55 -0600

> We don't want to unmap the skb if we've decided to use the old one, so we only
> unmap it if we're *not* using the old one.
> 
> Signed-off-by: Andy Fleming <afleming@freescale.com>

This does not apply to net-next-2.6, the code in this area doesn't
look anything like the context in this patch.  What are you
generating this against?

> @@ -1659,8 +1659,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
>  
>  			if (unlikely(!newskb))
>  				newskb = skb;
> -
> -			if (skb) {
> +			else if (skb) {
>  				dma_unmap_single(&priv->dev->dev,
>  						bdp->bufPtr,
>  						priv->rx_buffer_size,

That code reads:

			if (unlikely(!newskb))
				newskb = skb;

			if (skb)
				dev_kfree_skb_any(skb);

in my tree and the dma_unmap_single() is unconditionally executed
further up before the:

		/* We drop the frame if we failed to allocate a new buffer */
		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
				 bdp->status & RXBD_ERR)) {

check.

Please sort this out and be more careful in the future.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6ceff8d..7040a17 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1659,8 +1659,7 @@  int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
 			if (unlikely(!newskb))
 				newskb = skb;
-
-			if (skb) {
+			else if (skb) {
 				dma_unmap_single(&priv->dev->dev,
 						bdp->bufPtr,
 						priv->rx_buffer_size,