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 the detach path to prevent panic:



details:   https://anonhg.NetBSD.org/src/rev/756fc9e68917
branches:  trunk
changeset: 451775:756fc9e68917
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jun 03 09:58:31 2019 +0000

description:
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().

diffstat:

 sys/dev/usb/if_athn_usb.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 8a542a1fb5af -r 756fc9e68917 sys/dev/usb/if_athn_usb.c
--- a/sys/dev/usb/if_athn_usb.c Mon Jun 03 09:56:08 2019 +0000
+++ b/sys/dev/usb/if_athn_usb.c Mon Jun 03 09:58:31 2019 +0000
@@ -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_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_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 @@
                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



Home | Main Index | Thread Index | Old Index