summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2010-08-29 15:12:29 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2010-08-29 15:12:29 +0000
commitde463b77e4850a17773d722cd16952cf80c2f168 (patch)
treed94bf89399eb8698176bae0bcc50789925f6fe7d
parent2f68451a30053a351f74be6000bcd7470ce14903 (diff)
- add a missing ioctl FWRITE check
ok miod@
-rw-r--r--sys/dev/bluetooth/bthub.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/bluetooth/bthub.c b/sys/dev/bluetooth/bthub.c
index e5d209e034c..3527784c974 100644
--- a/sys/dev/bluetooth/bthub.c
+++ b/sys/dev/bluetooth/bthub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bthub.c,v 1.4 2008/02/24 21:46:19 uwe Exp $ */
+/* $OpenBSD: bthub.c,v 1.5 2010/08/29 15:12:28 jasper Exp $ */
/*
* Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
@@ -21,6 +21,7 @@
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
+#include <sys/fcntl.h>
#include <sys/vnode.h>
#include <netbt/bluetooth.h>
@@ -160,6 +161,15 @@ bthubioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
switch (cmd) {
case BTDEV_ATTACH:
case BTDEV_DETACH:
+ if ((flag & FWRITE) == 0)
+ return (EACCES);
+ default:
+ break;
+ }
+
+ switch (cmd) {
+ case BTDEV_ATTACH:
+ case BTDEV_DETACH:
bd = (struct btdev_attach_args *)data;
err = bthub_devioctl(dev, cmd, bd);
break;