Confidential - Oracle Restricted \Including External Recipients




Confidential - Oracle Restricted \Including External Recipients

From: Marc-André Lureau <[email protected]>
Date: Monday, May 4, 2026 at 7:36 AM
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Marc-André Lureau 
<[email protected]>; Jag Raman <[email protected]>
Subject: [PATCH v2 11/46] hw/remote: guard listener unregister in finalize

Guard the unregister by checking whether the listener callback was
set, which only happens right before registration.

This is probably better addressed by "[PATCH] qdev: test if DeviceListener
is in use". Just adding this patch for completeness.

Cc: [email protected]
Fixes: c7d80c7c1d9 ("multi-process: Associate fd of a PCIDevice with its 
object")
Signed-off-by: Marc-André Lureau <[email protected]>

Looks good to me.

Reviewed-by: Jagannathan Raman <[email protected]>

---
 hw/remote/remote-obj.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/remote/remote-obj.c b/hw/remote/remote-obj.c
index 86192dc8dad..4e74ae76158 100644
--- a/hw/remote/remote-obj.c
+++ b/hw/remote/remote-obj.c
@@ -154,7 +154,9 @@ static void remote_object_finalize(Object *obj)
     RemoteObjectClass *k = REMOTE_OBJECT_GET_CLASS(obj);
     RemoteObject *o = REMOTE_OBJECT(obj);

-    device_listener_unregister(&o->listener);
+    if (o->listener.unrealize) {
+        device_listener_unregister(&o->listener);
+    }

     if (o->ioc) {
         qio_channel_shutdown(o->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);

--
2.54.0

Reply via email to