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: a1f267a7d4 ("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>
This commit is contained in:
parent
eafb408629
commit
abc6249d42
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue