> -----Original Message-----
> From: Thomas Monjalon <tho...@monjalon.net>
> Sent: Thursday, June 20, 2024 4:16 AM
> To: Ye, MingjinX <mingjinx...@intel.com>
> Cc: dev@dpdk.org; sta...@dpdk.org; Marchand, David
> <david.march...@redhat.com>; step...@networkplumber.org;
> Richardson, Bruce <bruce.richard...@intel.com>
> Subject: Re: [PATCH 3/3] net/vdev: fix insert vdev core dump
> 
> 14/03/2024 10:36, Mingjin Ye:
> > Inserting a vdev device when the device arguments are already stored
> > in devargs_list, the rte_devargs_insert function replaces the supplied
> > new devargs with the found devargs and frees the new devargs. As a
> > result, the use of free devargs results in a core dump.
> >
> > This patch fixes the issue by using valid devargs.
> >
> > Fixes: f3a1188cee4a ("devargs: make device representation generic")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Mingjin Ye <mingjinx...@intel.com>
> > ---
> >     dev->device.bus = &rte_vdev_bus;
> >     dev->device.numa_node = SOCKET_ID_ANY;
> > -   dev->device.name = devargs->name;
> >
> >     if (find_vdev(name)) {
> >             /*
> > @@ -300,6 +299,7 @@ insert_vdev(const char *name, const char *args,
> > struct rte_vdev_device **p_dev)
> >
> >     rte_devargs_insert(&devargs);
> >     dev->device.devargs = devargs;
> > +   dev->device.name = devargs->name;
> >     TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
> 
> How setting the name later can have an impact here?
> 
/**
 * Insert an rte_devargs in the global list.
 *
 * @param da
 *  The devargs structure to insert.
 *  If a devargs for the same device is already inserted,
 *  it will be updated and returned. It means *da pointer can change.
 *
 * @return
 *   - 0 on success
 *   - Negative on error.
 */
int
rte_devargs_insert(struct rte_devargs **da);

Info: dpdk/lib/eal/include/rte_devargs.h

Reply via email to