From: Veerendranath Jakkam Date: Thu, 3 Jul 2025 10:42:23 +0000 (+0530) Subject: P2P: Fix preferred frequency list size handling in p2p_check_pref_chan() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8235e21d7fe33faede37228c9c4a1f3b04d98428;p=thirdparty%2Fhostap.git P2P: Fix preferred frequency list size handling in p2p_check_pref_chan() Currently, the P2P GO (Group Owner) prefers the PCL (Preferred Channel List) from the driver to select the operating channel for group formation. However, wpa_supplicant is limiting the maximum allowed channels to "num_pref_freq", even though the driver may return a longer list. To fix this, update the logic in p2p_check_pref_chan() to use ARRAY_SIZE(p2p->pref_freq_list) when passing the size to get_pref_freq_list(), and update p2p->num_pref_freq based on the value returned by the driver function. This ensures the preferred frequency list is sized correctly according to the driver response. Signed-off-by: Veerendranath Jakkam Signed-off-by: Kavita Kavita --- diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 4b787a576..d7e713a40 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -734,12 +734,12 @@ void p2p_check_pref_chan(struct p2p_data *p2p, int go, return; /* Obtain our preferred frequency list from driver based on P2P role. */ - size = P2P_MAX_PREF_CHANNELS; + size = ARRAY_SIZE(p2p->pref_freq_list); if (p2p->cfg->get_pref_freq_list(p2p->cfg->cb_ctx, go, - &p2p->num_pref_freq, + &size, p2p->pref_freq_list)) return; - size = p2p->num_pref_freq; + p2p->num_pref_freq = size; if (!size) return; /* Filter out frequencies that are not acceptable for P2P use */