Module Name: src
Committed By: plunky
Date: Tue Feb 7 11:40:24 UTC 2012
Modified Files:
src/sys/dev/usb: umidi.c
Log Message:
two locking fixes (from PR/45909)
- during attach, release kernel lock in error path
- during midiopen, take kernel lock for USB activity
(there are more problems with locking here, this does not fix the PR)
To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/umidi.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/umidi.c
diff -u src/sys/dev/usb/umidi.c:1.55 src/sys/dev/usb/umidi.c:1.56
--- src/sys/dev/usb/umidi.c:1.55 Fri Dec 23 00:51:47 2011
+++ src/sys/dev/usb/umidi.c Tue Feb 7 11:40:24 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: umidi.c,v 1.55 2011/12/23 00:51:47 jakllsch Exp $ */
+/* $NetBSD: umidi.c,v 1.56 2012/02/07 11:40:24 plunky Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.55 2011/12/23 00:51:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.56 2012/02/07 11:40:24 plunky Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -255,6 +255,7 @@ umidi_attach(device_t parent, device_t s
error:
aprint_error_dev(self, "disabled.\n");
sc->sc_dying = 1;
+ KERNEL_UNLOCK_ONE(curlwp);
return;
}
@@ -1125,7 +1126,9 @@ open_in_jack(struct umidi_jack *jack, vo
jack->u.in.intr = intr;
jack->opened = 1;
if (ep->num_open++ == 0 && UE_GET_DIR(ep->addr)==UE_DIR_IN) {
+ KERNEL_LOCK(1, curlwp);
err = start_input_transfer(ep);
+ KERNEL_UNLOCK_ONE(curlwp);
if (err != USBD_NORMAL_COMPLETION &&
err != USBD_IN_PROGRESS) {
ep->num_open--;