From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50F16C433ED for ; Tue, 27 Apr 2021 02:09:10 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id AB278613AB for ; Tue, 27 Apr 2021 02:09:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB278613AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CB0E4067E; Tue, 27 Apr 2021 04:09:09 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 425C04003E for ; Tue, 27 Apr 2021 04:09:08 +0200 (CEST) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FTlW32T4Nz7xRZ for ; Tue, 27 Apr 2021 10:06:39 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 27 Apr 2021 10:09:02 +0800 To: Ferruh Yigit , References: <1619063789-60922-1-git-send-email-humin29@huawei.com> <1619063789-60922-3-git-send-email-humin29@huawei.com> <5c6f4a89-d287-9d5c-fc6d-62bf5188304c@intel.com> From: "Min Hu (Connor)" Message-ID: <47af5a7d-d8ae-69d3-51f9-e3926e99fa5f@huawei.com> Date: Tue, 27 Apr 2021 10:09:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <5c6f4a89-d287-9d5c-fc6d-62bf5188304c@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH 2/3] net/kni: fix rewritten return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 在 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) >> --- >> 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; >> > > . >