diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-09-26 20:14:03 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-09-26 20:14:03 +0000 |
commit | 9da4982eda20c0a3cb5a6aa2d932e9d17462e108 (patch) | |
tree | efa8aef087d87c9b6850105e4e8c5196627994e8 /sys/dev | |
parent | 5918c1e495019411d85d56162501e91d4705e029 (diff) | |
download | FreeBSD-src-9da4982eda20c0a3cb5a6aa2d932e9d17462e108.zip FreeBSD-src-9da4982eda20c0a3cb5a6aa2d932e9d17462e108.tar.gz |
o Modify access control code for /dev/pci device to use securelevel_gt()
instead of direct securelevel variable test.
Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/pci_user.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 6968241..6131a43 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -37,6 +37,7 @@ #include <sys/fcntl.h> #include <sys/conf.h> #include <sys/kernel.h> +#include <sys/proc.h> #include <sys/queue.h> #include <sys/types.h> @@ -87,10 +88,15 @@ struct cdevsw pcicdev = { static int pci_open(dev_t dev, int oflags, int devtype, struct thread *td) { - if ((oflags & FWRITE) && securelevel > 0) { - return EPERM; + int error; + + if (oflags & FWRITE) { + error = securelevel_gt(td->td_proc->p_ucred, 0); + if (error) + return (error); } - return 0; + + return (0); } static int |