summaryrefslogtreecommitdiffstats
path: root/sys/dev/an
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2000-06-18 23:40:09 +0000
committerroberto <roberto@FreeBSD.org>2000-06-18 23:40:09 +0000
commit2628a3eeecdf7ff471eb9cbb186b05e72b47398d (patch)
treecceaf5c90bdc8fb538524c28c8d3fd88ccea59da /sys/dev/an
parent645dbbcce1d2b937a1a41018bf6b6a854813e4d6 (diff)
downloadFreeBSD-src-2628a3eeecdf7ff471eb9cbb186b05e72b47398d.zip
FreeBSD-src-2628a3eeecdf7ff471eb9cbb186b05e72b47398d.tar.gz
- Add suser check before SIOCSAIRONET.
- Fix a splimp() w/o splx bug in the ioctl routine while I'm here. Submitted by: Aaron Campbell <aaron@openbsd.org>
Diffstat (limited to 'sys/dev/an')
-rw-r--r--sys/dev/an/if_an.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c
index 34a5263..8abf07b 100644
--- a/sys/dev/an/if_an.c
+++ b/sys/dev/an/if_an.c
@@ -95,6 +95,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>
#ifdef ANCACHE
#include <sys/syslog.h>
@@ -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);
OpenPOWER on IntegriCloud