From: Ferruh Yigit Date: Wed, 31 Aug 2016 13:06:26 +0000 (+0100) Subject: kni: fix crash when removing interface X-Git-Tag: spdx-start~6024 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5544a453b4ac2e3eded876d01423e7bb0739284c;p=dpdk.git kni: fix crash when removing interface Removing KNI interface that has no PCI driver for ethtool support cause kernel crash. Fixes: 109febfe58f9 ("net/igb: move PCI device IDs from EAL") Fixes: 221fba3b987c ("net/ixgbe: move PCI device IDs from EAL") Signed-off-by: Ferruh Yigit --- diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 67e9b7d928..4f0750797e 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -355,10 +355,12 @@ kni_dev_remove(struct kni_dev *dev) if (!dev) return -ENODEV; - if (pci_match_id(ixgbe_pci_tbl, dev->pci_dev)) - ixgbe_kni_remove(dev->pci_dev); - else if (pci_match_id(igb_pci_tbl, dev->pci_dev)) - igb_kni_remove(dev->pci_dev); + if (dev->pci_dev) { + if (pci_match_id(ixgbe_pci_tbl, dev->pci_dev)) + ixgbe_kni_remove(dev->pci_dev); + else if (pci_match_id(igb_pci_tbl, dev->pci_dev)) + igb_kni_remove(dev->pci_dev); + } if (dev->net_dev) { unregister_netdev(dev->net_dev);