| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/23 00:20 | flow | patch-triage |
5mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series adds regulatory domain learning support (REGD_LEARN) to the Realtek 802.11ax wireless driver (rtw89). All modified files reside strictly within drivers/net/wireless/realtek/rtw89/ and deal with hardware/firmware runtime interaction (mac80211 operational callbacks, firmware H2C/C2H messaging, channel context pause/proceed, and workqueues). Realtek 802.11ax wireless network adapters (RTL8852/RTL8922) are vendor-specific physical hardware not emulated in standard virtualized environments (QEMU/GCE), and require proprietary firmware blobs and physical register handshakes to complete initialization. The code is structurally unreachable during fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/10/23 00:20 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 71d042b225511b72511621c7abcabbaf083b895a\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Oct 23 00:20:50 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/wireless/realtek/rtw89/chan.h b/drivers/net/wireless/realtek/rtw89/chan.h\nindex f99aca9ef6a44..e9df90c4ce3c3 100644\n--- a/drivers/net/wireless/realtek/rtw89/chan.h\n+++ b/drivers/net/wireless/realtek/rtw89/chan.h\n@@ -97,6 +97,7 @@ enum rtw89_chanctx_pause_reasons {\n \tRTW89_CHANCTX_PAUSE_REASON_HW_SCAN,\n \tRTW89_CHANCTX_PAUSE_REASON_ROC,\n \tRTW89_CHANCTX_PAUSE_REASON_GC_BCN_LOSS,\n+\tRTW89_CHANCTX_PAUSE_REASON_REGD_LEARN,\n };\n \n struct rtw89_chanctx_pause_parm {\ndiff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c\nindex 58ee5efc3b5ef..1cdf78a9a2979 100644\n--- a/drivers/net/wireless/realtek/rtw89/core.c\n+++ b/drivers/net/wireless/realtek/rtw89/core.c\n@@ -5026,6 +5026,8 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)\n \n \tlockdep_assert_wiphy(hw-\u003ewiphy);\n \n+\trtw89_regd_learn_cancel(rtwdev);\n+\n \trtw89_leave_ips_by_hwflags(rtwdev);\n \trtw89_leave_lps(rtwdev);\n \n@@ -5115,6 +5117,8 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)\n \tif (hw-\u003econf.flags \u0026 IEEE80211_CONF_IDLE)\n \t\twiphy_delayed_work_queue(hw-\u003ewiphy, \u0026roc-\u003eroc_work,\n \t\t\t\t\t msecs_to_jiffies(RTW89_ROC_IDLE_TIMEOUT));\n+\n+\trtw89_regd_learn_queue(rtwdev);\n }\n \n void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work)\n@@ -5548,6 +5552,7 @@ void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)\n {\n \tstruct rtw89_hal *hal = \u0026rtwdev-\u003ehal;\n \tu32 old = hal-\u003edisabled_dm_bitmap;\n+\tu32 changes = new ^ old;\n \n \tif (new == old)\n \t\treturn;\n@@ -5555,6 +5560,13 @@ void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)\n \thal-\u003edisabled_dm_bitmap = new;\n \n \trtw89_debug(rtwdev, RTW89_DBG_STATE, \"Disable DM: 0x%x -\u003e 0x%x\\n\", old, new);\n+\n+\tif (changes \u0026 BIT(RTW89_DM_REGD_LEARN)) {\n+\t\tif (new \u0026 BIT(RTW89_DM_REGD_LEARN))\n+\t\t\trtw89_regd_learn_cancel(rtwdev);\n+\t\telse\n+\t\t\trtw89_regd_learn_queue(rtwdev);\n+\t}\n }\n \n void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)\ndiff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h\nindex 0d893b992a4af..27fe4c0fa3165 100644\n--- a/drivers/net/wireless/realtek/rtw89/core.h\n+++ b/drivers/net/wireless/realtek/rtw89/core.h\n@@ -6126,6 +6126,7 @@ enum rtw89_fw_feature {\n \tRTW89_FW_FEATURE_SER_POST_RECOVER_DMAC,\n \tRTW89_FW_FEATURE_TX_HISTORY_V1,\n \tRTW89_FW_FEATURE_NO_DRV_BT_TXRX_EN,\n+\tRTW89_FW_FEATURE_REGD_LEARN,\n \n \tNUM_OF_RTW89_FW_FEATURES,\n };\n@@ -6484,6 +6485,7 @@ enum rtw89_dm_type {\n \tRTW89_DM_INACTIVE_PS,\n \tRTW89_DM_DIG_PD,\n \tRTW89_DM_VCORE,\n+\tRTW89_DM_REGD_LEARN,\n };\n \n #define RTW89_THERMAL_PROT_LV_MAX 5\n@@ -6564,6 +6566,7 @@ enum rtw89_flags {\n \tRTW89_FLAG_HW_RFKILL_STATE,\n \tRTW89_FLAG_UNPLUGGED,\n \tRTW89_FLAG_SHUTDOWN,\n+\tRTW89_FLAG_REGD_LEARNING,\n \n \tNUM_OF_RTW89_FLAGS,\n };\n@@ -7098,6 +7101,19 @@ struct rtw89_regd_ctrl {\n \tconst struct rtw89_regd *map;\n };\n \n+#define RTW89_REGD_LEARN_TIMEOUT 8\n+#define RTW89_REGD_LEARN_CACHE_TTL 3600\n+\n+struct rtw89_regd_learn {\n+\tchar hinted_alpha2[2];\n+\tbool can_activate;\n+\tbool shall_run;\n+\tunsigned long last_hint;\n+\tunsigned int retry;\n+\tstruct wiphy_delayed_work work;\n+\tstruct wiphy_delayed_work timeout_work;\n+};\n+\n #define RTW89_REGD_MAX_COUNTRY_NUM U8_MAX\n #define RTW89_5GHZ_UNII4_CHANNEL_NUM 3\n #define RTW89_5GHZ_UNII4_START_INDEX 25\n@@ -7796,6 +7812,7 @@ struct rtw89_dev {\n \tbool scanning;\n \n \tstruct rtw89_regulatory_info regulatory;\n+\tstruct rtw89_regd_learn regd_learn;\n \tstruct rtw89_sar_info sar;\n \tstruct rtw89_tas_info tas;\n \tstruct rtw89_ant_gain_info ant_gain;\n@@ -9540,6 +9557,11 @@ bool rtw89_legacy_rate_to_bitrate(struct rtw89_dev *rtwdev, u8 legacy_rate, u16\n int rtw89_regd_setup(struct rtw89_dev *rtwdev);\n int rtw89_regd_init_hint(struct rtw89_dev *rtwdev);\n const char *rtw89_regd_get_string(enum rtw89_regulation_type regd);\n+void rtw89_regd_learn_init(struct rtw89_dev *rtwdev);\n+void rtw89_regd_learn_deinit(struct rtw89_dev *rtwdev, bool ser);\n+void rtw89_regd_learn_queue(struct rtw89_dev *rtwdev);\n+void rtw89_regd_learn_cancel(struct rtw89_dev *rtwdev);\n+void rtw89_regd_learn_update(struct rtw89_dev *rtwdev, const char *alpha2, bool sync);\n void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,\n \t\t\t struct rtw89_traffic_stats *stats);\n struct rtw89_wait_response *\ndiff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c\nindex 3a430bd082c3f..49cbdc3e37182 100644\n--- a/drivers/net/wireless/realtek/rtw89/debug.c\n+++ b/drivers/net/wireless/realtek/rtw89/debug.c\n@@ -4777,6 +4777,7 @@ static const struct rtw89_disabled_dm_info {\n \tDM_INFO(INACTIVE_PS),\n \tDM_INFO(DIG_PD),\n \tDM_INFO(VCORE),\n+\tDM_INFO(REGD_LEARN),\n };\n \n static ssize_t\ndiff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c\nindex ea7dba077f5d0..07102c2c78ed2 100644\n--- a/drivers/net/wireless/realtek/rtw89/fw.c\n+++ b/drivers/net/wireless/realtek/rtw89/fw.c\n@@ -993,6 +993,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {\n \t__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 128, 0, LPS_DACK_BY_C2H_REG),\n \t__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 128, 0, CRASH_TRIGGER_TYPE_1),\n \t__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 129, 1, BEACON_TRACKING),\n+\t__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 138, 1, REGD_LEARN),\n \t__CFG_FW_FEAT(RTL8852C, ge, 0, 29, 94, 0, SER_L1_BY_EVENT),\n \t__CFG_FW_FEAT(RTL8852C, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),\n \t__CFG_FW_FEAT(RTL8922A, ge, 0, 0, 0, 0, RFK_PRE_NOTIFY_V0),\n@@ -1045,6 +1046,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {\n \t__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 113, 2, SCAN_OFFLOAD_BE_V2),\n \t__CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 0, LPS_ML_INFO_V1_EXTRA),\n \t__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 119, 0, CH_INFO_BE_V1),\n+\t__CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 2, REGD_LEARN),\n \t__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 119, 3, NO_DRV_BT_TXRX_EN),\n };\n \n@@ -11129,6 +11131,47 @@ int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev,\n \treturn ret;\n }\n \n+int rtw89_fw_h2c_regd_learn(struct rtw89_dev *rtwdev, const char *dflt)\n+{\n+\tstruct rtw89_wait_info *wait = \u0026rtwdev-\u003emac.fw_ofld_wait;\n+\tstruct rtw89_h2c_regd_learn *h2c;\n+\tu32 len = sizeof(*h2c);\n+\tstruct sk_buff *skb;\n+\tbool abort = !dflt;\n+\tint ret;\n+\n+\tskb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);\n+\tif (!skb) {\n+\t\trtw89_err(rtwdev, \"failed to alloc skb for regd_learn\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tskb_put(skb, len);\n+\th2c = (struct rtw89_h2c_regd_learn *)skb-\u003edata;\n+\th2c-\u003ew0 = le32_encode_bits(abort ? 0 : dflt[0],\n+\t\t\t\t RTW89_H2C_REGD_LEARN_W0_COUNTRY_0) |\n+\t\t le32_encode_bits(abort ? 0 : dflt[1],\n+\t\t\t\t RTW89_H2C_REGD_LEARN_W0_COUNTRY_1) |\n+\t\t le32_encode_bits(abort, RTW89_H2C_REGD_LEARN_W0_ABORT);\n+\n+\trtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,\n+\t\t\t H2C_CAT_MAC, H2C_CL_MAC_FW_OFLD,\n+\t\t\t H2C_FUNC_REGD_LEARN, 0, 0, len);\n+\n+\tif (abort)\n+\t\treturn rtw89_h2c_tx_and_wait(rtwdev, skb, wait,\n+\t\t\t\t\t RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT);\n+\n+\tret = rtw89_h2c_tx(rtwdev, skb, false);\n+\tif (ret) {\n+\t\trtw89_err(rtwdev, \"failed to send regd_learn h2c\\n\");\n+\t\tdev_kfree_skb_any(skb);\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n #define H2C_FW_CPU_EXCEPTION_TYPE_0 0x5566\n #define H2C_FW_CPU_EXCEPTION_TYPE_1 0x0\n int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev)\ndiff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h\nindex e4d3331fc18f1..50b813a3eed41 100644\n--- a/drivers/net/wireless/realtek/rtw89/fw.h\n+++ b/drivers/net/wireless/realtek/rtw89/fw.h\n@@ -4000,6 +4000,7 @@ struct rtw89_fw_c2h_attr {\n \tu8 class;\n \tu8 func;\n \tu16 len;\n+\tu8 ignore: 1;\n \tu8 is_scan_event: 1;\n \tu8 scan_seq: 2;\n };\n@@ -4179,6 +4180,22 @@ struct rtw89_c2h_scanofld {\n #define RTW89_C2H_SCANOFLD_W8_PERIOD_V1 GENMASK(15, 0)\n #define RTW89_C2H_SCANOFLD_W8_EXPECT_PERIOD_V1 GENMASK(31, 16)\n \n+struct rtw89_c2h_regd_learn {\n+\tstruct rtw89_c2h_hdr hdr;\n+\t__le32 w2;\n+} __packed;\n+\n+#define RTW89_C2H_REGD_LEARN_W2_STATUS GENMASK(7, 0)\n+#define RTW89_C2H_REGD_LEARN_W2_COUNTRY_0 GENMASK(15, 8)\n+#define RTW89_C2H_REGD_LEARN_W2_COUNTRY_1 GENMASK(23, 16)\n+\n+enum rtw89_c2h_regd_learn_status {\n+\tRTW89_C2H_REGD_LEARN_NONE = 0,\n+\tRTW89_C2H_REGD_LEARN_LEARNED = 1,\n+\tRTW89_C2H_REGD_LEARN_VERIFIED = 2,\n+\tRTW89_C2H_REGD_LEARN_ABORT = 3,\n+};\n+\n #define RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h) \\\n \tle32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))\n #define RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h) \\\n@@ -4856,10 +4873,19 @@ enum rtw89_fw_ofld_h2c_func {\n \tH2C_FUNC_MAC_MACID_PAUSE_SLEEP\t= 0x28,\n \tH2C_FUNC_SCANOFLD_BE\t\t= 0x2c,\n \tH2C_FUNC_TRX_PROTECT\t\t= 0x34,\n+\tH2C_FUNC_REGD_LEARN\t\t= 0x53,\n \n \tNUM_OF_RTW89_FW_OFLD_H2C_FUNC,\n };\n \n+struct rtw89_h2c_regd_learn {\n+\t__le32 w0;\n+} __packed;\n+\n+#define RTW89_H2C_REGD_LEARN_W0_COUNTRY_0\tGENMASK(7, 0)\n+#define RTW89_H2C_REGD_LEARN_W0_COUNTRY_1\tGENMASK(15, 8)\n+#define RTW89_H2C_REGD_LEARN_W0_ABORT\t\tBIT(16)\n+\n #define RTW89_FW_OFLD_WAIT_COND(tag, func) \\\n \t((tag) * NUM_OF_RTW89_FW_OFLD_H2C_FUNC + (func))\n \n@@ -4867,6 +4893,8 @@ enum rtw89_fw_ofld_h2c_func {\n \tRTW89_FW_OFLD_WAIT_COND(RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op), \\\n \t\t\t\tH2C_FUNC_PACKET_OFLD)\n #define RTW89_FW_OFLD_WAIT_COND_TRX_PROTECT RTW89_FW_OFLD_WAIT_COND(0, H2C_FUNC_TRX_PROTECT)\n+#define RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT \\\n+\tRTW89_FW_OFLD_WAIT_COND(1, H2C_FUNC_REGD_LEARN)\n \n #define RTW89_SCANOFLD_WAIT_COND_ADD_CH RTW89_FW_OFLD_WAIT_COND(0, H2C_FUNC_ADD_SCANOFLD_CH)\n \n@@ -5684,6 +5712,7 @@ int rtw89_hw_scan_append_wildcard_probe_req(struct rtw89_dev *rtwdev,\n \t\t\t\t\t const u8 *mac_addr, bool wowlan);\n void rtw89_hw_scan_calc_req_ssid(struct rtw89_dev *rtwdev,\n \t\t\t\t struct rtw89_vif_link *rtwvif_link, bool wowlan);\n+int rtw89_fw_h2c_regd_learn(struct rtw89_dev *rtwdev, const char *dflt);\n int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev);\n int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,\n \t\t\t const struct rtw89_pkt_drop_params *params);\ndiff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c\nindex de8598ba441f4..41796bff08edd 100644\n--- a/drivers/net/wireless/realtek/rtw89/mac.c\n+++ b/drivers/net/wireless/realtek/rtw89/mac.c\n@@ -5420,6 +5420,7 @@ rtw89_mac_bcn_fltr_rpt(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_l\n \tswitch (type) {\n \tcase RTW89_BCN_FLTR_BEACON_LOSS:\n \t\tif (!rtwdev-\u003escanning \u0026\u0026 !rtwvif-\u003eoffchan \u0026\u0026\n+\t\t !test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags) \u0026\u0026\n \t\t !rtwvif_link-\u003enoa_once.in_duration) {\n \t\t\tstart_detect = rtw89_mcc_detect_go_bcn(rtwdev, rtwvif_link);\n \t\t\tif (start_detect)\n@@ -6069,6 +6070,47 @@ rtw89_mac_c2h_pwr_int_notify(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32\n \trcu_read_unlock();\n }\n \n+static void\n+rtw89_mac_c2h_regd_learn(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 len)\n+{\n+\tconst struct rtw89_c2h_regd_learn *c2h =\n+\t\t(const struct rtw89_c2h_regd_learn *)skb-\u003edata;\n+\tconst struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(skb);\n+\tconst char *res;\n+\tchar alpha2[2];\n+\tu8 status;\n+\n+\tif (len \u003c sizeof(*c2h))\n+\t\treturn;\n+\n+\tif (attr-\u003eignore)\n+\t\treturn;\n+\n+\tif (!test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags))\n+\t\treturn;\n+\n+\tstatus = le32_get_bits(c2h-\u003ew2, RTW89_C2H_REGD_LEARN_W2_STATUS);\n+\talpha2[0] = le32_get_bits(c2h-\u003ew2, RTW89_C2H_REGD_LEARN_W2_COUNTRY_0);\n+\talpha2[1] = le32_get_bits(c2h-\u003ew2, RTW89_C2H_REGD_LEARN_W2_COUNTRY_1);\n+\n+\tswitch (status) {\n+\tcase RTW89_C2H_REGD_LEARN_NONE:\n+\t\trtw89_debug(rtwdev, RTW89_DBG_REGD,\n+\t\t\t \"regd_learn: c2h none\\n\");\n+\t\tres = NULL;\n+\t\tbreak;\n+\tcase RTW89_C2H_REGD_LEARN_LEARNED:\n+\tcase RTW89_C2H_REGD_LEARN_VERIFIED:\n+\t\tres = alpha2;\n+\t\tbreak;\n+\tdefault:\n+\t\trtw89_warn(rtwdev, \"regd_learn: c2h unknown (status=%d)\\n\", status);\n+\t\treturn;\n+\t}\n+\n+\trtw89_regd_learn_update(rtwdev, res, true);\n+}\n+\n static\n void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,\n \t\t\t\t\t struct sk_buff *c2h, u32 len) = {\n@@ -6081,6 +6123,7 @@ void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,\n \t[RTW89_MAC_C2H_FUNC_TX_DUTY_RPT] = rtw89_mac_c2h_tx_duty_rpt,\n \t[RTW89_MAC_C2H_FUNC_TSF32_TOGL_RPT] = rtw89_mac_c2h_tsf32_toggle_rpt,\n \t[RTW89_MAC_C2H_FUNC_BCNFLTR_RPT] = rtw89_mac_c2h_bcn_fltr_rpt,\n+\t[RTW89_MAC_C2H_FUNC_REGD_LEARN] = rtw89_mac_c2h_regd_learn,\n };\n \n static\n@@ -6168,6 +6211,29 @@ static void rtw89_mac_c2h_scanofld_rsp_atomic(struct rtw89_dev *rtwdev,\n \t}\n }\n \n+static void rtw89_mac_c2h_regd_learn_atomic(struct rtw89_dev *rtwdev,\n+\t\t\t\t\t struct sk_buff *skb)\n+{\n+\tconst struct rtw89_c2h_regd_learn *c2h =\n+\t\t(const struct rtw89_c2h_regd_learn *)skb-\u003edata;\n+\tstruct rtw89_wait_info *fw_ofld_wait = \u0026rtwdev-\u003emac.fw_ofld_wait;\n+\tstruct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(skb);\n+\tstruct rtw89_completion_data data = {};\n+\tu8 status;\n+\n+\tif (attr-\u003elen \u003c sizeof(*c2h))\n+\t\treturn;\n+\n+\tstatus = le32_get_bits(c2h-\u003ew2, RTW89_C2H_REGD_LEARN_W2_STATUS);\n+\tif (status != RTW89_C2H_REGD_LEARN_ABORT)\n+\t\treturn;\n+\n+\trtw89_complete_cond(fw_ofld_wait, RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT,\n+\t\t\t \u0026data);\n+\n+\tattr-\u003eignore = true;\n+}\n+\n bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, struct sk_buff *c2h,\n \t\t\t u8 class, u8 func)\n {\n@@ -6191,6 +6257,9 @@ bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, struct sk_buff *c2h,\n \t\t\treturn false;\n \t\tcase RTW89_MAC_C2H_FUNC_PKT_OFLD_RSP:\n \t\t\treturn true;\n+\t\tcase RTW89_MAC_C2H_FUNC_REGD_LEARN:\n+\t\t\trtw89_mac_c2h_regd_learn_atomic(rtwdev, c2h);\n+\t\t\treturn false;\n \t\t}\n \tcase RTW89_MAC_C2H_CLASS_MCC:\n \t\treturn true;\ndiff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h\nindex 8419bcd3956a9..db42e33e694c6 100644\n--- a/drivers/net/wireless/realtek/rtw89/mac.h\n+++ b/drivers/net/wireless/realtek/rtw89/mac.h\n@@ -413,6 +413,7 @@ enum rtw89_mac_c2h_ofld_func {\n \tRTW89_MAC_C2H_FUNC_SCANOFLD_RSP = 0x9,\n \tRTW89_MAC_C2H_FUNC_TX_DUTY_RPT = 0xa,\n \tRTW89_MAC_C2H_FUNC_BCNFLTR_RPT = 0xd,\n+\tRTW89_MAC_C2H_FUNC_REGD_LEARN = 0x24,\n \tRTW89_MAC_C2H_FUNC_OFLD_MAX,\n };\n \ndiff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c\nindex 9e6cafc492c44..5abf71a6ed1f6 100644\n--- a/drivers/net/wireless/realtek/rtw89/mac80211.c\n+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c\n@@ -57,10 +57,17 @@ static void rtw89_ops_wake_tx_queue(struct ieee80211_hw *hw,\n static int rtw89_ops_start(struct ieee80211_hw *hw)\n {\n \tstruct rtw89_dev *rtwdev = hw-\u003epriv;\n+\tint ret;\n \n \tlockdep_assert_wiphy(hw-\u003ewiphy);\n \n-\treturn rtw89_core_start(rtwdev);\n+\tret = rtw89_core_start(rtwdev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\trtw89_regd_learn_init(rtwdev);\n+\n+\treturn 0;\n }\n \n static void rtw89_ops_stop(struct ieee80211_hw *hw, bool suspend)\n@@ -69,6 +76,8 @@ static void rtw89_ops_stop(struct ieee80211_hw *hw, bool suspend)\n \n \tlockdep_assert_wiphy(hw-\u003ewiphy);\n \n+\trtw89_regd_learn_deinit(rtwdev, false);\n+\n \trtw89_core_stop(rtwdev);\n }\n \n@@ -95,7 +104,8 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)\n \n \tif ((changed \u0026 IEEE80211_CONF_CHANGE_IDLE) \u0026\u0026\n \t (hw-\u003econf.flags \u0026 IEEE80211_CONF_IDLE) \u0026\u0026\n-\t !rtwdev-\u003escanning)\n+\t !rtwdev-\u003escanning \u0026\u0026\n+\t !test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags))\n \t\trtw89_enter_ips(rtwdev);\n \n \tif (changed \u0026 IEEE80211_CONF_CHANGE_MONITOR)\n@@ -1298,7 +1308,8 @@ static int rtw89_ops_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\n \t\treturn -EBUSY;\n \t}\n \n-\tif (rtwdev-\u003escanning || rtwvif-\u003eoffchan)\n+\tif (rtwdev-\u003escanning || rtwvif-\u003eoffchan ||\n+\t test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags))\n \t\treturn -EBUSY;\n \n \trtwvif_link = rtw89_get_designated_link(rtwvif);\n@@ -1413,6 +1424,8 @@ static int rtw89_ops_assign_vif_chanctx(struct ieee80211_hw *hw,\n \t\treturn -ENOLINK;\n \t}\n \n+\trtw89_regd_learn_deinit(rtwdev, false);\n+\n \treturn rtw89_chanctx_ops_assign_vif(rtwdev, rtwvif_link, ctx);\n }\n \n@@ -1424,6 +1437,7 @@ static void rtw89_ops_unassign_vif_chanctx(struct ieee80211_hw *hw,\n \tstruct rtw89_dev *rtwdev = hw-\u003epriv;\n \tstruct rtw89_vif *rtwvif = vif_to_rtwvif(vif);\n \tstruct rtw89_vif_link *rtwvif_link;\n+\tunsigned int count = 0;\n \n \tlockdep_assert_wiphy(hw-\u003ewiphy);\n \n@@ -1436,6 +1450,12 @@ static void rtw89_ops_unassign_vif_chanctx(struct ieee80211_hw *hw,\n \t}\n \n \trtw89_chanctx_ops_unassign_vif(rtwdev, rtwvif_link, ctx);\n+\n+\trtw89_for_each_active_rtwvif(rtwdev, rtwvif)\n+\t\tcount++;\n+\n+\tif (count == 0)\n+\t\trtw89_regd_learn_init(rtwdev);\n }\n \n static\n@@ -1737,6 +1757,9 @@ int rtw89_ops_change_vif_links(struct ieee80211_hw *hw,\n \t\trcu_assign_pointer(rtwvif-\u003esnap_link_confs, snap);\n \t}\n \n+\t/* might enter ips without defer work */\n+\trtw89_regd_learn_cancel(rtwdev);\n+\n \t/* might depend on @snap; don't change order */\n \trtw89_leave_ips_by_hwflags(rtwdev);\n \n@@ -1780,6 +1803,9 @@ int rtw89_ops_change_vif_links(struct ieee80211_hw *hw,\n \t\trtw89_vif_update_fw_links(rtwdev, rtwvif, new_links, false);\n \n \trtw89_enter_ips_by_hwflags(rtwdev);\n+\n+\trtw89_regd_learn_queue(rtwdev);\n+\n \treturn ret;\n }\n \ndiff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c\nindex ddb27c7782a98..6d19e759fc0d9 100644\n--- a/drivers/net/wireless/realtek/rtw89/pci.c\n+++ b/drivers/net/wireless/realtek/rtw89/pci.c\n@@ -4268,6 +4268,7 @@ static void rtw89_pci_recalc_int_mit(struct rtw89_dev *rtwdev)\n \tu32 val = 0;\n \n \tif (rtwdev-\u003escanning ||\n+\t test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags) ||\n \t (tx_tfc_lv \u003c RTW89_TFC_HIGH \u0026\u0026 rx_tfc_lv \u003c RTW89_TFC_HIGH))\n \t\tgoto out;\n \ndiff --git a/drivers/net/wireless/realtek/rtw89/ps.h b/drivers/net/wireless/realtek/rtw89/ps.h\nindex 729477153de66..dee4d25da8cd9 100644\n--- a/drivers/net/wireless/realtek/rtw89/ps.h\n+++ b/drivers/net/wireless/realtek/rtw89/ps.h\n@@ -41,8 +41,9 @@ static inline void rtw89_enter_ips_by_hwflags(struct rtw89_dev *rtwdev)\n {\n \tstruct ieee80211_hw *hw = rtwdev-\u003ehw;\n \n-\t/* prevent entering IPS after ROC, but it is scanning */\n-\tif (rtwdev-\u003escanning)\n+\t/* prevent entering IPS after ROC, but it is scanning or regd learning */\n+\tif (rtwdev-\u003escanning ||\n+\t test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags))\n \t\treturn;\n \n \tif (hw-\u003econf.flags \u0026 IEEE80211_CONF_IDLE)\ndiff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c\nindex ec345feed184d..6acec34036adf 100644\n--- a/drivers/net/wireless/realtek/rtw89/regd.c\n+++ b/drivers/net/wireless/realtek/rtw89/regd.c\n@@ -3,7 +3,9 @@\n */\n \n #include \"acpi.h\"\n+#include \"chan.h\"\n #include \"debug.h\"\n+#include \"fw.h\"\n #include \"ps.h\"\n #include \"util.h\"\n \n@@ -706,6 +708,252 @@ static void rtw89_regd_setup_reg_rules(struct rtw89_dev *rtwdev)\n \tkfree(ptr);\n }\n \n+void rtw89_regd_learn_queue(struct rtw89_dev *rtwdev)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstatic const unsigned int backoff_list[] = {\n+\t\t4, 4, 4, 8, 16, 64, 256, 512, 1024, 2048,\n+\t};\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\tstruct rtw89_hal *hal = \u0026rtwdev-\u003ehal;\n+\tunsigned int delay;\n+\tunsigned int index;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tif (!regd_learn-\u003ecan_activate)\n+\t\treturn;\n+\n+\tif (!regd_learn-\u003eshall_run)\n+\t\treturn;\n+\n+\tif (hal-\u003edisabled_dm_bitmap \u0026 BIT(RTW89_DM_REGD_LEARN))\n+\t\treturn;\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: queue (retry=%u)\\n\",\n+\t\t regd_learn-\u003eretry);\n+\n+\tindex = min_t(unsigned int, regd_learn-\u003eretry,\n+\t\t ARRAY_SIZE(backoff_list) - 1);\n+\tdelay = backoff_list[index] * HZ;\n+\n+\twiphy_delayed_work_queue(wiphy, \u0026regd_learn-\u003ework, delay);\n+}\n+\n+static int __rtw89_regd_learn_retry(struct rtw89_dev *rtwdev, void *data)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\n+\tregd_learn-\u003eretry++;\n+\trtw89_regd_learn_queue(rtwdev);\n+\n+\treturn 0;\n+}\n+\n+static void __rtw89_regd_learn_start_setup(struct rtw89_dev *rtwdev)\n+{\n+\tstruct rtw89_chanctx_pause_parm pause_parm = {\n+\t\t.rsn = RTW89_CHANCTX_PAUSE_REASON_REGD_LEARN,\n+\t};\n+\n+\trtw89_leave_ips_by_hwflags(rtwdev);\n+\trtw89_leave_lps(rtwdev);\n+\trtw89_chanctx_pause(rtwdev, \u0026pause_parm);\n+\n+\tset_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags);\n+}\n+\n+static void __rtw89_regd_learn_stop_cleanup(struct rtw89_dev *rtwdev, bool retry)\n+{\n+\tstatic const struct rtw89_chanctx_cb_parm cb_retry = {\n+\t\t.cb = __rtw89_regd_learn_retry,\n+\t\t.data = NULL,\n+\t\t.caller = __func__,\n+\t};\n+\n+\tclear_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags);\n+\n+\trtw89_chanctx_proceed(rtwdev, retry ? \u0026cb_retry : NULL);\n+\trtw89_enter_ips_by_hwflags(rtwdev);\n+}\n+\n+static void __rtw89_regd_learn_finish(struct rtw89_dev *rtwdev, bool retry)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\n+\twiphy_delayed_work_cancel(wiphy, \u0026regd_learn-\u003ework);\n+\twiphy_delayed_work_cancel(wiphy, \u0026regd_learn-\u003etimeout_work);\n+\n+\tif (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags))\n+\t\t__rtw89_regd_learn_stop_cleanup(rtwdev, retry);\n+}\n+\n+void rtw89_regd_learn_cancel(struct rtw89_dev *rtwdev)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\tint ret;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tif (!regd_learn-\u003ecan_activate)\n+\t\treturn;\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: cancel\\n\");\n+\n+\tif (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags)) {\n+\t\tret = rtw89_fw_h2c_regd_learn(rtwdev, NULL);\n+\t\tif (ret)\n+\t\t\trtw89_warn(rtwdev, \"regd_learn: abort failed (ret=%d)\\n\", ret);\n+\t}\n+\n+\t__rtw89_regd_learn_finish(rtwdev, false);\n+}\n+\n+void rtw89_regd_learn_update(struct rtw89_dev *rtwdev, const char *alpha2, bool sync)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\tconst struct ieee80211_regdomain *wiphy_regd = get_wiphy_regdom(wiphy);\n+\tint ret;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\t/*\n+\t * Calls with REGD_LEARNING are only allowed in c2h context,\n+\t * i.e. other callers should rtw89_regd_learn_cancel() first.\n+\t */\n+\tif (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev-\u003eflags)) {\n+\t\t__rtw89_regd_learn_finish(rtwdev, !alpha2);\n+\n+\t\tif (!alpha2)\n+\t\t\treturn;\n+\n+\t\tregd_learn-\u003eshall_run = false;\n+\t\tregd_learn-\u003eretry = 0;\n+\t} else {\n+\t\tregd_learn-\u003eretry = 0;\n+\n+\t\tif (!wiphy_regd || memcmp(alpha2, wiphy_regd-\u003ealpha2, 2) == 0)\n+\t\t\treturn;\n+\t}\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD,\n+\t\t \"regd_learn: reg_hint %.2s (sync=%d)\\n\", alpha2, sync);\n+\n+\tret = regulatory_hint(wiphy, alpha2);\n+\tif (ret) {\n+\t\trtw89_warn(rtwdev, \"regd_learn: reg_hint failed (ret=%d)\\n\", ret);\n+\t\treturn;\n+\t}\n+\n+\tif (!sync)\n+\t\treturn;\n+\n+\tmemcpy(regd_learn-\u003ehinted_alpha2, alpha2, 2);\n+\tregd_learn-\u003elast_hint = jiffies;\n+}\n+\n+static void rtw89_regd_learn_work(struct wiphy *wiphy, struct wiphy_work *work)\n+{\n+\tstruct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,\n+\t\t\t\t\t\tregd_learn.work.work);\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tchar *alpha2 = regd_learn-\u003ehinted_alpha2;\n+\tint ret;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\twiphy_delayed_work_cancel(wiphy, \u0026regd_learn-\u003etimeout_work);\n+\n+\tif (rtwdev-\u003escanning || rtw89_chanctx_paused(rtwdev)) {\n+\t\trtw89_regd_learn_queue(rtwdev);\n+\t\treturn;\n+\t}\n+\n+\tif (regd_learn-\u003elast_hint \u0026\u0026\n+\t time_is_before_jiffies(regd_learn-\u003elast_hint +\n+\t\t\t\t RTW89_REGD_LEARN_CACHE_TTL * HZ)) {\n+\t\trtw89_debug(rtwdev, RTW89_DBG_REGD,\n+\t\t\t \"regd_learn: %.2s is outdated\\n\", alpha2);\n+\t\tmemset(alpha2, 0, 2);\n+\t}\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: start\\n\");\n+\n+\t__rtw89_regd_learn_start_setup(rtwdev);\n+\n+\tret = rtw89_fw_h2c_regd_learn(rtwdev, alpha2);\n+\tif (ret) {\n+\t\trtw89_warn(rtwdev, \"regd_learn: h2c failed (ret=%d)\\n\", ret);\n+\t\t__rtw89_regd_learn_stop_cleanup(rtwdev, true);\n+\t\treturn;\n+\t}\n+\n+\twiphy_delayed_work_queue(wiphy, \u0026regd_learn-\u003etimeout_work,\n+\t\t\t\t RTW89_REGD_LEARN_TIMEOUT * HZ);\n+}\n+\n+static void rtw89_regd_learn_timeout_work(struct wiphy *wiphy, struct wiphy_work *work)\n+{\n+\tstruct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,\n+\t\t\t\t\t\tregd_learn.timeout_work.work);\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: timeout\\n\");\n+\n+\trtw89_regd_learn_cancel(rtwdev);\n+\t__rtw89_regd_learn_retry(rtwdev, NULL);\n+}\n+\n+void rtw89_regd_learn_init(struct rtw89_dev *rtwdev)\n+{\n+\tstruct rtw89_regulatory_info *regulatory = \u0026rtwdev-\u003eregulatory;\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tif (regd_learn-\u003ecan_activate)\n+\t\treturn;\n+\n+\tregd_learn-\u003ecan_activate = !regulatory-\u003eprogrammed \u0026\u0026\n+\t\t\t\t RTW89_CHK_FW_FEATURE(REGD_LEARN, \u0026rtwdev-\u003efw);\n+\tif (!regd_learn-\u003ecan_activate)\n+\t\treturn;\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: init\\n\");\n+\n+\twiphy_delayed_work_init(\u0026regd_learn-\u003ework, rtw89_regd_learn_work);\n+\twiphy_delayed_work_init(\u0026regd_learn-\u003etimeout_work, rtw89_regd_learn_timeout_work);\n+\n+\tregd_learn-\u003eretry = 0;\n+\n+\trtw89_regd_learn_queue(rtwdev);\n+}\n+\n+void rtw89_regd_learn_deinit(struct rtw89_dev *rtwdev, bool ser)\n+{\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\tstruct wiphy *wiphy = rtwdev-\u003ehw-\u003ewiphy;\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\tif (!regd_learn-\u003ecan_activate)\n+\t\treturn;\n+\n+\tif (ser)\n+\t\t__rtw89_regd_learn_finish(rtwdev, false);\n+\telse\n+\t\trtw89_regd_learn_cancel(rtwdev);\n+\n+\trtw89_debug(rtwdev, RTW89_DBG_REGD, \"regd_learn: deinit\\n\");\n+\n+\tregd_learn-\u003ecan_activate = false;\n+}\n+\n int rtw89_regd_setup(struct rtw89_dev *rtwdev)\n {\n \tstruct rtw89_regulatory_info *regulatory = \u0026rtwdev-\u003eregulatory;\n@@ -883,6 +1131,8 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,\n \t\t\t\t struct wiphy *wiphy,\n \t\t\t\t struct regulatory_request *request)\n {\n+\tstruct rtw89_regd_learn *regd_learn = \u0026rtwdev-\u003eregd_learn;\n+\n \trtwdev-\u003eregulatory.regd = rtw89_regd_find_reg_by_name(rtwdev, request-\u003ealpha2);\n \t/* This notification might be set from the system of distros,\n \t * and it does not expect the regulatory will be modified by\n@@ -893,6 +1143,18 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,\n \t\twiphy-\u003eregulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;\n \telse\n \t\twiphy-\u003eregulatory_flags \u0026= ~REGULATORY_COUNTRY_IE_IGNORE;\n+\n+\trtw89_regd_learn_cancel(rtwdev);\n+\n+\tregd_learn-\u003eshall_run = request-\u003einitiator != NL80211_REGDOM_SET_BY_USER \u0026\u0026\n+\t\t\t\tmemcmp(request-\u003ealpha2, \"00\", 2) == 0;\n+\tif (!regd_learn-\u003eshall_run) {\n+\t\trtw89_regd_learn_update(rtwdev, request-\u003ealpha2,\n+\t\t\t\t\trequest-\u003einitiator != NL80211_REGDOM_SET_BY_USER);\n+\t\treturn;\n+\t}\n+\n+\trtw89_regd_learn_queue(rtwdev);\n }\n \n static\ndiff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c\nindex 045dac0bd1db4..3dc1b8a8dc2b5 100644\n--- a/drivers/net/wireless/realtek/rtw89/ser.c\n+++ b/drivers/net/wireless/realtek/rtw89/ser.c\n@@ -726,6 +726,7 @@ static void ser_l2_reset_st_pre_hdl(struct rtw89_ser *ser)\n bottom:\n \trtw89_ser_cd_free(rtwdev, buf, !!ret);\n \n+\trtw89_regd_learn_deinit(rtwdev, true);\n \tser_reset_mac_binding(rtwdev);\n \trtw89_core_stop(rtwdev);\n \trtw89_entity_init(rtwdev);\n"
} |
| 2/1 | 2026/10/23 00:20 | agent | patch-evaluator |
5mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series adds regulatory domain learning support (REGD_LEARN) to the Realtek 802.11ax wireless driver (rtw89). All modified files reside strictly within drivers/net/wireless/realtek/rtw89/ and deal with hardware/firmware runtime interaction (mac80211 operational callbacks, firmware H2C/C2H messaging, channel context pause/proceed, and workqueues). Realtek 802.11ax wireless network adapters (RTL8852/RTL8922) are vendor-specific physical hardware not emulated in standard virtualized environments (QEMU/GCE), and require proprietary firmware blobs and physical register handshakes to complete initialization. The code is structurally unreachable during fuzzing.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 71d042b225511b72511621c7abcabbaf083b895a
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Oct 23 00:20:50 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/wireless/realtek/rtw89/chan.h b/drivers/net/wireless/realtek/rtw89/chan.h
index f99aca9ef6a44..e9df90c4ce3c3 100644
--- a/drivers/net/wireless/realtek/rtw89/chan.h
+++ b/drivers/net/wireless/realtek/rtw89/chan.h
@@ -97,6 +97,7 @@ enum rtw89_chanctx_pause_reasons {
RTW89_CHANCTX_PAUSE_REASON_HW_SCAN,
RTW89_CHANCTX_PAUSE_REASON_ROC,
RTW89_CHANCTX_PAUSE_REASON_GC_BCN_LOSS,
+ RTW89_CHANCTX_PAUSE_REASON_REGD_LEARN,
};
struct rtw89_chanctx_pause_parm {
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 58ee5efc3b5ef..1cdf78a9a2979 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -5026,6 +5026,8 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
lockdep_assert_wiphy(hw->wiphy);
+ rtw89_regd_learn_cancel(rtwdev);
+
rtw89_leave_ips_by_hwflags(rtwdev);
rtw89_leave_lps(rtwdev);
@@ -5115,6 +5117,8 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
if (hw->conf.flags & IEEE80211_CONF_IDLE)
wiphy_delayed_work_queue(hw->wiphy, &roc->roc_work,
msecs_to_jiffies(RTW89_ROC_IDLE_TIMEOUT));
+
+ rtw89_regd_learn_queue(rtwdev);
}
void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work)
@@ -5548,6 +5552,7 @@ void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)
{
struct rtw89_hal *hal = &rtwdev->hal;
u32 old = hal->disabled_dm_bitmap;
+ u32 changes = new ^ old;
if (new == old)
return;
@@ -5555,6 +5560,13 @@ void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)
hal->disabled_dm_bitmap = new;
rtw89_debug(rtwdev, RTW89_DBG_STATE, "Disable DM: 0x%x -> 0x%x\n", old, new);
+
+ if (changes & BIT(RTW89_DM_REGD_LEARN)) {
+ if (new & BIT(RTW89_DM_REGD_LEARN))
+ rtw89_regd_learn_cancel(rtwdev);
+ else
+ rtw89_regd_learn_queue(rtwdev);
+ }
}
void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 0d893b992a4af..27fe4c0fa3165 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -6126,6 +6126,7 @@ enum rtw89_fw_feature {
RTW89_FW_FEATURE_SER_POST_RECOVER_DMAC,
RTW89_FW_FEATURE_TX_HISTORY_V1,
RTW89_FW_FEATURE_NO_DRV_BT_TXRX_EN,
+ RTW89_FW_FEATURE_REGD_LEARN,
NUM_OF_RTW89_FW_FEATURES,
};
@@ -6484,6 +6485,7 @@ enum rtw89_dm_type {
RTW89_DM_INACTIVE_PS,
RTW89_DM_DIG_PD,
RTW89_DM_VCORE,
+ RTW89_DM_REGD_LEARN,
};
#define RTW89_THERMAL_PROT_LV_MAX 5
@@ -6564,6 +6566,7 @@ enum rtw89_flags {
RTW89_FLAG_HW_RFKILL_STATE,
RTW89_FLAG_UNPLUGGED,
RTW89_FLAG_SHUTDOWN,
+ RTW89_FLAG_REGD_LEARNING,
NUM_OF_RTW89_FLAGS,
};
@@ -7098,6 +7101,19 @@ struct rtw89_regd_ctrl {
const struct rtw89_regd *map;
};
+#define RTW89_REGD_LEARN_TIMEOUT 8
+#define RTW89_REGD_LEARN_CACHE_TTL 3600
+
+struct rtw89_regd_learn {
+ char hinted_alpha2[2];
+ bool can_activate;
+ bool shall_run;
+ unsigned long last_hint;
+ unsigned int retry;
+ struct wiphy_delayed_work work;
+ struct wiphy_delayed_work timeout_work;
+};
+
#define RTW89_REGD_MAX_COUNTRY_NUM U8_MAX
#define RTW89_5GHZ_UNII4_CHANNEL_NUM 3
#define RTW89_5GHZ_UNII4_START_INDEX 25
@@ -7796,6 +7812,7 @@ struct rtw89_dev {
bool scanning;
struct rtw89_regulatory_info regulatory;
+ struct rtw89_regd_learn regd_learn;
struct rtw89_sar_info sar;
struct rtw89_tas_info tas;
struct rtw89_ant_gain_info ant_gain;
@@ -9540,6 +9557,11 @@ bool rtw89_legacy_rate_to_bitrate(struct rtw89_dev *rtwdev, u8 legacy_rate, u16
int rtw89_regd_setup(struct rtw89_dev *rtwdev);
int rtw89_regd_init_hint(struct rtw89_dev *rtwdev);
const char *rtw89_regd_get_string(enum rtw89_regulation_type regd);
+void rtw89_regd_learn_init(struct rtw89_dev *rtwdev);
+void rtw89_regd_learn_deinit(struct rtw89_dev *rtwdev, bool ser);
+void rtw89_regd_learn_queue(struct rtw89_dev *rtwdev);
+void rtw89_regd_learn_cancel(struct rtw89_dev *rtwdev);
+void rtw89_regd_learn_update(struct rtw89_dev *rtwdev, const char *alpha2, bool sync);
void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,
struct rtw89_traffic_stats *stats);
struct rtw89_wait_response *
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 3a430bd082c3f..49cbdc3e37182 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -4777,6 +4777,7 @@ static const struct rtw89_disabled_dm_info {
DM_INFO(INACTIVE_PS),
DM_INFO(DIG_PD),
DM_INFO(VCORE),
+ DM_INFO(REGD_LEARN),
};
static ssize_t
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index ea7dba077f5d0..07102c2c78ed2 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -993,6 +993,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 128, 0, LPS_DACK_BY_C2H_REG),
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 128, 0, CRASH_TRIGGER_TYPE_1),
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 129, 1, BEACON_TRACKING),
+ __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 138, 1, REGD_LEARN),
__CFG_FW_FEAT(RTL8852C, ge, 0, 29, 94, 0, SER_L1_BY_EVENT),
__CFG_FW_FEAT(RTL8852C, ge, 0, 29, 130, 0, SIM_SER_L0L1_BY_HALT_H2C),
__CFG_FW_FEAT(RTL8922A, ge, 0, 0, 0, 0, RFK_PRE_NOTIFY_V0),
@@ -1045,6 +1046,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 113, 2, SCAN_OFFLOAD_BE_V2),
__CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 0, LPS_ML_INFO_V1_EXTRA),
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 119, 0, CH_INFO_BE_V1),
+ __CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 2, REGD_LEARN),
__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 119, 3, NO_DRV_BT_TXRX_EN),
};
@@ -11129,6 +11131,47 @@ int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev,
return ret;
}
+int rtw89_fw_h2c_regd_learn(struct rtw89_dev *rtwdev, const char *dflt)
+{
+ struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
+ struct rtw89_h2c_regd_learn *h2c;
+ u32 len = sizeof(*h2c);
+ struct sk_buff *skb;
+ bool abort = !dflt;
+ int ret;
+
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
+ if (!skb) {
+ rtw89_err(rtwdev, "failed to alloc skb for regd_learn\n");
+ return -ENOMEM;
+ }
+
+ skb_put(skb, len);
+ h2c = (struct rtw89_h2c_regd_learn *)skb->data;
+ h2c->w0 = le32_encode_bits(abort ? 0 : dflt[0],
+ RTW89_H2C_REGD_LEARN_W0_COUNTRY_0) |
+ le32_encode_bits(abort ? 0 : dflt[1],
+ RTW89_H2C_REGD_LEARN_W0_COUNTRY_1) |
+ le32_encode_bits(abort, RTW89_H2C_REGD_LEARN_W0_ABORT);
+
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
+ H2C_CAT_MAC, H2C_CL_MAC_FW_OFLD,
+ H2C_FUNC_REGD_LEARN, 0, 0, len);
+
+ if (abort)
+ return rtw89_h2c_tx_and_wait(rtwdev, skb, wait,
+ RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT);
+
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
+ if (ret) {
+ rtw89_err(rtwdev, "failed to send regd_learn h2c\n");
+ dev_kfree_skb_any(skb);
+ return ret;
+ }
+
+ return 0;
+}
+
#define H2C_FW_CPU_EXCEPTION_TYPE_0 0x5566
#define H2C_FW_CPU_EXCEPTION_TYPE_1 0x0
int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index e4d3331fc18f1..50b813a3eed41 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -4000,6 +4000,7 @@ struct rtw89_fw_c2h_attr {
u8 class;
u8 func;
u16 len;
+ u8 ignore: 1;
u8 is_scan_event: 1;
u8 scan_seq: 2;
};
@@ -4179,6 +4180,22 @@ struct rtw89_c2h_scanofld {
#define RTW89_C2H_SCANOFLD_W8_PERIOD_V1 GENMASK(15, 0)
#define RTW89_C2H_SCANOFLD_W8_EXPECT_PERIOD_V1 GENMASK(31, 16)
+struct rtw89_c2h_regd_learn {
+ struct rtw89_c2h_hdr hdr;
+ __le32 w2;
+} __packed;
+
+#define RTW89_C2H_REGD_LEARN_W2_STATUS GENMASK(7, 0)
+#define RTW89_C2H_REGD_LEARN_W2_COUNTRY_0 GENMASK(15, 8)
+#define RTW89_C2H_REGD_LEARN_W2_COUNTRY_1 GENMASK(23, 16)
+
+enum rtw89_c2h_regd_learn_status {
+ RTW89_C2H_REGD_LEARN_NONE = 0,
+ RTW89_C2H_REGD_LEARN_LEARNED = 1,
+ RTW89_C2H_REGD_LEARN_VERIFIED = 2,
+ RTW89_C2H_REGD_LEARN_ABORT = 3,
+};
+
#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h) \
le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h) \
@@ -4856,10 +4873,19 @@ enum rtw89_fw_ofld_h2c_func {
H2C_FUNC_MAC_MACID_PAUSE_SLEEP = 0x28,
H2C_FUNC_SCANOFLD_BE = 0x2c,
H2C_FUNC_TRX_PROTECT = 0x34,
+ H2C_FUNC_REGD_LEARN = 0x53,
NUM_OF_RTW89_FW_OFLD_H2C_FUNC,
};
+struct rtw89_h2c_regd_learn {
+ __le32 w0;
+} __packed;
+
+#define RTW89_H2C_REGD_LEARN_W0_COUNTRY_0 GENMASK(7, 0)
+#define RTW89_H2C_REGD_LEARN_W0_COUNTRY_1 GENMASK(15, 8)
+#define RTW89_H2C_REGD_LEARN_W0_ABORT BIT(16)
+
#define RTW89_FW_OFLD_WAIT_COND(tag, func) \
((tag) * NUM_OF_RTW89_FW_OFLD_H2C_FUNC + (func))
@@ -4867,6 +4893,8 @@ enum rtw89_fw_ofld_h2c_func {
RTW89_FW_OFLD_WAIT_COND(RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op), \
H2C_FUNC_PACKET_OFLD)
#define RTW89_FW_OFLD_WAIT_COND_TRX_PROTECT RTW89_FW_OFLD_WAIT_COND(0, H2C_FUNC_TRX_PROTECT)
+#define RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT \
+ RTW89_FW_OFLD_WAIT_COND(1, H2C_FUNC_REGD_LEARN)
#define RTW89_SCANOFLD_WAIT_COND_ADD_CH RTW89_FW_OFLD_WAIT_COND(0, H2C_FUNC_ADD_SCANOFLD_CH)
@@ -5684,6 +5712,7 @@ int rtw89_hw_scan_append_wildcard_probe_req(struct rtw89_dev *rtwdev,
const u8 *mac_addr, bool wowlan);
void rtw89_hw_scan_calc_req_ssid(struct rtw89_dev *rtwdev,
struct rtw89_vif_link *rtwvif_link, bool wowlan);
+int rtw89_fw_h2c_regd_learn(struct rtw89_dev *rtwdev, const char *dflt);
int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev);
int rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
const struct rtw89_pkt_drop_params *params);
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index de8598ba441f4..41796bff08edd 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -5420,6 +5420,7 @@ rtw89_mac_bcn_fltr_rpt(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_l
switch (type) {
case RTW89_BCN_FLTR_BEACON_LOSS:
if (!rtwdev->scanning && !rtwvif->offchan &&
+ !test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags) &&
!rtwvif_link->noa_once.in_duration) {
start_detect = rtw89_mcc_detect_go_bcn(rtwdev, rtwvif_link);
if (start_detect)
@@ -6069,6 +6070,47 @@ rtw89_mac_c2h_pwr_int_notify(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32
rcu_read_unlock();
}
+static void
+rtw89_mac_c2h_regd_learn(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 len)
+{
+ const struct rtw89_c2h_regd_learn *c2h =
+ (const struct rtw89_c2h_regd_learn *)skb->data;
+ const struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(skb);
+ const char *res;
+ char alpha2[2];
+ u8 status;
+
+ if (len < sizeof(*c2h))
+ return;
+
+ if (attr->ignore)
+ return;
+
+ if (!test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags))
+ return;
+
+ status = le32_get_bits(c2h->w2, RTW89_C2H_REGD_LEARN_W2_STATUS);
+ alpha2[0] = le32_get_bits(c2h->w2, RTW89_C2H_REGD_LEARN_W2_COUNTRY_0);
+ alpha2[1] = le32_get_bits(c2h->w2, RTW89_C2H_REGD_LEARN_W2_COUNTRY_1);
+
+ switch (status) {
+ case RTW89_C2H_REGD_LEARN_NONE:
+ rtw89_debug(rtwdev, RTW89_DBG_REGD,
+ "regd_learn: c2h none\n");
+ res = NULL;
+ break;
+ case RTW89_C2H_REGD_LEARN_LEARNED:
+ case RTW89_C2H_REGD_LEARN_VERIFIED:
+ res = alpha2;
+ break;
+ default:
+ rtw89_warn(rtwdev, "regd_learn: c2h unknown (status=%d)\n", status);
+ return;
+ }
+
+ rtw89_regd_learn_update(rtwdev, res, true);
+}
+
static
void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,
struct sk_buff *c2h, u32 len) = {
@@ -6081,6 +6123,7 @@ void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev,
[RTW89_MAC_C2H_FUNC_TX_DUTY_RPT] = rtw89_mac_c2h_tx_duty_rpt,
[RTW89_MAC_C2H_FUNC_TSF32_TOGL_RPT] = rtw89_mac_c2h_tsf32_toggle_rpt,
[RTW89_MAC_C2H_FUNC_BCNFLTR_RPT] = rtw89_mac_c2h_bcn_fltr_rpt,
+ [RTW89_MAC_C2H_FUNC_REGD_LEARN] = rtw89_mac_c2h_regd_learn,
};
static
@@ -6168,6 +6211,29 @@ static void rtw89_mac_c2h_scanofld_rsp_atomic(struct rtw89_dev *rtwdev,
}
}
+static void rtw89_mac_c2h_regd_learn_atomic(struct rtw89_dev *rtwdev,
+ struct sk_buff *skb)
+{
+ const struct rtw89_c2h_regd_learn *c2h =
+ (const struct rtw89_c2h_regd_learn *)skb->data;
+ struct rtw89_wait_info *fw_ofld_wait = &rtwdev->mac.fw_ofld_wait;
+ struct rtw89_fw_c2h_attr *attr = RTW89_SKB_C2H_CB(skb);
+ struct rtw89_completion_data data = {};
+ u8 status;
+
+ if (attr->len < sizeof(*c2h))
+ return;
+
+ status = le32_get_bits(c2h->w2, RTW89_C2H_REGD_LEARN_W2_STATUS);
+ if (status != RTW89_C2H_REGD_LEARN_ABORT)
+ return;
+
+ rtw89_complete_cond(fw_ofld_wait, RTW89_FW_OFLD_WAIT_COND_REGD_LEARN_ABORT,
+ &data);
+
+ attr->ignore = true;
+}
+
bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
u8 class, u8 func)
{
@@ -6191,6 +6257,9 @@ bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
return false;
case RTW89_MAC_C2H_FUNC_PKT_OFLD_RSP:
return true;
+ case RTW89_MAC_C2H_FUNC_REGD_LEARN:
+ rtw89_mac_c2h_regd_learn_atomic(rtwdev, c2h);
+ return false;
}
case RTW89_MAC_C2H_CLASS_MCC:
return true;
diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h
index 8419bcd3956a9..db42e33e694c6 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.h
+++ b/drivers/net/wireless/realtek/rtw89/mac.h
@@ -413,6 +413,7 @@ enum rtw89_mac_c2h_ofld_func {
RTW89_MAC_C2H_FUNC_SCANOFLD_RSP = 0x9,
RTW89_MAC_C2H_FUNC_TX_DUTY_RPT = 0xa,
RTW89_MAC_C2H_FUNC_BCNFLTR_RPT = 0xd,
+ RTW89_MAC_C2H_FUNC_REGD_LEARN = 0x24,
RTW89_MAC_C2H_FUNC_OFLD_MAX,
};
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
index 9e6cafc492c44..5abf71a6ed1f6 100644
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
@@ -57,10 +57,17 @@ static void rtw89_ops_wake_tx_queue(struct ieee80211_hw *hw,
static int rtw89_ops_start(struct ieee80211_hw *hw)
{
struct rtw89_dev *rtwdev = hw->priv;
+ int ret;
lockdep_assert_wiphy(hw->wiphy);
- return rtw89_core_start(rtwdev);
+ ret = rtw89_core_start(rtwdev);
+ if (ret)
+ return ret;
+
+ rtw89_regd_learn_init(rtwdev);
+
+ return 0;
}
static void rtw89_ops_stop(struct ieee80211_hw *hw, bool suspend)
@@ -69,6 +76,8 @@ static void rtw89_ops_stop(struct ieee80211_hw *hw, bool suspend)
lockdep_assert_wiphy(hw->wiphy);
+ rtw89_regd_learn_deinit(rtwdev, false);
+
rtw89_core_stop(rtwdev);
}
@@ -95,7 +104,8 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
if ((changed & IEEE80211_CONF_CHANGE_IDLE) &&
(hw->conf.flags & IEEE80211_CONF_IDLE) &&
- !rtwdev->scanning)
+ !rtwdev->scanning &&
+ !test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags))
rtw89_enter_ips(rtwdev);
if (changed & IEEE80211_CONF_CHANGE_MONITOR)
@@ -1298,7 +1308,8 @@ static int rtw89_ops_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return -EBUSY;
}
- if (rtwdev->scanning || rtwvif->offchan)
+ if (rtwdev->scanning || rtwvif->offchan ||
+ test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags))
return -EBUSY;
rtwvif_link = rtw89_get_designated_link(rtwvif);
@@ -1413,6 +1424,8 @@ static int rtw89_ops_assign_vif_chanctx(struct ieee80211_hw *hw,
return -ENOLINK;
}
+ rtw89_regd_learn_deinit(rtwdev, false);
+
return rtw89_chanctx_ops_assign_vif(rtwdev, rtwvif_link, ctx);
}
@@ -1424,6 +1437,7 @@ static void rtw89_ops_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct rtw89_dev *rtwdev = hw->priv;
struct rtw89_vif *rtwvif = vif_to_rtwvif(vif);
struct rtw89_vif_link *rtwvif_link;
+ unsigned int count = 0;
lockdep_assert_wiphy(hw->wiphy);
@@ -1436,6 +1450,12 @@ static void rtw89_ops_unassign_vif_chanctx(struct ieee80211_hw *hw,
}
rtw89_chanctx_ops_unassign_vif(rtwdev, rtwvif_link, ctx);
+
+ rtw89_for_each_active_rtwvif(rtwdev, rtwvif)
+ count++;
+
+ if (count == 0)
+ rtw89_regd_learn_init(rtwdev);
}
static
@@ -1737,6 +1757,9 @@ int rtw89_ops_change_vif_links(struct ieee80211_hw *hw,
rcu_assign_pointer(rtwvif->snap_link_confs, snap);
}
+ /* might enter ips without defer work */
+ rtw89_regd_learn_cancel(rtwdev);
+
/* might depend on @snap; don't change order */
rtw89_leave_ips_by_hwflags(rtwdev);
@@ -1780,6 +1803,9 @@ int rtw89_ops_change_vif_links(struct ieee80211_hw *hw,
rtw89_vif_update_fw_links(rtwdev, rtwvif, new_links, false);
rtw89_enter_ips_by_hwflags(rtwdev);
+
+ rtw89_regd_learn_queue(rtwdev);
+
return ret;
}
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index ddb27c7782a98..6d19e759fc0d9 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -4268,6 +4268,7 @@ static void rtw89_pci_recalc_int_mit(struct rtw89_dev *rtwdev)
u32 val = 0;
if (rtwdev->scanning ||
+ test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags) ||
(tx_tfc_lv < RTW89_TFC_HIGH && rx_tfc_lv < RTW89_TFC_HIGH))
goto out;
diff --git a/drivers/net/wireless/realtek/rtw89/ps.h b/drivers/net/wireless/realtek/rtw89/ps.h
index 729477153de66..dee4d25da8cd9 100644
--- a/drivers/net/wireless/realtek/rtw89/ps.h
+++ b/drivers/net/wireless/realtek/rtw89/ps.h
@@ -41,8 +41,9 @@ static inline void rtw89_enter_ips_by_hwflags(struct rtw89_dev *rtwdev)
{
struct ieee80211_hw *hw = rtwdev->hw;
- /* prevent entering IPS after ROC, but it is scanning */
- if (rtwdev->scanning)
+ /* prevent entering IPS after ROC, but it is scanning or regd learning */
+ if (rtwdev->scanning ||
+ test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags))
return;
if (hw->conf.flags & IEEE80211_CONF_IDLE)
diff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c
index ec345feed184d..6acec34036adf 100644
--- a/drivers/net/wireless/realtek/rtw89/regd.c
+++ b/drivers/net/wireless/realtek/rtw89/regd.c
@@ -3,7 +3,9 @@
*/
#include "acpi.h"
+#include "chan.h"
#include "debug.h"
+#include "fw.h"
#include "ps.h"
#include "util.h"
@@ -706,6 +708,252 @@ static void rtw89_regd_setup_reg_rules(struct rtw89_dev *rtwdev)
kfree(ptr);
}
+void rtw89_regd_learn_queue(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ static const unsigned int backoff_list[] = {
+ 4, 4, 4, 8, 16, 64, 256, 512, 1024, 2048,
+ };
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+ struct rtw89_hal *hal = &rtwdev->hal;
+ unsigned int delay;
+ unsigned int index;
+
+ lockdep_assert_wiphy(wiphy);
+
+ if (!regd_learn->can_activate)
+ return;
+
+ if (!regd_learn->shall_run)
+ return;
+
+ if (hal->disabled_dm_bitmap & BIT(RTW89_DM_REGD_LEARN))
+ return;
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: queue (retry=%u)\n",
+ regd_learn->retry);
+
+ index = min_t(unsigned int, regd_learn->retry,
+ ARRAY_SIZE(backoff_list) - 1);
+ delay = backoff_list[index] * HZ;
+
+ wiphy_delayed_work_queue(wiphy, ®d_learn->work, delay);
+}
+
+static int __rtw89_regd_learn_retry(struct rtw89_dev *rtwdev, void *data)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+
+ regd_learn->retry++;
+ rtw89_regd_learn_queue(rtwdev);
+
+ return 0;
+}
+
+static void __rtw89_regd_learn_start_setup(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_chanctx_pause_parm pause_parm = {
+ .rsn = RTW89_CHANCTX_PAUSE_REASON_REGD_LEARN,
+ };
+
+ rtw89_leave_ips_by_hwflags(rtwdev);
+ rtw89_leave_lps(rtwdev);
+ rtw89_chanctx_pause(rtwdev, &pause_parm);
+
+ set_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags);
+}
+
+static void __rtw89_regd_learn_stop_cleanup(struct rtw89_dev *rtwdev, bool retry)
+{
+ static const struct rtw89_chanctx_cb_parm cb_retry = {
+ .cb = __rtw89_regd_learn_retry,
+ .data = NULL,
+ .caller = __func__,
+ };
+
+ clear_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags);
+
+ rtw89_chanctx_proceed(rtwdev, retry ? &cb_retry : NULL);
+ rtw89_enter_ips_by_hwflags(rtwdev);
+}
+
+static void __rtw89_regd_learn_finish(struct rtw89_dev *rtwdev, bool retry)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+
+ wiphy_delayed_work_cancel(wiphy, ®d_learn->work);
+ wiphy_delayed_work_cancel(wiphy, ®d_learn->timeout_work);
+
+ if (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags))
+ __rtw89_regd_learn_stop_cleanup(rtwdev, retry);
+}
+
+void rtw89_regd_learn_cancel(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+ int ret;
+
+ lockdep_assert_wiphy(wiphy);
+
+ if (!regd_learn->can_activate)
+ return;
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: cancel\n");
+
+ if (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags)) {
+ ret = rtw89_fw_h2c_regd_learn(rtwdev, NULL);
+ if (ret)
+ rtw89_warn(rtwdev, "regd_learn: abort failed (ret=%d)\n", ret);
+ }
+
+ __rtw89_regd_learn_finish(rtwdev, false);
+}
+
+void rtw89_regd_learn_update(struct rtw89_dev *rtwdev, const char *alpha2, bool sync)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+ const struct ieee80211_regdomain *wiphy_regd = get_wiphy_regdom(wiphy);
+ int ret;
+
+ lockdep_assert_wiphy(wiphy);
+
+ /*
+ * Calls with REGD_LEARNING are only allowed in c2h context,
+ * i.e. other callers should rtw89_regd_learn_cancel() first.
+ */
+ if (test_bit(RTW89_FLAG_REGD_LEARNING, rtwdev->flags)) {
+ __rtw89_regd_learn_finish(rtwdev, !alpha2);
+
+ if (!alpha2)
+ return;
+
+ regd_learn->shall_run = false;
+ regd_learn->retry = 0;
+ } else {
+ regd_learn->retry = 0;
+
+ if (!wiphy_regd || memcmp(alpha2, wiphy_regd->alpha2, 2) == 0)
+ return;
+ }
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD,
+ "regd_learn: reg_hint %.2s (sync=%d)\n", alpha2, sync);
+
+ ret = regulatory_hint(wiphy, alpha2);
+ if (ret) {
+ rtw89_warn(rtwdev, "regd_learn: reg_hint failed (ret=%d)\n", ret);
+ return;
+ }
+
+ if (!sync)
+ return;
+
+ memcpy(regd_learn->hinted_alpha2, alpha2, 2);
+ regd_learn->last_hint = jiffies;
+}
+
+static void rtw89_regd_learn_work(struct wiphy *wiphy, struct wiphy_work *work)
+{
+ struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
+ regd_learn.work.work);
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ char *alpha2 = regd_learn->hinted_alpha2;
+ int ret;
+
+ lockdep_assert_wiphy(wiphy);
+
+ wiphy_delayed_work_cancel(wiphy, ®d_learn->timeout_work);
+
+ if (rtwdev->scanning || rtw89_chanctx_paused(rtwdev)) {
+ rtw89_regd_learn_queue(rtwdev);
+ return;
+ }
+
+ if (regd_learn->last_hint &&
+ time_is_before_jiffies(regd_learn->last_hint +
+ RTW89_REGD_LEARN_CACHE_TTL * HZ)) {
+ rtw89_debug(rtwdev, RTW89_DBG_REGD,
+ "regd_learn: %.2s is outdated\n", alpha2);
+ memset(alpha2, 0, 2);
+ }
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: start\n");
+
+ __rtw89_regd_learn_start_setup(rtwdev);
+
+ ret = rtw89_fw_h2c_regd_learn(rtwdev, alpha2);
+ if (ret) {
+ rtw89_warn(rtwdev, "regd_learn: h2c failed (ret=%d)\n", ret);
+ __rtw89_regd_learn_stop_cleanup(rtwdev, true);
+ return;
+ }
+
+ wiphy_delayed_work_queue(wiphy, ®d_learn->timeout_work,
+ RTW89_REGD_LEARN_TIMEOUT * HZ);
+}
+
+static void rtw89_regd_learn_timeout_work(struct wiphy *wiphy, struct wiphy_work *work)
+{
+ struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
+ regd_learn.timeout_work.work);
+
+ lockdep_assert_wiphy(wiphy);
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: timeout\n");
+
+ rtw89_regd_learn_cancel(rtwdev);
+ __rtw89_regd_learn_retry(rtwdev, NULL);
+}
+
+void rtw89_regd_learn_init(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+
+ lockdep_assert_wiphy(wiphy);
+
+ if (regd_learn->can_activate)
+ return;
+
+ regd_learn->can_activate = !regulatory->programmed &&
+ RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw);
+ if (!regd_learn->can_activate)
+ return;
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: init\n");
+
+ wiphy_delayed_work_init(®d_learn->work, rtw89_regd_learn_work);
+ wiphy_delayed_work_init(®d_learn->timeout_work, rtw89_regd_learn_timeout_work);
+
+ regd_learn->retry = 0;
+
+ rtw89_regd_learn_queue(rtwdev);
+}
+
+void rtw89_regd_learn_deinit(struct rtw89_dev *rtwdev, bool ser)
+{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+ struct wiphy *wiphy = rtwdev->hw->wiphy;
+
+ lockdep_assert_wiphy(wiphy);
+
+ if (!regd_learn->can_activate)
+ return;
+
+ if (ser)
+ __rtw89_regd_learn_finish(rtwdev, false);
+ else
+ rtw89_regd_learn_cancel(rtwdev);
+
+ rtw89_debug(rtwdev, RTW89_DBG_REGD, "regd_learn: deinit\n");
+
+ regd_learn->can_activate = false;
+}
+
int rtw89_regd_setup(struct rtw89_dev *rtwdev)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
@@ -883,6 +1131,8 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,
struct wiphy *wiphy,
struct regulatory_request *request)
{
+ struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
+
rtwdev->regulatory.regd = rtw89_regd_find_reg_by_name(rtwdev, request->alpha2);
/* This notification might be set from the system of distros,
* and it does not expect the regulatory will be modified by
@@ -893,6 +1143,18 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,
wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
else
wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE;
+
+ rtw89_regd_learn_cancel(rtwdev);
+
+ regd_learn->shall_run = request->initiator != NL80211_REGDOM_SET_BY_USER &&
+ memcmp(request->alpha2, "00", 2) == 0;
+ if (!regd_learn->shall_run) {
+ rtw89_regd_learn_update(rtwdev, request->alpha2,
+ request->initiator != NL80211_REGDOM_SET_BY_USER);
+ return;
+ }
+
+ rtw89_regd_learn_queue(rtwdev);
}
static
diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c
index 045dac0bd1db4..3dc1b8a8dc2b5 100644
--- a/drivers/net/wireless/realtek/rtw89/ser.c
+++ b/drivers/net/wireless/realtek/rtw89/ser.c
@@ -726,6 +726,7 @@ static void ser_l2_reset_st_pre_hdl(struct rtw89_ser *ser)
bottom:
rtw89_ser_cd_free(rtwdev, buf, !!ret);
+ rtw89_regd_learn_deinit(rtwdev, true);
ser_reset_mac_binding(rtwdev);
rtw89_core_stop(rtwdev);
rtw89_entity_init(rtwdev);
|
| 3/2 | 2026/10/23 00:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16639 output: 40 thoughts: 450 Thoughts: **Analyzing the rtw89 Driver Patch** Okay, so this patch is touching a good chunk of the `rtw89` driver, specifically within `drivers/net/wireless/realtek/rtw89/`. I see it's modifying a range of files, including header files and core components: `chan.h`, `core.c`, `core.h`, `debug.c`, `fw.c`, `fw.h`, `mac.c`, `mac.h`, `mac80211.c`, `pci.c`, `ps.h`, `regd.c`, and `ser.c`. This suggests a potentially significant change, likely involving channel management, core functionality, debugging, firmware interaction, MAC layer operations, power management, regulatory domain handling, and potentially some kind of serial communication aspect of the driver. My immediate thought is to understand the scope of this driver. Is this something I can readily test in a standard virtualized environment like QEMU or Google Compute Engine? Or is it tied to specific hardware? Let's clarify what this driver's interface is. Ah, I remember now... `rtw89` is the Realtek 802.11ax wireless network adapter driver. But does it support both USB and PCI? If it's PCI, can I emulate it using a USB gadget or mac80211_hwsim? I need to know how I can interact with this driver. I am going to double-check that `mac80211_hwsim` is definitely a separate driver, which I know it is. To get a clearer picture of its capabilities, I need to check the Kconfig file within the driver's directory. Specifically, I need to check `drivers/net/wireless/realtek/rtw89/Kconfig`. This will help determine if it supports USB. |
| 4/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "config RTW89",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/Kconfig-1-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause\ndrivers/net/wireless/realtek/rtw89/Kconfig:2:menuconfig RTW89\ndrivers/net/wireless/realtek/rtw89/Kconfig-3-\ttristate \"Realtek 802.11ax wireless chips support\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig=11=if RTW89\ndrivers/net/wireless/realtek/rtw89/Kconfig-12-\ndrivers/net/wireless/realtek/rtw89/Kconfig:13:config RTW89_CORE\ndrivers/net/wireless/realtek/rtw89/Kconfig-14-\ttristate\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-16-\ndrivers/net/wireless/realtek/rtw89/Kconfig:17:config RTW89_PCI\ndrivers/net/wireless/realtek/rtw89/Kconfig-18-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-19-\ndrivers/net/wireless/realtek/rtw89/Kconfig:20:config RTW89_USB\ndrivers/net/wireless/realtek/rtw89/Kconfig-21-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-22-\ndrivers/net/wireless/realtek/rtw89/Kconfig:23:config RTW89_8851B\ndrivers/net/wireless/realtek/rtw89/Kconfig-24-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-25-\ndrivers/net/wireless/realtek/rtw89/Kconfig:26:config RTW89_8852A\ndrivers/net/wireless/realtek/rtw89/Kconfig-27-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-28-\ndrivers/net/wireless/realtek/rtw89/Kconfig:29:config RTW89_8852B_COMMON\ndrivers/net/wireless/realtek/rtw89/Kconfig-30-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-31-\ndrivers/net/wireless/realtek/rtw89/Kconfig:32:config RTW89_8852B\ndrivers/net/wireless/realtek/rtw89/Kconfig-33-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-34-\ndrivers/net/wireless/realtek/rtw89/Kconfig:35:config RTW89_8852BT\ndrivers/net/wireless/realtek/rtw89/Kconfig-36-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-37-\ndrivers/net/wireless/realtek/rtw89/Kconfig:38:config RTW89_8852C\ndrivers/net/wireless/realtek/rtw89/Kconfig-39-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-40-\ndrivers/net/wireless/realtek/rtw89/Kconfig:41:config RTW89_8922A\ndrivers/net/wireless/realtek/rtw89/Kconfig-42-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-43-\ndrivers/net/wireless/realtek/rtw89/Kconfig:44:config RTW89_8922D\ndrivers/net/wireless/realtek/rtw89/Kconfig-45-\ttristate\ndrivers/net/wireless/realtek/rtw89/Kconfig-46-\ndrivers/net/wireless/realtek/rtw89/Kconfig:47:config RTW89_8851BE\ndrivers/net/wireless/realtek/rtw89/Kconfig-48-\ttristate \"Realtek 8851BE PCI wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-57-\ndrivers/net/wireless/realtek/rtw89/Kconfig:58:config RTW89_8851BU\ndrivers/net/wireless/realtek/rtw89/Kconfig-59-\ttristate \"Realtek 8851BU USB wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-68-\ndrivers/net/wireless/realtek/rtw89/Kconfig:69:config RTW89_8852AE\ndrivers/net/wireless/realtek/rtw89/Kconfig-70-\ttristate \"Realtek 8852AE PCI wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-79-\ndrivers/net/wireless/realtek/rtw89/Kconfig:80:config RTW89_8852AU\ndrivers/net/wireless/realtek/rtw89/Kconfig-81-\ttristate \"Realtek 8852AU USB wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-90-\ndrivers/net/wireless/realtek/rtw89/Kconfig:91:config RTW89_8852BE\ndrivers/net/wireless/realtek/rtw89/Kconfig-92-\ttristate \"Realtek 8852BE PCI wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-102-\ndrivers/net/wireless/realtek/rtw89/Kconfig:103:config RTW89_8852BU\ndrivers/net/wireless/realtek/rtw89/Kconfig-104-\ttristate \"Realtek 8852BU USB wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-114-\ndrivers/net/wireless/realtek/rtw89/Kconfig:115:config RTW89_8852BTE\ndrivers/net/wireless/realtek/rtw89/Kconfig-116-\ttristate \"Realtek 8852BE-VT PCI wireless network (Wi-Fi 6) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-126-\ndrivers/net/wireless/realtek/rtw89/Kconfig:127:config RTW89_8852CE\ndrivers/net/wireless/realtek/rtw89/Kconfig-128-\ttristate \"Realtek 8852CE PCI wireless network (Wi-Fi 6E) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-137-\ndrivers/net/wireless/realtek/rtw89/Kconfig:138:config RTW89_8852CU\ndrivers/net/wireless/realtek/rtw89/Kconfig-139-\ttristate \"Realtek 8852CU USB wireless network (Wi-Fi 6E) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-148-\ndrivers/net/wireless/realtek/rtw89/Kconfig:149:config RTW89_8922AE\ndrivers/net/wireless/realtek/rtw89/Kconfig-150-\ttristate \"Realtek 8922AE/8922AE-VS PCI wireless network (Wi-Fi 7) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-162-\ndrivers/net/wireless/realtek/rtw89/Kconfig:163:config RTW89_8922AU\ndrivers/net/wireless/realtek/rtw89/Kconfig-164-\ttristate \"Realtek 8922AU USB wireless network (Wi-Fi 7) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-174-\ndrivers/net/wireless/realtek/rtw89/Kconfig:175:config RTW89_8922DE\ndrivers/net/wireless/realtek/rtw89/Kconfig-176-\ttristate \"Realtek 8922DE/8922DE-VS PCI wireless network (Wi-Fi 7) adapter\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-186-\ndrivers/net/wireless/realtek/rtw89/Kconfig:187:config RTW89_DEBUG\ndrivers/net/wireless/realtek/rtw89/Kconfig-188-\tbool\ndrivers/net/wireless/realtek/rtw89/Kconfig-189-\ndrivers/net/wireless/realtek/rtw89/Kconfig:190:config RTW89_DEBUGMSG\ndrivers/net/wireless/realtek/rtw89/Kconfig-191-\tbool \"Realtek rtw89 debug message support\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-198-\ndrivers/net/wireless/realtek/rtw89/Kconfig:199:config RTW89_DEBUGFS\ndrivers/net/wireless/realtek/rtw89/Kconfig-200-\tbool \"Realtek rtw89 debugfs support\"\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-207-\ndrivers/net/wireless/realtek/rtw89/Kconfig:208:config RTW89_LEDS\ndrivers/net/wireless/realtek/rtw89/Kconfig-209-\tbool\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-213-\ndrivers/net/wireless/realtek/rtw89/Kconfig:214:config RTW89_LEDS_MC\ndrivers/net/wireless/realtek/rtw89/Kconfig-215-\tbool\n"
} |
| 5/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20187 output: 41 thoughts: 945 Thoughts: **RTW89 and USB Fuzzing Feasibility: A Thought Process**
Okay, so I've noticed that RTW89 supports USB devices – specific ones like RTW89_8852AU, RTW89_8852CU, and RTW89_8922AU. This immediately triggers a line of thought: can we leverage Raw Gadget and syzkaller's USB fuzzing capabilities to target this? My initial question is whether the RTW89 USB probe can succeed *without* firmware, or if it's dependent on firmware loading. This is key.
Then, I remember syzkaller's USB fuzzing using Raw Gadget, and it supports USB device emulation. This is promising! Let's pivot and look at the specifics of the driver's firmware features, specifically what `REGD_LEARN` does and what triggers it. Time to dive into the patch details.
I've located `fw.c`:
```c
static const struct __fw_feat_cfg fw_feat_tbl[] = {
...
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 138, 1, REGD_LEARN),
...
__CFG_FW_FEAT(RTL8922D, ge, 0, 35, 119, 2, REGD_LEARN),
```
Aha! `REGD_LEARN` is a firmware feature. And then this:
```c
void rtw89_regd_learn_init(struct rtw89_dev *rtwdev)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
struct wiphy *wiphy = rtwdev->hw->wiphy;
lockdep_assert_wiphy(wiphy);
if (regd_learn->can_activate)
return;
regd_learn->can_activate = !regulatory->programmed &&
RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw);
...
```
So, can RTW89 actually be fuzzed? Now my thought process shifts to determining if the driver needs real hardware or if USB emulation will work. Does syzkaller target this? Let's check syzkaller's guidelines – Section 1, 2, 3:
* **Reachability is paramount.** Only code accessible in virtualized environments (like GCE, QEMU, USB gadgets) should be fuzzed.
* **WorthFuzzing=false if:** Code is structurally unreachable. Hardware requiring physical ASICs not emulated in QEMU is a big red flag. Teardown callbacks only during physical hot-unplug are also a negative.
* **WorthFuzzing=true if:** It targets reachable code, including drivers accessible via virtual buses like USB gadget.
Now, the million-dollar question: is RTW89 accessible via USB gadget? Let's investigate `rtw89_usb.c` and how RTW89 probes USB devices. Does it load firmware during probe or during the open function? Let's grep for `rtw89_usb` or check the USB source file directly at `drivers/net/wireless/realtek/rtw89/usb.c`. This is where the answer lies.
|
| 6/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "rtw89_usb",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 666 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (9 files in total):\ndrivers/net/wireless/realtek/rtw89/Makefile:2\ndrivers/net/wireless/realtek/rtw89/core.h:2\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c:3\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c:3\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c:3\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c:3\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c:3\ndrivers/net/wireless/realtek/rtw89/usb.c:181\ndrivers/net/wireless/realtek/rtw89/usb.h:10\n\ndrivers/net/wireless/realtek/rtw89/Makefile=106=rtw89_pci-y := pci.o pci_be.o\ndrivers/net/wireless/realtek/rtw89/Makefile-107-\ndrivers/net/wireless/realtek/rtw89/Makefile:108:obj-$(CONFIG_RTW89_USB) += rtw89_usb.o\ndrivers/net/wireless/realtek/rtw89/Makefile:109:rtw89_usb-y := usb.o\ndrivers/net/wireless/realtek/rtw89/Makefile-110-\n--\ndrivers/net/wireless/realtek/rtw89/core.h=20=struct rtw89_pci_info;\ndrivers/net/wireless/realtek/rtw89/core.h:21:struct rtw89_usb_info;\ndrivers/net/wireless/realtek/rtw89/core.h-22-struct rtw89_mac_gen_def;\n--\ndrivers/net/wireless/realtek/rtw89/core.h=5973=union rtw89_bus_info {\ndrivers/net/wireless/realtek/rtw89/core.h-5974-\tconst struct rtw89_pci_info *pci;\ndrivers/net/wireless/realtek/rtw89/core.h:5975:\tconst struct rtw89_usb_info *usb;\ndrivers/net/wireless/realtek/rtw89/core.h-5976-};\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-10-\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c:11:static const struct rtw89_usb_info rtw8851b_usb_info = {\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-12-\t.usb_host_request_2\t\t= R_AX_USB_HOST_REQUEST_2,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c=62=static int rtw8851bu_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-64-{\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c:65:\treturn rtw89_usb_probe(intf, id, \u0026rtw89_8851bu_info);\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-66-}\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c=68=static struct usb_driver rtw_8851bu_driver = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-71-\t.probe = rtw8851bu_probe,\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c:72:\t.disconnect = rtw89_usb_disconnect,\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-73-};\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-10-\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c:11:static const struct rtw89_usb_info rtw8852a_usb_info = {\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-12-\t.usb_host_request_2\t\t= R_AX_USB_HOST_REQUEST_2,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c=76=static int rtw8852au_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-78-{\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c:79:\treturn rtw89_usb_probe(intf, id, \u0026rtw89_8852au_info);\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-80-}\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c=82=static struct usb_driver rtw_8852au_driver = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-85-\t.probe = rtw8852au_probe,\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c:86:\t.disconnect = rtw89_usb_disconnect,\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-87-};\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-10-\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c:11:static const struct rtw89_usb_info rtw8852b_usb_info = {\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-12-\t.usb_host_request_2\t\t= R_AX_USB_HOST_REQUEST_2,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c=76=static int rtw8852bu_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-78-{\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c:79:\treturn rtw89_usb_probe(intf, id, \u0026rtw89_8852bu_info);\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-80-}\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c=82=static struct usb_driver rtw_8852bu_driver = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-85-\t.probe = rtw8852bu_probe,\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c:86:\t.disconnect = rtw89_usb_disconnect,\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-87-};\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-10-\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c:11:static const struct rtw89_usb_info rtw8852c_usb_info = {\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-12-\t.usb_host_request_2\t\t= R_AX_USB_HOST_REQUEST_2_V1,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c=137=static int rtw8852cu_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-139-{\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c:140:\treturn rtw89_usb_probe(intf, id, \u0026rtw89_8852cu_info);\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-141-}\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c=143=static struct usb_driver rtw_8852cu_driver = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-146-\t.probe = rtw8852cu_probe,\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c:147:\t.disconnect = rtw89_usb_disconnect,\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-148-};\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-9-\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c:10:static const struct rtw89_usb_info rtw8922a_usb_info = {\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-11-\t.usb_host_request_2\t\t= 0,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c=83=static int rtw8922au_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-85-{\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c:86:\treturn rtw89_usb_probe(intf, id, \u0026rtw89_8922au_info);\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-87-}\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c=89=static struct usb_driver rtw_8922au_driver = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-92-\t.probe = rtw8922au_probe,\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c:93:\t.disconnect = rtw89_usb_disconnect,\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-94-};\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-11-\ndrivers/net/wireless/realtek/rtw89/usb.c:12:static void rtw89_usb_read_port_complete(struct urb *urb);\ndrivers/net/wireless/realtek/rtw89/usb.c-13-\ndrivers/net/wireless/realtek/rtw89/usb.c:14:static void __rtw89_usb_vendorreq(struct rtw89_dev *rtwdev, u32 addr,\ndrivers/net/wireless/realtek/rtw89/usb.c-15-\t\t\t\t void *data, u16 len, u8 reqtype, bool warn)\ndrivers/net/wireless/realtek/rtw89/usb.c-16-{\ndrivers/net/wireless/realtek/rtw89/usb.c:17:\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c-18-\tstruct usb_device *udev = rtwusb-\u003eudev;\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-71-\ndrivers/net/wireless/realtek/rtw89/usb.c:72:static void rtw89_usb_vendorreq(struct rtw89_dev *rtwdev, u32 addr,\ndrivers/net/wireless/realtek/rtw89/usb.c-73-\t\t\t\tvoid *data, u16 len, u8 reqtype)\ndrivers/net/wireless/realtek/rtw89/usb.c-74-{\ndrivers/net/wireless/realtek/rtw89/usb.c:75:\t__rtw89_usb_vendorreq(rtwdev, addr, data, len, reqtype, true);\ndrivers/net/wireless/realtek/rtw89/usb.c-76-}\ndrivers/net/wireless/realtek/rtw89/usb.c-77-\ndrivers/net/wireless/realtek/rtw89/usb.c:78:static u32 rtw89_usb_read_cmac(struct rtw89_dev *rtwdev, u32 addr)\ndrivers/net/wireless/realtek/rtw89/usb.c-79-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-87-\tfor (count = 0; ; count++) {\ndrivers/net/wireless/realtek/rtw89/usb.c:88:\t\trtw89_usb_vendorreq(rtwdev, addr32, \u0026data, 4,\ndrivers/net/wireless/realtek/rtw89/usb.c-89-\t\t\t\t RTW89_USB_VENQT_READ);\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-107-\ndrivers/net/wireless/realtek/rtw89/usb.c:108:static u8 rtw89_usb_ops_read8(struct rtw89_dev *rtwdev, u32 addr)\ndrivers/net/wireless/realtek/rtw89/usb.c-109-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-112-\tif (ACCESS_CMAC(addr))\ndrivers/net/wireless/realtek/rtw89/usb.c:113:\t\treturn rtw89_usb_read_cmac(rtwdev, addr);\ndrivers/net/wireless/realtek/rtw89/usb.c-114-\ndrivers/net/wireless/realtek/rtw89/usb.c:115:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 1, RTW89_USB_VENQT_READ);\ndrivers/net/wireless/realtek/rtw89/usb.c-116-\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-119-\ndrivers/net/wireless/realtek/rtw89/usb.c:120:static u16 rtw89_usb_ops_read16(struct rtw89_dev *rtwdev, u32 addr)\ndrivers/net/wireless/realtek/rtw89/usb.c-121-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-124-\tif (ACCESS_CMAC(addr))\ndrivers/net/wireless/realtek/rtw89/usb.c:125:\t\treturn rtw89_usb_read_cmac(rtwdev, addr);\ndrivers/net/wireless/realtek/rtw89/usb.c-126-\ndrivers/net/wireless/realtek/rtw89/usb.c:127:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 2, RTW89_USB_VENQT_READ);\ndrivers/net/wireless/realtek/rtw89/usb.c-128-\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-131-\ndrivers/net/wireless/realtek/rtw89/usb.c:132:static u32 rtw89_usb_ops_read32(struct rtw89_dev *rtwdev, u32 addr)\ndrivers/net/wireless/realtek/rtw89/usb.c-133-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-136-\tif (ACCESS_CMAC(addr))\ndrivers/net/wireless/realtek/rtw89/usb.c:137:\t\treturn rtw89_usb_read_cmac(rtwdev, addr);\ndrivers/net/wireless/realtek/rtw89/usb.c-138-\ndrivers/net/wireless/realtek/rtw89/usb.c:139:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 4,\ndrivers/net/wireless/realtek/rtw89/usb.c-140-\t\t\t RTW89_USB_VENQT_READ);\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-144-\ndrivers/net/wireless/realtek/rtw89/usb.c:145:static void rtw89_usb_ops_write8(struct rtw89_dev *rtwdev, u32 addr, u8 val)\ndrivers/net/wireless/realtek/rtw89/usb.c-146-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-148-\ndrivers/net/wireless/realtek/rtw89/usb.c:149:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 1, RTW89_USB_VENQT_WRITE);\ndrivers/net/wireless/realtek/rtw89/usb.c-150-}\ndrivers/net/wireless/realtek/rtw89/usb.c-151-\ndrivers/net/wireless/realtek/rtw89/usb.c:152:static void rtw89_usb_ops_write16(struct rtw89_dev *rtwdev, u32 addr, u16 val)\ndrivers/net/wireless/realtek/rtw89/usb.c-153-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-155-\ndrivers/net/wireless/realtek/rtw89/usb.c:156:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 2, RTW89_USB_VENQT_WRITE);\ndrivers/net/wireless/realtek/rtw89/usb.c-157-}\ndrivers/net/wireless/realtek/rtw89/usb.c-158-\ndrivers/net/wireless/realtek/rtw89/usb.c:159:static void rtw89_usb_ops_write32(struct rtw89_dev *rtwdev, u32 addr, u32 val)\ndrivers/net/wireless/realtek/rtw89/usb.c-160-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-162-\ndrivers/net/wireless/realtek/rtw89/usb.c:163:\trtw89_usb_vendorreq(rtwdev, addr, \u0026data, 4, RTW89_USB_VENQT_WRITE);\ndrivers/net/wireless/realtek/rtw89/usb.c-164-}\ndrivers/net/wireless/realtek/rtw89/usb.c-165-\ndrivers/net/wireless/realtek/rtw89/usb.c:166:static void rtw89_usb_write32_quiet(struct rtw89_dev *rtwdev, u32 addr, u32 val)\ndrivers/net/wireless/realtek/rtw89/usb.c-167-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-169-\ndrivers/net/wireless/realtek/rtw89/usb.c:170:\t__rtw89_usb_vendorreq(rtwdev, addr, \u0026data, 4,\ndrivers/net/wireless/realtek/rtw89/usb.c-171-\t\t\t RTW89_USB_VENQT_WRITE, false);\n--\ndrivers/net/wireless/realtek/rtw89/usb.c=174=static u32\ndrivers/net/wireless/realtek/rtw89/usb.c:175:rtw89_usb_ops_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/usb.c-176-\t\t\t\t\t u8 txch)\ndrivers/net/wireless/realtek/rtw89/usb.c-177-{\ndrivers/net/wireless/realtek/rtw89/usb.c:178:\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c-179-\tint inflight;\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-190-\ndrivers/net/wireless/realtek/rtw89/usb.c:191:static void rtw89_usb_write_port_complete(struct urb *urb)\ndrivers/net/wireless/realtek/rtw89/usb.c-192-{\ndrivers/net/wireless/realtek/rtw89/usb.c:193:\tstruct rtw89_usb_tx_ctrl_block *txcb = urb-\u003econtext;\ndrivers/net/wireless/realtek/rtw89/usb.c-194-\tstruct rtw89_dev *rtwdev = txcb-\u003ertwdev;\ndrivers/net/wireless/realtek/rtw89/usb.c:195:\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c-196-\tstruct ieee80211_tx_info *info;\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-258-\ndrivers/net/wireless/realtek/rtw89/usb.c:259:static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,\ndrivers/net/wireless/realtek/rtw89/usb.c-260-\t\t\t\tvoid *data, int len, void *context)\ndrivers/net/wireless/realtek/rtw89/usb.c-261-{\ndrivers/net/wireless/realtek/rtw89/usb.c:262:\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c:263:\tconst struct rtw89_usb_info *info = rtwusb-\u003einfo;\ndrivers/net/wireless/realtek/rtw89/usb.c-264-\tstruct usb_device *usbd = rtwusb-\u003eudev;\n--\n\n"
} |
| 7/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28111 output: 44 thoughts: 36 Thoughts: Okay, let's dive into this. Here's my thought process on dissecting `rtw89_usb_probe` in `drivers/net/wireless/realtek/rtw89/usb.c`: **Dissecting rtw89_usb_probe** Alright, so the first step is always to understand the device probe function. "rtw89_usb_probe"...it's the USB variant of the Realtek 89 wireless driver, so I need to understand how the USB device is initialized and connected into the kernel's networking stack. I'm going to look at the USB device matching and configuration process, starting with the device ID table. That's the gateway for the kernel to recognize this specific piece of hardware. I’ll need to understand how the driver handles device enumeration, resource allocation (interrupts, DMA channels, memory regions), and the creation of the network interface. What are the key data structures involved? Is it using the standard USB netdev framework, or are there custom Realtek-specific hooks in place? My focus is on the crucial interactions between the USB controller and the Realtek chipset. I'm looking for the hardware initialization sequence, any custom USB transfers (control, bulk, interrupt), and the method for establishing the data link. I'll need to pay close attention to the error handling within the probe function as well, especially any robustness features. This will show how it handles the most common failures on initialization. From there, I'll move on to understanding how the driver handles power management: is there suspend/resume logic? How does it interact with the USB bus for power state changes? And finally, if I can, it'll be good to see how it handles firmware loading (if applicable). |
| 8/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "int rtw89_usb_probe",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/usb.c=1206=__ATTRIBUTE_GROUPS(rtw89_usb);\ndrivers/net/wireless/realtek/rtw89/usb.c-1207-\ndrivers/net/wireless/realtek/rtw89/usb.c:1208:int rtw89_usb_probe(struct usb_interface *intf,\ndrivers/net/wireless/realtek/rtw89/usb.c-1209-\t\t const struct usb_device_id *id,\n--\ndrivers/net/wireless/realtek/rtw89/usb.h=92=static inline struct rtw89_usb *rtw89_usb_priv(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/usb.h-96-\ndrivers/net/wireless/realtek/rtw89/usb.h:97:int rtw89_usb_probe(struct usb_interface *intf,\ndrivers/net/wireless/realtek/rtw89/usb.h-98-\t\t const struct usb_device_id *id,\n"
} |
| 9/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28867 output: 46 thoughts: 34 Thoughts: Okay, let's dive into this. I'm going to pull up `rtw89_usb_probe` in `drivers/net/wireless/realtek/rtw89/usb.c`. This is where the rubber meets the road, the initial connection point for this Realtek 89 USB wireless device. I need to understand how the driver gets loaded, how the hardware is identified, and what initial setup is performed. This is the critical entry point; everything hinges on a successful probe. I'll be looking for resource allocation, device initialization, interrupt setup – all the usual suspects. I want to see how robust the error handling is, and what the overall flow of control looks like. Let's see how well it's written and if I can spot any immediate red flags or clever optimizations. |
| 10/2 | 2026/10/23 00:21 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/usb.c",
"FirstLine": 1208,
"LineCount": 80
}Results: {
"Contents": "1208:\tint rtw89_usb_probe(struct usb_interface *intf,\n1209:\t\t\t const struct usb_device_id *id,\n1210:\t\t\t const struct rtw89_driver_info *default_info)\n1211:\t{\n1212:\t\tconst struct rtw89_driver_info *info;\n1213:\t\tstruct rtw89_dev *rtwdev;\n1214:\t\tstruct rtw89_usb *rtwusb;\n1215:\t\tint ret;\n1216:\t\n1217:\t\tinfo = (const struct rtw89_driver_info *)id-\u003edriver_info;\n1218:\t\tif (!info)\n1219:\t\t\tinfo = default_info;\n1220:\t\n1221:\t\trtwdev = rtw89_alloc_ieee80211_hw(\u0026intf-\u003edev,\n1222:\t\t\t\t\t\t sizeof(struct rtw89_usb), info);\n1223:\t\tif (!rtwdev) {\n1224:\t\t\tdev_err(\u0026intf-\u003edev, \"failed to allocate hw\\n\");\n1225:\t\t\treturn -ENOMEM;\n1226:\t\t}\n1227:\t\n1228:\t\trtwusb = rtw89_usb_priv(rtwdev);\n1229:\t\trtwusb-\u003ertwdev = rtwdev;\n1230:\t\trtwusb-\u003einfo = info-\u003ebus.usb;\n1231:\t\n1232:\t\trtwdev-\u003ehw-\u003ewiphy-\u003edev.groups = rtw89_usb_groups;\n1233:\t\n1234:\t\trtwdev-\u003ehci.ops = \u0026rtw89_usb_ops;\n1235:\t\trtwdev-\u003ehci.type = RTW89_HCI_TYPE_USB;\n1236:\t\trtwdev-\u003ehci.tx_rpt_enabled = true;\n1237:\t\n1238:\t\tret = rtw89_usb_intf_init(rtwdev, intf);\n1239:\t\tif (ret) {\n1240:\t\t\trtw89_err(rtwdev, \"failed to initialise intf: %d\\n\", ret);\n1241:\t\t\tgoto err_free_hw;\n1242:\t\t}\n1243:\t\n1244:\t\tret = rtw89_usb_switch_mode(rtwdev);\n1245:\t\tif (ret) {\n1246:\t\t\t/* Not a fail, but we do need to skip rtw89_core_register. */\n1247:\t\t\tret = 0;\n1248:\t\t\tgoto err_intf_deinit;\n1249:\t\t}\n1250:\t\n1251:\t\tif (rtwusb-\u003eudev-\u003espeed == USB_SPEED_SUPER)\n1252:\t\t\trtwdev-\u003ehci.dle_type = RTW89_HCI_DLE_TYPE_USB3;\n1253:\t\telse\n1254:\t\t\trtwdev-\u003ehci.dle_type = RTW89_HCI_DLE_TYPE_USB2;\n1255:\t\n1256:\t\trtw89_usb_init_tx(rtwdev);\n1257:\t\n1258:\t\tret = rtw89_usb_alloc_rx_bufs(rtwusb);\n1259:\t\tif (ret)\n1260:\t\t\tgoto err_intf_deinit;\n1261:\t\n1262:\t\tret = rtw89_usb_init_rx(rtwdev);\n1263:\t\tif (ret)\n1264:\t\t\tgoto err_free_rx_bufs;\n1265:\t\n1266:\t\tret = rtw89_core_init(rtwdev);\n1267:\t\tif (ret) {\n1268:\t\t\trtw89_err(rtwdev, \"failed to initialise core: %d\\n\", ret);\n1269:\t\t\tgoto err_deinit_rx;\n1270:\t\t}\n1271:\t\n1272:\t\tret = rtw89_chip_info_setup(rtwdev);\n1273:\t\tif (ret) {\n1274:\t\t\trtw89_err(rtwdev, \"failed to setup chip information\\n\");\n1275:\t\t\tgoto err_core_deinit;\n1276:\t\t}\n1277:\t\n1278:\t\tret = rtw89_core_register(rtwdev);\n1279:\t\tif (ret) {\n1280:\t\t\trtw89_err(rtwdev, \"failed to register core\\n\");\n1281:\t\t\tgoto err_core_deinit;\n1282:\t\t}\n1283:\t\n1284:\t\trtw89_usb_start_rx(rtwdev);\n1285:\t\n1286:\t\tset_bit(RTW89_FLAG_PROBE_DONE, rtwdev-\u003eflags);\n1287:\t\n"
} |
| 11/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30443 output: 46 thoughts: 908 Thoughts: **Diving Deep into the Regulatory Domain Logic** Okay, so `rtw89_usb_probe` kicks things off – initializes the driver, registers the core, and starts the receive path. Good. Now, I want to understand the regulatory domain learning process. Let's look at `rtw89_regd_learn_init` and `rtw89_regd_learn`, and figure out their calls. Alright, let's trace this back. Checking `rtw89_ops_start` in `mac80211.c` shows the call to `rtw89_regd_learn_init`. Great, this is the entry point. But hold on, how is `rtw89_regd_learn_init` actually activated? Let's dig into `rtw89_regd_learn_init` itself. It seems the execution of `rtw89_regd_learn_init` is guarded by `regd_learn->can_activate`. That depends on `regulatory->programmed` and a check of an FW feature `REGD_LEARN`. This is setting up the conditions for it to even *be* active. Okay, now, where does `regulatory_info` (or rather, the information it contains) get set up? Time to examine `rtw89_regd_notifier_apply` in `regd.c`. Ah, here it is, the driver is reacting to regulatory notifications from the system, populating the `regulatory` struct with information. Seems like the code handles notifications from the system and interprets the regulatory domain information. There's some logic regarding whether the regulatory domain is set by a user, and a country code check. Then it enqueues a `rtw89_regd_learn` or not. But where is `rtw89_regd_notifier_apply` actually called? I'll need to use grep to understand the call structure, and from there get a better handle on the control flow. |
| 12/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "rtw89_regd_notifier_apply",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/regd.c=1117=static void rtw89_regd_apply_policy_ant_gain(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/regd.c-1129-\ndrivers/net/wireless/realtek/rtw89/regd.c:1130:static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/regd.c-1131-\t\t\t\t struct wiphy *wiphy,\n--\ndrivers/net/wireless/realtek/rtw89/regd.c=1161=void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request)\n--\ndrivers/net/wireless/realtek/rtw89/regd.c-1170-\ndrivers/net/wireless/realtek/rtw89/regd.c:1171:\trtw89_regd_notifier_apply(rtwdev, wiphy, request);\ndrivers/net/wireless/realtek/rtw89/regd.c-1172-\trtw89_debug_regd(rtwdev, rtwdev-\u003eregulatory.regd,\n"
} |
| 13/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32191 output: 42 thoughts: 213 Thoughts: **Analyzing the Regulatory Notifier and Device Initialization** Okay, so `rtw89_regd_notifier` is the crucial callback function that the wireless regulatory system uses through the `wiphy` structure. Specifically, it's assigned to `wiphy->reg_notifier`. This is important because whenever the regulatory domain changes, either through a command from userspace via nl80211 or a hint from another part of the system, this callback is invoked. I need to keep this in mind as I trace how the driver handles channel context and configuration changes as a result. Now, let's consider the operations directly related to channel context and configuration. I need to keep in mind functions like `rtw89_ops_assign_vif_chanctx`, `rtw89_ops_unassign_vif_chanctx`, `rtw89_ops_config`, and `rtw89_ops_change_vif_links`. These are the key entry points to examine when a regulatory event occurs. Hold on a moment, a key question just popped into my head: can this `rtw89` device even initialize correctly within the constrained environment of syzkaller or QEMU? Does it have the necessary support to be probed and start? I wonder if there are USB descriptions present for it within syzkaller, to support this initialisation? Wait, which USB IDs does this driver actually support? I'm going to quickly check in files like `rtw8852au.c` and others to quickly confirm the supported hardware, and whether these are present within my syzkaller instance. |
| 14/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "MODULE_DEVICE_TABLE\\(usb",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/rtw8851bu.c=41=static const struct usb_device_id rtw_8851bu_id_table[] = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-59-};\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c:60:MODULE_DEVICE_TABLE(usb, rtw_8851bu_id_table);\ndrivers/net/wireless/realtek/rtw89/rtw8851bu.c-61-\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c=43=static const struct usb_device_id rtw_8852au_id_table[] = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-73-};\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c:74:MODULE_DEVICE_TABLE(usb, rtw_8852au_id_table);\ndrivers/net/wireless/realtek/rtw89/rtw8852au.c-75-\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c=41=static const struct usb_device_id rtw_8852bu_id_table[] = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-73-};\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c:74:MODULE_DEVICE_TABLE(usb, rtw_8852bu_id_table);\ndrivers/net/wireless/realtek/rtw89/rtw8852bu.c-75-\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c=108=static const struct usb_device_id rtw_8852cu_id_table[] = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-134-};\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c:135:MODULE_DEVICE_TABLE(usb, rtw_8852cu_id_table);\ndrivers/net/wireless/realtek/rtw89/rtw8852cu.c-136-\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c=42=static const struct usb_device_id rtw_8922au_id_table[] = {\n--\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-80-};\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c:81:MODULE_DEVICE_TABLE(usb, rtw_8922au_id_table);\ndrivers/net/wireless/realtek/rtw89/rtw8922au.c-82-\n"
} |
| 15/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 33612 output: 39 thoughts: 230 Thoughts: **Analyzing the Probe Sequence** Okay, let's break down this probe sequence step by step. I'm seeing a clear progression within `rtw89_usb_probe`. First, it's initializing the interface with `rtw89_usb_intf_init`, then switching modes with `rtw89_usb_switch_mode`. Makes sense so far. Allocation of RX buffers with `rtw89_usb_alloc_rx_bufs` and the initialization of the RX path with `rtw89_usb_init_rx` follow—standard setup for data reception. Now we get to the core setup. I see `rtw89_core_init`, `rtw89_chip_info_setup`, and finally `rtw89_core_register`. These look like critical steps for initializing the hardware and bringing the device online. But, a nagging question pops up: Where does the firmware loading actually fit into this whole process? Is it happening during the probe or is it pushed off until the `start` function, whatever that looks like? I need to dig into `rtw89_chip_info_setup` and `rtw89_core_init` to confirm my suspicion. The whole sequence seems to be logically connected. I'll also have to keep an eye out for `rtw89_core_start`, assuming there is one. |
| 16/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "request_firmware",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/fw.c=1091=rtw89_early_fw_feature_recognize(struct device *device,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1107-\ndrivers/net/wireless/realtek/rtw89/fw.c:1108:\t\tret = request_firmware(\u0026firmware, fw_name, device);\ndrivers/net/wireless/realtek/rtw89/fw.c-1109-\t\tif (!ret) {\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=2256=static int rtw89_load_firmware_req(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-2271-\telse\ndrivers/net/wireless/realtek/rtw89/fw.c:2272:\t\tret = request_firmware(\u0026req-\u003efirmware, fw_name, rtwdev-\u003edev);\ndrivers/net/wireless/realtek/rtw89/fw.c-2273-\n"
} |
| 17/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34485 output: 48 thoughts: 58 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing the RTW89 Firmware Loading Process** Right, so I'm digging into this RTW89 driver code again. I need to understand the firmware loading flow, specifically how it figures out what features are available early on. My immediate focus is on `rtw89_early_fw_feature_recognize` and the related `rtw89_load_firmware_req` function. I need to trace the call paths to understand precisely when that `rtw89_early_fw_feature_recognize` function is invoked. Time to break out the grep, I suppose. Gotta see where this crucial function gets called from. That will give me the context I'm looking for. |
| 18/2 | 2026/10/23 00:21 | tool | grepper |
0mArgs:{
"Expression": "rtw89_early_fw_feature_recognize",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=7652=struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7668-\ndrivers/net/wireless/realtek/rtw89/core.c:7669:\tfirmware = rtw89_early_fw_feature_recognize(device, chip, variant,\ndrivers/net/wireless/realtek/rtw89/core.c-7670-\t\t\t\t\t\t \u0026early_fw, \u0026fw_format);\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1090=const struct firmware *\ndrivers/net/wireless/realtek/rtw89/fw.c:1091:rtw89_early_fw_feature_recognize(struct device *device,\ndrivers/net/wireless/realtek/rtw89/fw.c-1092-\t\t\t\t const struct rtw89_chip_info *chip,\n--\ndrivers/net/wireless/realtek/rtw89/fw.h=5469=const struct firmware *\ndrivers/net/wireless/realtek/rtw89/fw.h:5470:rtw89_early_fw_feature_recognize(struct device *device,\ndrivers/net/wireless/realtek/rtw89/fw.h-5471-\t\t\t\t const struct rtw89_chip_info *chip,\n"
} |
| 19/2 | 2026/10/23 00:21 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 35159 output: 46 thoughts: 36 Thoughts: Here's a summary of my thought process, as requested: **Diving into the 802.11 Hardware Allocation** Okay, time to get my hands dirty. I need to understand how this driver, specifically the `rtw89`, allocates hardware resources for the 802.11 interface. My focus is on the `rtw89_alloc_ieee80211_hw` function, so I’ll jump right into `core.c` and zero in around line 7660. I know this is where the meat of the hardware initialization and resource assignment probably happens. Hopefully, by understanding this allocation process, I'll be able to better diagnose the current performance issue and consider possible optimizations. Let's see what we've got. |
| 20/2 | 2026/10/23 00:22 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/core.c",
"FirstLine": 7655,
"LineCount": 40
}Results: {
"Contents": "7655:\t{\n7656:\t\tconst unsigned long *dev_id_quirks = \u0026info-\u003edev_id_quirks;\n7657:\t\tconst struct rtw89_chip_variant *variant = info-\u003evariant;\n7658:\t\tconst struct rtw89_chip_info *chip = info-\u003echip;\n7659:\t\tstruct rtw89_fw_info early_fw = {};\n7660:\t\tconst struct firmware *firmware;\n7661:\t\tstruct ieee80211_hw *hw;\n7662:\t\tstruct rtw89_dev *rtwdev;\n7663:\t\tstruct ieee80211_ops *ops;\n7664:\t\tu32 driver_data_size;\n7665:\t\tint fw_format = -1;\n7666:\t\tbool support_mlo;\n7667:\t\tbool no_chanctx;\n7668:\t\n7669:\t\tfirmware = rtw89_early_fw_feature_recognize(device, chip, variant,\n7670:\t\t\t\t\t\t\t \u0026early_fw, \u0026fw_format);\n7671:\t\n7672:\t\tops = kmemdup(\u0026rtw89_ops, sizeof(rtw89_ops), GFP_KERNEL);\n7673:\t\tif (!ops)\n7674:\t\t\tgoto err;\n7675:\t\n7676:\t\tno_chanctx = chip-\u003esupport_chanctx_num == 0 ||\n7677:\t\t\t !RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, \u0026early_fw) ||\n7678:\t\t\t !RTW89_CHK_FW_FEATURE(BEACON_FILTER, \u0026early_fw);\n7679:\t\n7680:\t\tif (no_chanctx) {\n7681:\t\t\tops-\u003eadd_chanctx = ieee80211_emulate_add_chanctx;\n7682:\t\t\tops-\u003eremove_chanctx = ieee80211_emulate_remove_chanctx;\n7683:\t\t\tops-\u003echange_chanctx = ieee80211_emulate_change_chanctx;\n7684:\t\t\tops-\u003eswitch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx;\n7685:\t\t\tops-\u003eassign_vif_chanctx = NULL;\n7686:\t\t\tops-\u003eunassign_vif_chanctx = NULL;\n7687:\t\t\tops-\u003eremain_on_channel = NULL;\n7688:\t\t\tops-\u003ecancel_remain_on_channel = NULL;\n7689:\t\t}\n7690:\t\n7691:\t\tif (!chip-\u003esupport_noise)\n7692:\t\t\tops-\u003eget_survey = NULL;\n7693:\t\n7694:\t\tdriver_data_size = sizeof(struct rtw89_dev) + bus_data_size;\n"
} |
| 21/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36172 output: 46 thoughts: 60 Thoughts: Okay, let's break this down. **Investigating the Firmware Dependency in rtw89 Driver** Alright, I'm digging into the `rtw89` driver, and I'm particularly curious about what happens when the firmware is MIA. Specifically, I'm looking at the `rtw89_alloc_ieee80211_hw` function. My initial question is: does the driver gracefully handle a missing firmware in the probing process, or does it crash, or does it attempt to continue in a degraded mode? I want to see how robust this is. To get to the bottom of this, the logical next step is to examine the `rtw89_early_fw_feature_recognize` function. That's probably where the driver tries to figure out whether it can find the required firmware. That's the key. This function likely controls the detection. |
| 22/2 | 2026/10/23 00:22 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 1090,
"LineCount": 40
}Results: {
"Contents": "1090:\tconst struct firmware *\n1091:\trtw89_early_fw_feature_recognize(struct device *device,\n1092:\t\t\t\t\t const struct rtw89_chip_info *chip,\n1093:\t\t\t\t\t const struct rtw89_chip_variant *variant,\n1094:\t\t\t\t\t struct rtw89_fw_info *early_fw,\n1095:\t\t\t\t\t int *used_fw_format)\n1096:\t{\n1097:\t\tconst struct rtw89_fw_def *fw_def = __rtw89_chip_get_fw_def(chip, variant);\n1098:\t\tconst struct firmware *firmware;\n1099:\t\tchar fw_name[64];\n1100:\t\tint fw_format;\n1101:\t\tu32 ver_code;\n1102:\t\tint ret;\n1103:\t\n1104:\t\tfor (fw_format = fw_def-\u003efw_format_max; fw_format \u003e= 0; fw_format--) {\n1105:\t\t\trtw89_fw_get_filename(fw_name, sizeof(fw_name),\n1106:\t\t\t\t\t fw_def-\u003efw_basename, fw_format);\n1107:\t\n1108:\t\t\tret = request_firmware(\u0026firmware, fw_name, device);\n1109:\t\t\tif (!ret) {\n1110:\t\t\t\tdev_info(device, \"loaded firmware %s\\n\", fw_name);\n1111:\t\t\t\t*used_fw_format = fw_format;\n1112:\t\t\t\tbreak;\n1113:\t\t\t}\n1114:\t\t}\n1115:\t\n1116:\t\tif (ret) {\n1117:\t\t\tdev_err(device, \"failed to early request firmware: %d\\n\", ret);\n1118:\t\t\treturn NULL;\n1119:\t\t}\n1120:\t\n1121:\t\tver_code = rtw89_compat_fw_hdr_ver_code(firmware-\u003edata);\n1122:\t\n1123:\t\tif (!ver_code)\n1124:\t\t\tgoto out;\n1125:\t\n1126:\t\trtw89_fw_iterate_feature_cfg(early_fw, chip, ver_code);\n1127:\t\n1128:\tout:\n1129:\t\treturn firmware;\n"
} |
| 23/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37105 output: 46 thoughts: 53 Thoughts: Okay, let's break this down. **Investigating the Firmware Handling in `rtw89_alloc_ieee80211_hw`** Right, so I'm diving into this `rtw89_alloc_ieee80211_hw` function. The first thing that jumps out is the potential for `firmware` to be `NULL`. A null firmware pointer is a classic potential source of trouble, especially in a driver. I need to understand the implications of that condition. What safeguards are in place? What happens if the firmware isn't successfully loaded? I should probably get my nose on lines 7700-7730 of `core.c`. I'm going to look specifically at the conditional where the `firmware` pointer is checked. That section will probably contain the critical logic to handle a missing or unloaded firmware blob. I'll be looking for error handling, fallback mechanisms, or possibly even a fatal exit. I need to figure out what the intended behavior is in that specific situation. |
| 24/2 | 2026/10/23 00:22 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/core.c",
"FirstLine": 7700,
"LineCount": 40
}Results: {
"Contents": "7700:\t\t * or MLD-single-link softap. If RTW89_MLD_NON_STA_LINK_NUM enlarges,\n7701:\t\t * please tweak entire AP_LINKS_PS handling before supporting MLO.\n7702:\t\t */\n7703:\t\tsupport_mlo = !no_chanctx \u0026\u0026 chip-\u003esupport_link_num \u0026\u0026\n7704:\t\t\t RTW89_CHK_FW_FEATURE(NOTIFY_AP_INFO, \u0026early_fw) \u0026\u0026\n7705:\t\t\t RTW89_MLD_NON_STA_LINK_NUM == 1;\n7706:\t\n7707:\t\thw-\u003ewiphy-\u003eiface_combinations = rtw89_iface_combs;\n7708:\t\n7709:\t\tif (no_chanctx || chip-\u003esupport_chanctx_num == 1)\n7710:\t\t\thw-\u003ewiphy-\u003en_iface_combinations = 1;\n7711:\t\telse\n7712:\t\t\thw-\u003ewiphy-\u003en_iface_combinations = ARRAY_SIZE(rtw89_iface_combs);\n7713:\t\n7714:\t\trtwdev = hw-\u003epriv;\n7715:\t\trtwdev-\u003ehw = hw;\n7716:\t\trtwdev-\u003edev = device;\n7717:\t\trtwdev-\u003eops = ops;\n7718:\t\trtwdev-\u003echip = chip;\n7719:\t\trtwdev-\u003evariant = variant;\n7720:\t\trtwdev-\u003eboard = info-\u003eboard;\n7721:\t\trtwdev-\u003efw.req.firmware = firmware;\n7722:\t\trtwdev-\u003efw.fw_format = fw_format;\n7723:\t\trtwdev-\u003esupport_mlo = support_mlo;\n7724:\t\n7725:\t\tbitmap_or(rtwdev-\u003equirks, rtwdev-\u003equirks, dev_id_quirks,\n7726:\t\t\t NUM_OF_RTW89_QUIRKS);\n7727:\t\n7728:\t\trtw89_debug(rtwdev, RTW89_DBG_CHAN, \"probe driver %s chanctx\\n\",\n7729:\t\t\t no_chanctx ? \"without\" : \"with\");\n7730:\t\trtw89_debug(rtwdev, RTW89_DBG_CHAN, \"probe driver %s MLO cap\\n\",\n7731:\t\t\t support_mlo ? \"with\" : \"without\");\n7732:\t\n7733:\t\treturn rtwdev;\n7734:\t\n7735:\terr:\n7736:\t\tkfree(ops);\n7737:\t\trelease_firmware(firmware);\n7738:\t\treturn NULL;\n7739:\t}\n"
} |
| 25/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38166 output: 62 thoughts: 136 Thoughts: Okay, here's my breakdown of what's going through my mind as I analyze this: **Initial Concerns Regarding Firmware Allocation** Alright, so the `rtw89_alloc_ieee80211_hw` function doesn't seem to be gracefully handling a null `firmware` pointer. That's a red flag. The code appears to continue execution even with `early_fw` being an all-zero structure, and crucially, without any features being set from what I can see. This is immediately concerning because zeroed or missing firmware often leads to unpredictable behavior, especially during hardware initialization. Now, my immediate thought is to trace the execution path. Where is this potential problem *really* going to rear its head? I need to understand what functions are subsequently called, and how they interact with this potentially incomplete state. I'm focusing specifically on where this `firmware` pointer is used later on in the driver's initialization sequence. My suspicion is that we are likely to find a pointer dereference in the follow-on functions. Specifically, I'm thinking of `rtw89_core_init`, `rtw89_core_register`, `rtw89_usb_intf_init`, and `rtw89_usb_switch_mode`. I need to see what's happening within those functions, especially around any hardware access or configuration steps that would rely on the firmware data or feature flags. The most likely suspects, given the context, are `rtw89_usb_intf_init` and `rtw89_usb_switch_mode` so I'm going to look there first to see what's happening. |
| 26/2 | 2026/10/23 00:22 | tool | grepper |
0mArgs:{
"Expression": "int rtw89_usb_intf_init|int rtw89_usb_switch_mode",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/usb.c"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/usb.c=987=static int rtw89_usb_parse(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1046-\ndrivers/net/wireless/realtek/rtw89/usb.c:1047:static int rtw89_usb_intf_init(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/usb.c-1048-\t\t\t struct usb_interface *intf)\n--\ndrivers/net/wireless/realtek/rtw89/usb.c=1072=static void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1080-\ndrivers/net/wireless/realtek/rtw89/usb.c:1081:static int rtw89_usb_switch_mode_ax(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/usb.c-1082-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1112-\ndrivers/net/wireless/realtek/rtw89/usb.c:1113:static int rtw89_usb_switch_mode_be(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/usb.c-1114-{\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1141-\ndrivers/net/wireless/realtek/rtw89/usb.c:1142:static int rtw89_usb_switch_mode(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/usb.c-1143-{\n"
} |
| 27/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39247 output: 46 thoughts: 19 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving into `rtw89_usb_switch_mode`** Alright, let's dissect what happens within `rtw89_usb_switch_mode`. I need to figure out the intricacies of this USB mode switching process in the rtw89 driver. I immediately want to consider the context of its execution. Where is this function called from? Is it triggered by a specific event, perhaps a hardware interrupt, or a user-space request via sysfs or some other interface? Understanding the call stack is crucial for tracing the cause and effect. I expect this function to handle the low-level USB configuration changes. This might involve setting up the appropriate USB endpoints, configuring the transfer types (bulk, interrupt, isochronous), and potentially managing the USB descriptors. There's probably interaction with the USB core, likely using functions like `usb_set_interface`, `usb_control_msg`, and maybe even direct register manipulation if we're dealing with low-level USB registers within the firmware. Given that it’s a "switch mode" function, I anticipate the need for careful error handling. What happens if the USB device fails to reconfigure correctly? Are there retries implemented? Timeout mechanisms? Proper error codes returned to the caller? I'll need to look for any potential race conditions, especially if multiple threads or processes might be interacting with the USB device concurrently. I'm also curious about the power management aspects. Does this function handle suspending or resuming the USB device? Does it impact USB link state or signaling? How are things like USB bus power settings handled during this change? I'll need to trace the data flow. What data structures are involved? Are there any device-specific data structures or control registers that need to be read or written? I'll be looking for memory allocation or deallocation issues, especially if dynamically allocated data is used to hold USB descriptors or endpoint information. Finally, I'll be paying close attention to any possible firmware involvement: does the driver send commands to the device's firmware during the mode switch, or is this completely driver-managed at the software level? |
| 28/2 | 2026/10/23 00:22 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/usb.c",
"FirstLine": 1140,
"LineCount": 40
}Results: {
"Contents": "1140:\t}\n1141:\t\n1142:\tstatic int rtw89_usb_switch_mode(struct rtw89_dev *rtwdev)\n1143:\t{\n1144:\t\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\n1145:\t\n1146:\t\tif (rtwusb-\u003eudev-\u003espeed == USB_SPEED_SUPER) {\n1147:\t\t\trtw89_info(rtwdev,\n1148:\t\t\t\t \"2.4 GHz performance may be better in a USB 2 port\\n\");\n1149:\t\t\treturn 0;\n1150:\t\t}\n1151:\t\n1152:\t\tif (rtwdev-\u003echip-\u003echip_gen == RTW89_CHIP_AX)\n1153:\t\t\treturn rtw89_usb_switch_mode_ax(rtwdev);\n1154:\t\n1155:\t\treturn rtw89_usb_switch_mode_be(rtwdev);\n1156:\t}\n1157:\t\n1158:\tstatic ssize_t serial_number_show(struct device *dev,\n1159:\t\t\t\t\t struct device_attribute *attr, char *buf)\n1160:\t{\n1161:\t\tstruct wiphy *wiphy = container_of(dev, struct wiphy, dev);\n1162:\t\tstruct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);\n1163:\t\tstruct rtw89_dev *rtwdev = hw-\u003epriv;\n1164:\t\tstruct rtw89_efuse *efuse = \u0026rtwdev-\u003eefuse;\n1165:\t\n1166:\t\treturn sysfs_emit(buf, \"%*phN\\n\",\n1167:\t\t\t\t (int)sizeof(efuse-\u003esn), efuse-\u003esn);\n1168:\t}\n1169:\tstatic DEVICE_ATTR_RO(serial_number);\n1170:\t\n1171:\tstatic ssize_t uuid_show(struct device *dev,\n1172:\t\t\t\t struct device_attribute *attr, char *buf)\n1173:\t{\n1174:\t\tstruct wiphy *wiphy = container_of(dev, struct wiphy, dev);\n1175:\t\tstruct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);\n1176:\t\tstruct rtw89_dev *rtwdev = hw-\u003epriv;\n1177:\t\tstruct rtw89_efuse *efuse = \u0026rtwdev-\u003eefuse;\n1178:\t\n1179:\t\treturn sysfs_emit(buf, \"%pUb\\n\", efuse-\u003euuid);\n"
} |
| 29/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40526 output: 47 thoughts: 332 Thoughts: **Analyzing the REGD_LEARN Feature Initialization**
Okay, let's break down this `rtw89_regd_learn` initialization. First, I need to understand how this feature is enabled, right? The code checks `rtw89_regd_learn_init` and uses:
```c
void rtw89_regd_learn_init(struct rtw89_dev *rtwdev)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
struct rtw89_regd_learn *regd_learn = &rtwdev->regd_learn;
struct wiphy *wiphy = rtwdev->hw->wiphy;
lockdep_assert_wiphy(wiphy);
if (regd_learn->can_activate)
return;
regd_learn->can_activate = !regulatory->programmed &&
RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw);
if (!regd_learn->can_activate)
return;
...
```
So, the critical part is `RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw)`. That suggests a feature flag controlled by the firmware, and it's tied to this `rtwdev->fw` struct. I need to figure out where that `rtwdev->fw` struct's feature bitmap is populated. It's the key to this whole thing.
Now, I'm thinking, `RTW89_CHK_FW_FEATURE` is probably just a macro, but I want to make sure I know what it depends on. Let's see if there are any other uses for `RTW89_FW_FEATURE_REGD_LEARN` or something similar like `fw_feat_tbl`. Time to go searching the codebase, let's search for `rtw89_fw_iterate_feature_cfg` or `RTW89_CHK_FW_FEATURE`.
|
| 30/2 | 2026/10/23 00:22 | tool | grepper |
0mArgs:{
"Expression": "rtw89_fw_iterate_feature_cfg",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/fw.c=948=static const struct __fw_feat_cfg fw_feat_tbl[] = {\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1052-\ndrivers/net/wireless/realtek/rtw89/fw.c:1053:static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,\ndrivers/net/wireless/realtek/rtw89/fw.c-1054-\t\t\t\t\t const struct rtw89_chip_info *chip,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1078=static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1086-\ndrivers/net/wireless/realtek/rtw89/fw.c:1087:\trtw89_fw_iterate_feature_cfg(\u0026rtwdev-\u003efw, chip, suit_ver_code);\ndrivers/net/wireless/realtek/rtw89/fw.c-1088-}\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1091=rtw89_early_fw_feature_recognize(struct device *device,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1125-\ndrivers/net/wireless/realtek/rtw89/fw.c:1126:\trtw89_fw_iterate_feature_cfg(early_fw, chip, ver_code);\ndrivers/net/wireless/realtek/rtw89/fw.c-1127-\n"
} |
| 31/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41835 output: 46 thoughts: 24 Thoughts: Here's my thought process, as if I were analyzing that code: **Finding the Call Site of `rtw89_fw_recognize_features`** Okay, hold on a second. I need to understand where `rtw89_fw_recognize_features` is actually being *used*. It's not enough to know the function exists; I need to trace its execution flow. So, I need to find all the places in the codebase where this function is *called*. Let's get to work on that. I'll get to the bottom of this. |
| 32/2 | 2026/10/23 00:22 | tool | grepper |
0mArgs:{
"Expression": "rtw89_fw_recognize_features",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/fw.c=1053=static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1077-\ndrivers/net/wireless/realtek/rtw89/fw.c:1078:static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/fw.c-1079-{\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1153=int rtw89_fw_recognize(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1187-\ndrivers/net/wireless/realtek/rtw89/fw.c:1188:\trtw89_fw_recognize_features(rtwdev);\ndrivers/net/wireless/realtek/rtw89/fw.c-1189-\n"
} |
| 33/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 42334 output: 44 thoughts: 21 Thoughts: Here's my thought process, as if I were considering this myself: **Tracing the Function Call** Alright, so `rtw89_fw_recognize`... where's that being *used*? I need to figure out where this function is actually getting called within the system. Let's dig in and track down the calls to that specific function, and from there, understand its context. |
| 34/2 | 2026/10/23 00:22 | tool | grepper |
0mArgs:{
"Expression": "rtw89_fw_recognize",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=7393=int rtw89_chip_info_setup(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7413-\ndrivers/net/wireless/realtek/rtw89/core.c:7414:\tret = rtw89_fw_recognize(rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.c-7415-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7423-\ndrivers/net/wireless/realtek/rtw89/core.c:7424:\tret = rtw89_fw_recognize_elements(rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.c-7425-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=857=static\ndrivers/net/wireless/realtek/rtw89/fw.c:858:int __rtw89_fw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\ndrivers/net/wireless/realtek/rtw89/fw.c-859-\t\t\t bool nowarn)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=871=static\ndrivers/net/wireless/realtek/rtw89/fw.c:872:int __rtw89_fw_recognize_from_elm(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/fw.c-873-\t\t\t\t const struct rtw89_fw_element_hdr *elm,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1053=static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1077-\ndrivers/net/wireless/realtek/rtw89/fw.c:1078:static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/fw.c-1079-{\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1132=static int rtw89_fw_validate_ver_required(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1152-\ndrivers/net/wireless/realtek/rtw89/fw.c:1153:int rtw89_fw_recognize(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/fw.c-1154-{\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1167-\tif (chip-\u003etry_ce_fw) {\ndrivers/net/wireless/realtek/rtw89/fw.c:1168:\t\tret = __rtw89_fw_recognize(rtwdev, RTW89_FW_NORMAL_CE, true);\ndrivers/net/wireless/realtek/rtw89/fw.c-1169-\t\tif (!ret)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1172-\ndrivers/net/wireless/realtek/rtw89/fw.c:1173:\tret = __rtw89_fw_recognize(rtwdev, normal_fw_type, false);\ndrivers/net/wireless/realtek/rtw89/fw.c-1174-\tif (ret)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1182-\t/* It still works if wowlan firmware isn't existing. */\ndrivers/net/wireless/realtek/rtw89/fw.c:1183:\t__rtw89_fw_recognize(rtwdev, wowlan_fw_type, false);\ndrivers/net/wireless/realtek/rtw89/fw.c-1184-\ndrivers/net/wireless/realtek/rtw89/fw.c-1185-\t/* It still works if log format file isn't existing. */\ndrivers/net/wireless/realtek/rtw89/fw.c:1186:\t__rtw89_fw_recognize(rtwdev, RTW89_FW_LOGFMT, true);\ndrivers/net/wireless/realtek/rtw89/fw.c-1187-\ndrivers/net/wireless/realtek/rtw89/fw.c:1188:\trtw89_fw_recognize_features(rtwdev);\ndrivers/net/wireless/realtek/rtw89/fw.c-1189-\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1272=static\ndrivers/net/wireless/realtek/rtw89/fw.c:1273:int rtw89_fw_recognize_txpwr_from_elm(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/fw.c-1274-\t\t\t\t const struct rtw89_fw_element_hdr *elm,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1569=static const struct rtw89_fw_element_handler __fw_element_handlers[] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1570:\t[RTW89_FW_ELEMENT_ID_BBMCU0] = {__rtw89_fw_recognize_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1571-\t\t\t\t\t{ .fw_type = RTW89_FW_BBMCU0 }, NULL},\ndrivers/net/wireless/realtek/rtw89/fw.c:1572:\t[RTW89_FW_ELEMENT_ID_BBMCU1] = {__rtw89_fw_recognize_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1573-\t\t\t\t\t{ .fw_type = RTW89_FW_BBMCU1 }, NULL},\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1585-\t[RTW89_FW_ELEMENT_ID_TXPWR_BYRATE] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1586:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1587-\t\t{ .offset = offsetof(struct rtw89_rfe_data, byrate.conf) }, \"TXPWR\",\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1589-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_2GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1590:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1591-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_2ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1593-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_5GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1594:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1595-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_5ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1597-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_6GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1598:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1599-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_6ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1601-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_2GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1602:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1603-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_2ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1605-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_5GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1606:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1607-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_5ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1609-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_6GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1610:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1611-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_6ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1613-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_2GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1614:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1615-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_ru_2ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1617-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_5GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1618:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1619-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_ru_5ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1621-\t[RTW89_FW_ELEMENT_ID_TXPWR_LMT_RU_6GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1622:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1623-\t\t{ .offset = offsetof(struct rtw89_rfe_data, lmt_ru_6ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1625-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_RU_2GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1626:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1627-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_ru_2ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1629-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_RU_5GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1630:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1631-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_ru_5ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1633-\t[RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_RU_6GHZ] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1634:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1635-\t\t{ .offset = offsetof(struct rtw89_rfe_data, da_lmt_ru_6ghz.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1637-\t[RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1638:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1639-\t\t{ .offset = offsetof(struct rtw89_rfe_data, tx_shape_lmt.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1641-\t[RTW89_FW_ELEMENT_ID_TX_SHAPE_LMT_RU] = {\ndrivers/net/wireless/realtek/rtw89/fw.c:1642:\t\trtw89_fw_recognize_txpwr_from_elm,\ndrivers/net/wireless/realtek/rtw89/fw.c-1643-\t\t{ .offset = offsetof(struct rtw89_rfe_data, tx_shape_lmt_ru.conf) }, NULL,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1664-\ndrivers/net/wireless/realtek/rtw89/fw.c:1665:static int __rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/fw.c-1666-\t\t\t\t\t const struct firmware *firmware,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1714=static int rtw89_board_elm_seek(const struct firmware *board_elm,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1754-\ndrivers/net/wireless/realtek/rtw89/fw.c:1755:int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/fw.c-1756-{\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1780-\ndrivers/net/wireless/realtek/rtw89/fw.c:1781:\t\tret = __rtw89_fw_recognize_elements(rtwdev, \u0026pseudo_fw, 0, 0,\ndrivers/net/wireless/realtek/rtw89/fw.c-1782-\t\t\t\t\t\t \u0026unrecognized_elements);\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1797-\ndrivers/net/wireless/realtek/rtw89/fw.c:1798:\tret = __rtw89_fw_recognize_elements(rtwdev, firmware, offset,\ndrivers/net/wireless/realtek/rtw89/fw.c-1799-\t\t\t\t\t skipped_elements,\n--\ndrivers/net/wireless/realtek/rtw89/fw.h=5466=int rtw89_fw_check_rdy(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type);\ndrivers/net/wireless/realtek/rtw89/fw.h:5467:int rtw89_fw_recognize(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/fw.h:5468:int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/fw.h-5469-const struct firmware *\n"
} |
| 35/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 47110 output: 46 thoughts: 176 Thoughts: **Analyzing the Firmware Recognition Process** Okay, so I'm looking at `rtw89_chip_info_setup` and my mind immediately goes to the firmware. The code calls `rtw89_fw_recognize`, and if that fails, we get an error. But wait a minute... in a typical fuzzing setup, like syzkaller with a clean QEMU image, the firmware files might *not* be present. That's a critical edge case! I need to understand what `rtw89_fw_recognize` does, especially when there's no firmware to be found on the filesystem. Let me jump into `fw.c` and check lines 1160-1180 to see how the system handles the absence of the firmware. That's where the real logic of what happens when the firmware is *not* present is going to be! |
| 36/2 | 2026/10/23 00:22 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 1155,
"LineCount": 35
}Results: {
"Contents": "1155:\t\tconst struct rtw89_fw_def *fw_def = rtw89_chip_get_fw_def(rtwdev);\n1156:\t\tconst struct rtw89_chip_info *chip = rtwdev-\u003echip;\n1157:\t\tconst struct rtw89_hal *hal = \u0026rtwdev-\u003ehal;\n1158:\t\tenum rtw89_fw_type normal_fw_type = RTW89_FW_NORMAL;\n1159:\t\tenum rtw89_fw_type wowlan_fw_type = RTW89_FW_WOWLAN;\n1160:\t\tint ret;\n1161:\t\n1162:\t\tif (fw_def-\u003efw_b_aid \u0026\u0026 fw_def-\u003efw_b_aid == hal-\u003eaid) {\n1163:\t\t\tnormal_fw_type = RTW89_FW_NORMAL_B;\n1164:\t\t\twowlan_fw_type = RTW89_FW_WOWLAN_B;\n1165:\t\t}\n1166:\t\n1167:\t\tif (chip-\u003etry_ce_fw) {\n1168:\t\t\tret = __rtw89_fw_recognize(rtwdev, RTW89_FW_NORMAL_CE, true);\n1169:\t\t\tif (!ret)\n1170:\t\t\t\tgoto normal_done;\n1171:\t\t}\n1172:\t\n1173:\t\tret = __rtw89_fw_recognize(rtwdev, normal_fw_type, false);\n1174:\t\tif (ret)\n1175:\t\t\treturn ret;\n1176:\t\n1177:\tnormal_done:\n1178:\t\tret = rtw89_fw_validate_ver_required(rtwdev);\n1179:\t\tif (ret)\n1180:\t\t\treturn ret;\n1181:\t\n1182:\t\t/* It still works if wowlan firmware isn't existing. */\n1183:\t\t__rtw89_fw_recognize(rtwdev, wowlan_fw_type, false);\n1184:\t\n1185:\t\t/* It still works if log format file isn't existing. */\n1186:\t\t__rtw89_fw_recognize(rtwdev, RTW89_FW_LOGFMT, true);\n1187:\t\n1188:\t\trtw89_fw_recognize_features(rtwdev);\n1189:\t\n"
} |
| 37/2 | 2026/10/23 00:22 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 48178 output: 46 thoughts: 1977 Thoughts: **Fuzzing Feasibility of Realtek rtw89 USB Driver in syzkaller** Okay, so I'm diving into whether this Realtek rtw89 driver is worth fuzzing with syzkaller. First, the initial concern: the syzkaller root filesystem *doesn't* contain the firmware blobs for `rtw89`. However, the important question is whether syzkaller tests the USB drivers, even if firmware loading fails. It focuses on the `probe` function, specifically, how the driver initializes. If `rtw89_fw_recognize` fails during probe, `rtw89_chip_info_setup` also fails and probe aborts. I need to know: Does `rtw89_usb_probe` actually *call* any of the functions modified by the patch? Let's look at the patch itself to see exactly what code is modified. Okay, the patch touches a fair number of files: `chan.h`, `core.c`, `core.h`, `debug.c`, `fw.c`, `fw.h`, `mac.c`, `mac.h`, `mac80211.c`, `pci.c`, `ps.h`, `regd.c`, and `ser.c`. This suggests a widespread change affecting several driver components. The changes center around a `REGD_LEARN` functionality (likely related to regulatory domain learning/configuration). `RTW89` hardware is Realtek 802.11ax wireless chips, both PCIe and USB. Now, to determine if this is worth fuzzing, I need to consult the criteria. The negative criteria specify that if code is non-kernel, structurally unreachable (like vendor-specific PCIe), or unreachable during tear-down, it isn't worth fuzzing. The positive criteria, however, are promising. It specifically mentions drivers accessible via virtual buses, like USB. Now, I recall that syzkaller *does* use USB gadget and `raw-gadget` to fuzz USB drivers. It leverages `syz_usb_connect` and `syz_usb_control_io` syscalls. The question is can I actually connect a USB device with IDs that correspond to the Realtek 8852AU / 8852CU / 8851BU etc.? The answer is YES! Syzkaller is capable of probing USB drivers using arbitrary vendor/product IDs. The ultimate question: Can `rtw89_usb_probe` successfully probe and reach functions such as `rtw89_ops_start` or `rtw89_regd_learn_*`? To answer this, let me examine the functionality of `rtw89_usb_switch_mode_ax`. |
| 38/2 | 2026/10/23 00:23 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/usb.c",
"FirstLine": 1080,
"LineCount": 40
}Results: {
"Contents": "1080:\t\n1081:\tstatic int rtw89_usb_switch_mode_ax(struct rtw89_dev *rtwdev)\n1082:\t{\n1083:\t\tu32 pad_ctrl2;\n1084:\t\n1085:\t\t/* No known USB 3 devices with this chip. */\n1086:\t\tif (rtwdev-\u003echip-\u003echip_id == RTL8851B)\n1087:\t\t\treturn 0;\n1088:\t\n1089:\t\tpad_ctrl2 = rtw89_usb_ops_read32(rtwdev, R_AX_PAD_CTRL2);\n1090:\t\n1091:\t\trtw89_debug(rtwdev, RTW89_DBG_HCI, \"%s: pad_ctrl2: %#x\\n\",\n1092:\t\t\t __func__, pad_ctrl2);\n1093:\t\n1094:\t\t/* Already tried to switch but it's a USB 2 port. */\n1095:\t\tif (u32_get_bits(pad_ctrl2, B_AX_MATCH_CNT) == USB_SWITCH_DELAY)\n1096:\t\t\treturn 0;\n1097:\t\n1098:\t\t/* Add delay to prevent some platforms would not detect USB switch */\n1099:\t\tu32p_replace_bits(\u0026pad_ctrl2, USB_SWITCH_DELAY, B_AX_MATCH_CNT);\n1100:\t\n1101:\t\tpad_ctrl2 \u0026= ~(B_AX_FORCE_U3_CK | B_AX_USB2_FORCE |\n1102:\t\t\t B_AX_USB3_FORCE | B_AX_USB3_USB2_TRANSITION);\n1103:\t\n1104:\t\tu32p_replace_bits(\u0026pad_ctrl2, USB_MODE_U3, B_AX_USB23_SW_MODE_V1);\n1105:\t\n1106:\t\tpad_ctrl2 |= B_AX_NO_PDN_CHIPOFF_V1 | B_AX_RSM_EN_V1;\n1107:\t\n1108:\t\trtw89_usb_write32_quiet(rtwdev, R_AX_PAD_CTRL2, pad_ctrl2);\n1109:\t\n1110:\t\treturn 1;\n1111:\t}\n1112:\t\n1113:\tstatic int rtw89_usb_switch_mode_be(struct rtw89_dev *rtwdev)\n1114:\t{\n1115:\t\tu32 pad_ctrl2;\n1116:\t\n1117:\t\tpad_ctrl2 = rtw89_usb_ops_read32(rtwdev, R_BE_PAD_CTRL2);\n1118:\t\n1119:\t\trtw89_debug(rtwdev, RTW89_DBG_HCI, \"%s: pad_ctrl2: %#x\\n\",\n"
} |
| 39/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 51585 output: 45 thoughts: 378 Thoughts: **Analyzing the RTW89 USB Initialization Flow** Okay, let's break down this initialization sequence for the RTW89 USB driver. I'm focusing on how the system handles the USB mode switching and firmware recognition. First, I see that the `rtw89_usb_switch_mode` function is called. Its return value seems crucial. If it returns non-zero – which, on USB 2, appears to happen unless some `pad_ctrl2` condition is met and the match count is `USB_SWITCH_DELAY`– it jumps directly to `err_intf_deinit`, bypassing core registration. It seems that this jump is only avoided if the speed is `USB_SPEED_SUPER`, or the `pad_ctrl2` match cnt is reached. If we *don't* take that jump, and the USB mode switch succeeds (or, at least, doesn't immediately fail), the code proceeds to initialize the core with `rtw89_core_init`. From there, the flow goes into `rtw89_chip_info_setup`. Within `rtw89_chip_info_setup`, the code attempts to recognize the firmware using `rtw89_fw_recognize`. This is where the core functionality gets set up. Now, `rtw89_fw_recognize` calls `__rtw89_fw_recognize`, and *this* is the real point of interest. I need to dig into this function to understand how the firmware identification is performed. This is likely where the driver determines the specific firmware image to load and how it interacts with the hardware. I need to understand how the driver handles the firmware type, and any retries that might happen. |
| 40/2 | 2026/10/23 00:23 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 855,
"LineCount": 40
}Results: {
"Contents": " 855:\t}\n 856:\t\n 857:\tstatic\n 858:\tint __rtw89_fw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\n 859:\t\t\t\t bool nowarn)\n 860:\t{\n 861:\t\tstruct rtw89_fw_suit *fw_suit = rtw89_fw_suit_get(rtwdev, type);\n 862:\t\tint ret;\n 863:\t\n 864:\t\tret = rtw89_mfw_recognize(rtwdev, type, fw_suit, nowarn);\n 865:\t\tif (ret)\n 866:\t\t\treturn ret;\n 867:\t\n 868:\t\treturn rtw89_fw_update_ver(rtwdev, type, fw_suit);\n 869:\t}\n 870:\t\n 871:\tstatic\n 872:\tint __rtw89_fw_recognize_from_elm(struct rtw89_dev *rtwdev,\n 873:\t\t\t\t\t const struct rtw89_fw_element_hdr *elm,\n 874:\t\t\t\t\t const union rtw89_fw_element_arg arg)\n 875:\t{\n 876:\t\tenum rtw89_fw_type type = arg.fw_type;\n 877:\t\tstruct rtw89_hal *hal = \u0026rtwdev-\u003ehal;\n 878:\t\tstruct rtw89_fw_suit *fw_suit;\n 879:\t\n 880:\t\t/* Version of BB MCU is in decreasing order in firmware file, so take\n 881:\t\t * first equal or less version, which is equal or less but closest version.\n 882:\t\t */\n 883:\t\tif (hal-\u003ecv \u003c elm-\u003eu.bbmcu.cv)\n 884:\t\t\treturn 1; /* ignore this element */\n 885:\t\n 886:\t\tfw_suit = rtw89_fw_suit_get(rtwdev, type);\n 887:\t\tif (fw_suit-\u003edata)\n 888:\t\t\treturn 1; /* ignore this element (a firmware is taken already) */\n 889:\t\n 890:\t\tfw_suit-\u003esize = le32_to_cpu(elm-\u003esize);\n 891:\t\tfw_suit-\u003edata =\n 892:\t\t\trtw89_fw_suit_data_dup_if_needed(rtwdev, fw_suit, elm-\u003eu.bbmcu.contents);\n 893:\t\n 894:\t\treturn rtw89_fw_update_ver(rtwdev, type, fw_suit);\n"
} |
| 41/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 53097 output: 45 thoughts: 19 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving into `rtw89_mfw_recognize`** Alright, let's get down to brass tacks. I need to understand what this `rtw89_mfw_recognize` function actually *does*. I'm immediately interested in its purpose within the broader framework. Is it involved in driver initialization, packet handling, or perhaps some kind of firmware interaction? Based on the naming convention, I suspect it's related to recognizing or identifying something, likely within the context of the RTL89 series MediaTek WiFi driver. My initial hypothesis is that it could be related to regulatory domain detection, antenna configuration, or maybe even hardware features like beamforming. I need to go deeper to confirm that, or it could be something totally different! Time to start tracing its calls and looking at its arguments. Let's see what we can find. |
| 42/2 | 2026/10/23 00:23 | tool | grepper |
0mArgs:{
"Expression": "rtw89_mfw_recognize",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/fw.c=685=static\ndrivers/net/wireless/realtek/rtw89/fw.c:686:int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\ndrivers/net/wireless/realtek/rtw89/fw.c-687-\t\t\tstruct rtw89_fw_suit *fw_suit, bool nowarn)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=858=int __rtw89_fw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-863-\ndrivers/net/wireless/realtek/rtw89/fw.c:864:\tret = rtw89_mfw_recognize(rtwdev, type, fw_suit, nowarn);\ndrivers/net/wireless/realtek/rtw89/fw.c-865-\tif (ret)\n"
} |
| 43/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 53669 output: 45 thoughts: 16 Thoughts: Okay, here's my interpretation of what's going on, summarized from the hypothetical thought process, presented as you requested: **Deconstructing `rtw89_mfw_recognize`** Alright, let's dive into this `rtw89_mfw_recognize` function or module. Based on the naming convention, my initial instinct is that this is likely related to wireless networking, specifically using the Realtek RTL89 chipset, and probably involves some sort of media framework (mfw) aspect, potentially for recognizing or interpreting wireless signals. My expert knowledge immediately keys me to things like the signal processing flow, the protocol parsing, and likely some sort of hardware abstraction layer (HAL) considerations. The "recognize" part strongly suggests it's a critical component involved in the initial connection or discovery phase - maybe detecting available networks, identifying beacon frames, or parsing the associated information elements. I'll need to look closely at the data structures it operates on. My expertise will immediately bring up concerns such as signal strength, quality, and any potential security challenges. This is my working hypothesis; now it's time to dig in and validate it! |
| 44/2 | 2026/10/23 00:23 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 685,
"LineCount": 40
}Results: {
"Contents": " 685:\tstatic\n 686:\tint rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\n 687:\t\t\t\tstruct rtw89_fw_suit *fw_suit, bool nowarn)\n 688:\t{\n 689:\t\tstruct rtw89_fw_info *fw_info = \u0026rtwdev-\u003efw;\n 690:\t\tconst struct firmware *firmware = fw_info-\u003ereq.firmware;\n 691:\t\tconst struct rtw89_mfw_info *mfw_info = NULL, *tmp;\n 692:\t\tconst struct rtw89_mfw_hdr *mfw_hdr;\n 693:\t\tconst u8 *mfw = firmware-\u003edata;\n 694:\t\tu32 mfw_len = firmware-\u003esize;\n 695:\t\tconst u8 *mfw_info_ptr;\n 696:\t\tu32 mfw_info_size;\n 697:\t\tint ret;\n 698:\t\tint i;\n 699:\t\n 700:\t\tmfw_hdr = rtw89_mfw_get_hdr_ptr(rtwdev, firmware);\n 701:\t\tif (!mfw_hdr) {\n 702:\t\t\trtw89_debug(rtwdev, RTW89_DBG_FW, \"use legacy firmware\\n\");\n 703:\t\t\t/* legacy firmware support normal type only */\n 704:\t\t\tif (type != RTW89_FW_NORMAL)\n 705:\t\t\t\treturn -EINVAL;\n 706:\t\t\tfw_suit-\u003esize = mfw_len;\n 707:\t\t\tfw_suit-\u003edata = rtw89_fw_suit_data_dup_if_needed(rtwdev, fw_suit, mfw);\n 708:\t\t\treturn 0;\n 709:\t\t}\n 710:\t\n 711:\t\tret = rtw89_mfw_validate_hdr(rtwdev, firmware, mfw_hdr);\n 712:\t\tif (ret)\n 713:\t\t\treturn ret;\n 714:\t\n 715:\t\tfor (i = 0; i \u003c mfw_hdr-\u003efw_nr; i++) {\n 716:\t\t\ttmp = \u0026mfw_hdr-\u003einfo[i];\n 717:\t\t\tif (tmp-\u003etype != type)\n 718:\t\t\t\tcontinue;\n 719:\t\n 720:\t\t\tif (type == RTW89_FW_LOGFMT) {\n 721:\t\t\t\tmfw_info = tmp;\n 722:\t\t\t\tgoto found;\n 723:\t\t\t}\n 724:\t\n"
} |
| 45/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54685 output: 43 thoughts: 1873 Thoughts: **Analyzing a Potential NULL Pointer Dereference in the RTW89 Driver** Okay, let's break this down. My immediate concern is a potential NULL pointer dereference within the RTW89 driver, specifically around lines 690-693. If `firmware` is NULL, accessing `firmware->data` in `rtw89_mfw_recognize` will cause a crash. The root cause appears to be the `rtw89_early_fw_feature_recognize` function returning NULL, which then results in a NULL `rtwdev->fw.req.firmware`. Now, does syzkaller even have the firmware files needed for these tests? The QEMU images used by syzkaller usually lack Realtek firmware. But, has firmware been mocked or loaded in any other way? Likely not, if syzkaller is consistent in its setup. I need to re-read the documentation, particularly sections 1, 2, and 3, to be sure I haven't missed anything, as they touch on reachability. Section 2 mentions "structurally unreachable hardware," singling out PCIe devices. Section 3 outlines "reachable drivers," which include those using virtual buses like virtio and USB. Is RTW89 reachable through a USB path, or is it structurally unreachable, like the PCIe devices that require physical hardware? This is key. Looking at the examples in Section 2, the "structurally unreachable" devices are all PCIe devices, like PCIe switches or SmartNICs. In the Linux kernel, a similar situation exists. But wireless drivers such as RTW89, RTW88, etc., have USB support, and syzkaller has found numerous bugs in USB Wi-Fi drivers. Syzkaller leverages `syz_usb_connect` to fuzz USB Wi-Fi drivers. Can I trigger this condition via a USB gadget setup? To answer this conclusively, I have to determine if `RTW89_USB` is enabled in syzkaller's typical configurations. More importantly, does this patched code ever get executed *without* the hardware or firmware? The patch modifies code related to `rtw89_regd_learn_init`. This function checks for `REGD_LEARN` firmware features. According to `fw.c`, only `RTL8852C` and `RTL8922D` chips have this. Based on Kconfig, `RTL8922D` is PCI, which is a potential issue, as it is a PCIe adapter. However, the RTL8852C can be USB, so I might have a path there. What does "REGD_LEARN" actually mean? Regulatory Domain Learning. When the Wi-Fi card "learns" its regulatory domain by analyzing received beacons, the firmware determines the country code and sends this to the host. Now, is it possible to reach the `REGD_LEARN` path through mac80211 or cfg80211 operations? Let's trace calls to functions changed by this patch. `rtw89_regd_learn_init` is called from `rtw89_ops_start` and `rtw89_ops_unassign_vif_chanctx` within `mac80211.c`. `rtw89_ops_start` is the mac80211 driver's start operation. It gets called when an interface is brought up. For `rtw89_ops_start` to be called, the netdev and wiphy must be present. So, the function `rtw89_core_register` must be invoked. Now, where is `rtw89_core_register` called? That's what I need to find out to determine a code path. |
| 46/2 | 2026/10/23 00:23 | tool | grepper |
0mArgs:{
"Expression": "rtw89_core_register",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=7454=void rtw89_chip_cfg_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7474-\ndrivers/net/wireless/realtek/rtw89/core.c:7475:static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/core.c-7476-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c=7618=static void rtw89_core_unregister_hw(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7626-\ndrivers/net/wireless/realtek/rtw89/core.c:7627:int rtw89_core_register(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/core.c-7628-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7630-\ndrivers/net/wireless/realtek/rtw89/core.c:7631:\tret = rtw89_core_register_hw(rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.c-7632-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7641-}\ndrivers/net/wireless/realtek/rtw89/core.c:7642:EXPORT_SYMBOL(rtw89_core_register);\ndrivers/net/wireless/realtek/rtw89/core.c-7643-\n--\ndrivers/net/wireless/realtek/rtw89/core.h=9509=void rtw89_core_deinit(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.h:9510:int rtw89_core_register(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.h-9511-void rtw89_core_unregister(struct rtw89_dev *rtwdev);\n--\ndrivers/net/wireless/realtek/rtw89/pci.c=4813=int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/net/wireless/realtek/rtw89/pci.c-4881-\ndrivers/net/wireless/realtek/rtw89/pci.c:4882:\tret = rtw89_core_register(rtwdev);\ndrivers/net/wireless/realtek/rtw89/pci.c-4883-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/usb.c=1208=int rtw89_usb_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1245-\tif (ret) {\ndrivers/net/wireless/realtek/rtw89/usb.c:1246:\t\t/* Not a fail, but we do need to skip rtw89_core_register. */\ndrivers/net/wireless/realtek/rtw89/usb.c-1247-\t\tret = 0;\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1277-\ndrivers/net/wireless/realtek/rtw89/usb.c:1278:\tret = rtw89_core_register(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c-1279-\tif (ret) {\n"
} |
| 47/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 58475 output: 36 thoughts: 1441 Thoughts: **Analyzing the `rtw89` Driver Initialization in a USB Emulation Context** Okay, so I'm digging into the `rtw89` driver, specifically its initialization sequence and the potential for triggering specific code paths in a USB emulation environment like syzkaller or Raw Gadget. The core of my interest lies in how `rtw89_core_register` is called, and under what conditions. It's clear that it's called during both PCI and USB probe functions (`rtw89_pci_probe` and `rtw89_usb_probe`), so I'm focusing on the USB side, as PCI likely necessitates actual hardware, and I want to see if this can be emulated. My initial thought is to confirm whether the PCI probe can succeed without actual hardware; the answer is a resounding no, which eliminates a whole avenue of attack here. However, USB emulation is my target. I'm focusing on whether syzkaller/Raw Gadget can emulate the USB portion successfully. I'm now examining the `rtw89_usb_probe` function itself. I see the allocation and initialization of the `rtw89_usb` structure. I specifically noted the call to `rtw89_usb_switch_mode`. This call seems interesting, so I investigate it further. Looking at `rtw89_usb_switch_mode_ax`, I see a check based on the `rtwdev->chip->chip_id`. This device ID is intriguing because it's the gate keeper. If the device ID is RTL8851B, it returns zero. However, RTL8851B doesn't have REGD_LEARN! Now, the crucial question is: which USB device would syzkaller actually emulate? I'm assuming that it may emulate a Realtek RTL8852CU, or RTL8852AU, or RTL8851BU, and this matters for which code paths are executed. I'm aware that only RTL8852C and RTL8922D have the `REGD_LEARN` feature enabled. But I remember that RTL8922D is PCI-ONLY, so that only leaves RTL8852C, specifically RTL8852CU, as the only plausible USB chip that *could* have this. Now, I'm specifically looking for any method in which the REGD_LEARN function can be triggered. I'm now examining `rtw89_regd_learn_init`. Within this function, I see the condition: `RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw)`. This is the key. It looks like it depends on the firmware features to be initialized. How is this feature flag ever set? I'm going to grep for instances where `rtwdev->fw.features` are used to find all instances where `RTW89_FW_FEATURE_REGD_LEARN` is set! |
| 48/2 | 2026/10/23 00:23 | tool | grepper |
0mArgs:{
"Expression": "features",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/Kconfig=149=config RTW89_8922AE\n--\ndrivers/net/wireless/realtek/rtw89/Kconfig-160-\ndrivers/net/wireless/realtek/rtw89/Kconfig:161:\t The variant 8922AE-VS has the same features except 1024-QAM.\ndrivers/net/wireless/realtek/rtw89/Kconfig-162-\n--\ndrivers/net/wireless/realtek/rtw89/core.c=7475=static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7559-\ndrivers/net/wireless/realtek/rtw89/core.c:7560:\thw-\u003ewiphy-\u003efeatures |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;\ndrivers/net/wireless/realtek/rtw89/core.c-7561-\n--\ndrivers/net/wireless/realtek/rtw89/core.h=1030=enum rtw89_rfsi_ctrl_band {\n--\ndrivers/net/wireless/realtek/rtw89/core.h-1036-\ndrivers/net/wireless/realtek/rtw89/core.h:1037:/* only mgd features can be added to the enum */\ndrivers/net/wireless/realtek/rtw89/core.h-1038-enum rtw89_wow_flags {\n--\ndrivers/net/wireless/realtek/rtw89/core.h=6060=enum rtw89_fw_type {\n--\ndrivers/net/wireless/realtek/rtw89/core.h-6070-\ndrivers/net/wireless/realtek/rtw89/core.h:6071:#define RTW89_FW_FEATURE_GROUP(_grp, _features...) \\\ndrivers/net/wireless/realtek/rtw89/core.h-6072-\tRTW89_FW_FEATURE_##_grp##_MIN, \\\ndrivers/net/wireless/realtek/rtw89/core.h-6073-\t__RTW89_FW_FEATURE_##_grp##_S = RTW89_FW_FEATURE_##_grp##_MIN - 1, \\\ndrivers/net/wireless/realtek/rtw89/core.h:6074:\t_features \\\ndrivers/net/wireless/realtek/rtw89/core.h-6075-\t__RTW89_FW_FEATURE_##_grp##_E, \\\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1053=static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1077-\ndrivers/net/wireless/realtek/rtw89/fw.c:1078:static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/fw.c-1079-{\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=1153=int rtw89_fw_recognize(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-1187-\ndrivers/net/wireless/realtek/rtw89/fw.c:1188:\trtw89_fw_recognize_features(rtwdev);\ndrivers/net/wireless/realtek/rtw89/fw.c-1189-\n--\ndrivers/net/wireless/realtek/rtw89/wow.c=860=static void rtw89_wow_vif_iter(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/wow.c-874-\tcase RTW89_NET_TYPE_INFRA:\ndrivers/net/wireless/realtek/rtw89/wow.c:875:\t\tif (rtw_wow_has_mgd_features(rtwdev))\ndrivers/net/wireless/realtek/rtw89/wow.c-876-\t\t\trtw_wow-\u003ertwvif_link = rtwvif_link;\n--\ndrivers/net/wireless/realtek/rtw89/wow.h=105=static inline bool rtw89_wow_no_link(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/wow.h-111-\ndrivers/net/wireless/realtek/rtw89/wow.h:112:static inline bool rtw_wow_has_mgd_features(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/wow.h-113-{\n"
} |
| 49/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 61925 output: 46 thoughts: 24 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Diving into the `rtw89_fw_iterate_feature_cfg` Function** Alright, let's get down to brass tacks. I'm going to take a look at the `rtw89_fw_iterate_feature_cfg` function. This likely lives within the `fw.c` file, if the naming convention is consistent with other Realtek drivers I've worked with. The name itself suggests a function central to iterating through the configuration settings for various features within the firmware. My immediate assumption is this is where the core logic resides for how the device firmware is initialized and configured after being loaded, or perhaps in response to particular changes in the system's runtime state. This sounds like an area where I can learn more about how to set up more complex features of the driver. I expect to find within this function: conditionals dealing with different hardware revisions, feature flags, or perhaps even platform-specific quirks, such as interrupt handling or power management. I'll be looking closely at any data structures being used to represent the feature configuration, and how they're passed, processed, and updated. I'll be watching to see if there is any indication of a 'configuration tree' or a hierarchical approach to setting up the options. I'll need to understand how the firmware is told what to run, when. It's also possible that there are callback mechanisms being used. I'm expecting this function, if it's well-designed, to be reasonably modular, allowing for different features to be enabled or disabled, or have their parameters altered, without necessitating large changes to the core code. |
| 50/2 | 2026/10/23 00:23 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 1050,
"LineCount": 35
}Results: {
"Contents": "1050:\t\t__CFG_FW_FEAT(RTL8922D, lt, 0, 35, 119, 3, NO_DRV_BT_TXRX_EN),\n1051:\t};\n1052:\t\n1053:\tstatic void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,\n1054:\t\t\t\t\t\t const struct rtw89_chip_info *chip,\n1055:\t\t\t\t\t\t u32 ver_code)\n1056:\t{\n1057:\t\tint i;\n1058:\t\n1059:\t\tfor (i = 0; i \u003c ARRAY_SIZE(fw_feat_tbl); i++) {\n1060:\t\t\tconst struct __fw_feat_cfg *ent = \u0026fw_feat_tbl[i];\n1061:\t\n1062:\t\t\tif (chip-\u003echip_id != ent-\u003echip_id)\n1063:\t\t\t\tcontinue;\n1064:\t\n1065:\t\t\tif (!ent-\u003econd(ver_code, ent-\u003ever_code))\n1066:\t\t\t\tcontinue;\n1067:\t\n1068:\t\t\tif (!ent-\u003edisable) {\n1069:\t\t\t\tRTW89_SET_FW_FEATURE(ent-\u003efeature, fw);\n1070:\t\t\t\tcontinue;\n1071:\t\t\t}\n1072:\t\n1073:\t\t\tfor (int n = 0; n \u003c ent-\u003esize; n++)\n1074:\t\t\t\tRTW89_CLR_FW_FEATURE(ent-\u003efeature + n, fw);\n1075:\t\t}\n1076:\t}\n1077:\t\n1078:\tstatic void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)\n1079:\t{\n1080:\t\tconst struct rtw89_chip_info *chip = rtwdev-\u003echip;\n1081:\t\tconst struct rtw89_fw_suit *fw_suit;\n1082:\t\tu32 suit_ver_code;\n1083:\t\n1084:\t\tfw_suit = rtw89_fw_suit_get(rtwdev, RTW89_FW_NORMAL);\n"
} |
| 51/2 | 2026/10/23 00:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 62954 output: 22 thoughts: 974 Thoughts: **Analyzing the Regulatory Domain Learning in the rtw89 Driver** Okay, let's break this down. My initial thought process is centered around how the regulatory domain learning functionality within the `rtw89` driver operates. I'm starting with the assumption that `fw_feat_tbl` is iterated based on `ver_code` from the firmware image, which seems reasonable given the context. My primary focus is on the `rtw89_regd_learn` structure and its associated functions, specifically `rtw89_regd_learn_init`, `rtw89_regd_learn_queue`, `rtw89_regd_learn_cancel`, and `rtw89_regd_learn_deinit`. From a quick glance at `rtw89_regd_learn_init`, I see `regd_learn->can_activate` is crucial. It's only set if `!regulatory->programmed` AND `RTW89_CHK_FW_FEATURE(REGD_LEARN, &rtwdev->fw)` is true. That firmware feature check is a likely blocker, particularly since it seems to be false in the absence of a properly loaded firmware. The other functions I examined, such as `rtw89_regd_learn_queue`, `rtw89_regd_learn_cancel`, and `rtw89_regd_learn_deinit` all return early if `!regd_learn->can_activate`. However, the real puzzle lies in `rtw89_regd_notifier_apply`. This function seems to handle regulatory domain changes. It seems to call `rtw89_regd_learn_cancel` immediately, which looks like it would short-circuit the whole feature. However, it looks like there's a conditional path that can call `rtw89_regd_learn_update` *instead* of starting the learning process if `regd_learn->shall_run` is false. If it's true, it looks like it calls `rtw89_regd_learn_queue`, potentially starting the learning. My critical question is: under what conditions does `rtw89_regd_notifier_apply` actually *run*? It's triggered when `rtwdev` is registered! Now, a larger question is: Can `rtwdev` ever be registered in QEMU? This is the critical question. I need to figure out whether any `rtw89` device, even a mock or virtual one, can be registered in the QEMU environment. This determines whether this regulatory learning code is ever exercised! To this end, I need to check the entire kernel to see if there's any call to `rtw89_core_register` in the context of QEMU. |
| 52/2 | 2026/10/23 00:24 | tool | grepper |
0mArgs:{
"Expression": "rtw89_core_register"
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=7454=void rtw89_chip_cfg_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7474-\ndrivers/net/wireless/realtek/rtw89/core.c:7475:static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/core.c-7476-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c=7618=static void rtw89_core_unregister_hw(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7626-\ndrivers/net/wireless/realtek/rtw89/core.c:7627:int rtw89_core_register(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/core.c-7628-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7630-\ndrivers/net/wireless/realtek/rtw89/core.c:7631:\tret = rtw89_core_register_hw(rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.c-7632-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7641-}\ndrivers/net/wireless/realtek/rtw89/core.c:7642:EXPORT_SYMBOL(rtw89_core_register);\ndrivers/net/wireless/realtek/rtw89/core.c-7643-\n--\ndrivers/net/wireless/realtek/rtw89/core.h=9509=void rtw89_core_deinit(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.h:9510:int rtw89_core_register(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/core.h-9511-void rtw89_core_unregister(struct rtw89_dev *rtwdev);\n--\ndrivers/net/wireless/realtek/rtw89/pci.c=4813=int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n--\ndrivers/net/wireless/realtek/rtw89/pci.c-4881-\ndrivers/net/wireless/realtek/rtw89/pci.c:4882:\tret = rtw89_core_register(rtwdev);\ndrivers/net/wireless/realtek/rtw89/pci.c-4883-\tif (ret) {\n--\ndrivers/net/wireless/realtek/rtw89/usb.c=1208=int rtw89_usb_probe(struct usb_interface *intf,\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1245-\tif (ret) {\ndrivers/net/wireless/realtek/rtw89/usb.c:1246:\t\t/* Not a fail, but we do need to skip rtw89_core_register. */\ndrivers/net/wireless/realtek/rtw89/usb.c-1247-\t\tret = 0;\n--\ndrivers/net/wireless/realtek/rtw89/usb.c-1277-\ndrivers/net/wireless/realtek/rtw89/usb.c:1278:\tret = rtw89_core_register(rtwdev);\ndrivers/net/wireless/realtek/rtw89/usb.c-1279-\tif (ret) {\n"
} |
| 53/2 | 2026/10/23 00:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 65610 output: 46 thoughts: 603 Thoughts: **My Analysis of rtw89 Device Emulation** Okay, so I'm looking at how we can emulate an rtw89 device, specifically for testing purposes. My initial thoughts are that the `rtw89_core_register` function is only called by the PCI and USB drivers. Since QEMU lacks specific rtw89 device emulation for PCI, that avenue is closed. So, USB emulation is the next obvious target. Can we leverage USB Raw Gadget or syzkaller for this? Let's consider what happens when a USB device with the `rtw8852cu` USB ID is connected. I'm focusing on tracing the `rtw89_usb_probe` function to understand the initialization process. Within `rtw89_usb_probe`, a crucial part of the process involves calling `rtw89_alloc_ieee80211_hw`, which then invokes `rtw89_early_fw_feature_recognize`. The latter function calls `request_firmware` to obtain the necessary firmware blob. Ah, here's where the problem lies. Since the syzkaller QEMU test environments typically lack the firmware blobs like `rtw89/rtw8852c_fw.bin`, `request_firmware` will fail with -ENOENT. This means that `rtw89_early_fw_feature_recognize` returns NULL, and consequently, the `firmware` pointer is set to NULL. This NULL value then gets assigned to `rtwdev->fw.req.firmware`. Following this, `rtw89_alloc_ieee80211_hw` returns the `rtwdev` structure, and the code proceeds to call `rtw89_usb_intf_init`. I'd need to inspect `rtw89_usb_intf_init` to see what further consequences this missing firmware has, but the lack of firmware during the initial probe is definitely a major hurdle for successful emulation. This missing firmware will most likely result in a failed initialization and potentially a crash. So, my next steps would be to examine the rest of the probe and initialization to see exactly where the failure occurs. |
| 54/2 | 2026/10/23 00:24 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/usb.c",
"FirstLine": 1047,
"LineCount": 30
}Results: {
"Contents": "1047:\tstatic int rtw89_usb_intf_init(struct rtw89_dev *rtwdev,\n1048:\t\t\t\t struct usb_interface *intf)\n1049:\t{\n1050:\t\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\n1051:\t\tint ret;\n1052:\t\n1053:\t\tinit_usb_anchor(\u0026rtwusb-\u003etx_submitted);\n1054:\t\n1055:\t\tret = rtw89_usb_parse(rtwdev, intf);\n1056:\t\tif (ret)\n1057:\t\t\treturn ret;\n1058:\t\n1059:\t\trtwusb-\u003evendor_req_buf = kmalloc_obj(*rtwusb-\u003evendor_req_buf);\n1060:\t\tif (!rtwusb-\u003evendor_req_buf)\n1061:\t\t\treturn -ENOMEM;\n1062:\t\n1063:\t\trtwusb-\u003eudev = interface_to_usbdev(intf);\n1064:\t\n1065:\t\tusb_set_intfdata(intf, rtwdev-\u003ehw);\n1066:\t\n1067:\t\tSET_IEEE80211_DEV(rtwdev-\u003ehw, \u0026intf-\u003edev);\n1068:\t\n1069:\t\treturn 0;\n1070:\t}\n1071:\t\n1072:\tstatic void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,\n1073:\t\t\t\t\t struct usb_interface *intf)\n1074:\t{\n1075:\t\tstruct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);\n1076:\t\n"
} |
| 55/2 | 2026/10/23 00:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 67231 output: 31 thoughts: 1102 Thoughts: **Analyzing a Potential NULL Pointer Dereference in rtw89_usb_probe** Okay, let's break this down. We're looking at the `rtw89_usb_probe` function within the rtw89 USB driver. It calls `rtw89_usb_switch_mode`, and that's the first interesting bit. The `rtw89_usb_switch_mode` function, specifically the `_ax` variant, seems to be a key area. It modifies some USB-related control registers, presumably to switch the device between USB 2.0 and USB 3.0 modes. The core check is `B_AX_MATCH_CNT`, if it equals `USB_SWITCH_DELAY` the function returns. If it doesn't, it returns 1. The critical path is that if `rtw89_usb_switch_mode` returns 1, `rtw89_usb_probe` jumps to `err_intf_deinit`, and returns 0 without further initialization. This means that if it *doesn't* return 1, that is to say the USB is detected correctly, then we proceed to `rtw89_core_init`, and then `rtw89_chip_info_setup`. Here's the problem. Within `rtw89_chip_info_setup` and down the call stack to `rtw89_fw_recognize`, then `rtw89_mfw_recognize` we have: ```c struct rtw89_fw_info *fw_info = &rtwdev->fw; const struct firmware *firmware = fw_info->req.firmware; const struct rtw89_mfw_info *mfw_info = NULL, *tmp; const struct rtw89_mfw_hdr *mfw_hdr; const u8 *mfw = firmware->data; ``` If `firmware` is NULL (i.e. `request_firmware` fails), attempting to access `firmware->data` will lead to a NULL pointer dereference, and a crash. So, the critical question is *when* can `firmware` be NULL? It seems that it can be when there is no firmware, and `request_firmware` fails to find one. Has this been hit by anyone, reported, or fixed? It looks like we're going to need to check `git log` and the bug tracker to determine if syzkaller has found this, or if it is a new find. |
| 56/2 | 2026/10/23 00:24 | tool | grepper |
0mArgs:{
"Expression": "rtw89.*crash|rtw89_mfw_recognize"
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/debug.c=70=struct rtw89_debugfs {\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-81-\tstruct rtw89_debugfs_priv early_h2c;\ndrivers/net/wireless/realtek/rtw89/debug.c:82:\tstruct rtw89_debugfs_priv fw_crash;\ndrivers/net/wireless/realtek/rtw89/debug.c-83-\tstruct rtw89_debugfs_priv ser_counters;\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=3762=static ssize_t\ndrivers/net/wireless/realtek/rtw89/debug.c:3763:rtw89_debug_priv_fw_crash_get(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/debug.c-3764-\t\t\t struct rtw89_debugfs_priv *debugfs_priv,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-3773-\ndrivers/net/wireless/realtek/rtw89/debug.c:3774:enum rtw89_dbg_crash_simulation_type {\ndrivers/net/wireless/realtek/rtw89/debug.c-3775-\tRTW89_DBG_SIM_CPU_EXCEPTION = 1,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=3780=static ssize_t\ndrivers/net/wireless/realtek/rtw89/debug.c:3781:rtw89_debug_priv_fw_crash_set(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/debug.c-3782-\t\t\t struct rtw89_debugfs_priv *debugfs_priv,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=5596=static const struct rtw89_debugfs rtw89_debugfs_templ = {\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-5607-\t.early_h2c = rtw89_debug_priv_set_and_get(early_h2c, RWLOCK),\ndrivers/net/wireless/realtek/rtw89/debug.c:5608:\t.fw_crash = rtw89_debug_priv_set_and_get(fw_crash, WLOCK),\ndrivers/net/wireless/realtek/rtw89/debug.c-5609-\t.ser_counters = rtw89_debug_priv_get(ser_counters, RLOCK),\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=5657=void rtw89_debugfs_add_sec1(struct rtw89_dev *rtwdev, struct dentry *debugfs_topdir)\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-5660-\trtw89_debugfs_add_rw(early_h2c);\ndrivers/net/wireless/realtek/rtw89/debug.c:5661:\trtw89_debugfs_add_rw(fw_crash);\ndrivers/net/wireless/realtek/rtw89/debug.c-5662-\trtw89_debugfs_add_r(ser_counters);\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=685=static\ndrivers/net/wireless/realtek/rtw89/fw.c:686:int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\ndrivers/net/wireless/realtek/rtw89/fw.c-687-\t\t\tstruct rtw89_fw_suit *fw_suit, bool nowarn)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=858=int __rtw89_fw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-863-\ndrivers/net/wireless/realtek/rtw89/fw.c:864:\tret = rtw89_mfw_recognize(rtwdev, type, fw_suit, nowarn);\ndrivers/net/wireless/realtek/rtw89/fw.c-865-\tif (ret)\n"
} |
| 57/2 | 2026/10/23 00:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 70128 output: 46 thoughts: 60 Thoughts: Okay, let's dive into this. I need to understand how the firmware loading and feature detection are handled in this `rtw89` driver. My initial instinct is to look at the crucial steps involved. **Digging into the `rtw89` Firmware Loading and Feature Detection** My thought process is: *First*, I need to pinpoint the relevant functions. Based on the names, `rtw89_load_firmware_req` and `rtw89_early_fw_feature_recognize` are clearly the place to start. I'll need to see how they're interconnected. *Now*, I'll want to get my hands dirty. I'm going to quickly get my bearings by zeroing in on the implementation. Let me check the code directly. Specifically, lines 2250 through 2280 in `fw.c` should give me a solid overview of the loading sequence and feature recognition logic. That should tell me the core steps involved. |
| 58/2 | 2026/10/23 00:24 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/fw.c",
"FirstLine": 2250,
"LineCount": 40
}Results: {
"Contents": "2250:\t\tif (!fw-\u003ereq.firmware)\n2251:\t\t\treturn -EINVAL;\n2252:\t\n2253:\t\treturn 0;\n2254:\t}\n2255:\t\n2256:\tstatic int rtw89_load_firmware_req(struct rtw89_dev *rtwdev,\n2257:\t\t\t\t\t struct rtw89_fw_req_info *req,\n2258:\t\t\t\t\t const char *fw_name, bool nowarn)\n2259:\t{\n2260:\t\tconst struct rtw89_board_variant *board = rtwdev-\u003eboard;\n2261:\t\tint ret = 0;\n2262:\t\n2263:\t\tif (req-\u003efirmware) {\n2264:\t\t\trtw89_debug(rtwdev, RTW89_DBG_FW,\n2265:\t\t\t\t \"full firmware has been early requested\\n\");\n2266:\t\t\tgoto out;\n2267:\t\t}\n2268:\t\n2269:\t\tif (nowarn)\n2270:\t\t\tret = firmware_request_nowarn(\u0026req-\u003efirmware, fw_name, rtwdev-\u003edev);\n2271:\t\telse\n2272:\t\t\tret = request_firmware(\u0026req-\u003efirmware, fw_name, rtwdev-\u003edev);\n2273:\t\n2274:\tout:\n2275:\t\tif (board \u0026\u0026 board-\u003eid)\n2276:\t\t\tfirmware_request_nowarn(\u0026req-\u003eboard_elm, RTW89_FWNAME_BOARD_ELM, rtwdev-\u003edev);\n2277:\t\n2278:\t\treq-\u003efree_after_probe = req-\u003efirmware \u0026\u0026 req-\u003efirmware-\u003esize \u003e 0x200000;\n2279:\t\tcomplete_all(\u0026req-\u003ecompletion);\n2280:\t\n2281:\t\treturn ret;\n2282:\t}\n2283:\t\n2284:\tvoid rtw89_load_firmware_work(struct work_struct *work)\n2285:\t{\n2286:\t\tstruct rtw89_dev *rtwdev =\n2287:\t\t\tcontainer_of(work, struct rtw89_dev, load_firmware_work);\n2288:\t\tconst struct rtw89_fw_def *fw_def = rtw89_chip_get_fw_def(rtwdev);\n2289:\t\tchar fw_name[64];\n"
} |
| 59/2 | 2026/10/23 00:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 71114 output: 41 thoughts: 58 Thoughts: Here's my analysis of the code snippet you've provided: **Code Dive: Firmware Loading Process** Okay, so I see `req->firmware` being accessed within `rtw89_load_firmware_req`. That's the key. That tells me this function is *definitely* involved in requesting or at least handling a firmware image. Now, the real question is, when does the loading actually happen? I need to trace this back. Alright, the next logical step is to see *how* and *when* this request is actually fulfilled. Where is the actual firmware loading performed? I need to find the scheduling or triggering mechanism. So, I need to hunt down `load_firmware_work`. I'll search for where this is called. I'm hoping it's a workqueue item, which is pretty standard in this kind of scenario. I'll bet *that's* the entry point to understanding the whole process. |
| 60/2 | 2026/10/23 00:24 | tool | grepper |
0mArgs:{
"Expression": "load_firmware_work",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=6973=int rtw89_core_init(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7025-\twiphy_work_init(\u0026rtwdev-\u003ecancel_6ghz_probe_work, rtw89_cancel_6ghz_probe_work);\ndrivers/net/wireless/realtek/rtw89/core.c:7026:\tINIT_WORK(\u0026rtwdev-\u003eload_firmware_work, rtw89_load_firmware_work);\ndrivers/net/wireless/realtek/rtw89/core.c-7027-\n--\ndrivers/net/wireless/realtek/rtw89/core.c-7054-\ndrivers/net/wireless/realtek/rtw89/core.c:7055:\tschedule_work(\u0026rtwdev-\u003eload_firmware_work);\ndrivers/net/wireless/realtek/rtw89/core.c-7056-\n--\ndrivers/net/wireless/realtek/rtw89/core.h=7690=struct rtw89_dev {\n--\ndrivers/net/wireless/realtek/rtw89/core.h-7746-\tstruct wiphy_work cancel_6ghz_probe_work;\ndrivers/net/wireless/realtek/rtw89/core.h:7747:\tstruct work_struct load_firmware_work;\ndrivers/net/wireless/realtek/rtw89/core.h-7748-\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=2256=static int rtw89_load_firmware_req(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-2283-\ndrivers/net/wireless/realtek/rtw89/fw.c:2284:void rtw89_load_firmware_work(struct work_struct *work)\ndrivers/net/wireless/realtek/rtw89/fw.c-2285-{\ndrivers/net/wireless/realtek/rtw89/fw.c-2286-\tstruct rtw89_dev *rtwdev =\ndrivers/net/wireless/realtek/rtw89/fw.c:2287:\t\tcontainer_of(work, struct rtw89_dev, load_firmware_work);\ndrivers/net/wireless/realtek/rtw89/fw.c-2288-\tconst struct rtw89_fw_def *fw_def = rtw89_chip_get_fw_def(rtwdev);\n--\ndrivers/net/wireless/realtek/rtw89/fw.c=2346=void rtw89_unload_firmware(struct rtw89_dev *rtwdev)\n--\ndrivers/net/wireless/realtek/rtw89/fw.c-2349-\ndrivers/net/wireless/realtek/rtw89/fw.c:2350:\tcancel_work_sync(\u0026rtwdev-\u003eload_firmware_work);\ndrivers/net/wireless/realtek/rtw89/fw.c-2351-\t__rtw89_unload_firmware(rtwdev);\n--\ndrivers/net/wireless/realtek/rtw89/fw.h=5475=int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,\ndrivers/net/wireless/realtek/rtw89/fw.h-5476-\t\t bool include_bb);\ndrivers/net/wireless/realtek/rtw89/fw.h:5477:void rtw89_load_firmware_work(struct work_struct *work);\ndrivers/net/wireless/realtek/rtw89/fw.h-5478-void __rtw89_unload_firmware(struct rtw89_dev *rtwdev);\n"
} |
| 61/2 | 2026/10/23 00:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 72467 output: 46 thoughts: 72 Thoughts: Here's my summary, as I delve into this code: **Diving into the rtw89 Initialization Sequence** Okay, so I'm digging into this `rtw89` driver initialization. The code's organized well enough. Hmm, let me see. That `rtw89_core_init` function is interesting. Ah, there it is! I see it schedules that `load_firmware_work` workqueue. That makes perfect sense; firmware loading is often deferred to a workqueue to avoid blocking initialization. Now, where does it go from there? Let me jump to `rtw89_chip_info_setup` and examine that function. I recall that's where the silicon-specific details get configured. Let's look in `core.c` around line 7393. Right. I'm starting to get a better sense of the overall flow. I'll need to trace what `load_firmware_work` does after this step, but this looks like a good starting point. |
| 62/2 | 2026/10/23 00:25 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/core.c",
"FirstLine": 7393,
"LineCount": 40
}Results: {
"Contents": "7393:\tint rtw89_chip_info_setup(struct rtw89_dev *rtwdev)\n7394:\t{\n7395:\t\tstruct rtw89_fw_req_info *fw_req = \u0026rtwdev-\u003efw.req;\n7396:\t\tstruct rtw89_efuse *efuse = \u0026rtwdev-\u003eefuse;\n7397:\t\tstruct rtw89_hal *hal = \u0026rtwdev-\u003ehal;\n7398:\t\tint ret;\n7399:\t\n7400:\t\trtw89_read_chip_ver(rtwdev);\n7401:\t\n7402:\t\tret = rtw89_mac_pwr_on(rtwdev);\n7403:\t\tif (ret) {\n7404:\t\t\trtw89_err(rtwdev, \"failed to power on\\n\");\n7405:\t\t\treturn ret;\n7406:\t\t}\n7407:\t\n7408:\t\tret = rtw89_wait_firmware_completion(rtwdev);\n7409:\t\tif (ret) {\n7410:\t\t\trtw89_err(rtwdev, \"failed to wait firmware completion\\n\");\n7411:\t\t\tgoto out;\n7412:\t\t}\n7413:\t\n7414:\t\tret = rtw89_fw_recognize(rtwdev);\n7415:\t\tif (ret) {\n7416:\t\t\trtw89_err(rtwdev, \"failed to recognize firmware\\n\");\n7417:\t\t\tgoto out;\n7418:\t\t}\n7419:\t\n7420:\t\tret = rtw89_chip_efuse_info_setup(rtwdev);\n7421:\t\tif (ret)\n7422:\t\t\tgoto out;\n7423:\t\n7424:\t\tret = rtw89_fw_recognize_elements(rtwdev);\n7425:\t\tif (ret) {\n7426:\t\t\trtw89_err(rtwdev, \"failed to recognize firmware elements\\n\");\n7427:\t\t\tgoto out;\n7428:\t\t}\n7429:\t\n7430:\t\tret = rtw89_chip_board_info_setup(rtwdev);\n7431:\t\tif (ret)\n7432:\t\t\tgoto out;\n"
} |
| 63/2 | 2026/10/23 00:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 73444 output: 47 thoughts: 1675 Thoughts: **Reachability Analysis for RTW89 Driver Code** Okay, let's break this down. My initial focus was on lines 7402-7412, where `rtw89_mac_pwr_on` and `rtw89_wait_firmware_completion` are called. A failure here is critical, particularly if the firmware loading fails because, as we know, that leads to a probe failure. Moreover, that `RTW89_CHK_FW_FEATURE` check for firmware version >= 0.27.138.1 for RTL8852C or >= 0.35.119.2 for RTL8922D adds another layer of complexity, particularly since the RTL8922D is PCIe only. However, this raises critical questions related to reachability and therefore, fuzzability. Now, hold on. Time for a step back to the prompt instructions' core triage philosophy. The central principle is *reachability*. We can only fuzz code that *executes* in a standard virtualized environment (like QEMU or GCE). The instructions explicitly call out that code on structurally unreachable hardware *must not* be fuzzed. Section 2 is crystal clear: Vendor-specific PCIe hardware requiring physical ASICs, like MLXSW, QED, AMDGPU, etc. are considered structurally unreachable because they are not emulated in standard QEMU. Here's the rub: Does QEMU emulate Realtek wireless cards? No. Realtek PCI wireless cards, like the rtw89 driver (Realtek 802.11ax PCI/USB), aren't emulated. So, this looks like a dead end. However, could USB play a role? Syzkaller and USB gadget are known to be useful (using `raw-gadget` or `dummy_hcd`) for USB device emulation. `syz_usb_connect` provides descriptors and responds to control requests. But, syzkaller’s corpus can't be searched for the relevant `syz_*` calls. This means we have to evaluate reachability from the kernel perspective. So, are there virtual buses that would be accessible for RTW89? Section 3 says: virtio, USB gadget, loopback, netlink, binder, sockets. So, if we can use USB gadget, that might change things. However, can a USB gadget emulate *any* USB device? Yes! But, even if syzkaller connects with the RTL8852CU vendor/product ID: Can any of the patched code be reached? That is the crux of the matter. Let's look at `rtw89_usb_probe`. Crucially, if `rtw89_usb_switch_mode` returns 1 (which it will if the device does not respond to control reads with specific values), then it immediately bails out to `err_intf_deinit`, and no patch code executes! It’s only *if* the device mocks `R_AX_PAD_CTRL2` that we get to `rtw89_core_init`, and later on to the `rtw89_mac_pwr_on` call. But given the conditions for `rtw89_usb_switch_mode` returning 0, this all suggests that we cannot reach the patched code. Let's research `rtw89_mac_pwr_on` to be absolutely certain. |
| 64/2 | 2026/10/23 00:25 | tool | grepper |
0mArgs:{
"Expression": "int rtw89_mac_pwr_on",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/mac.c=1521=static int rtw89_mac_power_switch(struct rtw89_dev *rtwdev, bool on)\n--\ndrivers/net/wireless/realtek/rtw89/mac.c-1587-\ndrivers/net/wireless/realtek/rtw89/mac.c:1588:int rtw89_mac_pwr_on(struct rtw89_dev *rtwdev)\ndrivers/net/wireless/realtek/rtw89/mac.c-1589-{\n--\ndrivers/net/wireless/realtek/rtw89/mac.h=1295=rtw89_write32_port_set(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,\n--\ndrivers/net/wireless/realtek/rtw89/mac.h-1304-\ndrivers/net/wireless/realtek/rtw89/mac.h:1305:int rtw89_mac_pwr_on(struct rtw89_dev *rtwdev);\ndrivers/net/wireless/realtek/rtw89/mac.h-1306-void rtw89_mac_pwr_off(struct rtw89_dev *rtwdev);\n"
} |
| 65/2 | 2026/10/23 00:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 76272 output: 46 thoughts: 24 Thoughts: Okay, let's dive into this. Here's my thought process on what I'd expect to see, as an expert in this field: **Investigating `rtw89_mac_power_switch` in `mac.c`** Alright, so I need to understand what's happening with power management within this specific MAC layer implementation. Let's start with `rtw89_mac_power_switch` in `mac.c`. I immediately think about a few key things: This function is likely the central point for handling power state transitions for the MAC. Given the naming convention, it suggests a function specifically dealing with hardware or device power control as it is MAC specific (MAC.C). This isn't a *general* driver power management framework function; it's probably quite specific to this particular Realtek Wi-Fi device (`rtw89`). I'm expecting to find code that interacts with the hardware registers of the radio to: * **Enable/Disable the radio**: This is the most basic function; likely involves writing bits to some control register that effectively powers the RF circuitry on or off. I'd expect to see direct register access. * **Configure power levels**: Depending on the sophistication of the hardware, it might be involved in setting different power levels (e.g., full power, low power, sleep modes). There may be different levels supported. * **Handle hardware-specific sequences**: Certain chipsets require specific initialization or shutdown sequences when changing power states. I'll be looking for potentially complicated sequences of register writes, delays, and perhaps even checking of status flags. * **Potentially manage clock gating**: If this is a modern design, it could be responsible for clock gating specific blocks of the hardware when they are not in use to conserve power. * **Interactions with other power management components**: I'd be looking to see if this function is a leaf, or if it calls other functions within the driver. Does it interface with the more general power management framework (if one exists) to coordinate power state changes with other parts of the system? * **Error Handling**: I'm curious if the function performs any error checks, especially when attempting to switch the power state or interact with any status registers. So, when I look at the code, I will be expecting to see either low-level register interactions, or a wrapper for some other more abstract framework that is more abstracted. |
| 66/2 | 2026/10/23 00:25 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/mac.c",
"FirstLine": 1521,
"LineCount": 50
}Results: {
"Contents": "1521:\tstatic int rtw89_mac_power_switch(struct rtw89_dev *rtwdev, bool on)\n1522:\t{\n1523:\t\tconst struct rtw89_mac_gen_def *mac = rtwdev-\u003echip-\u003emac_def;\n1524:\t\tconst struct rtw89_chip_info *chip = rtwdev-\u003echip;\n1525:\t\tconst struct rtw89_pwr_cfg * const *cfg_seq;\n1526:\t\tint (*cfg_func)(struct rtw89_dev *rtwdev);\n1527:\t\tint ret;\n1528:\t\n1529:\t\trtw89_mac_power_switch_boot_mode(rtwdev);\n1530:\t\n1531:\t\tif (on) {\n1532:\t\t\tcfg_seq = chip-\u003epwr_on_seq;\n1533:\t\t\tcfg_func = chip-\u003eops-\u003epwr_on_func;\n1534:\t\t} else {\n1535:\t\t\tif (test_bit(RTW89_FLAG_UNPLUGGED, rtwdev-\u003eflags)) {\n1536:\t\t\t\tcfg_seq = NULL;\n1537:\t\t\t\tcfg_func = rtw89_mac_pwr_off_func_for_unplugged;\n1538:\t\t\t} else {\n1539:\t\t\t\tcfg_seq = chip-\u003epwr_off_seq;\n1540:\t\t\t\tcfg_func = chip-\u003eops-\u003epwr_off_func;\n1541:\t\t\t}\n1542:\t\t}\n1543:\t\n1544:\t\tif (test_bit(RTW89_FLAG_FW_RDY, rtwdev-\u003eflags))\n1545:\t\t\t__rtw89_leave_ps_mode(rtwdev);\n1546:\t\n1547:\t\tif (on) {\n1548:\t\t\tret = mac-\u003ereset_pwr_state(rtwdev);\n1549:\t\t\tif (ret)\n1550:\t\t\t\treturn ret;\n1551:\t\t}\n1552:\t\n1553:\t\tret = cfg_func ? cfg_func(rtwdev) : rtw89_mac_pwr_seq(rtwdev, cfg_seq);\n1554:\t\tif (ret)\n1555:\t\t\treturn ret;\n1556:\t\n1557:\t\tif (on) {\n1558:\t\t\tif (!test_bit(RTW89_FLAG_PROBE_DONE, rtwdev-\u003eflags)) {\n1559:\t\t\t\trtw89_mac_efuse_read_ecv(rtwdev);\n1560:\t\t\t\tmac-\u003eefuse_read_fw_secure(rtwdev);\n1561:\t\t\t\trtw89_mac_efuse_read_thermal_k(rtwdev);\n1562:\t\t\t\trtw89_mac_efuse_read_pwr_data(rtwdev);\n1563:\t\t\t}\n1564:\t\n1565:\t\t\tset_bit(RTW89_FLAG_POWERON, rtwdev-\u003eflags);\n1566:\t\t\tset_bit(RTW89_FLAG_DMAC_FUNC, rtwdev-\u003eflags);\n1567:\t\t\tset_bit(RTW89_FLAG_CMAC0_FUNC, rtwdev-\u003eflags);\n1568:\t\n1569:\t\t\trtw89_mac_update_scoreboard(rtwdev, MAC_AX_NOTIFY_TP_MAJOR);\n1570:\t\t\trtw89_mac_clr_aon_intr(rtwdev);\n"
} |
| 67/2 | 2026/10/23 00:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 77805 output: 45 thoughts: 1914 Thoughts: **Analysis of RTW89 Driver Fuzzability** Okay, let's break this down systematically. I'm looking at the `rtw89_wait_firmware_completion` function and immediately see a potential issue: if `fw_req->firmware` is NULL, the function returns `-ENOENT`, which leads to an early exit in the driver initialization. This means `rtw89_core_register` is never called, and consequently, critical functions like `rtw89_ops_start`, `rtw89_regd_learn_init`, and others related to the "regd learn" functionality I'm examining are never reached. This directly impacts the fuzzability of the added "regd learn" code. Now, let's consult the fuzzing criteria. The instructions emphasize reachability, and I need to determine if this code path is reachable in a standard environment. Section 2 outlines negative criteria – instances where we *shouldn't* fuzz. I pay close attention to the phrasing: "ONLY IF all modified code falls strictly into one or more of these categories". It lists "Structurally unreachable hardware" as a key exclusion, specifically citing vendor-specific PCIe switches, SmartNICs, or GPU drivers *requiring physical ASIC/PCIe cards not emulated in standard QEMU*. Section 3 provides positive criteria for fuzzing. It emphasizes "Reachable Drivers and Protocols: *Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.)*". This raises a crucial question: is RTW89 structurally unreachable hardware? The answer hinges on whether QEMU or a standard environment can emulate Realtek 802.11ax wireless hardware. And I know, from experience, that QEMU doesn't emulate any 802.11 wireless card; instead Linux uses mac80211_hwsim, a virtual mac80211 driver. Then I get a crucial reminder from Section 1: "utilizing software-emulated devices like USB gadgets". Ah, USB gadgets! Syzkaller *can* fuzz USB drivers through raw gadget! So, the question shifts: can the modified code in this patch execute via USB gadget? Now, let's trace the dependencies of the code being modified: the regulatory domain learning (`regd learn`) logic. Where are the `rtw89_regd_learn_init`, `rtw89_regd_learn_deinit`, `rtw89_regd_learn_queue`, `rtw89_regd_learn_cancel`, and `rtw89_regd_learn_update` functions called? After carefully tracing all the call graphs for the functions in question, I discover that there are numerous functions, like `rtw89_core_dm_disable_cfg`, that rely on being able to successfully probe the driver. So, the crux is: since my driver does not probe if the firmware is missing, and firmware is missing by definition (since it's an edge case), and my USB driver probe won't succeed. Therefore, all this regulatory logic, even though it *is* associated with `USB gadgets`, is not reachable! The failure in `rtw89_wait_firmware_completion` means the core driver isn't initialized, rendering the "regd learn" code unreachable. Consequently, I must conclude that this patch isn't worth fuzzing because, although USB is *potentially* fuzzed, this patch won't get there. |
| 68/2 | 2026/10/23 00:25 | tool | grepper |
0mArgs:{
"Expression": "rtw89_core_dm_disable",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/core.c=5500=static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)\n--\ndrivers/net/wireless/realtek/rtw89/core.c-5550-\ndrivers/net/wireless/realtek/rtw89/core.c:5551:void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)\ndrivers/net/wireless/realtek/rtw89/core.c-5552-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c-5571-\ndrivers/net/wireless/realtek/rtw89/core.c:5572:void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)\ndrivers/net/wireless/realtek/rtw89/core.c-5573-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c-5576-\ndrivers/net/wireless/realtek/rtw89/core.c:5577:\trtw89_core_dm_disable_cfg(rtwdev, cur | BIT(type));\ndrivers/net/wireless/realtek/rtw89/core.c-5578-}\ndrivers/net/wireless/realtek/rtw89/core.c-5579-\ndrivers/net/wireless/realtek/rtw89/core.c:5580:void rtw89_core_dm_disable_clr(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)\ndrivers/net/wireless/realtek/rtw89/core.c-5581-{\n--\ndrivers/net/wireless/realtek/rtw89/core.c-5584-\ndrivers/net/wireless/realtek/rtw89/core.c:5585:\trtw89_core_dm_disable_cfg(rtwdev, cur \u0026 ~BIT(type));\ndrivers/net/wireless/realtek/rtw89/core.c-5586-}\n--\ndrivers/net/wireless/realtek/rtw89/core.h=9596=int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,\ndrivers/net/wireless/realtek/rtw89/core.h-9597-\t\t\t unsigned int link_id);\ndrivers/net/wireless/realtek/rtw89/core.h:9598:void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new);\ndrivers/net/wireless/realtek/rtw89/core.h:9599:void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type);\ndrivers/net/wireless/realtek/rtw89/core.h:9600:void rtw89_core_dm_disable_clr(struct rtw89_dev *rtwdev, enum rtw89_dm_type type);\ndrivers/net/wireless/realtek/rtw89/core.h-9601-\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=4810=rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-4820-\ndrivers/net/wireless/realtek/rtw89/debug.c:4821:\trtw89_core_dm_disable_cfg(rtwdev, conf);\ndrivers/net/wireless/realtek/rtw89/debug.c-4822-\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=4872=rtw89_debug_priv_static_pd_th_set(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-4888-\tif (mode == 0) {\ndrivers/net/wireless/realtek/rtw89/debug.c:4889:\t\trtw89_core_dm_disable_clr(rtwdev, RTW89_DM_DIG_PD);\ndrivers/net/wireless/realtek/rtw89/debug.c-4890-\t\thal-\u003efixed_dig_pd_th = 0;\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-4899-\ndrivers/net/wireless/realtek/rtw89/debug.c:4900:\t\trtw89_core_dm_disable_set(rtwdev, RTW89_DM_DIG_PD);\ndrivers/net/wireless/realtek/rtw89/debug.c-4901-\t\thal-\u003efixed_dig_pd_th = clamp(rtw89_dig_pd_th_dbm_to_reg(pd_th_dbm),\n--\ndrivers/net/wireless/realtek/rtw89/debug.c=4963=rtw89_debug_priv_mlo_mode_set(struct rtw89_dev *rtwdev,\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-4973-\ndrivers/net/wireless/realtek/rtw89/debug.c:4974:\trtw89_core_dm_disable_set(rtwdev, RTW89_DM_MLO);\ndrivers/net/wireless/realtek/rtw89/debug.c-4975-\n--\ndrivers/net/wireless/realtek/rtw89/debug.c-4983-\t\trtw89_debug(rtwdev, RTW89_DBG_STATE, \"Unsupported MLO mode\\n\");\ndrivers/net/wireless/realtek/rtw89/debug.c:4984:\t\trtw89_core_dm_disable_clr(rtwdev, RTW89_DM_MLO);\ndrivers/net/wireless/realtek/rtw89/debug.c-4985-\n"
} |
| 69/2 | 2026/10/23 00:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 82164 output: 47 thoughts: 1150 Thoughts: **Investigating the `rtw89_debug_priv_disable_dm_set` Debugfs File and Syzkaller Exploitation**
Okay, so I'm looking at `rtw89_debug_priv_disable_dm_set` and that `disable_dm` debugfs file. The problem is, as I see it, all these functions require an active `rtwdev` instance. The question is, can we ever create and register an `rtwdev` instance without actual hardware? Let's break this down.
First, PCIe. Is there even a PCIe card for rtw89 in QEMU? Nope. QEMU doesn't emulate the Realtek 8852 or 8922 PCIe cards. So that's a dead end.
Okay, let's look at USB then. Can we emulate an `rtw8852cu`, `rtw8852au`, or `rtw8851bu` USB device? Hmmm... what if syzkaller creates a USB device with the `rtw8852cu`'s vendor and product ID using raw-gadget or dummy_hcd? What happens during `rtw89_usb_probe`?
Let me just re-verify the USB probe:
```c
int rtw89_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id,
const struct rtw89_driver_info *default_info)
{
...
rtwdev = rtw89_alloc_ieee80211_hw(&intf->dev,
sizeof(struct rtw89_usb), info);
if (!rtwdev) {
dev_err(&intf->dev, "failed to allocate hw\n");
return -ENOMEM;
}
...
ret = rtw89_usb_intf_init(rtwdev, intf);
if (ret) {
rtw89_err(rtwdev, "failed to initialise intf: %d\n", ret);
goto err_free_hw;
}
ret = rtw89_usb_switch_mode(rtwdev);
if (ret) {
/* Not a fail, but we do need to skip rtw89_core_register. */
ret = 0;
goto err_intf_deinit;
}
...
ret = rtw89_core_init(rtwdev);
...
ret = rtw89_chip_info_setup(rtwdev);
if (ret) {
rtw89_err(rtwdev, "failed to setup chip information\n");
goto err_core_deinit;
}
ret = rtw89_core_register(rtwdev);
```
Okay, so looking at `rtw89_chip_info_setup` here:
```c
int rtw89_chip_info_setup(struct rtw89_dev *rtwdev)
{
struct rtw89_fw_req_info *fw_req = &rtwdev->fw.req;
struct rtw89_efuse *efuse = &rtwdev->efuse;
struct rtw89_hal *hal = &rtwdev->hal;
int ret;
rtw89_read_chip_ver(rtwdev);
ret = rtw89_mac_pwr_on(rtwdev);
if (ret) {
rtw89_err(rtwdev, "failed to power on\n");
return ret;
}
ret = rtw89_wait_firmware_completion(rtwdev);
if (ret) {
rtw89_err(rtwdev, "failed to wait firmware completion\n");
goto out;
}
```
Now, hold on. `rtw89_wait_firmware_completion(rtwdev)` uses `wait_for_completion_timeout(&fw_req->completion, RTW89_WAIT_FIRMWARE_TIMEOUT);` and returns `-ENOENT` if the firmware isn't present. But wait, why would firmware be present or not present in a syzkaller fuzzing VM? Typical syzkaller/syzbot VM images, like those Debian rootfs built by sy
|
| 70/2 | 2026/10/23 00:26 | tool | grepper |
0mArgs:{
"Expression": "int rtw89_mac_pwr_seq",
"PathPrefixes": [
"drivers/net/wireless/realtek/rtw89/"
]
}Results: {
"Output": "drivers/net/wireless/realtek/rtw89/mac.c=1270=static int rtw89_mac_sub_pwr_seq(struct rtw89_dev *rtwdev, u8 cv_msk,\n--\ndrivers/net/wireless/realtek/rtw89/mac.c-1312-\ndrivers/net/wireless/realtek/rtw89/mac.c:1313:static int rtw89_mac_pwr_seq(struct rtw89_dev *rtwdev,\ndrivers/net/wireless/realtek/rtw89/mac.c-1314-\t\t\t const struct rtw89_pwr_cfg * const *cfg_seq)\n"
} |
| 71/2 | 2026/10/23 00:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 84576 output: 46 thoughts: 22 Thoughts: Okay, let's dive into this `rtw89_mac_sub_pwr_seq` function. I'm going to take a look under the hood and understand its role. **Dissecting the `rtw89_mac_sub_pwr_seq` Function** My immediate focus is on its function, the "what". What power sequencing procedures does it handle? Is it involved in initial power-up, power-down, or something more nuanced like transitions between different power states within the MAC subsystem? The name suggests it's related to power sequencing, which could be critical for energy efficiency and overall stability of the system. I'll need to figure out which pieces of the MAC it affects and in what order. I'll be looking for references to hardware registers, specific commands sent to the hardware, and any involved delays that could indicate time-critical operations. The more I understand the sequencing, the better I can comprehend any potential performance bottlenecks or power consumption optimizations. Time to get to work. |
| 72/2 | 2026/10/23 00:26 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/mac.c",
"FirstLine": 1270,
"LineCount": 40
}Results: {
"Contents": "1270:\tstatic int rtw89_mac_sub_pwr_seq(struct rtw89_dev *rtwdev, u8 cv_msk,\n1271:\t\t\t\t\t u8 intf_msk, const struct rtw89_pwr_cfg *cfg)\n1272:\t{\n1273:\t\tconst struct rtw89_pwr_cfg *cur_cfg;\n1274:\t\tu32 addr;\n1275:\t\tu8 val;\n1276:\t\n1277:\t\tfor (cur_cfg = cfg; cur_cfg-\u003ecmd != PWR_CMD_END; cur_cfg++) {\n1278:\t\t\tif (!(cur_cfg-\u003eintf_msk \u0026 intf_msk) ||\n1279:\t\t\t !(cur_cfg-\u003ecv_msk \u0026 cv_msk))\n1280:\t\t\t\tcontinue;\n1281:\t\n1282:\t\t\tswitch (cur_cfg-\u003ecmd) {\n1283:\t\t\tcase PWR_CMD_WRITE:\n1284:\t\t\t\taddr = cur_cfg-\u003eaddr;\n1285:\t\n1286:\t\t\t\tif (cur_cfg-\u003ebase == PWR_BASE_SDIO)\n1287:\t\t\t\t\taddr |= SDIO_LOCAL_BASE_ADDR;\n1288:\t\n1289:\t\t\t\tval = rtw89_read8(rtwdev, addr);\n1290:\t\t\t\tval \u0026= ~(cur_cfg-\u003emsk);\n1291:\t\t\t\tval |= (cur_cfg-\u003eval \u0026 cur_cfg-\u003emsk);\n1292:\t\n1293:\t\t\t\trtw89_write8(rtwdev, addr, val);\n1294:\t\t\t\tbreak;\n1295:\t\t\tcase PWR_CMD_POLL:\n1296:\t\t\t\tif (pwr_cmd_poll(rtwdev, cur_cfg))\n1297:\t\t\t\t\treturn -EBUSY;\n1298:\t\t\t\tbreak;\n1299:\t\t\tcase PWR_CMD_DELAY:\n1300:\t\t\t\tif (cur_cfg-\u003eval == PWR_DELAY_US)\n1301:\t\t\t\t\tudelay(cur_cfg-\u003eaddr);\n1302:\t\t\t\telse\n1303:\t\t\t\t\tfsleep(cur_cfg-\u003eaddr * 1000);\n1304:\t\t\t\tbreak;\n1305:\t\t\tdefault:\n1306:\t\t\t\treturn -EINVAL;\n1307:\t\t\t}\n1308:\t\t}\n1309:\t\n"
} |
| 73/2 | 2026/10/23 00:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 85489 output: 46 thoughts: 3930 Thoughts: **My Analysis of the Patch and Its Fuzzing Potential** Okay, here's the deal. I've taken a deep dive into this patch and, frankly, I'm pretty certain it's *unfuzzable* in any standard environment. Let me walk you through my thought process. First, I looked at `PWR_CMD_POLL` because any power management failure immediately blocks things. If `pwr_cmd_poll` fails, both `rtw89_mac_pwr_seq` and, by extension, `rtw89_mac_pwr_on` fail. It is a critical path. Then, I went back to basics and reviewed the patch itself. I asked the crucial question: does this patch even touch any *probe* code? Is there anything relating to the PCI or USB probe path? The answer is a resounding NO. Then, I meticulously went through the diff again. It adds an enum value, touches `roc_start/end`, a debugfs entry, adds some firmware feature entries, implements a firmware H2C function, and modifies a bunch of other functions. These changes are all centered on a new `regd_learn` state machine. It's used in *runtime* operations (like ROC, scan and interface configuration), firmware communication, power management, and reset operations. None of this is called *before* the driver is fully registered and a network interface starts. The crucial point here is that *none* of this code can execute without the hardware being fully probed, registered, and a wiphy active. Even if a wiphy *is* registered, the `rtw89_regd_learn_init()` function checks `regd_learn->can_activate` which defaults to false unless the correct firmware is loaded. And the driver only supports RTL8852C and RTL8922D firmwares. The other `regd_learn` functions have an initial check for `can_activate`. The actual work of learning only happens in `rtw89_regd_learn_work`, and the firmware H2C function is only ever called from the work function. So this whole learning process is dormant until certain conditions are met, after an interface starts. This made me ask the question: Is the RTW89 driver considered structurally unreachable hardware? I re-read the exclusion criteria. Specifically, the "structurally unreachable hardware" category: "Vendor-specific PCIe switches, SmartNICs, or GPU drivers... requiring physical ASIC/PCIe cards not emulated in standard QEMU". I pondered whether syzkaller/syzbot even *fuzzes* `rtw89` drivers. I searched my mental knowledge and found that Realtek has had issues in the past. But, I cannot remember a specific `rtw89` syzbot report. I confirmed that `CONFIG_RTW89` *is* enabled in syzbot's config, but that's not enough. Just because a driver is *enabled* doesn't mean it's *reachable*. PCI drivers, by default, are not reachable. The device must be emulated. So, can syzkaller reach PCI drivers without QEMU emulating them? NO. Standard QEMU does not emulate any Realtek Wi-Fi device. This means the default USB raw gadget is a possible, if limited, route. Can syzkaller probe USB drivers with Raw Gadget? Yes, it has `syz_usb_connect`. If I provide a VID/PID, the USB core binds the driver's `.probe()` function. So, syzkaller *can* call `rtw89_usb_probe()`. But the key point: Does this patch modify `rtw89_usb_probe()`? NO! It does *not* modify any `usb.c` code. Can `rtw89_usb_probe()` succeed without physical hardware and firmware? NO. It fails in `rtw89_usb_switch_mode` or `rtw89_chip_info_setup` and by extension `rtw89_mac_pwr_on` or `rtw89_wait_firmware_completion`. Can `rtw89_usb_probe()` call any modified function? NO. The modifications involve `rtw89_regd_learn_init` which is called by `rtw89_ops_start` in mac80211 after the network interface is up. But, if the probe has not completed, the interface cannot be brought up. RTL8922D is PCIe ONLY, and RTL8852C USB requires firmware loading and specific hardware responses which are impossible in a default QEMU environment. Then I considered |
| 74/2 | 2026/10/23 00:26 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/realtek/rtw89/mac.c",
"FirstLine": 1250,
"LineCount": 25
}Results: {
"Contents": "1250:\t\t\t\tconst struct rtw89_pwr_cfg *cfg)\n1251:\t{\n1252:\t\tu8 val = 0;\n1253:\t\tint ret;\n1254:\t\tu32 addr = cfg-\u003ebase == PWR_INTF_MSK_SDIO ?\n1255:\t\t\t cfg-\u003eaddr | SDIO_LOCAL_BASE_ADDR : cfg-\u003eaddr;\n1256:\t\n1257:\t\tret = read_poll_timeout(rtw89_read8, val, !((val ^ cfg-\u003eval) \u0026 cfg-\u003emsk),\n1258:\t\t\t\t\t1000, 1000 * PWR_POLL_CNT, false, rtwdev, addr);\n1259:\t\n1260:\t\tif (!ret)\n1261:\t\t\treturn 0;\n1262:\t\n1263:\t\trtw89_warn(rtwdev, \"[ERR] Polling timeout\\n\");\n1264:\t\trtw89_warn(rtwdev, \"[ERR] addr: %X, %X\\n\", addr, cfg-\u003eaddr);\n1265:\t\trtw89_warn(rtwdev, \"[ERR] val: %X, %X\\n\", val, cfg-\u003eval);\n1266:\t\n1267:\t\treturn -EBUSY;\n1268:\t}\n1269:\t\n1270:\tstatic int rtw89_mac_sub_pwr_seq(struct rtw89_dev *rtwdev, u8 cv_msk,\n1271:\t\t\t\t\t u8 intf_msk, const struct rtw89_pwr_cfg *cfg)\n1272:\t{\n1273:\t\tconst struct rtw89_pwr_cfg *cur_cfg;\n1274:\t\tu32 addr;\n"
} |
| 75/2 | 2026/10/23 00:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 90970 output: 199 thoughts: 1285 Thoughts: **Analysis of Fuzzing Applicability for Realtek rtw89 Driver Changes** Okay, let's break this down. My initial assessment points strongly towards not fuzzing this patch. The key lies in understanding the rtw89 driver's dependencies and execution flow, and how that intersects with the capabilities of standard virtualized environments like QEMU and GCE. First, I see the driver has a very specific initialization sequence. After the power-on sequence (`pwr_on`), it immediately calls `rtw89_wait_firmware_completion`. If the firmware isn't found, it returns `-ENOENT`. Then it calls `rtw89_fw_recognize` and subsequently `rtw89_mfw_recognize`, which attempts to load the firmware. A crucial point here is that if the firmware wasn't loaded (because `wait_firmware_completion` failed), subsequent code in `rtw89_mfw_recognize` *will* crash because the firmware data isn't validated. Following that, it reads the efuse, registers the core, and then, and *only then*, if all those steps succeed, does it register the hardware, start operations, and finally, *and only if* *that* succeeds, does it get to `rtw89_regd_learn_init`. The critical point is in `rtw89_regd_learn_init`, specifically the `can_activate` check. This feature relies on the presence of specific firmware and the REGD_LEARN feature bit in that firmware. Without that feature bit, `can_activate` is false, and the code path is completely bypassed. I'm thinking, "Wait a minute!" This whole flow depends on *physical* Realtek 802.11ax hardware and the proprietary firmware. QEMU and GCE don't emulate those devices. And the `regd_learn` part needs that firmware. So, no matter what I do, I'm not going to be able to reach the modified code in a standard virtualized environment. This puts it squarely in the "Structurally unreachable hardware" category, specifically Realtek 802.11ax wireless chipsets (RTL8852A/B/C, RTL8922A/D). Therefore, this whole thing falls under "structurally unreachable hardware". So, even if the code added assertions or did something complex, it's unreachable in a standard fuzzing environment. I also checked to see if any other aspects should be considered (such as if `WorthFuzzing` should be `false`): If `WorthFuzzing` is `false`: - `WorthFuzzing`: false - `FocusSymbols`: [] - `EnableConfigs`: [] - Reasoning: Concise explanation. Okay, let me confirm. I've carefully verified that all modified code is *strictly* unreachable because it depends on physical hardware not emulated in standard environments. It doesn't touch core subsystems or virtual drivers. No modified function can be invoked without a fully initialized `rtw89` hardware device. And there are no changes in USB-related code or probe paths. The focus symbols and enable configs are empty. Everything checks out. I'm confident in setting `WorthFuzzing = false`. |
| 76/2 | 2026/10/23 00:26 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series adds regulatory domain learning support (REGD_LEARN) to the Realtek 802.11ax wireless driver (rtw89). All modified files reside strictly within drivers/net/wireless/realtek/rtw89/ and deal with hardware/firmware runtime interaction (mac80211 operational callbacks, firmware H2C/C2H messaging, channel context pause/proceed, and workqueues). Realtek 802.11ax wireless network adapters (RTL8852/RTL8922) are vendor-specific physical hardware not emulated in standard virtualized environments (QEMU/GCE), and require proprietary firmware blobs and physical register handshakes to complete initialization. The code is structurally unreachable during fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series adds regulatory domain learning support (REGD_LEARN) to the Realtek 802.11ax wireless driver (rtw89). All modified files reside strictly within drivers/net/wireless/realtek/rtw89/ and deal with hardware/firmware runtime interaction (mac80211 operational callbacks, firmware H2C/C2H messaging, channel context pause/proceed, and workqueues). Realtek 802.11ax wireless network adapters (RTL8852/RTL8922) are vendor-specific physical hardware not emulated in standard virtualized environments (QEMU/GCE), and require proprietary firmware blobs and physical register handshakes to complete initialization. The code is structurally unreachable during fuzzing.",
"WorthFuzzing": false
} |
| 77/1 | 2026/10/23 00:26 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|