Skip to content

Commit 2b48644

Browse files
committed
wifi: brcm80211: fmac: Add error handling for brcmf_usb_dl_writeimage()
JIRA: https://issues.redhat.com/browse/RHEL-89168 CVE: CVE-2025-37990 commit 8e089e7 Author: Wentao Liang <vulab@iscas.ac.cn> Date: Tue Apr 22 12:22:02 2025 +0800 wifi: brcm80211: fmac: Add error handling for brcmf_usb_dl_writeimage() The function brcmf_usb_dl_writeimage() calls the function brcmf_usb_dl_cmd() but dose not check its return value. The 'state.state' and the 'state.bytes' are uninitialized if the function brcmf_usb_dl_cmd() fails. It is dangerous to use uninitialized variables in the conditions. Add error handling for brcmf_usb_dl_cmd() to jump to error handling path if the brcmf_usb_dl_cmd() fails and the 'state.state' and the 'state.bytes' are uninitialized. Improve the error message to report more detailed error information. Fixes: 71bb244 ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets") Cc: stable@vger.kernel.org # v3.4+ Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> Link: https://patch.msgid.link/20250422042203.2259-1-vulab@iscas.ac.cn Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent 855361e commit 2b48644

File tree

1 file changed

+4
-2
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+4
-2
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,14 +896,16 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
896896
}
897897

898898
/* 1) Prepare USB boot loader for runtime image */
899-
brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state));
899+
err = brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state));
900+
if (err)
901+
goto fail;
900902

901903
rdlstate = le32_to_cpu(state.state);
902904
rdlbytes = le32_to_cpu(state.bytes);
903905

904906
/* 2) Check we are in the Waiting state */
905907
if (rdlstate != DL_WAITING) {
906-
brcmf_err("Failed to DL_START\n");
908+
brcmf_err("Invalid DL state: %u\n", rdlstate);
907909
err = -EINVAL;
908910
goto fail;
909911
}

0 commit comments

Comments
 (0)