git: 7f40fc099de6 - stable/13 - iwlwifi: fix a bug in iwl_ssid_exist()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 16:38:15 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=7f40fc099de6720363d4e0bc1a45c094ccf451d5

commit 7f40fc099de6720363d4e0bc1a45c094ccf451d5
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-14 17:22:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:06 +0000

    iwlwifi: fix a bug in iwl_ssid_exist()
    
    Rather than always comparing a given SSID to the first SSID of the
    IE list, compare it to the the iterator one.  That way duplicates can
    be found.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit ee7077f24f5b02bde8cf5c202848128f18733398)
---
 sys/contrib/dev/iwlwifi/mvm/scan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mvm/scan.c b/sys/contrib/dev/iwlwifi/mvm/scan.c
index a4077053e374..8c5d6860914b 100644
--- a/sys/contrib/dev/iwlwifi/mvm/scan.c
+++ b/sys/contrib/dev/iwlwifi/mvm/scan.c
@@ -447,7 +447,11 @@ static int iwl_ssid_exist(u8 *ssid, u8 ssid_len, struct iwl_ssid_ie *ssid_list)
 		if (!ssid_list[i].len)
 			break;
 		if (ssid_list[i].len == ssid_len &&
+#if defined(__linux__)
 		    !memcmp(ssid_list->ssid, ssid, ssid_len))
+#elif defined(__FreeBSD__)
+		    !memcmp(ssid_list[i].ssid, ssid, ssid_len))
+#endif
 			return i;
 	}
 	return -1;