Skip to content

Commit

Permalink
rtw88: fix potential NULL pointer access for firmware
Browse files Browse the repository at this point in the history
Driver could access a NULL firmware pointer if we don't
return here.

Fixes: 5195b90 ("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>
  • Loading branch information
Yan-Hsuan Chuang authored and Kalle Valo committed Nov 6, 2019
1 parent 5174f1e commit f530c19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/wireless/realtek/rtw88/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f530c19

Please sign in to comment.