Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix locking in slhci_roothub_ctrl



details:   https://anonhg.NetBSD.org/src/rev/106eb379e049
branches:  trunk
changeset: 345209:106eb379e049
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu May 12 18:57:38 2016 +0000

description:
Fix locking in slhci_roothub_ctrl

diffstat:

 sys/dev/ic/sl811hs.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 11beef04e51c -r 106eb379e049 sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Thu May 12 15:27:54 2016 +0000
+++ b/sys/dev/ic/sl811hs.c      Thu May 12 18:57:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $       */
+/*     $NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $       */
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -3171,9 +3171,11 @@
                break;
        case UR_SET_FEATURE:
                if (type == UT_WRITE_CLASS_OTHER) {
-                       if (index == 1 /* Port */)
+                       if (index == 1 /* Port */) {
+                               mutex_enter(&sc->sc_intr_lock);
                                error = slhci_set_feature(sc, value);
-                       else
+                               mutex_exit(&sc->sc_intr_lock);
+                       } else
                                DLOG(D_ROOT, "Set Port Feature "
                                    "index = %#.4x", index, 0,0,0);
                } else if (type != UT_WRITE_CLASS_DEVICE)
@@ -3187,8 +3189,10 @@
                if (type == UT_READ_CLASS_OTHER) {
                        if (index == 1 /* Port */ && len == /* XXX >=? */
                            sizeof(usb_port_status_t)) {
+                               mutex_enter(&sc->sc_intr_lock);
                                slhci_get_status(sc, (usb_port_status_t *)
                                    buf);
+                               mutex_exit(&sc->sc_intr_lock);
                                actlen = sizeof(usb_port_status_t);
                                error = USBD_NORMAL_COMPLETION;
                        } else



Home | Main Index | Thread Index | Old Index