summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorThomas Monjalon <thomas@monjalon.net>2018-11-07 23:56:45 +0100
committerThomas Monjalon <thomas@monjalon.net>2018-11-12 00:10:21 +0100
commitc7ad7754f8e2233a4a8837f04e267d38048e8c2d (patch)
tree9191882cb613b4ce0c019adb606c177fcc0c657f /drivers
parent86ce81af7352875f31efc01cb110b7b17c0ae235 (diff)
downloaddpdk-c7ad7754f8e2233a4a8837f04e267d38048e8c2d.zip
dpdk-c7ad7754f8e2233a4a8837f04e267d38048e8c2d.tar.gz
dpdk-c7ad7754f8e2233a4a8837f04e267d38048e8c2d.tar.xz
devargs: do not replace already inserted device
The devargs of a device can be replaced by a newly allocated one when trying to probe again the same device (multi-process or multi-ports scenarios). This is breaking some pointer references. It can be avoided by copying the new content, freeing the new devargs, and returning the already inserted pointer. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: Qi Zhang <qi.z.zhang@intel.com> Tested-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bus/vdev/vdev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 9c66bdc..2c03ca4 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -224,7 +224,6 @@ insert_vdev(const char *name, const char *args,
}
dev->device.bus = &rte_vdev_bus;
- dev->device.devargs = devargs;
dev->device.numa_node = SOCKET_ID_ANY;
dev->device.name = devargs->name;
@@ -238,9 +237,10 @@ insert_vdev(const char *name, const char *args,
goto fail;
}
- TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
if (init)
- rte_devargs_insert(devargs);
+ rte_devargs_insert(&devargs);
+ dev->device.devargs = devargs;
+ TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
if (p_dev)
*p_dev = dev;