summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/if_ral.c
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2006-12-03 16:16:58 +0000
committerdamien <damien@openbsd.org>2006-12-03 16:16:58 +0000
commit98c7cce0630946608a8358b55c71040f554cf81b (patch)
tree97fd6816dd8e73853b6f2fffeb7f7ceecb3904f9 /sys/dev/usb/if_ral.c
parentSet sis_stopped=1 early on attach and reset it later in sis_init(). (diff)
downloadwireguard-openbsd-98c7cce0630946608a8358b55c71040f554cf81b.tar.xz
wireguard-openbsd-98c7cce0630946608a8358b55c71040f554cf81b.zip
don't schedule a USB task in {ural,rum}_newstate() if we're called from
a process context. this avoids potential races in {ural,rum}_stop().
Diffstat (limited to 'sys/dev/usb/if_ral.c')
-rw-r--r--sys/dev/usb/if_ral.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index a0637f7555a..b1668ee2541 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.84 2006/11/26 11:14:22 deraadt Exp $ */
+/* $OpenBSD: if_ral.c,v 1.85 2006/12/03 16:16:58 damien Exp $ */
/*-
* Copyright (c) 2005, 2006
@@ -638,11 +638,14 @@ ural_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
timeout_del(&sc->scan_to);
timeout_del(&sc->amrr_to);
- /* do it in a process context */
sc->sc_state = nstate;
sc->sc_arg = arg;
- usb_add_task(sc->sc_udev, &sc->sc_task);
-
+ if (curproc != NULL) {
+ ural_task(sc);
+ } else {
+ /* do it in a process context */
+ usb_add_task(sc->sc_udev, &sc->sc_task);
+ }
return 0;
}