diff options
author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2025-06-23 18:22:32 +0800 |
---|---|---|
committer | Cédric Le Goater <clg@redhat.com> | 2025-06-26 08:55:37 +0200 |
commit | abc6249d42f9681d5b659716434ef374c6e0edef (patch) | |
tree | 2f81ae5ff93475dadd3096c7664c1ecc0765dd0a | |
parent | eafb408629d980dac7db24abe5b8fab2c7a67525 (diff) | |
download | qemu-abc6249d42f9681d5b659716434ef374c6e0edef.zip qemu-abc6249d42f9681d5b659716434ef374c6e0edef.tar.gz qemu-abc6249d42f9681d5b659716434ef374c6e0edef.tar.bz2 |
vfio/container: Fix SIGSEGV when open container file fails
When open /dev/vfio/vfio fails, SIGSEGV triggers because
vfio_listener_unregister() doesn't support a NULL bcontainer
pointer.
Fixes: a1f267a7d4d9 ("vfio/container: reform vfio_container_connect cleanup")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250623102235.94877-2-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
-rw-r--r-- | hw/vfio/container.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 3e8d645..2853f6f 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -710,7 +710,9 @@ static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as, return true; fail: - vfio_listener_unregister(bcontainer); + if (new_container) { + vfio_listener_unregister(bcontainer); + } if (group_was_added) { vfio_container_group_del(container, group); |