DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>, <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/3] net/kni: fix rewritten return value
Date: Tue, 27 Apr 2021 10:09:02 +0800	[thread overview]
Message-ID: <47af5a7d-d8ae-69d3-51f9-e3926e99fa5f@huawei.com> (raw)
In-Reply-To: <5c6f4a89-d287-9d5c-fc6d-62bf5188304c@intel.com>



在 2021/4/26 21:18, Ferruh Yigit 写道:
> On 4/22/2021 4:56 AM, Min Hu (Connor) wrote:
>> Return value of function 'eth_kni_dev_stop' passed to 'ret' is
>> rewritten later, and this is unreasonable.
>>
>> This patch fixes it.
>>
>> Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>>   drivers/net/kni/rte_eth_kni.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
>> index 9ce74e5..067584c 100644
>> --- a/drivers/net/kni/rte_eth_kni.c
>> +++ b/drivers/net/kni/rte_eth_kni.c
>> @@ -211,6 +211,11 @@ eth_kni_close(struct rte_eth_dev *eth_dev)
>>   		return 0;
>>   
>>   	ret = eth_kni_dev_stop(eth_dev);
>> +	if (ret) {
>> +		PMD_LOG(WARNING, "Not able to stop kni for %s",
>> +			eth_dev->data->name);
>> +		return ret;
>> +	}
>>   
> 
> 'eth_kni_close()' is called by 'eth_kni_remove()', and returning here without
> setting 'eth_dev->data->mac_addrs' to NULL, 'eth_kni_remove()' may crash.
> 
> And the close ops is to not use the device anymore, there is not much to do if
> stop() fails here. So what do you think to log but not return on the
> 'eth_kni_dev_stop()' failure?
> 
Agreed, fixed in v2, thanks.
> 
>>   	/* mac_addrs must not be freed alone because part of dev_private */
>>   	eth_dev->data->mac_addrs = NULL;
>>
> 
> .
> 

  reply	other threads:[~2021-04-27  2:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  3:56 [dpdk-dev] [PATCH 0/3] bugfix for kni Min Hu (Connor)
2021-04-22  3:56 ` [dpdk-dev] [PATCH 1/3] kni: fix wrong comments Min Hu (Connor)
2021-04-26 13:34   ` Ferruh Yigit
2021-04-22  3:56 ` [dpdk-dev] [PATCH 2/3] net/kni: fix rewritten return value Min Hu (Connor)
2021-04-26 13:18   ` Ferruh Yigit
2021-04-27  2:09     ` Min Hu (Connor) [this message]
2021-04-27  2:08   ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-04-29 13:37     ` Ferruh Yigit
2021-04-22  3:56 ` [dpdk-dev] [PATCH 3/3] kni: fix unchecked " Min Hu (Connor)
2021-04-26 13:35   ` Ferruh Yigit
2021-04-26 13:35 ` [dpdk-dev] [PATCH 0/3] bugfix for kni Ferruh Yigit

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=47af5a7d-d8ae-69d3-51f9-e3926e99fa5f@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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;
as well as URLs for NNTP newsgroup(s).