bus/vdev: fix uninitialized device bus

Message ID 20181022054711.38683-1-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series bus/vdev: fix uninitialized device bus |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang Oct. 22, 2018, 5:47 a.m. UTC
  Device bus should be initialized after bus scan.
While it does not happened when scan vdev from secondary process,
that cause segment fault at rte_dev_probe when call dev->bus->xxx.

Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/bus/vdev/vdev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon Oct. 22, 2018, 7:02 a.m. UTC | #1
22/10/2018 07:47, Qi Zhang:
> Device bus should be initialized after bus scan.
> While it does not happened when scan vdev from secondary process,
> that cause segment fault at rte_dev_probe when call dev->bus->xxx.
> 
> Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  
Thomas Monjalon Oct. 22, 2018, 10:36 a.m. UTC | #2
22/10/2018 09:02, Thomas Monjalon:
> 22/10/2018 07:47, Qi Zhang:
> > Device bus should be initialized after bus scan.
> > While it does not happened when scan vdev from secondary process,
> > that cause segment fault at rte_dev_probe when call dev->bus->xxx.
> > 
> > Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>

Applied, thanks
  

Patch

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 0142fb2c8..7d658fdf7 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -222,6 +222,7 @@  insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev)
 		goto fail;
 	}
 
+	dev->device.bus = &rte_vdev_bus;
 	dev->device.devargs = devargs;
 	dev->device.numa_node = SOCKET_ID_ANY;
 	dev->device.name = devargs->name;