public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence
@ 2026-02-20  9:47 Fedor Pchelkin
  2026-02-23  2:09 ` Ping-Ke Shih
  2026-03-03  2:54 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Fedor Pchelkin @ 2026-02-20  9:47 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Fedor Pchelkin, Jian-Hong Pan, Kalle Valo, Kai-Heng Feng,
	linux-wireless, linux-kernel, Bitterblue Smith, Dmitry Antipov,
	lvc-project, stable

pci_upstream_bridge() returns NULL if the device is on a root bus.  If
8821CE is installed in the system with such a PCI topology, the probing
routine will crash.  This has probably been unnoticed as 8821CE is mostly
supplied in laptops where there is a PCI-to-PCI bridge located upstream
from the device.  However the card might be installed on a system with
different configuration.

Check if the bridge does exist for the specific workaround to be applied.

Found by Linux Verification Center (linuxtesting.org) with Svace static
analysis tool.

Fixes: 24f5e38a13b5 ("rtw88: Disable PCIe ASPM while doing NAPI poll on 8821CE")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---

I don't have 8821CE but 8822CE instead and I've been able to reproduce the
NULL bridge pointer dereference with rtwdev->chip->id manually adjusted in
the workaround.  Wifi devices happen to be located on a root bus in most
of the systems I have access to.

 drivers/net/wireless/realtek/rtw88/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 56b16186d3aa..ec0a45bfb670 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -1804,7 +1804,8 @@ int rtw_pci_probe(struct pci_dev *pdev,
 	}
 
 	/* Disable PCIe ASPM L1 while doing NAPI poll for 8821CE */
-	if (rtwdev->chip->id == RTW_CHIP_TYPE_8821C && bridge->vendor == PCI_VENDOR_ID_INTEL)
+	if (rtwdev->chip->id == RTW_CHIP_TYPE_8821C &&
+	    bridge && bridge->vendor == PCI_VENDOR_ID_INTEL)
 		rtwpci->rx_no_aspm = true;
 
 	rtw_pci_phy_cfg(rtwdev);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence
  2026-02-20  9:47 [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence Fedor Pchelkin
@ 2026-02-23  2:09 ` Ping-Ke Shih
  2026-03-03  2:54 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2026-02-23  2:09 UTC (permalink / raw)
  To: Fedor Pchelkin
  Cc: Jian-Hong Pan, Kalle Valo, Kai-Heng Feng,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bitterblue Smith, Dmitry Antipov, lvc-project@linuxtesting.org,
	stable@vger.kernel.org

Fedor Pchelkin <pchelkin@ispras.ru> wrote:
> pci_upstream_bridge() returns NULL if the device is on a root bus.  If
> 8821CE is installed in the system with such a PCI topology, the probing
> routine will crash.  This has probably been unnoticed as 8821CE is mostly
> supplied in laptops where there is a PCI-to-PCI bridge located upstream
> from the device.  However the card might be installed on a system with
> different configuration.
> 
> Check if the bridge does exist for the specific workaround to be applied.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace static
> analysis tool.
> 
> Fixes: 24f5e38a13b5 ("rtw88: Disable PCIe ASPM while doing NAPI poll on 8821CE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence
  2026-02-20  9:47 [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence Fedor Pchelkin
  2026-02-23  2:09 ` Ping-Ke Shih
@ 2026-03-03  2:54 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2026-03-03  2:54 UTC (permalink / raw)
  To: Fedor Pchelkin, Ping-Ke Shih
  Cc: Fedor Pchelkin, Jian-Hong Pan, Kalle Valo, Kai-Heng Feng,
	linux-wireless, linux-kernel, Bitterblue Smith, Dmitry Antipov,
	lvc-project, stable

Fedor Pchelkin <pchelkin@ispras.ru> wrote:

> pci_upstream_bridge() returns NULL if the device is on a root bus.  If
> 8821CE is installed in the system with such a PCI topology, the probing
> routine will crash.  This has probably been unnoticed as 8821CE is mostly
> supplied in laptops where there is a PCI-to-PCI bridge located upstream
> from the device.  However the card might be installed on a system with
> different configuration.
> 
> Check if the bridge does exist for the specific workaround to be applied.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace static
> analysis tool.
> 
> Fixes: 24f5e38a13b5 ("rtw88: Disable PCIe ASPM while doing NAPI poll on 8821CE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

eb101d2abdcc wifi: rtw88: check for PCI upstream bridge existence

---
https://github.com/pkshih/rtw.git


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-03  2:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20  9:47 [PATCH rtw-next] wifi: rtw88: check for PCI upstream bridge existence Fedor Pchelkin
2026-02-23  2:09 ` Ping-Ke Shih
2026-03-03  2:54 ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox