Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb fix locking for isoc transfers, as reported (and...



details:   https://anonhg.NetBSD.org/src/rev/e1ab26346094
branches:  trunk
changeset: 779835:e1ab26346094
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Jun 22 00:12:23 2012 +0000

description:
fix locking for isoc transfers, as reported (and the fix tested) by prlw1.

diffstat:

 sys/dev/usb/ehci.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 11e540898aea -r e1ab26346094 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Thu Jun 21 23:29:23 2012 +0000
+++ b/sys/dev/usb/ehci.c        Fri Jun 22 00:12:23 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.191 2012/06/19 07:15:41 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.192 2012/06/22 00:12:23 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.191 2012/06/19 07:15:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.192 2012/06/22 00:12:23 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2892,7 +2892,7 @@
        int i, offs, frindex, previndex;
        usb_dma_t dma;
 
-       KASSERT(mutex_owned(&sc->sc_lock));
+       mutex_enter(&sc->sc_lock);
 
        /* Find an itd that wasn't freed this frame or last frame. This can
         * discard itds that were freed before frindex wrapped around
@@ -2918,6 +2918,7 @@
 
                if (err) {
                        DPRINTF(("ehci_alloc_itd, alloc returned %d\n", err));
+                       mutex_exit(&sc->sc_lock);
                        return NULL;
                }
 
@@ -2944,6 +2945,8 @@
        itd->xfer_next = NULL;
        itd->slot = 0;
 
+       mutex_exit(&sc->sc_lock);
+
        return itd;
 }
 



Home | Main Index | Thread Index | Old Index