diff options
author | bde <bde@FreeBSD.org> | 1999-12-26 11:44:45 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1999-12-26 11:44:45 +0000 |
commit | 6435e2560e3103a14a4e67820a4c1f45a5b99be1 (patch) | |
tree | e1594fc2859d854c6562649fd51d08d8dd4e88a9 /sys | |
parent | 259b04149b01f22de9d796608f635cce975d1693 (diff) | |
download | FreeBSD-src-6435e2560e3103a14a4e67820a4c1f45a5b99be1.zip FreeBSD-src-6435e2560e3103a14a4e67820a4c1f45a5b99be1.tar.gz |
Fixed breakage of read-only opening of /dev/*mem at securelevel > 0 in
previous pair of commits.
Spell the "securelevel > 0" check consistently.
Use the proc arg instead of curproc in mmopen() and mmclose().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/mem.c | 7 | ||||
-rw-r--r-- | sys/i386/i386/mem.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 96c62a6..bb96e18 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -48,6 +48,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> +#include <sys/fcntl.h> #include <sys/buf.h> #include <sys/kernel.h> #include <sys/uio.h> @@ -112,7 +113,7 @@ mmclose(dev, flags, fmt, p) { switch (minor(dev)) { case 14: - curproc->p_md.md_regs->tf_eflags &= ~PSL_IOPL; + p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; break; default: break; @@ -132,7 +133,7 @@ mmopen(dev, flags, fmt, p) switch (minor(dev)) { case 0: case 1: - if (securelevel >= 1) + if ((flags & FWRITE) && securelevel > 0) return (EPERM); break; case 14: @@ -141,7 +142,7 @@ mmopen(dev, flags, fmt, p) return (error); if (securelevel > 0) return (EPERM); - curproc->p_md.md_regs->tf_eflags |= PSL_IOPL; + p->p_md.md_regs->tf_eflags |= PSL_IOPL; break; default: break; diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 96c62a6..bb96e18 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -48,6 +48,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> +#include <sys/fcntl.h> #include <sys/buf.h> #include <sys/kernel.h> #include <sys/uio.h> @@ -112,7 +113,7 @@ mmclose(dev, flags, fmt, p) { switch (minor(dev)) { case 14: - curproc->p_md.md_regs->tf_eflags &= ~PSL_IOPL; + p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; break; default: break; @@ -132,7 +133,7 @@ mmopen(dev, flags, fmt, p) switch (minor(dev)) { case 0: case 1: - if (securelevel >= 1) + if ((flags & FWRITE) && securelevel > 0) return (EPERM); break; case 14: @@ -141,7 +142,7 @@ mmopen(dev, flags, fmt, p) return (error); if (securelevel > 0) return (EPERM); - curproc->p_md.md_regs->tf_eflags |= PSL_IOPL; + p->p_md.md_regs->tf_eflags |= PSL_IOPL; break; default: break; |