summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_otus.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2009-11-03 17:36:59 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2009-11-03 17:36:59 +0000
commit20ee799719c991979f4893eb24b47594ddeac537 (patch)
treec34124ea7a83536e3ec6f8ea41fce1e34a73847b /sys/dev/usb/if_otus.c
parent4cebf82c323cb4ae3ffd5641d64f7d8f6672b220 (diff)
setting of WEP keys is defered until interface is brought up,
so do nothing in set_key() if the interface is not up and running. fixes a panic reported by Steph (frlinux at gmail dot com) with run(4) on misc
Diffstat (limited to 'sys/dev/usb/if_otus.c')
-rw-r--r--sys/dev/usb/if_otus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c
index ead0b5277fc..117a3a5d83d 100644
--- a/sys/dev/usb/if_otus.c
+++ b/sys/dev/usb/if_otus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_otus.c,v 1.12 2009/09/15 18:44:55 damien Exp $ */
+/* $OpenBSD: if_otus.c,v 1.13 2009/11/03 17:36:58 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -2047,6 +2047,11 @@ otus_set_key(struct ieee80211com *ic, struct ieee80211_node *ni,
struct otus_softc *sc = ic->ic_softc;
struct otus_cmd_key cmd;
+ /* Defer setting of WEP keys until interface is brought up. */
+ if ((ic->ic_if.if_flags & (IFF_UP | IFF_RUNNING)) !=
+ (IFF_UP | IFF_RUNNING))
+ return 0;
+
/* Do it in a process context. */
cmd.key = *k;
cmd.associd = (ni != NULL) ? ni->ni_associd : 0;