Skip to content

Commit 31605de

Browse files
author
Al Viro
committed
vfio: grab vfio_device reference *before* exposing the sucker via fd_install()
It's not critical (anymore) since another thread closing the file will block on ->device_lock before it gets to dropping the final reference, but it's definitely cleaner that way... Acked-by: Alex Williamson <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 90b1253 commit 31605de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/vfio/vfio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,10 +1111,10 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
11111111
*/
11121112
filep->f_mode |= (FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
11131113

1114-
fd_install(ret, filep);
1115-
11161114
vfio_device_get(device);
11171115
atomic_inc(&group->container_users);
1116+
1117+
fd_install(ret, filep);
11181118
break;
11191119
}
11201120
mutex_unlock(&group->device_lock);

0 commit comments

Comments
 (0)