diff options
author | Yan-Hsuan Chuang <yhchuang@realtek.com> | 2019-11-05 17:04:42 +0800 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-11-06 19:58:05 +0200 |
commit | f530c1961af27f68a009b5fa532a4ed14f9c0e8c (patch) | |
tree | 0dea525eb13a389dff9d1419fa4d2c9619caa809 /drivers/net/wireless/realtek/rtw88 | |
parent | 5174f1e41074b5186608badc2e89441d021e8c08 (diff) | |
download | linux-f530c1961af27f68a009b5fa532a4ed14f9c0e8c.tar.bz2 |
rtw88: fix potential NULL pointer access for firmware
Driver could access a NULL firmware pointer if we don't
return here.
Fixes: 5195b90426409 ("rtw88: avoid FW info flood")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/realtek/rtw88')
-rw-r--r-- | drivers/net/wireless/realtek/rtw88/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 021668f1b74f..de82d08ea29e 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1024,8 +1024,10 @@ static void rtw_load_firmware_cb(const struct firmware *firmware, void *context) struct rtw_fw_state *fw = &rtwdev->fw; const struct rtw_fw_hdr *fw_hdr; - if (!firmware) + if (!firmware || !firmware->data) { rtw_err(rtwdev, "failed to request firmware\n"); + return; + } fw_hdr = (const struct rtw_fw_hdr *)firmware->data; fw->h2c_version = le16_to_cpu(fw_hdr->h2c_fmt_ver); |