summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-05-30 22:20:42 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-05-30 22:20:42 +0000
commitbd47d4f00a2974c730adb0ed1052a3cbdbbc0500 (patch)
tree33c5fe0189ade6b0feb40a9f7ef36232fcada255
parent9d8b92ac9a688d42e3cbf49fafc55a872bf4223a (diff)
restrict the prio values from SIOCSIFLLPRIO to what the kernel handles
previously the ioctl code checked that prio was an int less than UCHAR_MAX, but the rest of the kernel (and priq code in particular) expects it to be between 0 and 7 inclusive. ok krw@ tb@
-rw-r--r--sys/net/if.c5
-rw-r--r--sys/net/if.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 53eba3f281c..d91708c8185 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.553 2018/05/30 18:15:47 sthen Exp $ */
+/* $OpenBSD: if.c,v 1.554 2018/05/30 22:20:41 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -2114,7 +2114,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
case SIOCSIFLLPRIO:
if ((error = suser(p)))
break;
- if (ifr->ifr_llprio > UCHAR_MAX) {
+ if (ifr->ifr_llprio < IFQ_MINPRIO ||
+ ifr->ifr_llprio > IFQ_MAXPRIO) {
error = EINVAL;
break;
}
diff --git a/sys/net/if.h b/sys/net/if.h
index d91ad1f5b9a..33f355dd161 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.193 2018/04/25 16:05:58 jca Exp $ */
+/* $OpenBSD: if.h,v 1.194 2018/05/30 22:20:41 dlg Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -126,6 +126,7 @@ struct if_data {
};
#define IFQ_NQUEUES 8
+#define IFQ_MINPRIO 0
#define IFQ_MAXPRIO IFQ_NQUEUES - 1
#define IFQ_DEFPRIO 3