From 8d9288ebfb3c1c5935ca1aac24ccee62559eab92 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 3 Nov 2021 11:53:13 +0000 Subject: [PATCH 609/634] 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(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 5b7118da6ed1..41a6509b5dc1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -662,8 +662,8 @@ static const struct brcmf_firmware_mapping sdio_fwnames[] = { 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 @@ -4557,6 +4557,8 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) 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, -- 2.33.1