summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2024-05-29 07:27:34 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2024-05-29 07:27:34 +0000
commit7adba6cf77e2c1af454922b89aa88d45bf08cecf (patch)
tree106d3d27510ee905a0be0281da1c07dd21a9171a /sys/dev/usb
parent25f8f28bc52ff7b951e9cb45e50f840f9c7d3c3a (diff)
fix WEP on athn(4) USB hostap
Deferring installation of software crypto keys to a task context is not needed and results in race conditions that trigger the infamous "key not installed for sw crypto" panic.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_athn_usb.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c
index b0e00117202..0eed5ca2a34 100644
--- a/sys/dev/usb/if_athn_usb.c
+++ b/sys/dev/usb/if_athn_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_athn_usb.c,v 1.66 2024/05/23 03:21:08 jsg Exp $ */
+/* $OpenBSD: if_athn_usb.c,v 1.67 2024/05/29 07:27:33 stsp Exp $ */
/*-
* Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr>
@@ -1640,6 +1640,11 @@ athn_usb_set_key(struct ieee80211com *ic, struct ieee80211_node *ni,
(IFF_UP | IFF_RUNNING))
return (0);
+ if (k->k_cipher != IEEE80211_CIPHER_CCMP) {
+ /* Use software crypto for ciphers other than CCMP. */
+ return ieee80211_set_key(ic, ni, k);
+ }
+
/* Do it in a process context. */
cmd.ni = (ni != NULL) ? ieee80211_ref_node(ni) : NULL;
cmd.key = k;
@@ -1682,6 +1687,11 @@ athn_usb_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni,
ic->ic_state != IEEE80211_S_RUN)
return; /* Nothing to do. */
+ if (k->k_cipher != IEEE80211_CIPHER_CCMP) {
+ ieee80211_delete_key(ic, ni, k);
+ return;
+ }
+
/* Do it in a process context. */
cmd.ni = (ni != NULL) ? ieee80211_ref_node(ni) : NULL;
cmd.key = k;