Netdev List
 help / color / mirror / Atom feed
From: tanhuazhong <tanhuazhong@huawei.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	<davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linuxarm@huawei.com>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<lipeng321@huawei.com>, <linyunsheng@huawei.com>
Subject: Re: [Patch V4 net 02/11] net: hns3: add error handler for hns3_get_ring_config/hns3_queue_to_ring
Date: Tue, 30 Oct 2018 18:17:46 +0800	[thread overview]
Message-ID: <e46552f4-750e-e48d-8e0a-f60ee2193d15@huawei.com> (raw)
In-Reply-To: <ddef9d62-ec9c-6df6-113a-e7b0a0bd2a05@cogentembedded.com>



On 2018/10/30 17:09, Sergei Shtylyov wrote:
> Hello!
> 
> On 10/29/2018 4:54 PM, Huazhong Tan wrote:
> 
>> When hns3_get_ring_config()/hns3_queue_to_ring() failed during resetting,
>> the allocated memory has not been freed before hns3_get_ring_config() and
>> hns3_queue_to_ring() return. So this patch fixes the buffer not freeing
>> problem during resetting.
>>
>> Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver 
>> for hip08 SoC")
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>>   drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
>> b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> index d9066c5..6f0fd62 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> [...]
>> @@ -3047,7 +3049,7 @@ static int hns3_get_ring_config(struct 
>> hns3_nic_priv *priv)
>>   {
>>       struct hnae3_handle *h = priv->ae_handle;
>>       struct pci_dev *pdev = h->pdev;
>> -    int i, ret;
>> +    int i, j, ret;
>>       priv->ring_data =  devm_kzalloc(&pdev->dev,
>>                       array3_size(h->kinfo.num_tqps,
>> @@ -3065,6 +3067,12 @@ static int hns3_get_ring_config(struct 
>> hns3_nic_priv *priv)
>>       return 0;
>>   err:
>> +    for (j = i - 1; j >= 0; j--) {
> 
>     As is with the other patch, you don't need 'j' here.
> 

Yes, i have modified it.
Thanks.

>> +        devm_kfree(priv->dev, priv->ring_data[j].ring);
>> +        devm_kfree(priv->dev,
>> +               priv->ring_data[j + h->kinfo.num_tqps].ring);
>> +    }
>> +
>>       devm_kfree(&pdev->dev, priv->ring_data);
>>       return ret;
>>   }
> 
> MBR, Sergei
> 

Greeting.
Huazhong.

> .
> 

  reply	other threads:[~2018-10-30 19:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 13:54 [Patch V4 net 00/11] Bugfix for the HNS3 driver Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 01/11] net: hns3: add error handler for hns3_nic_init_vector_data() Huazhong Tan
2018-10-29 17:44   ` Joe Perches
2018-10-30  1:21     ` tanhuazhong
2018-10-30  1:31       ` Joe Perches
2018-10-30  1:43         ` tanhuazhong
2018-10-30  9:11   ` Sergei Shtylyov
2018-10-30 10:19     ` tanhuazhong
2018-10-29 13:54 ` [Patch V4 net 02/11] net: hns3: add error handler for hns3_get_ring_config/hns3_queue_to_ring Huazhong Tan
2018-10-30  9:09   ` Sergei Shtylyov
2018-10-30 10:17     ` tanhuazhong [this message]
2018-10-29 13:54 ` [Patch V4 net 03/11] net: hns3: bugfix for reporting unknown vector0 interrupt repeatly problem Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 04/11] net: hns3: bugfix for the initialization of command queue's spin lock Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 05/11] net: hns3: remove unnecessary queue reset in the hns3_uninit_all_ring() Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 06/11] net: hns3: bugfix for is_valid_csq_clean_head() Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 07/11] net: hns3: bugfix for hclge_mdio_write and hclge_mdio_read Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 08/11] net: hns3: fix incorrect return value/type of some functions Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 09/11] net: hns3: bugfix for handling mailbox while the command queue reinitialized Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 10/11] net: hns3: bugfix for rtnl_lock's range in the hclge_reset() Huazhong Tan
2018-10-29 13:54 ` [Patch V4 net 11/11] net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset() Huazhong Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e46552f4-750e-e48d-8e0a-f60ee2193d15@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linuxarm@huawei.com \
    --cc=linyunsheng@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox