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

30 lines
1.0 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).
---
logind-acl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- systemd-209/src/login/logind-acl.c
+++ systemd-209/src/login/logind-acl.c 2014-02-28 17:27:51.806239118 +0000
@@ -283,5 +283,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 i;
+ for (i = 0; i <= 256 ; i++) {
+ _cleanup_free_ char *devname = NULL;
+ if (asprintf(&devname, "/dev/nvidia%d", i) < 0)
+ break;
+ if (devnode_acl(devname, flush, del, old_uid, add, new_uid) < 0)
+ break;
+ }
+ }
+
return r;
}