Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/usb Make sure to hold the TX lock when calling...



details:   https://anonhg.NetBSD.org/src-all/rev/ef6e9b642b99
branches:  trunk
changeset: 375706:ef6e9b642b99
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Oct 17 12:17:33 2021 +0200

description:
Make sure to hold the TX lock when calling one of the start functions.

diffstat:

 sys/dev/usb/usbwifi.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 27397bb4e5af -r ef6e9b642b99 sys/dev/usb/usbwifi.c
--- a/sys/dev/usb/usbwifi.c     Sun Oct 17 11:54:31 2021 +0200
+++ b/sys/dev/usb/usbwifi.c     Sun Oct 17 12:17:33 2021 +0200
@@ -383,11 +383,11 @@ usbwifi_txeof(struct usbd_xfer *xfer, vo
                break;
        }
 
-       mutex_exit(&uwp->uwp_txlock);
-
        if (status == USBD_NORMAL_COMPLETION &&
            !IFQ_IS_EMPTY(&uwp->uwp_sendq[c->uwc_index]))
                usbwifi_tx_prio_start(uw, c->uwc_index);
+
+       mutex_exit(&uwp->uwp_txlock);
 }
 
 static void
@@ -1079,8 +1079,11 @@ usbwifi_watchdog(struct usbwifi *uw)
                        break;
                }
        }
-       if (found)
+       if (found) {
+               mutex_enter(&uw->uw_pri->uwp_txlock);
                usbwifi_start(uw);
+               mutex_exit(&uw->uw_pri->uwp_txlock);
+       }
 }
 
 static void



Home | Main Index | Thread Index | Old Index