drm: Branch 'master'

[email protected] (GitLab Mirror) Wed, 18 Jul 2018 07:31:15 +0000 (UTC)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 amdgpu/amdgpu_device.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 4fa33e45e6d919b144d307934f372c82bc498c3c
Author: Christian König <[email protected]>
Date:   Tue Jul 17 11:04:31 2018 +0200

    amdgpu: make sure to set CLOEXEC on duplicated FDs
    
    Otherwise we leak file descriptors into child processes.
    
    Signed-off-by: Christian König <[email protected]>
    Reviewed-and-Tested-by: Junwei Zhang <[email protected]>
    Reviewed-by: Michel Dänzer <[email protected]>

diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 34ac95b8..d7aec6a4 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #include "xf86drm.h"
 #include "amdgpu_drm.h"
@@ -205,7 +206,7 @@ int amdgpu_device_initialize(int fd,
 			return r;
 		}
 		if ((flag_auth) && (!flag_authexist)) {
-			dev->flink_fd = dup(fd);
+			dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
 		}
 		*major_version = dev->major_version;
 		*minor_version = dev->minor_version;
@@ -239,7 +240,7 @@ int amdgpu_device_initialize(int fd,
 		goto cleanup;
 	}
 
-	dev->fd = dup(fd);
+	dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
 	dev->flink_fd = dev->fd;
 	dev->major_version = version->version_major;
 	dev->minor_version = version->version_minor;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches