Browse Source

vfio: fix possible use after free of vfio group

The vfio group should be released after
the vfio_group_try_dissolve_container call.
The code should not rely on someone else to hold
a reference on the group.

Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Ilya Lesokhin 9 years ago
parent
commit
d370c917b9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/vfio/vfio.c

+ 1 - 1
drivers/vfio/vfio.c

@@ -1711,8 +1711,8 @@ EXPORT_SYMBOL_GPL(vfio_group_get_external_user);
 
 void vfio_group_put_external_user(struct vfio_group *group)
 {
-	vfio_group_put(group);
 	vfio_group_try_dissolve_container(group);
+	vfio_group_put(group);
 }
 EXPORT_SYMBOL_GPL(vfio_group_put_external_user);