Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/usb Pull up following revision(s) (requested by s...



details:   https://anonhg.NetBSD.org/src/rev/717f97587099
branches:  netbsd-7
changeset: 800353:717f97587099
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Oct 23 19:15:09 2017 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #1515):
        sys/dev/usb/if_athn_usb.c: revision 1.23
PR/52553 Panic on "ifconfig athn0 up"
Don't race for a transfer in athn_usb_init on the free list for beacons.
Instead pre-assign a transfer to beacons in athn_usb_alloc_tx_list

diffstat:

 sys/dev/usb/if_athn_usb.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r a518f3f7eae6 -r 717f97587099 sys/dev/usb/if_athn_usb.c
--- a/sys/dev/usb/if_athn_usb.c Mon Oct 23 19:10:46 2017 +0000
+++ b/sys/dev/usb/if_athn_usb.c Mon Oct 23 19:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $  */
+/*     $NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj 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.6.6.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -733,9 +733,15 @@
                /* Append this Tx buffer to our free list. */
                TAILQ_INSERT_TAIL(&usc->usc_tx_free_list, data, next);
        }
-       if (error != 0)
+       if (error == 0) {
+               /* Steal one buffer for beacons. */
+               usc->usc_tx_bcn = TAILQ_FIRST(&usc->usc_tx_free_list);
+               TAILQ_REMOVE(&usc->usc_tx_free_list, usc->usc_tx_bcn, next);
+       } else {
                athn_usb_free_tx_list(usc);
+       }
        mutex_exit(&usc->usc_tx_mtx);
+
        return error;
 }
 
@@ -754,6 +760,10 @@
                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
@@ -2761,12 +2771,6 @@
        usc->usc_cmdq.cur = usc->usc_cmdq.next = usc->usc_cmdq.queued = 0;
        mutex_spin_exit(&usc->usc_task_mtx);
 
-       /* Steal one buffer for beacons. */
-       mutex_enter(&usc->usc_tx_mtx);
-       usc->usc_tx_bcn = TAILQ_FIRST(&usc->usc_tx_free_list);
-       TAILQ_REMOVE(&usc->usc_tx_free_list, usc->usc_tx_bcn, next);
-       mutex_exit(&usc->usc_tx_mtx);
-
        curchan = ic->ic_curchan;
        extchan = NULL;
 



Home | Main Index | Thread Index | Old Index