Skip to contentSkip to conversation

rtw89: Null pointer dereference in rtw89_pci_setup_mapping()

DISCUSSION Bitterblue Smith 2 participants 2 messages May 5, 2025 – May 6, 2025

lore
Share & tools
lore
#0 lore raw

Hi,

People trying to run Openwrt in Qemu ran into this situation where rtwpci->mmap is used before it's initialised:

rtw89_pci_probe()
rtw89_pci_setup_resource()

    rtw89_pci_setup_mapping()
      rtw89_pci_cfg_dac()
        rtw89_pci_config_byte_set()
          rtw89_pci_read_config_byte()
            rtw89_dbi_read8()
              rtw89_write16()
                rtw89_pci_ops_write16()
                  writew(data, rtwpci->mmap + addr);

Their wifi card is RTL8852BE.

It looks like the problem was introduced in kernel 6.11 by commit 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address").

This is not my bug, I'm just forwarding it from
https://github.com/openwrt/openwrt/issues/17025.

#1 lore raw
Quoted 15 lines · Bitterblue Smith

People trying to run Openwrt in Qemu ran into this situation where rtwpci->mmap is used before it's initialised:

rtw89_pci_probe()
rtw89_pci_setup_resource()

    rtw89_pci_setup_mapping()
      rtw89_pci_cfg_dac()
        rtw89_pci_config_byte_set()
          rtw89_pci_read_config_byte()
            rtw89_dbi_read8()
              rtw89_write16()
                rtw89_pci_ops_write16()
                  writew(data, rtwpci->mmap + addr);
Quoted 7 lines

Their wifi card is RTL8852BE.

It looks like the problem was introduced in kernel 6.11 by commit 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address").

This is not my bug, I'm just forwarding it from
https://github.com/openwrt/openwrt/issues/17025.

Thanks for the report. I made and sent a patch [1]. I will also post this information on the github issue.

[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#u