summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiger Yu <tfyu@codeaurora.org>2017-12-25 15:24:06 +0800
committersnandini <snandini@codeaurora.org>2018-01-03 14:51:15 -0800
commitccfd151c4e0b45af73d3c1cfdb0ddd66eed4fa66 (patch)
tree2f3ab8128ac1ebc46ba349e737782e74e731822b
parent07367945fae90a569d9d1a25daa5c8b085e7779b (diff)
qcacld-2.0: Fix potential buffer over-read in the htt_t2h_lp_msg_handler
Check for the validity of peer_cnt when received the htt message of HTT_T2H_MSG_TYPE_RATE_REPORT from firmware to ensure the buffer over-read does not happen. Change-Id: I16c811d20127fe921ef5d1b5a7750629ad38b26b CRs-Fixed: 2159422
-rw-r--r--CORE/CLD_TXRX/HTT/htt_t2h.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/CORE/CLD_TXRX/HTT/htt_t2h.c b/CORE/CLD_TXRX/HTT/htt_t2h.c
index 7f2b7290a6bf..0653d3797b62 100644
--- a/CORE/CLD_TXRX/HTT/htt_t2h.c
+++ b/CORE/CLD_TXRX/HTT/htt_t2h.c
@@ -535,6 +535,7 @@ htt_t2h_lp_msg_handler(void *context, adf_nbuf_t htt_t2h_msg )
u_int16_t peer_cnt = HTT_PEER_RATE_REPORT_MSG_PEER_COUNT_GET(*msg_word);
u_int16_t i;
struct rate_report_t *report, *each;
+ int max_peers;
/* Param sanity check */
if (peer_cnt == 0) {
@@ -542,6 +543,13 @@ htt_t2h_lp_msg_handler(void *context, adf_nbuf_t htt_t2h_msg )
break;
}
+ max_peers = ol_cfg_max_peer_id(pdev->ctrl_pdev) + 1;
+ if (peer_cnt > max_peers) {
+ adf_os_print("RATE REPORT msg peer_cnt is larger than %d\n",
+ max_peers);
+ break;
+ }
+
/* At least one peer and no limit apply to peer_cnt here */
report = adf_os_mem_alloc(NULL,
sizeof(struct rate_report_t) * peer_cnt);