diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-12-03 16:16:59 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-12-03 16:16:59 +0000 |
commit | 9cb1eceeabe4336705be57a44904e613028249a3 (patch) | |
tree | 908cb9a460041399d2ab0aae309eb93a7cf82812 /sys | |
parent | a1b900700c3e8afae1bf0eb74a5dbf5f1b917cce (diff) |
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')
-rw-r--r-- | sys/dev/usb/if_ral.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/if_rum.c | 11 |
2 files changed, 14 insertions, 8 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; } diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index e02c27b7229..58472d16067 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.45 2006/11/26 11:14:22 deraadt Exp $ */ +/* $OpenBSD: if_rum.c,v 1.46 2006/12/03 16:16:58 damien Exp $ */ /*- * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr> @@ -686,11 +686,14 @@ rum_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) { + rum_task(sc); + } else { + /* do it in a process context */ + usb_add_task(sc->sc_udev, &sc->sc_task); + } return 0; } |