aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2013-08-22 12:33:41 -0400
committerAlex Williamson <alex.williamson@redhat.com>2013-08-22 12:33:41 -0400
commit5d042fbdbb2df46c9185942a0c6fe280906ba70c (patch)
tree87483859f6ac5cdd04209e6e0b16ec131766232c /drivers/vfio
parenta5d550703d2c2f0f9fc5fd4a249efa8984dc9353 (diff)
vfio: Add O_CLOEXEC flag to vfio device fd
Add the default O_CLOEXEC flag for device file descriptors. This is generally considered a safer option as it allows the user a race free option to decide whether file descriptors are inherited across exec, with the default avoiding file descriptor leaks. Reported-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 75c16cc5921a..1eab4ace0671 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1109,7 +1109,7 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
1109 * We can't use anon_inode_getfd() because we need to modify 1109 * We can't use anon_inode_getfd() because we need to modify
1110 * the f_mode flags directly to allow more than just ioctls 1110 * the f_mode flags directly to allow more than just ioctls
1111 */ 1111 */
1112 ret = get_unused_fd_flags(0); 1112 ret = get_unused_fd_flags(O_CLOEXEC);
1113 if (ret < 0) { 1113 if (ret < 0) {
1114 device->ops->release(device->device_data); 1114 device->ops->release(device->device_data);
1115 break; 1115 break;