From dac32750573182dbad081ffd6d36a16fc64c1e6d Mon Sep 17 00:00:00 2001 From: Ollivier Robert Date: Sun, 18 Jun 2000 23:40:09 +0000 Subject: [PATCH] - Add suser check before SIOCSAIRONET. - Fix a splimp() w/o splx bug in the ioctl routine while I'm here. Submitted by: Aaron Campbell --- sys/dev/an/if_an.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 34a5263bda7..8abf07ba92f 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -95,6 +95,8 @@ #include #include #include +#include +#include #include #ifdef ANCACHE #include @@ -968,14 +970,17 @@ static int an_ioctl(ifp, command, data) struct an_softc *sc; struct an_req areq; struct ifreq *ifr; + struct proc *p = curproc; s = splimp(); sc = ifp->if_softc; ifr = (struct ifreq *)data; - if (sc->an_gone) - return(ENODEV); + if(sc->an_gone) { + error = ENODEV; + goto out; + } switch(command) { case SIOCSIFADDR: @@ -1034,6 +1039,8 @@ static int an_ioctl(ifp, command, data) error = copyout(&areq, ifr->ifr_data, sizeof(areq)); break; case SIOCSAIRONET: + if ((error = suser(p))) + goto out; error = copyin(ifr->ifr_data, &areq, sizeof(areq)); if (error) break; @@ -1043,7 +1050,7 @@ static int an_ioctl(ifp, command, data) error = EINVAL; break; } - +out: splx(s); return(error);