jcs's openbsd hax
openbsd

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.

stsp 720f4ea4 0f25b82d

+11 -1
+11 -1
sys/dev/usb/if_athn_usb.c
··· 1 - /* $OpenBSD: if_athn_usb.c,v 1.66 2024/05/23 03:21:08 jsg Exp $ */ 1 + /* $OpenBSD: if_athn_usb.c,v 1.67 2024/05/29 07:27:33 stsp Exp $ */ 2 2 3 3 /*- 4 4 * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> ··· 1640 1640 (IFF_UP | IFF_RUNNING)) 1641 1641 return (0); 1642 1642 1643 + if (k->k_cipher != IEEE80211_CIPHER_CCMP) { 1644 + /* Use software crypto for ciphers other than CCMP. */ 1645 + return ieee80211_set_key(ic, ni, k); 1646 + } 1647 + 1643 1648 /* Do it in a process context. */ 1644 1649 cmd.ni = (ni != NULL) ? ieee80211_ref_node(ni) : NULL; 1645 1650 cmd.key = k; ··· 1681 1686 if (!(ic->ic_if.if_flags & IFF_RUNNING) || 1682 1687 ic->ic_state != IEEE80211_S_RUN) 1683 1688 return; /* Nothing to do. */ 1689 + 1690 + if (k->k_cipher != IEEE80211_CIPHER_CCMP) { 1691 + ieee80211_delete_key(ic, ni, k); 1692 + return; 1693 + } 1684 1694 1685 1695 /* Do it in a process context. */ 1686 1696 cmd.ni = (ni != NULL) ? ieee80211_ref_node(ni) : NULL;