[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221218161836.933697-2-sashal@kernel.org>
Date: Sun, 18 Dec 2022 11:18:07 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Wright Feng <wright.feng@...ress.com>,
Chi-hsien Lin <chi-hsien.lin@...ress.com>,
Ian Lin <ian.lin@...ineon.com>, Kalle Valo <kvalo@...nel.org>,
Sasha Levin <sashal@...nel.org>, aspriel@...il.com,
franky.lin@...adcom.com, hante.meuleman@...adcom.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, marcan@...can.st, linus.walleij@...aro.org,
rmk+kernel@...linux.org.uk, soontak.lee@...ress.com,
alep@...ress.com, linux-wireless@...r.kernel.org,
brcm80211-dev-list.pdl@...adcom.com,
SHA-cyfmac-dev-list@...ineon.com, netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 5.4 02/30] brcmfmac: return error when getting invalid max_flowrings from dongle
From: Wright Feng <wright.feng@...ress.com>
[ Upstream commit 2aca4f3734bd717e04943ddf340d49ab62299a00 ]
When firmware hit trap at initialization, host will read abnormal
max_flowrings number from dongle, and it will cause kernel panic when
doing iowrite to initialize dongle ring.
To detect this error at early stage, we directly return error when getting
invalid max_flowrings(>256).
Signed-off-by: Wright Feng <wright.feng@...ress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@...ress.com>
Signed-off-by: Ian Lin <ian.lin@...ineon.com>
Signed-off-by: Kalle Valo <kvalo@...nel.org>
Link: https://lore.kernel.org/r/20220929031001.9962-3-ian.lin@infineon.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index b5d2e5b9f67c..8d4512c7181e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1109,6 +1109,10 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo)
BRCMF_NROF_H2D_COMMON_MSGRINGS;
max_completionrings = BRCMF_NROF_D2H_COMMON_MSGRINGS;
}
+ if (max_flowrings > 256) {
+ brcmf_err(bus, "invalid max_flowrings(%d)\n", max_flowrings);
+ return -EIO;
+ }
if (devinfo->dma_idx_sz != 0) {
bufsz = (max_submissionrings + max_completionrings) *
--
2.35.1
Powered by blists - more mailing lists