Skip to contentSkip to conversation

wifi: rtw88: fix wrong pci_get_drvdata type in AER handlers

PATCH In review Ping-Ke Shih 1 participant 2 messages Apr 13 – Apr 29 Realtek wireless driver (rtw88)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/1 wifi: rtw88: fix wrong pci_get_drvdata type in AER handlers

From: Chin-Yen Lee <[email protected]>

rtw88 stores an ieee80211_hw pointer via pci_set_drvdata() at probe time, but io_error_detected() and io_resume() retrieve it as a net_device pointer. This causes netif_device_detach/attach to operate on an ieee80211_hw struct, reading and writing at wrong offsets.

Use ieee80211_stop_queues/wake_queues instead, consistent with every other queue stop/start path in the driver.

Fixes cdb82c80b934 ("wifi: rtw88: pci: add PCI Express error handling")
---
 drivers/net/wireless/realtek/rtw88/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw88/pci.c +4 -4
index bba370ad510c..c56beacbb1b0 100644
@@ -1711,9 +1711,9 @@ static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
 static pci_ers_result_t rtw_pci_io_err_detected(struct pci_dev *pdev,
 						pci_channel_state_t state)
 {
-	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
 
-	netif_device_detach(netdev);
+	ieee80211_stop_queues(hw);
 
 	return PCI_ERS_RESULT_NEED_RESET;
 }
@@ -1730,12 +1730,12 @@ static pci_ers_result_t rtw_pci_io_slot_reset(struct pci_dev *pdev)
 
 static void rtw_pci_io_resume(struct pci_dev *pdev)
 {
-	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
 
 	/* ack any pending wake events, disable PME */
 	pci_enable_wake(pdev, PCI_D0, 0);
 
-	netif_device_attach(netdev);
+	ieee80211_wake_queues(hw);
 }
 
 const struct pci_error_handlers rtw_pci_err_handler = {

base-commit: fa489a77e3267e05df95db96ba98e141ec07cbd9

Signature · 1 line
2.25.1
author maintainer
#1 lore raw
Quoted 8 lines · Ping-Ke Shih

From: Chin-Yen Lee <[email protected]>

rtw88 stores an ieee80211_hw pointer via pci_set_drvdata() at probe time, but io_error_detected() and io_resume() retrieve it as a net_device pointer. This causes netif_device_detach/attach to operate on an ieee80211_hw struct, reading and writing at wrong offsets.

Quoted 6 lines

Use ieee80211_stop_queues/wake_queues instead, consistent with every other queue stop/start path in the driver.

Fixes cdb82c80b934 ("wifi: rtw88: pci: add PCI Express error handling")

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

706183dbef4a wifi: rtw88: fix wrong pci_get_drvdata type in AER handlers

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