diff mbox series

brcmfmac: pcie: fix oops on failure to resume and reprobe

Message ID 20210817063521.22450-1-a.fatoum@pengutronix.de
State New
Headers show
Series brcmfmac: pcie: fix oops on failure to resume and reprobe | expand

Commit Message

Ahmad Fatoum Aug. 17, 2021, 6:35 a.m. UTC
When resuming from suspend, brcmf_pcie_pm_leave_D3 will first attempt a
hot resume and then fall back to removing the PCI device and then
reprobing. If this probe fails, the kernel will oops, because brcmf_err,
which is called to report the failure will dereference the stale bus
pointer. Open code and use the default bus-less brcmf_err to avoid this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
To: Arend van Spriel <aspriel@gmail.com>
To: Franky Lin <franky.lin@broadcom.com>
To: Hante Meuleman <hante.meuleman@broadcom.com>
To: Chi-hsien Lin <chi-hsien.lin@infineon.com>
To: Wright Feng <wright.feng@infineon.com>
To: Chung-hsien Hsu <chung-hsien.hsu@infineon.com>
Cc: SHA-cyfmac-dev-list@infineon.com
Cc: brcm80211-dev-list.pdl@broadcom.com
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Aug. 29, 2021, 11:45 a.m. UTC | #1
Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:

> When resuming from suspend, brcmf_pcie_pm_leave_D3 will first attempt a

> hot resume and then fall back to removing the PCI device and then

> reprobing. If this probe fails, the kernel will oops, because brcmf_err,

> which is called to report the failure will dereference the stale bus

> pointer. Open code and use the default bus-less brcmf_err to avoid this.

> 

> Fixes: 8602e62441ab ("brcmfmac: pass bus to the __brcmf_err() in pcie.c")

> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>


Patch applied to wireless-drivers-next.git, thanks.

d745ca4f2c4a brcmfmac: pcie: fix oops on failure to resume and reprobe

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210817063521.22450-1-a.fatoum@pengutronix.de/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 9ef94d7a7ca7..d824bea4b79d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -2209,7 +2209,7 @@  static int brcmf_pcie_pm_leave_D3(struct device *dev)
 
 	err = brcmf_pcie_probe(pdev, NULL);
 	if (err)
-		brcmf_err(bus, "probe after resume failed, err=%d\n", err);
+		__brcmf_err(NULL, __func__, "probe after resume failed, err=%d\n", err);
 
 	return err;
 }