ath10k: fix array out-of-bounds access
PATCH 1/2 ath10k: fix array out-of-bounds access
If firmware reports rate_max > WMI_TPC_RATE_MAX(WMI_TPC_FINAL_RATE_MAX) or num_tx_chain > WMI_TPC_TX_N_CHAIN, it will cause array out-of-bounds access, so print a warning and reset to avoid memory corruption.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/debug.c | 2 +- drivers/net/wireless/ath/ath10k/wmi.c | 49 +++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath10k/debug.c +1 -1
@@ -1516,7 +1516,7 @@ static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats, *len +=scnprintf (buf + *len, buf_len - *len,"No. Preamble Rate_code " ); -for (i =0 ; i <WMI_TPC_TX_N_CHAIN ; i++) +for (i =0 ; i < tpc_stats->num_tx_chain; i++) *len +=scnprintf (buf + *len, buf_len - *len,"tpc_value%d " , i);
drivers/net/wireless/ath/ath10k/wmi.c +31 -18
111 lines not on this page · raw message
Signature · 7 lines
1.9.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH 2/2 ath10k: fix memory leak for tpc_stats_final
The memory of ar->debug.tpc_stats_final is reallocated every debugfs reading, it should be freed in ath10k_debug_destroy() for the last allocation.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/debug.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/debug.c +1 -0
@@ -2532,6 +2532,7 @@ void ath10k_debug_destroy(struct ath10k *ar)ath10k_debug_fw_stats_reset (ar);kfree (ar->debug.tpc_stats); +kfree (ar->debug.tpc_stats_final); }int ath10k_debug_register (struct ath10k *ar)
Signature · 7 lines
1.9.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 9 lines · Miaoqing Pan
If firmware reports
rate_max>WMI_TPC_RATE_MAX(WMI_TPC_FINAL_RATE_MAX)ornum_tx_chain>WMI_TPC_TX_N_CHAIN, it will cause array out-of-bounds access, so print a warning and reset to avoid memory corruption.Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035Signed-off-by Miaoqing Pan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
c5329b2d5b8b ath10k: fix array out-of-bounds access 486a88498434 ath10k: fix memory leak for tpc_stats_final
Signature · 3 lines
https://patchwork.kernel.org/patch/11180701/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 9 lines · Miaoqing Pan
If firmware reports
rate_max>WMI_TPC_RATE_MAX(WMI_TPC_FINAL_RATE_MAX)ornum_tx_chain>WMI_TPC_TX_N_CHAIN, it will cause array out-of-bounds access, so print a warning and reset to avoid memory corruption.Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035Signed-off-by Miaoqing Pan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
c5329b2d5b8b ath10k: fix array out-of-bounds access 486a88498434 ath10k: fix memory leak for tpc_stats_final
Signature · 9 lines
https://patchwork.kernel.org/patch/11180701/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k