All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Lin <ian.lin@infineon.com>
To: <linux-wireless@vger.kernel.org>
Cc: <brcm80211-dev-list@broadcom.com>,
	<brcm80211-dev-list@cypress.com>, <franky.lin@broadcom.com>,
	<hante.meuleman@broadcom.com>, <kvalo@kernel.org>,
	<Double.Lo@infineon.com>, <ian.lin@infineon.com>
Subject: [PATCH 2/3] brcmfmac: return error when getting invalid max_flowrings from dongle
Date: Wed, 28 Sep 2022 22:10:00 -0500	[thread overview]
Message-ID: <20220929031001.9962-3-ian.lin@infineon.com> (raw)
In-Reply-To: <20220929031001.9962-1-ian.lin@infineon.com>

From: Wright Feng <wright.feng@cypress.com>

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@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 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 2b7ebbd7b5b4..1becd50038ab 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1228,6 +1228,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.25.0


  parent reply	other threads:[~2022-09-29  3:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  3:09 [PATCH 0/3] brcmfmac: PCIE debug mechanism series Ian Lin
2022-09-29  3:09 ` [PATCH 1/3] brcmfmac: add a timer to read console periodically in PCIE bus Ian Lin
2022-10-04  7:07   ` Kalle Valo
2022-10-04  8:28   ` Kalle Valo
2022-10-10  9:53   ` Arend Van Spriel
2022-09-29  3:10 ` Ian Lin [this message]
2022-10-10  9:58   ` [PATCH 2/3] brcmfmac: return error when getting invalid max_flowrings from dongle Arend Van Spriel
2023-01-08 20:53   ` chainofflowers
2023-01-09  8:52     ` Arend van Spriel
2023-01-09 17:23       ` chainofflowers
2022-09-29  3:10 ` [PATCH 3/3] brcmfmac: dump dongle memory when attaching failed Ian Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929031001.9962-3-ian.lin@infineon.com \
    --to=ian.lin@infineon.com \
    --cc=Double.Lo@infineon.com \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=brcm80211-dev-list@cypress.com \
    --cc=franky.lin@broadcom.com \
    --cc=hante.meuleman@broadcom.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.