* [PATCH] wifi: rtw89: fix wrong pci_get_drvdata type in AER handlers
@ 2026-03-29 7:38 Christos Longros
2026-04-09 3:17 ` Ping-Ke Shih
0 siblings, 1 reply; 3+ messages in thread
From: Christos Longros @ 2026-03-29 7:38 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: linux-wireless, linux-kernel, Christos Longros
rtw89 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. The adjacent io_slot_reset() already does it correctly.
Use ieee80211_stop_queues/wake_queues instead, consistent with
every other queue stop/start path in the driver.
Tested on RTL8852CE by calling the handlers from a test module
before and after the fix.
Signed-off-by: Christos Longros <chris.longros@gmail.com>
---
drivers/net/wireless/realtek/rtw89/pci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index 43c61b3dc..64554eb35 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -4624,9 +4624,9 @@ EXPORT_SYMBOL(rtw89_pm_ops);
static pci_ers_result_t rtw89_pci_io_error_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;
}
@@ -4643,12 +4643,12 @@ static pci_ers_result_t rtw89_pci_io_slot_reset(struct pci_dev *pdev)
static void rtw89_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 rtw89_pci_err_handler = {
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] wifi: rtw89: fix wrong pci_get_drvdata type in AER handlers
2026-03-29 7:38 [PATCH] wifi: rtw89: fix wrong pci_get_drvdata type in AER handlers Christos Longros
@ 2026-04-09 3:17 ` Ping-Ke Shih
2026-04-13 6:06 ` Ping-Ke Shih
0 siblings, 1 reply; 3+ messages in thread
From: Ping-Ke Shih @ 2026-04-09 3:17 UTC (permalink / raw)
To: Christos Longros
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Christos Longros <chris.longros@gmail.com> wrote:
> rtw89 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. The adjacent io_slot_reset() already does it correctly.
>
> Use ieee80211_stop_queues/wake_queues instead, consistent with
> every other queue stop/start path in the driver.
>
> Tested on RTL8852CE by calling the handlers from a test module
> before and after the fix.
Could you share the "test module" you did? I'd like to know how to
test (simulate) the io error.
>
> Signed-off-by: Christos Longros <chris.longros@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] wifi: rtw89: fix wrong pci_get_drvdata type in AER handlers
2026-04-09 3:17 ` Ping-Ke Shih
@ 2026-04-13 6:06 ` Ping-Ke Shih
0 siblings, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2026-04-13 6:06 UTC (permalink / raw)
To: Christos Longros
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Ping-Ke Shih <pkshih@realtek.com> wrote:
> Christos Longros <chris.longros@gmail.com> wrote:
> > rtw89 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. The adjacent io_slot_reset() already does it correctly.
> >
> > Use ieee80211_stop_queues/wake_queues instead, consistent with
> > every other queue stop/start path in the driver.
> >
> > Tested on RTL8852CE by calling the handlers from a test module
> > before and after the fix.
>
> Could you share the "test module" you did? I'd like to know how to
> test (simulate) the io error.
>
> >
I'd add a Fixes tag
Fixes: 16e3d93c6183 ("wifi: rtw89: pci: add PCI Express error handling")
> > Signed-off-by: Christos Longros <chris.longros@gmail.com>
>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-13 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 7:38 [PATCH] wifi: rtw89: fix wrong pci_get_drvdata type in AER handlers Christos Longros
2026-04-09 3:17 ` Ping-Ke Shih
2026-04-13 6:06 ` 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