summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarek Stojaczyk <dariusz.stojaczyk@intel.com>2018-11-21 20:05:07 +0100
committerThomas Monjalon <thomas@monjalon.net>2018-11-25 13:15:34 +0100
commit5d36bf2bcd87760c5656ab09f0549eea5a3adefc (patch)
treea5989c68461703e6beaf9f98442829af9e53877d
parent047e3f9f2a4a4b73da86b707af8a32039ba1cad7 (diff)
downloaddpdk-5d36bf2bcd87760c5656ab09f0549eea5a3adefc.zip
dpdk-5d36bf2bcd87760c5656ab09f0549eea5a3adefc.tar.gz
dpdk-5d36bf2bcd87760c5656ab09f0549eea5a3adefc.tar.xz
eal: fix multi-process hotplug rollback
If a device fails to attach before it's plugged, the subsequent rollback will still try to detach it, causing a segfault. Unplugging a device that wasn't plugged isn't really supported, so this patch adds an extra error check to prevent that from happening. While here, fix this also for normal (non-rollback) detach, which could also theoretically segfault on non-plugged device. Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
-rw-r--r--lib/librte_eal/common/hotplug_mp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 7c9fcc4..d9e6790 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -264,6 +264,19 @@ static void __handle_primary_request(void *param)
goto quit;
}
+ if (!rte_dev_is_probed(dev)) {
+ if (req->t == EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK) {
+ /**
+ * Don't fail the rollback just because there's
+ * nothing to do.
+ */
+ ret = 0;
+ } else
+ ret = -ENODEV;
+
+ goto quit;
+ }
+
ret = local_dev_remove(dev);
quit:
free(da->args);