qcacld-2.0: Trim operation classes to max supported in change station

Operation classes supported can be controlled by user, which can
be sent greater than the max supported operations. This results
in stack overflow in change station command.

Add check to validate operations supported param given by user
and if it exceeds max supported value, set it to max supported
value.

CRs-Fixed: 2002052
Change-Id: Idd3a35e38b091546a17d7ec6329f19429e5c289c
Bug: 32094986
This commit is contained in:
Ariel Yin 2017-03-13 13:00:54 -07:00 committed by Luca Stefani
parent 925ea8fa69
commit 710354b4c9
1 changed files with 9 additions and 0 deletions

View File

@ -13917,6 +13917,15 @@ static int __wlan_hdd_change_station(struct wiphy *wiphy,
"%s: After removing duplcates StaParams.supported_channels_len: %d",
__func__, StaParams.supported_channels_len);
}
if (params->supported_oper_classes_len >
SIR_MAC_MAX_SUPP_OPER_CLASSES) {
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
"received oper classes:%d, resetting it to max supported %d",
params->supported_oper_classes_len,
SIR_MAC_MAX_SUPP_OPER_CLASSES);
params->supported_oper_classes_len =
SIR_MAC_MAX_SUPP_OPER_CLASSES;
}
vos_mem_copy(StaParams.supported_oper_classes,
params->supported_oper_classes,
params->supported_oper_classes_len);