qcacmn: Validate stats_req_type type before use as index of req array

Validate type which is used as index of req array to avoid any
out of bond access issue.

Change-Id: I75d08054b94b7066f7bdc030cf9896469c923a65
CRs-Fixed: 2305555
Esse commit está contido em:
Arif Hussain
2018-08-31 15:55:49 -07:00
commit de nshrivas
commit 89557a3838

Ver arquivo

@@ -487,6 +487,11 @@ QDF_STATUS ucfg_mc_cp_stats_set_pending_req(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_NULL_VALUE;
}
if (type > TYPE_MAX) {
cp_stats_err("Invalid type index: %d", type);
return QDF_STATUS_E_INVAL;
}
wlan_cp_stats_psoc_obj_lock(psoc_cp_stats_priv);
psoc_mc_stats = psoc_cp_stats_priv->obj_stats;
psoc_mc_stats->pending.type_map |= (1 << type);
@@ -508,6 +513,11 @@ QDF_STATUS ucfg_mc_cp_stats_reset_pending_req(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_NULL_VALUE;
}
if (type > TYPE_MAX) {
cp_stats_err("Invalid type index: %d", type);
return QDF_STATUS_E_INVAL;
}
wlan_cp_stats_psoc_obj_lock(psoc_cp_stats_priv);
psoc_mc_stats = psoc_cp_stats_priv->obj_stats;
psoc_mc_stats->pending.type_map &= ~(1 << type);
@@ -531,6 +541,10 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_NULL_VALUE;
}
if (type > TYPE_MAX) {
cp_stats_err("Invalid type index: %d", type);
return QDF_STATUS_E_INVAL;
}
wlan_cp_stats_psoc_obj_lock(psoc_cp_stats_priv);
psoc_mc_stats = psoc_cp_stats_priv->obj_stats;
*info = psoc_mc_stats->pending.req[type];