vfio: don't dereference after kfree...
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 9591e2b..0b025d5 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -416,8 +416,9 @@
/* Device reference always implies a group reference */
static void vfio_device_put(struct vfio_device *device)
{
+ struct vfio_group *group = device->group;
kref_put(&device->kref, vfio_device_release);
- vfio_group_put(device->group);
+ vfio_group_put(group);
}
static void vfio_device_get(struct vfio_device *device)