Bus rescan is done e.g. during the device hotplug,
where devargs are re-allocated. By not updating the
rte_device->devargs pointer we potentially make it
a dangling one, as previous devargs could have been
(or will be soon) freed.

Fixes: 55e411b301c3 ("bus/pci: fix resource mapping override")
Cc: qi.z.zh...@intel.com

Signed-off-by: Darek Stojaczyk <dariusz.stojac...@intel.com>
---
 drivers/bus/pci/linux/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index f87533c5c..f3172960e 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -349,10 +349,10 @@ pci_scan_one(const char *dirname, const struct 
rte_pci_addr *addr)
                        if (ret < 0) {
                                rte_pci_insert_device(dev2, dev);
                        } else { /* already registered */
+                               pci_name_set(dev2);
                                if (!rte_dev_is_probed(&dev2->device)) {
                                        dev2->kdrv = dev->kdrv;
                                        dev2->max_vfs = dev->max_vfs;
-                                       pci_name_set(dev2);
                                        memmove(dev2->mem_resource,
                                                dev->mem_resource,
                                                sizeof(dev->mem_resource));
-- 
2.17.1

Reply via email to