qcacmn: Compilation fixes for SM8150 platform

1. Address out of bounds array access while
   populating mcs rates.
2. Use cdp_sec_type enum inplace of htt_sec_type
   for common code.

Change-Id: I0ae1e0acaf7422e73dc26befc9f066f3f424ec6b
CRs-Fixed: 2327153
Цей коміт міститься в:
Venkata Sharath Chandra Manchala
2018-10-02 18:18:52 -07:00
зафіксовано nshrivas
джерело 60ac9aa036
коміт d18887ee9f
8 змінених файлів з 27 додано та 27 видалено

Переглянути файл

@@ -2981,7 +2981,7 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)
case HTT_T2H_MSG_TYPE_SEC_IND: case HTT_T2H_MSG_TYPE_SEC_IND:
{ {
u_int16_t peer_id; u_int16_t peer_id;
enum htt_sec_type sec_type; enum cdp_sec_type sec_type;
int is_unicast; int is_unicast;
peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word); peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word);
@@ -3178,7 +3178,7 @@ dp_htt_h2t_full(void *context, HTC_PACKET *pkt)
static QDF_STATUS static QDF_STATUS
dp_htt_hif_t2h_hp_callback (void *context, qdf_nbuf_t nbuf, uint8_t pipe_id) dp_htt_hif_t2h_hp_callback (void *context, qdf_nbuf_t nbuf, uint8_t pipe_id)
{ {
A_STATUS rc = QDF_STATUS_SUCCESS; QDF_STATUS rc = QDF_STATUS_SUCCESS;
HTC_PACKET htc_pkt; HTC_PACKET htc_pkt;
qdf_assert_always(pipe_id == DP_HTT_T2H_HP_PIPE); qdf_assert_always(pipe_id == DP_HTT_T2H_HP_PIPE);

Переглянути файл

@@ -5021,9 +5021,8 @@ static void dp_get_peer_mac_from_peer_id(struct cdp_pdev *pdev_handle,
if (pdev && peer_mac) { if (pdev && peer_mac) {
peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id); peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id);
if (peer) { if (peer) {
if (peer->mac_addr.raw) qdf_mem_copy(peer_mac, peer->mac_addr.raw,
qdf_mem_copy(peer_mac, peer->mac_addr.raw, DP_MAC_ADDR_LEN);
DP_MAC_ADDR_LEN);
dp_peer_unref_del_find_by_id(peer); dp_peer_unref_del_find_by_id(peer);
} }
} }
@@ -7140,7 +7139,7 @@ dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf)
struct cdp_txrx_stats_req req = {0,}; struct cdp_txrx_stats_req req = {0,};
dp_aggregate_pdev_stats(pdev); dp_aggregate_pdev_stats(pdev);
req.stats = HTT_DBG_EXT_STATS_PDEV_TX; req.stats = (enum cdp_stats)HTT_DBG_EXT_STATS_PDEV_TX;
req.cookie_val = 1; req.cookie_val = 1;
dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0, dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
req.param1, req.param2, req.param3, 0, req.param1, req.param2, req.param3, 0,
@@ -7148,7 +7147,7 @@ dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf)
msleep(DP_MAX_SLEEP_TIME); msleep(DP_MAX_SLEEP_TIME);
req.stats = HTT_DBG_EXT_STATS_PDEV_RX; req.stats = (enum cdp_stats)HTT_DBG_EXT_STATS_PDEV_RX;
req.cookie_val = 1; req.cookie_val = 1;
dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0, dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
req.param1, req.param2, req.param3, 0, req.param1, req.param2, req.param3, 0,

Переглянути файл

@@ -2394,7 +2394,7 @@ dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, struct cdp_peer *peer_handle
void void
dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id, dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
enum htt_sec_type sec_type, int is_unicast, u_int32_t *michael_key, enum cdp_sec_type sec_type, int is_unicast, u_int32_t *michael_key,
u_int32_t *rx_pn) u_int32_t *rx_pn)
{ {
struct dp_soc *soc = (struct dp_soc *)soc_handle; struct dp_soc *soc = (struct dp_soc *)soc_handle;
@@ -2434,7 +2434,7 @@ dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
#endif #endif
#ifdef notyet /* TODO: Check if this is required for wifi3.0 */ #ifdef notyet /* TODO: Check if this is required for wifi3.0 */
if (sec_type != htt_sec_type_wapi) { if (sec_type != cdp_sec_type_wapi) {
qdf_mem_set(peer->tids_last_pn_valid, _EXT_TIDS, 0x00); qdf_mem_set(peer->tids_last_pn_valid, _EXT_TIDS, 0x00);
} else { } else {
for (i = 0; i < DP_MAX_TIDS; i++) { for (i = 0; i < DP_MAX_TIDS; i++) {

Переглянути файл

@@ -95,7 +95,7 @@ void dp_rx_peer_unmap_handler(void *soc_handle, uint16_t peer_id,
uint8_t vdev_id, uint8_t *peer_mac_addr, uint8_t vdev_id, uint8_t *peer_mac_addr,
uint8_t is_wds); uint8_t is_wds);
void dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id, void dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
enum htt_sec_type sec_type, int is_unicast, enum cdp_sec_type sec_type, int is_unicast,
u_int32_t *michael_key, u_int32_t *rx_pn); u_int32_t *michael_key, u_int32_t *rx_pn);
uint8_t dp_get_peer_mac_addr_frm_id(struct cdp_soc_t *soc_handle, uint8_t dp_get_peer_mac_addr_frm_id(struct cdp_soc_t *soc_handle,
uint16_t peer_id, uint8_t *peer_mac); uint16_t peer_id, uint8_t *peer_mac);

Переглянути файл

@@ -865,9 +865,6 @@ free:
void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc, void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
qdf_nbuf_t mpdu, bool mpdu_done) qdf_nbuf_t mpdu, bool mpdu_done)
{ {
/* To avoid compiler warning */
mpdu_done = mpdu_done;
/* Process the nbuf */ /* Process the nbuf */
dp_rx_process_invalid_peer(soc, mpdu); dp_rx_process_invalid_peer(soc, mpdu);
} }
@@ -1195,23 +1192,23 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc,
DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(tid)], 1); DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(tid)], 1);
DP_STATS_INC(peer, rx.reception_type[reception_type], 1); DP_STATS_INC(peer, rx.reception_type[reception_type], 1);
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_A))); ((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_A)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_A))); ((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_A)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
((mcs >= MAX_MCS_11B) && (pkt_type == DOT11_B))); ((mcs >= MAX_MCS_11B) && (pkt_type == DOT11_B)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
((mcs <= MAX_MCS_11B) && (pkt_type == DOT11_B))); ((mcs <= MAX_MCS_11B) && (pkt_type == DOT11_B)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_N))); ((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_N)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_N))); ((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_N)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
((mcs >= MAX_MCS_11AC) && (pkt_type == DOT11_AC))); ((mcs >= MAX_MCS_11AC) && (pkt_type == DOT11_AC)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
((mcs <= MAX_MCS_11AC) && (pkt_type == DOT11_AC))); ((mcs <= MAX_MCS_11AC) && (pkt_type == DOT11_AC)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
((mcs >= MAX_MCS) && (pkt_type == DOT11_AX))); ((mcs >= MAX_MCS) && (pkt_type == DOT11_AX)));
DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
((mcs <= MAX_MCS) && (pkt_type == DOT11_AX))); ((mcs <= MAX_MCS) && (pkt_type == DOT11_AX)));

Переглянути файл

@@ -1156,10 +1156,10 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
index, peer->security[index].sec_type); index, peer->security[index].sec_type);
switch (peer->security[index].sec_type) { switch (peer->security[index].sec_type) {
case htt_sec_type_tkip: case cdp_sec_type_tkip:
tkip_demic = 1; tkip_demic = 1;
case htt_sec_type_tkip_nomic: case cdp_sec_type_tkip_nomic:
while (cur) { while (cur) {
tmp_next = qdf_nbuf_next(cur); tmp_next = qdf_nbuf_next(cur);
if (dp_rx_defrag_tkip_decap(cur, hdr_space)) { if (dp_rx_defrag_tkip_decap(cur, hdr_space)) {
@@ -1177,7 +1177,7 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
hdr_space += dp_f_tkip.ic_header; hdr_space += dp_f_tkip.ic_header;
break; break;
case htt_sec_type_aes_ccmp: case cdp_sec_type_aes_ccmp:
while (cur) { while (cur) {
tmp_next = qdf_nbuf_next(cur); tmp_next = qdf_nbuf_next(cur);
if (dp_rx_defrag_ccmp_demic(cur, hdr_space)) { if (dp_rx_defrag_ccmp_demic(cur, hdr_space)) {
@@ -1203,9 +1203,9 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
hdr_space += dp_f_ccmp.ic_header; hdr_space += dp_f_ccmp.ic_header;
break; break;
case htt_sec_type_wep40: case cdp_sec_type_wep40:
case htt_sec_type_wep104: case cdp_sec_type_wep104:
case htt_sec_type_wep128: case cdp_sec_type_wep128:
while (cur) { while (cur) {
tmp_next = qdf_nbuf_next(cur); tmp_next = qdf_nbuf_next(cur);
if (dp_rx_defrag_wep_decap(cur, hdr_space)) { if (dp_rx_defrag_wep_decap(cur, hdr_space)) {

Переглянути файл

@@ -2573,8 +2573,10 @@ dp_tx_update_peer_stats(struct dp_peer *peer,
mcs = ts->mcs; mcs = ts->mcs;
pkt_type = ts->pkt_type; pkt_type = ts->pkt_type;
if (!ts->release_src == HAL_TX_COMP_RELEASE_SOURCE_TQM) if (ts->release_src != HAL_TX_COMP_RELEASE_SOURCE_TQM) {
dp_err("Release source is not from TQM");
return; return;
}
DP_STATS_INCC(peer, tx.dropped.age_out, 1, DP_STATS_INCC(peer, tx.dropped.age_out, 1,
(ts->status == HAL_TX_TQM_RR_REM_CMD_AGED)); (ts->status == HAL_TX_TQM_RR_REM_CMD_AGED));
@@ -2597,8 +2599,10 @@ dp_tx_update_peer_stats(struct dp_peer *peer,
DP_STATS_INCC(peer, tx.dropped.fw_reason3, 1, DP_STATS_INCC(peer, tx.dropped.fw_reason3, 1,
(ts->status == HAL_TX_TQM_RR_FW_REASON3)); (ts->status == HAL_TX_TQM_RR_FW_REASON3));
if (!ts->status == HAL_TX_TQM_RR_FRAME_ACKED) if (ts->status != HAL_TX_TQM_RR_FRAME_ACKED) {
dp_err("Tx completion has no valid acknowledgment");
return; return;
}
DP_STATS_INCC(peer, tx.ofdma, 1, ts->ofdma); DP_STATS_INCC(peer, tx.ofdma, 1, ts->ofdma);

Переглянути файл

@@ -1507,7 +1507,7 @@ struct dp_peer {
/* TBD: No transmit TID state required? */ /* TBD: No transmit TID state required? */
struct { struct {
enum htt_sec_type sec_type; enum cdp_sec_type sec_type;
u_int32_t michael_key[2]; /* relevant for TKIP */ u_int32_t michael_key[2]; /* relevant for TKIP */
} security[2]; /* 0 -> multicast, 1 -> unicast */ } security[2]; /* 0 -> multicast, 1 -> unicast */