On Fri, 9 Sep 2016 10:42:16 +0800 zhouyangchao <zhouyates at gmail.com> wrote:
> Signed-off-by: zhouyangchao <zhouyates at gmail.com> > --- > lib/librte_eal/linuxapp/kni/kni_misc.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c > b/lib/librte_eal/linuxapp/kni/kni_misc.c > index 67e9b7d..17b6d7a 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c > @@ -361,6 +361,9 @@ kni_dev_remove(struct kni_dev *dev) > igb_kni_remove(dev->pci_dev); > > if (dev->net_dev) { > + if (dev->net_dev->state == NETREG_REGISTERED) { > + unregister_netdev(dev->net_dev); > + } > unregister_netdev(dev->net_dev); > free_netdev(dev->net_dev); > } The real problem is kni_dev_remove should not be called when register_netdevice fails. Why not just fix that unwind path.