diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 6968241681bb..6131a43489e8 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -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