diff mbox

[dpdk-dev] kni: fix crash for KNI interface remove

Message ID 1472648786-32404-1-git-send-email-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Commit Message

Ferruh Yigit Aug. 31, 2016, 1:06 p.m. UTC
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 <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Thomas Monjalon Sept. 9, 2016, 1:46 p.m. UTC | #1
2016-08-31 14:06, Ferruh Yigit:
> 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 <ferruh.yigit@intel.com>

Applied, thanks
diff mbox

Patch

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 41a331f..acb961f 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);