virtio: Unregister memory listener when unrealize
PATCH 1/1 virtio: Unregister memory listener when unrealize
Signed-off-by Fam Zheng <[email protected]>
--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +1 -0
@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp) } } +memory_listener_unregister (&vdev->listener);g_free (vdev->bus_name); vdev->bus_name =NULL ; }
Signature · 1 line
2.9.3
Quoted 22 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)hw/virtio/virtio.c +1
-0@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp) } } +memory_listener_unregister (&vdev->listener);g_free (vdev->bus_name); vdev->bus_name =NULL ; }Signature · 1 line
2.9.3
Oops, I think the one in the .finalize() callback should be removed meanwhile.
Fam
Quoted 11 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)hw/virtio/virtio.c +0
-0
hw/virtio/virtio.c static void virtio_device_unrealize(DeviceState *dev, Error **errp) · line 2521
Quoted 7 lines
hw/virtio/virtio.c +1
-0@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp) } } +memory_listener_unregister (&vdev->listener);g_free (vdev->bus_name); vdev->bus_name =NULL ; }
Is this a bug fix? If yes, what exactly's broken without it?
Quoted 16 lines · Markus Armbruster
Quoted 14 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)hw/virtio/virtio.c +0
-0@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp) } }
Quoted 7 lines
hw/virtio/virtio.c static void virtio_device_unrealize(DeviceState *dev, Error **errp) · line 2521
Quoted 4 lines
hw/virtio/virtio.c +1
-0+memory_listener_unregister (&vdev->listener);g_free (vdev->bus_name); vdev->bus_name =NULL ; }Is this a bug fix? If yes, what exactly's broken without it?
I thought it was obvious (missing unregister) but that was a mistake. There is one in virtio_device_instance_finalize(), but the callback is just not called due to something else with the QOM refcnt.
Will revise, and add commit message, of course.
Fam