]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix preferred frequency list size handling in p2p_check_pref_chan()
authorVeerendranath Jakkam <vjakkam@qti.qualcomm.com>
Thu, 3 Jul 2025 10:42:23 +0000 (16:12 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 25 Jul 2025 13:24:29 +0000 (16:24 +0300)
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 <vjakkam@qti.qualcomm.com>
Signed-off-by: Kavita Kavita <kkavita@qti.qualcomm.com>
src/p2p/p2p_go_neg.c

index 4b787a576622c4b3dc24c7e571bece72409fca29..d7e713a40201bdda6a1c6e254945548587065ad7 100644 (file)
@@ -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 */