From: Sreeramya Soratkal Date: Fri, 11 Feb 2022 13:44:04 +0000 (+0530) Subject: P2P: Copy only valid opclasses while filtering out 6 GHz channels X-Git-Tag: hostap_2_11~2128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5a9331f97274bce991d771fa8a50a5e51fd6428;p=thirdparty%2Fhostap.git 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: f7d4f1cbec34 ("P2P: Add a mechanism for allowing 6 GHz channels in channel lists") Signed-off-by: Sreeramya Soratkal --- diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c index 7d21f6881..a20360633 100644 --- a/src/p2p/p2p_utils.c +++ b/src/p2p/p2p_utils.c @@ -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],