Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/usb Drop/re-acquire the pipe lock when destroyi...



details:   https://anonhg.NetBSD.org/src/rev/e77f400f3065
branches:  nick-nhusb
changeset: 334352:e77f400f3065
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Dec 28 10:13:45 2015 +0000

description:
Drop/re-acquire the pipe lock when destroying up_intrxfer.  The fini
methods expect to be called unlocked.

diffstat:

 sys/dev/usb/usbdi.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 95d8e04351ef -r e77f400f3065 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Mon Dec 28 09:26:33 2015 +0000
+++ b/sys/dev/usb/usbdi.c       Mon Dec 28 10:13:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.162.2.40 2015/12/28 09:26:33 skrll Exp $   */
+/*     $NetBSD: usbdi.c,v 1.162.2.41 2015/12/28 10:13:45 skrll Exp $   */
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.40 2015/12/28 09:26:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.41 2015/12/28 10:13:45 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -253,8 +253,13 @@
 
        LIST_REMOVE(pipe, up_next);
        pipe->up_endpoint->ue_refcnt--;
-       if (pipe->up_intrxfer != NULL)
+
+       if (pipe->up_intrxfer != NULL) {
+               usbd_unlock_pipe(pipe);
                usbd_destroy_xfer(pipe->up_intrxfer);
+               usbd_lock_pipe(pipe);
+       }
+
        pipe->up_methods->upm_close(pipe);
        usbd_unlock_pipe(pipe);
        kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);



Home | Main Index | Thread Index | Old Index