P2P: Copy only valid opclasses while filtering out 6 GHz channels

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: f7d4f1cbec ("P2P: Add a mechanism for allowing 6 GHz channels in channel lists")
Signed-off-by: Sreeramya Soratkal <quic_ssramya@quicinc.com>
This commit is contained in:
Sreeramya Soratkal 2022-02-11 19:14:04 +05:30 committed by Jouni Malinen
parent 99c91beaad
commit d5a9331f97

View 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],