diff options
author | roberto <roberto@FreeBSD.org> | 2000-06-19 00:17:13 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2000-06-19 00:17:13 +0000 |
commit | a275eb84ffb2ebaee95ffb6417167c75d3ccd5ca (patch) | |
tree | e91337661703b33958eeede8a260b6189bfe1fa0 /sys/i386/isa/if_wi.c | |
parent | 9c3dcc7bed8fd16b488c5e3c331dd4e6f6512d47 (diff) | |
download | FreeBSD-src-a275eb84ffb2ebaee95ffb6417167c75d3ccd5ca.zip FreeBSD-src-a275eb84ffb2ebaee95ffb6417167c75d3ccd5ca.tar.gz |
Bring the an(4) fixes to wi(4):
- suser check
- splx() fix.
Reminded by: Aaron Campbell <aaron@openbsd.org>
Diffstat (limited to 'sys/i386/isa/if_wi.c')
-rw-r--r-- | sys/i386/isa/if_wi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c index 441beaf..deb797c 100644 --- a/sys/i386/isa/if_wi.c +++ b/sys/i386/isa/if_wi.c @@ -73,6 +73,8 @@ #include <sys/sockio.h> #include <sys/mbuf.h> #include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/ucred.h> #include <sys/socket.h> #include <sys/module.h> #include <sys/bus.h> @@ -962,14 +964,17 @@ static int wi_ioctl(ifp, command, data) struct wi_softc *sc; struct wi_req wreq; struct ifreq *ifr; + struct proc *p = curproc; s = splimp(); sc = ifp->if_softc; ifr = (struct ifreq *)data; - if (sc->wi_gone) - return(ENODEV); + if (sc->wi_gone) { + error = ENODEV; + goto out; + } switch(command) { case SIOCSIFADDR: @@ -1038,6 +1043,8 @@ static int wi_ioctl(ifp, command, data) error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSWAVELAN: + if ((error = suser(p))) + goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) break; @@ -1057,7 +1064,7 @@ static int wi_ioctl(ifp, command, data) error = EINVAL; break; } - +out: splx(s); return(error); |