From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754458AbcAMDtk (ORCPT ); Tue, 12 Jan 2016 22:49:40 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:12658 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753965AbcAMDtU (ORCPT ); Tue, 12 Jan 2016 22:49:20 -0500 Message-ID: <5695C919.8070203@huawei.com> Date: Wed, 13 Jan 2016 11:48:41 +0800 From: Ding Tianhong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Weidong Wang , David Miller , , , , CC: , Subject: Re: [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed References: <5695C04D.1070709@huawei.com> In-Reply-To: <5695C04D.1070709@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5695C92A.0056,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 189e53aa406d933521af544425d1a20c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/1/13 11:11, Weidong Wang wrote: > when build_skb failed, we should goto refill the buffer. > > Signed-off-by: Weidong Wang > --- Acked-by: Ding Tainhong > 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; >