From 6b062fd9e25f964f44157e427213114d0734f693 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 3 Nov 2021 11:53:13 +0000 Subject: [PATCH 577/828] brcmfmac: Protect against reprobing It is important to reinitialise the firmware array pointers to protect against the case that the brcmfmac driver is reprobed without first being unloaded. The potential hazard was noticed while investigating https://github.com/raspberrypi/firmware/issues/1644 . Signed-off-by: Phil Elwell --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -661,8 +661,8 @@ static const struct brcmf_firmware_mappi BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) }; -static const struct brcmf_firmware_mapping *brcmf_sdio_fwnames = sdio_fwnames; -static u32 brcmf_sdio_fwnames_count = ARRAY_SIZE(sdio_fwnames); +static const struct brcmf_firmware_mapping *brcmf_sdio_fwnames; +static u32 brcmf_sdio_fwnames_count; #define TXCTL_CREDITS 2 @@ -4556,6 +4556,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru brcmf_dbg(INFO, "completed!!\n"); + brcmf_sdio_fwnames = sdio_fwnames; + brcmf_sdio_fwnames_count = ARRAY_SIZE(sdio_fwnames); of_fwnames = brcmf_of_fwnames(sdiodev->dev, &of_fw_count); if (of_fwnames) fwnames = devm_kcalloc(sdiodev->dev,