From 5544a453b4ac2e3eded876d01423e7bb0739284c Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Wed, 31 Aug 2016 14:06:26 +0100 Subject: [PATCH] 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 --- lib/librte_eal/linuxapp/kni/kni_misc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); -- 2.20.1