summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHector Martin <marcan@marcan.st>2022-02-01 01:07:06 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:14:42 +0200
commitc3dc96e1b8169d2ce4335fd0318366592a218cfa (patch)
treec232d4a905404c36c9cf9489cbdb421f2f10b235
parentbfcae8cb77c0fb157531a5c329aa723b7274d2f1 (diff)
downloadlinux-stable-c3dc96e1b8169d2ce4335fd0318366592a218cfa.tar.gz
linux-stable-c3dc96e1b8169d2ce4335fd0318366592a218cfa.tar.bz2
linux-stable-c3dc96e1b8169d2ce4335fd0318366592a218cfa.zip
brcmfmac: firmware: Allocate space for default boardrev in nvram
commit d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 upstream. If boardrev is missing from the NVRAM we add a default one, but this might need more space in the output buffer than was allocated. Ensure we have enough padding for this in the buffer. Fixes: 46f2b38a91b0 ("brcmfmac: insert default boardrev in nvram data if missing") Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: Hector Martin <marcan@marcan.st> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220131160713.245637-3-marcan@marcan.st Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index 9927079a9ace..4e5a6c311d1a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -217,6 +217,8 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
size = BRCMF_FW_MAX_NVRAM_SIZE;
else
size = data_len;
+ /* Add space for properties we may add */
+ size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1;
/* Alloc for extra 0 byte + roundup by 4 + length field */
size += 1 + 3 + sizeof(u32);
nvp->nvram = kzalloc(size, GFP_KERNEL);