From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92530A0548; Mon, 26 Apr 2021 15:18:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5582D41104; Mon, 26 Apr 2021 15:18:29 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5906B40140 for ; Mon, 26 Apr 2021 15:18:27 +0200 (CEST) IronPort-SDR: Rgmbg8mf8/pzqDFULnXDdu6HP1lpFXFgpn1vyr5edkHIjSNGwr7IWOArbjQYQXyDVMwOUSspSM Qcy/ogD0IfiQ== X-IronPort-AV: E=McAfee;i="6200,9189,9966"; a="175815862" X-IronPort-AV: E=Sophos;i="5.82,252,1613462400"; d="scan'208";a="175815862" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2021 06:18:26 -0700 IronPort-SDR: AEFWViw2tk3+Xn1wcH4Zk4IzOpRhWld9AqMw4j0Mfz0eCMohz/tOsYHJlgWL9rdP/EbvIMTjeL bTVCCyBt6e4A== X-IronPort-AV: E=Sophos;i="5.82,252,1613462400"; d="scan'208";a="402922618" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.240.23]) ([10.213.240.23]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2021 06:18:24 -0700 To: "Min Hu (Connor)" , dev@dpdk.org References: <1619063789-60922-1-git-send-email-humin29@huawei.com> <1619063789-60922-3-git-send-email-humin29@huawei.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <5c6f4a89-d287-9d5c-fc6d-62bf5188304c@intel.com> Date: Mon, 26 Apr 2021 14:18:21 +0100 MIME-Version: 1.0 In-Reply-To: <1619063789-60922-3-git-send-email-humin29@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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" 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? > /* mac_addrs must not be freed alone because part of dev_private */ > eth_dev->data->mac_addrs = NULL; >