Module Name:    src
Committed By:   riastradh
Date:           Thu Jun 24 08:20:42 UTC 2021

Modified Files:
        src/sys/dev/usb: ucom.c

Log Message:
ucom(4): Fix earlier mistake causing pipes not to be closed.

In revision 1.123, mrg@ changed what he thought was a double-close,
but was actually abort&close (as is appropriate) to just abort (which
is not enough -- leaks the pipe).  This restores the abort&close.

The original `bug' was found by code inspection, whereas this bug was
found by asserting in usb_subr.c that no pipes are open on device
disconnection after detach; the asserts actually triggered with
several ucom(4) devices, and no longer trigger with this change.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/usb/ucom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.128 src/sys/dev/usb/ucom.c:1.129
--- src/sys/dev/usb/ucom.c:1.128	Mon Oct 26 12:24:10 2020
+++ src/sys/dev/usb/ucom.c	Thu Jun 24 08:20:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $	*/
+/*	$NetBSD: ucom.c,v 1.129 2021/06/24 08:20:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.129 2021/06/24 08:20:42 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -414,11 +414,9 @@ ucom_detach(device_t self, int flags)
 
 	if (sc->sc_bulkin_pipe != NULL) {
 		usbd_abort_pipe(sc->sc_bulkin_pipe);
-		sc->sc_bulkin_pipe = NULL;
 	}
 	if (sc->sc_bulkout_pipe != NULL) {
 		usbd_abort_pipe(sc->sc_bulkout_pipe);
-		sc->sc_bulkout_pipe = NULL;
 	}
 
 	mutex_enter(&sc->sc_lock);

Reply via email to