Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb two locking fixes (from PR/45909)



details:   https://anonhg.NetBSD.org/src/rev/ef60ffcdfa83
branches:  trunk
changeset: 773576:ef60ffcdfa83
user:      plunky <plunky%NetBSD.org@localhost>
date:      Tue Feb 07 11:40:24 2012 +0000

description:
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)

diffstat:

 sys/dev/usb/umidi.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 7489d6da8306 -r ef60ffcdfa83 sys/dev/usb/umidi.c
--- a/sys/dev/usb/umidi.c       Tue Feb 07 10:36:01 2012 +0000
+++ b/sys/dev/usb/umidi.c       Tue Feb 07 11:40:24 2012 +0000
@@ -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 @@
 error:
        aprint_error_dev(self, "disabled.\n");
        sc->sc_dying = 1;
+       KERNEL_UNLOCK_ONE(curlwp);
        return;
 }
 
@@ -1125,7 +1126,9 @@
        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--;



Home | Main Index | Thread Index | Old Index