[PATCH net-next] hip04_eth: fix missing error handle for build_skb failed

Subsystems: hisilicon network subsystem driver, networking drivers, the rest

STALE3866d

3 messages, 3 authors, 2016-01-13 · open the first message on its own page

[PATCH net-next] hip04_eth: fix missing error handle for build_skb failed

From: Weidong Wang <hidden>
Date: 2016-01-13 03:11:23

when build_skb failed, we should goto refill the buffer.

Signed-off-by: Weidong Wang <redacted>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 3b39fdd..417f131 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -500,8 +500,10 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 	while (cnt && !last) {
 		buf = priv->rx_buf[priv->rx_head];
 		skb = build_skb(buf, priv->rx_buf_size);
-		if (unlikely(!skb))
+		if (unlikely(!skb)) {
 			net_dbg_ratelimited("build_skb failed\n");
+			goto refill;
+		}

 		dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
 				 RX_BUF_SIZE, DMA_FROM_DEVICE);
@@ -528,6 +530,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 			rx++;
 		}

+refill:
 		buf = netdev_alloc_frag(priv->rx_buf_size);
 		if (!buf)
 			goto done;
-- 
1.9.0

Re: [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed

From: Ding Tianhong <hidden>
Date: 2016-01-13 03:49:40

On 2016/1/13 11:11, Weidong Wang wrote:
when build_skb failed, we should goto refill the buffer.

Signed-off-by: Weidong Wang <redacted>
---
Acked-by: Ding Tainhong <redacted>
quoted hunk
 drivers/net/ethernet/hisilicon/hip04_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 3b39fdd..417f131 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -500,8 +500,10 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 	while (cnt && !last) {
 		buf = priv->rx_buf[priv->rx_head];
 		skb = build_skb(buf, priv->rx_buf_size);
-		if (unlikely(!skb))
+		if (unlikely(!skb)) {
 			net_dbg_ratelimited("build_skb failed\n");
+			goto refill;
+		}

 		dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
 				 RX_BUF_SIZE, DMA_FROM_DEVICE);
@@ -528,6 +530,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 			rx++;
 		}

+refill:
 		buf = netdev_alloc_frag(priv->rx_buf_size);
 		if (!buf)
 			goto done;

Re: [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed

From: David Miller <davem@davemloft.net>
Date: 2016-01-13 20:48:39

From: Weidong Wang <redacted>
Date: Wed, 13 Jan 2016 11:11:09 +0800
when build_skb failed, we should goto refill the buffer.

Signed-off-by: Weidong Wang <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help