Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Check for write permission for some ioctls.
details: https://anonhg.NetBSD.org/src/rev/57fe6d30191e
branches: trunk
changeset: 526000:57fe6d30191e
user: augustss <augustss%NetBSD.org@localhost>
date: Tue Apr 23 06:34:11 2002 +0000
description:
Check for write permission for some ioctls.
diffstat:
sys/dev/usb/usb.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (45 lines):
diff -r 7851751280a3 -r 57fe6d30191e sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Tue Apr 23 06:10:42 2002 +0000
+++ b/sys/dev/usb/usb.c Tue Apr 23 06:34:11 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $ */
+/* $NetBSD: usb.c,v 1.69 2002/04/23 06:34:11 augustss Exp $ */
/*
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.69 2002/04/23 06:34:11 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,6 +54,7 @@
#include <sys/kthread.h>
#include <sys/proc.h>
#include <sys/conf.h>
+#include <sys/fcntl.h>
#include <sys/poll.h>
#include <sys/select.h>
#include <sys/vnode.h>
@@ -466,6 +467,8 @@
switch (cmd) {
#ifdef USB_DEBUG
case USB_SETDEBUG:
+ if (!(flag & FWRITE))
+ return (EBADF);
usbdebug = ((*(int *)data) & 0x000000ff);
#ifdef UHCI_DEBUG
uhcidebug = ((*(int *)data) & 0x0000ff00) >> 8;
@@ -486,6 +489,9 @@
usbd_status err;
int error = 0;
+ if (!(flag & FWRITE))
+ return (EBADF);
+
DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%d\n", addr, len));
if (len < 0 || len > 32768)
return (EINVAL);
Home |
Main Index |
Thread Index |
Old Index