wifi: mwifiex: firmware response validation fixes (WMM + sta_list)
Subsystems (2)
cover wifi: mwifiex: firmware response validation fixes (WMM + sta_list)
From: Tristan Madani <[email protected]>
Two input validation fixes for the mwifiex driver:
1/2: The WMM status response handler uses the firmware-provided
queue_index to index a 4-entry array without bounds checking. Values >= IEEE80211_NUM_ACS cause an out-of-bounds access.
2/2: The AP station list response handler iterates over sta_info
entries using firmware-provided sta_count without verifying the response buffer is large enough.
Tristan Madani (2):
wifi: mwifiex: validate WMM queue_index in firmware response
wifi: mwifiex: validate sta_count in AP sta_list response
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 14 +++++++++++--- drivers/net/wireless/marvell/mwifiex/wmm.c | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/2 wifi: mwifiex: validate WMM queue_index in firmware response
From: Tristan Madani <[email protected]>
mwifiex_ret_wmm_get_status() uses the firmware-provided queue_index to index into priv->wmm.ac_status[] without checking it is within bounds. A firmware response with queue_index >= IEEE80211_NUM_ACS causes an access past the end of the array.
Add a bounds check before using queue_index as an array index.
--- drivers/net/wireless/marvell/mwifiex/wmm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/marvell/mwifiex/wmm.c +3 -0
@@ -943,6 +943,9 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, tlv_wmm_qstatus->flow_required, tlv_wmm_qstatus->disabled); +if (tlv_wmm_qstatus->queue_index >=IEEE80211_NUM_ACS ) +break ; + ac_status = &priv->wmm.ac_status[tlv_wmm_qstatus-> queue_index]; ac_status->disabled = tlv_wmm_qstatus->disabled;
Signature · 1 line
2.47.3
PATCH 2/2 wifi: mwifiex: validate sta_count in AP sta_list response
In reply to Tristan MadaniFrom: Tristan Madani <[email protected]>
mwifiex_ret_uap_sta_list() iterates over sta_info entries using the firmware-provided sta_count without verifying the response buffer is large enough to hold that many entries.
Add a size check that validates the response contains enough data for the declared number of station entries before iterating.
--- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +11 -3
@@ -973,11 +973,19 @@ static int mwifiex_ret_uap_sta_list(struct mwifiex_private *priv, {struct host_cmd_ds_sta_list *sta_list = &resp->params.sta_list; -struct mwifiex_ie_types_sta_info *sta_info = (void *)&sta_list->tlv; -int i; +struct mwifiex_ie_types_sta_info *sta_info; +u16 sta_count =le16_to_cpu (sta_list->sta_count); +u16 resp_size =le16_to_cpu (resp->size);struct mwifiex_sta_node *sta_node; +int i; + +if (resp_size <sizeof (*resp) -sizeof (resp->params) + +sizeof (*sta_list) + sta_count *sizeof (*sta_info)) +return -EINVAL ; + + sta_info = (void *)&sta_list->tlv; -for (i =0 ; i < (le16_to_cpu (sta_list->sta_count)); i++) { +for (i =0 ; i < sta_count; i++) { sta_node =mwifiex_get_sta_entry (priv, sta_info->mac);if (unlikely (!sta_node))continue ;
Signature · 1 line
2.47.3