From: Andres Rodriguez <andres.rodrig...@amd.com>

Set the default permissions of /dev/kfd to be more than just root
accessible 600.

Signed-off-by: Andres Rodriguez <andres.rodrig...@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehl...@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index e4a8c2e..1ad9901 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -55,6 +55,14 @@ static int kfd_char_dev_major = -1;
 static struct class *kfd_class;
 struct device *kfd_device;
 
+static char *kfd_devnode(struct device *dev, umode_t *mode)
+{
+       if (mode && dev->devt == MKDEV(kfd_char_dev_major, 0))
+               *mode = 0666;
+
+       return NULL;
+}
+
 int kfd_chardev_init(void)
 {
        int err = 0;
@@ -69,6 +77,8 @@ int kfd_chardev_init(void)
        if (IS_ERR(kfd_class))
                goto err_class_create;
 
+       kfd_class->devnode = kfd_devnode;
+
        kfd_device = device_create(kfd_class, NULL,
                                        MKDEV(kfd_char_dev_major, 0),
                                        NULL, kfd_dev_name);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to