Skip to content

Commit

Permalink
qcacld-2.0: Fix possible integer underflow in cfg80211_rx_mgmt
Browse files Browse the repository at this point in the history
propagation from qcacld-3.0 to qcacld-2.0

In the function cfg80211_rx_mgmt, data_len is calculated as
len - ieee80211_hdrlen(mgmt->frame_control). Len is not
validated before this calculation. So a possible integer
underflow will occur if len value is less than the value of
ieee80211_hdrlen(mgmt->frame_control).

Validate the value of len against
ieee80211_hdrlen(mgmt->frame_control) in the caller.

Bug: 129850941
Change-Id: Iae776daf37b0c052bd4ce4da44ea728d121eae51
CRs-Fixed: 2337425
Signed-off-by: hsuvictor <hsuvictor@google.com>
  • Loading branch information
Jingxiang Ge authored and krossmo committed May 9, 2019
1 parent 29f93f4 commit 0da2144
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/staging/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3611,6 +3611,8 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
hdd_adapter_t *adapter;
v_CONTEXT_t vos_context;
int i;
struct ieee80211_mgmt *mgmt =
(struct ieee80211_mgmt *)frame_ind->frameBuf;

/* Get the global VOSS context.*/
vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
Expand All @@ -3625,6 +3627,11 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
if (0 != wlan_hdd_validate_context(hdd_ctx))
return;

if (frame_ind->frame_len < ieee80211_hdrlen(mgmt->frame_control)) {
hddLog(LOGE, FL("Invalid frame length"));
return;
}

if (HDD_SESSION_ID_ANY == frame_ind->sessionId) {
for (i = 0; i < HDD_SESSION_MAX; i++) {
adapter =
Expand Down

0 comments on commit 0da2144

Please sign in to comment.