提交 1758b122 编写于 作者: H Hector Martin 提交者: Zheng Zengkai

brcmfmac: pcie: Fix crashes due to early IRQs

stable inclusion
from stable-v5.10.110
commit 88975951d4e04826c3fd077d9b7eadb21ca37bdb
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=88975951d4e04826c3fd077d9b7eadb21ca37bdb

--------------------------------

commit b50255c8 upstream.

The driver was enabling IRQs before the message processing was
initialized. This could cause IRQs to come in too early and crash the
driver. Instead, move the IRQ enable and hostready to a bus preinit
function, at which point everything is properly initialized.

Fixes: 9e37f045 ("brcmfmac: Adding PCIe bus layer support.")
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: NArend van Spriel <arend.vanspriel@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: NHector Martin <marcan@marcan.st>
Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: NKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-7-marcan@marcan.stSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b772e6c4
...@@ -1306,6 +1306,18 @@ static void brcmf_pcie_down(struct device *dev) ...@@ -1306,6 +1306,18 @@ static void brcmf_pcie_down(struct device *dev)
{ {
} }
static int brcmf_pcie_preinit(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
brcmf_dbg(PCIE, "Enter\n");
brcmf_pcie_intr_enable(buspub->devinfo);
brcmf_pcie_hostready(buspub->devinfo);
return 0;
}
static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb) static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb)
{ {
...@@ -1414,6 +1426,7 @@ static int brcmf_pcie_reset(struct device *dev) ...@@ -1414,6 +1426,7 @@ static int brcmf_pcie_reset(struct device *dev)
} }
static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
.preinit = brcmf_pcie_preinit,
.txdata = brcmf_pcie_tx, .txdata = brcmf_pcie_tx,
.stop = brcmf_pcie_down, .stop = brcmf_pcie_down,
.txctl = brcmf_pcie_tx_ctlpkt, .txctl = brcmf_pcie_tx_ctlpkt,
...@@ -1786,9 +1799,6 @@ static void brcmf_pcie_setup(struct device *dev, int ret, ...@@ -1786,9 +1799,6 @@ static void brcmf_pcie_setup(struct device *dev, int ret,
init_waitqueue_head(&devinfo->mbdata_resp_wait); init_waitqueue_head(&devinfo->mbdata_resp_wait);
brcmf_pcie_intr_enable(devinfo);
brcmf_pcie_hostready(devinfo);
ret = brcmf_attach(&devinfo->pdev->dev); ret = brcmf_attach(&devinfo->pdev->dev);
if (ret) if (ret)
goto fail; goto fail;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册