* rtw89 USB: crash fix and RTL8922AU IDs for 7.3.y
@ 2026-11-22 13:23 Josef Schlehofer
2026-11-22 13:23 ` [PATCH 6.18.y] wifi: rtw89: usb: Avoid crash with dynamically added device ID Josef Schlehofer
0 siblings, 1 reply; 2+ messages in thread
From: Josef Schlehofer @ 2026-11-22 13:23 UTC (permalink / raw)
To: stable; +Cc: Ping-Ke Shih, Bitterblue Smith, Nick Venenga, linux-wireless
Hi,
please consider these upstream commits for 7.3.y:
b1827227176821af9bba0cb643728d23328f3660 wifi: rtw89: usb: Avoid crash with dynamically added device ID
de2cb461456143a69845c24ce38ac14a61d6e166 wifi: rtw89: 8922au: Add support for TP-Link TBE400U
475539db19530b7e134f58555e1afcae21d419f3 wifi: rtw89: 8922au: add ASUS BE93
The first one fixes a NULL pointer dereference when a device ID is added
through new_id, the other two only add device IDs. They apply cleanly to
7.3.5 and build without warnings. I did not reproduce the crash myself.
I will send a backport of the first one for 6.18.y, where the RTL8922AU
driver does not exist.
Thanks,
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 6.18.y] wifi: rtw89: usb: Avoid crash with dynamically added device ID
2026-11-22 13:23 rtw89 USB: crash fix and RTL8922AU IDs for 7.3.y Josef Schlehofer
@ 2026-11-22 13:23 ` Josef Schlehofer
0 siblings, 0 replies; 2+ messages in thread
From: Josef Schlehofer @ 2026-11-22 13:23 UTC (permalink / raw)
To: stable; +Cc: Ping-Ke Shih, Bitterblue Smith, linux-wireless
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
[ Upstream commit b1827227176821af9bba0cb643728d23328f3660 ]
Adding a device ID via sysfs causes a crash when the device is plugged
in, because the driver_info pointer is null.
Check for null driver_info in rtw89_usb_probe() and add a wrapper in
each driver to pass it a reasonable default value.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/7a537b2e-67d2-40fb-8ef2-fcbc7bbc93af@gmail.com
[ Dropped the hunks for rtw8852au.c, rtw8852cu.c and rtw8922au.c,
these drivers are not in 6.18. ]
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
Compile tested on 6.18.64 (arm64 defconfig with the rtw89 USB drivers,
W=1, no warnings). The probe through an ID added with new_id was
exercised with the upstream version of this fix in backports 7.2 on an
RTL8922AU. The commit is requested for 7.3.y as well.
drivers/net/wireless/realtek/rtw89/rtw8851bu.c | 8 +++++++-
drivers/net/wireless/realtek/rtw89/rtw8852bu.c | 8 +++++++-
drivers/net/wireless/realtek/rtw89/usb.c | 5 ++++-
drivers/net/wireless/realtek/rtw89/usb.h | 3 ++-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851bu.c b/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
index 10fcfade615..f9078923bba 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
@@ -32,10 +32,16 @@ static const struct usb_device_id rtw_8851bu_id_table[] = {
};
MODULE_DEVICE_TABLE(usb, rtw_8851bu_id_table);
+static int rtw8851bu_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return rtw89_usb_probe(intf, id, &rtw89_8851bu_info);
+}
+
static struct usb_driver rtw_8851bu_driver = {
.name = KBUILD_MODNAME,
.id_table = rtw_8851bu_id_table,
- .probe = rtw89_usb_probe,
+ .probe = rtw8851bu_probe,
.disconnect = rtw89_usb_disconnect,
};
module_usb_driver(rtw_8851bu_driver);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bu.c b/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
index add5987110b..fbeb3f5b737 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
@@ -46,10 +46,16 @@ static const struct usb_device_id rtw_8852bu_id_table[] = {
};
MODULE_DEVICE_TABLE(usb, rtw_8852bu_id_table);
+static int rtw8852bu_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return rtw89_usb_probe(intf, id, &rtw89_8852bu_info);
+}
+
static struct usb_driver rtw_8852bu_driver = {
.name = KBUILD_MODNAME,
.id_table = rtw_8852bu_id_table,
- .probe = rtw89_usb_probe,
+ .probe = rtw8852bu_probe,
.disconnect = rtw89_usb_disconnect,
};
module_usb_driver(rtw_8852bu_driver);
diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index 512a46dd9d0..faf1e471e30 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -931,7 +931,8 @@ static void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,
}
int rtw89_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
+ const struct usb_device_id *id,
+ const struct rtw89_driver_info *default_info)
{
const struct rtw89_driver_info *info;
struct rtw89_dev *rtwdev;
@@ -939,6 +940,8 @@ int rtw89_usb_probe(struct usb_interface *intf,
int ret;
info = (const struct rtw89_driver_info *)id->driver_info;
+ if (!info)
+ info = default_info;
rtwdev = rtw89_alloc_ieee80211_hw(&intf->dev,
sizeof(struct rtw89_usb),
diff --git a/drivers/net/wireless/realtek/rtw89/usb.h b/drivers/net/wireless/realtek/rtw89/usb.h
index c1b4bfa2097..fe0f86dc779 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.h
+++ b/drivers/net/wireless/realtek/rtw89/usb.h
@@ -59,7 +59,8 @@ static inline struct rtw89_usb *rtw89_usb_priv(struct rtw89_dev *rtwdev)
}
int rtw89_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
+ const struct usb_device_id *id,
+ const struct rtw89_driver_info *default_info);
void rtw89_usb_disconnect(struct usb_interface *intf);
#endif
--
2.54.0 (Apple Git-157)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-22 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 13:23 rtw89 USB: crash fix and RTL8922AU IDs for 7.3.y Josef Schlehofer
2026-11-22 13:23 ` [PATCH 6.18.y] wifi: rtw89: usb: Avoid crash with dynamically added device ID Josef Schlehofer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox