lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1965bda5b18.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com>
Date: Tue, 22 Apr 2025 06:55:59 +0200
From: Arend Van Spriel <arend.vanspriel@...adcom.com>
To: Wentao Liang <vulab@...as.ac.cn>, <kvalo@...nel.org>
CC: <jacobe.zang@...ion.com>, <sebastian.reichel@...labora.com>, <christophe.jaillet@...adoo.fr>, <erick.archer@...look.com>, <linux-wireless@...r.kernel.org>, <brcm80211@...ts.linux.dev>, <brcm80211-dev-list.pdl@...adcom.com>, <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>
Subject: Re: [PATCH v2 RESEND] brcm80211: fmac: Add error handling for brcmf_usb_dl_writeimage()

On April 22, 2025 6:22:48 AM Wentao Liang <vulab@...as.ac.cn> wrote:

> 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: 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 
> chipsets")
> Cc: stable@...r.kernel.org # v3.4+

Thanks for this patch.

Acked-by: Arend van Spriel <arend.vanspriel@...adcom.com>
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c 
> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> index 2821c27f317e..d06c724f63d9 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> @@ -896,14 +896,16 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info 
> *devinfo, u8 *fw, int fwlen)
>  }
>
>  /* 1) Prepare USB boot loader for runtime image */
> - brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state));
> + err = brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state));
> + if (err)
> + goto fail;
>
>  rdlstate = le32_to_cpu(state.state);
>  rdlbytes = le32_to_cpu(state.bytes);
>
>  /* 2) Check we are in the Waiting state */
>  if (rdlstate != DL_WAITING) {
> - brcmf_err("Failed to DL_START\n");
> + brcmf_err("Invalid DL state: %u\n", rdlstate);
>  err = -EINVAL;
>  goto fail;
>  }
> --
> 2.42.0.windows.2




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ