]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix handling of highest supported authentication algorithm
authorAiny Kumari <ainy.kumari@oss.qualcomm.com>
Thu, 4 Sep 2025 08:22:07 +0000 (13:52 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 4 Sep 2025 09:30:55 +0000 (12:30 +0300)
NL80211_AUTHTYPE_MAX represents the highest valid authentication
algorithm enum value, not an invalid or out-of-range value. The previous
logic for auth type boundary check incorrectly treats this value as
invalid, resulting in failures when the highest supported authentication
type is used during authentication frame exchange.

To fix this, update the validation logic to correctly recognize all
defined authentication algorithm enum values, including the last one,
and only reject values outside the defined range.

Fixes: 3c67e977dec5 ("nl80211: Add support to send updated connection parameters")
Signed-off-by: Ainy Kumari <ainy.kumari@oss.qualcomm.com>
src/drivers/driver_nl80211.c

index 5fb4529e56a507091ebeb5a41b0ba5b6009e83a3..8a007698bafb8b8d8259d6e6af2605ba868f3b15 100644 (file)
@@ -4108,7 +4108,7 @@ static enum nl80211_auth_type get_nl_auth_type(int wpa_auth_alg)
        if (wpa_auth_alg & WPA_AUTH_ALG_FILS_SK_PFS)
                return NL80211_AUTHTYPE_FILS_SK_PFS;
 
-       return NL80211_AUTHTYPE_MAX;
+       return NL80211_AUTHTYPE_MAX + 1;
 }
 
 
@@ -4231,7 +4231,7 @@ retry:
        }
        type = get_nl_auth_type(params->auth_alg);
        wpa_printf(MSG_DEBUG, "  * Auth Type %d", type);
-       if (type == NL80211_AUTHTYPE_MAX ||
+       if (type > NL80211_AUTHTYPE_MAX ||
            nla_put_u32(msg, NL80211_ATTR_AUTH_TYPE, type))
                goto fail;
        if (params->local_state_change) {
@@ -7396,7 +7396,7 @@ static int wpa_driver_nl80211_try_connect(
 
        type = get_nl_auth_type(params->auth_alg);
        wpa_printf(MSG_DEBUG, "  * Auth Type %d", type);
-       if (type == NL80211_AUTHTYPE_MAX ||
+       if (type > NL80211_AUTHTYPE_MAX ||
            nla_put_u32(msg, NL80211_ATTR_AUTH_TYPE, type))
                goto fail;
 
@@ -14455,7 +14455,7 @@ static int nl80211_update_connection_params(
 
        if (mask & WPA_DRV_UPDATE_AUTH_TYPE) {
                type = get_nl_auth_type(params->auth_alg);
-               if (type == NL80211_AUTHTYPE_MAX ||
+               if (type > NL80211_AUTHTYPE_MAX ||
                    nla_put_u32(msg, NL80211_ATTR_AUTH_TYPE, type))
                        goto fail;
                wpa_printf(MSG_DEBUG, "  * Auth Type %d", type);