vfio/pci: Fix a use-after-free issue
vbasedev->name is freed wrongly which leads to garbage VFIO trace log. Fix it by allocating a dup of vbasedev->name and then free the dup. Fixes: 2dca1b37a760 ("vfio/pci: add support for VF token") Suggested-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
aa33508196
commit
b83b40b614
@ -2994,7 +2994,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
|||||||
qemu_uuid_unparse(&vdev->vf_token, uuid);
|
qemu_uuid_unparse(&vdev->vf_token, uuid);
|
||||||
name = g_strdup_printf("%s vf_token=%s", vbasedev->name, uuid);
|
name = g_strdup_printf("%s vf_token=%s", vbasedev->name, uuid);
|
||||||
} else {
|
} else {
|
||||||
name = vbasedev->name;
|
name = g_strdup(vbasedev->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vfio_get_device(group, name, vbasedev, errp);
|
ret = vfio_get_device(group, name, vbasedev, errp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user