[PATCH 11/11] drm/amdkfd: Set /dev/kfd permissions to 0666 by default

Oded Gabbay oded.gabbay at gmail.com
Sun Sep 17 07:38:42 UTC 2017


On Sat, Sep 16, 2017 at 2:43 AM, Felix Kuehling <Felix.Kuehling at amd.com> wrote:
> From: Andres Rodriguez <andres.rodriguez at amd.com>
>
> Set the default permissions of /dev/kfd to be more than just root
> accessible 600.
>
I don't think that's acceptable.
You need to use udev rules file for that.

Oded

> Signed-off-by: Andres Rodriguez <andres.rodriguez at amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling at 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list