summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarek Stojaczyk <dariusz.stojaczyk@intel.com>2018-11-23 22:26:40 +0100
committerThomas Monjalon <thomas@monjalon.net>2018-11-25 13:22:51 +0100
commitd27eed313929685fda8c7f223f897a7e7baa9f63 (patch)
tree393afe3d393b4754ee3472fcbb4440e643429085
parent5d36bf2bcd87760c5656ab09f0549eea5a3adefc (diff)
downloaddpdk-d27eed313929685fda8c7f223f897a7e7baa9f63.zip
dpdk-d27eed313929685fda8c7f223f897a7e7baa9f63.tar.gz
dpdk-d27eed313929685fda8c7f223f897a7e7baa9f63.tar.xz
eal: fix multi-process hotplug if already probed
When primary process receives an IPC attach request of a device that's already locally-attached, it doesn't setup its variables properly and is prone to segfaulting on a subsequent rollback. `ret = local_dev_probe(req->devargs, &dev)` The above function will set `dev` pointer to the proper device *unless* it returns with error. One of those errors is -EEXIST, which the hotplug function explicitly ignores. For -EEXIST, it proceeds with attaching the device and expects the dev pointer to be valid. This patch makes `local_dev_probe` set the dev pointer even if it returns -EEXIST. Fixes: ac9e4a17370f ("eal: support attach/detach shared device from secondary") Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
-rw-r--r--lib/librte_eal/common/eal_common_dev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 1fdc9ab..a08dc08 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -168,16 +168,14 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
}
ret = dev->bus->plug(dev);
- if (ret) {
- if (rte_dev_is_probed(dev)) /* if already succeeded earlier */
- return ret; /* no rollback */
+ if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
dev->name);
goto err_devarg;
}
*new_dev = dev;
- return 0;
+ return ret;
err_devarg:
if (rte_devargs_remove(da) != 0) {