From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] kni: unregister an unregisterd net_device could cause a kernel crash Date: Thu, 8 Sep 2016 09:44:42 -0700 Message-ID: <20160908094442.4dfa5b01@xeon-e3> References: <1473389167-2758-1-git-send-email-zhouyates@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: ferruh.yigit@intel.com, dev@dpdk.org To: zhouyangchao Return-path: Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id 71E1D558B for ; Thu, 8 Sep 2016 18:44:33 +0200 (CEST) Received: by mail-pf0-f171.google.com with SMTP id g202so19926488pfb.0 for ; Thu, 08 Sep 2016 09:44:33 -0700 (PDT) In-Reply-To: <1473389167-2758-1-git-send-email-zhouyates@gmail.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 9 Sep 2016 10:46:07 +0800 zhouyangchao wrote: > Signed-off-by: zhouyangchao > --- > lib/librte_eal/linuxapp/kni/kni_misc.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c > index 67e9b7d..ad4e603 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c > @@ -361,7 +361,9 @@ kni_dev_remove(struct kni_dev *dev) > igb_kni_remove(dev->pci_dev); > > if (dev->net_dev) { > - unregister_netdev(dev->net_dev); > + if (dev->netdev->reg_state == NETREG_REGISTERED){ ----------------------------------------------------------------^ Incorrect whitespace. But then again the whole KNI driver fails completely when running kernel style check.