| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/04 14:58 | flow | patch-triage |
3mArgs:null Results: {
"EnableConfigs": [
"WLAN",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_start_nan",
"nl80211_nan_change_config",
"mac80211_hwsim_nan_start",
"mac80211_hwsim_nan_change_config",
"mac80211_hwsim_nan_stop",
"mac80211_hwsim_nan_receive",
"mac80211_hwsim_nan_rx",
"mac80211_hwsim_nan_discovery_beacon_timer",
"cfg80211_inform_bss_frame_data"
],
"KMSANReasoning": "The patch series adds support for Instant Communication (IC) in NAN (Wi-Fi Aware) across cfg80211, mac80211, and mac80211_hwsim.\n\nApplicability analysis:\n1. User-space data exposure / Info-leaks: The netlink changes only introduce a flag attribute (NL80211_NAN_CAPA_INSTANT_COMM via nla_put_flag) which carries zero payload and no padding. No uninitialized kernel memory or padding is exposed or copied to user space.\n2. Initialization of new structures and fields: All stack variables introduced or modified (e.g. `iter_data`, `rx_outside_dw`, `instant_comm`) are fully initialized at declaration or prior to evaluation. Structures like `struct cfg80211_nan_conf` are zero-initialized (`= {}`) in `nl80211.c`. In `mac80211_hwsim_nan_tx_beacon`, the newly transmitted attributes (`nan_ie`, `extra_nan_attrs`) are fully initialized before being copied into the allocated skb.\n3. Parsing and bounds checking: Packet inspection helpers (`hwsim_nan_beacon_has_service_ids` and `ieee80211_is_nan_beacon`) validate element lengths and boundary offsets against `skb-\u003elen`. Any potential buffer overrun or boundary violation on malformed frames would be caught by KASAN.\n\nBecause the changes do not introduce or expose uninitialized memory reads or information leaks, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false,
"Reasoning": "This patch implements Instant Communication (IC) mode support for Wi-Fi Aware (NAN) across cfg80211, mac80211, and the simulated mac80211_hwsim virtual driver. The changes introduce new netlink configuration attributes, modify beacon and frame reception/filtering paths, add parsing of variable NAN element attributes from skbs, introduce dynamic memory allocations for extra attributes, and add new runtime WARN_ON assertions in wiphy_register. Because mac80211_hwsim is a software-simulated device accessible via generic netlink (nl80211) in standard virtualized environments, these changes are fully reachable and warrant fuzzing.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/04 14:58 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 2a3d7190068a49947f3a0f326b9c677f952f8317\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Oct 4 14:58:13 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c\nindex 762f99eb15e4c..7e65474c9df15 100644\n--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c\n+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c\n@@ -1775,6 +1775,7 @@ struct tx_iter_data {\n \tstruct ieee80211_channel *channel;\n \tstruct ieee80211_rx_status *rx_status;\n \tstruct ieee80211_hw *hw;\n+\tstruct sk_buff *skb;\n \tbool receive;\n };\n \n@@ -1787,6 +1788,7 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,\n \tif (vif-\u003etype == NL80211_IFTYPE_NAN ||\n \t vif-\u003etype == NL80211_IFTYPE_NAN_DATA) {\n \t\tdata-\u003ereceive = mac80211_hwsim_nan_receive(data-\u003ehw,\n+\t\t\t\t\t\t\t data-\u003eskb,\n \t\t\t\t\t\t\t data-\u003echannel,\n \t\t\t\t\t\t\t data-\u003erx_status);\n \t\treturn;\n@@ -1968,6 +1970,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,\n \t\t\t.hw = data2-\u003ehw,\n \t\t\t.channel = chan,\n \t\t\t.rx_status = \u0026rx_status,\n+\t\t\t.skb = skb,\n \t\t};\n \n \t\tif (data == data2)\n@@ -5841,7 +5844,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,\n \t\t\t\t\t\t BIT(NL80211_BAND_5GHZ);\n \n \t\thw-\u003ewiphy-\u003enan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |\n-\t\t\t\t\t WIPHY_NAN_FLAGS_USERSPACE_DE;\n+\t\t\t\t\t WIPHY_NAN_FLAGS_USERSPACE_DE |\n+\t\t\t\t\t WIPHY_NAN_FLAGS_INSTANT_COMM;\n \t\thw-\u003ewiphy-\u003enan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |\n \t\t\t\t\t NAN_OP_MODE_80P80MHZ |\n \t\t\t\t\t NAN_OP_MODE_160MHZ;\n@@ -6643,6 +6647,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,\n \t\tstruct tx_iter_data iter_data = {\n \t\t\t.hw = data2-\u003ehw,\n \t\t\t.rx_status = \u0026rx_status,\n+\t\t\t.skb = skb,\n \t\t};\n \n \t\t/* throw away off-channel packets, but allow both the temporary\ndiff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c\nindex 2d9f6d7b92514..6f90856099e83 100644\n--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c\n+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c\n@@ -33,6 +33,12 @@ static_assert(DW0_TSF_MASK + 1 == 8192 * 1024);\n #define NAN_RSSI_CLOSE (-60)\n #define NAN_RSSI_MIDDLE (-75)\n \n+/* Size of the NAN vendor element carrying the mandatory attributes */\n+#define NAN_BEACON_ELEM_LEN\t\t27\n+\n+/* Space left in the NAN vendor element for the configured attributes */\n+#define NAN_BEACON_EXTRA_ATTRS_LEN\t(255 - (NAN_BEACON_ELEM_LEN - 2))\n+\n /* Quiet time at the end of each slot where TX is suppressed */\n #define NAN_CHAN_SWITCH_TIME_US\t\t256\n \n@@ -213,6 +219,37 @@ mac80211_hwsim_nan_schedule_slot(struct mac80211_hwsim_data *data, u8 slot,\n \t\t\t mac80211_hwsim_tsf_to_boottime(data, tsf));\n }\n \n+static bool hwsim_nan_beacon_has_service_ids(struct sk_buff *skb)\n+{\n+\tconst struct ieee80211_mgmt *mgmt = (void *)skb-\u003edata;\n+\tconst struct ieee80211_nan_attr *nan_attr;\n+\tconst struct element *elem;\n+\tsize_t len;\n+\n+\tif (skb-\u003elen \u003c offsetofend(struct ieee80211_mgmt, u.beacon) ||\n+\t !ieee80211_is_beacon(mgmt-\u003eframe_control))\n+\t\treturn false;\n+\n+\tlen = skb-\u003elen - offsetofend(struct ieee80211_mgmt, u.beacon);\n+\n+\t/* TODO: fragmented NAN elements are not supported */\n+\tfor_each_element_id(elem, WLAN_EID_VENDOR_SPECIFIC,\n+\t\t\t mgmt-\u003eu.beacon.variable, len) {\n+\t\tif (elem-\u003edatalen \u003c 4 ||\n+\t\t get_unaligned_be32(elem-\u003edata) !=\n+\t\t (WLAN_OUI_WFA \u003c\u003c 8 | WLAN_OUI_TYPE_WFA_NAN))\n+\t\t\tcontinue;\n+\n+\t\tfor_each_nan_attr(nan_attr, elem-\u003edata + 4, elem-\u003edatalen - 4)\n+\t\t\tif (nan_attr-\u003eattr == NAN_ATTR_SERVICE_ID_LIST ||\n+\t\t\t nan_attr-\u003eattr ==\n+\t\t\t NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST)\n+\t\t\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n+\n void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n \t\t\t struct sk_buff *skb)\n {\n@@ -230,9 +267,7 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n \tssize_t data_len;\n \tu8 slot;\n \n-\t/* Need a NAN vendor element at the start */\n-\tif (skb-\u003elen \u003c (offsetofend(struct ieee80211_mgmt, u.beacon) + 6) ||\n-\t !ieee80211_is_beacon(mgmt-\u003eframe_control))\n+\tif (!ieee80211_is_nan_beacon(mgmt, skb-\u003elen))\n \t\treturn;\n \n \tdata_len = skb-\u003elen - offsetofend(struct ieee80211_mgmt, u.beacon);\n@@ -266,28 +301,34 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n \t}\n \n \t/*\n-\t * (overly) simplify things, only track 2.4 GHz here. Also, ignore\n-\t * frames outside of the 2.4 GHz DW slot, unless in the initial SCAN\n-\t * phase.\n+\t * Only sync on 2.4 GHz, which all NAN devices attend. The slot number\n+\t * is derived from the local TSF, so before being synchronized a 5 GHz\n+\t * beacon from a different device may fall into the local 2.4 GHz DW\n+\t * slot. Filter by frequency to keep such beacons out of master\n+\t * selection and synchronization.\n \t */\n-\tif ((slot != SLOT_24GHZ_DW \u0026\u0026\n-\t data-\u003enan.phase != MAC80211_HWSIM_NAN_PHASE_SCAN) ||\n-\t rx_status.freq != 2437)\n+\tif (rx_status.freq != 2437)\n \t\treturn;\n \n-\t/* Just ignore low RSSI beacons that we cannot sync to */\n-\tif (rx_status.signal \u003c NAN_RSSI_MIDDLE)\n-\t\treturn;\n+\t/*\n+\t * Ignore frames outside of the 2.4 GHz DW slot, unless in the initial\n+\t * SCAN phase or in Instant Communication, where discovery beacons are\n+\t * received outside the DW.\n+\t */\n+\tif (slot != SLOT_24GHZ_DW) {\n+\t\tbool rx_outside_dw;\n \n-\t/* Needs to be a valid NAN cluster ID in A3 */\n-\tif (get_unaligned_be32(mgmt-\u003ebssid) != ((WLAN_OUI_WFA \u003c\u003c 8) | 0x01))\n-\t\treturn;\n+\t\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\n+\t\t\trx_outside_dw = data-\u003enan.instant_comm ||\n+\t\t\t\tdata-\u003enan.phase ==\n+\t\t\t\tMAC80211_HWSIM_NAN_PHASE_SCAN;\n \n-\t/* We are only interested in NAN beacons */\n-\tif (nan_elem-\u003eid != WLAN_EID_VENDOR_SPECIFIC ||\n-\t nan_elem-\u003edatalen \u003c 4 ||\n-\t get_unaligned_be32(nan_elem-\u003edata) !=\n-\t (WLAN_OUI_WFA \u003c\u003c 8 | WLAN_OUI_TYPE_WFA_NAN))\n+\t\tif (!rx_outside_dw)\n+\t\t\treturn;\n+\t}\n+\n+\t/* Just ignore low RSSI beacons that we cannot sync to */\n+\tif (rx_status.signal \u003c NAN_RSSI_MIDDLE)\n \t\treturn;\n \n \tu8 *nan_defragmented __free(kfree) = kzalloc(data_len, GFP_ATOMIC);\n@@ -636,10 +677,12 @@ mac80211_hwsim_nan_exec_state_transitions(struct mac80211_hwsim_data *data)\n \n \t/*\n \t * The discovery beacon timer will stop automatically. Make sure it is\n-\t * running if we are master. Do not bother with a proper alignment it\n-\t * will sync itself to the TSF after the first TX.\n+\t * running if we are master or if Instant Communication is enabled. Do\n+\t * not bother with a proper alignment it will sync itself to the TSF\n+\t * after the first TX.\n \t */\n-\tif (data-\u003enan.role == MAC80211_HWSIM_NAN_ROLE_MASTER \u0026\u0026\n+\tif ((data-\u003enan.role == MAC80211_HWSIM_NAN_ROLE_MASTER ||\n+\t data-\u003enan.instant_comm) \u0026\u0026\n \t !hrtimer_active(\u0026data-\u003enan.discovery_beacon_timer))\n \t\thrtimer_start(\u0026data-\u003enan.discovery_beacon_timer,\n \t\t\t ns_to_ktime(10 * NSEC_PER_USEC),\n@@ -698,7 +741,7 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,\n {\n \tstruct ieee80211_vendor_ie nan_ie = {\n \t\t.element_id = WLAN_EID_VENDOR_SPECIFIC,\n-\t\t.len = 27 - 2,\n+\t\t.len = NAN_BEACON_ELEM_LEN - 2,\n \t\t.oui = { u32_get_bits(WLAN_OUI_WFA, 0xff0000),\n \t\t\t u32_get_bits(WLAN_OUI_WFA, 0xff00),\n \t\t\t u32_get_bits(WLAN_OUI_WFA, 0xff) },\n@@ -707,23 +750,34 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,\n \tsize_t alloc_size =\n \t\tIEEE80211_TX_STATUS_HEADROOM +\n \t\toffsetofend(struct ieee80211_mgmt, u.beacon) +\n-\t\t27 /* size of NAN vendor element */;\n+\t\tNAN_BEACON_ELEM_LEN;\n \tstruct ieee80211_nan_master_indication master_indication;\n \tstruct ieee80211_nan_attr nan_attr;\n \tstruct ieee80211_mgmt *mgmt;\n \tstruct sk_buff *skb;\n \n \t/*\n-\t * TODO: Should the configured vendor elements or NAN attributes be\n-\t * included in some of these beacons?\n+\t * TODO: Should the configured vendor elements be included in some of\n+\t * these beacons?\n \t */\n \n+\t/* Allocate maximal size for NAN IE */\n+\tif (is_discovery)\n+\t\talloc_size += NAN_BEACON_EXTRA_ATTRS_LEN;\n+\n \tskb = alloc_skb(alloc_size, GFP_ATOMIC);\n \tif (!skb)\n \t\treturn;\n \n \tspin_lock(\u0026data-\u003enan.state_lock);\n \n+\t/*\n+\t * The attributes configured by user space are appended to the\n+\t * mandatory ones.\n+\t */\n+\tif (is_discovery)\n+\t\tnan_ie.len += data-\u003enan.extra_nan_attrs_len;\n+\n \tskb_reserve(skb, IEEE80211_TX_STATUS_HEADROOM);\n \tmgmt = skb_put(skb, offsetofend(struct ieee80211_mgmt, u.beacon));\n \n@@ -734,7 +788,9 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,\n \n \tmgmt-\u003eframe_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |\n \t\t\t\t\t IEEE80211_STYPE_BEACON);\n-\tmgmt-\u003eu.beacon.beacon_int = cpu_to_le16(is_discovery ? 100 : DWST_TU);\n+\tmgmt-\u003eu.beacon.beacon_int =\n+\t\tcpu_to_le16(is_discovery ? data-\u003enan.discovery_beacon_interval :\n+\t\t\t DWST_TU);\n \tmgmt-\u003eu.beacon.capab_info =\n \t\tcpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME |\n \t\t\t WLAN_CAPABILITY_SHORT_PREAMBLE);\n@@ -765,6 +821,10 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,\n \tskb_put_data(skb, \u0026data-\u003enan.current_ami,\n \t\t sizeof(data-\u003enan.current_ami));\n \n+\tif (is_discovery \u0026\u0026 data-\u003enan.extra_nan_attrs_len)\n+\t\tskb_put_data(skb, data-\u003enan.extra_nan_attrs,\n+\t\t\t data-\u003enan.extra_nan_attrs_len);\n+\n \tspin_unlock(\u0026data-\u003enan.state_lock);\n \n \tmac80211_hwsim_tx_frame(data-\u003ehw, skb, channel);\n@@ -877,7 +937,15 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)\n \t\treturn HRTIMER_NORESTART;\n \n \tscoped_guard(spinlock, \u0026data-\u003enan.state_lock) {\n-\t\tif (data-\u003enan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN ||\n+\t\tif (data-\u003enan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)\n+\t\t\treturn HRTIMER_NORESTART;\n+\n+\t\t/*\n+\t\t * With Instant Communication the discovery beacons are\n+\t\t * transmitted disregarding the role and the state, see\n+\t\t * Wi-Fi Aware version 4.0 section 13.\n+\t\t */\n+\t\tif (!data-\u003enan.instant_comm \u0026\u0026\n \t\t data-\u003enan.role != MAC80211_HWSIM_NAN_ROLE_MASTER)\n \t\t\treturn HRTIMER_NORESTART;\n \t}\n@@ -894,10 +962,11 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)\n \ttsf_now = mac80211_hwsim_get_tsf(data-\u003ehw, data-\u003enan.device_vif);\n \n \t/* Wrap value to be after the next TBTT */\n-\ttbtt = tsf_now + ieee80211_tu_to_usec(100);\n+\ttbtt = tsf_now + ieee80211_tu_to_usec(data-\u003enan.discovery_beacon_interval);\n \n \t/* Round TBTT down to the correct time */\n-\tdiv_u64_rem(tbtt, ieee80211_tu_to_usec(100), \u0026remainder);\n+\tdiv_u64_rem(tbtt, ieee80211_tu_to_usec(data-\u003enan.discovery_beacon_interval),\n+\t\t \u0026remainder);\n \ttbtt = tbtt - remainder;\n \n \thrtimer_set_expires(\u0026data-\u003enan.discovery_beacon_timer,\n@@ -918,11 +987,51 @@ mac80211_hwsim_nan_sched_update_work(struct wiphy *wiphy,\n \t\tieee80211_nan_sched_update_done(data-\u003enan.device_vif);\n }\n \n+static int mac80211_hwsim_nan_set_config(struct mac80211_hwsim_data *data,\n+\t\t\t\t\t struct cfg80211_nan_conf *conf)\n+{\n+\tconst u8 *extra_nan_attrs = NULL;\n+\tconst u8 *old;\n+\n+\tif (conf-\u003eextra_nan_attrs_len \u003e NAN_BEACON_EXTRA_ATTRS_LEN)\n+\t\treturn -EINVAL;\n+\n+\tif (conf-\u003eextra_nan_attrs_len) {\n+\t\textra_nan_attrs = kmemdup(conf-\u003eextra_nan_attrs,\n+\t\t\t\t\t conf-\u003eextra_nan_attrs_len,\n+\t\t\t\t\t GFP_KERNEL);\n+\t\tif (!extra_nan_attrs)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tdata-\u003enan.notify_dw = conf-\u003eenable_dw_notification;\n+\n+\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock) {\n+\t\t/*\n+\t\t * Fall back to the device default if user space did not\n+\t\t * configure it\n+\t\t */\n+\t\tdata-\u003enan.discovery_beacon_interval =\n+\t\t\tconf-\u003ediscovery_beacon_interval ? : 100;\n+\n+\t\tdata-\u003enan.instant_comm = conf-\u003einstant_comm;\n+\n+\t\told = data-\u003enan.extra_nan_attrs;\n+\t\tdata-\u003enan.extra_nan_attrs = extra_nan_attrs;\n+\t\tdata-\u003enan.extra_nan_attrs_len = conf-\u003eextra_nan_attrs_len;\n+\t}\n+\n+\tkfree(old);\n+\n+\treturn 0;\n+}\n+\n int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,\n \t\t\t struct ieee80211_vif *vif,\n \t\t\t struct cfg80211_nan_conf *conf)\n {\n \tstruct mac80211_hwsim_data *data = hw-\u003epriv;\n+\tint err;\n \n \tif (vif-\u003etype != NL80211_IFTYPE_NAN)\n \t\treturn -EINVAL;\n@@ -930,6 +1039,10 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,\n \tif (data-\u003enan.device_vif)\n \t\treturn -EALREADY;\n \n+\terr = mac80211_hwsim_nan_set_config(data, conf);\n+\tif (err)\n+\t\treturn err;\n+\n \t/* set this before starting the timer, as preemption might occur */\n \tdata-\u003enan.device_vif = vif;\n \tdata-\u003enan.bands = conf-\u003ebands;\n@@ -938,9 +1051,13 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,\n \t\t\t\tmac80211_hwsim_nan_sched_update_work);\n \n \tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock) {\n-\t\t/* Start in the \"scan\" phase and stay there for a little bit */\n+\t\t/*\n+\t\t * Start in the \"scan\" phase and stay there for a little bit,\n+\t\t * unless Instant Communication is configured, in which case an\n+\t\t * own cluster is started immediately.\n+\t\t */\n \t\tdata-\u003enan.phase = MAC80211_HWSIM_NAN_PHASE_SCAN;\n-\t\tdata-\u003enan.random_factor_valid_dwst = 1;\n+\t\tdata-\u003enan.random_factor_valid_dwst = conf-\u003einstant_comm ? 0 : 1;\n \t\tdata-\u003enan.random_factor = 0;\n \t\tdata-\u003enan.master_pref = conf-\u003emaster_pref;\n \t\tdata-\u003enan.role = MAC80211_HWSIM_NAN_ROLE_MASTER;\n@@ -958,8 +1075,6 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,\n \n \tether_addr_copy(data-\u003enan.cluster_id, conf-\u003ecluster_id);\n \n-\tdata-\u003enan.notify_dw = conf-\u003eenable_dw_notification;\n-\n \treturn 0;\n }\n \n@@ -967,6 +1082,7 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,\n \t\t\t struct ieee80211_vif *vif)\n {\n \tstruct mac80211_hwsim_data *data = hw-\u003epriv;\n+\tconst u8 *old;\n \n \tif (vif-\u003etype != NL80211_IFTYPE_NAN || !data-\u003enan.device_vif ||\n \t data-\u003enan.device_vif != vif)\n@@ -978,6 +1094,15 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,\n \twiphy_delayed_work_cancel(hw-\u003ewiphy, \u0026data-\u003enan.sched_update_work);\n \tdata-\u003enan.device_vif = NULL;\n \n+\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock) {\n+\t\told = data-\u003enan.extra_nan_attrs;\n+\t\tdata-\u003enan.extra_nan_attrs = NULL;\n+\t\tdata-\u003enan.extra_nan_attrs_len = 0;\n+\t\tdata-\u003enan.instant_comm = false;\n+\t}\n+\n+\tkfree(old);\n+\n \treturn 0;\n }\n \n@@ -996,13 +1121,27 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,\n \n \twiphy_debug(hw-\u003ewiphy, \"nan_config_changed: changes=0x%x\\n\", changes);\n \n+\tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_CONFIG) {\n+\t\tint err = mac80211_hwsim_nan_set_config(data, conf);\n+\n+\t\tif (err)\n+\t\t\treturn err;\n+\n+\t\t/*\n+\t\t * When Instant Communication is enabled discovery beacons are\n+\t\t * transmitted regardless of the role and the state.\n+\t\t */\n+\t\tif (conf-\u003einstant_comm \u0026\u0026\n+\t\t !hrtimer_active(\u0026data-\u003enan.discovery_beacon_timer))\n+\t\t\thrtimer_start(\u0026data-\u003enan.discovery_beacon_timer,\n+\t\t\t\t ns_to_ktime(10 * NSEC_PER_USEC),\n+\t\t\t\t HRTIMER_MODE_REL_SOFT);\n+\t}\n+\n \t/* Handle only the changes we care about for simulation purposes */\n \tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_BANDS)\n \t\tdata-\u003enan.bands = conf-\u003ebands;\n \n-\tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_CONFIG)\n-\t\tdata-\u003enan.notify_dw = conf-\u003eenable_dw_notification;\n-\n \tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_PREF) {\n \t\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\n \t\t\tdata-\u003enan.master_pref = conf-\u003emaster_pref;\n@@ -1185,9 +1324,16 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,\n \tis_dw_slot = mac80211_hwsim_nan_is_dw_slot(data, slot);\n \n \tif (!txq-\u003esta) {\n-\t\t/* Non-STA TXQ: allow management frames during DW */\n-\t\tif (txq-\u003evif-\u003etype == NL80211_IFTYPE_NAN)\n-\t\t\treturn is_dw_slot;\n+\t\t/* Non-STA TXQ: allow management frames during DW or IC */\n+\t\tif (txq-\u003evif-\u003etype == NL80211_IFTYPE_NAN) {\n+\t\t\tif (is_dw_slot)\n+\t\t\t\treturn true;\n+\n+\t\t\t/* Outside the DW the local schedule must allow it */\n+\t\t\tguard(spinlock_bh)(\u0026data-\u003enan.state_lock);\n+\t\t\treturn data-\u003enan.instant_comm \u0026\u0026\n+\t\t\t\tdata-\u003enan.local_sched[slot].chan;\n+\t\t}\n \n \t\t/* Allow multicast data when all the peers are available\n \t\t * on this slot\n@@ -1240,15 +1386,32 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,\n }\n \n bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,\n+\t\t\t\tstruct sk_buff *skb,\n \t\t\t\tstruct ieee80211_channel *channel,\n \t\t\t\tstruct ieee80211_rx_status *rx_status)\n {\n \tstruct mac80211_hwsim_data *data = hw-\u003epriv;\n+\tbool instant_comm;\n \tu8 slot;\n \n \tif (WARN_ON_ONCE(!data-\u003enan.device_vif))\n \t\treturn false;\n \n+\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\n+\t\tinstant_comm = data-\u003enan.instant_comm;\n+\n+\t/*\n+\t * During Instant Communication a peer advertises its services in the\n+\t * discovery beacons, which are transmitted disregarding the roles and\n+\t * the states, see Section 13 in Wi-Fi Aware v4.0.\n+\t * Note that while according to the specification Instant communication\n+\t * should be enabled only on the NAN discovery channels, do not force\n+\t * this here, and allow receiving NAN frames on any channel if Instant\n+\t * Communication is enabled.\n+\t */\n+\tif (instant_comm \u0026\u0026 hwsim_nan_beacon_has_service_ids(skb))\n+\t\treturn true;\n+\n \tif (data-\u003enan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)\n \t\treturn channel-\u003ecenter_freq == 2437;\n \ndiff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h\nindex 2801a1d8dcf07..0684f9b823baf 100644\n--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h\n+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h\n@@ -32,6 +32,9 @@ struct mac80211_hwsim_nan_data {\n \t/* Later members are protected by this lock */\n \tspinlock_t state_lock;\n \n+\tconst u8 *extra_nan_attrs;\n+\tu16 extra_nan_attrs_len;\n+\n \tu8 master_pref;\n \tu8 random_factor;\n \n@@ -53,6 +56,9 @@ struct mac80211_hwsim_nan_data {\n \tbool tsf_adjusted;\n \tbool tsf_discontinuity;\n \n+\tbool instant_comm;\n+\tu8 discovery_beacon_interval;\n+\n \t/*\n \t * Local schedule - stores channel definition for each 16TU slot.\n \t * Derived from NMI vif-\u003ecfg.nan_schedule. chan == NULL means not\n@@ -93,6 +99,7 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,\n \t\t\t\t struct cfg80211_chan_def *chandef);\n \n bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,\n+\t\t\t\tstruct sk_buff *skb,\n \t\t\t\tstruct ieee80211_channel *channel,\n \t\t\t\tstruct ieee80211_rx_status *rx_status);\n \ndiff --git a/include/linux/ieee80211-nan.h b/include/linux/ieee80211-nan.h\nindex 455033955e545..7815a6cf81605 100644\n--- a/include/linux/ieee80211-nan.h\n+++ b/include/linux/ieee80211-nan.h\n@@ -40,6 +40,8 @@\n /* NAN attributes, as defined in Wi-Fi Aware (TM) specification 4.0 Table 42 */\n #define NAN_ATTR_MASTER_INDICATION\t\t0x00\n #define NAN_ATTR_CLUSTER_INFO\t\t\t0x01\n+#define NAN_ATTR_SERVICE_ID_LIST\t\t0x02\n+#define NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST\t0x28\n \n struct ieee80211_nan_attr {\n \tu8 attr;\n@@ -74,4 +76,30 @@ struct ieee80211_nan_anchor_master_info {\n \t _attr = (const struct ieee80211_nan_attr *)\t\t\\\n \t\t(_attr-\u003edata + le16_to_cpu(_attr-\u003elength)))\n \n+static inline bool ieee80211_is_nan_beacon(const struct ieee80211_mgmt *mgmt,\n+\t\t\t\t\t size_t len)\n+{\n+\tconst struct element *elem;\n+\n+\t/* The NAN IE is at least 6 octets */\n+\tif (len \u003c offsetofend(struct ieee80211_mgmt, u.beacon) + 6)\n+\t\treturn false;\n+\n+\tif (!ieee80211_is_beacon(mgmt-\u003eframe_control))\n+\t\treturn false;\n+\n+\t/* NAN Cluster IDs range from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF */\n+\tif (get_unaligned_be32(mgmt-\u003ebssid) != ((WLAN_OUI_WFA \u003c\u003c 8) | 0x01))\n+\t\treturn false;\n+\n+\telem = (const struct element *)mgmt-\u003eu.beacon.variable;\n+\tif (elem-\u003eid != WLAN_EID_VENDOR_SPECIFIC ||\n+\t elem-\u003edatalen \u003c 4 ||\n+\t get_unaligned_be32(elem-\u003edata) !=\n+\t (WLAN_OUI_WFA \u003c\u003c 8 | WLAN_OUI_TYPE_WFA_NAN))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n #endif /* LINUX_IEEE80211_NAN_H */\ndiff --git a/include/net/cfg80211.h b/include/net/cfg80211.h\nindex b603f1804cc26..96b5bf8b8ff38 100644\n--- a/include/net/cfg80211.h\n+++ b/include/net/cfg80211.h\n@@ -4191,9 +4191,12 @@ struct cfg80211_nan_band_config {\n *\tthat can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.\n * @scan_period: period (in seconds) between NAN scans.\n * @scan_dwell_time: dwell time (in milliseconds) for NAN scans.\n- * @discovery_beacon_interval: interval (in TUs) for discovery beacons.\n+ * @discovery_beacon_interval: interval (in TUs) for discovery beacons. Must be\n+ *\tgreater than 0 when @instant_comm is true.\n * @enable_dw_notification: flag to enable/disable discovery window\n *\tnotifications.\n+ * @instant_comm: if true, start Instant Communication (IC) as defined in\n+ *\tChapter 13 of the Wi-Fi Aware Specification v4.0.\n * @band_cfgs: array of band specific configurations, indexed by\n *\t\u0026enum nl80211_band values.\n * @extra_nan_attrs: pointer to additional NAN attributes.\n@@ -4209,6 +4212,7 @@ struct cfg80211_nan_conf {\n \tu16 scan_dwell_time;\n \tu8 discovery_beacon_interval;\n \tbool enable_dw_notification;\n+\tbool instant_comm;\n \tstruct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];\n \tconst u8 *extra_nan_attrs;\n \tu16 extra_nan_attrs_len;\n@@ -6305,10 +6309,13 @@ struct wiphy_radio {\n * @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable\n * synchronization.\n * @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.\n+ * @WIPHY_NAN_FLAGS_INSTANT_COMM: Device can switch to Instant Communication\n+ * (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC.\n */\n enum wiphy_nan_flags {\n \tWIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),\n \tWIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),\n+\tWIPHY_NAN_FLAGS_INSTANT_COMM = BIT(2),\n };\n \n /**\ndiff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h\nindex 75d4c5d6a7a32..21d98c1ec424c 100644\n--- a/include/uapi/linux/nl80211.h\n+++ b/include/uapi/linux/nl80211.h\n@@ -7890,6 +7890,11 @@ enum nl80211_nan_band_conf_attributes {\n *\tthe upcoming discovery window with\n *\t%NL80211_CMD_NAN_NEXT_DW_NOTIFICATION.\n *\tThis is a flag attribute.\n+ * @NL80211_NAN_CONF_INSTANT_COMM: If set, the NAN synchronization logic will\n+ *\tstart Instant Communication (IC) as defined in Chapter 13 of the\n+ *\tWi-Fi Aware Specification v4.0.\n+ *\t%NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL must be set as well.\n+ *\tThis is a flag attribute.\n * @NUM_NL80211_NAN_CONF_ATTR: Internal.\n * @NL80211_NAN_CONF_ATTR_MAX: Highest NAN configuration attribute.\n *\n@@ -7905,6 +7910,7 @@ enum nl80211_nan_conf_attributes {\n \tNL80211_NAN_CONF_SCAN_DWELL_TIME,\n \tNL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL,\n \tNL80211_NAN_CONF_NOTIFY_DW,\n+\tNL80211_NAN_CONF_INSTANT_COMM,\n \n \t/* keep last */\n \tNUM_NL80211_NAN_CONF_ATTR,\n@@ -9121,6 +9127,11 @@ enum nl80211_s1g_short_beacon_attrs {\n *\tspecification Table 79 (Capabilities field).\n * @NL80211_NAN_CAPA_PHY: nested attribute containing band-agnostic\n *\tcapabilities for NAN data path. See \u0026enum nl80211_nan_phy_cap_attr.\n+ * @NL80211_NAN_CAPA_INSTANT_COMM: Flag attribute indicating that the device\n+ *\tcan switch to Instant Communication (IC) mode, as defined in Chapter 13\n+ *\tof the Wi-Fi Aware Specification v4.0. Can only be set if\n+ *\t%NL80211_NAN_CAPA_CONFIGURABLE_SYNC is set. When IC is enabled, the IC\n+ *\tschedule is expected to be configured by user space.\n * @__NL80211_NAN_CAPABILITIES_LAST: Internal\n * @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute.\n */\n@@ -9134,6 +9145,7 @@ enum nl80211_nan_capabilities {\n \tNL80211_NAN_CAPA_MAX_CHANNEL_SWITCH_TIME,\n \tNL80211_NAN_CAPA_CAPABILITIES,\n \tNL80211_NAN_CAPA_PHY,\n+\tNL80211_NAN_CAPA_INSTANT_COMM,\n \t/* keep last */\n \t__NL80211_NAN_CAPABILITIES_LAST,\n \tNL80211_NAN_CAPABILITIES_MAX = __NL80211_NAN_CAPABILITIES_LAST - 1,\ndiff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c\nindex bd1a857c812d4..eeab1b515e774 100644\n--- a/net/mac80211/cfg.c\n+++ b/net/mac80211/cfg.c\n@@ -368,6 +368,7 @@ static int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,\n \t\tdst-\u003ediscovery_beacon_interval =\n \t\t\tsrc-\u003ediscovery_beacon_interval;\n \t\tdst-\u003eenable_dw_notification = src-\u003eenable_dw_notification;\n+\t\tdst-\u003einstant_comm = src-\u003einstant_comm;\n \t\tmemcpy(\u0026dst-\u003eband_cfgs, \u0026src-\u003eband_cfgs,\n \t\t sizeof(dst-\u003eband_cfgs));\n \ndiff --git a/net/mac80211/main.c b/net/mac80211/main.c\nindex 7816395681fa4..b889d2a7ef751 100644\n--- a/net/mac80211/main.c\n+++ b/net/mac80211/main.c\n@@ -745,8 +745,13 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {\n \t},\n \t[NL80211_IFTYPE_NAN] = {\n \t\t.tx = 0xffff,\n+\t\t/*\n+\t\t * Beacon Rx registration is needed to let user space handle\n+\t\t * service discovery when Instant Communication is enabled.\n+\t\t */\n \t\t.rx = BIT(IEEE80211_STYPE_ACTION \u003e\u003e 4) |\n-\t\t\tBIT(IEEE80211_STYPE_AUTH \u003e\u003e 4),\n+\t\t\tBIT(IEEE80211_STYPE_AUTH \u003e\u003e 4) |\n+\t\t\tBIT(IEEE80211_STYPE_BEACON \u003e\u003e 4),\n \t},\n \t[NL80211_IFTYPE_NAN_DATA] = {\n \t\t.tx = 0xffff,\ndiff --git a/net/mac80211/rx.c b/net/mac80211/rx.c\nindex f5893f9c07c67..1121e650b0dd5 100644\n--- a/net/mac80211/rx.c\n+++ b/net/mac80211/rx.c\n@@ -4687,7 +4687,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\n \t\t * Accept only frames that are addressed to the NAN cluster\n \t\t * (based on the Cluster ID). From these frames, accept only\n \t\t * - public action frames,\n-\t\t * - authentication frames to the local address, and\n+\t\t * - authentication frames to the local address,\n+\t\t * - NAN beacons, when Instant Communication is enabled, and\n \t\t * - robust management frames except disassoc.\n \t\t */\n \t\tif (!ether_addr_equal(sdata-\u003eu.nan.conf.cluster_id, hdr-\u003eaddr3))\n@@ -4697,6 +4698,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\n \t\tif (ieee80211_is_auth(hdr-\u003eframe_control) \u0026\u0026\n \t\t ether_addr_equal(sdata-\u003evif.addr, hdr-\u003eaddr1))\n \t\t\treturn true;\n+\t\tif (ieee80211_is_nan_beacon((struct ieee80211_mgmt *)hdr,\n+\t\t\t\t\t skb-\u003elen))\n+\t\t\treturn sdata-\u003eu.nan.conf.instant_comm;\n \t\tif (!ieee80211_is_disassoc(hdr-\u003eframe_control) \u0026\u0026\n \t\t ieee80211_is_robust_mgmt_frame(skb))\n \t\t\treturn true;\ndiff --git a/net/wireless/core.c b/net/wireless/core.c\nindex dc1e0522340a2..45a1709cffe7a 100644\n--- a/net/wireless/core.c\n+++ b/net/wireless/core.c\n@@ -964,6 +964,18 @@ int wiphy_register(struct wiphy *wiphy)\n \t\t (!wiphy-\u003enan_capa.phy.ht.ht_supported || wiphy-\u003en_radio \u003e 1)))\n \t\treturn -EINVAL;\n \n+\tif (WARN_ON((wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM) \u0026\u0026\n+\t\t !(wiphy-\u003enan_capa.flags \u0026\n+\t\t WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC)))\n+\t\treturn -EINVAL;\n+\n+\t/* Instant Communication requires user space to track NAN beacons */\n+\tif (WARN_ON((wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM) \u0026\u0026\n+\t\t (!wiphy-\u003emgmt_stypes ||\n+\t\t !(wiphy-\u003emgmt_stypes[NL80211_IFTYPE_NAN].rx \u0026\n+\t\t BIT(IEEE80211_STYPE_BEACON \u003e\u003e 4)))))\n+\t\treturn -EINVAL;\n+\n \tif (WARN_ON(wiphy-\u003einterface_modes \u0026 BIT(NL80211_IFTYPE_WDS)))\n \t\treturn -EINVAL;\n \ndiff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c\nindex a182404557e00..1944f001d8b00 100644\n--- a/net/wireless/nl80211.c\n+++ b/net/wireless/nl80211.c\n@@ -687,6 +687,7 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {\n \t[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL] =\n \t\tNLA_POLICY_RANGE(NLA_U8, 50, 200),\n \t[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },\n+\t[NL80211_NAN_CONF_INSTANT_COMM] = { .type = NLA_FLAG },\n };\n \n static const struct netlink_range_validation nl80211_punct_bitmap_range = {\n@@ -3036,6 +3037,10 @@ static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg)\n \t nla_put_flag(msg, NL80211_NAN_CAPA_USERSPACE_DE))\n \t\tgoto fail;\n \n+\tif ((wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM) \u0026\u0026\n+\t nla_put_flag(msg, NL80211_NAN_CAPA_INSTANT_COMM))\n+\t\tgoto fail;\n+\n \tif (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE,\n \t\t wiphy-\u003enan_capa.op_mode) ||\n \t nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS,\n@@ -16781,6 +16786,23 @@ static int nl80211_parse_nan_conf(struct wiphy *wiphy,\n \t\tconf-\u003eenable_dw_notification =\n \t\t\tnla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);\n \n+\tconf-\u003einstant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);\n+\tif (conf-\u003einstant_comm) {\n+\t\tif (!(wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM)) {\n+\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n+\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n+\t\t\t\t\t \"Instant Communication is not supported\");\n+\t\t\treturn -EOPNOTSUPP;\n+\t\t}\n+\n+\t\tif (!conf-\u003ediscovery_beacon_interval) {\n+\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n+\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n+\t\t\t\t\t \"Instant Communication requires a discovery beacon interval\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n out:\n \tif (!conf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan \u0026\u0026\n \t (!conf-\u003ebands || conf-\u003ebands \u0026 BIT(NL80211_BAND_5GHZ))) {\ndiff --git a/net/wireless/scan.c b/net/wireless/scan.c\nindex d35c826c4b1a7..b7c6c856b3c9f 100644\n--- a/net/wireless/scan.c\n+++ b/net/wireless/scan.c\n@@ -3338,6 +3338,10 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,\n \tif (WARN_ON(!wiphy))\n \t\treturn NULL;\n \n+\t/* NAN beacons are not a BSS, don't add to the BSS table */\n+\tif (ieee80211_is_nan_beacon(mgmt, len))\n+\t\treturn NULL;\n+\n \tBUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=\n \t\t offsetof(struct ieee80211_mgmt, u.beacon.variable));\n \n"
} |
| 2/1 | 2026/10/04 14:58 | agent | patch-evaluator |
1mModel:core Args: null Results: {
"EnableConfigs": [
"WLAN",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_start_nan",
"nl80211_nan_change_config",
"mac80211_hwsim_nan_start",
"mac80211_hwsim_nan_change_config",
"mac80211_hwsim_nan_stop",
"mac80211_hwsim_nan_receive",
"mac80211_hwsim_nan_rx",
"mac80211_hwsim_nan_discovery_beacon_timer",
"cfg80211_inform_bss_frame_data"
],
"Reasoning": "This patch implements Instant Communication (IC) mode support for Wi-Fi Aware (NAN) across cfg80211, mac80211, and the simulated mac80211_hwsim virtual driver. The changes introduce new netlink configuration attributes, modify beacon and frame reception/filtering paths, add parsing of variable NAN element attributes from skbs, introduce dynamic memory allocations for extra attributes, and add new runtime WARN_ON assertions in wiphy_register. Because mac80211_hwsim is a software-simulated device accessible via generic netlink (nl80211) in standard virtualized environments, these changes are fully reachable and warrant fuzzing.",
"WorthFuzzing": true
}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 2a3d7190068a49947f3a0f326b9c677f952f8317
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Oct 4 14:58:13 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 762f99eb15e4c..7e65474c9df15 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -1775,6 +1775,7 @@ struct tx_iter_data {
struct ieee80211_channel *channel;
struct ieee80211_rx_status *rx_status;
struct ieee80211_hw *hw;
+ struct sk_buff *skb;
bool receive;
};
@@ -1787,6 +1788,7 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,
if (vif->type == NL80211_IFTYPE_NAN ||
vif->type == NL80211_IFTYPE_NAN_DATA) {
data->receive = mac80211_hwsim_nan_receive(data->hw,
+ data->skb,
data->channel,
data->rx_status);
return;
@@ -1968,6 +1970,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
.hw = data2->hw,
.channel = chan,
.rx_status = &rx_status,
+ .skb = skb,
};
if (data == data2)
@@ -5841,7 +5844,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
BIT(NL80211_BAND_5GHZ);
hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
- WIPHY_NAN_FLAGS_USERSPACE_DE;
+ WIPHY_NAN_FLAGS_USERSPACE_DE |
+ WIPHY_NAN_FLAGS_INSTANT_COMM;
hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
NAN_OP_MODE_80P80MHZ |
NAN_OP_MODE_160MHZ;
@@ -6643,6 +6647,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
struct tx_iter_data iter_data = {
.hw = data2->hw,
.rx_status = &rx_status,
+ .skb = skb,
};
/* throw away off-channel packets, but allow both the temporary
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
index 2d9f6d7b92514..6f90856099e83 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
@@ -33,6 +33,12 @@ static_assert(DW0_TSF_MASK + 1 == 8192 * 1024);
#define NAN_RSSI_CLOSE (-60)
#define NAN_RSSI_MIDDLE (-75)
+/* Size of the NAN vendor element carrying the mandatory attributes */
+#define NAN_BEACON_ELEM_LEN 27
+
+/* Space left in the NAN vendor element for the configured attributes */
+#define NAN_BEACON_EXTRA_ATTRS_LEN (255 - (NAN_BEACON_ELEM_LEN - 2))
+
/* Quiet time at the end of each slot where TX is suppressed */
#define NAN_CHAN_SWITCH_TIME_US 256
@@ -213,6 +219,37 @@ mac80211_hwsim_nan_schedule_slot(struct mac80211_hwsim_data *data, u8 slot,
mac80211_hwsim_tsf_to_boottime(data, tsf));
}
+static bool hwsim_nan_beacon_has_service_ids(struct sk_buff *skb)
+{
+ const struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ const struct ieee80211_nan_attr *nan_attr;
+ const struct element *elem;
+ size_t len;
+
+ if (skb->len < offsetofend(struct ieee80211_mgmt, u.beacon) ||
+ !ieee80211_is_beacon(mgmt->frame_control))
+ return false;
+
+ len = skb->len - offsetofend(struct ieee80211_mgmt, u.beacon);
+
+ /* TODO: fragmented NAN elements are not supported */
+ for_each_element_id(elem, WLAN_EID_VENDOR_SPECIFIC,
+ mgmt->u.beacon.variable, len) {
+ if (elem->datalen < 4 ||
+ get_unaligned_be32(elem->data) !=
+ (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ continue;
+
+ for_each_nan_attr(nan_attr, elem->data + 4, elem->datalen - 4)
+ if (nan_attr->attr == NAN_ATTR_SERVICE_ID_LIST ||
+ nan_attr->attr ==
+ NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST)
+ return true;
+ }
+
+ return false;
+}
+
void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
struct sk_buff *skb)
{
@@ -230,9 +267,7 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
ssize_t data_len;
u8 slot;
- /* Need a NAN vendor element at the start */
- if (skb->len < (offsetofend(struct ieee80211_mgmt, u.beacon) + 6) ||
- !ieee80211_is_beacon(mgmt->frame_control))
+ if (!ieee80211_is_nan_beacon(mgmt, skb->len))
return;
data_len = skb->len - offsetofend(struct ieee80211_mgmt, u.beacon);
@@ -266,28 +301,34 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
}
/*
- * (overly) simplify things, only track 2.4 GHz here. Also, ignore
- * frames outside of the 2.4 GHz DW slot, unless in the initial SCAN
- * phase.
+ * Only sync on 2.4 GHz, which all NAN devices attend. The slot number
+ * is derived from the local TSF, so before being synchronized a 5 GHz
+ * beacon from a different device may fall into the local 2.4 GHz DW
+ * slot. Filter by frequency to keep such beacons out of master
+ * selection and synchronization.
*/
- if ((slot != SLOT_24GHZ_DW &&
- data->nan.phase != MAC80211_HWSIM_NAN_PHASE_SCAN) ||
- rx_status.freq != 2437)
+ if (rx_status.freq != 2437)
return;
- /* Just ignore low RSSI beacons that we cannot sync to */
- if (rx_status.signal < NAN_RSSI_MIDDLE)
- return;
+ /*
+ * Ignore frames outside of the 2.4 GHz DW slot, unless in the initial
+ * SCAN phase or in Instant Communication, where discovery beacons are
+ * received outside the DW.
+ */
+ if (slot != SLOT_24GHZ_DW) {
+ bool rx_outside_dw;
- /* Needs to be a valid NAN cluster ID in A3 */
- if (get_unaligned_be32(mgmt->bssid) != ((WLAN_OUI_WFA << 8) | 0x01))
- return;
+ scoped_guard(spinlock_bh, &data->nan.state_lock)
+ rx_outside_dw = data->nan.instant_comm ||
+ data->nan.phase ==
+ MAC80211_HWSIM_NAN_PHASE_SCAN;
- /* We are only interested in NAN beacons */
- if (nan_elem->id != WLAN_EID_VENDOR_SPECIFIC ||
- nan_elem->datalen < 4 ||
- get_unaligned_be32(nan_elem->data) !=
- (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ if (!rx_outside_dw)
+ return;
+ }
+
+ /* Just ignore low RSSI beacons that we cannot sync to */
+ if (rx_status.signal < NAN_RSSI_MIDDLE)
return;
u8 *nan_defragmented __free(kfree) = kzalloc(data_len, GFP_ATOMIC);
@@ -636,10 +677,12 @@ mac80211_hwsim_nan_exec_state_transitions(struct mac80211_hwsim_data *data)
/*
* The discovery beacon timer will stop automatically. Make sure it is
- * running if we are master. Do not bother with a proper alignment it
- * will sync itself to the TSF after the first TX.
+ * running if we are master or if Instant Communication is enabled. Do
+ * not bother with a proper alignment it will sync itself to the TSF
+ * after the first TX.
*/
- if (data->nan.role == MAC80211_HWSIM_NAN_ROLE_MASTER &&
+ if ((data->nan.role == MAC80211_HWSIM_NAN_ROLE_MASTER ||
+ data->nan.instant_comm) &&
!hrtimer_active(&data->nan.discovery_beacon_timer))
hrtimer_start(&data->nan.discovery_beacon_timer,
ns_to_ktime(10 * NSEC_PER_USEC),
@@ -698,7 +741,7 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
{
struct ieee80211_vendor_ie nan_ie = {
.element_id = WLAN_EID_VENDOR_SPECIFIC,
- .len = 27 - 2,
+ .len = NAN_BEACON_ELEM_LEN - 2,
.oui = { u32_get_bits(WLAN_OUI_WFA, 0xff0000),
u32_get_bits(WLAN_OUI_WFA, 0xff00),
u32_get_bits(WLAN_OUI_WFA, 0xff) },
@@ -707,23 +750,34 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
size_t alloc_size =
IEEE80211_TX_STATUS_HEADROOM +
offsetofend(struct ieee80211_mgmt, u.beacon) +
- 27 /* size of NAN vendor element */;
+ NAN_BEACON_ELEM_LEN;
struct ieee80211_nan_master_indication master_indication;
struct ieee80211_nan_attr nan_attr;
struct ieee80211_mgmt *mgmt;
struct sk_buff *skb;
/*
- * TODO: Should the configured vendor elements or NAN attributes be
- * included in some of these beacons?
+ * TODO: Should the configured vendor elements be included in some of
+ * these beacons?
*/
+ /* Allocate maximal size for NAN IE */
+ if (is_discovery)
+ alloc_size += NAN_BEACON_EXTRA_ATTRS_LEN;
+
skb = alloc_skb(alloc_size, GFP_ATOMIC);
if (!skb)
return;
spin_lock(&data->nan.state_lock);
+ /*
+ * The attributes configured by user space are appended to the
+ * mandatory ones.
+ */
+ if (is_discovery)
+ nan_ie.len += data->nan.extra_nan_attrs_len;
+
skb_reserve(skb, IEEE80211_TX_STATUS_HEADROOM);
mgmt = skb_put(skb, offsetofend(struct ieee80211_mgmt, u.beacon));
@@ -734,7 +788,9 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_BEACON);
- mgmt->u.beacon.beacon_int = cpu_to_le16(is_discovery ? 100 : DWST_TU);
+ mgmt->u.beacon.beacon_int =
+ cpu_to_le16(is_discovery ? data->nan.discovery_beacon_interval :
+ DWST_TU);
mgmt->u.beacon.capab_info =
cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME |
WLAN_CAPABILITY_SHORT_PREAMBLE);
@@ -765,6 +821,10 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
skb_put_data(skb, &data->nan.current_ami,
sizeof(data->nan.current_ami));
+ if (is_discovery && data->nan.extra_nan_attrs_len)
+ skb_put_data(skb, data->nan.extra_nan_attrs,
+ data->nan.extra_nan_attrs_len);
+
spin_unlock(&data->nan.state_lock);
mac80211_hwsim_tx_frame(data->hw, skb, channel);
@@ -877,7 +937,15 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)
return HRTIMER_NORESTART;
scoped_guard(spinlock, &data->nan.state_lock) {
- if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN ||
+ if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)
+ return HRTIMER_NORESTART;
+
+ /*
+ * With Instant Communication the discovery beacons are
+ * transmitted disregarding the role and the state, see
+ * Wi-Fi Aware version 4.0 section 13.
+ */
+ if (!data->nan.instant_comm &&
data->nan.role != MAC80211_HWSIM_NAN_ROLE_MASTER)
return HRTIMER_NORESTART;
}
@@ -894,10 +962,11 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)
tsf_now = mac80211_hwsim_get_tsf(data->hw, data->nan.device_vif);
/* Wrap value to be after the next TBTT */
- tbtt = tsf_now + ieee80211_tu_to_usec(100);
+ tbtt = tsf_now + ieee80211_tu_to_usec(data->nan.discovery_beacon_interval);
/* Round TBTT down to the correct time */
- div_u64_rem(tbtt, ieee80211_tu_to_usec(100), &remainder);
+ div_u64_rem(tbtt, ieee80211_tu_to_usec(data->nan.discovery_beacon_interval),
+ &remainder);
tbtt = tbtt - remainder;
hrtimer_set_expires(&data->nan.discovery_beacon_timer,
@@ -918,11 +987,51 @@ mac80211_hwsim_nan_sched_update_work(struct wiphy *wiphy,
ieee80211_nan_sched_update_done(data->nan.device_vif);
}
+static int mac80211_hwsim_nan_set_config(struct mac80211_hwsim_data *data,
+ struct cfg80211_nan_conf *conf)
+{
+ const u8 *extra_nan_attrs = NULL;
+ const u8 *old;
+
+ if (conf->extra_nan_attrs_len > NAN_BEACON_EXTRA_ATTRS_LEN)
+ return -EINVAL;
+
+ if (conf->extra_nan_attrs_len) {
+ extra_nan_attrs = kmemdup(conf->extra_nan_attrs,
+ conf->extra_nan_attrs_len,
+ GFP_KERNEL);
+ if (!extra_nan_attrs)
+ return -ENOMEM;
+ }
+
+ data->nan.notify_dw = conf->enable_dw_notification;
+
+ scoped_guard(spinlock_bh, &data->nan.state_lock) {
+ /*
+ * Fall back to the device default if user space did not
+ * configure it
+ */
+ data->nan.discovery_beacon_interval =
+ conf->discovery_beacon_interval ? : 100;
+
+ data->nan.instant_comm = conf->instant_comm;
+
+ old = data->nan.extra_nan_attrs;
+ data->nan.extra_nan_attrs = extra_nan_attrs;
+ data->nan.extra_nan_attrs_len = conf->extra_nan_attrs_len;
+ }
+
+ kfree(old);
+
+ return 0;
+}
+
int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_nan_conf *conf)
{
struct mac80211_hwsim_data *data = hw->priv;
+ int err;
if (vif->type != NL80211_IFTYPE_NAN)
return -EINVAL;
@@ -930,6 +1039,10 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
if (data->nan.device_vif)
return -EALREADY;
+ err = mac80211_hwsim_nan_set_config(data, conf);
+ if (err)
+ return err;
+
/* set this before starting the timer, as preemption might occur */
data->nan.device_vif = vif;
data->nan.bands = conf->bands;
@@ -938,9 +1051,13 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
mac80211_hwsim_nan_sched_update_work);
scoped_guard(spinlock_bh, &data->nan.state_lock) {
- /* Start in the "scan" phase and stay there for a little bit */
+ /*
+ * Start in the "scan" phase and stay there for a little bit,
+ * unless Instant Communication is configured, in which case an
+ * own cluster is started immediately.
+ */
data->nan.phase = MAC80211_HWSIM_NAN_PHASE_SCAN;
- data->nan.random_factor_valid_dwst = 1;
+ data->nan.random_factor_valid_dwst = conf->instant_comm ? 0 : 1;
data->nan.random_factor = 0;
data->nan.master_pref = conf->master_pref;
data->nan.role = MAC80211_HWSIM_NAN_ROLE_MASTER;
@@ -958,8 +1075,6 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
ether_addr_copy(data->nan.cluster_id, conf->cluster_id);
- data->nan.notify_dw = conf->enable_dw_notification;
-
return 0;
}
@@ -967,6 +1082,7 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct mac80211_hwsim_data *data = hw->priv;
+ const u8 *old;
if (vif->type != NL80211_IFTYPE_NAN || !data->nan.device_vif ||
data->nan.device_vif != vif)
@@ -978,6 +1094,15 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,
wiphy_delayed_work_cancel(hw->wiphy, &data->nan.sched_update_work);
data->nan.device_vif = NULL;
+ scoped_guard(spinlock_bh, &data->nan.state_lock) {
+ old = data->nan.extra_nan_attrs;
+ data->nan.extra_nan_attrs = NULL;
+ data->nan.extra_nan_attrs_len = 0;
+ data->nan.instant_comm = false;
+ }
+
+ kfree(old);
+
return 0;
}
@@ -996,13 +1121,27 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,
wiphy_debug(hw->wiphy, "nan_config_changed: changes=0x%x\n", changes);
+ if (changes & CFG80211_NAN_CONF_CHANGED_CONFIG) {
+ int err = mac80211_hwsim_nan_set_config(data, conf);
+
+ if (err)
+ return err;
+
+ /*
+ * When Instant Communication is enabled discovery beacons are
+ * transmitted regardless of the role and the state.
+ */
+ if (conf->instant_comm &&
+ !hrtimer_active(&data->nan.discovery_beacon_timer))
+ hrtimer_start(&data->nan.discovery_beacon_timer,
+ ns_to_ktime(10 * NSEC_PER_USEC),
+ HRTIMER_MODE_REL_SOFT);
+ }
+
/* Handle only the changes we care about for simulation purposes */
if (changes & CFG80211_NAN_CONF_CHANGED_BANDS)
data->nan.bands = conf->bands;
- if (changes & CFG80211_NAN_CONF_CHANGED_CONFIG)
- data->nan.notify_dw = conf->enable_dw_notification;
-
if (changes & CFG80211_NAN_CONF_CHANGED_PREF) {
scoped_guard(spinlock_bh, &data->nan.state_lock)
data->nan.master_pref = conf->master_pref;
@@ -1185,9 +1324,16 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,
is_dw_slot = mac80211_hwsim_nan_is_dw_slot(data, slot);
if (!txq->sta) {
- /* Non-STA TXQ: allow management frames during DW */
- if (txq->vif->type == NL80211_IFTYPE_NAN)
- return is_dw_slot;
+ /* Non-STA TXQ: allow management frames during DW or IC */
+ if (txq->vif->type == NL80211_IFTYPE_NAN) {
+ if (is_dw_slot)
+ return true;
+
+ /* Outside the DW the local schedule must allow it */
+ guard(spinlock_bh)(&data->nan.state_lock);
+ return data->nan.instant_comm &&
+ data->nan.local_sched[slot].chan;
+ }
/* Allow multicast data when all the peers are available
* on this slot
@@ -1240,15 +1386,32 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,
}
bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,
+ struct sk_buff *skb,
struct ieee80211_channel *channel,
struct ieee80211_rx_status *rx_status)
{
struct mac80211_hwsim_data *data = hw->priv;
+ bool instant_comm;
u8 slot;
if (WARN_ON_ONCE(!data->nan.device_vif))
return false;
+ scoped_guard(spinlock_bh, &data->nan.state_lock)
+ instant_comm = data->nan.instant_comm;
+
+ /*
+ * During Instant Communication a peer advertises its services in the
+ * discovery beacons, which are transmitted disregarding the roles and
+ * the states, see Section 13 in Wi-Fi Aware v4.0.
+ * Note that while according to the specification Instant communication
+ * should be enabled only on the NAN discovery channels, do not force
+ * this here, and allow receiving NAN frames on any channel if Instant
+ * Communication is enabled.
+ */
+ if (instant_comm && hwsim_nan_beacon_has_service_ids(skb))
+ return true;
+
if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)
return channel->center_freq == 2437;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
index 2801a1d8dcf07..0684f9b823baf 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
@@ -32,6 +32,9 @@ struct mac80211_hwsim_nan_data {
/* Later members are protected by this lock */
spinlock_t state_lock;
+ const u8 *extra_nan_attrs;
+ u16 extra_nan_attrs_len;
+
u8 master_pref;
u8 random_factor;
@@ -53,6 +56,9 @@ struct mac80211_hwsim_nan_data {
bool tsf_adjusted;
bool tsf_discontinuity;
+ bool instant_comm;
+ u8 discovery_beacon_interval;
+
/*
* Local schedule - stores channel definition for each 16TU slot.
* Derived from NMI vif->cfg.nan_schedule. chan == NULL means not
@@ -93,6 +99,7 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef);
bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,
+ struct sk_buff *skb,
struct ieee80211_channel *channel,
struct ieee80211_rx_status *rx_status);
diff --git a/include/linux/ieee80211-nan.h b/include/linux/ieee80211-nan.h
index 455033955e545..7815a6cf81605 100644
--- a/include/linux/ieee80211-nan.h
+++ b/include/linux/ieee80211-nan.h
@@ -40,6 +40,8 @@
/* NAN attributes, as defined in Wi-Fi Aware (TM) specification 4.0 Table 42 */
#define NAN_ATTR_MASTER_INDICATION 0x00
#define NAN_ATTR_CLUSTER_INFO 0x01
+#define NAN_ATTR_SERVICE_ID_LIST 0x02
+#define NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST 0x28
struct ieee80211_nan_attr {
u8 attr;
@@ -74,4 +76,30 @@ struct ieee80211_nan_anchor_master_info {
_attr = (const struct ieee80211_nan_attr *) \
(_attr->data + le16_to_cpu(_attr->length)))
+static inline bool ieee80211_is_nan_beacon(const struct ieee80211_mgmt *mgmt,
+ size_t len)
+{
+ const struct element *elem;
+
+ /* The NAN IE is at least 6 octets */
+ if (len < offsetofend(struct ieee80211_mgmt, u.beacon) + 6)
+ return false;
+
+ if (!ieee80211_is_beacon(mgmt->frame_control))
+ return false;
+
+ /* NAN Cluster IDs range from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF */
+ if (get_unaligned_be32(mgmt->bssid) != ((WLAN_OUI_WFA << 8) | 0x01))
+ return false;
+
+ elem = (const struct element *)mgmt->u.beacon.variable;
+ if (elem->id != WLAN_EID_VENDOR_SPECIFIC ||
+ elem->datalen < 4 ||
+ get_unaligned_be32(elem->data) !=
+ (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ return false;
+
+ return true;
+}
+
#endif /* LINUX_IEEE80211_NAN_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b603f1804cc26..96b5bf8b8ff38 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4191,9 +4191,12 @@ struct cfg80211_nan_band_config {
* that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.
* @scan_period: period (in seconds) between NAN scans.
* @scan_dwell_time: dwell time (in milliseconds) for NAN scans.
- * @discovery_beacon_interval: interval (in TUs) for discovery beacons.
+ * @discovery_beacon_interval: interval (in TUs) for discovery beacons. Must be
+ * greater than 0 when @instant_comm is true.
* @enable_dw_notification: flag to enable/disable discovery window
* notifications.
+ * @instant_comm: if true, start Instant Communication (IC) as defined in
+ * Chapter 13 of the Wi-Fi Aware Specification v4.0.
* @band_cfgs: array of band specific configurations, indexed by
* &enum nl80211_band values.
* @extra_nan_attrs: pointer to additional NAN attributes.
@@ -4209,6 +4212,7 @@ struct cfg80211_nan_conf {
u16 scan_dwell_time;
u8 discovery_beacon_interval;
bool enable_dw_notification;
+ bool instant_comm;
struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];
const u8 *extra_nan_attrs;
u16 extra_nan_attrs_len;
@@ -6305,10 +6309,13 @@ struct wiphy_radio {
* @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable
* synchronization.
* @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.
+ * @WIPHY_NAN_FLAGS_INSTANT_COMM: Device can switch to Instant Communication
+ * (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC.
*/
enum wiphy_nan_flags {
WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),
WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),
+ WIPHY_NAN_FLAGS_INSTANT_COMM = BIT(2),
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 75d4c5d6a7a32..21d98c1ec424c 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -7890,6 +7890,11 @@ enum nl80211_nan_band_conf_attributes {
* the upcoming discovery window with
* %NL80211_CMD_NAN_NEXT_DW_NOTIFICATION.
* This is a flag attribute.
+ * @NL80211_NAN_CONF_INSTANT_COMM: If set, the NAN synchronization logic will
+ * start Instant Communication (IC) as defined in Chapter 13 of the
+ * Wi-Fi Aware Specification v4.0.
+ * %NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL must be set as well.
+ * This is a flag attribute.
* @NUM_NL80211_NAN_CONF_ATTR: Internal.
* @NL80211_NAN_CONF_ATTR_MAX: Highest NAN configuration attribute.
*
@@ -7905,6 +7910,7 @@ enum nl80211_nan_conf_attributes {
NL80211_NAN_CONF_SCAN_DWELL_TIME,
NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL,
NL80211_NAN_CONF_NOTIFY_DW,
+ NL80211_NAN_CONF_INSTANT_COMM,
/* keep last */
NUM_NL80211_NAN_CONF_ATTR,
@@ -9121,6 +9127,11 @@ enum nl80211_s1g_short_beacon_attrs {
* specification Table 79 (Capabilities field).
* @NL80211_NAN_CAPA_PHY: nested attribute containing band-agnostic
* capabilities for NAN data path. See &enum nl80211_nan_phy_cap_attr.
+ * @NL80211_NAN_CAPA_INSTANT_COMM: Flag attribute indicating that the device
+ * can switch to Instant Communication (IC) mode, as defined in Chapter 13
+ * of the Wi-Fi Aware Specification v4.0. Can only be set if
+ * %NL80211_NAN_CAPA_CONFIGURABLE_SYNC is set. When IC is enabled, the IC
+ * schedule is expected to be configured by user space.
* @__NL80211_NAN_CAPABILITIES_LAST: Internal
* @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute.
*/
@@ -9134,6 +9145,7 @@ enum nl80211_nan_capabilities {
NL80211_NAN_CAPA_MAX_CHANNEL_SWITCH_TIME,
NL80211_NAN_CAPA_CAPABILITIES,
NL80211_NAN_CAPA_PHY,
+ NL80211_NAN_CAPA_INSTANT_COMM,
/* keep last */
__NL80211_NAN_CAPABILITIES_LAST,
NL80211_NAN_CAPABILITIES_MAX = __NL80211_NAN_CAPABILITIES_LAST - 1,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bd1a857c812d4..eeab1b515e774 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -368,6 +368,7 @@ static int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,
dst->discovery_beacon_interval =
src->discovery_beacon_interval;
dst->enable_dw_notification = src->enable_dw_notification;
+ dst->instant_comm = src->instant_comm;
memcpy(&dst->band_cfgs, &src->band_cfgs,
sizeof(dst->band_cfgs));
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 7816395681fa4..b889d2a7ef751 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -745,8 +745,13 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
},
[NL80211_IFTYPE_NAN] = {
.tx = 0xffff,
+ /*
+ * Beacon Rx registration is needed to let user space handle
+ * service discovery when Instant Communication is enabled.
+ */
.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4),
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_BEACON >> 4),
},
[NL80211_IFTYPE_NAN_DATA] = {
.tx = 0xffff,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f5893f9c07c67..1121e650b0dd5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4687,7 +4687,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
* Accept only frames that are addressed to the NAN cluster
* (based on the Cluster ID). From these frames, accept only
* - public action frames,
- * - authentication frames to the local address, and
+ * - authentication frames to the local address,
+ * - NAN beacons, when Instant Communication is enabled, and
* - robust management frames except disassoc.
*/
if (!ether_addr_equal(sdata->u.nan.conf.cluster_id, hdr->addr3))
@@ -4697,6 +4698,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
if (ieee80211_is_auth(hdr->frame_control) &&
ether_addr_equal(sdata->vif.addr, hdr->addr1))
return true;
+ if (ieee80211_is_nan_beacon((struct ieee80211_mgmt *)hdr,
+ skb->len))
+ return sdata->u.nan.conf.instant_comm;
if (!ieee80211_is_disassoc(hdr->frame_control) &&
ieee80211_is_robust_mgmt_frame(skb))
return true;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index dc1e0522340a2..45a1709cffe7a 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -964,6 +964,18 @@ int wiphy_register(struct wiphy *wiphy)
(!wiphy->nan_capa.phy.ht.ht_supported || wiphy->n_radio > 1)))
return -EINVAL;
+ if (WARN_ON((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ !(wiphy->nan_capa.flags &
+ WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC)))
+ return -EINVAL;
+
+ /* Instant Communication requires user space to track NAN beacons */
+ if (WARN_ON((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ (!wiphy->mgmt_stypes ||
+ !(wiphy->mgmt_stypes[NL80211_IFTYPE_NAN].rx &
+ BIT(IEEE80211_STYPE_BEACON >> 4)))))
+ return -EINVAL;
+
if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
return -EINVAL;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a182404557e00..1944f001d8b00 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -687,6 +687,7 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL] =
NLA_POLICY_RANGE(NLA_U8, 50, 200),
[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },
+ [NL80211_NAN_CONF_INSTANT_COMM] = { .type = NLA_FLAG },
};
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
@@ -3036,6 +3037,10 @@ static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg)
nla_put_flag(msg, NL80211_NAN_CAPA_USERSPACE_DE))
goto fail;
+ if ((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ nla_put_flag(msg, NL80211_NAN_CAPA_INSTANT_COMM))
+ goto fail;
+
if (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE,
wiphy->nan_capa.op_mode) ||
nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS,
@@ -16781,6 +16786,23 @@ static int nl80211_parse_nan_conf(struct wiphy *wiphy,
conf->enable_dw_notification =
nla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);
+ conf->instant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);
+ if (conf->instant_comm) {
+ if (!(wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM)) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ attrs[NL80211_NAN_CONF_INSTANT_COMM],
+ "Instant Communication is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (!conf->discovery_beacon_interval) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ attrs[NL80211_NAN_CONF_INSTANT_COMM],
+ "Instant Communication requires a discovery beacon interval");
+ return -EINVAL;
+ }
+ }
+
out:
if (!conf->band_cfgs[NL80211_BAND_5GHZ].chan &&
(!conf->bands || conf->bands & BIT(NL80211_BAND_5GHZ))) {
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index d35c826c4b1a7..b7c6c856b3c9f 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3338,6 +3338,10 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
if (WARN_ON(!wiphy))
return NULL;
+ /* NAN beacons are not a BSS, don't add to the BSS table */
+ if (ieee80211_is_nan_beacon(mgmt, len))
+ return NULL;
+
BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=
offsetof(struct ieee80211_mgmt, u.beacon.variable));
|
| 3/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15159 output: 38 thoughts: 437 Thoughts: **Fuzzing Suitability Evaluation** Okay, let's assess if this patch series is a good candidate for syzkaller fuzzing. The key, as always, is reachability. I need to determine if the modified code is accessible within a standard syzkaller environment. The primary guideline here is that syzkaller thrives in environments with emulated devices like USB gadgets, netdev, tun/tap, and, importantly, `mac80211_hwsim`. And bingo! `mac80211_hwsim` is explicitly mentioned. It's a software simulator for 802.11, meaning it's fully virtualized and emulated, which aligns perfectly with syzkaller's strengths. We know syzkaller *actively* fuzzes `nl80211` and `mac80211_hwsim`, so that's a huge green flag. Now, let's dig into the details. I see a list of modified files: `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, `drivers/net/wireless/virtual/mac80211_hwsim_nan.c`, `drivers/net/wireless/virtual/mac80211_hwsim_nan.h`, `include/linux/ieee80211-nan.h`, `include/net/cfg80211.h`, `include/uapi/linux/nl80211.h`, `net/mac80211/cfg.c`, `net/mac80211/main.c`, `net/mac80211/rx.c`, `net/wireless/core.c`, `net/wireless/nl80211.c`, and `net/wireless/scan.c`. Looks like a lot of activity within the wireless stack. I need to verify what configurations are required and what specific functions are touched within these files. To get that information, I'll need to run `grepper` or scan the Kconfig files for `mac80211_hwsim`, `mac80211`, and `cfg80211`. That should give me a clearer picture of the code paths this patch series modifies and if the modules it touches can be enabled/loaded within the standard syzkaller setup. |
| 4/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211_HWSIM",
"PathPrefix": "drivers/net/wireless/virtual"
}Results: {
"Output": "drivers/net/wireless/virtual/Kconfig:1:config MAC80211_HWSIM\ndrivers/net/wireless/virtual/Kconfig-2-\ttristate \"Simulated radio testing tool for mac80211\"\n"
} |
| 5/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16223 output: 36 thoughts: 16 Thoughts: Here's a summary of my thought process, as requested: **Kconfig Dive** Alright, time to dive in. My immediate thought is to check the `drivers/net/wireless/virtual/Kconfig` file. That's the logical starting point for understanding the configuration options related to virtual wireless interfaces within this kernel tree. I'm going to want to understand what features are enabled, what dependencies exist, and how the various virtual wireless functionalities are controlled via the build system. This Kconfig file should be the central point to begin untangling all of that. |
| 6/2 | 2026/10/04 14:58 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/Kconfig",
"FirstLine": 1,
"LineCount": 40
}Results: {
"Contents": " 1:\tconfig MAC80211_HWSIM\n 2:\t\ttristate \"Simulated radio testing tool for mac80211\"\n 3:\t\tdepends on MAC80211\n 4:\t\thelp\n 5:\t\t This driver is a developer testing tool that can be used to test\n 6:\t\t IEEE 802.11 networking stack (mac80211) functionality. This is not\n 7:\t\t needed for normal wireless LAN usage and is only for testing. See\n 8:\t\t Documentation/networking/mac80211_hwsim for more information on how\n 9:\t\t to use this tool.\n 10:\t\n 11:\t\t To compile this driver as a module, choose M here: the module will be\n 12:\t\t called mac80211_hwsim. If unsure, say N.\n 13:\t\n 14:\tconfig VIRT_WIFI\n 15:\t\ttristate \"Wifi wrapper for ethernet drivers\"\n 16:\t\tdepends on CFG80211\n 17:\t\thelp\n 18:\t\t This option adds support for ethernet connections to appear as if they\n 19:\t\t are wifi connections through a special rtnetlink device.\n 20:\t\n"
} |
| 7/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16719 output: 37 thoughts: 27 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Diving into the 802.11 Core Configuration** Alright, before I get too deep into this problem, I want to get a lay of the land, specifically regarding the kernel configuration options related to 802.11. My first step is to revisit the `MAC80211` and `CFG80211` Kconfig files. I need to refresh my mental map of which features are enabled, disabled, and conditionally compiled. The interplay between these two is critical, and I want to quickly evaluate which options might be relevant to the issue I'm troubleshooting, or the feature I'm implementing. I need to understand what's possible and what's enabled by default. Given the complexities of modern wireless stacks, it is often useful to check these config options when working on a specific issue. Let's see what we're working with here. I'll start with the high-level defaults and then zoom in on anything that jumps out. |
| 8/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211\\b",
"PathPrefix": "net/mac80211"
}Results: {
"Output": "net/mac80211/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nnet/mac80211/Kconfig:2:config MAC80211\nnet/mac80211/Kconfig-3-\ttristate \"Generic IEEE 802.11 Networking Stack (mac80211)\"\n"
} |
| 9/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17111 output: 37 thoughts: 26 Thoughts: Here's a summary of my thought process, as requested: **Diving into `net/mac80211/Kconfig` Dependencies** Okay, time to get a grip on the `net/mac80211/Kconfig` file. I need to understand its dependencies, specifically focusing on the initial lines, roughly lines 1-30. I'm thinking, this is probably where the core configuration options are defined, or perhaps the initial dependencies are set up for the entire mac80211 wireless subsystem. I'm going to scan that section carefully, looking for anything that might be crucial to overall build configurations or that impacts other subsystems. I'll be keeping an eye out for any obvious boolean options, tristates, or any conditionals that are acting as gatekeepers for larger features. I'm expecting some standard Kconfig syntax, but I'll also be watching for anything unusual or particularly clever. Let's see what's what. |
| 10/2 | 2026/10/04 14:58 | tool | read-file |
0mArgs:{
"File": "net/mac80211/Kconfig",
"FirstLine": 1,
"LineCount": 30
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\tconfig MAC80211\n 3:\t\ttristate \"Generic IEEE 802.11 Networking Stack (mac80211)\"\n 4:\t\tdepends on CFG80211\n 5:\t\tselect CRYPTO\n 6:\t\tselect CRYPTO_LIB_AES_CBC_MACS\n 7:\t\tselect CRYPTO_LIB_ARC4\n 8:\t\tselect CRYPTO_AES\n 9:\t\tselect CRYPTO_CCM\n 10:\t\tselect CRYPTO_GCM\n 11:\t\tselect CRC32\n 12:\t\thelp\n 13:\t\t This option enables the hardware independent IEEE 802.11\n 14:\t\t networking stack.\n 15:\t\n 16:\tcomment \"CFG80211 needs to be enabled for MAC80211\"\n 17:\t\tdepends on CFG80211=n\n 18:\t\n 19:\tif MAC80211 != n\n 20:\t\n 21:\tconfig MAC80211_HAS_RC\n 22:\t\tbool\n 23:\t\n 24:\tconfig MAC80211_RC_MINSTREL\n 25:\t\tbool \"Minstrel\" if EXPERT\n 26:\t\tselect MAC80211_HAS_RC\n 27:\t\tdefault y\n 28:\t\thelp\n 29:\t\t This option enables the 'minstrel' TX rate control algorithm\n 30:\t\n"
} |
| 11/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17784 output: 17 thoughts: 66 Thoughts: Okay, here's my summary, presented as a stream of thought: **Dependency Chain and Search for NAN Configurations** Alright, let's see, it looks like `MAC80211` hinges on `CFG80211`. That makes sense. And as I suspected, `MAC80211_HWSIM` needs `MAC80211` itself, the base driver. Good, good, dependency chain checks out. Now, what else is relevant in this area? I'm specifically interested in any configurations related to NAN, or anything closely related to that. Time to delve into the Kconfig files. I'll search for "NAN" – that should be a decent starting point. Let's see what pops up. |
| 12/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config .*NAN"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 427 lines.\nUse more precise expression if possible.\n\ndrivers/edac/Kconfig=417=config EDAC_ALTERA_ETHERNET\n--\ndrivers/edac/Kconfig-423-\ndrivers/edac/Kconfig:424:config EDAC_ALTERA_NAND\ndrivers/edac/Kconfig-425-\tbool \"Altera NAND FIFO ECC\"\n--\ndrivers/gpu/drm/amd/amdgpu/gfx_v6_0.c=1652=static void gfx_v6_0_constants_init(struct amdgpu_device *adev)\n--\ndrivers/gpu/drm/amd/amdgpu/gfx_v6_0.c-1743-\t\tadev-\u003egfx.config.sc_earlyz_tile_fifo_size = 0x130;\ndrivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:1744:\t\tgb_addr_config = HAINAN_GB_ADDR_CONFIG_GOLDEN;\ndrivers/gpu/drm/amd/amdgpu/gfx_v6_0.c-1745-\t\tbreak;\n--\ndrivers/gpu/drm/radeon/si.c=3069=static void si_gpu_init(struct radeon_device *rdev)\n--\ndrivers/gpu/drm/radeon/si.c-3162-\t\trdev-\u003econfig.si.sc_earlyz_tile_fifo_size = 0x130;\ndrivers/gpu/drm/radeon/si.c:3163:\t\tgb_addr_config = HAINAN_GB_ADDR_CONFIG_GOLDEN;\ndrivers/gpu/drm/radeon/si.c-3164-\t\tbreak;\n--\ndrivers/mtd/nand/Kconfig=3=menu \"NAND\"\ndrivers/mtd/nand/Kconfig-4-\ndrivers/mtd/nand/Kconfig:5:config MTD_NAND_CORE\ndrivers/mtd/nand/Kconfig-6-\ttristate\n--\ndrivers/mtd/nand/Kconfig=12=menu \"ECC engine support\"\ndrivers/mtd/nand/Kconfig-13-\ndrivers/mtd/nand/Kconfig:14:config MTD_NAND_ECC\ndrivers/mtd/nand/Kconfig-15- bool\n--\ndrivers/mtd/nand/Kconfig-17-\ndrivers/mtd/nand/Kconfig:18:config MTD_NAND_ECC_SW_HAMMING\ndrivers/mtd/nand/Kconfig-19-\tbool \"Software Hamming ECC engine\"\n--\ndrivers/mtd/nand/Kconfig-29-\ndrivers/mtd/nand/Kconfig:30:config MTD_NAND_ECC_SW_HAMMING_SMC\ndrivers/mtd/nand/Kconfig-31-\tbool \"NAND ECC Smart Media byte order\"\n--\ndrivers/mtd/nand/Kconfig-37-\ndrivers/mtd/nand/Kconfig:38:config MTD_NAND_ECC_SW_BCH\ndrivers/mtd/nand/Kconfig-39-\tbool \"Software BCH ECC engine\"\n--\ndrivers/mtd/nand/Kconfig-48-\ndrivers/mtd/nand/Kconfig:49:config MTD_NAND_ECC_MXIC\ndrivers/mtd/nand/Kconfig-50-\tbool \"Macronix external hardware ECC engine\"\n--\ndrivers/mtd/nand/Kconfig-55-\ndrivers/mtd/nand/Kconfig:56:config MTD_NAND_ECC_MEDIATEK\ndrivers/mtd/nand/Kconfig-57-\ttristate \"Mediatek hardware ECC engine\"\n--\ndrivers/mtd/nand/Kconfig-63-\ndrivers/mtd/nand/Kconfig:64:config MTD_NAND_ECC_REALTEK\ndrivers/mtd/nand/Kconfig-65- tristate \"Realtek RTL93xx hardware ECC engine\"\n--\ndrivers/mtd/nand/onenand/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\ndrivers/mtd/nand/onenand/Kconfig:2:menuconfig MTD_ONENAND\ndrivers/mtd/nand/onenand/Kconfig-3-\ttristate \"OneNAND Device Support\"\n--\ndrivers/mtd/nand/onenand/Kconfig=9=if MTD_ONENAND\ndrivers/mtd/nand/onenand/Kconfig-10-\ndrivers/mtd/nand/onenand/Kconfig:11:config MTD_ONENAND_VERIFY_WRITE\ndrivers/mtd/nand/onenand/Kconfig-12-\tbool \"Verify OneNAND page writes\"\n--\ndrivers/mtd/nand/onenand/Kconfig-19-\ndrivers/mtd/nand/onenand/Kconfig:20:config MTD_ONENAND_GENERIC\ndrivers/mtd/nand/onenand/Kconfig-21-\ttristate \"OneNAND Flash device via platform device driver\"\n--\ndrivers/mtd/nand/onenand/Kconfig-24-\ndrivers/mtd/nand/onenand/Kconfig:25:config MTD_ONENAND_OMAP2\ndrivers/mtd/nand/onenand/Kconfig-26-\ttristate \"OneNAND on OMAP2/OMAP3 support\"\n--\ndrivers/mtd/nand/onenand/Kconfig-34-\ndrivers/mtd/nand/onenand/Kconfig:35:config MTD_ONENAND_SAMSUNG\ndrivers/mtd/nand/onenand/Kconfig-36-\ttristate \"OneNAND on Samsung SOC controller support\"\n--\ndrivers/mtd/nand/onenand/Kconfig-43-\ndrivers/mtd/nand/onenand/Kconfig:44:config MTD_ONENAND_OTP\ndrivers/mtd/nand/onenand/Kconfig-45-\tbool \"OneNAND OTP Support\"\n--\ndrivers/mtd/nand/onenand/Kconfig-56-\ndrivers/mtd/nand/onenand/Kconfig:57:config MTD_ONENAND_2X_PROGRAM\ndrivers/mtd/nand/onenand/Kconfig-58-\tbool \"OneNAND 2X program support\"\n--\ndrivers/mtd/nand/raw/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\ndrivers/mtd/nand/raw/Kconfig:2:menuconfig MTD_RAW_NAND\ndrivers/mtd/nand/raw/Kconfig-3-\ttristate \"Raw/Parallel NAND Device Support\"\n--\ndrivers/mtd/nand/raw/Kconfig=13=comment \"Raw/parallel NAND flash controllers\"\ndrivers/mtd/nand/raw/Kconfig-14-\ndrivers/mtd/nand/raw/Kconfig:15:config MTD_NAND_DENALI\ndrivers/mtd/nand/raw/Kconfig-16-\ttristate\ndrivers/mtd/nand/raw/Kconfig-17-\ndrivers/mtd/nand/raw/Kconfig:18:config MTD_NAND_DENALI_PCI\ndrivers/mtd/nand/raw/Kconfig-19-\ttristate \"Denali NAND controller on Intel Moorestown\"\n--\ndrivers/mtd/nand/raw/Kconfig-25-\ndrivers/mtd/nand/raw/Kconfig:26:config MTD_NAND_DENALI_DT\ndrivers/mtd/nand/raw/Kconfig-27-\ttristate \"Denali NAND controller as a DT device\"\n--\ndrivers/mtd/nand/raw/Kconfig-33-\ndrivers/mtd/nand/raw/Kconfig:34:config MTD_NAND_AMS_DELTA\ndrivers/mtd/nand/raw/Kconfig-35-\ttristate \"Amstrad E3 NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-40-\ndrivers/mtd/nand/raw/Kconfig:41:config MTD_NAND_OMAP2\ndrivers/mtd/nand/raw/Kconfig-42-\ttristate \"OMAP2, OMAP3, OMAP4 and Keystone NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-49-\ndrivers/mtd/nand/raw/Kconfig:50:config MTD_NAND_OMAP_BCH\ndrivers/mtd/nand/raw/Kconfig-51-\tdepends on MTD_NAND_OMAP2\n--\ndrivers/mtd/nand/raw/Kconfig-61-\ndrivers/mtd/nand/raw/Kconfig:62:config MTD_NAND_OMAP_BCH_BUILD\ndrivers/mtd/nand/raw/Kconfig-63-\tdef_tristate MTD_NAND_OMAP2 \u0026\u0026 MTD_NAND_OMAP_BCH\ndrivers/mtd/nand/raw/Kconfig-64-\ndrivers/mtd/nand/raw/Kconfig:65:config MTD_NAND_AU1550\ndrivers/mtd/nand/raw/Kconfig-66-\ttristate \"Au1550/1200 NAND support\"\n--\ndrivers/mtd/nand/raw/Kconfig-71-\ndrivers/mtd/nand/raw/Kconfig:72:config MTD_NAND_NDFC\ndrivers/mtd/nand/raw/Kconfig-73-\ttristate \"IBM/MCC 4xx NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-80-\ndrivers/mtd/nand/raw/Kconfig:81:config MTD_NAND_SHARPSL\ndrivers/mtd/nand/raw/Kconfig-82-\ttristate \"Sharp SL Series (C7xx + others) NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-85-\ndrivers/mtd/nand/raw/Kconfig:86:config MTD_NAND_CAFE\ndrivers/mtd/nand/raw/Kconfig-87-\ttristate \"OLPC CAFÉ NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-94-\ndrivers/mtd/nand/raw/Kconfig:95:config MTD_NAND_CS553X\ndrivers/mtd/nand/raw/Kconfig-96-\ttristate \"CS5535/CS5536 (AMD Geode companion) NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-108-\ndrivers/mtd/nand/raw/Kconfig:109:config MTD_NAND_ATMEL\ndrivers/mtd/nand/raw/Kconfig-110-\ttristate \"Atmel AT91 NAND Flash/SmartMedia NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-118-\ndrivers/mtd/nand/raw/Kconfig:119:config MTD_NAND_ORION\ndrivers/mtd/nand/raw/Kconfig-120-\ttristate \"Marvell Orion NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-127-\ndrivers/mtd/nand/raw/Kconfig:128:config MTD_NAND_MARVELL\ndrivers/mtd/nand/raw/Kconfig-129-\ttristate \"Marvell EBU NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-139-\ndrivers/mtd/nand/raw/Kconfig:140:config MTD_NAND_SLC_LPC32XX\ndrivers/mtd/nand/raw/Kconfig-141-\ttristate \"NXP LPC32xx SLC NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-151-\ndrivers/mtd/nand/raw/Kconfig:152:config MTD_NAND_MLC_LPC32XX\ndrivers/mtd/nand/raw/Kconfig-153-\ttristate \"NXP LPC32xx MLC NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-163-\ndrivers/mtd/nand/raw/Kconfig:164:config MTD_NAND_PASEMI\ndrivers/mtd/nand/raw/Kconfig-165-\ttristate \"PA Semi PWRficient NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig=171=source \"drivers/mtd/nand/raw/brcmnand/Kconfig\"\ndrivers/mtd/nand/raw/Kconfig-172-\ndrivers/mtd/nand/raw/Kconfig:173:config MTD_NAND_BCM47XXNFLASH\ndrivers/mtd/nand/raw/Kconfig-174-\ttristate \"BCM4706 BCMA NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-181-\ndrivers/mtd/nand/raw/Kconfig:182:config MTD_NAND_MPC5121_NFC\ndrivers/mtd/nand/raw/Kconfig-183-\ttristate \"MPC5121 NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-188-\ndrivers/mtd/nand/raw/Kconfig:189:config MTD_NAND_GPMI_NAND\ndrivers/mtd/nand/raw/Kconfig-190-\ttristate \"Freescale GPMI NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-197-\ndrivers/mtd/nand/raw/Kconfig:198:config MTD_NAND_FSL_ELBC\ndrivers/mtd/nand/raw/Kconfig-199-\ttristate \"Freescale eLBC NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-207-\ndrivers/mtd/nand/raw/Kconfig:208:config MTD_NAND_FSL_IFC\ndrivers/mtd/nand/raw/Kconfig-209-\ttristate \"Freescale IFC NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-218-\ndrivers/mtd/nand/raw/Kconfig:219:config MTD_NAND_FSL_UPM\ndrivers/mtd/nand/raw/Kconfig-220-\ttristate \"Freescale UPM NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-226-\ndrivers/mtd/nand/raw/Kconfig:227:config MTD_NAND_VF610_NFC\ndrivers/mtd/nand/raw/Kconfig-228-\ttristate \"Freescale VF610/MPC5125 NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-238-\ndrivers/mtd/nand/raw/Kconfig:239:config MTD_NAND_MXC\ndrivers/mtd/nand/raw/Kconfig-240-\ttristate \"Freescale MXC NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-246-\ndrivers/mtd/nand/raw/Kconfig:247:config MTD_NAND_SH_FLCTL\ndrivers/mtd/nand/raw/Kconfig-248-\ttristate \"Renesas SuperH FLCTL NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-254-\ndrivers/mtd/nand/raw/Kconfig:255:config MTD_NAND_DAVINCI\ndrivers/mtd/nand/raw/Kconfig-256-\ttristate \"DaVinci/Keystone NAND controller\"\n--\ndrivers/mtd/nand/raw/Kconfig-262-\ndrivers/mtd/nand/raw/Kconfig:263:config MTD_NAND_TXX9NDFMC\ndrivers/mtd/nand/raw/Kconfig-264-\ttristate \"TXx9 NAND controller\"\n\n"
} |
| 13/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21994 output: 25 thoughts: 55 Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue: **NAN Implementation Review** Right, so we're looking at Neighbor Awareness Networking – NAN, or Wi-Fi Aware. It's not a standalone entity within the kernel's wireless stack, which is interesting. I'd assumed, perhaps naively, that it might have its own dedicated Kconfig option in either `cfg80211` or `mac80211`. That would have made the configuration process much cleaner, but apparently, that's not the approach taken. Let's quickly confirm, though. It's always best to be thorough. I need to double-check if `CFG80211` *does* have any underlying configuration hooks related to NAN, even if it's not a direct, top-level option. Perhaps it's nested or implicitly enabled via another feature. I need to scour the relevant Kconfig files to be absolutely sure. A quick search should give me the answer. |
| 14/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config .*",
"PathPrefix": "net/wireless"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 359 lines.\nUse more precise expression if possible.\n\nnet/wireless/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nnet/wireless/Kconfig:2:config WIRELESS_EXT\nnet/wireless/Kconfig-3-\tbool\nnet/wireless/Kconfig-4-\nnet/wireless/Kconfig:5:config WEXT_CORE\nnet/wireless/Kconfig-6-\tdef_bool y\n--\nnet/wireless/Kconfig-8-\nnet/wireless/Kconfig:9:config WEXT_PROC\nnet/wireless/Kconfig-10-\tdef_bool y\n--\nnet/wireless/Kconfig-13-\nnet/wireless/Kconfig:14:config WEXT_PRIV\nnet/wireless/Kconfig-15-\tbool\nnet/wireless/Kconfig-16-\nnet/wireless/Kconfig:17:config CFG80211\nnet/wireless/Kconfig-18-\ttristate \"cfg80211 - wireless configuration API\"\n--\nnet/wireless/Kconfig=36=if CFG80211\nnet/wireless/Kconfig-37-\nnet/wireless/Kconfig:38:config NL80211_TESTMODE\nnet/wireless/Kconfig-39-\tbool \"nl80211 testmode command\"\n--\nnet/wireless/Kconfig-51-\nnet/wireless/Kconfig:52:config CFG80211_DEVELOPER_WARNINGS\nnet/wireless/Kconfig-53-\tbool \"enable developer warnings\"\n--\nnet/wireless/Kconfig-67-\nnet/wireless/Kconfig:68:config CFG80211_CERTIFICATION_ONUS\nnet/wireless/Kconfig-69-\tbool \"cfg80211 certification onus\"\n--\nnet/wireless/Kconfig-88-\nnet/wireless/Kconfig:89:config CFG80211_REQUIRE_SIGNED_REGDB\nnet/wireless/Kconfig-90-\tbool \"require regdb signature\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-98-\nnet/wireless/Kconfig:99:config CFG80211_USE_KERNEL_REGDB_KEYS\nnet/wireless/Kconfig-100-\tbool \"allow regdb keys shipped with the kernel\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-110-\nnet/wireless/Kconfig:111:config CFG80211_EXTRA_REGDB_KEYDIR\nnet/wireless/Kconfig-112-\tstring \"additional regdb key directory\" if CFG80211_CERTIFICATION_ONUS\n--\nnet/wireless/Kconfig-121-\nnet/wireless/Kconfig:122:config CFG80211_REG_CELLULAR_HINTS\nnet/wireless/Kconfig-123-\tbool \"cfg80211 regulatory support for cellular base station hints\"\n--\nnet/wireless/Kconfig-134-\nnet/wireless/Kconfig:135:config CFG80211_REG_RELAX_NO_IR\nnet/wireless/Kconfig-136-\tbool \"cfg80211 support for NO_IR relaxation\"\n--\nnet/wireless/Kconfig-158-\nnet/wireless/Kconfig:159:config CFG80211_DEFAULT_PS\nnet/wireless/Kconfig-160-\tbool \"enable powersave by default\"\n--\nnet/wireless/Kconfig-168-\nnet/wireless/Kconfig:169:config CFG80211_DEBUGFS\nnet/wireless/Kconfig-170-\tbool \"cfg80211 DebugFS entries\"\n--\nnet/wireless/Kconfig-176-\nnet/wireless/Kconfig:177:config CFG80211_CRDA_SUPPORT\nnet/wireless/Kconfig-178-\tbool \"support CRDA\" if EXPERT\n--\nnet/wireless/Kconfig-186-\nnet/wireless/Kconfig:187:config CFG80211_WEXT\nnet/wireless/Kconfig-188-\tbool \"cfg80211 wireless extensions compatibility\"\n--\nnet/wireless/Kconfig-193-\nnet/wireless/Kconfig:194:config CFG80211_KUNIT_TEST\nnet/wireless/Kconfig-195-\ttristate \"KUnit tests for cfg80211\" if !KUNIT_ALL_TESTS\n--\nnet/wireless/chan.c=178=static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef)\n--\nnet/wireless/chan.c-203-\t */\nnet/wireless/chan.c:204:\t/* check bw_config against contiguous edmg channels */\nnet/wireless/chan.c-205-\tswitch (chandef-\u003eedmg.bw_config) {\n--\nnet/wireless/chan.c-234-\nnet/wireless/chan.c:235:\t/* check bw_config against aggregated (non contiguous) edmg channels */\nnet/wireless/chan.c-236-\tswitch (chandef-\u003eedmg.bw_config) {\n--\nnet/wireless/chan.c=1357=static bool cfg80211_edmg_usable(struct wiphy *wiphy, u8 edmg_channels,\nnet/wireless/chan.c:1358:\t\t\t\t enum ieee80211_edmg_bw_config edmg_bw_config,\nnet/wireless/chan.c-1359-\t\t\t\t int primary_channel,\n--\nnet/wireless/chan.c-1396-\nnet/wireless/chan.c:1397:\t/* check bw_config is a subset of what driver supports\nnet/wireless/chan.c-1398-\t * (see IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13)\nnet/wireless/chan.c-1399-\t */\nnet/wireless/chan.c:1400:\tif ((edmg_bw_config % 4) \u003e (edmg_cap-\u003ebw_config % 4))\nnet/wireless/chan.c-1401-\t\treturn false;\nnet/wireless/chan.c-1402-\nnet/wireless/chan.c:1403:\tif (edmg_bw_config \u003e edmg_cap-\u003ebw_config)\nnet/wireless/chan.c-1404-\t\treturn false;\n--\nnet/wireless/chan.c=1778=bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,\nnet/wireless/chan.c-1779-\t\t\t\t struct cfg80211_chan_def *chandef,\nnet/wireless/chan.c:1780:\t\t\t\t struct cfg80211_beaconing_check_config *cfg)\nnet/wireless/chan.c-1781-{\n--\nnet/wireless/core.c=1378=void wiphy_unregister(struct wiphy *wiphy)\n--\nnet/wireless/core.c-1416-#ifdef CONFIG_PM\nnet/wireless/core.c:1417:\tif (rdev-\u003ewiphy.wowlan_config \u0026\u0026 rdev-\u003eops-\u003eset_wakeup)\nnet/wireless/core.c-1418-\t\trdev_set_wakeup(rdev, false);\n--\nnet/wireless/core.c=1497=static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,\n--\nnet/wireless/core.c-1500-\tstruct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev-\u003ewiphy);\nnet/wireless/core.c:1501:\tstruct cfg80211_cqm_config *cqm_config;\nnet/wireless/core.c-1502-\tunsigned int link_id;\n--\nnet/wireless/core.c-1543-\t/* deleted from the list, so can't be found from nl80211 any more */\nnet/wireless/core.c:1544:\tcqm_config = rcu_access_pointer(wdev-\u003ecqm_config);\nnet/wireless/core.c-1545-\tkfree_rcu(cqm_config, rcu_head);\n--\nnet/wireless/core.h=312=struct cfg80211_beacon_registration {\n--\nnet/wireless/core.h-316-\nnet/wireless/core.h:317:struct cfg80211_cqm_config {\nnet/wireless/core.h-318-\tstruct rcu_head rcu_head;\n--\nnet/wireless/core.h=359=int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/core.h-362-/* mesh */\nnet/wireless/core.h:363:extern const struct mesh_config default_mesh_config;\nnet/wireless/core.h-364-extern const struct mesh_setup default_mesh_setup;\nnet/wireless/core.h=365=int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/core.h-367-\t\t\t struct mesh_setup *setup,\nnet/wireless/core.h:368:\t\t\t const struct mesh_config *conf);\nnet/wireless/core.h-369-int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/ibss.c=369=int cfg80211_ibss_wext_siwessid(struct net_device *dev,\n--\nnet/wireless/ibss.c-391-\nnet/wireless/ibss.c:392:\t/* iwconfig uses nul termination in SSID.. */\nnet/wireless/ibss.c-393-\tif (len \u003e 0 \u0026\u0026 ssid[len - 1] == '\\0')\n--\nnet/wireless/mesh.c-56-\nnet/wireless/mesh.c:57:const struct mesh_config default_mesh_config = {\nnet/wireless/mesh.c-58-\t.dot11MeshRetryTimeout = MESH_RET_T,\n--\nnet/wireless/mesh.c=102=int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/mesh.c-104-\t\t\t struct mesh_setup *setup,\nnet/wireless/mesh.c:105:\t\t\t const struct mesh_config *conf)\nnet/wireless/mesh.c-106-{\n--\nnet/wireless/nl80211.c=2848=static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)\n--\nnet/wireless/nl80211.c-2854-\nnet/wireless/nl80211.c:2855:\tconfig = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG);\nnet/wireless/nl80211.c-2856-\tif (!config)\n--\nnet/wireless/nl80211.c=3947=static int _nl80211_parse_chandef(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/nl80211.c-4043-\t\tif (attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG])\nnet/wireless/nl80211.c:4044:\t\t\tchandef-\u003eedmg.bw_config =\nnet/wireless/nl80211.c-4045-\t\t nla_get_u8(attrs[NL80211_ATTR_WIPHY_EDMG_BW_CONFIG]);\nnet/wireless/nl80211.c-4046-\t} else {\nnet/wireless/nl80211.c:4047:\t\tchandef-\u003eedmg.bw_config = 0;\nnet/wireless/nl80211.c-4048-\t\tchandef-\u003eedmg.channels = 0;\n--\nnet/wireless/nl80211.c=4126=static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/nl80211.c-4165-\t\t\tstruct ieee80211_channel *cur_chan;\nnet/wireless/nl80211.c:4166:\t\t\tstruct cfg80211_beaconing_check_config config = {\nnet/wireless/nl80211.c-4167-\t\t\t\t.iftype = iftype,\n--\nnet/wireless/nl80211.c=6477=static int nl80211_parse_mbssid_config(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-6480-\t\t\t\t struct nlattr *attrs,\nnet/wireless/nl80211.c:6481:\t\t\t\t struct cfg80211_mbssid_config *config,\nnet/wireless/nl80211.c-6482-\t\t\t\t u8 num_elems)\n--\nnet/wireless/nl80211.c=7241=static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-7243-\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\nnet/wireless/nl80211.c:7244:\tstruct cfg80211_beaconing_check_config beacon_check = {};\nnet/wireless/nl80211.c-7245-\tunsigned int link_id = nl80211_link_id(info-\u003eattrs);\n--\nnet/wireless/nl80211.c=7550=static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-7552-\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\nnet/wireless/nl80211.c:7553:\tstruct cfg80211_beaconing_check_config beacon_check = {};\nnet/wireless/nl80211.c-7554-\tunsigned int link_id = nl80211_link_id(info-\u003eattrs);\n--\nnet/wireless/nl80211.c=10322=static int nl80211_get_mesh_config(struct sk_buff *skb,\n--\nnet/wireless/nl80211.c-10327-\tstruct wireless_dev *wdev = dev-\u003eieee80211_ptr;\nnet/wireless/nl80211.c:10328:\tstruct mesh_config cur_params;\nnet/wireless/nl80211.c-10329-\tint err = 0;\n--\nnet/wireless/nl80211.c=10498=static int nl80211_parse_mesh_config(struct genl_info *info,\nnet/wireless/nl80211.c:10499:\t\t\t\t struct mesh_config *cfg,\nnet/wireless/nl80211.c-10500-\t\t\t\t u32 *mask_out)\n--\nnet/wireless/nl80211.c=10700=static int nl80211_update_mesh_config(struct sk_buff *skb,\n--\n\n"
} |
| 15/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26400 output: 34 thoughts: 2921 Thoughts: **WorthFuzzing Analysis: Instant Communication (IC) Mode in Wi-Fi Aware (NAN)** Okay, let's break this down. This patch introduces Instant Communication (IC) support for Wi-Fi Aware (NAN) in the kernel. My initial read immediately flagged this as a potential target. We're looking at modifications across several key areas: `net/wireless/core.c`, `net/wireless/nl80211.c`, `net/wireless/scan.c`, `include/linux/ieee80211-nan.h`, `net/mac80211/*`, and the `mac80211_hwsim` virtual driver. The most interesting thing is the addition of the new IC mode, especially the `mac80211_hwsim` virtual driver modifications. This is key because `mac80211_hwsim` is a software-defined Wi-Fi interface, fully reachable within a standard virtualized environment like QEMU. That is excellent for fuzzing! The key elements in `mac80211_hwsim_nan.*` are: * The new `ieee80211_is_nan_beacon` helper and handling of NAN beacons, parsing the beacon data. * The parsing of user-controlled netlink attributes. * Extra attributes appended to the beacon. * New netlink commands related to instant communication. * Timer calculations that may be vulnerable to integer overflows. The code modifies core wireless stack components. Notably, `nl80211_parse_nan_conf`, `nl80211_put_nan_capa`, `cfg80211_inform_bss_frame_data`, and `ieee80211_accept_frame` now handle IC-related attributes and beacon data. Furthermore, new `WARN_ON` assertions are added in `wiphy_register`, as well as one in `mac80211_hwsim_nan_receive`. The fact that new assertions are added is a significant red flag because we know that any new assertions in reachable code MUST be fuzzed. Looking at the code, it's clear the patch allocates and frees memory (`kmemdup`, `kfree`), parses netlink attributes (like `NL80211_NAN_CONF_INSTANT_COMM`, `NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL`), and processes data from potentially untrusted frames in `hwsim_nan_beacon_has_service_ids`, `ieee80211_is_nan_beacon`, and `mac80211_hwsim_nan_rx`. The `discovery_beacon_interval` usage within the timer is noteworthy; even though it checks for zero on config, it would be useful to look at the interval value and where it is used. Given the potential for fuzzing via `mac80211_hwsim`, which syzkaller can readily interact with, the reachability of the core wireless stack, and the introduction of new assertions, this is definitively WorthFuzzing. Regarding the required kernel configurations, we need to ensure that `mac80211_hwsim` is enabled, along with the core Wi-Fi features. I would check the relevant Kconfig files in the drivers and net/wireless directories to identify the necessary flags. |
| 16/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "mac80211_hwsim",
"PathPrefix": "drivers/net/wireless"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 1619 lines.\nUse more precise expression if possible.\n\ndrivers/net/wireless/virtual/Kconfig=1=config MAC80211_HWSIM\n--\ndrivers/net/wireless/virtual/Kconfig-7-\t needed for normal wireless LAN usage and is only for testing. See\ndrivers/net/wireless/virtual/Kconfig:8:\t Documentation/networking/mac80211_hwsim for more information on how\ndrivers/net/wireless/virtual/Kconfig-9-\t to use this tool.\n--\ndrivers/net/wireless/virtual/Kconfig-11-\t To compile this driver as a module, choose M here: the module will be\ndrivers/net/wireless/virtual/Kconfig:12:\t called mac80211_hwsim. If unsure, say N.\ndrivers/net/wireless/virtual/Kconfig-13-\n--\ndrivers/net/wireless/virtual/Makefile:1:obj-$(CONFIG_MAC80211_HWSIM)\t+= mac80211_hwsim.o\ndrivers/net/wireless/virtual/Makefile:2:mac80211_hwsim-objs\t\t+= mac80211_hwsim_main.o\ndrivers/net/wireless/virtual/Makefile:3:mac80211_hwsim-objs\t\t+= mac80211_hwsim_nan.o\ndrivers/net/wireless/virtual/Makefile-4-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim.h-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-33- * entities such as wmediumd to receive and process all broadcasted\ndrivers/net/wireless/virtual/mac80211_hwsim.h:34: * frames from a mac80211_hwsim radio device.\ndrivers/net/wireless/virtual/mac80211_hwsim.h-35- *\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-42- * Once registered the user application has to take responsibility of\ndrivers/net/wireless/virtual/mac80211_hwsim.h:43: * broadcasting the frames to all listening mac80211_hwsim radio\ndrivers/net/wireless/virtual/mac80211_hwsim.h-44- * interfaces.\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-55- * @HWSIM_CMD_REGISTER: request to register and received all broadcasted\ndrivers/net/wireless/virtual/mac80211_hwsim.h:56: *\tframes by any mac80211_hwsim radio device.\ndrivers/net/wireless/virtual/mac80211_hwsim.h-57- * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-13-#include \u003cnet/mac80211.h\u003e\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:14:#include \"mac80211_hwsim.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:15:#include \"mac80211_hwsim_nan.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-16-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h=27=struct hwsim_sta_priv {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-37-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:38:struct mac80211_hwsim_link_data {\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-39-\tu32 link_id;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-50-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:51:struct mac80211_hwsim_data {\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-52-\tstruct list_head list;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-65-\t/* Storage space for channels, etc. */\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:66:\tstruct mac80211_hwsim_phy_data *phy_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-67-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-144-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:145:\tstruct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-146-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:147:\tstruct mac80211_hwsim_nan_data nan;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-148-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h=151=extern struct list_head hwsim_radios;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-152-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:153:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-154-\t\t\t\t u64 tsf);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:155:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-156-\t\t\t\t ktime_t ts);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-157-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:158:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-159-\t\t\t struct ieee80211_vif *vif);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-160-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:161:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-162-\t\t\t struct sk_buff *skb,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-40-#include \u003clinux/string.h\u003e\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:41:#include \"mac80211_hwsim.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:42:#include \"mac80211_hwsim_i.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-43-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=335=static const struct class hwsim_class = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:336:\t.name\t= \"mac80211_hwsim\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-337-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=604=hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-607-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:608:static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-609-\t\t\t\t\t struct wireless_dev *wdev,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-630-\t *\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:631:\t * event_idx = 0 (index in mac80211_hwsim_vendor_commands)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-632-\t */\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-658-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:659:static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-660-\t{\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-663-\t\t.flags = WIPHY_VENDOR_CMD_NEED_NETDEV,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:664:\t\t.doit = mac80211_hwsim_vendor_cmd_test,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-665-\t\t.policy = hwsim_vendor_test_policy,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-670-/* Advertise support vendor specific events */\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:671:static const struct nl80211_vendor_cmd_info mac80211_hwsim_vendor_events[] = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-672-\t{ .vendor_id = OUI_QCA, .subcmd = 1 },\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=679=static int hwsim_radios_generation = 1;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-680-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:681:static struct platform_driver mac80211_hwsim_driver = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-682-\t.driver = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:683:\t\t.name = \"mac80211_hwsim\",\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-684-\t},\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=687=static const struct rhashtable_params hwsim_rht_params = {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-690-\t.key_len = ETH_ALEN,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:691:\t.key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:692:\t.head_offset = offsetof(struct mac80211_hwsim_data, rht),\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-693-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=704=struct hwsim_radiotap_ack_hdr {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-711-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:712:static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-713-{\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=909=static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-910-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:911:static int hwsim_tx_virtio(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-912-\t\t\t struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-939-/* cause a linker error if this ends up being needed */\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:940:extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-941-\t\t\t struct sk_buff *skb);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=980=static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-981-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:982:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-983-\tstruct hwsim_vif_priv *vp = (void *)vif-\u003edrv_priv;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1005-\trcu_read_lock();\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1006:\tmac80211_hwsim_tx_frame(data-\u003ehw, skb,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1007-\t\t\t\trcu_dereference(vif-\u003ebss_conf.chanctx_conf)-\u003edef.chan);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1010-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1011:static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1012-\t\t\t\tstruct ieee80211_vif *vif, int ps)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1043-\trcu_read_lock();\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1044:\tmac80211_hwsim_tx_frame(data-\u003ehw, skb,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1045-\t\t\t\trcu_dereference(vif-\u003ebss_conf.chanctx_conf)-\u003edef.chan);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1050=static void hwsim_send_nullfunc_ps(void *dat, u8 *mac,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1052-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1053:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1054-\thwsim_send_nullfunc(data, mac, vif, 1);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1057=static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1059-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1060:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1061-\thwsim_send_nullfunc(data, mac, vif, 0);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1064=static int hwsim_fops_ps_read(void *dat, u64 *val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1065-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1066:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1067-\t*val = data-\u003eps;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1071=static int hwsim_fops_ps_write(void *dat, u64 val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1072-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1073:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1074-\tenum ps_mode old_ps;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1111=static int hwsim_write_simulate_radar(void *dat, u64 val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1112-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1113:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1114-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1123=static ssize_t hwsim_background_cac_write(struct file *file,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1126-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1127:\tstruct mac80211_hwsim_data *data = file-\u003eprivate_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1128-\tchar buf[8] = {};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1175=static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1178-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1179:\tstruct mac80211_hwsim_data *data = file-\u003eprivate_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1180-\tstruct hwsim_chanctx_iter_arg arg = {};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1217=static int hwsim_fops_group_read(void *dat, u64 *val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1218-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1219:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1220-\t*val = data-\u003egroup;\n--\n\n"
} |
| 17/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36184 output: 33 thoughts: 65 Thoughts: Okay, here's my take on those config options, broken down as if I'm thinking through this process: **Diving into the Network Wireless Configuration** Alright, let's see what's what. I'm staring at these config options: `CONFIG_MAC80211_HWSIM`, `CONFIG_MAC80211`, `CONFIG_CFG80211`, and `CONFIG_NET`. Naturally, `CONFIG_NET` is the base, the bedrock. That's a given. It has to be enabled for anything else network-related to work. Now, my immediate thought is to understand the dependencies. It's time to check what `CONFIG_CFG80211` relies on. Specifically, I'm going to look inside the `net/wireless/Kconfig` file. That's where all the details of the wireless configuration options will be laid out. I need to understand the relationship between `CFG80211` and the other `MAC80211` options, as well as any other supporting infrastructure within the wireless subsystem. Figuring out these dependencies is key to understanding how these options fit together and to build a kernel that is lean, but covers the needed functionality. |
| 18/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config CFG80211\\b",
"PathPrefix": "net/wireless"
}Results: {
"Output": "net/wireless/Kconfig=14=config WEXT_PRIV\n--\nnet/wireless/Kconfig-16-\nnet/wireless/Kconfig:17:config CFG80211\nnet/wireless/Kconfig-18-\ttristate \"cfg80211 - wireless configuration API\"\n"
} |
| 19/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36639 output: 33 thoughts: 20 Thoughts: Okay, here's my take on those lines in `net/wireless/Kconfig`. **Diving into the net/wireless/Kconfig Section** Alright, let's zero in on lines 15-35 of `net/wireless/Kconfig`. Hmm, what's being defined here? I'm betting we're looking at some core wireless configuration options. Given the location within the file and the general structure of these Kconfig files, I'd expect to see some fundamental choices or default behaviors for wireless networking components. This specific range might be setting up base capabilities – something like "do we even *want* wireless support?" or maybe defining the most basic protocol layers like mac80211 or cfg80211. Perhaps a global switch for the entire wireless subsystem? I'd imagine that might be the main theme if there are multiple wireless subsystems that can be enabled. It's likely determining if we're building it as a module or built in. I'm also looking for any conditional dependencies that are immediately clear. Often, we get hints of underlying architecture and design here that'll shape later configuration options. Let's see if my hunches are right... |
| 20/2 | 2026/10/04 14:58 | tool | read-file |
0mArgs:{
"File": "net/wireless/Kconfig",
"FirstLine": 15,
"LineCount": 20
}Results: {
"Contents": " 15:\t\tbool\n 16:\t\n 17:\tconfig CFG80211\n 18:\t\ttristate \"cfg80211 - wireless configuration API\"\n 19:\t\tdepends on RFKILL || !RFKILL\n 20:\t\tselect FW_LOADER\n 21:\t\tselect CRC32\n 22:\t\t# may need to update this when certificates are changed and are\n 23:\t\t# using a different algorithm, though right now they shouldn't\n 24:\t\t# (this is here rather than below to allow it to be a module)\n 25:\t\tselect CRYPTO_SHA256 if CFG80211_USE_KERNEL_REGDB_KEYS\n 26:\t\thelp\n 27:\t\t cfg80211 is the Linux wireless LAN (802.11) configuration API.\n 28:\t\t Enable this if you have a wireless device.\n 29:\t\n 30:\t\t For more information refer to documentation on the wireless wiki:\n 31:\t\n 32:\t\t https://wireless.wiki.kernel.org/en/developers/Documentation/cfg80211\n 33:\t\n 34:\t\t When built as a module it will be called cfg80211.\n"
} |
| 21/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37272 output: 28 thoughts: 74 Thoughts: Okay, here's my take on those config considerations, distilled into my internal thought process: **Reviewing Wireless Driver Configuration** Right, let's nail down these wireless driver configurations. I'm focusing on these for starters: `CFG80211`, `MAC80211`, and `MAC80211_HWSIM`. They're the core, but I need to be sure I'm not missing anything crucial. I've got to ensure the dependencies are all accounted for and that there aren't any subtle interactions with other modules. Now, before I commit to anything, I need a comprehensive overview. I'm going to quickly scan the `drivers/net/wireless/Kconfig` file and confirm there are no overlooked configurations or dependencies that might influence these choices or that need activation alongside them. Gotta be thorough. There might be some crucial hidden setting, so I need to make sure I don't miss anything. |
| 22/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "VIRTUAL",
"PathPrefix": "drivers/net/wireless"
}Results: {
"Output": "drivers/net/wireless/ath/ath11k/wmi.h=994=enum wmi_tlv_vdev_param {\n--\ndrivers/net/wireless/ath/ath11k/wmi.h-1083-\tWMI_VDEV_PARAM_PROXY_STA,\ndrivers/net/wireless/ath/ath11k/wmi.h:1084:\tWMI_VDEV_PARAM_VIRTUAL_CELL_MODE,\ndrivers/net/wireless/ath/ath11k/wmi.h-1085-\tWMI_VDEV_PARAM_RX_DECAP_TYPE,\n--\ndrivers/net/wireless/ath/ath12k/mac.c=10422=int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)\n--\ndrivers/net/wireless/ath/ath12k/mac.c-10443-\ndrivers/net/wireless/ath/ath12k/mac.c:10444:\t/* In NO_VIRTUAL_MONITOR, its necessary to restrict only one monitor\ndrivers/net/wireless/ath/ath12k/mac.c-10445-\t * interface in each radio\n--\ndrivers/net/wireless/ath/ath12k/mac.c=14806=static int ath12k_mac_hw_register(struct ath12k_hw *ah)\n--\ndrivers/net/wireless/ath/ath12k/mac.c-14913-\tieee80211_hw_set(hw, REPORTS_LOW_ACK);\ndrivers/net/wireless/ath/ath12k/mac.c:14914:\tieee80211_hw_set(hw, NO_VIRTUAL_MONITOR);\ndrivers/net/wireless/ath/ath12k/mac.c-14915-\n--\ndrivers/net/wireless/ath/ath12k/wmi.h=1092=enum wmi_tlv_vdev_param {\n--\ndrivers/net/wireless/ath/ath12k/wmi.h-1181-\tWMI_VDEV_PARAM_PROXY_STA,\ndrivers/net/wireless/ath/ath12k/wmi.h:1182:\tWMI_VDEV_PARAM_VIRTUAL_CELL_MODE,\ndrivers/net/wireless/ath/ath12k/wmi.h-1183-\tWMI_VDEV_PARAM_RX_DECAP_TYPE,\n--\ndrivers/net/wireless/ath/carl9170/carl9170.h=236=struct ar9170 {\n--\ndrivers/net/wireless/ath/carl9170/carl9170.h-308-\tunsigned int vifs;\ndrivers/net/wireless/ath/carl9170/carl9170.h:309:\tstruct carl9170_vif vif_priv[AR9170_MAX_VIRTUAL_MAC];\ndrivers/net/wireless/ath/carl9170/carl9170.h-310-\n--\ndrivers/net/wireless/ath/carl9170/fw.c=223=static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len)\n--\ndrivers/net/wireless/ath/carl9170/fw.c-322-\ndrivers/net/wireless/ath/carl9170/fw.c:323:\tif (ar-\u003efw.vif_num \u003e= AR9170_MAX_VIRTUAL_MAC || !ar-\u003efw.vif_num ||\ndrivers/net/wireless/ath/carl9170/fw.c-324-\t ar-\u003efw.mem_blocks \u003c 16 || !ar-\u003efw.cmd_bufs ||\n--\ndrivers/net/wireless/ath/carl9170/hw.h-291-#define AR9170_MAC_REG_TX_QOS_THRESHOLD\t\t(AR9170_MAC_REG_BASE + 0xb3c)\ndrivers/net/wireless/ath/carl9170/hw.h:292:#define\tAR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA\t(AR9170_MAC_REG_BASE + 0xb40)\ndrivers/net/wireless/ath/carl9170/hw.h:293:#define\t\tAR9170_MAC_VIRTUAL_CCA_Q0\t\tBIT(15)\ndrivers/net/wireless/ath/carl9170/hw.h:294:#define\t\tAR9170_MAC_VIRTUAL_CCA_Q1\t\tBIT(16)\ndrivers/net/wireless/ath/carl9170/hw.h:295:#define\t\tAR9170_MAC_VIRTUAL_CCA_Q2\t\tBIT(17)\ndrivers/net/wireless/ath/carl9170/hw.h:296:#define\t\tAR9170_MAC_VIRTUAL_CCA_Q3\t\tBIT(18)\ndrivers/net/wireless/ath/carl9170/hw.h:297:#define\t\tAR9170_MAC_VIRTUAL_CCA_Q4\t\tBIT(19)\ndrivers/net/wireless/ath/carl9170/hw.h:298:#define\t\tAR9170_MAC_VIRTUAL_CCA_ALL\t\t(0xf8000)\ndrivers/net/wireless/ath/carl9170/hw.h-299-\n--\ndrivers/net/wireless/ath/carl9170/hw.h=850=struct ar9170_stream {\n--\ndrivers/net/wireless/ath/carl9170/hw.h-858-#define AR9170_MAX_ACKTABLE_ENTRIES\t\t\t8\ndrivers/net/wireless/ath/carl9170/hw.h:859:#define AR9170_MAX_VIRTUAL_MAC\t\t\t\t7\ndrivers/net/wireless/ath/carl9170/hw.h-860-\n--\ndrivers/net/wireless/ath/carl9170/tx.c=107=static struct ieee80211_sta *__carl9170_get_tx_sta(struct ar9170 *ar,\n--\ndrivers/net/wireless/ath/carl9170/tx.c-117-\ndrivers/net/wireless/ath/carl9170/tx.c:118:\tif (WARN_ON_ONCE(vif_id \u003e= AR9170_MAX_VIRTUAL_MAC))\ndrivers/net/wireless/ath/carl9170/tx.c-119-\t\treturn NULL;\n--\ndrivers/net/wireless/ath/carl9170/tx.c=959=static int carl9170_tx_prepare(struct ar9170 *ar,\n--\ndrivers/net/wireless/ath/carl9170/tx.c-978-\ndrivers/net/wireless/ath/carl9170/tx.c:979:\tBUILD_BUG_ON(AR9170_MAX_VIRTUAL_MAC \u003e\ndrivers/net/wireless/ath/carl9170/tx.c-980-\t\t((CARL9170_TX_SUPER_MISC_VIF_ID \u003e\u003e\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_dma.h=43=enum dma_msg_port {\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_dma.h-47-\tHOST_PORT,\ndrivers/net/wireless/mediatek/mt76/mt76x02_dma.h:48:\tVIRTUAL_CPU_RX_PORT,\ndrivers/net/wireless/mediatek/mt76/mt76x02_dma.h:49:\tVIRTUAL_CPU_TX_PORT,\ndrivers/net/wireless/mediatek/mt76/mt76x02_dma.h-50-\tDISCARD,\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_core.c=750=int mt792x_init_wiphy(struct ieee80211_hw *hw)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_core.c-837-\tif (is_mt7927(\u0026dev-\u003emt76))\ndrivers/net/wireless/mediatek/mt76/mt792x_core.c:838:\t\tieee80211_hw_set(hw, NO_VIRTUAL_MONITOR);\ndrivers/net/wireless/mediatek/mt76/mt792x_core.c-839-\telse\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/init.c=478=mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/init.c-539-\tieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);\ndrivers/net/wireless/mediatek/mt76/mt7996/init.c:540:\tieee80211_hw_set(hw, NO_VIRTUAL_MONITOR);\ndrivers/net/wireless/mediatek/mt76/mt7996/init.c-541-\tieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);\n--\ndrivers/net/wireless/mediatek/mt7601u/dma.h=23=enum mt76_msg_port {\n--\ndrivers/net/wireless/mediatek/mt7601u/dma.h-27-\tHOST_PORT,\ndrivers/net/wireless/mediatek/mt7601u/dma.h:28:\tVIRTUAL_CPU_RX_PORT,\ndrivers/net/wireless/mediatek/mt7601u/dma.h:29:\tVIRTUAL_CPU_TX_PORT,\ndrivers/net/wireless/mediatek/mt7601u/dma.h-30-\tDISCARD,\n--\ndrivers/net/wireless/ti/wl1251/io.c=82=void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val)\n--\ndrivers/net/wireless/ti/wl1251/io.c-88- *\ndrivers/net/wireless/ti/wl1251/io.c:89: * There are two VIRTUAL partitions (the memory partition and the\ndrivers/net/wireless/ti/wl1251/io.c-90- * registers partition), which are mapped to two different areas of the\n--\ndrivers/net/wireless/ti/wl1251/io.c-100- * ...+----+--\u003e mem_start\ndrivers/net/wireless/ti/wl1251/io.c:101: * VIRTUAL address ... | |\ndrivers/net/wireless/ti/wl1251/io.c-102- * space ... | | [PART_0]\n--\ndrivers/net/wireless/ti/wl1251/rx.h-50-#define RX_DESC_STAINTIM 0x0008\ndrivers/net/wireless/ti/wl1251/rx.h:51:#define RX_DESC_VIRTUAL_BM 0x0010\ndrivers/net/wireless/ti/wl1251/rx.h-52-#define RX_DESC_BCAST 0x0020\n--\ndrivers/net/wireless/ti/wlcore/rx.h-33-#define RX_DESC_STAINTIM 0x0008\ndrivers/net/wireless/ti/wlcore/rx.h:34:#define RX_DESC_VIRTUAL_BM 0x0010\ndrivers/net/wireless/ti/wlcore/rx.h-35-#define RX_DESC_BCAST 0x0020\n"
} |
| 23/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40743 output: 26 thoughts: 24 Thoughts: Here's my thought process, as requested: **Investigating Virtualization in the Wireless Networking Kconfig** Okay, I need to understand how the `virtual/` directory is incorporated into the wireless networking configuration. My first step is to dive into the `drivers/net/wireless/Kconfig` file. That's the go-to place for core wireless driver configuration, so that should reveal the relevant dependencies and inclusion mechanisms. It will provide the best overview of where these virtual elements are brought in within the context of the larger wireless subsystem. Let's see what's in there. |
| 24/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "virtual",
"PathPrefix": "drivers/net/wireless"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 1149 lines.\nUse more precise expression if possible.\n\ndrivers/net/wireless/Kconfig=40=source \"drivers/net/wireless/quantenna/Kconfig\"\ndrivers/net/wireless/Kconfig-41-\ndrivers/net/wireless/Kconfig:42:source \"drivers/net/wireless/virtual/Kconfig\"\ndrivers/net/wireless/Kconfig-43-\n--\ndrivers/net/wireless/Makefile=25=obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/\ndrivers/net/wireless/Makefile-26-\ndrivers/net/wireless/Makefile:27:obj-$(CONFIG_WLAN) += virtual/\n--\ndrivers/net/wireless/ath/ath10k/pci.c=903=static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,\n--\ndrivers/net/wireless/ath/ath10k/pci.c-935-\t/* The address supplied by the caller is in the\ndrivers/net/wireless/ath/ath10k/pci.c:936:\t * Target CPU virtual address space.\ndrivers/net/wireless/ath/ath10k/pci.c-937-\t *\ndrivers/net/wireless/ath/ath10k/pci.c-938-\t * In order to use this address with the diagnostic CE,\ndrivers/net/wireless/ath/ath10k/pci.c:939:\t * convert it from Target CPU virtual address space\ndrivers/net/wireless/ath/ath10k/pci.c-940-\t * to CE address space\n--\ndrivers/net/wireless/ath/ath10k/pci.c=1049=int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,\n--\ndrivers/net/wireless/ath/ath10k/pci.c-1080-\t * The address supplied by the caller is in the\ndrivers/net/wireless/ath/ath10k/pci.c:1081:\t * Target CPU virtual address space.\ndrivers/net/wireless/ath/ath10k/pci.c-1082-\t *\n--\ndrivers/net/wireless/ath/ath10k/pci.c-1084-\t * convert it from\ndrivers/net/wireless/ath/ath10k/pci.c:1085:\t * Target CPU virtual address space\ndrivers/net/wireless/ath/ath10k/pci.c-1086-\t * to\n--\ndrivers/net/wireless/ath/ath10k/pci.h=108=struct ath10k_pci {\n--\ndrivers/net/wireless/ath/ath10k/pci.h-176-\ndrivers/net/wireless/ath/ath10k/pci.h:177:\t/* chip specific methods for converting target CPU virtual address\ndrivers/net/wireless/ath/ath10k/pci.h-178-\t * space to CE address space\n--\ndrivers/net/wireless/ath/ath10k/wmi.c=3574=static void ath10k_wmi_update_tim(struct ath10k *ar,\n--\ndrivers/net/wireless/ath/ath10k/wmi.c-3657-\ttim-\u003ebitmap_ctrl = !!__le32_to_cpu(tim_info-\u003etim_mcast);\ndrivers/net/wireless/ath/ath10k/wmi.c:3658:\tmemcpy(tim-\u003evirtual_map, arvif-\u003eu.ap.tim_bitmap, pvm_len);\ndrivers/net/wireless/ath/ath10k/wmi.c-3659-\n--\ndrivers/net/wireless/ath/ath10k/wmi.h=1093=enum wmi_cmd_id {\n--\ndrivers/net/wireless/ath/ath10k/wmi.h-1116-\ndrivers/net/wireless/ath/ath10k/wmi.h:1117:\t/* VDEV (virtual device) specific commands */\ndrivers/net/wireless/ath/ath10k/wmi.h-1118-\tWMI_VDEV_CREATE_CMDID = WMI_CMD_GRP(WMI_GRP_VDEV),\n--\ndrivers/net/wireless/ath/ath10k/wmi.h=1336=enum wmi_10x_cmd_id {\n--\ndrivers/net/wireless/ath/ath10k/wmi.h-1364-\ndrivers/net/wireless/ath/ath10k/wmi.h:1365:\t/* VDEV(virtual device) specific commands */\ndrivers/net/wireless/ath/ath10k/wmi.h-1366-\tWMI_10X_VDEV_CREATE_CMDID,\n--\ndrivers/net/wireless/ath/ath10k/wmi.h=2362=struct wmi_resource_config {\ndrivers/net/wireless/ath/ath10k/wmi.h:2363:\t/* number of virtual devices (VAPs) to support */\ndrivers/net/wireless/ath/ath10k/wmi.h-2364-\t__le32 num_vdevs;\n--\ndrivers/net/wireless/ath/ath10k/wmi.h=2559=struct wmi_resource_config_10x {\ndrivers/net/wireless/ath/ath10k/wmi.h:2560:\t/* number of virtual devices (VAPs) to support */\ndrivers/net/wireless/ath/ath10k/wmi.h-2561-\t__le32 num_vdevs;\n--\ndrivers/net/wireless/ath/ath10k/wmi.h=2764=struct wmi_resource_config_10_4 {\ndrivers/net/wireless/ath/ath10k/wmi.h:2765:\t/* Number of virtual devices (VAPs) to support */\ndrivers/net/wireless/ath/ath10k/wmi.h-2766-\t__le32 num_vdevs;\n--\ndrivers/net/wireless/ath/ath11k/hal_desc.h=17=struct ath11k_buffer_addr {\n--\ndrivers/net/wireless/ath/ath11k/hal_desc.h-47- *\t\tField can be used by SW to for example associate the buffers\ndrivers/net/wireless/ath/ath11k/hal_desc.h:48: *\t\tphysical address with the virtual address.\ndrivers/net/wireless/ath/ath11k/hal_desc.h-49- */\n--\ndrivers/net/wireless/ath/ath12k/hal.h=764=struct ath12k_buffer_addr {\n--\ndrivers/net/wireless/ath/ath12k/hal.h-794- *\t\tField can be used by SW to for example associate the buffers\ndrivers/net/wireless/ath/ath12k/hal.h:795: *\t\tphysical address with the virtual address.\ndrivers/net/wireless/ath/ath12k/hal.h-796- *\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h=733=struct hal_reo_dest_ring {\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-760- *\t\tField only valid if Reo_dest_buffer_type is set to MSDU_buf_address\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h:761: *\t\tLower 32 bits of the 64-bit virtual address corresponding\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-762- *\t\tto Buf_or_link_desc_addr_info\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-765- *\t\tAddress (upper 32 bits) of the REO queue descriptor.\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h:766: *\t\tUpper 32 bits of the 64-bit virtual address corresponding\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-767- *\t\tto Buf_or_link_desc_addr_info\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h=1121=struct hal_tcl_data_cmd {\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-1145- *\t\tused to select one of the TCL register banks for fields removed\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h:1146: *\t\tfrom 'TCL_DATA_CMD' that do not change often within one virtual\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h:1147: *\t\tdevice or a set of virtual devices:\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-1148- *\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-1232- *\t\tavoid security issues from transmitting packets from an incorrect\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h:1233: *\t\tvirtual device\ndrivers/net/wireless/ath/ath12k/wifi7/hal_desc.h-1234- *\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_rx_desc.h=208=struct rx_mpdu_start_qcn9274_compact {\n--\ndrivers/net/wireless/ath/ath12k/wifi7/hal_rx_desc.h-638- * src_info\ndrivers/net/wireless/ath/ath12k/wifi7/hal_rx_desc.h:639: *\t\tSource (virtual) device/interface info. associated with\ndrivers/net/wireless/ath/ath12k/wifi7/hal_rx_desc.h-640- *\t\tthis peer\n--\ndrivers/net/wireless/ath/ath5k/base.h=64=struct ath5k_buf {\ndrivers/net/wireless/ath/ath5k/base.h-65-\tstruct list_head\t\tlist;\ndrivers/net/wireless/ath/ath5k/base.h:66:\tstruct ath5k_desc\t\t*desc;\t\t/* virtual addr of desc */\ndrivers/net/wireless/ath/ath5k/base.h-67-\tdma_addr_t\t\t\tdaddr;\t\t/* physical addr of desc */\n--\ndrivers/net/wireless/ath/ath5k/base.h=113=void ath5k_deinit_ah(struct ath5k_hw *ah);\n--\ndrivers/net/wireless/ath/ath5k/base.h-117-\ndrivers/net/wireless/ath/ath5k/base.h:118:/* Check whether virtual EOL is supported */\ndrivers/net/wireless/ath/ath5k/base.h-119-#define ath5k_hw_hasveol(_ah) (ah-\u003eah_version != AR5K_AR5210)\n--\ndrivers/net/wireless/ath/ath5k/desc.c=559=ath5k_hw_setup_rx_desc(struct ath5k_hw *ah,\n--\ndrivers/net/wireless/ath/ath5k/desc.c-570-\t * while scanning we get too many results,\ndrivers/net/wireless/ath/ath5k/desc.c:571:\t * most of them virtual, after some secs\ndrivers/net/wireless/ath/ath5k/desc.c-572-\t * of scanning system hangs. M.F.\n--\ndrivers/net/wireless/ath/ath5k/desc.h=155=struct ath5k_hw_2w_tx_ctl {\n--\ndrivers/net/wireless/ath/ath5k/desc.h-167-#define AR5K_2W_TX_DESC_CTL0_LONG_PACKET_5210\t0x00800000 /* [5210] long packet */\ndrivers/net/wireless/ath/ath5k/desc.h:168:#define AR5K_2W_TX_DESC_CTL0_VEOL_5211\t\t0x00800000 /* [5211] virtual end-of-list */\ndrivers/net/wireless/ath/ath5k/desc.h-169-#define AR5K_2W_TX_DESC_CTL0_CLRDMASK\t\t0x01000000 /* clear destination mask */\n--\ndrivers/net/wireless/ath/ath5k/desc.h=213=struct ath5k_hw_4w_tx_ctl {\n--\ndrivers/net/wireless/ath/ath5k/desc.h-224-#define AR5K_4W_TX_DESC_CTL0_RTSENA\t\t0x00400000 /* RTS/CTS enable */\ndrivers/net/wireless/ath/ath5k/desc.h:225:#define AR5K_4W_TX_DESC_CTL0_VEOL\t\t0x00800000 /* virtual end-of-list */\ndrivers/net/wireless/ath/ath5k/desc.h-226-#define AR5K_4W_TX_DESC_CTL0_CLRDMASK\t\t0x01000000 /* clear destination mask */\n--\ndrivers/net/wireless/ath/ath5k/desc.h=276=struct ath5k_hw_tx_status {\n--\ndrivers/net/wireless/ath/ath5k/desc.h-294-#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S\t8\ndrivers/net/wireless/ath/ath5k/desc.h:295:#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5211\t0x0000f000 /* [5211+] virtual collision count */\ndrivers/net/wireless/ath/ath5k/desc.h-296-#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5212_S\t12\n--\ndrivers/net/wireless/ath/ath5k/pcu.c-51- *\ndrivers/net/wireless/ath/ath5k/pcu.c:52: * - Generating virtual CCA\ndrivers/net/wireless/ath/ath5k/pcu.c-53- *\n--\ndrivers/net/wireless/ath/ath5k/pcu.c=399=ath5k_hw_set_bssid(struct ath5k_hw *ah)\n--\ndrivers/net/wireless/ath/ath5k/pcu.c-440- * BSS every bit matters since we lock to only one BSS. In AP mode with\ndrivers/net/wireless/ath/ath5k/pcu.c:441: * multiple BSSes (virtual interfaces) not every bit matters because hw must\ndrivers/net/wireless/ath/ath5k/pcu.c-442- * accept frames for all BSSes and so we tweak some bits of our mac address\n--\ndrivers/net/wireless/ath/ath5k/pcu.c=954=ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode)\n--\ndrivers/net/wireless/ath/ath5k/pcu.c-962-\t/* Write rate duration table only on AR5212 and if\ndrivers/net/wireless/ath/ath5k/pcu.c:963:\t * virtual interface has already been brought up\ndrivers/net/wireless/ath/ath5k/pcu.c-964-\t * XXX: rethink this after new mode changes to\n--\ndrivers/net/wireless/ath/ath5k/reg.h-1449-#define AR5K_DIAG_SW_RX_CLEAR_HIGH\t0x00100000\t/* Ignore carrier sense */\ndrivers/net/wireless/ath/ath5k/reg.h:1450:#define AR5K_DIAG_SW_IGNORE_CARR_SENSE\t0x00200000\t/* Ignore virtual carrier sense */\ndrivers/net/wireless/ath/ath5k/reg.h-1451-#define AR5K_DIAG_SW_CHANNEL_IDLE_HIGH\t0x00400000\t/* Force channel idle high */\n--\ndrivers/net/wireless/ath/ath6kl/cfg80211.c=3443=static const struct cfg80211_ops ath6kl_cfg80211_ops = {\ndrivers/net/wireless/ath/ath6kl/cfg80211.c:3444:\t.add_virtual_intf = ath6kl_cfg80211_add_iface,\ndrivers/net/wireless/ath/ath6kl/cfg80211.c:3445:\t.del_virtual_intf = ath6kl_cfg80211_del_iface,\ndrivers/net/wireless/ath/ath6kl/cfg80211.c:3446:\t.change_virtual_intf = ath6kl_cfg80211_change_iface,\ndrivers/net/wireless/ath/ath6kl/cfg80211.c-3447-\t.scan = ath6kl_cfg80211_scan,\n--\ndrivers/net/wireless/ath/ath6kl/sdio.c=731=static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)\n--\ndrivers/net/wireless/ath/ath6kl/sdio.c-766-\t\t\tath6kl_sdio_cleanup_scatter(ar);\ndrivers/net/wireless/ath/ath6kl/sdio.c:767:\t\t\tath6kl_warn(\"hif scatter resource setup failed, trying virtual scatter method\\n\");\ndrivers/net/wireless/ath/ath6kl/sdio.c-768-\t\t}\n--\ndrivers/net/wireless/ath/ath6kl/sdio.c-776-\t\tif (ret) {\ndrivers/net/wireless/ath/ath6kl/sdio.c:777:\t\t\tath6kl_err(\"failed to alloc virtual scatter resources !\\n\");\ndrivers/net/wireless/ath/ath6kl/sdio.c-778-\t\t\tath6kl_sdio_cleanup_scatter(ar);\n--\ndrivers/net/wireless/ath/ath6kl/sdio.c-782-\t\tath6kl_dbg(ATH6KL_DBG_BOOT,\ndrivers/net/wireless/ath/ath6kl/sdio.c:783:\t\t\t \"virtual scatter enabled requests %d entries %d\\n\",\ndrivers/net/wireless/ath/ath6kl/sdio.c-784-\t\t\t ATH6KL_SCATTER_REQS, ATH6KL_SCATTER_ENTRIES_PER_REQ);\n--\ndrivers/net/wireless/ath/ath6kl/target.h=159=struct host_interest {\n--\ndrivers/net/wireless/ath/ath6kl/target.h-331-\ndrivers/net/wireless/ath/ath6kl/target.h:332:/* Convert a Target virtual address into a Target physical address */\ndrivers/net/wireless/ath/ath6kl/target.h-333-#define AR6003_VTOP(vaddr) ((vaddr) \u0026 0x001fffff)\n--\ndrivers/net/wireless/ath/ath9k/ath9k.h=221=struct ath_buf {\n--\ndrivers/net/wireless/ath/ath9k/ath9k.h-226-\tstruct sk_buff *bf_mpdu;\t/* enclosing frame structure */\ndrivers/net/wireless/ath/ath9k/ath9k.h:227:\tvoid *bf_desc;\t\t\t/* virtual addr of desc */\ndrivers/net/wireless/ath/ath9k/ath9k.h-228-\tdma_addr_t bf_daddr;\t\t/* physical addr of desc */\n--\ndrivers/net/wireless/ath/ath9k/mci.h=142=struct ath_mci_buf {\ndrivers/net/wireless/ath/ath9k/mci.h:143:\tvoid *bf_addr;\t\t/* virtual addr of desc */\ndrivers/net/wireless/ath/ath9k/mci.h-144-\tdma_addr_t bf_paddr; /* physical addr of buffer */\n--\ndrivers/net/wireless/ath/ath9k/recv.c=37=static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,\n--\ndrivers/net/wireless/ath/ath9k/recv.c-48-\ndrivers/net/wireless/ath/ath9k/recv.c:49:\t/* virtual addr of the beginning of the buffer. */\ndrivers/net/wireless/ath/ath9k/recv.c-50-\tskb = bf-\u003ebf_mpdu;\n--\n\n"
} |
| 25/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46291 output: 29 thoughts: 71 Thoughts: Here's my thought process, as requested: **Navigating the Wireless Driver Makefile** Okay, let's dive into this `drivers/net/wireless/Makefile`. I need to figure out how `virtual/` is being included. Specifically, I'm focusing on lines 25-28. Aha, here it is: `obj-$(CONFIG_WLAN) += virtual/`. So, `WLAN` is a configuration option, or more precisely, `CONFIG_WLAN` is the symbol used to control its inclusion. Now, where is `CONFIG_WLAN` defined? To find out, I'll need to check the Kconfig file for the wireless drivers. Let's go look in `drivers/net/wireless/Kconfig`. I'll be looking for where `CONFIG_WLAN` is defined. |
| 26/2 | 2026/10/04 14:58 | tool | grepper |
0mArgs:{
"Expression": "config WLAN\\b",
"PathPrefix": "drivers/net/wireless"
}Results: {
"Output": "drivers/net/wireless/Kconfig-5-\ndrivers/net/wireless/Kconfig:6:menuconfig WLAN\ndrivers/net/wireless/Kconfig-7-\tbool \"Wireless LAN\"\n"
} |
| 27/2 | 2026/10/04 14:58 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46627 output: 34 thoughts: 22 Thoughts: Okay, let's dive into this. I'm going to take a look at the `drivers/net/wireless/Kconfig` file, specifically focusing on lines 5 through 25. This section likely deals with the configuration options for various wireless network drivers within this kernel build. I need to understand what sorts of options are presented to the user, the dependencies between them, and how they relate to the overall structure of the wireless subsystem. I'm expecting to see things like module selection, feature toggles for different wireless standards (Wi-Fi, Bluetooth, etc.), perhaps choices related to power management or security features, and definitely conditional dependencies based on hardware availability or other kernel components. I'm going to pay close attention to the `bool`, `tristate`, `select`, `depends on`, and `default` keywords, as they will define the configuration space and how the user interacts with it. I'm particularly interested in any configuration that might influence performance or resource usage. This should give me a good overview of the design choices made in this area of the kernel. I will then have a good understanding of what configurable aspects of wireless functionality are exposed and how the build system integrates them. |
| 28/2 | 2026/10/04 14:59 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/Kconfig",
"FirstLine": 5,
"LineCount": 25
}Results: {
"Contents": " 5:\t\n 6:\tmenuconfig WLAN\n 7:\t\tbool \"Wireless LAN\"\n 8:\t\tdepends on !S390\n 9:\t\tdepends on NET\n 10:\t\tselect WIRELESS\n 11:\t\tdefault y\n 12:\t\thelp\n 13:\t\t This section contains all the pre 802.11 and 802.11 wireless\n 14:\t\t device drivers. For a complete list of drivers and documentation\n 15:\t\t on them refer to the wireless wiki:\n 16:\t\n 17:\t\t https://wireless.wiki.kernel.org/en/users/Drivers\n 18:\t\n 19:\tif WLAN\n 20:\t\n 21:\tsource \"drivers/net/wireless/admtek/Kconfig\"\n 22:\tsource \"drivers/net/wireless/ath/Kconfig\"\n 23:\tsource \"drivers/net/wireless/atmel/Kconfig\"\n 24:\tsource \"drivers/net/wireless/broadcom/Kconfig\"\n 25:\tsource \"drivers/net/wireless/intel/Kconfig\"\n 26:\tsource \"drivers/net/wireless/intersil/Kconfig\"\n 27:\tsource \"drivers/net/wireless/marvell/Kconfig\"\n 28:\tsource \"drivers/net/wireless/mediatek/Kconfig\"\n 29:\tsource \"drivers/net/wireless/microchip/Kconfig\"\n"
} |
| 29/2 | 2026/10/04 14:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 47299 output: 41 thoughts: 473 Thoughts: **Analyzing the Impact of These Configuration Options** Okay, so we're dealing with `CONFIG_WLAN`, `CONFIG_CFG80211`, `CONFIG_MAC80211`, and `CONFIG_MAC80211_HWSIM`. My immediate thought is to drill down on what's *changing* as a result of these being enabled. I need to understand the functional modifications and additions that are happening at the code level. Let's get to the heart of the matter. I've got the patch diff in front of me. Focusing on the modified functions should give me the crucial context. Alright, here's what the diff reveals: In `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, I see a couple of functions are new or modified: `mac80211_hwsim_tx_iter`, `mac80211_hwsim_tx_frame_no_nl`, `mac80211_hwsim_new_radio`, and `hwsim_cloned_frame_received_nl`. This seems like core hardware simulation infrastructure. Then, looking at `drivers/net/wireless/virtual/mac80211_hwsim_nan.c`, things are getting more interesting. There's a flurry of activity related to what I'm guessing is NAN (Neighbor Awareness Networking) support within the hardware simulation: `hwsim_nan_beacon_has_service_ids`, `mac80211_hwsim_nan_rx`, `mac80211_hwsim_nan_exec_state_transitions`, `mac80211_hwsim_nan_tx_beacon`, `mac80211_hwsim_nan_discovery_beacon_timer`, `mac80211_hwsim_nan_set_config`, `mac80211_hwsim_nan_start`, `mac80211_hwsim_nan_stop`, `mac80211_hwsim_nan_change_config`, `mac80211_hwsim_nan_txq_transmitting`, and `mac80211_hwsim_nan_receive`. That’s a significant addition and indicates significant new NAN functionality is being simulated. Finally, there's `net/mac80211/cfg.c` with this new function `ieee80211_nan_conf_copy`. I need to figure out how this `ieee80211_nan_conf_copy` function is being used. Specifically, which parts of the system are *calling* it and what this copy operation is about. This will give me a better understanding of how the NAN configuration is handled. Let's go check the call sites for it. |
| 30/2 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "ieee80211_nan_conf_copy",
"PathPrefix": "net/mac80211"
}Results: {
"Output": "net/mac80211/cfg.c=338=static void ieee80211_stop_nan(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-354-\nnet/mac80211/cfg.c:355:static int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,\nnet/mac80211/cfg.c-356-\t\t\t\t struct cfg80211_nan_conf *src,\n--\nnet/mac80211/cfg.c=414=static int ieee80211_start_nan(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-442-\nnet/mac80211/cfg.c:443:\tret = ieee80211_nan_conf_copy(\u0026sdata-\u003eu.nan.conf, conf, 0xFFFFFFFF);\nnet/mac80211/cfg.c-444-\tif (ret) {\n--\nnet/mac80211/cfg.c=452=static int ieee80211_nan_change_conf(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-472-\t */\nnet/mac80211/cfg.c:473:\tret = ieee80211_nan_conf_copy(\u0026new_conf, \u0026sdata-\u003eu.nan.conf,\nnet/mac80211/cfg.c-474-\t\t\t\t 0xFFFFFFFF);\n--\nnet/mac80211/cfg.c-477-\nnet/mac80211/cfg.c:478:\tret = ieee80211_nan_conf_copy(\u0026new_conf, conf, changes);\nnet/mac80211/cfg.c-479-\tif (ret \u003c 0)\n"
} |
| 31/2 | 2026/10/04 14:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 48956 output: 39 thoughts: 111 Thoughts: **Analyzing the 802.11 NAN Configuration Workflow** Okay, let's break this down. My initial observation is that `ieee80211_start_nan` and `ieee80211_nan_change_conf` both funnel into `ieee80211_nan_conf_copy`. That strongly suggests the configuration copying process is central to starting and modifying NAN configurations, as expected. I need to understand what this copy operation entails, its implications, and where the core configuration data is housed. Is there a distinction between initial setup and ongoing modifications? Now, focusing on the receive path – specifically within `net/mac80211/rx.c` – I see `ieee80211_accept_frame` called out. This is interesting. Given that we're talking about NAN, I expect that this function is where NAN-specific frames are evaluated. I'll need to dig into `ieee80211_accept_frame` to see how it interacts with the NAN configuration and to ensure that NAN traffic is correctly filtered or forwarded. This is a critical point to ensure correct NAN frame filtering and management. |
| 32/2 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "ieee80211_accept_frame",
"PathPrefix": "net/mac80211"
}Results: {
"Output": "net/mac80211/rx.c=4532=static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)\n--\nnet/mac80211/rx.c-4537-\nnet/mac80211/rx.c:4538:static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\nnet/mac80211/rx.c-4539-{\n--\nnet/mac80211/rx.c=5040=static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,\n--\nnet/mac80211/rx.c-5090-\t * punting here will make it go through the full checks in\nnet/mac80211/rx.c:5091:\t * ieee80211_accept_frame().\nnet/mac80211/rx.c-5092-\t */\n--\nnet/mac80211/rx.c=5201=static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,\n--\nnet/mac80211/rx.c-5216-\t *\nnet/mac80211/rx.c:5217:\t * We skip the ieee80211_accept_frame() call and do the necessary\nnet/mac80211/rx.c-5218-\t * checking inside ieee80211_invoke_fast_rx().\n--\nnet/mac80211/rx.c-5227-\nnet/mac80211/rx.c:5228:\tif (!ieee80211_accept_frame(rx))\nnet/mac80211/rx.c-5229-\t\treturn false;\n"
} |
| 33/2 | 2026/10/04 14:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 49886 output: 35 thoughts: 127 Thoughts: **Analyzing the 802.11 Frame Handling and Configuration** Okay, so I'm looking at the `ieee80211_prepare_and_rx_handle` function, and it seems to call `ieee80211_accept_frame`. Nothing too surprising there. I'm focusing my attention on how the 802.11 standard is implemented. Now, let's see, I'm noting calls to `wiphy_register` in `net/wireless/core.c`. Standard initialization process, I need to keep that in mind. Next, I'm investigating `net/wireless/nl80211.c`. Specifically, I see `nl80211_parse_nan_conf` and `nl80211_put_nan_capa`. The NAN configuration and capabilities functions are relevant, but I need to understand the control flow better. My immediate next step is to trace the call graph. Let's dig into where `nl80211_parse_nan_conf` is being called from to get a better sense of how it's used. |
| 34/2 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "nl80211_parse_nan_conf",
"PathPrefix": "net/wireless"
}Results: {
"Output": "net/wireless/nl80211.c=16620=static int nl80211_parse_nan_band_config(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-16665-\nnet/wireless/nl80211.c:16666:static int nl80211_parse_nan_conf(struct wiphy *wiphy,\nnet/wireless/nl80211.c-16667-\t\t\t\t struct genl_info *info,\n--\nnet/wireless/nl80211.c=16832=static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-16851-\nnet/wireless/nl80211.c:16852:\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, NULL, true);\nnet/wireless/nl80211.c-16853-\tif (err)\n--\nnet/wireless/nl80211.c=17206=static int nl80211_nan_change_config(struct sk_buff *skb,\n--\nnet/wireless/nl80211.c-17220-\nnet/wireless/nl80211.c:17221:\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, \u0026changed, false);\nnet/wireless/nl80211.c-17222-\tif (err)\n"
} |
| 35/2 | 2026/10/04 14:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 50742 output: 33 thoughts: 1291 Thoughts: **Analyzing NAN Configuration Entrypoints** Okay, so I'm diving into the NAN (Neighbor Awareness Networking) configuration and looking for key functions to focus on. My initial thought is to identify the non-static symbols related to this feature, as well as the specific entry points. I know `nl80211_start_nan` and `nl80211_nan_change_config` are crucial, and they both call `nl80211_parse_nan_conf`. Plus, `nl80211_put_nan_capa` is called by `nl80211_send_wiphy`, so I'll keep that in mind. I see that `cfg80211_inform_bss_frame_data` in `net/wireless/scan.c` is also in the mix. Let me see which specific feature logic or direct API entrypoints are in play here. I've got a good list: `nl80211_start_nan`, `nl80211_nan_change_config`, `mac80211_hwsim_nan_receive`, `mac80211_hwsim_nan_rx`, `mac80211_hwsim_nan_start`, `mac80211_hwsim_nan_change_config`, `mac80211_hwsim_nan_stop`, `mac80211_hwsim_nan_discovery_beacon_timer`, `mac80211_hwsim_nan_tx_beacon`, and of course `cfg80211_inform_bss_frame_data`. I have to remember that `wiphy_register` is called when a wiphy is created, but that may not be specific enough for my needs, especially given the guidelines. Following FocusSymbols guidelines, I'm trying to avoid ubiquitous lifecycle hot-paths. So I'm zeroing in on those NAN entrypoints. Also, I need to remember that static inline functions can be tricky. Here, `ieee80211_is_nan_beacon` is a static inline defined in `include/linux/ieee80211-nan.h`. Its callers are important: `mac80211_hwsim_nan_rx`, `ieee80211_accept_frame`, and `cfg80211_inform_bss_frame_data`. I want to make sure I have the direct API entrypoints for NAN configuration, so let's verify those again: `nl80211_start_nan`, `nl80211_nan_change_config`, `mac80211_hwsim_nan_start`, `mac80211_hwsim_nan_change_config`, `mac80211_hwsim_nan_stop`, `mac80211_hwsim_nan_receive`, `mac80211_hwsim_nan_rx`, `mac80211_hwsim_nan_tx_beacon`, `mac80211_hwsim_nan_discovery_beacon_timer`, and finally `cfg80211_inform_bss_frame_data`. Now, I'm going to double-check that those `mac80211_hwsim_*` functions are indeed non-static kernel functions. A quick look in `mac80211_hwsim_nan.c` confirms that `mac80211_hwsim_nan_start`, `mac80211_hwsim_nan_stop`, `mac80211_hwsim_nan_change_config`, `mac80211_hwsim_nan_rx`, and `mac80211_hwsim_nan_receive` are all non-static. `mac80211_hwsim_nan_tx_beacon` is static, which makes sense. Also, the function pointer for the hrtimer, `mac80211_hwsim_nan_discovery_beacon_timer` is not static. I also have to keep in mind that `nl80211_start_nan` is static. Okay, let me check the symbols in nl80211 to double-check my understanding. |
| 36/2 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "nl80211_start_nan",
"PathPrefix": "net/wireless"
}Results: {
"Output": "net/wireless/nl80211.c=16666=static int nl80211_parse_nan_conf(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-16831-\nnet/wireless/nl80211.c:16832:static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info)\nnet/wireless/nl80211.c-16833-{\n--\nnet/wireless/nl80211.c=19947=static const struct genl_small_ops nl80211_small_ops[] = {\n--\nnet/wireless/nl80211.c-20488-\t\t.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,\nnet/wireless/nl80211.c:20489:\t\t.doit = nl80211_start_nan,\nnet/wireless/nl80211.c-20490-\t\t.flags = GENL_ADMIN_PERM,\n"
} |
| 37/2 | 2026/10/04 14:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 53336 output: 359 thoughts: 805 Thoughts: **My Analysis of Wi-Fi Aware (NAN) Instant Communication (IC) Mode Implementation** Okay, let's break this down. First, I need to confirm that certain symbols related to NAN functionality are definitely exported or have their addresses taken, making them visible in `kallsyms`. I've verified that `nl80211_start_nan`, `nl80211_nan_change_config`, `mac80211_hwsim_nan_discovery_beacon_timer`, and `ieee80211_start_nan` are all valid symbols, either within `nl80211_small_ops`, used as a hrtimer, within `ieee80211_ops`, or explicitly exported. I've also confirmed `cfg80211_inform_bss_frame_data` is exported. This gives me a solid list of symbols to work with. To be absolutely sure, I've compiled a definitive list of symbols to include: `nl80211_start_nan`, `nl80211_nan_change_config`, `mac80211_hwsim_nan_start`, `mac80211_hwsim_nan_change_config`, `mac80211_hwsim_nan_stop`, `mac80211_hwsim_nan_receive`, `mac80211_hwsim_nan_rx`, `mac80211_hwsim_nan_discovery_beacon_timer`, and `cfg80211_inform_bss_frame_data`. Now, I'm checking the relevant Kconfig options to ensure I've got the correct dependencies. I've confirmed that the critical configurations are `WLAN`, `CFG80211`, `MAC80211`, and `MAC80211_HWSIM`. I double-checked the dependencies: `MAC80211_HWSIM` depends on `MAC80211`, which depends on `CFG80211`, which in turn depends on `RFKILL` (or not, which is fine), and finally, `WLAN` depends on `NET` (but not `S390`). The dependency chain is sound. I've also performed a sanity check on the reasoning behind the patch. I've clearly articulated that this patch enables Wi-Fi Aware (NAN) Instant Communication (IC) mode across the cfg80211, mac80211, and mac80211_hwsim components. This involves netlink attribute additions for IC and beacon interval configuration, frame handling and parsing for NAN beacons including service IDs, modifications to transmission timers, new memory allocations (`kmemdup`), attribute copying, and new `WARN_ON` checks during wiphy registration. The fact that this impacts virtual networking drivers and protocols that are completely reachable in a QEMU environment through generic netlink (nl80211) makes it an excellent target for fuzzing. My analysis is complete and thorough. I'm satisfied with the validation. |
| 38/2 | 2026/10/04 14:59 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"WLAN",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_start_nan",
"nl80211_nan_change_config",
"mac80211_hwsim_nan_start",
"mac80211_hwsim_nan_change_config",
"mac80211_hwsim_nan_stop",
"mac80211_hwsim_nan_receive",
"mac80211_hwsim_nan_rx",
"mac80211_hwsim_nan_discovery_beacon_timer",
"cfg80211_inform_bss_frame_data"
],
"Reasoning": "This patch implements Instant Communication (IC) mode support for Wi-Fi Aware (NAN) across cfg80211, mac80211, and the simulated mac80211_hwsim virtual driver. The changes introduce new netlink configuration attributes, modify beacon and frame reception/filtering paths, add parsing of variable NAN element attributes from skbs, introduce dynamic memory allocations for extra attributes, and add new runtime WARN_ON assertions in wiphy_register. Because mac80211_hwsim is a software-simulated device accessible via generic netlink (nl80211) in standard virtualized environments, these changes are fully reachable and warrant fuzzing.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"WLAN",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM"
],
"FocusSymbols": [
"nl80211_start_nan",
"nl80211_nan_change_config",
"mac80211_hwsim_nan_start",
"mac80211_hwsim_nan_change_config",
"mac80211_hwsim_nan_stop",
"mac80211_hwsim_nan_receive",
"mac80211_hwsim_nan_rx",
"mac80211_hwsim_nan_discovery_beacon_timer",
"cfg80211_inform_bss_frame_data"
],
"Reasoning": "This patch implements Instant Communication (IC) mode support for Wi-Fi Aware (NAN) across cfg80211, mac80211, and the simulated mac80211_hwsim virtual driver. The changes introduce new netlink configuration attributes, modify beacon and frame reception/filtering paths, add parsing of variable NAN element attributes from skbs, introduce dynamic memory allocations for extra attributes, and add new runtime WARN_ON assertions in wiphy_register. Because mac80211_hwsim is a software-simulated device accessible via generic netlink (nl80211) in standard virtualized environments, these changes are fully reachable and warrant fuzzing.",
"WorthFuzzing": true
} |
| 39/1 | 2026/10/04 14:59 | action | If |
2mArgs:{
"WorthFuzzing": true
}Results: null |
| 40/2 | 2026/10/04 14:59 | agent | kmsan-evaluator |
2mModel:core Args: null Results: {
"KMSANReasoning": "The patch series adds support for Instant Communication (IC) in NAN (Wi-Fi Aware) across cfg80211, mac80211, and mac80211_hwsim.\n\nApplicability analysis:\n1. User-space data exposure / Info-leaks: The netlink changes only introduce a flag attribute (NL80211_NAN_CAPA_INSTANT_COMM via nla_put_flag) which carries zero payload and no padding. No uninitialized kernel memory or padding is exposed or copied to user space.\n2. Initialization of new structures and fields: All stack variables introduced or modified (e.g. `iter_data`, `rx_outside_dw`, `instant_comm`) are fully initialized at declaration or prior to evaluation. Structures like `struct cfg80211_nan_conf` are zero-initialized (`= {}`) in `nl80211.c`. In `mac80211_hwsim_nan_tx_beacon`, the newly transmitted attributes (`nan_ie`, `extra_nan_attrs`) are fully initialized before being copied into the allocated skb.\n3. Parsing and bounds checking: Packet inspection helpers (`hwsim_nan_beacon_has_service_ids` and `ieee80211_is_nan_beacon`) validate element lengths and boundary offsets against `skb-\u003elen`. Any potential buffer overrun or boundary violation on malformed frames would be caught by KASAN.\n\nBecause the changes do not introduce or expose uninitialized memory reads or information leaks, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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 2a3d7190068a49947f3a0f326b9c677f952f8317
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Oct 4 14:58:13 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 762f99eb15e4c..7e65474c9df15 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -1775,6 +1775,7 @@ struct tx_iter_data {
struct ieee80211_channel *channel;
struct ieee80211_rx_status *rx_status;
struct ieee80211_hw *hw;
+ struct sk_buff *skb;
bool receive;
};
@@ -1787,6 +1788,7 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,
if (vif->type == NL80211_IFTYPE_NAN ||
vif->type == NL80211_IFTYPE_NAN_DATA) {
data->receive = mac80211_hwsim_nan_receive(data->hw,
+ data->skb,
data->channel,
data->rx_status);
return;
@@ -1968,6 +1970,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
.hw = data2->hw,
.channel = chan,
.rx_status = &rx_status,
+ .skb = skb,
};
if (data == data2)
@@ -5841,7 +5844,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
BIT(NL80211_BAND_5GHZ);
hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
- WIPHY_NAN_FLAGS_USERSPACE_DE;
+ WIPHY_NAN_FLAGS_USERSPACE_DE |
+ WIPHY_NAN_FLAGS_INSTANT_COMM;
hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
NAN_OP_MODE_80P80MHZ |
NAN_OP_MODE_160MHZ;
@@ -6643,6 +6647,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
struct tx_iter_data iter_data = {
.hw = data2->hw,
.rx_status = &rx_status,
+ .skb = skb,
};
/* throw away off-channel packets, but allow both the temporary
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
index 2d9f6d7b92514..6f90856099e83 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.c
@@ -33,6 +33,12 @@ static_assert(DW0_TSF_MASK + 1 == 8192 * 1024);
#define NAN_RSSI_CLOSE (-60)
#define NAN_RSSI_MIDDLE (-75)
+/* Size of the NAN vendor element carrying the mandatory attributes */
+#define NAN_BEACON_ELEM_LEN 27
+
+/* Space left in the NAN vendor element for the configured attributes */
+#define NAN_BEACON_EXTRA_ATTRS_LEN (255 - (NAN_BEACON_ELEM_LEN - 2))
+
/* Quiet time at the end of each slot where TX is suppressed */
#define NAN_CHAN_SWITCH_TIME_US 256
@@ -213,6 +219,37 @@ mac80211_hwsim_nan_schedule_slot(struct mac80211_hwsim_data *data, u8 slot,
mac80211_hwsim_tsf_to_boottime(data, tsf));
}
+static bool hwsim_nan_beacon_has_service_ids(struct sk_buff *skb)
+{
+ const struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ const struct ieee80211_nan_attr *nan_attr;
+ const struct element *elem;
+ size_t len;
+
+ if (skb->len < offsetofend(struct ieee80211_mgmt, u.beacon) ||
+ !ieee80211_is_beacon(mgmt->frame_control))
+ return false;
+
+ len = skb->len - offsetofend(struct ieee80211_mgmt, u.beacon);
+
+ /* TODO: fragmented NAN elements are not supported */
+ for_each_element_id(elem, WLAN_EID_VENDOR_SPECIFIC,
+ mgmt->u.beacon.variable, len) {
+ if (elem->datalen < 4 ||
+ get_unaligned_be32(elem->data) !=
+ (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ continue;
+
+ for_each_nan_attr(nan_attr, elem->data + 4, elem->datalen - 4)
+ if (nan_attr->attr == NAN_ATTR_SERVICE_ID_LIST ||
+ nan_attr->attr ==
+ NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST)
+ return true;
+ }
+
+ return false;
+}
+
void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
struct sk_buff *skb)
{
@@ -230,9 +267,7 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
ssize_t data_len;
u8 slot;
- /* Need a NAN vendor element at the start */
- if (skb->len < (offsetofend(struct ieee80211_mgmt, u.beacon) + 6) ||
- !ieee80211_is_beacon(mgmt->frame_control))
+ if (!ieee80211_is_nan_beacon(mgmt, skb->len))
return;
data_len = skb->len - offsetofend(struct ieee80211_mgmt, u.beacon);
@@ -266,28 +301,34 @@ void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,
}
/*
- * (overly) simplify things, only track 2.4 GHz here. Also, ignore
- * frames outside of the 2.4 GHz DW slot, unless in the initial SCAN
- * phase.
+ * Only sync on 2.4 GHz, which all NAN devices attend. The slot number
+ * is derived from the local TSF, so before being synchronized a 5 GHz
+ * beacon from a different device may fall into the local 2.4 GHz DW
+ * slot. Filter by frequency to keep such beacons out of master
+ * selection and synchronization.
*/
- if ((slot != SLOT_24GHZ_DW &&
- data->nan.phase != MAC80211_HWSIM_NAN_PHASE_SCAN) ||
- rx_status.freq != 2437)
+ if (rx_status.freq != 2437)
return;
- /* Just ignore low RSSI beacons that we cannot sync to */
- if (rx_status.signal < NAN_RSSI_MIDDLE)
- return;
+ /*
+ * Ignore frames outside of the 2.4 GHz DW slot, unless in the initial
+ * SCAN phase or in Instant Communication, where discovery beacons are
+ * received outside the DW.
+ */
+ if (slot != SLOT_24GHZ_DW) {
+ bool rx_outside_dw;
- /* Needs to be a valid NAN cluster ID in A3 */
- if (get_unaligned_be32(mgmt->bssid) != ((WLAN_OUI_WFA << 8) | 0x01))
- return;
+ scoped_guard(spinlock_bh, &data->nan.state_lock)
+ rx_outside_dw = data->nan.instant_comm ||
+ data->nan.phase ==
+ MAC80211_HWSIM_NAN_PHASE_SCAN;
- /* We are only interested in NAN beacons */
- if (nan_elem->id != WLAN_EID_VENDOR_SPECIFIC ||
- nan_elem->datalen < 4 ||
- get_unaligned_be32(nan_elem->data) !=
- (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ if (!rx_outside_dw)
+ return;
+ }
+
+ /* Just ignore low RSSI beacons that we cannot sync to */
+ if (rx_status.signal < NAN_RSSI_MIDDLE)
return;
u8 *nan_defragmented __free(kfree) = kzalloc(data_len, GFP_ATOMIC);
@@ -636,10 +677,12 @@ mac80211_hwsim_nan_exec_state_transitions(struct mac80211_hwsim_data *data)
/*
* The discovery beacon timer will stop automatically. Make sure it is
- * running if we are master. Do not bother with a proper alignment it
- * will sync itself to the TSF after the first TX.
+ * running if we are master or if Instant Communication is enabled. Do
+ * not bother with a proper alignment it will sync itself to the TSF
+ * after the first TX.
*/
- if (data->nan.role == MAC80211_HWSIM_NAN_ROLE_MASTER &&
+ if ((data->nan.role == MAC80211_HWSIM_NAN_ROLE_MASTER ||
+ data->nan.instant_comm) &&
!hrtimer_active(&data->nan.discovery_beacon_timer))
hrtimer_start(&data->nan.discovery_beacon_timer,
ns_to_ktime(10 * NSEC_PER_USEC),
@@ -698,7 +741,7 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
{
struct ieee80211_vendor_ie nan_ie = {
.element_id = WLAN_EID_VENDOR_SPECIFIC,
- .len = 27 - 2,
+ .len = NAN_BEACON_ELEM_LEN - 2,
.oui = { u32_get_bits(WLAN_OUI_WFA, 0xff0000),
u32_get_bits(WLAN_OUI_WFA, 0xff00),
u32_get_bits(WLAN_OUI_WFA, 0xff) },
@@ -707,23 +750,34 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
size_t alloc_size =
IEEE80211_TX_STATUS_HEADROOM +
offsetofend(struct ieee80211_mgmt, u.beacon) +
- 27 /* size of NAN vendor element */;
+ NAN_BEACON_ELEM_LEN;
struct ieee80211_nan_master_indication master_indication;
struct ieee80211_nan_attr nan_attr;
struct ieee80211_mgmt *mgmt;
struct sk_buff *skb;
/*
- * TODO: Should the configured vendor elements or NAN attributes be
- * included in some of these beacons?
+ * TODO: Should the configured vendor elements be included in some of
+ * these beacons?
*/
+ /* Allocate maximal size for NAN IE */
+ if (is_discovery)
+ alloc_size += NAN_BEACON_EXTRA_ATTRS_LEN;
+
skb = alloc_skb(alloc_size, GFP_ATOMIC);
if (!skb)
return;
spin_lock(&data->nan.state_lock);
+ /*
+ * The attributes configured by user space are appended to the
+ * mandatory ones.
+ */
+ if (is_discovery)
+ nan_ie.len += data->nan.extra_nan_attrs_len;
+
skb_reserve(skb, IEEE80211_TX_STATUS_HEADROOM);
mgmt = skb_put(skb, offsetofend(struct ieee80211_mgmt, u.beacon));
@@ -734,7 +788,9 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_BEACON);
- mgmt->u.beacon.beacon_int = cpu_to_le16(is_discovery ? 100 : DWST_TU);
+ mgmt->u.beacon.beacon_int =
+ cpu_to_le16(is_discovery ? data->nan.discovery_beacon_interval :
+ DWST_TU);
mgmt->u.beacon.capab_info =
cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME |
WLAN_CAPABILITY_SHORT_PREAMBLE);
@@ -765,6 +821,10 @@ mac80211_hwsim_nan_tx_beacon(struct mac80211_hwsim_data *data,
skb_put_data(skb, &data->nan.current_ami,
sizeof(data->nan.current_ami));
+ if (is_discovery && data->nan.extra_nan_attrs_len)
+ skb_put_data(skb, data->nan.extra_nan_attrs,
+ data->nan.extra_nan_attrs_len);
+
spin_unlock(&data->nan.state_lock);
mac80211_hwsim_tx_frame(data->hw, skb, channel);
@@ -877,7 +937,15 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)
return HRTIMER_NORESTART;
scoped_guard(spinlock, &data->nan.state_lock) {
- if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN ||
+ if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)
+ return HRTIMER_NORESTART;
+
+ /*
+ * With Instant Communication the discovery beacons are
+ * transmitted disregarding the role and the state, see
+ * Wi-Fi Aware version 4.0 section 13.
+ */
+ if (!data->nan.instant_comm &&
data->nan.role != MAC80211_HWSIM_NAN_ROLE_MASTER)
return HRTIMER_NORESTART;
}
@@ -894,10 +962,11 @@ mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)
tsf_now = mac80211_hwsim_get_tsf(data->hw, data->nan.device_vif);
/* Wrap value to be after the next TBTT */
- tbtt = tsf_now + ieee80211_tu_to_usec(100);
+ tbtt = tsf_now + ieee80211_tu_to_usec(data->nan.discovery_beacon_interval);
/* Round TBTT down to the correct time */
- div_u64_rem(tbtt, ieee80211_tu_to_usec(100), &remainder);
+ div_u64_rem(tbtt, ieee80211_tu_to_usec(data->nan.discovery_beacon_interval),
+ &remainder);
tbtt = tbtt - remainder;
hrtimer_set_expires(&data->nan.discovery_beacon_timer,
@@ -918,11 +987,51 @@ mac80211_hwsim_nan_sched_update_work(struct wiphy *wiphy,
ieee80211_nan_sched_update_done(data->nan.device_vif);
}
+static int mac80211_hwsim_nan_set_config(struct mac80211_hwsim_data *data,
+ struct cfg80211_nan_conf *conf)
+{
+ const u8 *extra_nan_attrs = NULL;
+ const u8 *old;
+
+ if (conf->extra_nan_attrs_len > NAN_BEACON_EXTRA_ATTRS_LEN)
+ return -EINVAL;
+
+ if (conf->extra_nan_attrs_len) {
+ extra_nan_attrs = kmemdup(conf->extra_nan_attrs,
+ conf->extra_nan_attrs_len,
+ GFP_KERNEL);
+ if (!extra_nan_attrs)
+ return -ENOMEM;
+ }
+
+ data->nan.notify_dw = conf->enable_dw_notification;
+
+ scoped_guard(spinlock_bh, &data->nan.state_lock) {
+ /*
+ * Fall back to the device default if user space did not
+ * configure it
+ */
+ data->nan.discovery_beacon_interval =
+ conf->discovery_beacon_interval ? : 100;
+
+ data->nan.instant_comm = conf->instant_comm;
+
+ old = data->nan.extra_nan_attrs;
+ data->nan.extra_nan_attrs = extra_nan_attrs;
+ data->nan.extra_nan_attrs_len = conf->extra_nan_attrs_len;
+ }
+
+ kfree(old);
+
+ return 0;
+}
+
int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_nan_conf *conf)
{
struct mac80211_hwsim_data *data = hw->priv;
+ int err;
if (vif->type != NL80211_IFTYPE_NAN)
return -EINVAL;
@@ -930,6 +1039,10 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
if (data->nan.device_vif)
return -EALREADY;
+ err = mac80211_hwsim_nan_set_config(data, conf);
+ if (err)
+ return err;
+
/* set this before starting the timer, as preemption might occur */
data->nan.device_vif = vif;
data->nan.bands = conf->bands;
@@ -938,9 +1051,13 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
mac80211_hwsim_nan_sched_update_work);
scoped_guard(spinlock_bh, &data->nan.state_lock) {
- /* Start in the "scan" phase and stay there for a little bit */
+ /*
+ * Start in the "scan" phase and stay there for a little bit,
+ * unless Instant Communication is configured, in which case an
+ * own cluster is started immediately.
+ */
data->nan.phase = MAC80211_HWSIM_NAN_PHASE_SCAN;
- data->nan.random_factor_valid_dwst = 1;
+ data->nan.random_factor_valid_dwst = conf->instant_comm ? 0 : 1;
data->nan.random_factor = 0;
data->nan.master_pref = conf->master_pref;
data->nan.role = MAC80211_HWSIM_NAN_ROLE_MASTER;
@@ -958,8 +1075,6 @@ int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,
ether_addr_copy(data->nan.cluster_id, conf->cluster_id);
- data->nan.notify_dw = conf->enable_dw_notification;
-
return 0;
}
@@ -967,6 +1082,7 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct mac80211_hwsim_data *data = hw->priv;
+ const u8 *old;
if (vif->type != NL80211_IFTYPE_NAN || !data->nan.device_vif ||
data->nan.device_vif != vif)
@@ -978,6 +1094,15 @@ int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,
wiphy_delayed_work_cancel(hw->wiphy, &data->nan.sched_update_work);
data->nan.device_vif = NULL;
+ scoped_guard(spinlock_bh, &data->nan.state_lock) {
+ old = data->nan.extra_nan_attrs;
+ data->nan.extra_nan_attrs = NULL;
+ data->nan.extra_nan_attrs_len = 0;
+ data->nan.instant_comm = false;
+ }
+
+ kfree(old);
+
return 0;
}
@@ -996,13 +1121,27 @@ int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,
wiphy_debug(hw->wiphy, "nan_config_changed: changes=0x%x\n", changes);
+ if (changes & CFG80211_NAN_CONF_CHANGED_CONFIG) {
+ int err = mac80211_hwsim_nan_set_config(data, conf);
+
+ if (err)
+ return err;
+
+ /*
+ * When Instant Communication is enabled discovery beacons are
+ * transmitted regardless of the role and the state.
+ */
+ if (conf->instant_comm &&
+ !hrtimer_active(&data->nan.discovery_beacon_timer))
+ hrtimer_start(&data->nan.discovery_beacon_timer,
+ ns_to_ktime(10 * NSEC_PER_USEC),
+ HRTIMER_MODE_REL_SOFT);
+ }
+
/* Handle only the changes we care about for simulation purposes */
if (changes & CFG80211_NAN_CONF_CHANGED_BANDS)
data->nan.bands = conf->bands;
- if (changes & CFG80211_NAN_CONF_CHANGED_CONFIG)
- data->nan.notify_dw = conf->enable_dw_notification;
-
if (changes & CFG80211_NAN_CONF_CHANGED_PREF) {
scoped_guard(spinlock_bh, &data->nan.state_lock)
data->nan.master_pref = conf->master_pref;
@@ -1185,9 +1324,16 @@ bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,
is_dw_slot = mac80211_hwsim_nan_is_dw_slot(data, slot);
if (!txq->sta) {
- /* Non-STA TXQ: allow management frames during DW */
- if (txq->vif->type == NL80211_IFTYPE_NAN)
- return is_dw_slot;
+ /* Non-STA TXQ: allow management frames during DW or IC */
+ if (txq->vif->type == NL80211_IFTYPE_NAN) {
+ if (is_dw_slot)
+ return true;
+
+ /* Outside the DW the local schedule must allow it */
+ guard(spinlock_bh)(&data->nan.state_lock);
+ return data->nan.instant_comm &&
+ data->nan.local_sched[slot].chan;
+ }
/* Allow multicast data when all the peers are available
* on this slot
@@ -1240,15 +1386,32 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,
}
bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,
+ struct sk_buff *skb,
struct ieee80211_channel *channel,
struct ieee80211_rx_status *rx_status)
{
struct mac80211_hwsim_data *data = hw->priv;
+ bool instant_comm;
u8 slot;
if (WARN_ON_ONCE(!data->nan.device_vif))
return false;
+ scoped_guard(spinlock_bh, &data->nan.state_lock)
+ instant_comm = data->nan.instant_comm;
+
+ /*
+ * During Instant Communication a peer advertises its services in the
+ * discovery beacons, which are transmitted disregarding the roles and
+ * the states, see Section 13 in Wi-Fi Aware v4.0.
+ * Note that while according to the specification Instant communication
+ * should be enabled only on the NAN discovery channels, do not force
+ * this here, and allow receiving NAN frames on any channel if Instant
+ * Communication is enabled.
+ */
+ if (instant_comm && hwsim_nan_beacon_has_service_ids(skb))
+ return true;
+
if (data->nan.phase == MAC80211_HWSIM_NAN_PHASE_SCAN)
return channel->center_freq == 2437;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
index 2801a1d8dcf07..0684f9b823baf 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_nan.h
@@ -32,6 +32,9 @@ struct mac80211_hwsim_nan_data {
/* Later members are protected by this lock */
spinlock_t state_lock;
+ const u8 *extra_nan_attrs;
+ u16 extra_nan_attrs_len;
+
u8 master_pref;
u8 random_factor;
@@ -53,6 +56,9 @@ struct mac80211_hwsim_nan_data {
bool tsf_adjusted;
bool tsf_discontinuity;
+ bool instant_comm;
+ u8 discovery_beacon_interval;
+
/*
* Local schedule - stores channel definition for each 16TU slot.
* Derived from NMI vif->cfg.nan_schedule. chan == NULL means not
@@ -93,6 +99,7 @@ void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef);
bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,
+ struct sk_buff *skb,
struct ieee80211_channel *channel,
struct ieee80211_rx_status *rx_status);
diff --git a/include/linux/ieee80211-nan.h b/include/linux/ieee80211-nan.h
index 455033955e545..7815a6cf81605 100644
--- a/include/linux/ieee80211-nan.h
+++ b/include/linux/ieee80211-nan.h
@@ -40,6 +40,8 @@
/* NAN attributes, as defined in Wi-Fi Aware (TM) specification 4.0 Table 42 */
#define NAN_ATTR_MASTER_INDICATION 0x00
#define NAN_ATTR_CLUSTER_INFO 0x01
+#define NAN_ATTR_SERVICE_ID_LIST 0x02
+#define NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST 0x28
struct ieee80211_nan_attr {
u8 attr;
@@ -74,4 +76,30 @@ struct ieee80211_nan_anchor_master_info {
_attr = (const struct ieee80211_nan_attr *) \
(_attr->data + le16_to_cpu(_attr->length)))
+static inline bool ieee80211_is_nan_beacon(const struct ieee80211_mgmt *mgmt,
+ size_t len)
+{
+ const struct element *elem;
+
+ /* The NAN IE is at least 6 octets */
+ if (len < offsetofend(struct ieee80211_mgmt, u.beacon) + 6)
+ return false;
+
+ if (!ieee80211_is_beacon(mgmt->frame_control))
+ return false;
+
+ /* NAN Cluster IDs range from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF */
+ if (get_unaligned_be32(mgmt->bssid) != ((WLAN_OUI_WFA << 8) | 0x01))
+ return false;
+
+ elem = (const struct element *)mgmt->u.beacon.variable;
+ if (elem->id != WLAN_EID_VENDOR_SPECIFIC ||
+ elem->datalen < 4 ||
+ get_unaligned_be32(elem->data) !=
+ (WLAN_OUI_WFA << 8 | WLAN_OUI_TYPE_WFA_NAN))
+ return false;
+
+ return true;
+}
+
#endif /* LINUX_IEEE80211_NAN_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b603f1804cc26..96b5bf8b8ff38 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4191,9 +4191,12 @@ struct cfg80211_nan_band_config {
* that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.
* @scan_period: period (in seconds) between NAN scans.
* @scan_dwell_time: dwell time (in milliseconds) for NAN scans.
- * @discovery_beacon_interval: interval (in TUs) for discovery beacons.
+ * @discovery_beacon_interval: interval (in TUs) for discovery beacons. Must be
+ * greater than 0 when @instant_comm is true.
* @enable_dw_notification: flag to enable/disable discovery window
* notifications.
+ * @instant_comm: if true, start Instant Communication (IC) as defined in
+ * Chapter 13 of the Wi-Fi Aware Specification v4.0.
* @band_cfgs: array of band specific configurations, indexed by
* &enum nl80211_band values.
* @extra_nan_attrs: pointer to additional NAN attributes.
@@ -4209,6 +4212,7 @@ struct cfg80211_nan_conf {
u16 scan_dwell_time;
u8 discovery_beacon_interval;
bool enable_dw_notification;
+ bool instant_comm;
struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];
const u8 *extra_nan_attrs;
u16 extra_nan_attrs_len;
@@ -6305,10 +6309,13 @@ struct wiphy_radio {
* @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable
* synchronization.
* @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.
+ * @WIPHY_NAN_FLAGS_INSTANT_COMM: Device can switch to Instant Communication
+ * (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC.
*/
enum wiphy_nan_flags {
WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),
WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),
+ WIPHY_NAN_FLAGS_INSTANT_COMM = BIT(2),
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 75d4c5d6a7a32..21d98c1ec424c 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -7890,6 +7890,11 @@ enum nl80211_nan_band_conf_attributes {
* the upcoming discovery window with
* %NL80211_CMD_NAN_NEXT_DW_NOTIFICATION.
* This is a flag attribute.
+ * @NL80211_NAN_CONF_INSTANT_COMM: If set, the NAN synchronization logic will
+ * start Instant Communication (IC) as defined in Chapter 13 of the
+ * Wi-Fi Aware Specification v4.0.
+ * %NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL must be set as well.
+ * This is a flag attribute.
* @NUM_NL80211_NAN_CONF_ATTR: Internal.
* @NL80211_NAN_CONF_ATTR_MAX: Highest NAN configuration attribute.
*
@@ -7905,6 +7910,7 @@ enum nl80211_nan_conf_attributes {
NL80211_NAN_CONF_SCAN_DWELL_TIME,
NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL,
NL80211_NAN_CONF_NOTIFY_DW,
+ NL80211_NAN_CONF_INSTANT_COMM,
/* keep last */
NUM_NL80211_NAN_CONF_ATTR,
@@ -9121,6 +9127,11 @@ enum nl80211_s1g_short_beacon_attrs {
* specification Table 79 (Capabilities field).
* @NL80211_NAN_CAPA_PHY: nested attribute containing band-agnostic
* capabilities for NAN data path. See &enum nl80211_nan_phy_cap_attr.
+ * @NL80211_NAN_CAPA_INSTANT_COMM: Flag attribute indicating that the device
+ * can switch to Instant Communication (IC) mode, as defined in Chapter 13
+ * of the Wi-Fi Aware Specification v4.0. Can only be set if
+ * %NL80211_NAN_CAPA_CONFIGURABLE_SYNC is set. When IC is enabled, the IC
+ * schedule is expected to be configured by user space.
* @__NL80211_NAN_CAPABILITIES_LAST: Internal
* @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute.
*/
@@ -9134,6 +9145,7 @@ enum nl80211_nan_capabilities {
NL80211_NAN_CAPA_MAX_CHANNEL_SWITCH_TIME,
NL80211_NAN_CAPA_CAPABILITIES,
NL80211_NAN_CAPA_PHY,
+ NL80211_NAN_CAPA_INSTANT_COMM,
/* keep last */
__NL80211_NAN_CAPABILITIES_LAST,
NL80211_NAN_CAPABILITIES_MAX = __NL80211_NAN_CAPABILITIES_LAST - 1,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bd1a857c812d4..eeab1b515e774 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -368,6 +368,7 @@ static int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,
dst->discovery_beacon_interval =
src->discovery_beacon_interval;
dst->enable_dw_notification = src->enable_dw_notification;
+ dst->instant_comm = src->instant_comm;
memcpy(&dst->band_cfgs, &src->band_cfgs,
sizeof(dst->band_cfgs));
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 7816395681fa4..b889d2a7ef751 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -745,8 +745,13 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
},
[NL80211_IFTYPE_NAN] = {
.tx = 0xffff,
+ /*
+ * Beacon Rx registration is needed to let user space handle
+ * service discovery when Instant Communication is enabled.
+ */
.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4),
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_BEACON >> 4),
},
[NL80211_IFTYPE_NAN_DATA] = {
.tx = 0xffff,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f5893f9c07c67..1121e650b0dd5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4687,7 +4687,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
* Accept only frames that are addressed to the NAN cluster
* (based on the Cluster ID). From these frames, accept only
* - public action frames,
- * - authentication frames to the local address, and
+ * - authentication frames to the local address,
+ * - NAN beacons, when Instant Communication is enabled, and
* - robust management frames except disassoc.
*/
if (!ether_addr_equal(sdata->u.nan.conf.cluster_id, hdr->addr3))
@@ -4697,6 +4698,9 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
if (ieee80211_is_auth(hdr->frame_control) &&
ether_addr_equal(sdata->vif.addr, hdr->addr1))
return true;
+ if (ieee80211_is_nan_beacon((struct ieee80211_mgmt *)hdr,
+ skb->len))
+ return sdata->u.nan.conf.instant_comm;
if (!ieee80211_is_disassoc(hdr->frame_control) &&
ieee80211_is_robust_mgmt_frame(skb))
return true;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index dc1e0522340a2..45a1709cffe7a 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -964,6 +964,18 @@ int wiphy_register(struct wiphy *wiphy)
(!wiphy->nan_capa.phy.ht.ht_supported || wiphy->n_radio > 1)))
return -EINVAL;
+ if (WARN_ON((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ !(wiphy->nan_capa.flags &
+ WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC)))
+ return -EINVAL;
+
+ /* Instant Communication requires user space to track NAN beacons */
+ if (WARN_ON((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ (!wiphy->mgmt_stypes ||
+ !(wiphy->mgmt_stypes[NL80211_IFTYPE_NAN].rx &
+ BIT(IEEE80211_STYPE_BEACON >> 4)))))
+ return -EINVAL;
+
if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
return -EINVAL;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a182404557e00..1944f001d8b00 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -687,6 +687,7 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL] =
NLA_POLICY_RANGE(NLA_U8, 50, 200),
[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },
+ [NL80211_NAN_CONF_INSTANT_COMM] = { .type = NLA_FLAG },
};
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
@@ -3036,6 +3037,10 @@ static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg)
nla_put_flag(msg, NL80211_NAN_CAPA_USERSPACE_DE))
goto fail;
+ if ((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
+ nla_put_flag(msg, NL80211_NAN_CAPA_INSTANT_COMM))
+ goto fail;
+
if (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE,
wiphy->nan_capa.op_mode) ||
nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS,
@@ -16781,6 +16786,23 @@ static int nl80211_parse_nan_conf(struct wiphy *wiphy,
conf->enable_dw_notification =
nla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);
+ conf->instant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);
+ if (conf->instant_comm) {
+ if (!(wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM)) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ attrs[NL80211_NAN_CONF_INSTANT_COMM],
+ "Instant Communication is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (!conf->discovery_beacon_interval) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ attrs[NL80211_NAN_CONF_INSTANT_COMM],
+ "Instant Communication requires a discovery beacon interval");
+ return -EINVAL;
+ }
+ }
+
out:
if (!conf->band_cfgs[NL80211_BAND_5GHZ].chan &&
(!conf->bands || conf->bands & BIT(NL80211_BAND_5GHZ))) {
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index d35c826c4b1a7..b7c6c856b3c9f 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3338,6 +3338,10 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
if (WARN_ON(!wiphy))
return NULL;
+ /* NAN beacons are not a BSS, don't add to the BSS table */
+ if (ieee80211_is_nan_beacon(mgmt, len))
+ return NULL;
+
BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=
offsetof(struct ieee80211_mgmt, u.beacon.variable));
|
| 41/3 | 2026/10/04 14:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14371 output: 46 thoughts: 897 Thoughts: **KMSAN Fuzzing Evaluation for the Patch Series** Okay, let's break this down. The prompt essentially asks if this patch series warrants firing up a dedicated KMSAN fuzzing session. The rule is clear: KMSAN is a resource hog, and *we only* use it if the patch exposes uninitialized memory risks *that other tools won't catch*. KASAN, LOCKDEP, those are our first lines of defense. I need to apply the NeedsKMSAN criteria here. The triggers I'm looking for are: 1. Kernel structures going to userspace. 2. Conditional logic relying on uninitialized variables. 3. Allocation/initialization of complex data structures with potential for later uninitialized reads. 4. Logic that lets code access uninitialized bytes of existing buffers. And, of course, *not* triggering it if the changes are about things like out-of-bounds reads/writes, NULL pointer dereferences, locking issues – KASAN and friends handle those. Fully initialized structures? No problem. No uninitialized memory risks? Fine. So, let's see what the patch touches. I have a list of modified files, a fair chunk of them dealing with mac80211, and some includes and kernel networking components. I'll need to go through each change carefully. Right, `drivers/net/wireless/virtual/mac80211_hwsim_main.c` is up first. I see a `struct tx_iter_data` gets a new `struct sk_buff *skb;` member. Okay, it gets passed to `mac80211_hwsim_nan_receive`. I need to track down exactly how `iter_data.skb` gets initialized in this context. Is it being passed down the stack? Is it zeroed? Does it get allocated? It looks like it is getting populated in `mac80211_hwsim_tx_frame_no_nl` and `hwsim_cloned_frame_received_nl` where the `iter_data`'s `.skb` is set to `skb`. I should grep `mac80211_hwsim_main.c` for `tx_iter_data` and find all callers and usages. I need to make sure this `skb` is properly handled throughout its lifecycle and that it is fully initialized. |
| 42/3 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "tx_iter_data",
"PathPrefix": "drivers/net/wireless/virtual/mac80211_hwsim_main.c"
}Results: {
"Output": "drivers/net/wireless/virtual/mac80211_hwsim_main.c=1765=static bool hwsim_chans_compat(struct ieee80211_channel *c1,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1773-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1774:struct tx_iter_data {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1775-\tstruct ieee80211_channel *channel;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1782=static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1784-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1785:\tstruct tx_iter_data *data = _data;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1786-\tint i;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1904=static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1967-\t\tstruct sk_buff *nskb;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1968:\t\tstruct tx_iter_data tx_iter_data = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1969-\t\t\t.receive = false,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1998-\t\t\t\tdata2-\u003ehw, IEEE80211_IFACE_ITER_NORMAL,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1999:\t\t\t\tmac80211_hwsim_tx_iter, \u0026tx_iter_data);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:2000:\t\t\tif (!tx_iter_data.receive)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2001-\t\t\t\tcontinue;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=6533=static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-6646-\tif (info-\u003eattrs[HWSIM_ATTR_FREQ]) {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:6647:\t\tstruct tx_iter_data iter_data = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-6648-\t\t\t.hw = data2-\u003ehw,\n"
} |
| 43/3 | 2026/10/04 14:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16683 output: 21 thoughts: 542 Thoughts: **Analyzing Potential Data Corruption in Beacon Handling** Okay, so I'm looking at how `struct tx_iter_data` is initialized. I see it's only done in two places using designated initializers, which is good because it ensures any uninitialized fields are zeroed out. Crucially, in both of these cases, `.skb = skb` is explicitly set, which is what I'd expect. Now, I'm digging into `hwsim_nan_beacon_has_service_ids(struct sk_buff *skb)`. This is where things get interesting. I'm going through the code, and I'm looking for potential vulnerabilities. I check if the `skb` is long enough and if it's a beacon, and I calculate the length of the data. Then, I'm iterating through vendor-specific elements, specifically looking for the WFA OUI. My primary concern here is the use of loops within loops, and whether bounds checking is sufficient. Ah, but wait! The crucial part is the calls to `for_each_element_id` and `for_each_nan_attr`! I need to ensure these functions do the *right* kind of bounds checking. Is this KMSAN or KASAN protecting us? I'm betting that KASAN will detect if we try to read past the end of `skb->len`. But that isn't really the root of my concerns. So, I need to understand what `for_each_element_id` and `for_each_nan_attr` *actually* do. I need to check how they handle the bounds and length of the elements they are iterating over. That's the key to figuring out if there's a potential for out-of-bounds reads. |
| 44/3 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "for_each_element_id"
}Results: {
"Output": ".clang-format=71=ForEachMacros:\n--\n.clang-format-288- - 'for_each_element_extid'\n.clang-format:289: - 'for_each_element_id'\n.clang-format-290- - 'for_each_enabled_cpu'\n--\ndrivers/net/wireless/ath/ath12k/mac.c=1650=static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif,\n--\ndrivers/net/wireless/ath/ath12k/mac.c-1687-\t*nontx_profile_found = false;\ndrivers/net/wireless/ath/ath12k/mac.c:1688:\tfor_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, start, rem_len) {\ndrivers/net/wireless/ath/ath12k/mac.c-1689-\t\t/* Fixed minimum MBSSID element length with at least one\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/mcu.c=1884=mt7915_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/mcu.c-1902-\ndrivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1903:\tfor_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID,\ndrivers/net/wireless/mediatek/mt76/mt7915/mcu.c-1904-\t\t\t \u0026skb-\u003edata[offs-\u003embssid_off],\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mcu.c=3079=mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mcu.c-3092-\ndrivers/net/wireless/mediatek/mt76/mt7996/mcu.c:3093:\tfor_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID,\ndrivers/net/wireless/mediatek/mt76/mt7996/mcu.c-3094-\t\t\t \u0026skb-\u003edata[offs-\u003embssid_off],\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=222=static bool hwsim_nan_beacon_has_service_ids(struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-235-\t/* TODO: fragmented NAN elements are not supported */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:236:\tfor_each_element_id(elem, WLAN_EID_VENDOR_SPECIFIC,\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-237-\t\t\t mgmt-\u003eu.beacon.variable, len) {\n--\ninclude/linux/ieee80211.h=2727=struct element {\n--\ninclude/linux/ieee80211.h-2741-\ninclude/linux/ieee80211.h:2742:#define for_each_element_id(element, _id, data, datalen)\t\t\\\ninclude/linux/ieee80211.h-2743-\tfor_each_element(element, data, datalen)\t\t\t\\\n--\ninclude/linux/ieee80211.h-2755-#define for_each_subelement_id(sub, id, element)\t\t\t\\\ninclude/linux/ieee80211.h:2756:\tfor_each_element_id(sub, id, (element)-\u003edata, (element)-\u003edatalen)\ninclude/linux/ieee80211.h-2757-\n--\nnet/mac80211/mlme.c=7966=ieee80211_mgd_check_cross_link_csa(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/mlme.c-7984-\nnet/mac80211/mlme.c:7985:\tfor_each_element_id(sub, IEEE80211_MLE_SUBELEM_PER_STA_PROFILE,\nnet/mac80211/mlme.c-7986-\t\t\t subelems, subelems_len) {\n--\nnet/mac80211/parse.c=827=static size_t ieee802_11_find_bssid_profile(const u8 *start, size_t len,\n--\nnet/mac80211/parse.c-836-\nnet/mac80211/parse.c:837:\tfor_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, start, len) {\nnet/mac80211/parse.c-838-\t\tif (elem-\u003edatalen \u003c 2)\n--\nnet/wireless/scan.c=642=bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,\n--\nnet/wireless/scan.c-651-\nnet/wireless/scan.c:652:\tfor_each_element_id(rnr, WLAN_EID_REDUCED_NEIGHBOR_REPORT,\nnet/wireless/scan.c-653-\t\t\t elems, elems_len) {\n--\nnet/wireless/scan.c=1439=cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,\n--\nnet/wireless/scan.c-1444-\nnet/wireless/scan.c:1445:\tfor_each_element_id(elem, eid, ies, len) {\nnet/wireless/scan.c-1446-\t\tif (elem-\u003edatalen \u003e= match_offset + match_len \u0026\u0026\n--\nnet/wireless/scan.c=2546=cfg80211_parse_mbssid_data(struct wiphy *wiphy,\n--\nnet/wireless/scan.c-2586-\nnet/wireless/scan.c:2587:\tfor_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID,\nnet/wireless/scan.c-2588-\t\t\t tx_data-\u003eie, tx_data-\u003eielen) {\n--\nnet/wireless/scan.c=2750=cfg80211_defrag_mle(const struct element *mle, const u8 *ie, size_t ielen,\n--\nnet/wireless/scan.c-2789-\tidx = 0;\nnet/wireless/scan.c:2790:\tfor_each_element_id(elem, IEEE80211_MLE_SUBELEM_PER_STA_PROFILE,\nnet/wireless/scan.c-2791-\t\t\t ie, ielen) {\n"
} |
| 45/3 | 2026/10/04 14:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19497 output: 42 thoughts: 45 Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts: **Investigating `for_each_nan_attr`** Alright, the first step is clear: I need to refresh my memory on what `for_each_nan_attr` actually *does*. Given the context, it's highly likely this is related to NAN (Neighbor Awareness Networking) and specifically handling attributes within that context. The standard procedure is to start with the authoritative definition. Therefore, I'm going to quickly look for `for_each_nan_attr` within the kernel's NAN header file. I'll use `grep` – the go-to tool for this sort of source code exploration – to pinpoint the declaration. Specifically, I'll be looking in `include/linux/ieee80211-nan.h`, because that’s the most logical place to find it, given the likely NAN-specific nature of this function. I expect to get a quick and precise answer. |
| 46/3 | 2026/10/04 14:59 | tool | grepper |
0mArgs:{
"Expression": "for_each_nan_attr",
"PathPrefix": "include/linux/ieee80211-nan.h"
}Results: {
"Output": "include/linux/ieee80211-nan.h=57=struct ieee80211_nan_anchor_master_info {\n--\ninclude/linux/ieee80211-nan.h-69-\ninclude/linux/ieee80211-nan.h:70:#define for_each_nan_attr(_attr, _data, _datalen)\t\t\t\\\ninclude/linux/ieee80211-nan.h-71-\tfor (_attr = (const struct ieee80211_nan_attr *)(_data);\t\\\n"
} |
| 47/3 | 2026/10/04 14:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19963 output: 42 thoughts: 27 Thoughts: Okay, here's my interpretation of that thought process, assuming I'm deep in the weeds of 802.11 Wi-Fi Direct and NAN implementation, speaking as an expert: **Diving into the NAN Specification** Alright, time to get my hands dirty. I need to refresh my understanding of the NAN implementation details and the nuances in the Linux kernel. Let's start by looking directly at the source code, specifically `include/linux/ieee80211-nan.h`, focusing around line 70. I'm going to scan that section for definitions related to (Specific thought processes regarding NAN definitions follow - e.g. for NAN discovery, data transfer, etc, which are not known, and would be specific to what you need the user to think about.) This likely will require deep dive for further reading. |
| 48/3 | 2026/10/04 14:59 | tool | read-file |
0mArgs:{
"File": "include/linux/ieee80211-nan.h",
"FirstLine": 60,
"LineCount": 45
}Results: {
"Contents": " 60:\t\t\tstruct {\n 61:\t\t\t\tu8 master_addr[ETH_ALEN];\n 62:\t\t\t\tu8 random_factor;\n 63:\t\t\t\tu8 master_pref;\n 64:\t\t\t} __packed;\n 65:\t\t} __packed;\n 66:\t\tu8 hop_count;\n 67:\t\t__le32 ambtt;\n 68:\t} __packed;\n 69:\t\n 70:\t#define for_each_nan_attr(_attr, _data, _datalen)\t\t\t\\\n 71:\t\tfor (_attr = (const struct ieee80211_nan_attr *)(_data);\t\\\n 72:\t\t (const u8 *)(_data) + (_datalen) - (const u8 *)_attr \u003e=\t\\\n 73:\t\t\t(int)sizeof(*_attr) \u0026\u0026\t\t\t\t\t\\\n 74:\t\t (const u8 *)(_data) + (_datalen) - (const u8 *)_attr \u003e=\t\\\n 75:\t\t\t(int)sizeof(*_attr) + le16_to_cpu(_attr-\u003elength);\t\\\n 76:\t\t _attr = (const struct ieee80211_nan_attr *)\t\t\\\n 77:\t\t\t(_attr-\u003edata + le16_to_cpu(_attr-\u003elength)))\n 78:\t\n 79:\tstatic inline bool ieee80211_is_nan_beacon(const struct ieee80211_mgmt *mgmt,\n 80:\t\t\t\t\t\t size_t len)\n 81:\t{\n 82:\t\tconst struct element *elem;\n 83:\t\n 84:\t\t/* The NAN IE is at least 6 octets */\n 85:\t\tif (len \u003c offsetofend(struct ieee80211_mgmt, u.beacon) + 6)\n 86:\t\t\treturn false;\n 87:\t\n 88:\t\tif (!ieee80211_is_beacon(mgmt-\u003eframe_control))\n 89:\t\t\treturn false;\n 90:\t\n 91:\t\t/* NAN Cluster IDs range from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF */\n 92:\t\tif (get_unaligned_be32(mgmt-\u003ebssid) != ((WLAN_OUI_WFA \u003c\u003c 8) | 0x01))\n 93:\t\t\treturn false;\n 94:\t\n 95:\t\telem = (const struct element *)mgmt-\u003eu.beacon.variable;\n 96:\t\tif (elem-\u003eid != WLAN_EID_VENDOR_SPECIFIC ||\n 97:\t\t elem-\u003edatalen \u003c 4 ||\n 98:\t\t get_unaligned_be32(elem-\u003edata) !=\n 99:\t\t (WLAN_OUI_WFA \u003c\u003c 8 | WLAN_OUI_TYPE_WFA_NAN))\n 100:\t\t\treturn false;\n 101:\t\n 102:\t\treturn true;\n 103:\t}\n 104:\t\n"
} |
| 49/3 | 2026/10/04 14:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20996 output: 40 thoughts: 27 Thoughts: Here's my take on those thoughts, tailored for an expert audience: **Diving into the 802.11 Header** Okay, time to get my hands dirty and dive into the kernel's 802.11 implementation. I need to refresh my memory on the specifics of how the `for_each_element` macro is defined, and its role in traversing data structures related to 802.11 frames. My gut feeling is it's probably used in a number of critical places, perhaps within the management frame parsing, the rate control algorithms, or even the security key management. So, I'll start by taking a close look at `include/linux/ieee80211.h` – that's the obvious starting point. I want to see if this macro is just a convenience wrapper around a more fundamental iteration mechanism, or if it provides some specific 802.11 context within the loop. The subtleties are usually in the details, and I'll need to understand the underlying data structures it operates on. I'll need to understand what's *actually* happening underneath the hood; the abstraction could be hiding a performance concern. Depending on where it is used, I might need to consider cache-line alignment and iterator invalidation scenarios, which are always important when dealing with critical network code. Let's see what's in there. |
| 50/3 | 2026/10/04 15:00 | tool | grepper |
0mArgs:{
"Expression": "define for_each_element\\(",
"PathPrefix": "include/linux/ieee80211.h"
}Results: {
"Output": "include/linux/ieee80211.h=2727=struct element {\n--\ninclude/linux/ieee80211.h-2733-/* element iteration helpers */\ninclude/linux/ieee80211.h:2734:#define for_each_element(_elem, _data, _datalen)\t\t\t\\\ninclude/linux/ieee80211.h-2735-\tfor (_elem = (const struct element *)(_data);\t\t\t\\\n"
} |
| 51/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21495 output: 42 thoughts: 31 Thoughts: Okay, let's dive into this. Here's my take on those lines of code: **Analyzing the IEEE 802.11 Header Definitions** Right, so I'm focusing in on `include/linux/ieee80211.h` and specifically lines 2730 to 2760. I know this is where the core definitions related to a specific aspect of the 802.11 standard are likely located. I'm expecting to find some data structures or enumerations defining a certain set of information within the frame format, perhaps related to management frames, specific types of information elements, or maybe even a new experimental field. It's probably something that relates to recent updates to the standard or a vendor-specific addition. I immediately start by looking for structured declarations. I would be hunting for a `struct` or a `enum` that appears pivotal. I'll expect to see bitfields being used if it's packed header data to maximize space. I'll mentally parse the field names – are they intuitive, are there obvious inconsistencies in naming or structure that I'll need to interpret? And most importantly, I'll be looking to see if these definitions are conditional on some Kconfig option or platform-specific macro. I'll be specifically watching for anything that touches on security mechanisms, key exchange, or network discovery. If this involves new encryption types or authentication methods, I'll probably be able to relate it to the current state of 802.11 security research. Alternatively, I’ll anticipate seeing definitions related to power management, QoS enhancements, or possibly support for new radio technologies. Whatever the topic, I'll need to relate it to the broader context of the 802.11 protocol stack. |
| 52/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "include/linux/ieee80211.h",
"FirstLine": 2730,
"LineCount": 35
}Results: {
"Contents": "2730:\t\tu8 data[];\n2731:\t} __packed;\n2732:\t\n2733:\t/* element iteration helpers */\n2734:\t#define for_each_element(_elem, _data, _datalen)\t\t\t\\\n2735:\t\tfor (_elem = (const struct element *)(_data);\t\t\t\\\n2736:\t\t (const u8 *)(_data) + (_datalen) - (const u8 *)_elem \u003e=\t\\\n2737:\t\t\t(int)sizeof(*_elem) \u0026\u0026\t\t\t\t\t\\\n2738:\t\t (const u8 *)(_data) + (_datalen) - (const u8 *)_elem \u003e=\t\\\n2739:\t\t\t(int)sizeof(*_elem) + _elem-\u003edatalen;\t\t\t\\\n2740:\t\t _elem = (const struct element *)(_elem-\u003edata + _elem-\u003edatalen))\n2741:\t\n2742:\t#define for_each_element_id(element, _id, data, datalen)\t\t\\\n2743:\t\tfor_each_element(element, data, datalen)\t\t\t\\\n2744:\t\t\tif (element-\u003eid == (_id))\n2745:\t\n2746:\t#define for_each_element_extid(element, extid, _data, _datalen)\t\t\\\n2747:\t\tfor_each_element(element, _data, _datalen)\t\t\t\\\n2748:\t\t\tif (element-\u003eid == WLAN_EID_EXTENSION \u0026\u0026\t\t\\\n2749:\t\t\t element-\u003edatalen \u003e 0 \u0026\u0026\t\t\t\t\\\n2750:\t\t\t element-\u003edata[0] == (extid))\n2751:\t\n2752:\t#define for_each_subelement(sub, element)\t\t\t\t\\\n2753:\t\tfor_each_element(sub, (element)-\u003edata, (element)-\u003edatalen)\n2754:\t\n2755:\t#define for_each_subelement_id(sub, id, element)\t\t\t\\\n2756:\t\tfor_each_element_id(sub, id, (element)-\u003edata, (element)-\u003edatalen)\n2757:\t\n2758:\t#define for_each_subelement_extid(sub, extid, element)\t\t\t\\\n2759:\t\tfor_each_element_extid(sub, extid, (element)-\u003edata, (element)-\u003edatalen)\n2760:\t\n2761:\t/**\n2762:\t * for_each_element_completed - determine if element parsing consumed all data\n2763:\t * @element: element pointer after for_each_element() or friends\n2764:\t * @data: same data pointer as passed to for_each_element() or friends\n"
} |
| 53/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22646 output: 49 thoughts: 1033 Thoughts: **Analyzing NAN Beacon Transmission in mac80211_hwsim** Okay, the macro definitions for `NAN_BEACON_ELEM_LEN` and `NAN_BEACON_EXTRA_ATTRS_LEN` seem correct, handling the sizes for NAN vendor elements. Now, I'm digging into `mac80211_hwsim_nan_tx_beacon` to understand the beacon transmission process. My immediate focus is on how the `skb` (socket buffer) is allocated and populated. The code first defines a `nan_ie` structure representing the NAN vendor information element, setting its basic parameters like element ID, length, OUI, and OUI type. Then, I see the calculation of `alloc_size`. It looks like the base size is determined by `IEEE80211_TX_STATUS_HEADROOM`, the size of the management frame up to the beacon information (`offsetofend(struct ieee80211_mgmt, u.beacon)`), and the mandatory NAN beacon element length (`NAN_BEACON_ELEM_LEN`). If it's a discovery beacon (`is_discovery` is true), an additional `NAN_BEACON_EXTRA_ATTRS_LEN` is added to the allocation. The allocation uses `alloc_skb` with the calculated `alloc_size`. A spinlock is acquired to protect shared NAN state. I'm focusing on the data being put into the allocated `skb`. The code calculates the length of the NAN IE based on whether or not the discovery IE is enabled and then proceeds to construct the beacon frame: the frame control, beacon interval, and capability information. I see that the `nan_ie` is copied into the `skb`, as well as `data->nan.current_ami`, and if it's a discovery beacon, the extra NAN attributes. But hold on...I need to double-check that allocation calculation. It appears I need to ensure that the code is allocating enough space to hold all of the data. This means that, when `is_discovery` is true, it needs to account for the extra attributes. Let me verify the code and make sure the `alloc_size` properly reflects all the data elements that will be placed into the buffer. This section is what I will double check. I need to make sure `alloc_size` accounts for: `IEEE80211_TX_STATUS_HEADROOM`, `offsetofend(struct ieee80211_mgmt, u.beacon)`, `NAN_BEACON_ELEM_LEN` and, when `is_discovery` is true, `NAN_BEACON_EXTRA_ATTRS_LEN` and that the data being put into `skb` matches. |
| 54/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_nan.c",
"FirstLine": 740,
"LineCount": 85
}Results: {
"Contents": " 740:\t\t\t\t struct ieee80211_channel *channel)\n 741:\t{\n 742:\t\tstruct ieee80211_vendor_ie nan_ie = {\n 743:\t\t\t.element_id = WLAN_EID_VENDOR_SPECIFIC,\n 744:\t\t\t.len = NAN_BEACON_ELEM_LEN - 2,\n 745:\t\t\t.oui = { u32_get_bits(WLAN_OUI_WFA, 0xff0000),\n 746:\t\t\t\t u32_get_bits(WLAN_OUI_WFA, 0xff00),\n 747:\t\t\t\t u32_get_bits(WLAN_OUI_WFA, 0xff) },\n 748:\t\t\t.oui_type = WLAN_OUI_TYPE_WFA_NAN,\n 749:\t\t};\n 750:\t\tsize_t alloc_size =\n 751:\t\t\tIEEE80211_TX_STATUS_HEADROOM +\n 752:\t\t\toffsetofend(struct ieee80211_mgmt, u.beacon) +\n 753:\t\t\tNAN_BEACON_ELEM_LEN;\n 754:\t\tstruct ieee80211_nan_master_indication master_indication;\n 755:\t\tstruct ieee80211_nan_attr nan_attr;\n 756:\t\tstruct ieee80211_mgmt *mgmt;\n 757:\t\tstruct sk_buff *skb;\n 758:\t\n 759:\t\t/*\n 760:\t\t * TODO: Should the configured vendor elements be included in some of\n 761:\t\t * these beacons?\n 762:\t\t */\n 763:\t\n 764:\t\t/* Allocate maximal size for NAN IE */\n 765:\t\tif (is_discovery)\n 766:\t\t\talloc_size += NAN_BEACON_EXTRA_ATTRS_LEN;\n 767:\t\n 768:\t\tskb = alloc_skb(alloc_size, GFP_ATOMIC);\n 769:\t\tif (!skb)\n 770:\t\t\treturn;\n 771:\t\n 772:\t\tspin_lock(\u0026data-\u003enan.state_lock);\n 773:\t\n 774:\t\t/*\n 775:\t\t * The attributes configured by user space are appended to the\n 776:\t\t * mandatory ones.\n 777:\t\t */\n 778:\t\tif (is_discovery)\n 779:\t\t\tnan_ie.len += data-\u003enan.extra_nan_attrs_len;\n 780:\t\n 781:\t\tskb_reserve(skb, IEEE80211_TX_STATUS_HEADROOM);\n 782:\t\tmgmt = skb_put(skb, offsetofend(struct ieee80211_mgmt, u.beacon));\n 783:\t\n 784:\t\tmemset(mgmt, 0, offsetofend(struct ieee80211_mgmt, u.beacon));\n 785:\t\tmemcpy(mgmt-\u003esa, data-\u003enan.device_vif-\u003eaddr, ETH_ALEN);\n 786:\t\tmemset(mgmt-\u003eda, 0xff, ETH_ALEN);\n 787:\t\tmemcpy(mgmt-\u003ebssid, data-\u003enan.cluster_id, ETH_ALEN);\n 788:\t\n 789:\t\tmgmt-\u003eframe_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |\n 790:\t\t\t\t\t\t IEEE80211_STYPE_BEACON);\n 791:\t\tmgmt-\u003eu.beacon.beacon_int =\n 792:\t\t\tcpu_to_le16(is_discovery ? data-\u003enan.discovery_beacon_interval :\n 793:\t\t\t\t DWST_TU);\n 794:\t\tmgmt-\u003eu.beacon.capab_info =\n 795:\t\t\tcpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME |\n 796:\t\t\t\t WLAN_CAPABILITY_SHORT_PREAMBLE);\n 797:\t\n 798:\t\t/* FIXME: set these to saner values? */\n 799:\t\tmgmt-\u003eduration = 0;\n 800:\t\tmgmt-\u003eseq_ctrl = 0;\n 801:\t\n 802:\t\t/* Put the NAN element */\n 803:\t\tskb_put_data(skb, \u0026nan_ie, sizeof(nan_ie));\n 804:\t\n 805:\t\tnan_attr.attr = NAN_ATTR_MASTER_INDICATION;\n 806:\t\tnan_attr.length = cpu_to_le16(sizeof(master_indication));\n 807:\t\tif (data-\u003enan.phase == MAC80211_HWSIM_NAN_PHASE_UP) {\n 808:\t\t\tmaster_indication.master_pref = data-\u003enan.master_pref;\n 809:\t\t\tmaster_indication.random_factor = data-\u003enan.random_factor;\n 810:\t\t} else {\n 811:\t\t\tmaster_indication.master_pref = 0;\n 812:\t\t\tmaster_indication.random_factor = 0;\n 813:\t\t}\n 814:\t\n 815:\t\tskb_put_data(skb, \u0026nan_attr, sizeof(nan_attr));\n 816:\t\tskb_put_data(skb, \u0026master_indication, sizeof(master_indication));\n 817:\t\n 818:\t\tnan_attr.attr = NAN_ATTR_CLUSTER_INFO;\n 819:\t\tnan_attr.length = cpu_to_le16(sizeof(data-\u003enan.current_ami));\n 820:\t\tskb_put_data(skb, \u0026nan_attr, sizeof(nan_attr));\n 821:\t\tskb_put_data(skb, \u0026data-\u003enan.current_ami,\n 822:\t\t\t sizeof(data-\u003enan.current_ami));\n 823:\t\n 824:\t\tif (is_discovery \u0026\u0026 data-\u003enan.extra_nan_attrs_len)\n"
} |
| 55/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25887 output: 42 thoughts: 647 Thoughts: **Analyzing NAN Configuration in mac80211_hwsim** Okay, let's break this down. First, I'm noting the construction of this NAN beacon. The `mgmt` structure is being zeroed using `memset`, then specific fields are populated. The `nan_ie` is initialized and then `skb_put_data` is used to carefully insert the data. I'm focusing on how `alloc_size` includes extra space (`NAN_BEACON_EXTRA_ATTRS_LEN`), but the `skb_put_data` only advances the tail pointer to reflect what's actually added. This implies the unused tailroom isn't reflected in `skb->len` or `skb->data` when transmitted or used in later processing, which is something I need to keep in mind. Now I'm diving into `mac80211_hwsim_nan_set_config`. I see a clear check: `if (conf->extra_nan_attrs_len > NAN_BEACON_EXTRA_ATTRS_LEN)`. That's important. The code allocates memory for extra NAN attributes using `kmemdup` if provided and its length must be within bounds. Then the code sets several configuration parameters. The configuration for the NAN attributes are guarded by a spinlock, which I appreciate for thread safety. Device default interval is set if the user did not specify one, and then the new `extra_nan_attrs` are set, and the old attributes are freed with `kfree`. The spinlock usage looks correct, and the memory management seems sound. I'm now asking myself where `conf` is coming from. That's the key question. I need to understand the source of that `conf` struct. So I need to go look at how `conf` is passed, in particular how it is parsed and passed to `mac80211_hwsim_nan_set_config`. I'll go check `nl80211_parse_nan_conf` in `net/wireless/nl80211.c` to see where the configuration parameters are being parsed. |
| 56/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 16730,
"LineCount": 85
}Results: {
"Contents": "16730:\t\t\t\tnla_data(attrs[NL80211_NAN_CONF_EXTRA_ATTRS]);\n16731:\t\t\tconf-\u003eextra_nan_attrs_len =\n16732:\t\t\t\tnla_len(attrs[NL80211_NAN_CONF_EXTRA_ATTRS]);\n16733:\t\t}\n16734:\t\n16735:\t\tif (attrs[NL80211_NAN_CONF_VENDOR_ELEMS]) {\n16736:\t\t\tconf-\u003evendor_elems =\n16737:\t\t\t\tnla_data(attrs[NL80211_NAN_CONF_VENDOR_ELEMS]);\n16738:\t\t\tconf-\u003evendor_elems_len =\n16739:\t\t\t\tnla_len(attrs[NL80211_NAN_CONF_VENDOR_ELEMS]);\n16740:\t\t}\n16741:\t\n16742:\t\tif (attrs[NL80211_NAN_CONF_BAND_CONFIGS]) {\n16743:\t\t\tnla_for_each_nested(band_config,\n16744:\t\t\t\t\t attrs[NL80211_NAN_CONF_BAND_CONFIGS],\n16745:\t\t\t\t\t rem) {\n16746:\t\t\t\tenum nl80211_band band;\n16747:\t\t\t\tstruct cfg80211_nan_band_config *cfg;\n16748:\t\t\t\tstruct nlattr *tb[NL80211_NAN_BAND_CONF_ATTR_MAX + 1];\n16749:\t\n16750:\t\t\t\terr = nla_parse_nested(tb,\n16751:\t\t\t\t\t\t NL80211_NAN_BAND_CONF_ATTR_MAX,\n16752:\t\t\t\t\t\t band_config, NULL,\n16753:\t\t\t\t\t\t info-\u003eextack);\n16754:\t\t\t\tif (err)\n16755:\t\t\t\t\treturn err;\n16756:\t\n16757:\t\t\t\tif (!tb[NL80211_NAN_BAND_CONF_BAND])\n16758:\t\t\t\t\treturn -EINVAL;\n16759:\t\n16760:\t\t\t\tband = nla_get_u8(tb[NL80211_NAN_BAND_CONF_BAND]);\n16761:\t\t\t\tif (conf-\u003ebands \u0026\u0026 !(conf-\u003ebands \u0026 BIT(band)))\n16762:\t\t\t\t\treturn -EINVAL;\n16763:\t\n16764:\t\t\t\tcfg = \u0026conf-\u003eband_cfgs[band];\n16765:\t\n16766:\t\t\t\terr = nl80211_parse_nan_band_config(wiphy, tb, cfg,\n16767:\t\t\t\t\t\t\t\t band);\n16768:\t\t\t\tif (err)\n16769:\t\t\t\t\treturn err;\n16770:\t\t\t}\n16771:\t\t}\n16772:\t\n16773:\t\tif (attrs[NL80211_NAN_CONF_SCAN_PERIOD])\n16774:\t\t\tconf-\u003escan_period =\n16775:\t\t\t\tnla_get_u16(attrs[NL80211_NAN_CONF_SCAN_PERIOD]);\n16776:\t\n16777:\t\tif (attrs[NL80211_NAN_CONF_SCAN_DWELL_TIME])\n16778:\t\t\tconf-\u003escan_dwell_time =\n16779:\t\t\t\tnla_get_u16(attrs[NL80211_NAN_CONF_SCAN_DWELL_TIME]);\n16780:\t\n16781:\t\tif (attrs[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL])\n16782:\t\t\tconf-\u003ediscovery_beacon_interval =\n16783:\t\t\t\tnla_get_u8(attrs[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL]);\n16784:\t\n16785:\t\tif (attrs[NL80211_NAN_CONF_NOTIFY_DW])\n16786:\t\t\tconf-\u003eenable_dw_notification =\n16787:\t\t\t\tnla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);\n16788:\t\n16789:\t\tconf-\u003einstant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);\n16790:\t\tif (conf-\u003einstant_comm) {\n16791:\t\t\tif (!(wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM)) {\n16792:\t\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n16793:\t\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n16794:\t\t\t\t\t\t \"Instant Communication is not supported\");\n16795:\t\t\t\treturn -EOPNOTSUPP;\n16796:\t\t\t}\n16797:\t\n16798:\t\t\tif (!conf-\u003ediscovery_beacon_interval) {\n16799:\t\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n16800:\t\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n16801:\t\t\t\t\t\t \"Instant Communication requires a discovery beacon interval\");\n16802:\t\t\t\treturn -EINVAL;\n16803:\t\t\t}\n16804:\t\t}\n16805:\t\n16806:\tout:\n16807:\t\tif (!conf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan \u0026\u0026\n16808:\t\t (!conf-\u003ebands || conf-\u003ebands \u0026 BIT(NL80211_BAND_5GHZ))) {\n16809:\t\t\t/* If no 5GHz channel is specified use default, if possible */\n16810:\t\t\tconf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan =\n16811:\t\t\t\t\tnl80211_get_nan_channel(wiphy, 5745);\n16812:\t\t\tif (!conf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan)\n16813:\t\t\t\tconf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan =\n16814:\t\t\t\t\t\tnl80211_get_nan_channel(wiphy, 5220);\n"
} |
| 57/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28726 output: 44 thoughts: 38 Thoughts: Okay, here's my take on those thoughts, framed as an expert's self-reflection: **Deep Dive into NAN Configuration Parsing** Alright, time to get my hands dirty. I'm focusing on that `nl80211_parse_nan_conf` function – need to really understand its usage. First things first, I want to trace back its callers. Get a clear picture of how this NAN configuration is actually initiated and when. That'll provide crucial context for understanding its purpose and potential integration issues. Then, and this is critical, where is the memory allocated for the `struct cfg80211_nan_conf` structure? Knowing the allocation site helps me to trace how the struct is instantiated, initialized, and ultimately, freed. This sheds light on lifetime management of this struct and I can understand if there may be any obvious memory leaks, use-after-free conditions, or other related problems. |
| 58/3 | 2026/10/04 15:00 | tool | grepper |
0mArgs:{
"Expression": "nl80211_parse_nan_conf",
"PathPrefix": "net/wireless/nl80211.c"
}Results: {
"Output": "net/wireless/nl80211.c=16620=static int nl80211_parse_nan_band_config(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-16665-\nnet/wireless/nl80211.c:16666:static int nl80211_parse_nan_conf(struct wiphy *wiphy,\nnet/wireless/nl80211.c-16667-\t\t\t\t struct genl_info *info,\n--\nnet/wireless/nl80211.c=16832=static int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-16851-\nnet/wireless/nl80211.c:16852:\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, NULL, true);\nnet/wireless/nl80211.c-16853-\tif (err)\n--\nnet/wireless/nl80211.c=17206=static int nl80211_nan_change_config(struct sk_buff *skb,\n--\nnet/wireless/nl80211.c-17220-\nnet/wireless/nl80211.c:17221:\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, \u0026changed, false);\nnet/wireless/nl80211.c-17222-\tif (err)\n"
} |
| 59/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 29448 output: 42 thoughts: 38 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing NAN Configuration Initialization and Modification** Alright, let's get down to brass tacks. I need to quickly refresh my understanding of how the `conf` variable is handled within the NAN context. Specifically, I want to trace its usage through `nl80211_start_nan` and `nl80211_nan_change_config`. I'm interested in how that configuration object is initially set up when a NAN service is started and, critically, how any subsequent modifications are processed during runtime. I'm thinking about the implications for various scenarios; are there potential race conditions in access? How is the consistency of the `conf` object ensured between these two points, given how these are likely different system calls. I need to understand whether this `conf` struct is being copied, passed by reference, or some combination thereof. Are there any locks involved, and if so, what's their scope and impact on performance? I need to quickly identify potential pitfalls related to the config structure. Specifically, I'll be looking for shared memory issues, potential for data corruption, or inconsistent state when multiple NAN services are started or configured. |
| 60/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 16830,
"LineCount": 35
}Results: {
"Contents": "16830:\t}\n16831:\t\n16832:\tstatic int nl80211_start_nan(struct sk_buff *skb, struct genl_info *info)\n16833:\t{\n16834:\t\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n16835:\t\tstruct wireless_dev *wdev = info-\u003euser_ptr[1];\n16836:\t\tstruct cfg80211_nan_conf conf = {};\n16837:\t\tint err;\n16838:\t\n16839:\t\tif (wdev-\u003eiftype != NL80211_IFTYPE_NAN)\n16840:\t\t\treturn -EOPNOTSUPP;\n16841:\t\n16842:\t\tif (wdev_running(wdev))\n16843:\t\t\treturn -EEXIST;\n16844:\t\n16845:\t\tif (rfkill_blocked(rdev-\u003ewiphy.rfkill))\n16846:\t\t\treturn -ERFKILL;\n16847:\t\n16848:\t\t/* Master preference is mandatory for START_NAN */\n16849:\t\tif (!info-\u003eattrs[NL80211_ATTR_NAN_MASTER_PREF])\n16850:\t\t\treturn -EINVAL;\n16851:\t\n16852:\t\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, NULL, true);\n16853:\t\tif (err)\n16854:\t\t\treturn err;\n16855:\t\n16856:\t\terr = rdev_start_nan(rdev, wdev, \u0026conf);\n16857:\t\tif (err)\n16858:\t\t\treturn err;\n16859:\t\n16860:\t\twdev-\u003eis_running = true;\n16861:\t\trdev-\u003eopencount++;\n16862:\t\n16863:\t\treturn 0;\n16864:\t}\n"
} |
| 61/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30351 output: 42 thoughts: 56 Thoughts: Okay, here's my take on those lines of code, presented as a personal thought process:
**Diving into the NAN Configuration**
Alright, so `struct cfg80211_nan_conf conf = {};` – right, that's just zero-initializing the `conf` struct. Good, good. Standard practice. No surprises there. Now, let's get into the meat of it in `nl80211_nan_change_config`. Specifically, I want to refresh my memory on lines 17200 through 17230, as that's where the core configuration changes are likely handled. I need to quickly run that section to see what variables are set, and how. That section determines the parameters and how they will be passed to the stack. Is there a default setup, is this going to run into issues with the hardware or is there something subtle that I may have missed? This is critical for the NAN (Neighbor Awareness Networking) configuration, so I want to make sure I understand the interaction between the user space and the kernel space here.
|
| 62/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 17206,
"LineCount": 30
}Results: {
"Contents": "17206:\tstatic int nl80211_nan_change_config(struct sk_buff *skb,\n17207:\t\t\t\t\t struct genl_info *info)\n17208:\t{\n17209:\t\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n17210:\t\tstruct wireless_dev *wdev = info-\u003euser_ptr[1];\n17211:\t\tstruct cfg80211_nan_conf conf = {};\n17212:\t\tu32 changed = 0;\n17213:\t\tint err;\n17214:\t\n17215:\t\tif (wdev-\u003eiftype != NL80211_IFTYPE_NAN)\n17216:\t\t\treturn -EOPNOTSUPP;\n17217:\t\n17218:\t\tif (!wdev_running(wdev))\n17219:\t\t\treturn -ENOTCONN;\n17220:\t\n17221:\t\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, \u0026changed, false);\n17222:\t\tif (err)\n17223:\t\t\treturn err;\n17224:\t\n17225:\t\tif (!changed)\n17226:\t\t\treturn -EINVAL;\n17227:\t\n17228:\t\treturn rdev_nan_change_conf(rdev, wdev, \u0026conf, changed);\n17229:\t}\n17230:\t\n17231:\tstatic int nl80211_start_pd(struct sk_buff *skb, struct genl_info *info)\n17232:\t{\n17233:\t\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n17234:\t\tstruct wireless_dev *wdev = info-\u003euser_ptr[1];\n17235:\t\tint err;\n"
} |
| 63/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31216 output: 42 thoughts: 101 Thoughts: **Analyzing NAN Configuration Changes** Okay, so `conf` is initialized as an empty dictionary, which makes sense. But, hold on a second... what about the `changed` variable? It's crucial to track what has actually been modified within the NAN configuration. Does the `nl80211_parse_nan_conf` function, when `NL80211_NAN_CONF_INSTANT_COMM` is set, also set the `CFG80211_NAN_CONF_CHANGED_CONFIG` flag within the `changed` variable? I need to verify that this is the case, otherwise, the change tracking is incomplete. I need to dive into the code and quickly check the implementation details. Let's jump over to `net/wireless/nl80211.c` and take a look around line 16785. That's where the critical logic should reside. |
| 64/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/wireless/nl80211.c",
"FirstLine": 16780,
"LineCount": 35
}Results: {
"Contents": "16780:\t\n16781:\t\tif (attrs[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL])\n16782:\t\t\tconf-\u003ediscovery_beacon_interval =\n16783:\t\t\t\tnla_get_u8(attrs[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL]);\n16784:\t\n16785:\t\tif (attrs[NL80211_NAN_CONF_NOTIFY_DW])\n16786:\t\t\tconf-\u003eenable_dw_notification =\n16787:\t\t\t\tnla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);\n16788:\t\n16789:\t\tconf-\u003einstant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);\n16790:\t\tif (conf-\u003einstant_comm) {\n16791:\t\t\tif (!(wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM)) {\n16792:\t\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n16793:\t\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n16794:\t\t\t\t\t\t \"Instant Communication is not supported\");\n16795:\t\t\t\treturn -EOPNOTSUPP;\n16796:\t\t\t}\n16797:\t\n16798:\t\t\tif (!conf-\u003ediscovery_beacon_interval) {\n16799:\t\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n16800:\t\t\t\t\t\t attrs[NL80211_NAN_CONF_INSTANT_COMM],\n16801:\t\t\t\t\t\t \"Instant Communication requires a discovery beacon interval\");\n16802:\t\t\t\treturn -EINVAL;\n16803:\t\t\t}\n16804:\t\t}\n16805:\t\n16806:\tout:\n16807:\t\tif (!conf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan \u0026\u0026\n16808:\t\t (!conf-\u003ebands || conf-\u003ebands \u0026 BIT(NL80211_BAND_5GHZ))) {\n16809:\t\t\t/* If no 5GHz channel is specified use default, if possible */\n16810:\t\t\tconf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan =\n16811:\t\t\t\t\tnl80211_get_nan_channel(wiphy, 5745);\n16812:\t\t\tif (!conf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan)\n16813:\t\t\t\tconf-\u003eband_cfgs[NL80211_BAND_5GHZ].chan =\n16814:\t\t\t\t\t\tnl80211_get_nan_channel(wiphy, 5220);\n"
} |
| 65/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32320 output: 33 thoughts: 48 Thoughts: Okay, let's see. My mind's buzzing – I need to get this straight. **Digging into the NAN Configuration Parsing** Wait a minute, I'm missing something crucial here. Where exactly does the `changed` variable get updated within the `nl80211_parse_nan_conf` function? I know what `changed` does in general, but I'm trying to ensure I understand how the code actually modifies it, so I can predict its behavior. It's a key piece of state. This is fundamental to understanding any side effects, and how to track the overall configuration process. Okay, let's just search within that function for every instance of `changed`. That should give me a solid view of its lifecycle here. No more guesswork; time to be precise. |
| 66/3 | 2026/10/04 15:00 | tool | grepper |
0mArgs:{
"Expression": "changed",
"PathPrefix": "net/wireless/nl80211.c"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 233 lines.\nUse more precise expression if possible.\n\nnet/wireless/nl80211.c=4244=static int nl80211_set_wiphy_radio(struct genl_info *info,\n--\nnet/wireless/nl80211.c-4247-{\nnet/wireless/nl80211.c:4248:\tu32 rts_threshold = 0, old_rts, changed = 0;\nnet/wireless/nl80211.c-4249-\tint result;\n--\nnet/wireless/nl80211.c-4256-\t\t\t\tinfo-\u003eattrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]);\nnet/wireless/nl80211.c:4257:\t\tchanged |= WIPHY_PARAM_RTS_THRESHOLD;\nnet/wireless/nl80211.c-4258-\t}\n--\nnet/wireless/nl80211.c-4263-\nnet/wireless/nl80211.c:4264:\tresult = rdev_set_wiphy_params(rdev, radio_idx, changed);\nnet/wireless/nl80211.c-4265-\tif (result)\n--\nnet/wireless/nl80211.c=4271=static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-4277-\tstruct nlattr *nl_txq_params;\nnet/wireless/nl80211.c:4278:\tu32 changed;\nnet/wireless/nl80211.c-4279-\tu8 retry_short = 0, retry_long = 0;\n--\nnet/wireless/nl80211.c-4467-\nnet/wireless/nl80211.c:4468:\tchanged = 0;\nnet/wireless/nl80211.c-4469-\n--\nnet/wireless/nl80211.c-4473-\nnet/wireless/nl80211.c:4474:\t\tchanged |= WIPHY_PARAM_RETRY_SHORT;\nnet/wireless/nl80211.c-4475-\t}\n--\nnet/wireless/nl80211.c-4480-\nnet/wireless/nl80211.c:4481:\t\tchanged |= WIPHY_PARAM_RETRY_LONG;\nnet/wireless/nl80211.c-4482-\t}\n--\nnet/wireless/nl80211.c-4498-\t\t}\nnet/wireless/nl80211.c:4499:\t\tchanged |= WIPHY_PARAM_FRAG_THRESHOLD;\nnet/wireless/nl80211.c-4500-\t}\n--\nnet/wireless/nl80211.c-4504-\t\t\tinfo-\u003eattrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]);\nnet/wireless/nl80211.c:4505:\t\tchanged |= WIPHY_PARAM_RTS_THRESHOLD;\nnet/wireless/nl80211.c-4506-\t}\n--\nnet/wireless/nl80211.c-4513-\t\t\tinfo-\u003eattrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]);\nnet/wireless/nl80211.c:4514:\t\tchanged |= WIPHY_PARAM_COVERAGE_CLASS;\nnet/wireless/nl80211.c-4515-\t}\n--\nnet/wireless/nl80211.c-4520-\nnet/wireless/nl80211.c:4521:\t\tchanged |= WIPHY_PARAM_DYN_ACK;\nnet/wireless/nl80211.c-4522-\t}\n--\nnet/wireless/nl80211.c-4530-\t\t\tinfo-\u003eattrs[NL80211_ATTR_TXQ_LIMIT]);\nnet/wireless/nl80211.c:4531:\t\tchanged |= WIPHY_PARAM_TXQ_LIMIT;\nnet/wireless/nl80211.c-4532-\t}\n--\nnet/wireless/nl80211.c-4540-\t\t\tinfo-\u003eattrs[NL80211_ATTR_TXQ_MEMORY_LIMIT]);\nnet/wireless/nl80211.c:4541:\t\tchanged |= WIPHY_PARAM_TXQ_MEMORY_LIMIT;\nnet/wireless/nl80211.c-4542-\t}\n--\nnet/wireless/nl80211.c-4550-\t\t\tinfo-\u003eattrs[NL80211_ATTR_TXQ_QUANTUM]);\nnet/wireless/nl80211.c:4551:\t\tchanged |= WIPHY_PARAM_TXQ_QUANTUM;\nnet/wireless/nl80211.c-4552-\t}\nnet/wireless/nl80211.c-4553-\nnet/wireless/nl80211.c:4554:\tif (changed) {\nnet/wireless/nl80211.c-4555-\t\tu8 old_retry_short, old_retry_long;\n--\nnet/wireless/nl80211.c-4585-\nnet/wireless/nl80211.c:4586:\t\tif (changed \u0026 WIPHY_PARAM_RETRY_SHORT)\nnet/wireless/nl80211.c-4587-\t\t\trdev-\u003ewiphy.retry_short = retry_short;\nnet/wireless/nl80211.c:4588:\t\tif (changed \u0026 WIPHY_PARAM_RETRY_LONG)\nnet/wireless/nl80211.c-4589-\t\t\trdev-\u003ewiphy.retry_long = retry_long;\nnet/wireless/nl80211.c:4590:\t\tif (changed \u0026 WIPHY_PARAM_FRAG_THRESHOLD)\nnet/wireless/nl80211.c-4591-\t\t\trdev-\u003ewiphy.frag_threshold = frag_threshold;\nnet/wireless/nl80211.c:4592:\t\tif (changed \u0026 WIPHY_PARAM_RTS_THRESHOLD) {\nnet/wireless/nl80211.c-4593-\t\t\trdev-\u003ewiphy.rts_threshold = rts_threshold;\n--\nnet/wireless/nl80211.c-4599-\t\t}\nnet/wireless/nl80211.c:4600:\t\tif (changed \u0026 WIPHY_PARAM_COVERAGE_CLASS)\nnet/wireless/nl80211.c-4601-\t\t\trdev-\u003ewiphy.coverage_class = coverage_class;\nnet/wireless/nl80211.c:4602:\t\tif (changed \u0026 WIPHY_PARAM_TXQ_LIMIT)\nnet/wireless/nl80211.c-4603-\t\t\trdev-\u003ewiphy.txq_limit = txq_limit;\nnet/wireless/nl80211.c:4604:\t\tif (changed \u0026 WIPHY_PARAM_TXQ_MEMORY_LIMIT)\nnet/wireless/nl80211.c-4605-\t\t\trdev-\u003ewiphy.txq_memory_limit = txq_memory_limit;\nnet/wireless/nl80211.c:4606:\t\tif (changed \u0026 WIPHY_PARAM_TXQ_QUANTUM)\nnet/wireless/nl80211.c-4607-\t\t\trdev-\u003ewiphy.txq_quantum = txq_quantum;\nnet/wireless/nl80211.c-4608-\nnet/wireless/nl80211.c:4609:\t\tresult = rdev_set_wiphy_params(rdev, radio_idx, changed);\nnet/wireless/nl80211.c-4610-\t\tif (result) {\n--\nnet/wireless/nl80211.c=7550=static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-7580-\nnet/wireless/nl80211.c:7581:\t/* recheck beaconing is permitted with possibly changed power type */\nnet/wireless/nl80211.c-7582-\tbeacon_check.iftype = wdev-\u003eiftype;\n--\nnet/wireless/nl80211.c=10165=static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)\n--\nnet/wireless/nl80211.c-10170-\tu32 bss_param_support = rdev-\u003ewiphy.bss_param_support;\nnet/wireless/nl80211.c:10171:\tu32 changed = 0;\nnet/wireless/nl80211.c-10172-\tbool strict;\n--\nnet/wireless/nl80211.c-10190-\t\t nla_get_u8(info-\u003eattrs[NL80211_ATTR_BSS_CTS_PROT]);\nnet/wireless/nl80211.c:10191:\t\tchanged |= WIPHY_BSS_PARAM_CTS_PROT;\nnet/wireless/nl80211.c-10192-\t}\n--\nnet/wireless/nl80211.c-10198-\t\t nla_get_u8(info-\u003eattrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]);\nnet/wireless/nl80211.c:10199:\t\tchanged |= WIPHY_BSS_PARAM_SHORT_PREAMBLE;\nnet/wireless/nl80211.c-10200-\t}\n--\nnet/wireless/nl80211.c-10206-\t\t nla_get_u8(info-\u003eattrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);\nnet/wireless/nl80211.c:10207:\t\tchanged |= WIPHY_BSS_PARAM_SHORT_SLOT_TIME;\nnet/wireless/nl80211.c-10208-\t}\n--\nnet/wireless/nl80211.c-10216-\t\t\tnla_len(info-\u003eattrs[NL80211_ATTR_BSS_BASIC_RATES]);\nnet/wireless/nl80211.c:10217:\t\tchanged |= WIPHY_BSS_PARAM_BASIC_RATES;\nnet/wireless/nl80211.c-10218-\t}\n--\nnet/wireless/nl80211.c-10223-\t\t\t!!nla_get_u8(info-\u003eattrs[NL80211_ATTR_AP_ISOLATE]);\nnet/wireless/nl80211.c:10224:\t\tchanged |= WIPHY_BSS_PARAM_AP_ISOLATE;\nnet/wireless/nl80211.c-10225-\t}\n--\nnet/wireless/nl80211.c-10230-\t\t\tnla_get_u16(info-\u003eattrs[NL80211_ATTR_BSS_HT_OPMODE]);\nnet/wireless/nl80211.c:10231:\t\tchanged |= WIPHY_BSS_PARAM_HT_OPMODE;\nnet/wireless/nl80211.c-10232-\t}\n--\nnet/wireless/nl80211.c-10241-\t\t\treturn -EINVAL;\nnet/wireless/nl80211.c:10242:\t\tchanged |= WIPHY_BSS_PARAM_P2P_CTWINDOW;\nnet/wireless/nl80211.c-10243-\t}\n--\nnet/wireless/nl80211.c-10265-\nnet/wireless/nl80211.c:10266:\tchanged \u0026= rdev-\u003ewiphy.bss_param_support;\nnet/wireless/nl80211.c:10267:\tif (!changed)\nnet/wireless/nl80211.c-10268-\t\treturn 0;\n--\nnet/wireless/nl80211.c=14365=static int nl80211_update_connect_params(struct sk_buff *skb,\n--\nnet/wireless/nl80211.c-14373-\tu32 auth_type;\nnet/wireless/nl80211.c:14374:\tu32 changed = 0;\nnet/wireless/nl80211.c-14375-\n--\nnet/wireless/nl80211.c-14381-\t\tconnect.ie_len = nla_len(info-\u003eattrs[NL80211_ATTR_IE]);\nnet/wireless/nl80211.c:14382:\t\tchanged |= UPDATE_ASSOC_IES;\nnet/wireless/nl80211.c-14383-\t}\n--\nnet/wireless/nl80211.c-14412-\t\t\tnla_len(info-\u003eattrs[NL80211_ATTR_FILS_ERP_RRK]);\nnet/wireless/nl80211.c:14413:\t\tchanged |= UPDATE_FILS_ERP_INFO;\nnet/wireless/nl80211.c-14414-\t} else if (info-\u003eattrs[NL80211_ATTR_FILS_ERP_USERNAME] ||\n--\nnet/wireless/nl80211.c-14427-\t\tif (auth_type == NL80211_AUTHTYPE_FILS_SK \u0026\u0026\nnet/wireless/nl80211.c:14428:\t\t fils_sk_offload \u0026\u0026 !(changed \u0026 UPDATE_FILS_ERP_INFO))\nnet/wireless/nl80211.c-14429-\t\t\treturn -EINVAL;\n--\nnet/wireless/nl80211.c-14431-\t\tconnect.auth_type = auth_type;\nnet/wireless/nl80211.c:14432:\t\tchanged |= UPDATE_AUTH_TYPE;\nnet/wireless/nl80211.c-14433-\t}\n--\nnet/wireless/nl80211.c-14437-\nnet/wireless/nl80211.c:14438:\treturn rdev_update_connect_params(rdev, dev, \u0026connect, changed);\nnet/wireless/nl80211.c-14439-}\n--\nnet/wireless/nl80211.c=16666=static int nl80211_parse_nan_conf(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-16668-\t\t\t\t struct cfg80211_nan_conf *conf,\nnet/wireless/nl80211.c:16669:\t\t\t\t u32 *changed_flags,\nnet/wireless/nl80211.c-16670-\t\t\t\t bool start)\n--\nnet/wireless/nl80211.c-16673-\tint err, rem;\nnet/wireless/nl80211.c:16674:\tu32 changed = 0;\nnet/wireless/nl80211.c-16675-\tstruct nlattr *band_config;\n--\nnet/wireless/nl80211.c-16680-\nnet/wireless/nl80211.c:16681:\t\tchanged |= CFG80211_NAN_CONF_CHANGED_PREF;\nnet/wireless/nl80211.c-16682-\t}\n--\nnet/wireless/nl80211.c-16693-\t\tconf-\u003ebands = bands;\nnet/wireless/nl80211.c:16694:\t\tchanged |= CFG80211_NAN_CONF_CHANGED_BANDS;\nnet/wireless/nl80211.c-16695-\t}\n--\nnet/wireless/nl80211.c-16715-\nnet/wireless/nl80211.c:16716:\tchanged |= CFG80211_NAN_CONF_CHANGED_CONFIG;\nnet/wireless/nl80211.c-16717-\tif (attrs[NL80211_NAN_CONF_CLUSTER_ID] \u0026\u0026 start) {\n--\nnet/wireless/nl80211.c-16825-\nnet/wireless/nl80211.c:16826:\tif (changed_flags)\nnet/wireless/nl80211.c:16827:\t\t*changed_flags = changed;\nnet/wireless/nl80211.c-16828-\n--\nnet/wireless/nl80211.c=17206=static int nl80211_nan_change_config(struct sk_buff *skb,\n--\nnet/wireless/nl80211.c-17211-\tstruct cfg80211_nan_conf conf = {};\nnet/wireless/nl80211.c:17212:\tu32 changed = 0;\nnet/wireless/nl80211.c-17213-\tint err;\n--\nnet/wireless/nl80211.c-17220-\nnet/wireless/nl80211.c:17221:\terr = nl80211_parse_nan_conf(\u0026rdev-\u003ewiphy, info, \u0026conf, \u0026changed, false);\nnet/wireless/nl80211.c-17222-\tif (err)\n--\nnet/wireless/nl80211.c-17224-\nnet/wireless/nl80211.c:17225:\tif (!changed)\nnet/wireless/nl80211.c-17226-\t\treturn -EINVAL;\nnet/wireless/nl80211.c-17227-\nnet/wireless/nl80211.c:17228:\treturn rdev_nan_change_conf(rdev, wdev, \u0026conf, changed);\nnet/wireless/nl80211.c-17229-}\n\n"
} |
| 67/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37445 output: 40 thoughts: 220 Thoughts: Okay, let's break this down. **Analyzing NAN Configuration Updates in mac80211** Right, so I'm seeing that `CFG80211_NAN_CONF_CHANGED_CONFIG` is *always* getting set when attributes are present. That's the key starting point. Now, the next logical step is to dive into the core configuration copy function. I need to understand exactly what happens with the NAN configuration data when it's updated. Let me look at `net/mac80211/cfg.c`, specifically `ieee80211_nan_conf_copy`. I want to see what that function, around line 368, is actually doing. Ah, there it is! It's copying the discovery beacon interval, the enable DW notification, instant communication settings and band configurations. Makes perfect sense. This copy operation is the heart of propagating the updated configuration. This will influence how NAN behavior is changed in the system. I need to investigate any potential side effects of this copy operation. |
| 68/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/mac80211/cfg.c",
"FirstLine": 355,
"LineCount": 45
}Results: {
"Contents": " 355:\tstatic int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,\n 356:\t\t\t\t\t struct cfg80211_nan_conf *src,\n 357:\t\t\t\t\t u32 changes)\n 358:\t{\n 359:\t\tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_PREF)\n 360:\t\t\tdst-\u003emaster_pref = src-\u003emaster_pref;\n 361:\t\n 362:\t\tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_BANDS)\n 363:\t\t\tdst-\u003ebands = src-\u003ebands;\n 364:\t\n 365:\t\tif (changes \u0026 CFG80211_NAN_CONF_CHANGED_CONFIG) {\n 366:\t\t\tdst-\u003escan_period = src-\u003escan_period;\n 367:\t\t\tdst-\u003escan_dwell_time = src-\u003escan_dwell_time;\n 368:\t\t\tdst-\u003ediscovery_beacon_interval =\n 369:\t\t\t\tsrc-\u003ediscovery_beacon_interval;\n 370:\t\t\tdst-\u003eenable_dw_notification = src-\u003eenable_dw_notification;\n 371:\t\t\tdst-\u003einstant_comm = src-\u003einstant_comm;\n 372:\t\t\tmemcpy(\u0026dst-\u003eband_cfgs, \u0026src-\u003eband_cfgs,\n 373:\t\t\t sizeof(dst-\u003eband_cfgs));\n 374:\t\n 375:\t\t\tkfree(dst-\u003eextra_nan_attrs);\n 376:\t\t\tdst-\u003eextra_nan_attrs = NULL;\n 377:\t\t\tdst-\u003eextra_nan_attrs_len = 0;\n 378:\t\n 379:\t\t\tkfree(dst-\u003evendor_elems);\n 380:\t\t\tdst-\u003evendor_elems = NULL;\n 381:\t\t\tdst-\u003evendor_elems_len = 0;\n 382:\t\n 383:\t\t\tif (is_zero_ether_addr(dst-\u003ecluster_id))\n 384:\t\t\t\tether_addr_copy(dst-\u003ecluster_id, src-\u003ecluster_id);\n 385:\t\n 386:\t\t\tif (src-\u003eextra_nan_attrs \u0026\u0026 src-\u003eextra_nan_attrs_len) {\n 387:\t\t\t\tdst-\u003eextra_nan_attrs = kmemdup(src-\u003eextra_nan_attrs,\n 388:\t\t\t\t\t\t\t src-\u003eextra_nan_attrs_len,\n 389:\t\t\t\t\t\t\t GFP_KERNEL);\n 390:\t\t\t\tif (!dst-\u003eextra_nan_attrs)\n 391:\t\t\t\t\tgoto no_mem;\n 392:\t\n 393:\t\t\t\tdst-\u003eextra_nan_attrs_len = src-\u003eextra_nan_attrs_len;\n 394:\t\t\t}\n 395:\t\n 396:\t\t\tif (src-\u003evendor_elems \u0026\u0026 src-\u003evendor_elems_len) {\n 397:\t\t\t\tdst-\u003evendor_elems = kmemdup(src-\u003evendor_elems,\n 398:\t\t\t\t\t\t\t src-\u003evendor_elems_len,\n 399:\t\t\t\t\t\t\t GFP_KERNEL);\n"
} |
| 69/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38728 output: 41 thoughts: 444 Thoughts: **Analyzing Frame Acceptance in mac80211 for NAN Clusters** Alright, let's dive into this `ieee80211_accept_frame` function within `net/mac80211/rx.c`. I need to understand the filtering logic, especially for frames related to NAN (Neighbor Awareness Networking) clusters. The code's primary concern seems to be determining when to accept a received frame based on its destination and type. It appears the first check is against the Cluster ID. We're only accepting frames *if* they're addressed to the NAN cluster, which makes sense. After that we see the primary cases where an accept would happen. Specifically, these are: * **Public Action Frames**: These get accepted immediately, which is typical for essential control signaling. * **Authentication Frames**: If the frame is an authentication frame *and* addressed to our local MAC, we accept it. Fine. * **NAN Beacons**: Now, there's a new check for NAN beacons. *Crucially*, this is only enabled when "Instant Communication" is activated via `sdata->u.nan.conf.instant_comm`. This looks like a refinement—only accepting these beacons under specific circumstances which I should investigate further. * **Robust Management Frames**: We reject disassociation frames (which makes sense) but accept *other* robust management frames, probably due to their critical nature in managing the NAN environment. Essentially, this function forms a key part of the frame filtering process for the NAN implementation within mac80211. This helps ensure that the driver can handle NAN-related frames correctly. |
| 70/3 | 2026/10/04 15:00 | tool | read-file |
0mArgs:{
"File": "net/mac80211/rx.c",
"FirstLine": 4680,
"LineCount": 40
}Results: {
"Contents": "4680:\t\t\t\tether_addr_equal(sdata-\u003evif.addr, hdr-\u003eaddr1));\n4681:\t\tcase NL80211_IFTYPE_NAN:\n4682:\t\t\tif (ieee80211_has_tods(hdr-\u003eframe_control) ||\n4683:\t\t\t ieee80211_has_fromds(hdr-\u003eframe_control))\n4684:\t\t\t\treturn false;\n4685:\t\n4686:\t\t\t/*\n4687:\t\t\t * Accept only frames that are addressed to the NAN cluster\n4688:\t\t\t * (based on the Cluster ID). From these frames, accept only\n4689:\t\t\t * - public action frames,\n4690:\t\t\t * - authentication frames to the local address,\n4691:\t\t\t * - NAN beacons, when Instant Communication is enabled, and\n4692:\t\t\t * - robust management frames except disassoc.\n4693:\t\t\t */\n4694:\t\t\tif (!ether_addr_equal(sdata-\u003eu.nan.conf.cluster_id, hdr-\u003eaddr3))\n4695:\t\t\t\treturn false;\n4696:\t\t\tif (ieee80211_is_public_action(hdr, skb-\u003elen))\n4697:\t\t\t\treturn true;\n4698:\t\t\tif (ieee80211_is_auth(hdr-\u003eframe_control) \u0026\u0026\n4699:\t\t\t ether_addr_equal(sdata-\u003evif.addr, hdr-\u003eaddr1))\n4700:\t\t\t\treturn true;\n4701:\t\t\tif (ieee80211_is_nan_beacon((struct ieee80211_mgmt *)hdr,\n4702:\t\t\t\t\t\t skb-\u003elen))\n4703:\t\t\t\treturn sdata-\u003eu.nan.conf.instant_comm;\n4704:\t\t\tif (!ieee80211_is_disassoc(hdr-\u003eframe_control) \u0026\u0026\n4705:\t\t\t ieee80211_is_robust_mgmt_frame(skb))\n4706:\t\t\t\treturn true;\n4707:\t\t\treturn false;\n4708:\t\tcase NL80211_IFTYPE_NAN_DATA:\n4709:\t\t\tif (ieee80211_has_tods(hdr-\u003eframe_control) ||\n4710:\t\t\t ieee80211_has_fromds(hdr-\u003eframe_control))\n4711:\t\t\t\treturn false;\n4712:\t\n4713:\t\t\tif (ieee80211_is_data(hdr-\u003eframe_control)) {\n4714:\t\t\t\tstruct ieee80211_sub_if_data *nmi;\n4715:\t\n4716:\t\t\t\tnmi = rcu_dereference(sdata-\u003eu.nan_data.nmi);\n4717:\t\t\t\tif (!nmi)\n4718:\t\t\t\t\treturn false;\n4719:\t\n"
} |
| 71/3 | 2026/10/04 15:00 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40326 output: 49 thoughts: 1348 Thoughts: **Analyzing NAN Beacon Handling in mac80211** Okay, let's dive into this NAN beacon processing logic. First, I'll check `net/mac80211/main.c` to see how the driver handles different interface types. I see that `NL80211_IFTYPE_NAN` has specific settings for transmission and reception, including enabling reception for action frames, authentication, and beacons, which is expected for service discovery in Instant Communication mode. Next, I'll examine `net/wireless/scan.c` to understand how NAN beacons are handled during scans. The code correctly filters out NAN beacons from being added to the BSS table because they aren't actually BSSes, which is crucial for preventing incorrect entries. I'll then review `nl80211_put_nan_capa` to see how NAN capabilities are advertised through Netlink. It seems straightforward; if Instant Communication is supported (`WIPHY_NAN_FLAGS_INSTANT_COMM`), a flag (`NL80211_NAN_CAPA_INSTANT_COMM`) is added to the Netlink message. Importantly, `nla_put_flag` doesn't introduce uninitialized memory issues because it just puts a zero-length attribute. Now, the core of the issue: I'll focus on `mac80211_hwsim_nan_rx`, specifically around lines 230-330 in `drivers/net/wireless/virtual/mac80211_hwsim_nan.c`. This code simulates NAN beacon reception. Previously, it had checks to make sure the frame was a valid NAN beacon, using the `nan_elem` variable, and filtering by frequency and other criteria. The initial check used to verify the beacon's format and presence of a NAN vendor element and a valid NAN cluster ID. However, the previous implementation, had logic that filtered by the DW slot. The code now appears to have removed those checks. The filtering logic has been updated, now it only syncs on 2.4 GHz, which all NAN devices attend. It also checks that the received signal strength (`rx_status.signal`) is above a certain threshold (`NAN_RSSI_MIDDLE`) to avoid syncing with weak beacons. A new check determines if the beacon is in the 2.4 GHz DW slot, unless it's in the initial SCAN phase or Instant Communication. This is important because the slot number is derived from the local TSF, so beacons from a 5 GHz device may fall in the local 2.4 GHz DW slot if the devices aren't synchronized. I should also check where `nan_elem` is defined and used. It looks like the check related to `nan_elem` has been removed. If the check has been removed, I need to check if there is some other validation present. |
| 72/3 | 2026/10/04 15:01 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_nan.c",
"FirstLine": 240,
"LineCount": 80
}Results: {
"Contents": " 240:\t\t\t (WLAN_OUI_WFA \u003c\u003c 8 | WLAN_OUI_TYPE_WFA_NAN))\n 241:\t\t\t\tcontinue;\n 242:\t\n 243:\t\t\tfor_each_nan_attr(nan_attr, elem-\u003edata + 4, elem-\u003edatalen - 4)\n 244:\t\t\t\tif (nan_attr-\u003eattr == NAN_ATTR_SERVICE_ID_LIST ||\n 245:\t\t\t\t nan_attr-\u003eattr ==\n 246:\t\t\t\t NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST)\n 247:\t\t\t\t\treturn true;\n 248:\t\t}\n 249:\t\n 250:\t\treturn false;\n 251:\t}\n 252:\t\n 253:\tvoid mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n 254:\t\t\t\t struct sk_buff *skb)\n 255:\t{\n 256:\t\tstruct mac80211_hwsim_data *data = hw-\u003epriv;\n 257:\t\tconst struct ieee80211_mgmt *mgmt = (void *)skb-\u003edata;\n 258:\t\tstruct element *nan_elem = (void *)mgmt-\u003eu.beacon.variable;\n 259:\t\tstruct ieee80211_nan_anchor_master_info *ami = NULL;\n 260:\t\tconst struct ieee80211_nan_attr *nan_attr;\n 261:\t\tstruct ieee80211_rx_status rx_status;\n 262:\t\tbool joined_cluster = false;\n 263:\t\tbool adopt_tsf = false;\n 264:\t\tbool is_sync_beacon;\n 265:\t\tbool is_same_cluster;\n 266:\t\tu64 master_rank = 0;\n 267:\t\tssize_t data_len;\n 268:\t\tu8 slot;\n 269:\t\n 270:\t\tif (!ieee80211_is_nan_beacon(mgmt, skb-\u003elen))\n 271:\t\t\treturn;\n 272:\t\n 273:\t\tdata_len = skb-\u003elen - offsetofend(struct ieee80211_mgmt, u.beacon);\n 274:\t\n 275:\t\t/* Copy the RX status to add a MAC timestamp if needed */\n 276:\t\tmemcpy(\u0026rx_status, IEEE80211_SKB_RXCB(skb),\n 277:\t\t sizeof(struct ieee80211_rx_status));\n 278:\t\n 279:\t\t/* And deal with the lack of mac time stamp */\n 280:\t\tif ((rx_status.flag \u0026 RX_FLAG_MACTIME) != RX_FLAG_MACTIME_START) {\n 281:\t\t\tu64 tsf = mac80211_hwsim_get_tsf(hw, data-\u003enan.device_vif);;\n 282:\t\n 283:\t\t\t/* In that case there should be no timestamp */\n 284:\t\t\tWARN_ON_ONCE(rx_status.flag \u0026 RX_FLAG_MACTIME);\n 285:\t\n 286:\t\t\t/* No mac timestamp, set current TSF for the frame end */\n 287:\t\t\trx_status.flag |= RX_FLAG_MACTIME_END;\n 288:\t\t\trx_status.mactime = tsf;\n 289:\t\n 290:\t\t\t/* And translate to the start for the rest of the code */\n 291:\t\t\trx_status.mactime =\n 292:\t\t\t\tieee80211_calculate_rx_timestamp(hw, \u0026rx_status,\n 293:\t\t\t\t\t\t\t\t skb-\u003elen, 0);\n 294:\t\t\trx_status.flag \u0026= ~RX_FLAG_MACTIME;\n 295:\t\t\trx_status.flag |= RX_FLAG_MACTIME_START;\n 296:\t\n 297:\t\t\t/* Match mac80211_hwsim_nan_receive, see comment there */\n 298:\t\t\tslot = hwsim_nan_slot_from_tsf(tsf + 128);\n 299:\t\t} else {\n 300:\t\t\tslot = hwsim_nan_slot_from_tsf(rx_status.mactime);\n 301:\t\t}\n 302:\t\n 303:\t\t/*\n 304:\t\t * Only sync on 2.4 GHz, which all NAN devices attend. The slot number\n 305:\t\t * is derived from the local TSF, so before being synchronized a 5 GHz\n 306:\t\t * beacon from a different device may fall into the local 2.4 GHz DW\n 307:\t\t * slot. Filter by frequency to keep such beacons out of master\n 308:\t\t * selection and synchronization.\n 309:\t\t */\n 310:\t\tif (rx_status.freq != 2437)\n 311:\t\t\treturn;\n 312:\t\n 313:\t\t/*\n 314:\t\t * Ignore frames outside of the 2.4 GHz DW slot, unless in the initial\n 315:\t\t * SCAN phase or in Instant Communication, where discovery beacons are\n 316:\t\t * received outside the DW.\n 317:\t\t */\n 318:\t\tif (slot != SLOT_24GHZ_DW) {\n 319:\t\t\tbool rx_outside_dw;\n"
} |
| 73/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 43760 output: 40 thoughts: 818 Thoughts: **Analyzing NAN Beacon Reception and Processing** Okay, let's break this down. First, I see the core logic for identifying NAN beacons, `ieee80211_is_nan_beacon`, which is a static inline function. It checks several critical elements: the minimum frame length, whether it's actually a beacon frame, the BSSID for a valid NAN cluster ID (specifically, the WFA OUI and a fixed value), and finally, verifies the presence and content of the Vendor Specific Information Element (IE) for NAN, confirming the WFA OUI and NAN type. This looks solid, a good, concise way to validate the structure. Then, I'm noting how this function is used within `mac80211_hwsim_nan_rx`. Previously, that function duplicated the same checks directly. The refactor simplifies the code, making it cleaner and easier to maintain – good practice. The consolidation into `ieee80211_is_nan_beacon` is a clear improvement. But wait a minute, how does this interaction occur in user space? I need to understand how the NAN beacons that are received with the `instant_comm` feature are handled. Let's look at `net/mac80211/rx.c`. I see `ieee80211_accept_frame`, it seems the critical path is here: the return is determined by `sdata->u.nan.conf.instant_comm`. Now, when `ieee80211_accept_frame` returns true for NAN beacons on `NL80211_IFTYPE_NAN`, I need to understand what happens to the received SKB (socket buffer). So, if `ieee80211_accept_frame` returns `true` for a NAN beacon, based on `instant_comm`, where does it go from there? What does mac80211 do with this accepted management frame for NAN interface types? That’s where my focus should be to understand the complete end-to-end path. |
| 74/3 | 2026/10/04 15:01 | tool | grepper |
0mArgs:{
"Expression": "ieee80211_accept_frame",
"PathPrefix": "net/mac80211/"
}Results: {
"Output": "net/mac80211/rx.c=4532=static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)\n--\nnet/mac80211/rx.c-4537-\nnet/mac80211/rx.c:4538:static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\nnet/mac80211/rx.c-4539-{\n--\nnet/mac80211/rx.c=5040=static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,\n--\nnet/mac80211/rx.c-5090-\t * punting here will make it go through the full checks in\nnet/mac80211/rx.c:5091:\t * ieee80211_accept_frame().\nnet/mac80211/rx.c-5092-\t */\n--\nnet/mac80211/rx.c=5201=static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,\n--\nnet/mac80211/rx.c-5216-\t *\nnet/mac80211/rx.c:5217:\t * We skip the ieee80211_accept_frame() call and do the necessary\nnet/mac80211/rx.c-5218-\t * checking inside ieee80211_invoke_fast_rx().\n--\nnet/mac80211/rx.c-5227-\nnet/mac80211/rx.c:5228:\tif (!ieee80211_accept_frame(rx))\nnet/mac80211/rx.c-5229-\t\treturn false;\n"
} |
| 75/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 45590 output: 41 thoughts: 56 Thoughts: Here's my summary, as if I were thinking these thoughts: **Diving Deep into the 802.11 RX Path** Okay, so I'm trying to trace the path of a received frame after it's been prepped for handling, specifically from the `ieee80211_prepare_and_rx_handle` function. My instinct is to understand exactly *what* happens next. Let's see what happens after that critical point. Right, that function handles the initial setup, and now I want to understand the actual frame processing. Let's start with lines 5220-5260 within `net/mac80211/rx.c` to see if we can understand where this packet goes next. |
| 76/3 | 2026/10/04 15:01 | tool | read-file |
0mArgs:{
"File": "net/mac80211/rx.c",
"FirstLine": 5225,
"LineCount": 40
}Results: {
"Contents": "5225:\t\t\t\treturn true;\n5226:\t\t}\n5227:\t\n5228:\t\tif (!ieee80211_accept_frame(rx))\n5229:\t\t\treturn false;\n5230:\t\n5231:\t\tif (!consume) {\n5232:\t\t\tstruct skb_shared_hwtstamps *shwt;\n5233:\t\n5234:\t\t\trx-\u003eskb = skb_copy(skb, GFP_ATOMIC);\n5235:\t\t\tif (!rx-\u003eskb) {\n5236:\t\t\t\tif (net_ratelimit())\n5237:\t\t\t\t\twiphy_debug(local-\u003ehw.wiphy,\n5238:\t\t\t\t\t\t\"failed to copy skb for %s\\n\",\n5239:\t\t\t\t\t\tsdata-\u003ename);\n5240:\t\t\t\treturn true;\n5241:\t\t\t}\n5242:\t\n5243:\t\t\t/* skb_copy() does not copy the hw timestamps, so copy it\n5244:\t\t\t * explicitly\n5245:\t\t\t */\n5246:\t\t\tshwt = skb_hwtstamps(rx-\u003eskb);\n5247:\t\t\tshwt-\u003ehwtstamp = skb_hwtstamps(skb)-\u003ehwtstamp;\n5248:\t\n5249:\t\t\t/* Update the hdr pointer to the new skb for translation below */\n5250:\t\t\thdr = (struct ieee80211_hdr *)rx-\u003eskb-\u003edata;\n5251:\t\t}\n5252:\t\n5253:\t\tstatus = IEEE80211_SKB_RXCB(rx-\u003eskb);\n5254:\t\tstatus-\u003elink_id = rx-\u003elink_id \u003c 0 ? 0 : rx-\u003elink_id;\n5255:\t\n5256:\t\tif (ieee80211_is_s1g_beacon(hdr-\u003eframe_control)) {\n5257:\t\t\tieee80211_invoke_rx_handlers(rx);\n5258:\t\t\treturn true;\n5259:\t\t}\n5260:\t\n5261:\t\t/* Store a copy of the pre-translated link addresses for SW crypto */\n5262:\t\tif (unlikely(is_unicast_ether_addr(hdr-\u003eaddr1) \u0026\u0026\n5263:\t\t\t !ieee80211_is_data(hdr-\u003eframe_control)))\n5264:\t\t\tmemcpy(rx-\u003elink_addrs, \u0026hdr-\u003eaddrs, 3 * ETH_ALEN);\n"
} |
| 77/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46515 output: 50 thoughts: 2220 Thoughts: **NAN Instant Communication and KMSAN Investigation** Okay, let's break this down. My initial concern was centered around potential KMSAN issues within the NAN (Neighbor Awareness Networking) Instant Communication functionality, specifically around how management frames are handled and passed to user space. It seems `ieee80211_invoke_rx_handlers(rx)` forwards management frames to user space via `nl80211 mgmt rx`, specifically `cfg80211_rx_mgmt`. I needed to understand whether and how beacons were processed in `scan.c`. I see `cfg80211_inform_bss_frame_data` checks for NAN beacons and explicitly *doesn't* add them to the BSS cache. This suggests that if a NAN beacon is received, it's not being treated as a typical BSS, therefore, is *not* used in building the BSS cache. The first potential area was uninitialized kernel data sent to user space. After reviewing the code, it seems the `nla_put_flag` call for `NL80211_NAN_CAPA_INSTANT_COMM` simply adds an attribute header, with no data or padding. This looks safe. The other path to user space seems to be the `cfg80211_rx_mgmt` or similar functions, which pass the received `skb`. The packet data itself comes from the network, so it should be properly initialized. Second, I had to ensure that conditional logic and branches relied on initialized variables. I focused on the relevant struct fields: `wiphy->nan_capa.flags`, `data->nan.instant_comm`, `data->nan.discovery_beacon_interval`, `data->nan.extra_nan_attrs`, and `tx_iter_data.skb`, and `conf->instant_comm` and `conf->discovery_beacon_interval`. The initial setup of `wiphy` happens during registration, and the flags are set by the driver at init, which seems safe. Then, I needed to check where the data structure members are set (and cleared). `data->nan.instant_comm` etc. are set in `mac80211_hwsim_nan_set_config` and cleared in `nan_stop`. I examined the `mac80211_hwsim_nan_set_config` function, where all fields are initialized via `kzalloc` in `mac80211_hwsim_new_radio`. Then, the configuration is properly copied. The `extra_nan_attrs` is `NULL` or allocated via `kmemdup`. Finally, during the stop function, these fields are cleared, and memory freed. I confirmed this in the `mac80211_hwsim_nan_stop`. This all seems safe. Finally, I wanted to ensure `hwsim_nan_beacon_has_service_ids` was safe. In this function, the input is `skb`. The concerns were the contents of `skb`. After retracing the uses of `skb` in `mac80211_hwsim_tx_frame_no_nl` and `hwsim_cloned_frame_received_nl`, I confirmed that `skb` is a valid, initialized pointer. After a thorough code review, I've satisfied myself that there are no KMSAN-relevant issues around NAN Instant Communication. |
| 78/3 | 2026/10/04 15:01 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/mac80211_hwsim_main.c",
"FirstLine": 6640,
"LineCount": 40
}Results: {
"Contents": "6640:\t\n6641:\t\tif ((data2-\u003eidle \u0026\u0026 !data2-\u003etmp_chan) || !data2-\u003estarted)\n6642:\t\t\tgoto out_unlock;\n6643:\t\n6644:\t\t/* A frame is received from user space */\n6645:\t\tmemset(\u0026rx_status, 0, sizeof(rx_status));\n6646:\t\tif (info-\u003eattrs[HWSIM_ATTR_FREQ]) {\n6647:\t\t\tstruct tx_iter_data iter_data = {\n6648:\t\t\t\t.hw = data2-\u003ehw,\n6649:\t\t\t\t.rx_status = \u0026rx_status,\n6650:\t\t\t\t.skb = skb,\n6651:\t\t\t};\n6652:\t\n6653:\t\t\t/* throw away off-channel packets, but allow both the temporary\n6654:\t\t\t * (\"hw\" scan/remain-on-channel), regular channels and links,\n6655:\t\t\t * since the internal datapath also allows this\n6656:\t\t\t */\n6657:\t\t\trx_status.freq = nla_get_u32(info-\u003eattrs[HWSIM_ATTR_FREQ]);\n6658:\t\n6659:\t\t\titer_data.channel = ieee80211_get_channel(data2-\u003ehw-\u003ewiphy,\n6660:\t\t\t\t\t\t\t\t rx_status.freq);\n6661:\t\t\tif (!iter_data.channel)\n6662:\t\t\t\tgoto out_unlock;\n6663:\t\t\trx_status.band = iter_data.channel-\u003eband;\n6664:\t\n6665:\t\t\tif (!hwsim_chans_compat(iter_data.channel, channel)) {\n6666:\t\t\t\tieee80211_iterate_active_interfaces_atomic(\n6667:\t\t\t\t\tdata2-\u003ehw, IEEE80211_IFACE_ITER_NORMAL,\n6668:\t\t\t\t\tmac80211_hwsim_tx_iter, \u0026iter_data);\n6669:\t\t\t\tif (!iter_data.receive)\n6670:\t\t\t\t\tgoto out_unlock;\n6671:\t\t\t}\n6672:\t\t} else if (!channel) {\n6673:\t\t\tgoto out_unlock;\n6674:\t\t} else {\n6675:\t\t\trx_status.freq = channel-\u003ecenter_freq;\n6676:\t\t\trx_status.band = channel-\u003eband;\n6677:\t\t}\n6678:\t\n6679:\t\trx_status.rate_idx = nla_get_u32(info-\u003eattrs[HWSIM_ATTR_RX_RATE]);\n"
} |
| 79/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 50204 output: 17 thoughts: 2404 Thoughts: **Analysis of NAN Beacon Transmission in mac80211_hwsim** Okay, let's break this down. My initial concern was about potential uninitialized memory reads or overflows in the NAN beacon transmission process, specifically within the `mac80211_hwsim_tx_iter` and related functions. First, I confirmed that the `data` struct, which contains all necessary information for the transmission, is fully initialized before being passed to `mac80211_hwsim_tx_iter`. This involves checking the assignment of `iter_data.channel` and the structure itself. My attention then shifted to the `mac80211_hwsim_nan_tx_beacon` function, which handles the NAN-specific beacon transmission. I carefully examined the code within `mac80211_hwsim_nan.c`, focusing on the construction of the NAN vendor information element (`nan_ie`). My primary concern revolved around the `nan_ie.len` field, which is a `u8`, and whether the size of the appended attributes could lead to an overflow. I verified, through checks and calculations using `NAN_BEACON_ELEM_LEN` and `NAN_BEACON_EXTRA_ATTRS_LEN`, that the maximum value of `nan_ie.len` would indeed stay within the limits of a `u8`, therefore eliminating the risk of overflow. I also double-checked the allocation size of the `skb` to confirm sufficient headroom for the data. A detailed review of what data is written to the `skb` and the sizes involved assured that all data written is initialized and will fit. My investigation further involved tracing how `cfg80211_nan_conf` is populated and used. Specifically, I examined the `ieee80211_nan_conf_copy` to ensure all members of this struct, including `instant_comm`, are properly initialized. I confirmed that the source `cfg80211_nan_conf` is always zero-initialized, preventing any read-before-write issues. Then I considered the potential for a zero value for `data->nan.discovery_beacon_interval`. The code sets this value to either the configuration value or a default of 100. The code in `mac80211_hwsim_nan_discovery_beacon_timer` calculates timing based on the `discovery_beacon_interval`. If this could become zero, the division would cause a crash. However, after careful review, I determined that zero is not possible, as it is defaulted and always validated to be >= 50. In summary, my analysis assures the absence of memory corruption and uninitialized memory issues in the NAN beacon transmission path, through detailed checks of the code, variables, and potential edge cases. |
| 80/3 | 2026/10/04 15:01 | tool | grepper |
0mArgs:{
"Expression": "instant_comm"
}Results: {
"Output": "drivers/net/wireless/virtual/mac80211_hwsim_nan.c=253=void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-321-\t\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:322:\t\t\trx_outside_dw = data-\u003enan.instant_comm ||\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-323-\t\t\t\tdata-\u003enan.phase ==\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=653=mac80211_hwsim_nan_exec_state_transitions(struct mac80211_hwsim_data *data)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-684-\tif ((data-\u003enan.role == MAC80211_HWSIM_NAN_ROLE_MASTER ||\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:685:\t data-\u003enan.instant_comm) \u0026\u0026\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-686-\t !hrtimer_active(\u0026data-\u003enan.discovery_beacon_timer))\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=927=mac80211_hwsim_nan_discovery_beacon_timer(struct hrtimer *timer)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-947-\t\t */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:948:\t\tif (!data-\u003enan.instant_comm \u0026\u0026\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-949-\t\t data-\u003enan.role != MAC80211_HWSIM_NAN_ROLE_MASTER)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=990=static int mac80211_hwsim_nan_set_config(struct mac80211_hwsim_data *data,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1016-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1017:\t\tdata-\u003enan.instant_comm = conf-\u003einstant_comm;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1018-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1029=int mac80211_hwsim_nan_start(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1059-\t\tdata-\u003enan.phase = MAC80211_HWSIM_NAN_PHASE_SCAN;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1060:\t\tdata-\u003enan.random_factor_valid_dwst = conf-\u003einstant_comm ? 0 : 1;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1061-\t\tdata-\u003enan.random_factor = 0;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1081=int mac80211_hwsim_nan_stop(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1100-\t\tdata-\u003enan.extra_nan_attrs_len = 0;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1101:\t\tdata-\u003enan.instant_comm = false;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1102-\t}\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1109=int mac80211_hwsim_nan_change_config(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1133-\t\t */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1134:\t\tif (conf-\u003einstant_comm \u0026\u0026\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1135-\t\t !hrtimer_active(\u0026data-\u003enan.discovery_beacon_timer))\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1304=bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1333-\t\t\tguard(spinlock_bh)(\u0026data-\u003enan.state_lock);\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1334:\t\t\treturn data-\u003enan.instant_comm \u0026\u0026\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1335-\t\t\t\tdata-\u003enan.local_sched[slot].chan;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1388=bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1393-\tstruct mac80211_hwsim_data *data = hw-\u003epriv;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1394:\tbool instant_comm;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1395-\tu8 slot;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1400-\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1401:\t\tinstant_comm = data-\u003enan.instant_comm;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1402-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1411-\t */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1412:\tif (instant_comm \u0026\u0026 hwsim_nan_beacon_has_service_ids(skb))\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1413-\t\treturn true;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h=22=struct mac80211_hwsim_nan_data {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-58-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h:59:\tbool instant_comm;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-60-\tu8 discovery_beacon_interval;\n--\ninclude/net/cfg80211.h=4173=struct cfg80211_nan_band_config {\n--\ninclude/net/cfg80211.h-4194- * @discovery_beacon_interval: interval (in TUs) for discovery beacons. Must be\ninclude/net/cfg80211.h:4195: *\tgreater than 0 when @instant_comm is true.\ninclude/net/cfg80211.h-4196- * @enable_dw_notification: flag to enable/disable discovery window\ninclude/net/cfg80211.h-4197- *\tnotifications.\ninclude/net/cfg80211.h:4198: * @instant_comm: if true, start Instant Communication (IC) as defined in\ninclude/net/cfg80211.h-4199- *\tChapter 13 of the Wi-Fi Aware Specification v4.0.\n--\ninclude/net/cfg80211.h=4207=struct cfg80211_nan_conf {\n--\ninclude/net/cfg80211.h-4214-\tbool enable_dw_notification;\ninclude/net/cfg80211.h:4215:\tbool instant_comm;\ninclude/net/cfg80211.h-4216-\tstruct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];\n--\nnet/mac80211/cfg.c=355=static int ieee80211_nan_conf_copy(struct cfg80211_nan_conf *dst,\n--\nnet/mac80211/cfg.c-370-\t\tdst-\u003eenable_dw_notification = src-\u003eenable_dw_notification;\nnet/mac80211/cfg.c:371:\t\tdst-\u003einstant_comm = src-\u003einstant_comm;\nnet/mac80211/cfg.c-372-\t\tmemcpy(\u0026dst-\u003eband_cfgs, \u0026src-\u003eband_cfgs,\n--\nnet/mac80211/rx.c=4538=static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-4702-\t\t\t\t\t skb-\u003elen))\nnet/mac80211/rx.c:4703:\t\t\treturn sdata-\u003eu.nan.conf.instant_comm;\nnet/mac80211/rx.c-4704-\t\tif (!ieee80211_is_disassoc(hdr-\u003eframe_control) \u0026\u0026\n--\nnet/wireless/nl80211.c=16666=static int nl80211_parse_nan_conf(struct wiphy *wiphy,\n--\nnet/wireless/nl80211.c-16788-\nnet/wireless/nl80211.c:16789:\tconf-\u003einstant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);\nnet/wireless/nl80211.c:16790:\tif (conf-\u003einstant_comm) {\nnet/wireless/nl80211.c-16791-\t\tif (!(wiphy-\u003enan_capa.flags \u0026 WIPHY_NAN_FLAGS_INSTANT_COMM)) {\n"
} |
| 81/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 56121 output: 34 thoughts: 33 Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts: **Investigating the Initialization of `sdata->u.nan.conf`** Alright, so I need to track down where `sdata->u.nan.conf` is initialized within the mac80211 framework. Given that we're dealing with NAN, my first instinct is to zero in on `net/mac80211/nan.c`. That file seems like the most logical starting point for handling NAN-specific configurations. It's a key part of the driver. I'll need to check the file for the initialization of this structure. It could be directly within a function in nan.c, or maybe called in a function in a related file. If it isn't, I'll have to expand my search. |
| 82/3 | 2026/10/04 15:01 | tool | grepper |
0mArgs:{
"Expression": "u\\.nan\\.conf",
"PathPrefix": "net/mac80211/"
}Results: {
"Output": "net/mac80211/cfg.c=338=static void ieee80211_stop_nan(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-348-\nnet/mac80211/cfg.c:349:\tieee80211_nan_conf_free(\u0026sdata-\u003eu.nan.conf);\nnet/mac80211/cfg.c-350-\n--\nnet/mac80211/cfg.c=414=static int ieee80211_start_nan(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-442-\nnet/mac80211/cfg.c:443:\tret = ieee80211_nan_conf_copy(\u0026sdata-\u003eu.nan.conf, conf, 0xFFFFFFFF);\nnet/mac80211/cfg.c-444-\tif (ret) {\n--\nnet/mac80211/cfg.c=452=static int ieee80211_nan_change_conf(struct wiphy *wiphy,\n--\nnet/mac80211/cfg.c-472-\t */\nnet/mac80211/cfg.c:473:\tret = ieee80211_nan_conf_copy(\u0026new_conf, \u0026sdata-\u003eu.nan.conf,\nnet/mac80211/cfg.c-474-\t\t\t\t 0xFFFFFFFF);\n--\nnet/mac80211/cfg.c-485-\t} else {\nnet/mac80211/cfg.c:486:\t\tieee80211_nan_conf_free(\u0026sdata-\u003eu.nan.conf);\nnet/mac80211/cfg.c:487:\t\tsdata-\u003eu.nan.conf = new_conf;\nnet/mac80211/cfg.c-488-\t}\n--\nnet/mac80211/cfg.c=5329=void ieee80211_nan_cluster_joined(struct ieee80211_vif *vif,\n--\nnet/mac80211/cfg.c-5340-\nnet/mac80211/cfg.c:5341:\tether_addr_copy(sdata-\u003eu.nan.conf.cluster_id, cluster_id);\nnet/mac80211/cfg.c-5342-\n--\nnet/mac80211/rx.c=4538=static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)\n--\nnet/mac80211/rx.c-4693-\t\t */\nnet/mac80211/rx.c:4694:\t\tif (!ether_addr_equal(sdata-\u003eu.nan.conf.cluster_id, hdr-\u003eaddr3))\nnet/mac80211/rx.c-4695-\t\t\treturn false;\n--\nnet/mac80211/rx.c-4702-\t\t\t\t\t skb-\u003elen))\nnet/mac80211/rx.c:4703:\t\t\treturn sdata-\u003eu.nan.conf.instant_comm;\nnet/mac80211/rx.c-4704-\t\tif (!ieee80211_is_disassoc(hdr-\u003eframe_control) \u0026\u0026\n--\nnet/mac80211/rx.c-4719-\nnet/mac80211/rx.c:4720:\t\t\tif (!ether_addr_equal(nmi-\u003eu.nan.conf.cluster_id,\nnet/mac80211/rx.c-4721-\t\t\t\t\t hdr-\u003eaddr3))\n--\nnet/mac80211/tx.c=2719=static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/tx.c-2955-\t\t}\nnet/mac80211/tx.c:2956:\t\tmemcpy(hdr.addr3, nmi-\u003eu.nan.conf.cluster_id, ETH_ALEN);\nnet/mac80211/tx.c-2957-\t\thdrlen = 24;\n--\nnet/mac80211/util.c=1806=static int ieee80211_reconfig_nan(struct ieee80211_sub_if_data *sdata)\n--\nnet/mac80211/util.c-1812-\nnet/mac80211/util.c:1813:\tres = drv_start_nan(local, sdata, \u0026sdata-\u003eu.nan.conf);\nnet/mac80211/util.c-1814-\tif (WARN_ON(res))\n"
} |
| 83/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57667 output: 42 thoughts: 388 Thoughts: **Analyzing NAN Configuration and Transmission in mac80211** Okay, let's dive into this `net/mac80211` code. My initial focus is on how NAN (Neighbor Awareness Networking) configurations are handled. I see in `cfg.c`, particularly within `ieee80211_start_nan` and `ieee80211_nan_change_conf`, a consistent pattern: the configuration structure (`new_conf`) is either initialized to zero or properly copied into. The `ieee80211_nan_conf_copy` function seems to be the critical piece for updating these NAN configurations. No obvious gotchas there, the copying looks clean with no obvious issues. Now, let's shift gears and examine `mac80211_hwsim_nan_txq_transmitting`. This is where the NAN transmission queue logic comes into play. I'm focusing on the condition related to non-STA TXQs, specifically when the `vif->type` is `NL80211_IFTYPE_NAN`. The check for `data->nan.instant_comm && data->nan.local_sched[slot].chan` is interesting. It indicates that outside the Discovery Window (DW), transmission depends on the local schedule being enabled and the channel being defined. Here `slot` is being derived via `hwsim_nan_slot_from_tsf(tsf)`, which looks correct in principle. My concern is the size of `data->nan.local_sched`. If there is a bug, this array seems to be a good place for it to exist. I need to understand its dimension. I'm going to look in `mac80211_hwsim_nan.h` to see how large this scheduler is. I need to make sure the slot calculation is safe. |
| 84/3 | 2026/10/04 15:01 | tool | grepper |
0mError:no matches Args: {
"Expression": "local_sched",
"PathPrefix": "drivers/net/wireless/virtual/mac80211_hwsim_nan"
}Results: {
"error": "no matches"
} |
| 85/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 58511 output: 17 thoughts: 14 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Investigating Scheduling Implementations** Okay, so I need to get a handle on how scheduling is handled locally within this codebase. My gut tells me there's a specific implementation, likely named something like `local_sched` or at least something similar that should give me insight into where all the action is. My immediate instinct is to jump in with a `grep` to quickly identify all instances of that term. A wide search will give me a base of operations. This should provide a clear picture of how this scheduler is organized and used. From there, I can drill down further based on the hits. I expect this will quickly pinpoint the key files and functions I need to analyze. |
| 86/3 | 2026/10/04 15:01 | tool | grepper |
0mArgs:{
"Expression": "local_sched"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 300 lines.\nUse more precise expression if possible.\n\ndrivers/net/wireless/mediatek/mt76/mt7925/main.c=2095=static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/main.c-2145-\t changed \u0026 BSS_CHANGED_NAN_LOCAL_SCHED) {\ndrivers/net/wireless/mediatek/mt76/mt7925/main.c:2146:\t\tmt7925_nan_local_sched_changed(dev, vif);\ndrivers/net/wireless/mediatek/mt76/mt7925/main.c-2147-\t}\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c=562=static u32 mt7925_nan_slot_to_bitmap(struct ieee80211_vif *vif,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-569-\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:570:\tfor (i = 0; i \u003c ARRAY_SIZE(mvif-\u003enan.local_sched); i++) {\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:571:\t\tstruct cfg80211_chan_def *slot_chan = \u0026mvif-\u003enan.local_sched[i];\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-572-\t\tstruct ieee80211_nan_channel *slot = slots[i];\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c=612=static int mt7925_nan_avail_tlv(struct sk_buff *skb,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-644-\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:645:void mt7925_nan_local_sched_changed(struct mt792x_dev *dev,\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-646-\t\t\t\t struct ieee80211_vif *vif)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c=787=mt7925_nan_fill_crb_committed(struct mt7925_nan_sched_update_crb_tlv *crb_tlv,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-790-{\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:791:\tstruct ieee80211_nan_sched_cfg *local_sched;\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-792-\tu8 local_map_id;\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-797-\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:798:\tlocal_sched = \u0026vif-\u003ecfg.nan_sched;\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:799:\tlocal_map_id = mt7925_nan_avail_attr_ctrl(local_sched) \u0026\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-800-\t\t NAN_AVAIL_CTRL_MAPID;\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-819-\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c:820:\t\t\tlocal_ch = local_sched-\u003eschedule[slot];\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.c-821-\t\t\tpeer_ch = map-\u003eslots[slot];\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.h=406=int mt7925_nan_set_nmi_addr(struct mt792x_dev *dev, const u8 *addr);\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.h-407-\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.h:408:void mt7925_nan_local_sched_changed(struct mt792x_dev *dev,\ndrivers/net/wireless/mediatek/mt76/mt7925/nan.h-409-\t\t\t\t struct ieee80211_vif *vif);\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h=175=struct mt792x_nan {\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h-178-\t/* Scheduler */\ndrivers/net/wireless/mediatek/mt76/mt792x.h:179:\tstruct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS];\ndrivers/net/wireless/mediatek/mt76/mt792x.h-180-\tu32 seq_id;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=2693=static void mac80211_hwsim_vif_info_changed(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2711-\tif (changed \u0026 BSS_CHANGED_NAN_LOCAL_SCHED)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:2712:\t\tmac80211_hwsim_nan_local_sched_changed(hw, vif);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2713-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=107=hwsim_nan_rx_chandef_compatible(struct mac80211_hwsim_data *data, u8 slot,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-117-\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:118:\t\tsched_chandef = data-\u003enan.local_sched[slot];\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-119-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=169=hwsim_nan_peer_present_in_faw(struct hwsim_sta_priv *sp,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-174-\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:175:\t\tlocal_chandef = data-\u003enan.local_sched[slot];\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-176-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1177=static void mac80211_hwsim_nan_resume_txqs(struct mac80211_hwsim_data *data)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1190-\t\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock) {\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1191:\t\t\tif (!data-\u003enan.local_sched[slot].chan)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1192-\t\t\t\treturn;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1304=bool mac80211_hwsim_nan_txq_transmitting(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1334-\t\t\treturn data-\u003enan.instant_comm \u0026\u0026\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1335:\t\t\t\tdata-\u003enan.local_sched[slot].chan;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1336-\t\t}\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1361=void mac80211_hwsim_nan_get_tx_chandef(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1384-\tscoped_guard(spinlock_bh, \u0026data-\u003enan.state_lock)\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1385:\t\t*chandef = data-\u003enan.local_sched[slot];\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1386-}\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c=1388=bool mac80211_hwsim_nan_receive(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1446-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1447:void mac80211_hwsim_nan_local_sched_changed(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1448-\t\t\t\t\t struct ieee80211_vif *vif)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1457-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1458:\tfor (int i = 0; i \u003c ARRAY_SIZE(data-\u003enan.local_sched); i++) {\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1459-\t\tstruct ieee80211_chanctx_conf *chanctx;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1461-\t\tif (!slots[i] || IS_ERR(slots[i])) {\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1462:\t\t\tmemset(\u0026data-\u003enan.local_sched[i], 0,\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1463:\t\t\t sizeof(data-\u003enan.local_sched[i]));\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1464-\t\t\tcontinue;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1468-\t\tif (!chanctx) {\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1469:\t\t\tmemset(\u0026data-\u003enan.local_sched[i], 0,\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1470:\t\t\t sizeof(data-\u003enan.local_sched[i]));\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1471-\t\t\tcontinue;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1473-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:1474:\t\tdata-\u003enan.local_sched[i] = chanctx-\u003edef;\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c-1475-\t}\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h=22=struct mac80211_hwsim_nan_data {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-66-\t */\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h:67:\tstruct cfg80211_chan_def local_sched[CFG80211_NAN_SCHED_NUM_TIME_SLOTS];\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-68-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h=106=void mac80211_hwsim_nan_rx(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-108-\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h:109:void mac80211_hwsim_nan_local_sched_changed(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h-110-\t\t\t\t\t struct ieee80211_vif *vif);\n--\ninclude/linux/highmem-internal.h=12=void kmap_local_fork(struct task_struct *tsk);\ninclude/linux/highmem-internal.h:13:void __kmap_local_sched_out(void);\ninclude/linux/highmem-internal.h:14:void __kmap_local_sched_in(void);\ninclude/linux/highmem-internal.h-15-static inline void kmap_assert_nomap(void)\n--\ninclude/net/cfg80211.h=4236=struct cfg80211_nan_channel {\n--\ninclude/net/cfg80211.h-4242-/**\ninclude/net/cfg80211.h:4243: * struct cfg80211_nan_local_sched - NAN local schedule\ninclude/net/cfg80211.h-4244- *\n--\ninclude/net/cfg80211.h-4261- */\ninclude/net/cfg80211.h:4262:struct cfg80211_nan_local_sched {\ninclude/net/cfg80211.h-4263-\tu8 schedule[CFG80211_NAN_SCHED_NUM_TIME_SLOTS];\n--\ninclude/net/cfg80211.h=4870=struct mgmt_frame_regs {\n--\ninclude/net/cfg80211.h-5219- *\tAll other parameters must be ignored.\ninclude/net/cfg80211.h:5220: * @nan_set_local_sched: configure the local schedule for NAN. The schedule\ninclude/net/cfg80211.h-5221- *\tconsists of an array of %cfg80211_nan_channel and the schedule itself,\n--\ninclude/net/cfg80211.h=5313=struct cfg80211_ops {\n--\ninclude/net/cfg80211.h-5622-\t\t\t\t u32 changes);\ninclude/net/cfg80211.h:5623:\tint\t(*nan_set_local_sched)(struct wiphy *wiphy,\ninclude/net/cfg80211.h-5624-\t\t\t\t struct wireless_dev *wdev,\ninclude/net/cfg80211.h:5625:\t\t\t\t struct cfg80211_nan_local_sched *sched);\ninclude/net/cfg80211.h-5626-\tint\t(*nan_set_peer_sched)(struct wiphy *wiphy,\n--\nkernel/sched/core.c=5253=static inline void finish_lock_switch(struct rq *rq)\n--\nkernel/sched/core.c-5278-\nkernel/sched/core.c:5279:static inline void kmap_local_sched_out(void)\nkernel/sched/core.c-5280-{\n--\nkernel/sched/core.c-5282-\tif (unlikely(current-\u003ekmap_ctrl.idx))\nkernel/sched/core.c:5283:\t\t__kmap_local_sched_out();\nkernel/sched/core.c-5284-#endif\n--\nkernel/sched/core.c-5286-\nkernel/sched/core.c:5287:static inline void kmap_local_sched_in(void)\nkernel/sched/core.c-5288-{\n--\nkernel/sched/core.c-5290-\tif (unlikely(current-\u003ekmap_ctrl.idx))\nkernel/sched/core.c:5291:\t\t__kmap_local_sched_in();\nkernel/sched/core.c-5292-#endif\n--\nkernel/sched/core.c=5309=prepare_task_switch(struct rq *rq, struct task_struct *prev,\n--\nkernel/sched/core.c-5316-\tfire_sched_out_preempt_notifiers(prev, next);\nkernel/sched/core.c:5317:\tkmap_local_sched_out();\nkernel/sched/core.c-5318-\tprepare_task(next);\n--\nkernel/sched/core.c=5341=static struct rq *finish_task_switch(struct task_struct *prev)\n--\nkernel/sched/core.c-5385-\t/*\nkernel/sched/core.c:5386:\t * kmap_local_sched_out() is invoked with rq::lock held and\nkernel/sched/core.c-5387-\t * interrupts disabled. There is no requirement for that, but the\n--\nkernel/sched/core.c-5391-\t */\nkernel/sched/core.c:5392:\tkmap_local_sched_in();\nkernel/sched/core.c-5393-\n--\nmm/highmem.c=634=EXPORT_SYMBOL(kunmap_local_indexed);\n--\nmm/highmem.c-645- */\nmm/highmem.c:646:void __kmap_local_sched_out(void)\nmm/highmem.c-647-{\n--\nmm/highmem.c-682-\nmm/highmem.c:683:void __kmap_local_sched_in(void)\nmm/highmem.c-684-{\n--\nmm/highmem.c-702-\nmm/highmem.c:703:\t\t/* See comment in __kmap_local_sched_out() */\nmm/highmem.c-704-\t\tidx = arch_kmap_local_map_idx(i, pte_pfn(pteval));\n--\nnet/mac80211/cfg.c=5993=ieee80211_set_local_nan_sched(struct wiphy *wiphy,\nnet/mac80211/cfg.c-5994-\t\t\t struct wireless_dev *wdev,\nnet/mac80211/cfg.c:5995:\t\t\t struct cfg80211_nan_local_sched *sched)\nnet/mac80211/cfg.c-5996-{\n--\nnet/mac80211/cfg.c-6000-\n\n"
} |
| 87/3 | 2026/10/04 15:01 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 63943 output: 376 thoughts: 998 Thoughts: **KMSAN Risk Assessment: NAN Instant Communication Implementation** Okay, let's break this down. My goal here is to determine if this new Instant Communication (IC) mode implementation for NAN introduces any potential uninitialized memory risks or kernel information leaks that would trigger a need for a KMSAN (Kernel Memory Sanitizer) fuzzing session. I'm focusing on the integration across `mac80211_hwsim`, `cfg80211`, and `mac80211`. First, I need to confirm there's no unintentional data leakage to user space. I've double-checked that `local_sched`, which is pre-initialized, is the only place we have state. Netlink communications are safe, only transmitting a simple flag (`NL80211_NAN_CAPA_INSTANT_COMM`). No structs are being directly copied to userspace, which is good. Next, I need to thoroughly audit the code for uninitialized variables. This is where I've spent the most time. I've gone line by line, scrutinizing every added variable and field: * `tx_iter_data.skb` is initialized in its allocation. * `conf->instant_comm` is safely initialized, and parsed by `nla_get_flag`. * `data->nan.instant_comm` is handled consistently through the NAN lifecycle (set, unset in specific functions). * Discovery beacon intervals are handled correctly, either with a user-supplied value or a default. * `data->nan.extra_nan_attrs` is kmemdup'd or NULL, with its length tracked. * `data->nan.random_factor_valid_dwst` is correctly calculated based on `conf->instant_comm`. * The `nan_ie` is well-initialized. * The contents of `skb` are initialized before use in `mac80211_hwsim_nan_tx_beacon`. * Local boolean variables `rx_outside_dw` and `instant_comm` are assigned from correctly initialized data. * In the `mac80211_hwsim_nan_receive` function, pointers `channel` and `skb` are ensured to be valid. So, *all* new variables and fields introduced by this patch are properly initialized before use. There's no chance of uninitialized memory making its way into user space through these changes. Now, let's think about potential KASAN catches. KASAN (Kernel Address Sanitizer) will still catch any out-of-bounds frame parsing or buffer overflows, which is crucial. But KMSAN is the one that looks for reads of uninitialized memory, or kernel-to-user memory info-leaks, and I'm confident that this patch doesn't introduce *any* of those. In summary, this patch introduces IC support with: 1. New configuration flags, handling of intervals, and NAN beacon acceptance. 2. Rigorous initialization of all new stack variables, zero-initialization or fully populated buffers, and safe netlink communication. 3. Bounding frame parsing to catch invalid frame formats. Therefore, since all potentially problematic memory areas are safe, I'm concluding that no KMSAN fuzzing session is needed. NeedsKMSAN should be false. Everything appears to be rock solid. |
| 88/3 | 2026/10/04 15:02 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series adds support for Instant Communication (IC) in NAN (Wi-Fi Aware) across cfg80211, mac80211, and mac80211_hwsim.\n\nApplicability analysis:\n1. User-space data exposure / Info-leaks: The netlink changes only introduce a flag attribute (NL80211_NAN_CAPA_INSTANT_COMM via nla_put_flag) which carries zero payload and no padding. No uninitialized kernel memory or padding is exposed or copied to user space.\n2. Initialization of new structures and fields: All stack variables introduced or modified (e.g. `iter_data`, `rx_outside_dw`, `instant_comm`) are fully initialized at declaration or prior to evaluation. Structures like `struct cfg80211_nan_conf` are zero-initialized (`= {}`) in `nl80211.c`. In `mac80211_hwsim_nan_tx_beacon`, the newly transmitted attributes (`nan_ie`, `extra_nan_attrs`) are fully initialized before being copied into the allocated skb.\n3. Parsing and bounds checking: Packet inspection helpers (`hwsim_nan_beacon_has_service_ids` and `ieee80211_is_nan_beacon`) validate element lengths and boundary offsets against `skb-\u003elen`. Any potential buffer overrun or boundary violation on malformed frames would be caught by KASAN.\n\nBecause the changes do not introduce or expose uninitialized memory reads or information leaks, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series adds support for Instant Communication (IC) in NAN (Wi-Fi Aware) across cfg80211, mac80211, and mac80211_hwsim.\n\nApplicability analysis:\n1. User-space data exposure / Info-leaks: The netlink changes only introduce a flag attribute (NL80211_NAN_CAPA_INSTANT_COMM via nla_put_flag) which carries zero payload and no padding. No uninitialized kernel memory or padding is exposed or copied to user space.\n2. Initialization of new structures and fields: All stack variables introduced or modified (e.g. `iter_data`, `rx_outside_dw`, `instant_comm`) are fully initialized at declaration or prior to evaluation. Structures like `struct cfg80211_nan_conf` are zero-initialized (`= {}`) in `nl80211.c`. In `mac80211_hwsim_nan_tx_beacon`, the newly transmitted attributes (`nan_ie`, `extra_nan_attrs`) are fully initialized before being copied into the allocated skb.\n3. Parsing and bounds checking: Packet inspection helpers (`hwsim_nan_beacon_has_service_ids` and `ieee80211_is_nan_beacon`) validate element lengths and boundary offsets against `skb-\u003elen`. Any potential buffer overrun or boundary violation on malformed frames would be caught by KASAN.\n\nBecause the changes do not introduce or expose uninitialized memory reads or information leaks, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|