@samitouri / QOSamiQemu / commits / 52342c3067

hw/remote: guard listener unregister in finalize

Guard the unregister by checking whether the listener callback was set, which only happens right before registration. Cc: jag.raman@oracle.com Fixes: c7d80c7c1d9 ("multi-process: Associate fd of a PCIDevice with its object") Reviewed-by: Jagannathan Raman <jag.raman@oracle.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Apr 25, 2026 at 01:00 UTC 52342c306747de0773093bd03029df3c5f7d1c7b
1 file changed +3 -1
hw/remote/remote-obj.c
+3 -1
@@ -154,7 +154,9 @@ static void remote_object_finalize(Object *obj)
154 RemoteObjectClass *k = REMOTE_OBJECT_GET_CLASS(obj);
155 RemoteObject *o = REMOTE_OBJECT(obj);
156
157 - device_listener_unregister(&o->listener);
157 + if (o->listener.unrealize) {
158 + device_listener_unregister(&o->listener);
159 + }
160
161 if (o->ioc) {
162 qio_channel_shutdown(o->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);