systemd/apply-ACL-for-nvidia-device-nodes.patch

32 lines
1.1 KiB
Diff

From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: apply ACL for nvidia device nodes
set ACL on nvidia devices (bnc#808319).
---
src/login/logind-acl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Index: systemd-221/src/login/logind-acl.c
===================================================================
--- systemd-221.orig/src/login/logind-acl.c
+++ systemd-221/src/login/logind-acl.c
@@ -285,5 +285,17 @@ int devnode_acl_all(struct udev *udev,
r = k;
}
+ /* only apply ACL on nvidia* if /dev/nvidiactl exists */
+ if (devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid) >= 0) {
+ int j;
+ for (j = 0; j <= 256 ; j++) {
+ _cleanup_free_ char *devname = NULL;
+ if (asprintf(&devname, "/dev/nvidia%d", j) < 0)
+ break;
+ if (devnode_acl(devname, flush, del, old_uid, add, new_uid) < 0)
+ break;
+ }
+ }
+
return r;
}