[v2] net/vdev: fix insert vdev core dump
Checks
Commit Message
In secondary processes, insert_vdev() may be called multiple times on the
same device due to multi-process hot-plugging of the vdev bus and EAL
parameters to add the same vdev.
In this case, when rte_devargs_insert() is called, the devargs->name
reference will be invalidated because rte_devargs_insert() destroys the
just-allocated devargs and replaces the pointer from the devargs list.
As a result, the reference to devargs->name stored in dev->device.name
will be invalid.
This patch fixes the issue by setting the device name after calling
rte_devargs_insert().
Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
Cc: stable@dpdk.org
Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
v2: Modify commit log.
---
drivers/bus/vdev/vdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 7/16/2024 11:53 AM, Mingjin Ye wrote:
> In secondary processes, insert_vdev() may be called multiple times on the
> same device due to multi-process hot-plugging of the vdev bus and EAL
> parameters to add the same vdev.
>
> In this case, when rte_devargs_insert() is called, the devargs->name
> reference will be invalidated because rte_devargs_insert() destroys the
> just-allocated devargs and replaces the pointer from the devargs list.
> As a result, the reference to devargs->name stored in dev->device.name
> will be invalid.
>
> This patch fixes the issue by setting the device name after calling
> rte_devargs_insert().
>
> Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
> Cc: stable@dpdk.org
>
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---
> v2: Modify commit log.
> ---
Forgot to add my review tag:
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
22/07/2024 14:39, Burakov, Anatoly:
> On 7/16/2024 11:53 AM, Mingjin Ye wrote:
> > In secondary processes, insert_vdev() may be called multiple times on the
> > same device due to multi-process hot-plugging of the vdev bus and EAL
> > parameters to add the same vdev.
> >
> > In this case, when rte_devargs_insert() is called, the devargs->name
> > reference will be invalidated because rte_devargs_insert() destroys the
> > just-allocated devargs and replaces the pointer from the devargs list.
> > As a result, the reference to devargs->name stored in dev->device.name
> > will be invalid.
> >
> > This patch fixes the issue by setting the device name after calling
> > rte_devargs_insert().
> >
> > Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> > ---
> > v2: Modify commit log.
> > ---
>
> Forgot to add my review tag:
>
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks.
@@ -288,7 +288,6 @@ insert_vdev(const char *name, const char *args,
dev->device.bus = &rte_vdev_bus;
dev->device.numa_node = SOCKET_ID_ANY;
- dev->device.name = devargs->name;
if (find_vdev(name)) {
/*
@@ -303,6 +302,7 @@ insert_vdev(const char *name, const char *args,
if (init)
rte_devargs_insert(&devargs);
dev->device.devargs = devargs;
+ dev->device.name = devargs->name;
TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
if (p_dev)