* [PATCH v2] brcm80211: fmac: Add error handling forbrcmf_usb_dl_writeimage()
@ 2025-04-15 7:20 Wentao Liang
2025-04-15 11:21 ` Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Wentao Liang @ 2025-04-15 7:20 UTC (permalink / raw)
To: arend.vanspriel, kvalo
Cc: jacobe.zang, sebastian.reichel, christophe.jaillet, erick.archer,
linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
Wentao Liang, stable
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@vger.kernel.org # v3.4+
Signed-off-by: Wentao Liang <vulab@iscas.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] brcm80211: fmac: Add error handling forbrcmf_usb_dl_writeimage()
2025-04-15 7:20 [PATCH v2] brcm80211: fmac: Add error handling forbrcmf_usb_dl_writeimage() Wentao Liang
@ 2025-04-15 11:21 ` Markus Elfring
2025-04-15 11:43 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-04-15 11:21 UTC (permalink / raw)
To: vulab, brcm80211-dev-list.pdl, brcm80211, linux-wireless
Cc: stable, LKML, Arend van Spriel, Christophe Jaillet, Erick Archer,
Jacobe Zang, Kalle Valo, Sebastian Reichel
…
> brcmf_usb_dl_cmd() but dose not check its return value. The
> 'state.state' and the 'state.bytes' are uninitialized if the
…
Would you ever like to benefit any more from change descriptions
which may contain text lines that would occasionally be longer
than 60 characters?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] brcm80211: fmac: Add error handling forbrcmf_usb_dl_writeimage()
2025-04-15 11:21 ` Markus Elfring
@ 2025-04-15 11:43 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-04-15 11:43 UTC (permalink / raw)
To: Markus Elfring
Cc: vulab, brcm80211-dev-list.pdl, brcm80211, linux-wireless, stable,
LKML, Arend van Spriel, Christophe Jaillet, Erick Archer,
Jacobe Zang, Kalle Valo, Sebastian Reichel
On Tue, Apr 15, 2025 at 01:21:23PM +0200, Markus Elfring wrote:
> …
> > brcmf_usb_dl_cmd() but dose not check its return value. The
> > 'state.state' and the 'state.bytes' are uninitialized if the
> …
>
> Would you ever like to benefit any more from change descriptions
> which may contain text lines that would occasionally be longer
> than 60 characters?
>
> Regards,
> Markus
>
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list. I strongly suggest that you not do this anymore. Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.
Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all. The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback. Please feel free to also ignore emails
from them.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-15 11:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 7:20 [PATCH v2] brcm80211: fmac: Add error handling forbrcmf_usb_dl_writeimage() Wentao Liang
2025-04-15 11:21 ` Markus Elfring
2025-04-15 11:43 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).