From 20b5dc36e39824ab755df1d4048dba018ee8ea8f Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 1 Jun 2017 11:03:19 -0700 Subject: [PATCH] qcacld-3.0: Avoid extscan bucket spec overread Currently in hdd_extscan_start_fill_bucket_channel_spec() the QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC attribute is parsed without specifying a policy. This means that no policy is enforced. Subsequently the values of the nested attributes are retrieved, but again without any length limits enforced. This could result in a buffer overread. To prevent this issue: * Parse using the existing policy wlan_hdd_extscan_config_policy * Update the policy to add missing attributes Change-Id: I3b20cb28d1beccd2e804b022b531413ad1edb533 CRs-Fixed: 2054958 --- core/hdd/src/wlan_hdd_ext_scan.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ext_scan.c b/core/hdd/src/wlan_hdd_ext_scan.c index 8f9960098c5e..b3644275989b 100644 --- a/core/hdd/src/wlan_hdd_ext_scan.c +++ b/core/hdd/src/wlan_hdd_ext_scan.c @@ -110,6 +110,12 @@ static const struct nla_policy wlan_hdd_extscan_config_policy .type = NLA_U32}, [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = NLA_U32}, + [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = { + .type = NLA_U32}, + [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE] = { + .type = NLA_U32}, + [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = { + .type = NLA_U32}, [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = { .type = NLA_BINARY, .len = IEEE80211_MAX_SSID_LEN + 1 }, @@ -2661,8 +2667,9 @@ static int hdd_extscan_start_fill_bucket_channel_spec( } if (nla_parse(bucket, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, - nla_data(buckets), nla_len(buckets), NULL)) { + QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, + nla_data(buckets), nla_len(buckets), + wlan_hdd_extscan_config_policy)) { hdd_err("nla_parse failed"); return -EINVAL; }