Module Name: src
Committed By: christos
Date: Fri Jul 20 02:23:35 UTC 2012
Modified Files:
src/sys/dev/usb: usb.c
Log Message:
don't access memory outside the array bounds.
To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/usb/usb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.132 src/sys/dev/usb/usb.c:1.133
--- src/sys/dev/usb/usb.c:1.132 Tue Jul 17 06:33:46 2012
+++ src/sys/dev/usb/usb.c Thu Jul 19 22:23:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.132 2012/07/17 10:33:46 cegger Exp $ */
+/* $NetBSD: usb.c,v 1.133 2012/07/20 02:23:35 christos Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.132 2012/07/17 10:33:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.133 2012/07/20 02:23:35 christos Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usb.h"
@@ -362,15 +362,14 @@ usb_add_task(usbd_device_handle dev, str
void
usb_rem_task(usbd_device_handle dev, struct usb_task *task)
{
- struct usb_taskq *taskq;
- taskq = &usb_taskq[task->queue];
- mutex_enter(&taskq->lock);
if (task->queue != -1) {
+ struct usb_taskq *taskq = &usb_taskq[task->queue];
+ mutex_enter(&taskq->lock);
TAILQ_REMOVE(&taskq->tasks, task, next);
task->queue = -1;
+ mutex_exit(&taskq->lock);
}
- mutex_exit(&taskq->lock);
}
void