diff mbox series

[2/4] netdev: fail the connection if sending external auth fails

Message ID 20250211192656.83157-2-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] eap: initialize vendor_id/vendor_type to zero | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

James Prestwood Feb. 11, 2025, 7:26 p.m. UTC
This prevents IWD from hanging after external auth fails. In addition
(as described in the comment) unless IWD actually issues a disconnect
the driver/kernel gets into a state where it no longer accepts any
commands, for example:

Received error during CMD_TRIGGER_SCAN: Resource temporarily unavailable (11)
---
 src/netdev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/netdev.c b/src/netdev.c
index 7af3c39a..611fb597 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -3468,11 +3468,22 @@  static void netdev_external_auth_sae_tx_authenticate(const uint8_t *body,
 
 static void netdev_external_auth_cb(struct l_genl_msg *msg, void *user_data)
 {
+	struct netdev *netdev = user_data;
 	int error = l_genl_msg_get_error(msg);
 
-	if (error < 0)
+	if (error < 0) {
 		l_debug("Failed to send External Auth: %s(%d)",
 				strerror(-error), -error);
+
+		/*
+		 * Without an explicit disconnect here brcmfmac gets into a
+		 * broken state and returns "Resource temporarily unavailable
+		 * for any subsequent scans/commands
+		 */
+		netdev_disconnect_and_fail_connection(netdev,
+					NETDEV_RESULT_AUTHENTICATION_FAILED,
+					MMPDU_REASON_CODE_UNSPECIFIED);
+	}
 }
 
 static void netdev_send_external_auth(struct netdev *netdev,