From bf0b0fed9acc0d1f71680f3b31bb6f004ae587c5 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Fri, 2 Sep 2022 13:42:17 +0800 Subject: [PATCH] qcacmn: Fix P2P find failure for invalid RSN probe response Some p2p device include invalid RSN IE in wildcard probe respone frames in p2p discovery. Do not drop it because the wildcard SSID entry will not be used to do association. Change-Id: I1e390509931094d9d9a55d2caef825c5772a086b CRs-Fixed: 3282030 --- umac/scan/core/src/wlan_scan_cache_db.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 2e865058d4..5da1fa777e 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -1017,6 +1017,27 @@ static bool scm_is_bss_allowed_for_country(struct wlan_objmgr_psoc *psoc, } #endif +/** + * scm_is_p2p_wildcard_ssid() - check p2p wildcard ssid or not + * @scan_entry: scan entry + * + * Return: true if SSID is wildcard "DIRECT-" ssid + */ +static bool scm_is_p2p_wildcard_ssid(struct scan_cache_entry *scan_entry) +{ + static const char wildcard_ssid[] = "DIRECT-"; + uint8_t len = sizeof(wildcard_ssid) - 1; + + if (!scan_entry->is_p2p) + return false; + if (!qdf_mem_cmp(scan_entry->ssid.ssid, + wildcard_ssid, len) && + (scan_entry->ssid.length == len)) + return true; + + return false; +} + QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn) { struct wlan_objmgr_psoc *psoc; @@ -1131,7 +1152,8 @@ QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn) status = wlan_crypto_rsnie_check( &sec_params, util_scan_entry_rsn(scan_entry)); - if (QDF_IS_STATUS_ERROR(status)) { + if (QDF_IS_STATUS_ERROR(status) && + !scm_is_p2p_wildcard_ssid(scan_entry)) { scm_nofl_debug("Drop frame from invalid RSN IE AP" QDF_MAC_ADDR_FMT ": RSN IE parse failed, status %d",