aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2016-03-17 05:52:08 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2016-03-21 12:31:03 -0400
commit8866c727440d5b059637cb97927e383548099e8c (patch)
tree75aee152e29208f5395b8d9889824403ff54f5c2
parent750eeed89cf3c466df302e4707491b015531e26c (diff)
ath10k: fix null deref if device crashes early
If device failed to init during early probing (which is quite rare) it triggered driver to compute crc before ar->firmware was ready causing an oops. Fixes: 3e58044b61a9 ("ath10k: print crc32 checksums for firmware and board files") Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 0f834646e6a7..2cf1b350ac73 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -127,6 +127,7 @@ EXPORT_SYMBOL(ath10k_info);
127void ath10k_debug_print_hwfw_info(struct ath10k *ar) 127void ath10k_debug_print_hwfw_info(struct ath10k *ar)
128{ 128{
129 char fw_features[128] = {}; 129 char fw_features[128] = {};
130 u32 crc = 0;
130 131
131 ath10k_core_get_fw_features_str(ar, fw_features, sizeof(fw_features)); 132 ath10k_core_get_fw_features_str(ar, fw_features, sizeof(fw_features));
132 133
@@ -143,11 +144,14 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar)
143 config_enabled(CONFIG_ATH10K_DFS_CERTIFIED), 144 config_enabled(CONFIG_ATH10K_DFS_CERTIFIED),
144 config_enabled(CONFIG_NL80211_TESTMODE)); 145 config_enabled(CONFIG_NL80211_TESTMODE));
145 146
147 if (ar->firmware)
148 crc = crc32_le(0, ar->firmware->data, ar->firmware->size);
149
146 ath10k_info(ar, "firmware ver %s api %d features %s crc32 %08x\n", 150 ath10k_info(ar, "firmware ver %s api %d features %s crc32 %08x\n",
147 ar->hw->wiphy->fw_version, 151 ar->hw->wiphy->fw_version,
148 ar->fw_api, 152 ar->fw_api,
149 fw_features, 153 fw_features,
150 crc32_le(0, ar->firmware->data, ar->firmware->size)); 154 crc);
151} 155}
152 156
153void ath10k_debug_print_board_info(struct ath10k *ar) 157void ath10k_debug_print_board_info(struct ath10k *ar)