]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Copy only valid opclasses while filtering out 6 GHz channels
authorSreeramya Soratkal <quic_ssramya@quicinc.com>
Fri, 11 Feb 2022 13:44:04 +0000 (19:14 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 30 Mar 2022 17:42:14 +0000 (20:42 +0300)
Copy channels from only valid operating classes in the source channel
list while preparing a non-6 GHz channel/op-classes list when the 6 GHz
band is not used for P2P GO negotiation.

Earlier, during preparation of P2P channels for GO negotiation, a union
of the GO channels and the P2P Client channels is used. While generating
the union in p2p_channels_union_inplace() as the first list itself has
P2P_MAX_REG_CLASSES number of entries, the operating classes from the
second list which are not in the first list were not getting considered.

Fix this by not setting the dst->reg_classes to too large a value.

Fixes: f7d4f1cbec34 ("P2P: Add a mechanism for allowing 6 GHz channels in channel lists")
Signed-off-by: Sreeramya Soratkal <quic_ssramya@quicinc.com>
src/p2p/p2p_utils.c

index 7d21f68819c732efdb8ac2c72081ecf8c9cfda25..a203606331e27566788921029138a924868d89bf 100644 (file)
@@ -508,7 +508,7 @@ void p2p_copy_channels(struct p2p_channels *dst,
                return;
        }
 
-       for (i = 0, j = 0; i < P2P_MAX_REG_CLASSES; i++) {
+       for (i = 0, j = 0; i < src->reg_classes; i++) {
                if (is_6ghz_op_class(src->reg_class[i].reg_class))
                        continue;
                os_memcpy(&dst->reg_class[j], &src->reg_class[i],