hw/vfio-user/pci.c | 2 -- 1 file changed, 2 deletions(-)
From: GuoHan Zhao <zhaoguohan@kylinos.cn>
vfio_user_pci_realize() assigns vbasedev->name before connecting to the
server, then assigns the same name again after installing the request
handler. The second assignment overwrites the first allocation, so only
the second string can be freed later by vfio_device_free_name().
Drop the duplicate assignment and keep the first name allocation, which is
also available on connection failures for error reporting.
Fixes: 36227628d824 ("vfio-user: implement message send infrastructure")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
---
hw/vfio-user/pci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
index facc79727acb..e7573d4a9f08 100644
--- a/hw/vfio-user/pci.c
+++ b/hw/vfio-user/pci.c
@@ -280,8 +280,6 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)
vbasedev->proxy = proxy;
vfio_user_set_handler(vbasedev, vfio_user_pci_process_req, vdev);
- vbasedev->name = g_strdup_printf("vfio-user:%s", sock_name);
-
if (udev->send_queued) {
proxy->flags |= VFIO_PROXY_FORCE_QUEUED;
}
--
2.43.0
On 4/24/26 05:22, zhaoguohan@kylinos.cn wrote:
> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
>
> vfio_user_pci_realize() assigns vbasedev->name before connecting to the
> server, then assigns the same name again after installing the request
> handler. The second assignment overwrites the first allocation, so only
> the second string can be freed later by vfio_device_free_name().
>
> Drop the duplicate assignment and keep the first name allocation, which is
> also available on connection failures for error reporting.
>
> Fixes: 36227628d824 ("vfio-user: implement message send infrastructure")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
> hw/vfio-user/pci.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
> index facc79727acb..e7573d4a9f08 100644
> --- a/hw/vfio-user/pci.c
> +++ b/hw/vfio-user/pci.c
> @@ -280,8 +280,6 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)
> vbasedev->proxy = proxy;
> vfio_user_set_handler(vbasedev, vfio_user_pci_process_req, vdev);
>
> - vbasedev->name = g_strdup_printf("vfio-user:%s", sock_name);
> -
> if (udev->send_queued) {
> proxy->flags |= VFIO_PROXY_FORCE_QUEUED;
> }
Applied to
https://github.com/legoater/qemu vfio-next
Please base future contributions on this branch.
Thanks,
C.
On Fri, Apr 24, 2026 at 11:22:09AM +0800, zhaoguohan@kylinos.cn wrote:
> vfio_user_pci_realize() assigns vbasedev->name before connecting to the
> server, then assigns the same name again after installing the request
> handler. The second assignment overwrites the first allocation, so only
> the second string can be freed later by vfio_device_free_name().
>
> Drop the duplicate assignment and keep the first name allocation, which is
> also available on connection failures for error reporting.
>
> Fixes: 36227628d824 ("vfio-user: implement message send infrastructure")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: John Levon <john.levon@nutanix.com>
regards
john
© 2016 - 2026 Red Hat, Inc.