Commit f530c196 authored by Yan-Hsuan Chuang's avatar Yan-Hsuan Chuang Committed by Kalle Valo

rtw88: fix potential NULL pointer access for firmware

Driver could access a NULL firmware pointer if we don't
return here.

Fixes: 5195b904 ("rtw88: avoid FW info flood")
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 5174f1e4
...@@ -1024,8 +1024,10 @@ static void rtw_load_firmware_cb(const struct firmware *firmware, void *context) ...@@ -1024,8 +1024,10 @@ static void rtw_load_firmware_cb(const struct firmware *firmware, void *context)
struct rtw_fw_state *fw = &rtwdev->fw; struct rtw_fw_state *fw = &rtwdev->fw;
const struct rtw_fw_hdr *fw_hdr; const struct rtw_fw_hdr *fw_hdr;
if (!firmware) if (!firmware || !firmware->data) {
rtw_err(rtwdev, "failed to request firmware\n"); rtw_err(rtwdev, "failed to request firmware\n");
return;
}
fw_hdr = (const struct rtw_fw_hdr *)firmware->data; fw_hdr = (const struct rtw_fw_hdr *)firmware->data;
fw->h2c_version = le16_to_cpu(fw_hdr->h2c_fmt_ver); fw->h2c_version = le16_to_cpu(fw_hdr->h2c_fmt_ver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment