Module Name:    src
Committed By:   msaitoh
Date:           Mon Jun  3 09:58:31 UTC 2019

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

Log Message:
Fix the detach path to prevent panic:
 - Fix athn_usb_free_tx_list(). usc->usc_tx_bcn->xfer is freed in the above
   for () loop, so remove the if block. OK'd by skrll.
 - Add missing athn_usb_free_tx_msg().
 - Add missing athn_usb_stop().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/usb/if_athn_usb.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/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.33 src/sys/dev/usb/if_athn_usb.c:1.34
--- src/sys/dev/usb/if_athn_usb.c:1.33	Mon Jun  3 09:56:08 2019
+++ src/sys/dev/usb/if_athn_usb.c	Mon Jun  3 09:58:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.33 2019/06/03 09:56:08 msaitoh Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.34 2019/06/03 09:58:31 msaitoh Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.33 2019/06/03 09:56:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.34 2019/06/03 09:58:31 msaitoh Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -508,6 +508,7 @@ athn_usb_detach(device_t self, int flags
 
 	athn_usb_wait_async(usc);
 
+	athn_usb_stop(&sc->sc_if, 0);
 	usb_rem_task_wait(usc->usc_udev, &usc->usc_task, USB_TASKQ_DRIVER,
 	    NULL);
 
@@ -523,6 +524,7 @@ athn_usb_detach(device_t self, int flags
 	athn_usb_free_rx_list(usc);
 	athn_usb_free_tx_list(usc);
 	athn_usb_free_tx_cmd(usc);
+	athn_usb_free_tx_msg(usc);
 
 	/* Close Tx/Rx pipes. */
 	athn_usb_close_pipes(usc);
@@ -764,10 +766,6 @@ athn_usb_free_tx_list(struct athn_usb_so
 		if (xfer != NULL)
 			usbd_destroy_xfer(xfer);
 	}
-	if (usc->usc_tx_bcn) {
-		usbd_destroy_xfer(usc->usc_tx_bcn->xfer);
-		usc->usc_tx_bcn = NULL;
-	}
 }
 
 Static int

Reply via email to