From: GuoHan Zhao <[email protected]>

vfio_ccw_register_irq_notifier() cleans up the fd handler and EventNotifier
when vfio_device_irq_set_signaling() fails, but still returns true to its
caller.

Return false after cleanup so the caller can handle the failed
registration path instead of treating it as a successful notifier setup.

Fixes: 8aaeff97acee ("vfio/ccw: Make vfio_ccw_register_irq_notifier() return a 
bool")
Signed-off-by: GuoHan Zhao <[email protected]>
Reviewed-by: Eric Farman <[email protected]>
Reviewed-by: Matthew Rosato <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Link: 
https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
---
 hw/vfio/ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 
ff6ab9a7408f01b9e64ba06f2c8da4a69fa1f9ff..c3dc7c19623556ea452344b8e4b76fb9a56206c7
 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -431,6 +431,7 @@ static bool vfio_ccw_register_irq_notifier(VFIOCCWDevice 
*vcdev,
                                        VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) 
{
         qemu_set_fd_handler(fd, NULL, NULL, vcdev);
         event_notifier_cleanup(notifier);
+        return false;
     }
 
     return true;
-- 
2.54.0


Reply via email to