Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Ignore completed transfers when detaching. This ...



details:   https://anonhg.NetBSD.org/src/rev/7ecbeab532d6
branches:  trunk
changeset: 348026:7ecbeab532d6
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Oct 01 11:09:12 2016 +0000

description:
Ignore completed transfers when detaching. This avoids a race condition
where the detach code has already freed the xfer structures.

diffstat:

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

diffs (28 lines):

diff -r d3582924200b -r 7ecbeab532d6 sys/dev/usb/if_run.c
--- a/sys/dev/usb/if_run.c      Sat Oct 01 11:07:30 2016 +0000
+++ b/sys/dev/usb/if_run.c      Sat Oct 01 11:09:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_run.c,v 1.19 2016/10/01 11:07:30 mlelstv Exp $      */
+/*     $NetBSD: if_run.c,v 1.20 2016/10/01 11:09:12 mlelstv Exp $      */
 /*     $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.19 2016/10/01 11:07:30 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.20 2016/10/01 11:09:12 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -2335,6 +2335,9 @@
        uint32_t dmalen;
        int xferlen;
 
+       if (__predict_false(sc->sc_flags & RUN_DETACHING))
+               return;
+
        if (__predict_false(status != USBD_NORMAL_COMPLETION)) {
                DPRINTF(("RX status=%d\n", status));
                if (status == USBD_STALLED)



Home | Main Index | Thread Index | Old Index