diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 47e927bfc119..1e040ab4e699 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.15 1995/10/28 16:57:55 markm Exp $ + * $Id: mem.c,v 1.16 1995/10/29 11:37:56 bde Exp $ */ /* @@ -351,12 +351,20 @@ mmioctl(dev, cmd, cmdarg, flags, p) struct proc *p; { #ifdef DEVRANDOM + int error; + if (minor(dev) != 3 && minor(dev) != 4) return (ENODEV); if (*(u_int16_t *)cmdarg >= 16) return (EINVAL); + /* Only root can do this */ + error = suser(p->p_ucred, &p->p_acflag); + if (error != 0) { + return (error); + } + switch (cmd){ case MEM_SETIRQ: diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 47e927bfc119..1e040ab4e699 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.15 1995/10/28 16:57:55 markm Exp $ + * $Id: mem.c,v 1.16 1995/10/29 11:37:56 bde Exp $ */ /* @@ -351,12 +351,20 @@ mmioctl(dev, cmd, cmdarg, flags, p) struct proc *p; { #ifdef DEVRANDOM + int error; + if (minor(dev) != 3 && minor(dev) != 4) return (ENODEV); if (*(u_int16_t *)cmdarg >= 16) return (EINVAL); + /* Only root can do this */ + error = suser(p->p_ucred, &p->p_acflag); + if (error != 0) { + return (error); + } + switch (cmd){ case MEM_SETIRQ: