| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/15 07:06 | flow | patch-triage |
5mArgs:null Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"WIRELESS"
],
"FocusSymbols": [
"nl80211_qos_mgmt_cfg",
"nl80211_parse_qm_desc",
"nl80211_parse_qm_tclas",
"nl80211_parse_qm_qos_attr",
"ieee80211_set_qos_mgmt_cfg",
"ieee80211_qos_mgmt_cfg",
"ieee80211_qos_mgmt_update_scs",
"ieee80211_qos_mgmt_update_mscs",
"ieee80211_qos_mgmt_mscs_set_mark",
"ieee80211_qos_mgmt_set_priority"
],
"KMSANReasoning": "The patch series adds support for QoS Management (Stream Classification Service / Mirrored SCS) configuration via nl80211 (NL80211_CMD_QOS_MGMT), implementing request parsing, response generation, mac80211 state management, and packet priority tagging.\n\nKMSAN vs KASAN Applicability:\n1. Heap and Stack Initialization: All newly introduced or modified structures and arrays are explicitly zero-initialized. Specifically, `struct cfg80211_qm_req_data qm_req` and `struct cfg80211_qm_resp_data qm_resp` on the stack are initialized with `= {}`. Dynamic buffers (`qm_req.qm_req_desc`, `qm_req_desc-\u003etclas`, and `qm_resp.qm_resp_desc`) are allocated with `kzalloc_objs()`. The RCU-managed per-station state (`new_qos`) is allocated with `kzalloc_obj()`.\n2. Kernel-to-User Info-leaks: The response message returned to userspace via Netlink (`nl80211_qm_send_resp`) only serializes discrete, fully-initialized fields (`qm_id` and `status` via `nla_put_u8`, and `peer_mac` via `nla_put` from validated input). Netlink's attribute reservation (`__nla_reserve`) explicitly zero-pads attributes. No kernel structs or padding bytes are copied raw to userspace.\n3. Fast-path packet processing: The RX mark setting (`ieee80211_qos_mgmt_mscs_set_mark`) and TX priority classification (`ieee80211_qos_mgmt_set_priority`) only read already-initialized packet fields (`skb-\u003emark`, `skb-\u003epriority`) and verified fields within the zero-initialized RCU QoS structure.\n4. Bugs that could potentially arise in this code (such as array out-of-bounds indexing, NULL pointer dereferences, RCU/lockdep locking inconsistencies, or memory leaks on early parse failures) are already detected by KASAN, LOCKDEP, and KMEMLEAK under the standard configuration.\n\nSince no uninitialized memory risks or uninitialized info-leaks are introduced, a dedicated KMSAN fuzzing session is not justified.",
"NeedsKMSAN": false,
"Reasoning": "The patch introduces a new Netlink command NL80211_CMD_QOS_MGMT and support for QoS Management (SCS and MSCS) across cfg80211 and mac80211. It adds complex nested Netlink attribute parsers, dynamic memory allocations, RCU-managed per-station QoS state updates, and hooks in both RX and TX data paths. This code is reachable from userspace in standard QEMU virtualized environments via mac80211_hwsim and warrants fuzzing.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/15 07:06 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 76cb85b08d3003181c80b3ef3091595db6ef5519\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Oct 15 07:06:58 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h\nindex 66f9ebe79c618..f235059cbebd4 100644\n--- a/include/linux/ieee80211.h\n+++ b/include/linux/ieee80211.h\n@@ -1821,6 +1821,7 @@ enum ieee80211_eid_ext {\n \tWLAN_EID_EXT_SHORT_SSID_LIST = 58,\n \tWLAN_EID_EXT_HE_6GHZ_CAPA = 59,\n \tWLAN_EID_EXT_UL_MU_POWER_CAPA = 60,\n+\tWLAN_EID_EXT_MSCS_DESCRIPTOR = 88,\n \tWLAN_EID_EXT_EHT_OPERATION = 106,\n \tWLAN_EID_EXT_EHT_MULTI_LINK = 107,\n \tWLAN_EID_EXT_EHT_CAPABILITY = 108,\ndiff --git a/include/net/cfg80211.h b/include/net/cfg80211.h\nindex f773856c18181..74abe25bb107a 100644\n--- a/include/net/cfg80211.h\n+++ b/include/net/cfg80211.h\n@@ -4860,6 +4860,216 @@ struct cfg80211_update_owe_info {\n \tu8 peer_mld_addr[ETH_ALEN] __aligned(2);\n };\n \n+/* QoS Management IP address lengths */\n+#define QM_IPV4_LEN\t4\n+#define QM_IPV6_LEN\t16\n+\n+/**\n+ * enum cfg80211_qm_ip_version - IP protocol version identifiers used in\n+ *\tQoS Management traffic classification\n+ * @QM_IP_VERSION_4: Internet Protocol version 4 (IPv4)\n+ * @QM_IP_VERSION_6: Internet Protocol version 6 (IPv6)\n+ */\n+enum cfg80211_qm_ip_version {\n+\tQM_IP_VERSION_4 = 4,\n+\tQM_IP_VERSION_6 = 6,\n+};\n+\n+/**\n+ * struct cfg80211_qm_tclas4_params - TCLAS classifier type 4 parameters\n+ * @classifier_mask: bitmask indicating which fields are used for\n+ *\tclassification; the version bit is mandatory and the remaining bits\n+ *\tidentify fields used for classification, as defined by\n+ *\t\u0026enum nl80211_qm_tclas_type4_mask\n+ * @ip_ver: IP version of @src_ip / @dst_ip\n+ * @src_ip: source IP address (IPv4 or IPv6)\n+ * @dst_ip: destination IP address (IPv4 or IPv6)\n+ * @src_port: source port number\n+ * @dst_port: destination port number\n+ * @dscp: Differentiated Services Code Point\n+ * @protocol: IP protocol number, valid for IPv4 only\n+ * @next_header: next header field, valid for IPv6 only\n+ * @flow_label: flow label, valid for IPv6 only\n+ */\n+struct cfg80211_qm_tclas4_params {\n+\tu8 classifier_mask;\n+\tenum cfg80211_qm_ip_version ip_ver;\n+\tunion {\n+\t\tu8 ipv4[QM_IPV4_LEN];\n+\t\tu8 ipv6[QM_IPV6_LEN];\n+\t} src_ip;\n+\tunion {\n+\t\tu8 ipv4[QM_IPV4_LEN];\n+\t\tu8 ipv6[QM_IPV6_LEN];\n+\t} dst_ip;\n+\tu16 src_port;\n+\tu16 dst_port;\n+\tu8 dscp;\n+\tu8 protocol;\n+\tu8 next_header;\n+\tu8 flow_label[NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN];\n+};\n+\n+/**\n+ * struct cfg80211_qm_tclas10_params - TCLAS classifier type 10 parameters\n+ * @protocol_instance: protocol instance identifier\n+ * @protocol_number: protocol number\n+ * @filter_value: filter value bytes\n+ * @filter_mask: filter mask bytes\n+ * @filter_len: length of @filter_value / @filter_mask\n+ */\n+struct cfg80211_qm_tclas10_params {\n+\tu8 protocol_instance;\n+\tu8 protocol_number;\n+\tu8 filter_value[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];\n+\tu8 filter_mask[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];\n+\tu8 filter_len;\n+};\n+\n+/**\n+ * struct cfg80211_qm_tclas_elements - a single TCLAS element\n+ * @up: user priority\n+ * @classifier_type: classifier type, see\n+ *\t\u0026enum nl80211_qm_tclas_classifier_type\n+ * @tclas_elem: classifier-specific parameters\n+ */\n+struct cfg80211_qm_tclas_elements {\n+\tu8 up;\n+\tenum nl80211_qm_tclas_classifier_type classifier_type;\n+\tunion {\n+\t\tstruct cfg80211_qm_tclas4_params type4_params;\n+\t\tstruct cfg80211_qm_tclas10_params type10_params;\n+\t} tclas_elem;\n+};\n+\n+/**\n+ * struct cfg80211_qm_qos_attributes - QoS attributes of a QoS Management\n+ *\trequest\n+ * @direction: traffic direction, see \u0026enum nl80211_qm_direction\n+ * @tid: traffic identifier\n+ * @up: user priority\n+ * @bitmap: TID/UP bitmap\n+ * @link_id: link identifier\n+ * @min_service_interval: minimum service interval, in microseconds\n+ * @max_service_interval: maximum service interval, in microseconds\n+ * @min_data_rate: minimum data rate, in kbps\n+ * @delay_bound: delay bound, in microseconds\n+ * @max_msdu_size: maximum MSDU size, in bytes\n+ * @service_start_time: service start time, in microseconds\n+ * @service_start_time_link_id: link ID for @service_start_time\n+ * @mean_data_rate: mean data rate, in kbps\n+ * @burst_size: burst size, in bytes\n+ * @msdu_lifetime: MSDU lifetime, in milliseconds\n+ * @msdu_delivery_ratio: MSDU delivery ratio\n+ * @msdu_count_exponent: MSDU count exponent\n+ * @medium_time: medium time, in units of 32 microseconds\n+ */\n+struct cfg80211_qm_qos_attributes {\n+\tenum nl80211_qm_direction direction;\n+\tu8 tid;\n+\tu8 up;\n+\tu16 bitmap;\n+\tu8 link_id;\n+\tu32 min_service_interval;\n+\tu32 max_service_interval;\n+\tu32 min_data_rate;\n+\tu32 delay_bound;\n+\tu16 max_msdu_size;\n+\tu32 service_start_time;\n+\tu8 service_start_time_link_id;\n+\tu32 mean_data_rate;\n+\tu32 burst_size;\n+\tu16 msdu_lifetime;\n+\tu8 msdu_delivery_ratio;\n+\tu8 msdu_count_exponent;\n+\tu16 medium_time;\n+};\n+\n+/**\n+ * struct cfg80211_qm_req_desc_data - a single QoS Management request\n+ *\tdescriptor\n+ * @qm_id: identifier for this descriptor within the request\n+ * @request_type: request type, see \u0026enum nl80211_qm_req_type\n+ * @priority: SCS descriptor priority\n+ * @num_tclas_elements: number of entries in @tclas\n+ * @tclas: SCS TCLAS elements used for traffic classification\n+ * @tclas_processing: SCS TCLAS processing rule, see\n+ *\t\u0026enum nl80211_qm_tclas_processing\n+ * @is_qos_present: whether @qos_attr is populated\n+ * @qos_attr: SCS QoS attributes associated with this descriptor\n+ * @user_priority_bitmap: user priority bitmap of TID values sent by the\n+ *\tnon-AP STA in an MSCS request\n+ * @user_priority_limit: user priority limit sent by the non-AP STA in an\n+ *\tMSCS request\n+ * @tclas_mask: traffic classifier mask with a bitmap of parameters to\n+ *\tmatch in an uplink flow for downlink prioritization\n+ */\n+struct cfg80211_qm_req_desc_data {\n+\tu8 qm_id;\n+\tenum nl80211_qm_req_type request_type;\n+\tu8 priority;\n+\tunsigned int num_tclas_elements;\n+\tstruct cfg80211_qm_tclas_elements *tclas;\n+\tenum nl80211_qm_tclas_processing tclas_processing;\n+\tbool is_qos_present;\n+\tstruct cfg80211_qm_qos_attributes qos_attr;\n+\tu8 user_priority_bitmap;\n+\tu8 user_priority_limit;\n+\tu8 tclas_mask;\n+};\n+\n+/**\n+ * struct cfg80211_qm_req_data - a complete QoS Management request for a\n+ *\tpeer\n+ * @peer_mac: MAC address of the peer\n+ * @qm_type: QoS Management protocol, see \u0026enum nl80211_qm_type\n+ * @num_qm_desc: number of entries in @qm_req_desc\n+ * @qm_req_desc: QoS Management request descriptors\n+ *\n+ * This is the parsed representation passed to the driver by the\n+ * \u0026struct cfg80211_ops.set_qos_mgmt_cfg callback. The descriptor and TCLAS\n+ * arrays are owned by cfg80211 and are valid only for the duration of the\n+ * callback. The driver must not retain these pointers after the callback\n+ * returns.\n+ */\n+struct cfg80211_qm_req_data {\n+\tu8 peer_mac[ETH_ALEN];\n+\tenum nl80211_qm_type qm_type;\n+\tunsigned int num_qm_desc;\n+\tstruct cfg80211_qm_req_desc_data *qm_req_desc;\n+};\n+\n+/**\n+ * struct cfg80211_qm_resp_desc_data - result of processing a single QoS\n+ *\tManagement request descriptor\n+ * @qm_id: identifier matching the corresponding request descriptor\n+ * @status: response status, see \u0026enum nl80211_qm_status\n+ */\n+struct cfg80211_qm_resp_desc_data {\n+\tu8 qm_id;\n+\tenum nl80211_qm_status status;\n+};\n+\n+/**\n+ * struct cfg80211_qm_resp_data - a complete QoS Management response\n+ * @qm_resp_desc: response descriptors corresponding to the request\n+ *\n+ * cfg80211 allocates and initializes one response descriptor for each\n+ * request descriptor with the corresponding\n+ * \u0026struct cfg80211_qm_req_desc_data.qm_id and a declined status.\n+ * The driver updates the status for each descriptor it processes. The\n+ * response array is parallel to the request descriptor array: entry @i\n+ * corresponds to request descriptor @i, and the driver must update entries\n+ * in place without reordering them. The initialized @qm_id values must be\n+ * left unchanged. The response array is valid only for the duration of the\n+ * callback and must not be retained by the driver.\n+ * cfg80211/nl80211 supplies the peer address and protocol type from the\n+ * request when it builds the reply.\n+ */\n+struct cfg80211_qm_resp_data {\n+\tstruct cfg80211_qm_resp_desc_data *qm_resp_desc;\n+};\n+\n /**\n * struct mgmt_frame_regs - management frame registrations data\n * @global_stypes: bitmap of management frame subtypes registered\n@@ -5332,6 +5542,13 @@ struct mgmt_frame_regs {\n *\n * @start_pd: Start the PD interface.\n * @stop_pd: Stop the PD interface.\n+ *\n+ * @set_qos_mgmt_cfg: Configure QoS Management (QM) parameters such as\n+ *\ttraffic classification (TCLAS) and QoS attributes for a station. The\n+ *\trequest has already been parsed from the nested nl80211 attributes.\n+ *\tThe driver or firmware applies the protocol-specific configuration and\n+ *\tpopulates the response structure with a status for each descriptor.\n+ *\tThis callback provides the control-path interface for the driver.\n */\n struct cfg80211_ops {\n \tint\t(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);\n@@ -5730,6 +5947,9 @@ struct cfg80211_ops {\n \t\t\t bool val);\n \tint\t(*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\n \tvoid\t(*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);\n+\tint\t(*set_qos_mgmt_cfg)(struct wiphy *wiphy, struct net_device *dev,\n+\t\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t\t struct cfg80211_qm_resp_data *qm_resp);\n };\n \n /*\ndiff --git a/include/net/mac80211.h b/include/net/mac80211.h\nindex a1a6409b44c12..a610d6eb92b4e 100644\n--- a/include/net/mac80211.h\n+++ b/include/net/mac80211.h\n@@ -4760,6 +4760,9 @@ struct ieee80211_prep_tx_info {\n * @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay\n *\tdriver according to the parameter received in the EML Operating mode\n *\tnotification frame.\n+ * @qos_mgmt_cfg: Configure QoS Management (QM) for a station. The request\n+ *\tcontains SCS or MSCS parameters, and the driver populates the\n+ *\tper-descriptor response status.\n */\n struct ieee80211_ops {\n \tvoid (*tx)(struct ieee80211_hw *hw,\n@@ -5173,6 +5176,10 @@ struct ieee80211_ops {\n \t\t\t struct ieee80211_vif *vif,\n \t\t\t struct ieee80211_sta *sta,\n \t\t\t struct ieee80211_eml_params *eml_params);\n+\tint (*qos_mgmt_cfg)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,\n+\t\t\t struct ieee80211_sta *sta,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp);\n };\n \n /**\ndiff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h\nindex b56a96f57bec2..4106fe6629454 100644\n--- a/include/uapi/linux/nl80211.h\n+++ b/include/uapi/linux/nl80211.h\n@@ -1468,6 +1468,10 @@\n *\tand multiple can be nested in %NL80211_ATTR_MLO_LINKS but then the\n *\tupdate isn't atomic if any failures happen.\n *\tOnly supported with %NL80211_EXT_FEATURE_UPDATE_BEACON.\n+ * @NL80211_CMD_QOS_MGMT: QoS Management configuration for a station. Used\n+ *\tby userspace to send QoS Management (QM) requests and to receive the\n+ *\tcorresponding status response via %NL80211_ATTR_QOS_MGMT.\n+ *\n * @NL80211_CMD_MAX: highest used command number\n * @__NL80211_CMD_AFTER_LAST: internal use\n */\n@@ -1750,6 +1754,8 @@ enum nl80211_commands {\n \n \tNL80211_CMD_UPDATE_BEACON,\n \n+\tNL80211_CMD_QOS_MGMT,\n+\n \t/* add new commands above here */\n \n \t/* used to define NL80211_CMD_MAX below */\n@@ -3243,6 +3249,13 @@ enum nl80211_commands {\n * @NL80211_ATTR_ASSOC_PROTECTED_TWT: Enable protected TWT for the association,\n *\trequires protected TWT support (flag attribute)\n *\n+ * @NL80211_ATTR_QOS_MGMT: Used with %NL80211_CMD_QOS_MGMT to configure\n+ *\tQoS Management (QM) features for a station. The nested payload is\n+ *\tdescribed by \u0026enum nl80211_qm_attrs. It contains a nested array of\n+ *\t\u0026enum nl80211_qm_desc_attrs entries; SCS TCLAS and QoS attributes use\n+ *\t\u0026enum nl80211_qm_tclas_attrs and \u0026enum nl80211_qm_qos_attrs,\n+ *\trespectively.\n+ *\n * @NUM_NL80211_ATTR: total number of nl80211_attrs available\n * @NL80211_ATTR_MAX: highest attribute number currently defined\n * @__NL80211_ATTR_AFTER_LAST: internal use\n@@ -3850,6 +3863,8 @@ enum nl80211_attrs {\n \n \tNL80211_ATTR_ASSOC_PROTECTED_TWT,\n \n+\tNL80211_ATTR_QOS_MGMT,\n+\n \t/* add attributes here, update the policy in nl80211.c */\n \n \t__NL80211_ATTR_AFTER_LAST,\n@@ -9200,4 +9215,333 @@ enum nl80211_nan_peer_map_attrs {\n \n #define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff\n \n+#define NL80211_IPADDR_MAX_LEN\t\t\t16\n+#define NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN\t12\n+#define NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN\t3\n+\n+/*\n+ * The TCLAS element (reference 9.4.2.29, IEEE Std 802.11-2024) is used by\n+ * SCS for traffic classification.\n+ */\n+/**\n+ * enum nl80211_qm_tclas_type4_attrs - TCLAS classifier type 4 attributes\n+ *\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_INVALID: Invalid\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK: Classifier mask (u8), see\n+ *\t\u0026enum nl80211_qm_tclas_type4_mask\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION: IP version, 4 or 6 (u8)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP: Source IP address\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP: Destination IP address\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT: Source port (u16)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT: Destination port (u16)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DSCP: DSCP value, 0-63 (u8)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL: IP protocol number, IPv4 only (u8)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER: Next header, IPv6 only (u8)\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL: Flow label, IPv6 only\n+ * @__NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_TCLAS_TYPE4_ATTR_MAX: highest type 4 attribute number currently\n+ *\tdefined\n+ */\n+enum nl80211_qm_tclas_type4_attrs {\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_INVALID,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_DST_IP,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_DSCP,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL,\n+\n+\t/* keep last */\n+\t__NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST,\n+\tNL80211_QM_TCLAS_TYPE4_ATTR_MAX =\n+\t\t__NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_tclas_type10_attrs - TCLAS classifier type 10 attributes\n+ *\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_INVALID: Invalid\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE: Protocol instance (u8)\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER: Protocol number (u8)\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE: Filter value bytes\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK: Filter mask bytes\n+ * @__NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_TCLAS_TYPE10_ATTR_MAX: highest type 10 attribute number currently\n+ *\tdefined\n+ */\n+enum nl80211_qm_tclas_type10_attrs {\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_INVALID,\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE,\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER,\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE,\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK,\n+\n+\t/* keep last */\n+\t__NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST,\n+\tNL80211_QM_TCLAS_TYPE10_ATTR_MAX =\n+\t\t__NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_tclas_attrs - TCLAS element attributes\n+ *\n+ * @NL80211_QM_TCLAS_ATTR_INVALID: Invalid\n+ * @NL80211_QM_TCLAS_ATTR_USER_PRIORITY: User priority, 0-7 (u8)\n+ * @NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE: Classifier type, 4 or 10 (u8)\n+ * @NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS: Nested type 4 classifier params, see\n+ *\t\u0026enum nl80211_qm_tclas_type4_attrs\n+ * @NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS: Nested type 10 classifier params, see\n+ *\t\u0026enum nl80211_qm_tclas_type10_attrs\n+ * @__NL80211_QM_TCLAS_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_TCLAS_ATTR_MAX: highest TCLAS attribute number currently defined\n+ */\n+enum nl80211_qm_tclas_attrs {\n+\tNL80211_QM_TCLAS_ATTR_INVALID,\n+\tNL80211_QM_TCLAS_ATTR_USER_PRIORITY,\n+\tNL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE,\n+\tNL80211_QM_TCLAS_ATTR_TYPE4_PARAMS,\n+\tNL80211_QM_TCLAS_ATTR_TYPE10_PARAMS,\n+\n+\t/* keep last */\n+\t__NL80211_QM_TCLAS_ATTR_AFTER_LAST,\n+\tNL80211_QM_TCLAS_ATTR_MAX = __NL80211_QM_TCLAS_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_tclas_classifier_type - TCLAS classifier type values sent\n+ *\tin %NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE\n+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE4: Classifier type 4, 5-tuple based;\n+ *\treference 9.4.2.29, IEEE Std 802.11-2024.\n+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE10: Classifier type 10, filter based;\n+ *\treference 9.4.2.29, IEEE Std 802.11-2024.\n+ *\n+ * The SCS interface currently supports only classifier types 4 and 10.\n+ */\n+enum nl80211_qm_tclas_classifier_type {\n+\tNL80211_QM_TCLAS_CLASSIFIER_TYPE4 = 4,\n+\tNL80211_QM_TCLAS_CLASSIFIER_TYPE10 = 10,\n+};\n+\n+/**\n+ * enum nl80211_qm_tclas_type4_mask - classifier mask bits for TCLAS type 4\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_VERSION: IP version field\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_IP: source IP address\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_IP: destination IP address\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT: source port\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_PORT: destination port\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_DSCP: DSCP field\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL: protocol / next-header field\n+ * @NL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL: IPv6 flow label\n+ */\n+enum nl80211_qm_tclas_type4_mask {\n+\tNL80211_QM_TCLAS_TYPE4_MASK_VERSION = 1 \u003c\u003c 0,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_SRC_IP = 1 \u003c\u003c 1,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_DST_IP = 1 \u003c\u003c 2,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT = 1 \u003c\u003c 3,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_DST_PORT = 1 \u003c\u003c 4,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_DSCP = 1 \u003c\u003c 5,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL = 1 \u003c\u003c 6,\n+\tNL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL = 1 \u003c\u003c 7,\n+};\n+\n+/**\n+ * enum nl80211_qm_tclas_processing - TCLAS processing rules\n+ *\n+ * Processing field values are defined in 9.4.2.31, IEEE Std 802.11-2024.\n+ *\n+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL: all TCLAS elements must match\n+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ANY: any TCLAS element may match\n+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST: all except the first\n+ *\tmust match\n+ */\n+enum nl80211_qm_tclas_processing {\n+\tNL80211_QM_TCLAS_PROCESSING_MATCH_ALL = 0,\n+\tNL80211_QM_TCLAS_PROCESSING_MATCH_ANY = 1,\n+\tNL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST = 2,\n+};\n+\n+/**\n+ * enum nl80211_qm_qos_attrs - QoS Management QoS attributes\n+ *\n+ * The QoS Characteristics element is specified in 9.4.2.326,\n+ * IEEE Std 802.11be-2024.\n+ *\n+ * @NL80211_QM_QOS_ATTR_INVALID: Invalid\n+ * @NL80211_QM_QOS_ATTR_CONTROL_INFO: QoS characteristics control info (u32)\n+ * @NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL: Minimum service interval, us (u32)\n+ * @NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL: Maximum service interval, us (u32)\n+ * @NL80211_QM_QOS_ATTR_MIN_DATA_RATE: Minimum data rate, kbps (u32)\n+ * @NL80211_QM_QOS_ATTR_DELAY_BOUND: Delay bound, us (u32)\n+ * @NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE: Maximum MSDU size, bytes (u16)\n+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME: Service start time, us (u32)\n+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID: Link ID for service start\n+ *\ttime (u8)\n+ * @NL80211_QM_QOS_ATTR_MEAN_DATA_RATE: Mean data rate, kbps (u32)\n+ * @NL80211_QM_QOS_ATTR_BURST_SIZE: Burst size, bytes (u32)\n+ * @NL80211_QM_QOS_ATTR_MSDU_LIFETIME: MSDU lifetime, ms (u16)\n+ * @NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO: MSDU delivery ratio and count\n+ *\texponent (u8)\n+ * @NL80211_QM_QOS_ATTR_MEDIUM_TIME: Medium time, 32 us units (u16)\n+ * @__NL80211_QM_QOS_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_QOS_ATTR_MAX: highest QoS attribute number currently defined\n+ */\n+enum nl80211_qm_qos_attrs {\n+\tNL80211_QM_QOS_ATTR_INVALID,\n+\tNL80211_QM_QOS_ATTR_CONTROL_INFO,\n+\tNL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL,\n+\tNL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL,\n+\tNL80211_QM_QOS_ATTR_MIN_DATA_RATE,\n+\tNL80211_QM_QOS_ATTR_DELAY_BOUND,\n+\tNL80211_QM_QOS_ATTR_MAX_MSDU_SIZE,\n+\tNL80211_QM_QOS_ATTR_SVC_START_TIME,\n+\tNL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID,\n+\tNL80211_QM_QOS_ATTR_MEAN_DATA_RATE,\n+\tNL80211_QM_QOS_ATTR_BURST_SIZE,\n+\tNL80211_QM_QOS_ATTR_MSDU_LIFETIME,\n+\tNL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO,\n+\tNL80211_QM_QOS_ATTR_MEDIUM_TIME,\n+\n+\t/* keep last */\n+\t__NL80211_QM_QOS_ATTR_AFTER_LAST,\n+\tNL80211_QM_QOS_ATTR_MAX = __NL80211_QM_QOS_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_desc_attrs - QoS Management descriptor attributes\n+ *\n+ * @NL80211_QM_DESC_ATTR_INVALID: Invalid\n+ * @NL80211_QM_DESC_ATTR_QM_ID: Userspace-assigned identifier (u8) used\n+ *\tto correlate a request descriptor with its response descriptor\n+ * @NL80211_QM_DESC_ATTR_REQUEST_TYPE: Request type, see\n+ *\t\u0026enum nl80211_qm_req_type (u8)\n+ * @NL80211_QM_DESC_ATTR_PRIORITY: SCS descriptor priority (u8)\n+ * @NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS: Nested array of SCS TCLAS elements,\n+ *\tsee \u0026enum nl80211_qm_tclas_attrs\n+ * @NL80211_QM_DESC_ATTR_TCLAS_PROCESSING: SCS TCLAS processing rule (u8),\n+ *\tsee \u0026enum nl80211_qm_tclas_processing\n+ * @NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES: Nested SCS QoS attributes, see\n+ *\t\u0026enum nl80211_qm_qos_attrs\n+ * @NL80211_QM_DESC_ATTR_STATUS: Response status for this descriptor (u8),\n+ *\tsee \u0026enum nl80211_qm_status\n+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP: MSCS user priority bitmap of\n+ *\tTID values sent by the non-AP STA (u8)\n+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT: MSCS user priority limit sent\n+ *\tby the non-AP STA (u8)\n+ * @NL80211_QM_DESC_ATTR_TCLAS_MASK: MSCS traffic classifier mask with a\n+ *\tbitmap of parameters to match in an uplink flow for downlink\n+ *\tprioritization (u8)\n+ * @__NL80211_QM_DESC_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_DESC_ATTR_MAX: highest QoS Management descriptor attribute\n+ *\tnumber currently defined\n+ */\n+enum nl80211_qm_desc_attrs {\n+\tNL80211_QM_DESC_ATTR_INVALID,\n+\tNL80211_QM_DESC_ATTR_QM_ID,\n+\tNL80211_QM_DESC_ATTR_REQUEST_TYPE,\n+\tNL80211_QM_DESC_ATTR_PRIORITY,\n+\tNL80211_QM_DESC_ATTR_TCLAS_ELEMENTS,\n+\tNL80211_QM_DESC_ATTR_TCLAS_PROCESSING,\n+\tNL80211_QM_DESC_ATTR_QOS_ATTRIBUTES,\n+\tNL80211_QM_DESC_ATTR_STATUS,\n+\tNL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP,\n+\tNL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT,\n+\tNL80211_QM_DESC_ATTR_TCLAS_MASK,\n+\n+\t/* keep last */\n+\t__NL80211_QM_DESC_ATTR_AFTER_LAST,\n+\tNL80211_QM_DESC_ATTR_MAX = __NL80211_QM_DESC_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_attrs - QoS Management attributes\n+ *\n+ * @NL80211_QM_ATTR_INVALID: Invalid\n+ * @NL80211_QM_ATTR_MAC_ADDR: Target station MAC address (6 bytes)\n+ * @NL80211_QM_ATTR_QM_TYPE: QoS Management protocol type, see\n+ *\t\u0026enum nl80211_qm_type (u8)\n+ * @NL80211_QM_ATTR_DESCRIPTOR_PARAMS: Nested array of QM descriptors, see\n+ *\t\u0026enum nl80211_qm_desc_attrs\n+ * @__NL80211_QM_ATTR_AFTER_LAST: internal use\n+ * @NL80211_QM_ATTR_MAX: highest QoS Management attribute number currently\n+ *\tdefined\n+ */\n+enum nl80211_qm_attrs {\n+\tNL80211_QM_ATTR_INVALID,\n+\tNL80211_QM_ATTR_MAC_ADDR,\n+\tNL80211_QM_ATTR_QM_TYPE,\n+\tNL80211_QM_ATTR_DESCRIPTOR_PARAMS,\n+\n+\t/* keep last */\n+\t__NL80211_QM_ATTR_AFTER_LAST,\n+\tNL80211_QM_ATTR_MAX = __NL80211_QM_ATTR_AFTER_LAST - 1\n+};\n+\n+/**\n+ * enum nl80211_qm_type - QoS Management protocol types\n+ * @NL80211_QM_TYPE_SCS: Stream Classification Service (SCS) protocol,\n+ *\treference 11.25.2, IEEE Std 802.11-2024.\n+ * @NL80211_QM_TYPE_MSCS: Mirrored Stream Classification Service (MSCS)\n+ *\tprotocol, reference 11.25.3, IEEE Std 802.11-2024.\n+ * @NL80211_QM_TYPE_MAX: Maximum value for QoS Management protocol types\n+ *\n+ * Enumerates the QoS Management protocols supported through the generic\n+ * QoS Management (QM) request/response framework.\n+ *\n+ */\n+enum nl80211_qm_type {\n+\tNL80211_QM_TYPE_SCS,\n+\tNL80211_QM_TYPE_MSCS,\n+\t/* Future QM protocols to be added here */\n+\tNL80211_QM_TYPE_MAX,\n+};\n+\n+/**\n+ * enum nl80211_qm_direction - QoS Management descriptor\n+ *\ttraffic direction\n+ * @NL80211_QM_DIRECTION_UPLINK: Traffic direction is uplink, from the\n+ *\tnon-AP STA to the AP.\n+ * @NL80211_QM_DIRECTION_DOWNLINK: Traffic direction is downlink, from\n+ *\tthe AP to the non-AP STA.\n+ * @NL80211_QM_DIRECTION_DIRECT: Direct link traffic between STAs (P2P).\n+ *\n+ * Encodes the QoS characteristics element direction subfield, denoting\n+ * which traffic direction a set of QoS attributes applies to. The QoS\n+ * Characteristics element is specified in 9.4.2.326, IEEE Std 802.11be-2024.\n+ */\n+enum nl80211_qm_direction {\n+\tNL80211_QM_DIRECTION_UPLINK = 0,\n+\tNL80211_QM_DIRECTION_DOWNLINK = 1,\n+\tNL80211_QM_DIRECTION_DIRECT = 2,\n+};\n+\n+/**\n+ * enum nl80211_qm_req_type - QoS Management request types\n+ * @NL80211_QM_ADD_REQ: Add a new QoS Management configuration\n+ * @NL80211_QM_REMOVE_REQ: Remove an existing QoS Management configuration\n+ * @NL80211_QM_CHANGE_REQ: Modify an existing QoS Management configuration\n+ *\n+ * Identifies the operation requested in a QoS Management transaction.\n+ * Reference 11.25.2 and 11.25.3, IEEE Std 802.11-2024, for the operation\n+ * values.\n+ */\n+enum nl80211_qm_req_type {\n+\tNL80211_QM_ADD_REQ,\n+\tNL80211_QM_REMOVE_REQ,\n+\tNL80211_QM_CHANGE_REQ,\n+};\n+\n+/**\n+ * enum nl80211_qm_status - QoS Management response status codes\n+ * @NL80211_QM_STATUS_SUCCESS: request accepted\n+ * @NL80211_QM_STATUS_DECLINED: request declined\n+ */\n+enum nl80211_qm_status {\n+\tNL80211_QM_STATUS_SUCCESS = 0,\n+\tNL80211_QM_STATUS_DECLINED = 1,\n+};\n+\n #endif /* __LINUX_NL80211_H */\ndiff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c\nindex 9608c07bcea7d..f66f736adb922 100644\n--- a/net/mac80211/cfg.c\n+++ b/net/mac80211/cfg.c\n@@ -6309,6 +6309,18 @@ ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy,\n \treturn ieee80211_nan_set_non_evac_channels(sdata, channels);\n }\n \n+static int\n+ieee80211_set_qos_mgmt_cfg(struct wiphy *wiphy, struct net_device *dev,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tstruct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);\n+\n+\tlockdep_assert_wiphy(wiphy);\n+\n+\treturn ieee80211_qos_mgmt_cfg(sdata, qm_req, qm_resp);\n+}\n+\n const struct cfg80211_ops mac80211_config_ops = {\n \t.add_virtual_intf = ieee80211_add_iface,\n \t.del_virtual_intf = ieee80211_del_iface,\n@@ -6432,4 +6444,5 @@ const struct cfg80211_ops mac80211_config_ops = {\n \t.nan_set_local_sched = ieee80211_set_local_nan_sched,\n \t.nan_set_peer_sched = ieee80211_set_peer_nan_sched,\n \t.nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels,\n+\t.set_qos_mgmt_cfg = ieee80211_set_qos_mgmt_cfg,\n };\ndiff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h\nindex 83dd15f2daf62..f1dc9ca9f8f70 100644\n--- a/net/mac80211/driver-ops.h\n+++ b/net/mac80211/driver-ops.h\n@@ -1804,4 +1804,32 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,\n \treturn ret;\n }\n \n+static inline int\n+drv_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_local *local, struct ieee80211_sta *sta,\n+\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tint ret = -EOPNOTSUPP;\n+\n+\tmight_sleep();\n+\tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n+\n+\tif (!check_sdata_in_driver(sdata))\n+\t\treturn ret;\n+\n+\t/*\n+\t * Called only for SCS descriptors carrying a QoS Characteristics\n+\t * element (9.4.2.326, IEEE Std 802.11be-2024). Legacy SCS and MSCS\n+\t * are handled in mac80211.\n+\t */\n+\ttrace_drv_qos_mgmt_cfg(local, sdata, sta, qm_req);\n+\tif (local-\u003eops-\u003eqos_mgmt_cfg)\n+\t\tret = local-\u003eops-\u003eqos_mgmt_cfg(\u0026local-\u003ehw, \u0026sdata-\u003evif,\n+\t\t\t\t\t\tsta, qm_req, qm_resp);\n+\ttrace_drv_return_int(local, ret);\n+\n+\treturn ret;\n+}\n+\n #endif /* __MAC80211_DRIVER_OPS */\ndiff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h\nindex 1a6cbbb5a17d8..aa36289b3ae4e 100644\n--- a/net/mac80211/ieee80211_i.h\n+++ b/net/mac80211/ieee80211_i.h\n@@ -80,6 +80,20 @@ struct ieee80211_mesh_fast_tx;\n #define IEEE80211_DEFAULT_MAX_SP_LEN\t\t\\\n \tIEEE80211_WMM_IE_STA_QOSINFO_SP_ALL\n \n+/*\n+ * TODO: Synchronize this skb-\u003emark encoding with the userspace application\n+ * (hostapd). These values reuse IEEE element IDs, but their use in skb-\u003emark\n+ * is an implementation contract between hostapd/nftables and mac80211.\n+ */\n+/* skb-\u003emark bits [7:0] carry a QoS Management protocol tag. The values\n+ * match the IEEE Std 802.11-2024 element IDs for the respective descriptors:\n+ * WLAN_EID_SCS_DESCRIPTOR (185) and WLAN_EID_EXT_MSCS_DESCRIPTOR (88).\n+ */\n+#define IEEE80211_QOS_MGMT_TAG_MASK\tGENMASK(7, 0)\n+#define IEEE80211_QOS_MGMT_SCS_TAG\tWLAN_EID_SCS_DESCRIPTOR\n+#define IEEE80211_QOS_MGMT_MSCS_TAG\tWLAN_EID_EXT_MSCS_DESCRIPTOR\n+#define IEEE80211_QOS_MGMT_ID_MASK\tGENMASK(15, 8)\n+\n extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];\n \n #define IEEE80211_DEAUTH_FRAME_LEN\t(24 /* hdr */ + 2 /* reason */)\n@@ -3020,6 +3034,10 @@ ieee80211_uhr_cap_ie_to_sta_uhr_cap(struct ieee80211_sub_if_data *sdata,\n \t\t\t\t u8 uhr_cap_len,\n \t\t\t\t struct link_sta_info *link_sta);\n \n+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp);\n+\n #if IS_ENABLED(CONFIG_MAC80211_KUNIT_TEST)\n #define EXPORT_SYMBOL_IF_MAC80211_KUNIT(sym) EXPORT_SYMBOL_IF_KUNIT(sym)\n #define VISIBLE_IF_MAC80211_KUNIT\ndiff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c\nindex 6ec45a9f72214..2d853cd1c18aa 100644\n--- a/net/mac80211/mlme.c\n+++ b/net/mac80211/mlme.c\n@@ -12036,3 +12036,168 @@ void ieee80211_sta_rx_queued_frame(struct ieee80211_sub_if_data *sdata,\n \t\tbreak;\n \t}\n }\n+\n+static void\n+ieee80211_qos_mgmt_update_scs(struct ieee80211_sta_qos *qos,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tu8 tid;\n+\tint i;\n+\n+\tif (qm_req-\u003eqm_type != NL80211_QM_TYPE_SCS)\n+\t\treturn;\n+\n+\tfor (i = 0; i \u003c qm_req-\u003enum_qm_desc; i++) {\n+\t\tstruct cfg80211_qm_req_desc_data *qm_req_desc =\n+\t\t\t\u0026qm_req-\u003eqm_req_desc[i];\n+\t\tstruct cfg80211_qm_resp_desc_data *qm_resp_desc =\n+\t\t\t\u0026qm_resp-\u003eqm_resp_desc[i];\n+\n+\t\tif (qm_resp_desc-\u003eqm_id != qm_req_desc-\u003eqm_id ||\n+\t\t qm_resp_desc-\u003estatus != NL80211_QM_STATUS_SUCCESS)\n+\t\t\tcontinue;\n+\n+\t\tswitch (qm_req_desc-\u003erequest_type) {\n+\t\tcase NL80211_QM_REMOVE_REQ:\n+\t\t\tclear_bit(qm_req_desc-\u003eqm_id, qos-\u003eactive_scs_id);\n+\t\t\tbreak;\n+\t\tcase NL80211_QM_ADD_REQ:\n+\t\tcase NL80211_QM_CHANGE_REQ:\n+\t\t\t/*\n+\t\t\t * For legacy SCS the TID is derived from the UP\n+\t\t\t * field of the first TCLAS element (11.25.2, IEEE\n+\t\t\t * Std 802.11-2024). For 802.11be SCS the TID is\n+\t\t\t * taken from the QoS\n+\t\t\t * Characteristics element (9.4.2.326, IEEE Std\n+\t\t\t * 802.11be-2024).\n+\t\t\t */\n+\t\t\tif (qm_req_desc-\u003eis_qos_present)\n+\t\t\t\ttid = qm_req_desc-\u003eqos_attr.tid;\n+\t\t\telse if (qm_req_desc-\u003enum_tclas_elements \u003e 0)\n+\t\t\t\ttid = qm_req_desc-\u003etclas[0].up;\n+\t\t\telse\n+\t\t\t\tcontinue;\n+\n+\t\t\tif (tid \u003e= IEEE80211_QOS_MGMT_MAX_TID)\n+\t\t\t\tcontinue;\n+\n+\t\t\tqos-\u003escs_id_tid_mapping[qm_req_desc-\u003eqm_id] = tid;\n+\t\t\tset_bit(qm_req_desc-\u003eqm_id, qos-\u003eactive_scs_id);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tqos-\u003escs_enabled =\n+\t\t!bitmap_empty(qos-\u003eactive_scs_id,\n+\t\t\t IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);\n+}\n+\n+static void\n+ieee80211_qos_mgmt_update_mscs(struct ieee80211_sta_qos *qos,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tstruct cfg80211_qm_req_desc_data *qm_req_desc;\n+\tstruct cfg80211_qm_resp_desc_data *qm_resp_desc;\n+\n+\tqm_req_desc = \u0026qm_req-\u003eqm_req_desc[0];\n+\tqm_resp_desc = \u0026qm_resp-\u003eqm_resp_desc[0];\n+\n+\tif (qm_resp_desc-\u003eqm_id != qm_req_desc-\u003eqm_id ||\n+\t qm_resp_desc-\u003estatus != NL80211_QM_STATUS_SUCCESS)\n+\t\treturn;\n+\n+\tswitch (qm_req_desc-\u003erequest_type) {\n+\tcase NL80211_QM_ADD_REQ:\n+\tcase NL80211_QM_CHANGE_REQ:\n+\t\tqos-\u003emscs_user_priority_bitmap =\n+\t\t\tqm_req_desc-\u003euser_priority_bitmap;\n+\t\tqos-\u003emscs_user_priority_limit =\n+\t\t\tqm_req_desc-\u003euser_priority_limit;\n+\t\tqos-\u003emscs_enabled = true;\n+\t\tbreak;\n+\tcase NL80211_QM_REMOVE_REQ:\n+\t\tqos-\u003emscs_user_priority_bitmap = 0;\n+\t\tqos-\u003emscs_user_priority_limit = 0;\n+\t\tqos-\u003emscs_enabled = false;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+}\n+\n+static bool\n+ieee80211_qos_mgmt_has_qos_char(struct cfg80211_qm_req_data *qm_req)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i \u003c qm_req-\u003enum_qm_desc; i++) {\n+\t\tif (qm_req-\u003eqm_req_desc[i].is_qos_present)\n+\t\t\treturn true;\n+\t}\n+\treturn false;\n+}\n+\n+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,\n+\t\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tstruct ieee80211_local *local = sdata-\u003elocal;\n+\tstruct ieee80211_sta_qos_rcu *new_qos = NULL;\n+\tstruct ieee80211_sta_qos_rcu *old_qos;\n+\tstruct sta_info *sta;\n+\tint ret;\n+\n+\tif (sdata-\u003evif.type != NL80211_IFTYPE_AP)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tsta = sta_info_get_bss(sdata, qm_req-\u003epeer_mac);\n+\tif (!sta)\n+\t\treturn -ENOENT;\n+\n+\tif (qm_req-\u003eqm_type == NL80211_QM_TYPE_SCS ||\n+\t qm_req-\u003eqm_type == NL80211_QM_TYPE_MSCS) {\n+\t\tnew_qos = kzalloc_obj(*new_qos);\n+\t\tif (!new_qos)\n+\t\t\treturn -ENOMEM;\n+\n+\t\told_qos = rcu_dereference_protected(sta-\u003eqos,\n+\t\t\t\t\t\t lockdep_is_held(\u0026local-\u003ehw.wiphy-\u003emtx));\n+\t\tif (old_qos)\n+\t\t\tnew_qos-\u003edata = old_qos-\u003edata;\n+\t}\n+\n+\t/*\n+\t * SCS descriptors carrying a QoS Characteristics element\n+\t * (9.4.2.326, IEEE Std 802.11be-2024) require hardware-specific\n+\t * scheduling support; forward the request to the driver. Legacy\n+\t * SCS and MSCS are handled in mac80211.\n+\t */\n+\tif (ieee80211_qos_mgmt_has_qos_char(qm_req)) {\n+\t\tret = drv_qos_mgmt_cfg(sdata, local, \u0026sta-\u003esta,\n+\t\t\t\t qm_req, qm_resp);\n+\t\tif (ret) {\n+\t\t\tkfree(new_qos);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\tif (!new_qos)\n+\t\treturn 0;\n+\n+\tif (qm_req-\u003eqm_type == NL80211_QM_TYPE_SCS)\n+\t\tieee80211_qos_mgmt_update_scs(\u0026new_qos-\u003edata, qm_req,\n+\t\t\t\t\t qm_resp);\n+\telse\n+\t\tieee80211_qos_mgmt_update_mscs(\u0026new_qos-\u003edata, qm_req,\n+\t\t\t\t\t qm_resp);\n+\told_qos = rcu_replace_pointer(sta-\u003eqos, new_qos,\n+\t\t\t\t lockdep_is_held(\u0026local-\u003ehw.wiphy-\u003emtx));\n+\tif (old_qos)\n+\t\tkfree_rcu(old_qos, rcu_head);\n+\n+\treturn 0;\n+}\ndiff --git a/net/mac80211/rx.c b/net/mac80211/rx.c\nindex ecee9348c70d4..930de5b412c5d 100644\n--- a/net/mac80211/rx.c\n+++ b/net/mac80211/rx.c\n@@ -1003,6 +1003,31 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)\n \trx-\u003eskb-\u003epriority = (tid \u003e 7) ? 0 : tid;\n }\n \n+static void ieee80211_qos_mgmt_mscs_set_mark(struct ieee80211_rx_data *rx)\n+{\n+\tstruct ieee80211_sta_qos_rcu *qos;\n+\tu8 tid;\n+\n+\tif (!rx-\u003esta ||\n+\t (rx-\u003esdata-\u003evif.type != NL80211_IFTYPE_AP \u0026\u0026\n+\t rx-\u003esdata-\u003evif.type != NL80211_IFTYPE_AP_VLAN) ||\n+\t rx-\u003eseqno_idx \u003e= IEEE80211_QOS_MGMT_MAX_TID)\n+\t\treturn;\n+\n+\ttid = rx-\u003eskb-\u003epriority;\n+\n+\tqos = rcu_dereference(rx-\u003esta-\u003eqos);\n+\tif (!qos || !qos-\u003edata.mscs_enabled ||\n+\t !(BIT(tid) \u0026 qos-\u003edata.mscs_user_priority_bitmap))\n+\t\treturn;\n+\n+\trx-\u003eskb-\u003emark = u32_replace_bits(rx-\u003eskb-\u003emark,\n+\t\t\t\t\t IEEE80211_QOS_MGMT_MSCS_TAG,\n+\t\t\t\t\t IEEE80211_QOS_MGMT_TAG_MASK);\n+\trx-\u003eskb-\u003emark = u32_replace_bits(rx-\u003eskb-\u003emark, tid,\n+\t\t\t\t\t IEEE80211_QOS_MGMT_ID_MASK);\n+}\n+\n /**\n * DOC: Packet alignment\n *\n@@ -3333,6 +3358,9 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)\n \n \trx-\u003eskb-\u003edev = dev;\n \n+\tif (!port_control)\n+\t\tieee80211_qos_mgmt_mscs_set_mark(rx);\n+\n \tif (!ieee80211_hw_check(\u0026local-\u003ehw, SUPPORTS_DYNAMIC_PS) \u0026\u0026\n \t local-\u003eps_sdata \u0026\u0026 local-\u003ehw.conf.dynamic_ps_timeout \u003e 0 \u0026\u0026\n \t !is_multicast_ether_addr(\n@@ -4996,6 +5024,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,\n \tstats-\u003epackets++;\n \n \tskb-\u003edev = fast_rx-\u003edev;\n+\tieee80211_qos_mgmt_mscs_set_mark(rx);\n \n \tdev_sw_netstats_rx_add(fast_rx-\u003edev, skb-\u003elen);\n \ndiff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c\nindex 5c95ffee257d3..e714b719e2f1e 100644\n--- a/net/mac80211/sta_info.c\n+++ b/net/mac80211/sta_info.c\n@@ -467,8 +467,15 @@ static void sta_remove_link(struct sta_info *sta, unsigned int link_id,\n */\n void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)\n {\n+\tstruct ieee80211_sta_qos_rcu *qos;\n \tint i;\n \n+\tlockdep_assert_wiphy(local-\u003ehw.wiphy);\n+\tqos = rcu_replace_pointer(sta-\u003eqos, NULL,\n+\t\t\t\t lockdep_is_held(\u0026local-\u003ehw.wiphy-\u003emtx));\n+\tif (qos)\n+\t\tkfree_rcu(qos, rcu_head);\n+\n \tfor (i = 0; i \u003c ARRAY_SIZE(sta-\u003elink); i++) {\n \t\tstruct link_sta_info *link_sta;\n \ndiff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h\nindex 8942541375b27..68acd8fdc6718 100644\n--- a/net/mac80211/sta_info.h\n+++ b/net/mac80211/sta_info.h\n@@ -16,10 +16,29 @@\n #include \u003clinux/average.h\u003e\n #include \u003clinux/bitfield.h\u003e\n #include \u003clinux/etherdevice.h\u003e\n+#include \u003clinux/rcupdate.h\u003e\n #include \u003clinux/rhashtable.h\u003e\n #include \u003clinux/u64_stats_sync.h\u003e\n #include \"key.h\"\n \n+/* SCS IDs are in the range 1-255; zero is reserved. */\n+#define IEEE80211_QOS_MGMT_MAX_SCS_ID\t255\n+#define IEEE80211_QOS_MGMT_MAX_TID\t8\n+\n+struct ieee80211_sta_qos {\n+\tbool scs_enabled;\n+\tbool mscs_enabled;\n+\tDECLARE_BITMAP(active_scs_id, IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);\n+\tu8 scs_id_tid_mapping[IEEE80211_QOS_MGMT_MAX_SCS_ID + 1];\n+\tu8 mscs_user_priority_bitmap;\n+\tu8 mscs_user_priority_limit;\n+};\n+\n+struct ieee80211_sta_qos_rcu {\n+\tstruct rcu_head rcu_head;\n+\tstruct ieee80211_sta_qos data;\n+};\n+\n /**\n * enum ieee80211_sta_info_flags - Stations flags\n *\n@@ -657,6 +676,7 @@ struct ieee80211_sta_removed_link_stats {\n * @rate_ctrl_priv: rate control private per-STA pointer\n * @lock: used for locking all fields that require locking, see comments\n *\tin the header file.\n+ * @qos: RCU-published QoS Management state\n * @drv_deliver_wk: used for delivering frames after driver PS unblocking\n * @listen_interval: listen interval of this station, when we're acting as AP\n * @_flags: STA flags, see \u0026enum ieee80211_sta_info_flags, do not use directly\n@@ -728,6 +748,7 @@ struct sta_info {\n \tvoid *rate_ctrl_priv;\n \tspinlock_t rate_ctrl_lock;\n \tspinlock_t lock;\n+\tstruct ieee80211_sta_qos_rcu __rcu *qos;\n \n \tstruct ieee80211_fast_tx __rcu *fast_tx;\n \tstruct ieee80211_fast_rx __rcu *fast_rx;\ndiff --git a/net/mac80211/trace.h b/net/mac80211/trace.h\nindex ea46c3cca21a3..ce69e5edd03f0 100644\n--- a/net/mac80211/trace.h\n+++ b/net/mac80211/trace.h\n@@ -3431,6 +3431,30 @@ TRACE_EVENT(drv_nan_peer_sched_changed,\n \t)\n );\n \n+TRACE_EVENT(drv_qos_mgmt_cfg,\n+\t TP_PROTO(struct ieee80211_local *local,\n+\t\t struct ieee80211_sub_if_data *sdata,\n+\t\t struct ieee80211_sta *sta,\n+\t\t struct cfg80211_qm_req_data *qm_req),\n+\t TP_ARGS(local, sdata, sta, qm_req),\n+\t TP_STRUCT__entry(LOCAL_ENTRY\n+\t\t\t VIF_ENTRY\n+\t\t\t STA_ENTRY\n+\t\t\t __field(u8, qm_type)\n+\t\t\t __field(unsigned int, num_qm_desc)\n+\t),\n+\t TP_fast_assign(LOCAL_ASSIGN;\n+\t\t\t VIF_ASSIGN;\n+\t\t\t STA_NAMED_ASSIGN(sta);\n+\t\t\t __entry-\u003eqm_type = qm_req-\u003eqm_type;\n+\t\t\t __entry-\u003enum_qm_desc = qm_req-\u003enum_qm_desc;\n+\t),\n+\t TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT\n+\t\t \" qm_type:%u num_qm_desc:%u\",\n+\t\t LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,\n+\t\t __entry-\u003eqm_type, __entry-\u003enum_qm_desc)\n+);\n+\n #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */\n \n #undef TRACE_INCLUDE_PATH\ndiff --git a/net/mac80211/wme.c b/net/mac80211/wme.c\nindex 1601be5764145..feca08f281856 100644\n--- a/net/mac80211/wme.c\n+++ b/net/mac80211/wme.c\n@@ -113,6 +113,52 @@ static u16 ieee80211_downgrade_queue(struct ieee80211_sub_if_data *sdata,\n \treturn ieee802_1d_to_ac[skb-\u003epriority];\n }\n \n+static void\n+ieee80211_qos_mgmt_set_priority(struct sta_info *sta, struct sk_buff *skb)\n+{\n+\tstruct ieee80211_sta_qos_rcu *qos;\n+\tu8 qos_tag;\n+\tu8 qos_id;\n+\tu8 tid;\n+\n+\tif (!sta)\n+\t\treturn;\n+\n+\tqos_tag = u32_get_bits(skb-\u003emark, IEEE80211_QOS_MGMT_TAG_MASK);\n+\tqos_id = u32_get_bits(skb-\u003emark, IEEE80211_QOS_MGMT_ID_MASK);\n+\tif (qos_tag != IEEE80211_QOS_MGMT_SCS_TAG \u0026\u0026\n+\t qos_tag != IEEE80211_QOS_MGMT_MSCS_TAG)\n+\t\treturn;\n+\n+\tif (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG \u0026\u0026 !qos_id)\n+\t\treturn;\n+\n+\tguard(rcu)();\n+\tqos = rcu_dereference(sta-\u003eqos);\n+\n+\tif (!qos)\n+\t\treturn;\n+\n+\tif (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG) {\n+\t\tif (!qos-\u003edata.scs_enabled ||\n+\t\t !test_bit(qos_id, qos-\u003edata.active_scs_id))\n+\t\t\treturn;\n+\n+\t\ttid = qos-\u003edata.scs_id_tid_mapping[qos_id];\n+\t} else {\n+\t\tif (!qos-\u003edata.mscs_enabled ||\n+\t\t qos_id \u003e= IEEE80211_QOS_MGMT_MAX_TID ||\n+\t\t !(qos-\u003edata.mscs_user_priority_bitmap \u0026 BIT(qos_id)))\n+\t\t\treturn;\n+\n+\t\ttid = min_t(u8, qos_id,\n+\t\t\t qos-\u003edata.mscs_user_priority_limit);\n+\t}\n+\n+\tif (tid \u003c IEEE80211_QOS_MGMT_MAX_TID)\n+\t\tskb-\u003epriority = tid;\n+}\n+\n /* Indicate which queue to use for this fully formed 802.11 frame */\n u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,\n \t\t\t\t struct sk_buff *skb,\n@@ -179,6 +225,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,\n \tqos_map = rcu_dereference(sdata-\u003eqos_map);\n \tskb-\u003epriority = cfg80211_classify8021d(skb, qos_map ?\n \t\t\t\t\t \u0026qos_map-\u003eqos_map : NULL);\n+\tieee80211_qos_mgmt_set_priority(sta, skb);\n \n downgrade:\n \treturn ieee80211_downgrade_queue(sdata, sta, skb);\ndiff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c\nindex d790e204aee36..d77363a7ed176 100644\n--- a/net/wireless/nl80211.c\n+++ b/net/wireless/nl80211.c\n@@ -798,6 +798,93 @@ static const struct netlink_range_validation q_range = {\n \t.max = INT_MAX,\n };\n \n+static const struct nla_policy\n+nl80211_qm_tclas_type4_policy[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1] = {\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] = { .type = NLA_BINARY,\n+\t\t\t\t\t .len = NL80211_IPADDR_MAX_LEN },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] = { .type = NLA_BINARY,\n+\t\t\t\t\t .len = NL80211_IPADDR_MAX_LEN },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] = { .type = NLA_U16 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] = { .type = NLA_U16 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP] = NLA_POLICY_MAX(NLA_U8, 63),\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL] =\n+\t\tNLA_POLICY_EXACT_LEN(NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN),\n+};\n+\n+static const struct nla_policy\n+nl80211_qm_tclas_type10_policy[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1] = {\n+\t[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] = {\n+\t\t\t.type = NLA_BINARY,\n+\t\t\t.len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },\n+\t[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK] = {\n+\t\t\t.type = NLA_BINARY,\n+\t\t\t.len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },\n+};\n+\n+static const struct nla_policy\n+nl80211_qm_tclas_policy[NL80211_QM_TCLAS_ATTR_MAX + 1] = {\n+\t[NL80211_QM_TCLAS_ATTR_USER_PRIORITY] =\n+\t\t\tNLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),\n+\t[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE] = { .type = NLA_U8 },\n+\t[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS] =\n+\t\t\tNLA_POLICY_NESTED(nl80211_qm_tclas_type4_policy),\n+\t[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS] =\n+\t\t\tNLA_POLICY_NESTED(nl80211_qm_tclas_type10_policy),\n+};\n+\n+static const struct nla_policy\n+nl80211_qm_qos_policy[NL80211_QM_QOS_ATTR_MAX + 1] = {\n+\t[NL80211_QM_QOS_ATTR_CONTROL_INFO] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_MIN_DATA_RATE] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_DELAY_BOUND] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE] = { .type = NLA_U16 },\n+\t[NL80211_QM_QOS_ATTR_SVC_START_TIME] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID] =\n+\t\t\tNLA_POLICY_MAX(NLA_U8, IEEE80211_MLD_MAX_NUM_LINKS - 1),\n+\t[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_BURST_SIZE] = { .type = NLA_U32 },\n+\t[NL80211_QM_QOS_ATTR_MSDU_LIFETIME] = { .type = NLA_U16 },\n+\t[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO] = { .type = NLA_U8 },\n+\t[NL80211_QM_QOS_ATTR_MEDIUM_TIME] = { .type = NLA_U16 },\n+};\n+\n+static const struct nla_policy\n+nl80211_qm_desc_params_policy[NL80211_QM_DESC_ATTR_MAX + 1] = {\n+\t[NL80211_QM_DESC_ATTR_QM_ID] = { .type = NLA_U8 },\n+\t[NL80211_QM_DESC_ATTR_REQUEST_TYPE] =\n+\t\tNLA_POLICY_MAX(NLA_U8, NL80211_QM_CHANGE_REQ),\n+\t[NL80211_QM_DESC_ATTR_PRIORITY] = { .type = NLA_U8 },\n+\t[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS] =\n+\t\t\tNLA_POLICY_NESTED_ARRAY(nl80211_qm_tclas_policy),\n+\t[NL80211_QM_DESC_ATTR_TCLAS_PROCESSING] =\n+\t\tNLA_POLICY_MAX(NLA_U8,\n+\t\t\t NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST),\n+\t[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES] =\n+\t\t\tNLA_POLICY_NESTED(nl80211_qm_qos_policy),\n+\t[NL80211_QM_DESC_ATTR_STATUS] = { .type = NLA_REJECT },\n+\t[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP] = { .type = NLA_U8 },\n+\t[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT] =\n+\t\tNLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),\n+\t[NL80211_QM_DESC_ATTR_TCLAS_MASK] = { .type = NLA_U8 },\n+};\n+\n+static const struct nla_policy\n+nl80211_qm_policy[NL80211_QM_ATTR_MAX + 1] = {\n+\t[NL80211_QM_ATTR_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\n+\t[NL80211_QM_ATTR_QM_TYPE] = NLA_POLICY_MAX(NLA_U8,\n+\t\t\t\t\t\t NL80211_QM_TYPE_MAX - 1),\n+\t[NL80211_QM_ATTR_DESCRIPTOR_PARAMS] =\n+\t\t\tNLA_POLICY_NESTED_ARRAY(nl80211_qm_desc_params_policy),\n+};\n+\n static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n \t[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },\n \t[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },\n@@ -1201,6 +1288,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n \t[NL80211_ATTR_ASSOC_CIP] = { .type = NLA_FLAG },\n \t[NL80211_ATTR_CIP_CAPABILITIES] = { .type = NLA_U8 },\n \t[NL80211_ATTR_ASSOC_PROTECTED_TWT] = { .type = NLA_FLAG },\n+\t[NL80211_ATTR_QOS_MGMT] = NLA_POLICY_NESTED(nl80211_qm_policy),\n };\n \n /* policy for the key attributes */\n@@ -20459,6 +20547,642 @@ static const struct genl_ops nl80211_ops[] = {\n \t},\n };\n \n+static int\n+nl80211_parse_qm_tclas4_elem(struct nlattr *tb_tclas_entry[],\n+\t\t\t struct cfg80211_qm_tclas4_params *type4_params)\n+{\n+\tstruct nlattr *tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1];\n+\tstruct nlattr *attr;\n+\tu8 version;\n+\n+\tif (nla_parse_nested(tb_tclas_type4, NL80211_QM_TCLAS_TYPE4_ATTR_MAX,\n+\t\t\t tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS],\n+\t\t\t nl80211_qm_tclas_type4_policy, NULL))\n+\t\treturn -EINVAL;\n+\n+\tif (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] ||\n+\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP])\n+\t\treturn -EINVAL;\n+\n+\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK];\n+\ttype4_params-\u003eclassifier_mask = nla_get_u8(attr);\n+\tif (!(type4_params-\u003eclassifier_mask \u0026\n+\t NL80211_QM_TCLAS_TYPE4_MASK_VERSION))\n+\t\treturn -EINVAL;\n+\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION];\n+\ttype4_params-\u003eip_ver = nla_get_u8(attr);\n+\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT];\n+\ttype4_params-\u003esrc_port = nla_get_u16(attr);\n+\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT];\n+\ttype4_params-\u003edst_port = nla_get_u16(attr);\n+\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP];\n+\ttype4_params-\u003edscp = nla_get_u8(attr);\n+\n+\tversion = type4_params-\u003eip_ver;\n+\tif (version == QM_IP_VERSION_4) {\n+\t\tif (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL])\n+\t\t\treturn -EINVAL;\n+\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];\n+\t\tif (nla_len(attr) != QM_IPV4_LEN)\n+\t\t\treturn -EINVAL;\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];\n+\t\tif (nla_len(attr) != QM_IPV4_LEN)\n+\t\t\treturn -EINVAL;\n+\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL];\n+\t\ttype4_params-\u003eprotocol = nla_get_u8(attr);\n+\n+\t\tnla_memcpy(type4_params-\u003esrc_ip.ipv4,\n+\t\t\t tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],\n+\t\t\t QM_IPV4_LEN);\n+\t\tnla_memcpy(type4_params-\u003edst_ip.ipv4,\n+\t\t\t tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],\n+\t\t\t QM_IPV4_LEN);\n+\t} else if (version == QM_IP_VERSION_6) {\n+\t\tif (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] ||\n+\t\t !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL])\n+\t\t\treturn -EINVAL;\n+\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];\n+\t\tif (nla_len(attr) != QM_IPV6_LEN)\n+\t\t\treturn -EINVAL;\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];\n+\t\tif (nla_len(attr) != QM_IPV6_LEN)\n+\t\t\treturn -EINVAL;\n+\n+\t\tnla_memcpy(type4_params-\u003esrc_ip.ipv6,\n+\t\t\t tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],\n+\t\t\t QM_IPV6_LEN);\n+\t\tnla_memcpy(type4_params-\u003edst_ip.ipv6,\n+\t\t\t tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],\n+\t\t\t QM_IPV6_LEN);\n+\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER];\n+\t\ttype4_params-\u003enext_header = nla_get_u8(attr);\n+\n+\t\tattr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL];\n+\t\tnla_memcpy(type4_params-\u003eflow_label,\n+\t\t\t attr,\n+\t\t\t NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN);\n+\t} else {\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+nl80211_parse_qm_tclas10_elem(struct nlattr *tb_tclas_entry[],\n+\t\t\t struct cfg80211_qm_tclas10_params *type10_params)\n+{\n+\tstruct nlattr *tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1];\n+\tstruct nlattr *attr;\n+\tu8 filter_value_len, filter_mask_len;\n+\n+\tattr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS];\n+\tif (nla_parse_nested(tb_tclas_type10, NL80211_QM_TCLAS_TYPE10_ATTR_MAX,\n+\t\t\t attr,\n+\t\t\t nl80211_qm_tclas_type10_policy, NULL))\n+\t\treturn -EINVAL;\n+\n+\tif (!tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] ||\n+\t !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] ||\n+\t !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] ||\n+\t !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK])\n+\t\treturn -EINVAL;\n+\n+\tattr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE];\n+\ttype10_params-\u003eprotocol_instance = nla_get_u8(attr);\n+\tattr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER];\n+\ttype10_params-\u003eprotocol_number = nla_get_u8(attr);\n+\n+\tattr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE];\n+\tfilter_value_len = nla_len(attr);\n+\tattr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK];\n+\tfilter_mask_len = nla_len(attr);\n+\n+\tif (filter_value_len != filter_mask_len ||\n+\t filter_value_len \u003e NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN)\n+\t\treturn -EINVAL;\n+\n+\ttype10_params-\u003efilter_len = filter_value_len;\n+\tnla_memcpy(type10_params-\u003efilter_value,\n+\t\t tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE],\n+\t\t type10_params-\u003efilter_len);\n+\tnla_memcpy(type10_params-\u003efilter_mask,\n+\t\t tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK],\n+\t\t type10_params-\u003efilter_len);\n+\n+\treturn 0;\n+}\n+\n+static int\n+nl80211_parse_qm_tclas_elem(struct nlattr *tb_tclas,\n+\t\t\t struct cfg80211_qm_tclas_elements *tclas)\n+{\n+\tstruct nlattr *tb_tclas_entry[NL80211_QM_TCLAS_ATTR_MAX + 1];\n+\tstruct cfg80211_qm_tclas4_params *type4_params;\n+\tstruct cfg80211_qm_tclas10_params *type10_params;\n+\tstruct nlattr *attr;\n+\tu8 classifier_type;\n+\tint ret;\n+\n+\tif (nla_parse_nested(tb_tclas_entry, NL80211_QM_TCLAS_ATTR_MAX,\n+\t\t\t tb_tclas, nl80211_qm_tclas_policy, NULL))\n+\t\treturn -EINVAL;\n+\n+\tif (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY] ||\n+\t !tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE])\n+\t\treturn -EINVAL;\n+\n+\ttclas-\u003eup =\n+\t\tnla_get_u8(tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY]);\n+\tattr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE];\n+\ttclas-\u003eclassifier_type = nla_get_u8(attr);\n+\tclassifier_type = tclas-\u003eclassifier_type;\n+\ttype4_params = \u0026tclas-\u003etclas_elem.type4_params;\n+\ttype10_params = \u0026tclas-\u003etclas_elem.type10_params;\n+\n+\tswitch (classifier_type) {\n+\tcase NL80211_QM_TCLAS_CLASSIFIER_TYPE4:\n+\t\tif (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS])\n+\t\t\treturn -EINVAL;\n+\n+\t\tret = nl80211_parse_qm_tclas4_elem(tb_tclas_entry,\n+\t\t\t\t\t\t type4_params);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\n+\tcase NL80211_QM_TCLAS_CLASSIFIER_TYPE10:\n+\t\tif (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS])\n+\t\t\treturn -EINVAL;\n+\n+\t\tret = nl80211_parse_qm_tclas10_elem(tb_tclas_entry,\n+\t\t\t\t\t\t type10_params);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+nl80211_parse_qm_tclas(struct nlattr *tb[],\n+\t\t struct cfg80211_qm_req_desc_data *qm_req_desc)\n+{\n+\tstruct nlattr *tb_tclas;\n+\tstruct nlattr *tclas_elements;\n+\tstruct cfg80211_qm_tclas_elements *tclas_elem;\n+\tstruct nlattr *attr;\n+\tint rem_tclas_desc;\n+\tunsigned int num_tclas_elements = 0;\n+\tunsigned int tclas_idx = 0;\n+\tint ret;\n+\n+\ttclas_elements = tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS];\n+\tnla_for_each_nested(tb_tclas, tclas_elements, rem_tclas_desc)\n+\t\tnum_tclas_elements++;\n+\n+\tif (num_tclas_elements) {\n+\t\tqm_req_desc-\u003etclas = kzalloc_objs(*qm_req_desc-\u003etclas,\n+\t\t\t\t\t\t num_tclas_elements,\n+\t\t\t\t\t\t GFP_KERNEL);\n+\t\tif (!qm_req_desc-\u003etclas)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n+\tnla_for_each_nested(tb_tclas, tclas_elements,\n+\t\t\t rem_tclas_desc) {\n+\t\ttclas_elem = \u0026qm_req_desc-\u003etclas[tclas_idx];\n+\t\tret = nl80211_parse_qm_tclas_elem(tb_tclas, tclas_elem);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\ttclas_idx++;\n+\t}\n+\n+\tqm_req_desc-\u003enum_tclas_elements = num_tclas_elements;\n+\n+\tattr = tb[NL80211_QM_DESC_ATTR_TCLAS_PROCESSING];\n+\tif (attr)\n+\t\tqm_req_desc-\u003etclas_processing = nla_get_u8(attr);\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * QoS characteristics control info bitfield masks, used only here to\n+ * parse NL80211_QM_QOS_ATTR_CONTROL_INFO.\n+ */\n+#define QM_CTRL_INFO_DIRECTION_MASK\tGENMASK(1, 0)\n+#define QM_CTRL_INFO_TID_MASK\t\tGENMASK(5, 2)\n+#define QM_CTRL_INFO_UP_MASK\t\tGENMASK(8, 6)\n+#define QM_CTRL_INFO_BITMAP_MASK\tGENMASK(24, 9)\n+#define QM_CTRL_INFO_LINK_ID_MASK\tGENMASK(28, 25)\n+#define QM_CTRL_INFO_RESERVED_MASK\tGENMASK(31, 29)\n+\n+/*\n+ * MSDU delivery info bitfield masks, used only here to parse\n+ * NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO.\n+ */\n+#define QM_MSDU_DELIVERY_INFO_RATIO_MASK\t\tGENMASK(3, 0)\n+#define QM_MSDU_DELIVERY_INFO_COUNT_EXPONENT_MASK\tGENMASK(7, 4)\n+\n+#define GET_FIELD_FROM_QM_CTRL_INFO(ctrl_info, FIELD) \\\n+\tu32_get_bits((ctrl_info), QM_CTRL_INFO_##FIELD##_MASK)\n+\n+#define GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info, FIELD) \\\n+\tu8_get_bits((msdu_delivery_info), \\\n+\t\t QM_MSDU_DELIVERY_INFO_##FIELD##_MASK)\n+\n+static int\n+nl80211_parse_qm_qos_attr(struct nlattr *tb[],\n+\t\t\t struct cfg80211_qm_qos_attributes *qos_attr)\n+{\n+\tstruct nlattr *tb_qm_qos[NL80211_QM_QOS_ATTR_MAX + 1];\n+\tstruct nlattr *attr;\n+\tu8 msdu_delivery_info;\n+\tu32 control_info;\n+\n+\tattr = tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES];\n+\tif (nla_parse_nested(tb_qm_qos, NL80211_QM_QOS_ATTR_MAX, attr,\n+\t\t\t nl80211_qm_qos_policy, NULL))\n+\t\treturn -EINVAL;\n+\n+\tif (!tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO] ||\n+\t !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] ||\n+\t !tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] ||\n+\t !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE] ||\n+\t !tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND])\n+\t\treturn -EINVAL;\n+\n+\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO];\n+\tcontrol_info = nla_get_u32(attr);\n+\tqos_attr-\u003edirection =\n+\t\tGET_FIELD_FROM_QM_CTRL_INFO(control_info, DIRECTION);\n+\tqos_attr-\u003etid = GET_FIELD_FROM_QM_CTRL_INFO(control_info, TID);\n+\tqos_attr-\u003eup = GET_FIELD_FROM_QM_CTRL_INFO(control_info, UP);\n+\tqos_attr-\u003ebitmap = GET_FIELD_FROM_QM_CTRL_INFO(control_info, BITMAP);\n+\tqos_attr-\u003elink_id = GET_FIELD_FROM_QM_CTRL_INFO(control_info, LINK_ID);\n+\n+\tqos_attr-\u003emin_service_interval =\n+\t\tnla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL]);\n+\tqos_attr-\u003emax_service_interval =\n+\t\tnla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL]);\n+\tqos_attr-\u003emin_data_rate =\n+\t\tnla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE]);\n+\tqos_attr-\u003edelay_bound =\n+\t\tnla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND]);\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE];\n+\t\tqos_attr-\u003emax_msdu_size = nla_get_u16(attr);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME];\n+\t\tqos_attr-\u003eservice_start_time = nla_get_u32(attr);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID];\n+\t\tqos_attr-\u003eservice_start_time_link_id = nla_get_u8(attr);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE];\n+\t\tqos_attr-\u003emean_data_rate = nla_get_u32(attr);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE])\n+\t\tqos_attr-\u003eburst_size =\n+\t\t\tnla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE]);\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME];\n+\t\tqos_attr-\u003emsdu_lifetime = nla_get_u16(attr);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO]) {\n+\t\tattr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO];\n+\t\tmsdu_delivery_info = nla_get_u8(attr);\n+\n+\t\tqos_attr-\u003emsdu_delivery_ratio =\n+\t\t\tGET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,\n+\t\t\t\t\t\t\t RATIO);\n+\t\tqos_attr-\u003emsdu_count_exponent =\n+\t\t\tGET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,\n+\t\t\t\t\t\t\t COUNT_EXPONENT);\n+\t}\n+\n+\tif (tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME])\n+\t\tqos_attr-\u003emedium_time =\n+\t\t\tnla_get_u16(tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME]);\n+\n+\treturn 0;\n+}\n+\n+static int nl80211_parse_qm_desc(struct nlattr *tb_qm_desc,\n+\t\t\t\t struct cfg80211_qm_req_desc_data *qm_req_desc,\n+\t\t\t\t enum nl80211_qm_type qm_type)\n+{\n+\tstruct nlattr *tb[NL80211_QM_DESC_ATTR_MAX + 1];\n+\tstruct nlattr *attr;\n+\tint ret;\n+\n+\tif (nla_parse_nested(tb, NL80211_QM_DESC_ATTR_MAX,\n+\t\t\t tb_qm_desc, nl80211_qm_desc_params_policy, NULL))\n+\t\treturn -EINVAL;\n+\n+\tif (!tb[NL80211_QM_DESC_ATTR_QM_ID] ||\n+\t !tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE])\n+\t\treturn -EINVAL;\n+\n+\tqm_req_desc-\u003eqm_id = nla_get_u8(tb[NL80211_QM_DESC_ATTR_QM_ID]);\n+\tif (!qm_req_desc-\u003eqm_id)\n+\t\treturn -EINVAL;\n+\n+\tqm_req_desc-\u003erequest_type =\n+\t\tnla_get_u8(tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE]);\n+\n+\tswitch (qm_req_desc-\u003erequest_type) {\n+\tcase NL80211_QM_REMOVE_REQ:\n+\t\treturn 0;\n+\tcase NL80211_QM_ADD_REQ:\n+\tcase NL80211_QM_CHANGE_REQ:\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tswitch (qm_type) {\n+\tcase NL80211_QM_TYPE_SCS:\n+\t\tif (tb[NL80211_QM_DESC_ATTR_PRIORITY]) {\n+\t\t\tattr = tb[NL80211_QM_DESC_ATTR_PRIORITY];\n+\t\t\tqm_req_desc-\u003epriority = nla_get_u8(attr);\n+\t\t}\n+\n+\t\tif (tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS]) {\n+\t\t\tret = nl80211_parse_qm_tclas(tb, qm_req_desc);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\n+\t\tif (tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES]) {\n+\t\t\tret = nl80211_parse_qm_qos_attr(tb,\n+\t\t\t\t\t\t\t\u0026qm_req_desc-\u003eqos_attr);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\tqm_req_desc-\u003eis_qos_present = true;\n+\t\t}\n+\t\tbreak;\n+\n+\tcase NL80211_QM_TYPE_MSCS:\n+\t\tif (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP]) {\n+\t\t\tattr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP];\n+\t\t\tqm_req_desc-\u003euser_priority_bitmap = nla_get_u8(attr);\n+\t\t}\n+\n+\t\tif (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT]) {\n+\t\t\tattr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT];\n+\t\t\tqm_req_desc-\u003euser_priority_limit = nla_get_u8(attr);\n+\t\t}\n+\n+\t\tif (tb[NL80211_QM_DESC_ATTR_TCLAS_MASK]) {\n+\t\t\tattr = tb[NL80211_QM_DESC_ATTR_TCLAS_MASK];\n+\t\t\tqm_req_desc-\u003etclas_mask = nla_get_u8(attr);\n+\t\t}\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+nl80211_set_qm_resp_desc(struct sk_buff *msg,\n+\t\t\t struct cfg80211_qm_resp_desc_data *qm_resp_desc,\n+\t\t\t int idx)\n+{\n+\tstruct nlattr *qm_desc_entry;\n+\n+\tqm_desc_entry = nla_nest_start(msg, idx);\n+\tif (!qm_desc_entry)\n+\t\treturn -ENOBUFS;\n+\n+\tif (nla_put_u8(msg, NL80211_QM_DESC_ATTR_QM_ID,\n+\t\t qm_resp_desc-\u003eqm_id) ||\n+\t nla_put_u8(msg, NL80211_QM_DESC_ATTR_STATUS,\n+\t\t qm_resp_desc-\u003estatus)) {\n+\t\tnla_nest_cancel(msg, qm_desc_entry);\n+\t\treturn -ENOBUFS;\n+\t}\n+\n+\tnla_nest_end(msg, qm_desc_entry);\n+\treturn 0;\n+}\n+\n+static int\n+nl80211_qm_send_resp(struct genl_info *info,\n+\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tstruct nlattr *qm, *qm_desc;\n+\tstruct sk_buff *msg;\n+\tvoid *hdr;\n+\tint ret;\n+\tint idx;\n+\n+\tmsg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);\n+\tif (!msg)\n+\t\treturn -ENOMEM;\n+\n+\thdr = nl80211hdr_put(msg, info-\u003esnd_portid, info-\u003esnd_seq, 0,\n+\t\t\t NL80211_CMD_QOS_MGMT);\n+\tif (!hdr) {\n+\t\tret = -ENOBUFS;\n+\t\tgoto nla_fail;\n+\t}\n+\n+\tqm = nla_nest_start(msg, NL80211_ATTR_QOS_MGMT);\n+\tif (!qm) {\n+\t\tret = -ENOBUFS;\n+\t\tgoto nla_fail;\n+\t}\n+\n+\tif (nla_put(msg, NL80211_QM_ATTR_MAC_ADDR, ETH_ALEN,\n+\t\t qm_req-\u003epeer_mac) ||\n+\t nla_put_u8(msg, NL80211_QM_ATTR_QM_TYPE,\n+\t\t qm_req-\u003eqm_type)) {\n+\t\tret = -ENOBUFS;\n+\t\tgoto nla_qm_fail;\n+\t}\n+\n+\tqm_desc = nla_nest_start(msg, NL80211_QM_ATTR_DESCRIPTOR_PARAMS);\n+\tif (!qm_desc) {\n+\t\tret = -ENOBUFS;\n+\t\tgoto nla_qm_fail;\n+\t}\n+\n+\tfor (idx = 0; idx \u003c qm_req-\u003enum_qm_desc; idx++) {\n+\t\tret = nl80211_set_qm_resp_desc(msg, \u0026qm_resp-\u003eqm_resp_desc[idx],\n+\t\t\t\t\t idx);\n+\t\tif (ret) {\n+\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t \"QoS Management response descriptor failed\");\n+\t\t\tgoto nla_qm_desc_fail;\n+\t\t}\n+\t}\n+\n+\tnla_nest_end(msg, qm_desc);\n+\tnla_nest_end(msg, qm);\n+\tgenlmsg_end(msg, hdr);\n+\n+\treturn genlmsg_reply(msg, info);\n+\n+nla_qm_desc_fail:\n+\tnla_nest_cancel(msg, qm_desc);\n+nla_qm_fail:\n+\tnla_nest_cancel(msg, qm);\n+nla_fail:\n+\tnlmsg_free(msg);\n+\treturn ret;\n+}\n+\n+static void\n+nl80211_free_qm_req(struct cfg80211_qm_req_data *qm_req)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i \u003c qm_req-\u003enum_qm_desc; i++)\n+\t\tkfree(qm_req-\u003eqm_req_desc[i].tclas);\n+\n+\tkfree(qm_req-\u003eqm_req_desc);\n+}\n+\n+static int\n+nl80211_qos_mgmt_cfg(struct sk_buff *skb, struct genl_info *info)\n+{\n+\tstruct cfg80211_registered_device *rdev = info-\u003euser_ptr[0];\n+\tstruct net_device *dev = info-\u003euser_ptr[1];\n+\tstruct wireless_dev *wdev = dev-\u003eieee80211_ptr;\n+\tstruct nlattr *tb_qm[NL80211_QM_ATTR_MAX + 1];\n+\tstruct cfg80211_qm_resp_data qm_resp = {};\n+\tstruct cfg80211_qm_req_data qm_req = {};\n+\tstruct cfg80211_qm_req_desc_data *qm_req_desc;\n+\tstruct nlattr *tb_qm_desc;\n+\tint rem_qm_desc;\n+\tunsigned int num_qm_desc = 0;\n+\tunsigned int idx;\n+\tint ret;\n+\n+\tif (wdev-\u003eiftype != NL80211_IFTYPE_AP)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tif (!info-\u003eattrs[NL80211_ATTR_QOS_MGMT]) {\n+\t\tGENL_SET_ERR_MSG(info, \"QoS Management attribute missing\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (nla_parse_nested(tb_qm, NL80211_QM_ATTR_MAX,\n+\t\t\t info-\u003eattrs[NL80211_ATTR_QOS_MGMT],\n+\t\t\t nl80211_qm_policy, NULL)) {\n+\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t \"QoS Management attribute parsing failed\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!tb_qm[NL80211_QM_ATTR_MAC_ADDR] ||\n+\t !tb_qm[NL80211_QM_ATTR_QM_TYPE] ||\n+\t !tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS]) {\n+\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t \"QoS Management request attributes missing\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tnla_memcpy(qm_req.peer_mac, tb_qm[NL80211_QM_ATTR_MAC_ADDR], ETH_ALEN);\n+\tqm_req.qm_type = nla_get_u8(tb_qm[NL80211_QM_ATTR_QM_TYPE]);\n+\n+\tnla_for_each_nested(tb_qm_desc,\n+\t\t\t tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],\n+\t\t\t rem_qm_desc)\n+\t\tnum_qm_desc++;\n+\n+\tif (!num_qm_desc) {\n+\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t \"QoS Management descriptor list is empty\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tqm_req.qm_req_desc = kzalloc_objs(*qm_req.qm_req_desc,\n+\t\t\t\t\t num_qm_desc, GFP_KERNEL);\n+\tif (!qm_req.qm_req_desc) {\n+\t\tret = -ENOMEM;\n+\t\tgoto free_qm;\n+\t}\n+\n+\tnla_for_each_nested(tb_qm_desc,\n+\t\t\t tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],\n+\t\t\t rem_qm_desc) {\n+\t\tqm_req_desc = \u0026qm_req.qm_req_desc[qm_req.num_qm_desc];\n+\t\tret = nl80211_parse_qm_desc(tb_qm_desc, qm_req_desc,\n+\t\t\t\t\t qm_req.qm_type);\n+\t\tif (ret) {\n+\t\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t\t \"QoS Management descriptor parsing failed\");\n+\t\t\tgoto free_qm;\n+\t\t}\n+\t\tqm_req.num_qm_desc++;\n+\t}\n+\n+\tif (qm_req.qm_type == NL80211_QM_TYPE_MSCS \u0026\u0026 qm_req.num_qm_desc != 1) {\n+\t\tGENL_SET_ERR_MSG(info,\n+\t\t\t\t \"MSCS request must contain exactly one descriptor\");\n+\t\tret = -EINVAL;\n+\t\tgoto free_qm;\n+\t}\n+\n+\tqm_resp.qm_resp_desc = kzalloc_objs(*qm_resp.qm_resp_desc,\n+\t\t\t\t\t qm_req.num_qm_desc, GFP_KERNEL);\n+\tif (!qm_resp.qm_resp_desc) {\n+\t\tret = -ENOMEM;\n+\t\tgoto free_qm;\n+\t}\n+\n+\tfor (idx = 0; idx \u003c qm_req.num_qm_desc; idx++) {\n+\t\tqm_resp.qm_resp_desc[idx].qm_id =\n+\t\t\tqm_req.qm_req_desc[idx].qm_id;\n+\t\tqm_resp.qm_resp_desc[idx].status = NL80211_QM_STATUS_DECLINED;\n+\t}\n+\n+\tret = rdev_set_qos_mgmt_cfg(rdev, dev, \u0026qm_req, \u0026qm_resp);\n+\tif (ret) {\n+\t\tGENL_SET_ERR_MSG(info, \"set_qos_mgmt_cfg failed\");\n+\t\tgoto free_qm;\n+\t}\n+\n+\tret = nl80211_qm_send_resp(info, \u0026qm_req, \u0026qm_resp);\n+\n+free_qm:\n+\tkfree(qm_resp.qm_resp_desc);\n+\tnl80211_free_qm_req(\u0026qm_req);\n+\treturn ret;\n+}\n+\n static const struct genl_small_ops nl80211_small_ops[] = {\n \t{\n \t\t.cmd = NL80211_CMD_SET_WIPHY,\n@@ -21350,6 +22074,12 @@ static const struct genl_small_ops nl80211_small_ops[] = {\n \t\t.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |\n \t\t\t\t\t NL80211_FLAG_NO_WIPHY_MTX),\n \t},\n+\t{\n+\t\t.cmd = NL80211_CMD_QOS_MGMT,\n+\t\t.doit = nl80211_qos_mgmt_cfg,\n+\t\t.flags = GENL_UNS_ADMIN_PERM,\n+\t\t.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),\n+\t},\n };\n \n static struct genl_family nl80211_fam __ro_after_init = {\ndiff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h\nindex ae15cec9bf8b7..16698af390207 100644\n--- a/net/wireless/rdev-ops.h\n+++ b/net/wireless/rdev-ops.h\n@@ -1707,4 +1707,21 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,\n \treturn ret;\n }\n \n+static inline int\n+rdev_set_qos_mgmt_cfg(struct cfg80211_registered_device *rdev,\n+\t\t struct net_device *dev,\n+\t\t struct cfg80211_qm_req_data *qm_req,\n+\t\t struct cfg80211_qm_resp_data *qm_resp)\n+{\n+\tstruct wiphy *wiphy = \u0026rdev-\u003ewiphy;\n+\tint ret = -EOPNOTSUPP;\n+\n+\ttrace_rdev_set_qos_mgmt_cfg(wiphy, dev, qm_req);\n+\tif (rdev-\u003eops-\u003eset_qos_mgmt_cfg)\n+\t\tret = rdev-\u003eops-\u003eset_qos_mgmt_cfg(wiphy, dev, qm_req, qm_resp);\n+\ttrace_rdev_return_int(wiphy, ret);\n+\n+\treturn ret;\n+}\n+\n #endif /* __CFG80211_RDEV_OPS */\ndiff --git a/net/wireless/trace.h b/net/wireless/trace.h\nindex 31000ffebe436..83bd63e1c7e26 100644\n--- a/net/wireless/trace.h\n+++ b/net/wireless/trace.h\n@@ -3281,6 +3281,26 @@ TRACE_EVENT(rdev_set_epcs,\n \t\t WIPHY_PR_ARG, NETDEV_PR_ARG, __entry-\u003eval)\n );\n \n+TRACE_EVENT(rdev_set_qos_mgmt_cfg,\n+\t TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,\n+\t\t struct cfg80211_qm_req_data *qm_req),\n+\t TP_ARGS(wiphy, netdev, qm_req),\n+\t TP_STRUCT__entry(WIPHY_ENTRY\n+\t\t\t NETDEV_ENTRY\n+\t\t\t __field(u8, qm_type)\n+\t\t\t __field(unsigned int, num_qm_desc)\n+\t),\n+\t TP_fast_assign(WIPHY_ASSIGN;\n+\t\t\t NETDEV_ASSIGN;\n+\t\t\t __entry-\u003eqm_type = qm_req-\u003eqm_type;\n+\t\t\t __entry-\u003enum_qm_desc = qm_req-\u003enum_qm_desc;\n+\t),\n+\t TP_printk(WIPHY_PR_FMT \", \" NETDEV_PR_FMT\n+\t\t \", qm_type=%u num_qm_desc=%u\",\n+\t\t WIPHY_PR_ARG, NETDEV_PR_ARG, __entry-\u003eqm_type,\n+\t\t __entry-\u003enum_qm_desc)\n+);\n+\n /*************************************************************\n *\t cfg80211 exported functions traces\t\t *\n *************************************************************/\n"
} |
| 2/1 | 2026/10/15 07:06 | agent | patch-evaluator |
2mModel:core Args: null Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"WIRELESS"
],
"FocusSymbols": [
"nl80211_qos_mgmt_cfg",
"nl80211_parse_qm_desc",
"nl80211_parse_qm_tclas",
"nl80211_parse_qm_qos_attr",
"ieee80211_set_qos_mgmt_cfg",
"ieee80211_qos_mgmt_cfg",
"ieee80211_qos_mgmt_update_scs",
"ieee80211_qos_mgmt_update_mscs",
"ieee80211_qos_mgmt_mscs_set_mark",
"ieee80211_qos_mgmt_set_priority"
],
"Reasoning": "The patch introduces a new Netlink command NL80211_CMD_QOS_MGMT and support for QoS Management (SCS and MSCS) across cfg80211 and mac80211. It adds complex nested Netlink attribute parsers, dynamic memory allocations, RCU-managed per-station QoS state updates, and hooks in both RX and TX data paths. This code is reachable from userspace in standard QEMU virtualized environments via mac80211_hwsim and warrants 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 76cb85b08d3003181c80b3ef3091595db6ef5519
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 15 07:06:58 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 66f9ebe79c618..f235059cbebd4 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1821,6 +1821,7 @@ enum ieee80211_eid_ext {
WLAN_EID_EXT_SHORT_SSID_LIST = 58,
WLAN_EID_EXT_HE_6GHZ_CAPA = 59,
WLAN_EID_EXT_UL_MU_POWER_CAPA = 60,
+ WLAN_EID_EXT_MSCS_DESCRIPTOR = 88,
WLAN_EID_EXT_EHT_OPERATION = 106,
WLAN_EID_EXT_EHT_MULTI_LINK = 107,
WLAN_EID_EXT_EHT_CAPABILITY = 108,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f773856c18181..74abe25bb107a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4860,6 +4860,216 @@ struct cfg80211_update_owe_info {
u8 peer_mld_addr[ETH_ALEN] __aligned(2);
};
+/* QoS Management IP address lengths */
+#define QM_IPV4_LEN 4
+#define QM_IPV6_LEN 16
+
+/**
+ * enum cfg80211_qm_ip_version - IP protocol version identifiers used in
+ * QoS Management traffic classification
+ * @QM_IP_VERSION_4: Internet Protocol version 4 (IPv4)
+ * @QM_IP_VERSION_6: Internet Protocol version 6 (IPv6)
+ */
+enum cfg80211_qm_ip_version {
+ QM_IP_VERSION_4 = 4,
+ QM_IP_VERSION_6 = 6,
+};
+
+/**
+ * struct cfg80211_qm_tclas4_params - TCLAS classifier type 4 parameters
+ * @classifier_mask: bitmask indicating which fields are used for
+ * classification; the version bit is mandatory and the remaining bits
+ * identify fields used for classification, as defined by
+ * &enum nl80211_qm_tclas_type4_mask
+ * @ip_ver: IP version of @src_ip / @dst_ip
+ * @src_ip: source IP address (IPv4 or IPv6)
+ * @dst_ip: destination IP address (IPv4 or IPv6)
+ * @src_port: source port number
+ * @dst_port: destination port number
+ * @dscp: Differentiated Services Code Point
+ * @protocol: IP protocol number, valid for IPv4 only
+ * @next_header: next header field, valid for IPv6 only
+ * @flow_label: flow label, valid for IPv6 only
+ */
+struct cfg80211_qm_tclas4_params {
+ u8 classifier_mask;
+ enum cfg80211_qm_ip_version ip_ver;
+ union {
+ u8 ipv4[QM_IPV4_LEN];
+ u8 ipv6[QM_IPV6_LEN];
+ } src_ip;
+ union {
+ u8 ipv4[QM_IPV4_LEN];
+ u8 ipv6[QM_IPV6_LEN];
+ } dst_ip;
+ u16 src_port;
+ u16 dst_port;
+ u8 dscp;
+ u8 protocol;
+ u8 next_header;
+ u8 flow_label[NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN];
+};
+
+/**
+ * struct cfg80211_qm_tclas10_params - TCLAS classifier type 10 parameters
+ * @protocol_instance: protocol instance identifier
+ * @protocol_number: protocol number
+ * @filter_value: filter value bytes
+ * @filter_mask: filter mask bytes
+ * @filter_len: length of @filter_value / @filter_mask
+ */
+struct cfg80211_qm_tclas10_params {
+ u8 protocol_instance;
+ u8 protocol_number;
+ u8 filter_value[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];
+ u8 filter_mask[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];
+ u8 filter_len;
+};
+
+/**
+ * struct cfg80211_qm_tclas_elements - a single TCLAS element
+ * @up: user priority
+ * @classifier_type: classifier type, see
+ * &enum nl80211_qm_tclas_classifier_type
+ * @tclas_elem: classifier-specific parameters
+ */
+struct cfg80211_qm_tclas_elements {
+ u8 up;
+ enum nl80211_qm_tclas_classifier_type classifier_type;
+ union {
+ struct cfg80211_qm_tclas4_params type4_params;
+ struct cfg80211_qm_tclas10_params type10_params;
+ } tclas_elem;
+};
+
+/**
+ * struct cfg80211_qm_qos_attributes - QoS attributes of a QoS Management
+ * request
+ * @direction: traffic direction, see &enum nl80211_qm_direction
+ * @tid: traffic identifier
+ * @up: user priority
+ * @bitmap: TID/UP bitmap
+ * @link_id: link identifier
+ * @min_service_interval: minimum service interval, in microseconds
+ * @max_service_interval: maximum service interval, in microseconds
+ * @min_data_rate: minimum data rate, in kbps
+ * @delay_bound: delay bound, in microseconds
+ * @max_msdu_size: maximum MSDU size, in bytes
+ * @service_start_time: service start time, in microseconds
+ * @service_start_time_link_id: link ID for @service_start_time
+ * @mean_data_rate: mean data rate, in kbps
+ * @burst_size: burst size, in bytes
+ * @msdu_lifetime: MSDU lifetime, in milliseconds
+ * @msdu_delivery_ratio: MSDU delivery ratio
+ * @msdu_count_exponent: MSDU count exponent
+ * @medium_time: medium time, in units of 32 microseconds
+ */
+struct cfg80211_qm_qos_attributes {
+ enum nl80211_qm_direction direction;
+ u8 tid;
+ u8 up;
+ u16 bitmap;
+ u8 link_id;
+ u32 min_service_interval;
+ u32 max_service_interval;
+ u32 min_data_rate;
+ u32 delay_bound;
+ u16 max_msdu_size;
+ u32 service_start_time;
+ u8 service_start_time_link_id;
+ u32 mean_data_rate;
+ u32 burst_size;
+ u16 msdu_lifetime;
+ u8 msdu_delivery_ratio;
+ u8 msdu_count_exponent;
+ u16 medium_time;
+};
+
+/**
+ * struct cfg80211_qm_req_desc_data - a single QoS Management request
+ * descriptor
+ * @qm_id: identifier for this descriptor within the request
+ * @request_type: request type, see &enum nl80211_qm_req_type
+ * @priority: SCS descriptor priority
+ * @num_tclas_elements: number of entries in @tclas
+ * @tclas: SCS TCLAS elements used for traffic classification
+ * @tclas_processing: SCS TCLAS processing rule, see
+ * &enum nl80211_qm_tclas_processing
+ * @is_qos_present: whether @qos_attr is populated
+ * @qos_attr: SCS QoS attributes associated with this descriptor
+ * @user_priority_bitmap: user priority bitmap of TID values sent by the
+ * non-AP STA in an MSCS request
+ * @user_priority_limit: user priority limit sent by the non-AP STA in an
+ * MSCS request
+ * @tclas_mask: traffic classifier mask with a bitmap of parameters to
+ * match in an uplink flow for downlink prioritization
+ */
+struct cfg80211_qm_req_desc_data {
+ u8 qm_id;
+ enum nl80211_qm_req_type request_type;
+ u8 priority;
+ unsigned int num_tclas_elements;
+ struct cfg80211_qm_tclas_elements *tclas;
+ enum nl80211_qm_tclas_processing tclas_processing;
+ bool is_qos_present;
+ struct cfg80211_qm_qos_attributes qos_attr;
+ u8 user_priority_bitmap;
+ u8 user_priority_limit;
+ u8 tclas_mask;
+};
+
+/**
+ * struct cfg80211_qm_req_data - a complete QoS Management request for a
+ * peer
+ * @peer_mac: MAC address of the peer
+ * @qm_type: QoS Management protocol, see &enum nl80211_qm_type
+ * @num_qm_desc: number of entries in @qm_req_desc
+ * @qm_req_desc: QoS Management request descriptors
+ *
+ * This is the parsed representation passed to the driver by the
+ * &struct cfg80211_ops.set_qos_mgmt_cfg callback. The descriptor and TCLAS
+ * arrays are owned by cfg80211 and are valid only for the duration of the
+ * callback. The driver must not retain these pointers after the callback
+ * returns.
+ */
+struct cfg80211_qm_req_data {
+ u8 peer_mac[ETH_ALEN];
+ enum nl80211_qm_type qm_type;
+ unsigned int num_qm_desc;
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+};
+
+/**
+ * struct cfg80211_qm_resp_desc_data - result of processing a single QoS
+ * Management request descriptor
+ * @qm_id: identifier matching the corresponding request descriptor
+ * @status: response status, see &enum nl80211_qm_status
+ */
+struct cfg80211_qm_resp_desc_data {
+ u8 qm_id;
+ enum nl80211_qm_status status;
+};
+
+/**
+ * struct cfg80211_qm_resp_data - a complete QoS Management response
+ * @qm_resp_desc: response descriptors corresponding to the request
+ *
+ * cfg80211 allocates and initializes one response descriptor for each
+ * request descriptor with the corresponding
+ * &struct cfg80211_qm_req_desc_data.qm_id and a declined status.
+ * The driver updates the status for each descriptor it processes. The
+ * response array is parallel to the request descriptor array: entry @i
+ * corresponds to request descriptor @i, and the driver must update entries
+ * in place without reordering them. The initialized @qm_id values must be
+ * left unchanged. The response array is valid only for the duration of the
+ * callback and must not be retained by the driver.
+ * cfg80211/nl80211 supplies the peer address and protocol type from the
+ * request when it builds the reply.
+ */
+struct cfg80211_qm_resp_data {
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc;
+};
+
/**
* struct mgmt_frame_regs - management frame registrations data
* @global_stypes: bitmap of management frame subtypes registered
@@ -5332,6 +5542,13 @@ struct mgmt_frame_regs {
*
* @start_pd: Start the PD interface.
* @stop_pd: Stop the PD interface.
+ *
+ * @set_qos_mgmt_cfg: Configure QoS Management (QM) parameters such as
+ * traffic classification (TCLAS) and QoS attributes for a station. The
+ * request has already been parsed from the nested nl80211 attributes.
+ * The driver or firmware applies the protocol-specific configuration and
+ * populates the response structure with a status for each descriptor.
+ * This callback provides the control-path interface for the driver.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5730,6 +5947,9 @@ struct cfg80211_ops {
bool val);
int (*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
void (*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
+ int (*set_qos_mgmt_cfg)(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
};
/*
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a1a6409b44c12..a610d6eb92b4e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4760,6 +4760,9 @@ struct ieee80211_prep_tx_info {
* @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
* driver according to the parameter received in the EML Operating mode
* notification frame.
+ * @qos_mgmt_cfg: Configure QoS Management (QM) for a station. The request
+ * contains SCS or MSCS parameters, and the driver populates the
+ * per-descriptor response status.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5173,6 +5176,10 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_eml_params *eml_params);
+ int (*qos_mgmt_cfg)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b56a96f57bec2..4106fe6629454 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1468,6 +1468,10 @@
* and multiple can be nested in %NL80211_ATTR_MLO_LINKS but then the
* update isn't atomic if any failures happen.
* Only supported with %NL80211_EXT_FEATURE_UPDATE_BEACON.
+ * @NL80211_CMD_QOS_MGMT: QoS Management configuration for a station. Used
+ * by userspace to send QoS Management (QM) requests and to receive the
+ * corresponding status response via %NL80211_ATTR_QOS_MGMT.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1750,6 +1754,8 @@ enum nl80211_commands {
NL80211_CMD_UPDATE_BEACON,
+ NL80211_CMD_QOS_MGMT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3243,6 +3249,13 @@ enum nl80211_commands {
* @NL80211_ATTR_ASSOC_PROTECTED_TWT: Enable protected TWT for the association,
* requires protected TWT support (flag attribute)
*
+ * @NL80211_ATTR_QOS_MGMT: Used with %NL80211_CMD_QOS_MGMT to configure
+ * QoS Management (QM) features for a station. The nested payload is
+ * described by &enum nl80211_qm_attrs. It contains a nested array of
+ * &enum nl80211_qm_desc_attrs entries; SCS TCLAS and QoS attributes use
+ * &enum nl80211_qm_tclas_attrs and &enum nl80211_qm_qos_attrs,
+ * respectively.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3850,6 +3863,8 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_PROTECTED_TWT,
+ NL80211_ATTR_QOS_MGMT,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -9200,4 +9215,333 @@ enum nl80211_nan_peer_map_attrs {
#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff
+#define NL80211_IPADDR_MAX_LEN 16
+#define NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN 12
+#define NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN 3
+
+/*
+ * The TCLAS element (reference 9.4.2.29, IEEE Std 802.11-2024) is used by
+ * SCS for traffic classification.
+ */
+/**
+ * enum nl80211_qm_tclas_type4_attrs - TCLAS classifier type 4 attributes
+ *
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK: Classifier mask (u8), see
+ * &enum nl80211_qm_tclas_type4_mask
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION: IP version, 4 or 6 (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP: Source IP address
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP: Destination IP address
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT: Source port (u16)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT: Destination port (u16)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DSCP: DSCP value, 0-63 (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL: IP protocol number, IPv4 only (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER: Next header, IPv6 only (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL: Flow label, IPv6 only
+ * @__NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_MAX: highest type 4 attribute number currently
+ * defined
+ */
+enum nl80211_qm_tclas_type4_attrs {
+ NL80211_QM_TCLAS_TYPE4_ATTR_INVALID,
+ NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK,
+ NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION,
+ NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DSCP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL,
+ NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER,
+ NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_TYPE4_ATTR_MAX =
+ __NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_type10_attrs - TCLAS classifier type 10 attributes
+ *
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE: Protocol instance (u8)
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER: Protocol number (u8)
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE: Filter value bytes
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK: Filter mask bytes
+ * @__NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_MAX: highest type 10 attribute number currently
+ * defined
+ */
+enum nl80211_qm_tclas_type10_attrs {
+ NL80211_QM_TCLAS_TYPE10_ATTR_INVALID,
+ NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE,
+ NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER,
+ NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE,
+ NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_TYPE10_ATTR_MAX =
+ __NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_attrs - TCLAS element attributes
+ *
+ * @NL80211_QM_TCLAS_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_ATTR_USER_PRIORITY: User priority, 0-7 (u8)
+ * @NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE: Classifier type, 4 or 10 (u8)
+ * @NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS: Nested type 4 classifier params, see
+ * &enum nl80211_qm_tclas_type4_attrs
+ * @NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS: Nested type 10 classifier params, see
+ * &enum nl80211_qm_tclas_type10_attrs
+ * @__NL80211_QM_TCLAS_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_ATTR_MAX: highest TCLAS attribute number currently defined
+ */
+enum nl80211_qm_tclas_attrs {
+ NL80211_QM_TCLAS_ATTR_INVALID,
+ NL80211_QM_TCLAS_ATTR_USER_PRIORITY,
+ NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE,
+ NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS,
+ NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_ATTR_MAX = __NL80211_QM_TCLAS_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_classifier_type - TCLAS classifier type values sent
+ * in %NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE
+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE4: Classifier type 4, 5-tuple based;
+ * reference 9.4.2.29, IEEE Std 802.11-2024.
+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE10: Classifier type 10, filter based;
+ * reference 9.4.2.29, IEEE Std 802.11-2024.
+ *
+ * The SCS interface currently supports only classifier types 4 and 10.
+ */
+enum nl80211_qm_tclas_classifier_type {
+ NL80211_QM_TCLAS_CLASSIFIER_TYPE4 = 4,
+ NL80211_QM_TCLAS_CLASSIFIER_TYPE10 = 10,
+};
+
+/**
+ * enum nl80211_qm_tclas_type4_mask - classifier mask bits for TCLAS type 4
+ * @NL80211_QM_TCLAS_TYPE4_MASK_VERSION: IP version field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_IP: source IP address
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_IP: destination IP address
+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT: source port
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_PORT: destination port
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DSCP: DSCP field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL: protocol / next-header field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL: IPv6 flow label
+ */
+enum nl80211_qm_tclas_type4_mask {
+ NL80211_QM_TCLAS_TYPE4_MASK_VERSION = 1 << 0,
+ NL80211_QM_TCLAS_TYPE4_MASK_SRC_IP = 1 << 1,
+ NL80211_QM_TCLAS_TYPE4_MASK_DST_IP = 1 << 2,
+ NL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT = 1 << 3,
+ NL80211_QM_TCLAS_TYPE4_MASK_DST_PORT = 1 << 4,
+ NL80211_QM_TCLAS_TYPE4_MASK_DSCP = 1 << 5,
+ NL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL = 1 << 6,
+ NL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL = 1 << 7,
+};
+
+/**
+ * enum nl80211_qm_tclas_processing - TCLAS processing rules
+ *
+ * Processing field values are defined in 9.4.2.31, IEEE Std 802.11-2024.
+ *
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL: all TCLAS elements must match
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ANY: any TCLAS element may match
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST: all except the first
+ * must match
+ */
+enum nl80211_qm_tclas_processing {
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL = 0,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ANY = 1,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST = 2,
+};
+
+/**
+ * enum nl80211_qm_qos_attrs - QoS Management QoS attributes
+ *
+ * The QoS Characteristics element is specified in 9.4.2.326,
+ * IEEE Std 802.11be-2024.
+ *
+ * @NL80211_QM_QOS_ATTR_INVALID: Invalid
+ * @NL80211_QM_QOS_ATTR_CONTROL_INFO: QoS characteristics control info (u32)
+ * @NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL: Minimum service interval, us (u32)
+ * @NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL: Maximum service interval, us (u32)
+ * @NL80211_QM_QOS_ATTR_MIN_DATA_RATE: Minimum data rate, kbps (u32)
+ * @NL80211_QM_QOS_ATTR_DELAY_BOUND: Delay bound, us (u32)
+ * @NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE: Maximum MSDU size, bytes (u16)
+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME: Service start time, us (u32)
+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID: Link ID for service start
+ * time (u8)
+ * @NL80211_QM_QOS_ATTR_MEAN_DATA_RATE: Mean data rate, kbps (u32)
+ * @NL80211_QM_QOS_ATTR_BURST_SIZE: Burst size, bytes (u32)
+ * @NL80211_QM_QOS_ATTR_MSDU_LIFETIME: MSDU lifetime, ms (u16)
+ * @NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO: MSDU delivery ratio and count
+ * exponent (u8)
+ * @NL80211_QM_QOS_ATTR_MEDIUM_TIME: Medium time, 32 us units (u16)
+ * @__NL80211_QM_QOS_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_QOS_ATTR_MAX: highest QoS attribute number currently defined
+ */
+enum nl80211_qm_qos_attrs {
+ NL80211_QM_QOS_ATTR_INVALID,
+ NL80211_QM_QOS_ATTR_CONTROL_INFO,
+ NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL,
+ NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL,
+ NL80211_QM_QOS_ATTR_MIN_DATA_RATE,
+ NL80211_QM_QOS_ATTR_DELAY_BOUND,
+ NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE,
+ NL80211_QM_QOS_ATTR_SVC_START_TIME,
+ NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID,
+ NL80211_QM_QOS_ATTR_MEAN_DATA_RATE,
+ NL80211_QM_QOS_ATTR_BURST_SIZE,
+ NL80211_QM_QOS_ATTR_MSDU_LIFETIME,
+ NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO,
+ NL80211_QM_QOS_ATTR_MEDIUM_TIME,
+
+ /* keep last */
+ __NL80211_QM_QOS_ATTR_AFTER_LAST,
+ NL80211_QM_QOS_ATTR_MAX = __NL80211_QM_QOS_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_desc_attrs - QoS Management descriptor attributes
+ *
+ * @NL80211_QM_DESC_ATTR_INVALID: Invalid
+ * @NL80211_QM_DESC_ATTR_QM_ID: Userspace-assigned identifier (u8) used
+ * to correlate a request descriptor with its response descriptor
+ * @NL80211_QM_DESC_ATTR_REQUEST_TYPE: Request type, see
+ * &enum nl80211_qm_req_type (u8)
+ * @NL80211_QM_DESC_ATTR_PRIORITY: SCS descriptor priority (u8)
+ * @NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS: Nested array of SCS TCLAS elements,
+ * see &enum nl80211_qm_tclas_attrs
+ * @NL80211_QM_DESC_ATTR_TCLAS_PROCESSING: SCS TCLAS processing rule (u8),
+ * see &enum nl80211_qm_tclas_processing
+ * @NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES: Nested SCS QoS attributes, see
+ * &enum nl80211_qm_qos_attrs
+ * @NL80211_QM_DESC_ATTR_STATUS: Response status for this descriptor (u8),
+ * see &enum nl80211_qm_status
+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP: MSCS user priority bitmap of
+ * TID values sent by the non-AP STA (u8)
+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT: MSCS user priority limit sent
+ * by the non-AP STA (u8)
+ * @NL80211_QM_DESC_ATTR_TCLAS_MASK: MSCS traffic classifier mask with a
+ * bitmap of parameters to match in an uplink flow for downlink
+ * prioritization (u8)
+ * @__NL80211_QM_DESC_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_DESC_ATTR_MAX: highest QoS Management descriptor attribute
+ * number currently defined
+ */
+enum nl80211_qm_desc_attrs {
+ NL80211_QM_DESC_ATTR_INVALID,
+ NL80211_QM_DESC_ATTR_QM_ID,
+ NL80211_QM_DESC_ATTR_REQUEST_TYPE,
+ NL80211_QM_DESC_ATTR_PRIORITY,
+ NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS,
+ NL80211_QM_DESC_ATTR_TCLAS_PROCESSING,
+ NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES,
+ NL80211_QM_DESC_ATTR_STATUS,
+ NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP,
+ NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT,
+ NL80211_QM_DESC_ATTR_TCLAS_MASK,
+
+ /* keep last */
+ __NL80211_QM_DESC_ATTR_AFTER_LAST,
+ NL80211_QM_DESC_ATTR_MAX = __NL80211_QM_DESC_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_attrs - QoS Management attributes
+ *
+ * @NL80211_QM_ATTR_INVALID: Invalid
+ * @NL80211_QM_ATTR_MAC_ADDR: Target station MAC address (6 bytes)
+ * @NL80211_QM_ATTR_QM_TYPE: QoS Management protocol type, see
+ * &enum nl80211_qm_type (u8)
+ * @NL80211_QM_ATTR_DESCRIPTOR_PARAMS: Nested array of QM descriptors, see
+ * &enum nl80211_qm_desc_attrs
+ * @__NL80211_QM_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_ATTR_MAX: highest QoS Management attribute number currently
+ * defined
+ */
+enum nl80211_qm_attrs {
+ NL80211_QM_ATTR_INVALID,
+ NL80211_QM_ATTR_MAC_ADDR,
+ NL80211_QM_ATTR_QM_TYPE,
+ NL80211_QM_ATTR_DESCRIPTOR_PARAMS,
+
+ /* keep last */
+ __NL80211_QM_ATTR_AFTER_LAST,
+ NL80211_QM_ATTR_MAX = __NL80211_QM_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_type - QoS Management protocol types
+ * @NL80211_QM_TYPE_SCS: Stream Classification Service (SCS) protocol,
+ * reference 11.25.2, IEEE Std 802.11-2024.
+ * @NL80211_QM_TYPE_MSCS: Mirrored Stream Classification Service (MSCS)
+ * protocol, reference 11.25.3, IEEE Std 802.11-2024.
+ * @NL80211_QM_TYPE_MAX: Maximum value for QoS Management protocol types
+ *
+ * Enumerates the QoS Management protocols supported through the generic
+ * QoS Management (QM) request/response framework.
+ *
+ */
+enum nl80211_qm_type {
+ NL80211_QM_TYPE_SCS,
+ NL80211_QM_TYPE_MSCS,
+ /* Future QM protocols to be added here */
+ NL80211_QM_TYPE_MAX,
+};
+
+/**
+ * enum nl80211_qm_direction - QoS Management descriptor
+ * traffic direction
+ * @NL80211_QM_DIRECTION_UPLINK: Traffic direction is uplink, from the
+ * non-AP STA to the AP.
+ * @NL80211_QM_DIRECTION_DOWNLINK: Traffic direction is downlink, from
+ * the AP to the non-AP STA.
+ * @NL80211_QM_DIRECTION_DIRECT: Direct link traffic between STAs (P2P).
+ *
+ * Encodes the QoS characteristics element direction subfield, denoting
+ * which traffic direction a set of QoS attributes applies to. The QoS
+ * Characteristics element is specified in 9.4.2.326, IEEE Std 802.11be-2024.
+ */
+enum nl80211_qm_direction {
+ NL80211_QM_DIRECTION_UPLINK = 0,
+ NL80211_QM_DIRECTION_DOWNLINK = 1,
+ NL80211_QM_DIRECTION_DIRECT = 2,
+};
+
+/**
+ * enum nl80211_qm_req_type - QoS Management request types
+ * @NL80211_QM_ADD_REQ: Add a new QoS Management configuration
+ * @NL80211_QM_REMOVE_REQ: Remove an existing QoS Management configuration
+ * @NL80211_QM_CHANGE_REQ: Modify an existing QoS Management configuration
+ *
+ * Identifies the operation requested in a QoS Management transaction.
+ * Reference 11.25.2 and 11.25.3, IEEE Std 802.11-2024, for the operation
+ * values.
+ */
+enum nl80211_qm_req_type {
+ NL80211_QM_ADD_REQ,
+ NL80211_QM_REMOVE_REQ,
+ NL80211_QM_CHANGE_REQ,
+};
+
+/**
+ * enum nl80211_qm_status - QoS Management response status codes
+ * @NL80211_QM_STATUS_SUCCESS: request accepted
+ * @NL80211_QM_STATUS_DECLINED: request declined
+ */
+enum nl80211_qm_status {
+ NL80211_QM_STATUS_SUCCESS = 0,
+ NL80211_QM_STATUS_DECLINED = 1,
+};
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9608c07bcea7d..f66f736adb922 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -6309,6 +6309,18 @@ ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy,
return ieee80211_nan_set_non_evac_channels(sdata, channels);
}
+static int
+ieee80211_set_qos_mgmt_cfg(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ lockdep_assert_wiphy(wiphy);
+
+ return ieee80211_qos_mgmt_cfg(sdata, qm_req, qm_resp);
+}
+
const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -6432,4 +6444,5 @@ const struct cfg80211_ops mac80211_config_ops = {
.nan_set_local_sched = ieee80211_set_local_nan_sched,
.nan_set_peer_sched = ieee80211_set_peer_nan_sched,
.nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels,
+ .set_qos_mgmt_cfg = ieee80211_set_qos_mgmt_cfg,
};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 83dd15f2daf62..f1dc9ca9f8f70 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1804,4 +1804,32 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,
return ret;
}
+static inline int
+drv_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_local *local, struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return ret;
+
+ /*
+ * Called only for SCS descriptors carrying a QoS Characteristics
+ * element (9.4.2.326, IEEE Std 802.11be-2024). Legacy SCS and MSCS
+ * are handled in mac80211.
+ */
+ trace_drv_qos_mgmt_cfg(local, sdata, sta, qm_req);
+ if (local->ops->qos_mgmt_cfg)
+ ret = local->ops->qos_mgmt_cfg(&local->hw, &sdata->vif,
+ sta, qm_req, qm_resp);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1a6cbbb5a17d8..aa36289b3ae4e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -80,6 +80,20 @@ struct ieee80211_mesh_fast_tx;
#define IEEE80211_DEFAULT_MAX_SP_LEN \
IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
+/*
+ * TODO: Synchronize this skb->mark encoding with the userspace application
+ * (hostapd). These values reuse IEEE element IDs, but their use in skb->mark
+ * is an implementation contract between hostapd/nftables and mac80211.
+ */
+/* skb->mark bits [7:0] carry a QoS Management protocol tag. The values
+ * match the IEEE Std 802.11-2024 element IDs for the respective descriptors:
+ * WLAN_EID_SCS_DESCRIPTOR (185) and WLAN_EID_EXT_MSCS_DESCRIPTOR (88).
+ */
+#define IEEE80211_QOS_MGMT_TAG_MASK GENMASK(7, 0)
+#define IEEE80211_QOS_MGMT_SCS_TAG WLAN_EID_SCS_DESCRIPTOR
+#define IEEE80211_QOS_MGMT_MSCS_TAG WLAN_EID_EXT_MSCS_DESCRIPTOR
+#define IEEE80211_QOS_MGMT_ID_MASK GENMASK(15, 8)
+
extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
@@ -3020,6 +3034,10 @@ ieee80211_uhr_cap_ie_to_sta_uhr_cap(struct ieee80211_sub_if_data *sdata,
u8 uhr_cap_len,
struct link_sta_info *link_sta);
+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
+
#if IS_ENABLED(CONFIG_MAC80211_KUNIT_TEST)
#define EXPORT_SYMBOL_IF_MAC80211_KUNIT(sym) EXPORT_SYMBOL_IF_KUNIT(sym)
#define VISIBLE_IF_MAC80211_KUNIT
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6ec45a9f72214..2d853cd1c18aa 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -12036,3 +12036,168 @@ void ieee80211_sta_rx_queued_frame(struct ieee80211_sub_if_data *sdata,
break;
}
}
+
+static void
+ieee80211_qos_mgmt_update_scs(struct ieee80211_sta_qos *qos,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ u8 tid;
+ int i;
+
+ if (qm_req->qm_type != NL80211_QM_TYPE_SCS)
+ return;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++) {
+ struct cfg80211_qm_req_desc_data *qm_req_desc =
+ &qm_req->qm_req_desc[i];
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc =
+ &qm_resp->qm_resp_desc[i];
+
+ if (qm_resp_desc->qm_id != qm_req_desc->qm_id ||
+ qm_resp_desc->status != NL80211_QM_STATUS_SUCCESS)
+ continue;
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_REMOVE_REQ:
+ clear_bit(qm_req_desc->qm_id, qos->active_scs_id);
+ break;
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ /*
+ * For legacy SCS the TID is derived from the UP
+ * field of the first TCLAS element (11.25.2, IEEE
+ * Std 802.11-2024). For 802.11be SCS the TID is
+ * taken from the QoS
+ * Characteristics element (9.4.2.326, IEEE Std
+ * 802.11be-2024).
+ */
+ if (qm_req_desc->is_qos_present)
+ tid = qm_req_desc->qos_attr.tid;
+ else if (qm_req_desc->num_tclas_elements > 0)
+ tid = qm_req_desc->tclas[0].up;
+ else
+ continue;
+
+ if (tid >= IEEE80211_QOS_MGMT_MAX_TID)
+ continue;
+
+ qos->scs_id_tid_mapping[qm_req_desc->qm_id] = tid;
+ set_bit(qm_req_desc->qm_id, qos->active_scs_id);
+ break;
+ default:
+ break;
+ }
+ }
+
+ qos->scs_enabled =
+ !bitmap_empty(qos->active_scs_id,
+ IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);
+}
+
+static void
+ieee80211_qos_mgmt_update_mscs(struct ieee80211_sta_qos *qos,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc;
+
+ qm_req_desc = &qm_req->qm_req_desc[0];
+ qm_resp_desc = &qm_resp->qm_resp_desc[0];
+
+ if (qm_resp_desc->qm_id != qm_req_desc->qm_id ||
+ qm_resp_desc->status != NL80211_QM_STATUS_SUCCESS)
+ return;
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ qos->mscs_user_priority_bitmap =
+ qm_req_desc->user_priority_bitmap;
+ qos->mscs_user_priority_limit =
+ qm_req_desc->user_priority_limit;
+ qos->mscs_enabled = true;
+ break;
+ case NL80211_QM_REMOVE_REQ:
+ qos->mscs_user_priority_bitmap = 0;
+ qos->mscs_user_priority_limit = 0;
+ qos->mscs_enabled = false;
+ break;
+ default:
+ break;
+ }
+}
+
+static bool
+ieee80211_qos_mgmt_has_qos_char(struct cfg80211_qm_req_data *qm_req)
+{
+ unsigned int i;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++) {
+ if (qm_req->qm_req_desc[i].is_qos_present)
+ return true;
+ }
+ return false;
+}
+
+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_sta_qos_rcu *new_qos = NULL;
+ struct ieee80211_sta_qos_rcu *old_qos;
+ struct sta_info *sta;
+ int ret;
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, qm_req->peer_mac);
+ if (!sta)
+ return -ENOENT;
+
+ if (qm_req->qm_type == NL80211_QM_TYPE_SCS ||
+ qm_req->qm_type == NL80211_QM_TYPE_MSCS) {
+ new_qos = kzalloc_obj(*new_qos);
+ if (!new_qos)
+ return -ENOMEM;
+
+ old_qos = rcu_dereference_protected(sta->qos,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (old_qos)
+ new_qos->data = old_qos->data;
+ }
+
+ /*
+ * SCS descriptors carrying a QoS Characteristics element
+ * (9.4.2.326, IEEE Std 802.11be-2024) require hardware-specific
+ * scheduling support; forward the request to the driver. Legacy
+ * SCS and MSCS are handled in mac80211.
+ */
+ if (ieee80211_qos_mgmt_has_qos_char(qm_req)) {
+ ret = drv_qos_mgmt_cfg(sdata, local, &sta->sta,
+ qm_req, qm_resp);
+ if (ret) {
+ kfree(new_qos);
+ return ret;
+ }
+ }
+
+ if (!new_qos)
+ return 0;
+
+ if (qm_req->qm_type == NL80211_QM_TYPE_SCS)
+ ieee80211_qos_mgmt_update_scs(&new_qos->data, qm_req,
+ qm_resp);
+ else
+ ieee80211_qos_mgmt_update_mscs(&new_qos->data, qm_req,
+ qm_resp);
+ old_qos = rcu_replace_pointer(sta->qos, new_qos,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (old_qos)
+ kfree_rcu(old_qos, rcu_head);
+
+ return 0;
+}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ecee9348c70d4..930de5b412c5d 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1003,6 +1003,31 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
rx->skb->priority = (tid > 7) ? 0 : tid;
}
+static void ieee80211_qos_mgmt_mscs_set_mark(struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_sta_qos_rcu *qos;
+ u8 tid;
+
+ if (!rx->sta ||
+ (rx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ rx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ rx->seqno_idx >= IEEE80211_QOS_MGMT_MAX_TID)
+ return;
+
+ tid = rx->skb->priority;
+
+ qos = rcu_dereference(rx->sta->qos);
+ if (!qos || !qos->data.mscs_enabled ||
+ !(BIT(tid) & qos->data.mscs_user_priority_bitmap))
+ return;
+
+ rx->skb->mark = u32_replace_bits(rx->skb->mark,
+ IEEE80211_QOS_MGMT_MSCS_TAG,
+ IEEE80211_QOS_MGMT_TAG_MASK);
+ rx->skb->mark = u32_replace_bits(rx->skb->mark, tid,
+ IEEE80211_QOS_MGMT_ID_MASK);
+}
+
/**
* DOC: Packet alignment
*
@@ -3333,6 +3358,9 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
rx->skb->dev = dev;
+ if (!port_control)
+ ieee80211_qos_mgmt_mscs_set_mark(rx);
+
if (!ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS) &&
local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 &&
!is_multicast_ether_addr(
@@ -4996,6 +5024,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
stats->packets++;
skb->dev = fast_rx->dev;
+ ieee80211_qos_mgmt_mscs_set_mark(rx);
dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 5c95ffee257d3..e714b719e2f1e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -467,8 +467,15 @@ static void sta_remove_link(struct sta_info *sta, unsigned int link_id,
*/
void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
{
+ struct ieee80211_sta_qos_rcu *qos;
int i;
+ lockdep_assert_wiphy(local->hw.wiphy);
+ qos = rcu_replace_pointer(sta->qos, NULL,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (qos)
+ kfree_rcu(qos, rcu_head);
+
for (i = 0; i < ARRAY_SIZE(sta->link); i++) {
struct link_sta_info *link_sta;
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 8942541375b27..68acd8fdc6718 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -16,10 +16,29 @@
#include <linux/average.h>
#include <linux/bitfield.h>
#include <linux/etherdevice.h>
+#include <linux/rcupdate.h>
#include <linux/rhashtable.h>
#include <linux/u64_stats_sync.h>
#include "key.h"
+/* SCS IDs are in the range 1-255; zero is reserved. */
+#define IEEE80211_QOS_MGMT_MAX_SCS_ID 255
+#define IEEE80211_QOS_MGMT_MAX_TID 8
+
+struct ieee80211_sta_qos {
+ bool scs_enabled;
+ bool mscs_enabled;
+ DECLARE_BITMAP(active_scs_id, IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);
+ u8 scs_id_tid_mapping[IEEE80211_QOS_MGMT_MAX_SCS_ID + 1];
+ u8 mscs_user_priority_bitmap;
+ u8 mscs_user_priority_limit;
+};
+
+struct ieee80211_sta_qos_rcu {
+ struct rcu_head rcu_head;
+ struct ieee80211_sta_qos data;
+};
+
/**
* enum ieee80211_sta_info_flags - Stations flags
*
@@ -657,6 +676,7 @@ struct ieee80211_sta_removed_link_stats {
* @rate_ctrl_priv: rate control private per-STA pointer
* @lock: used for locking all fields that require locking, see comments
* in the header file.
+ * @qos: RCU-published QoS Management state
* @drv_deliver_wk: used for delivering frames after driver PS unblocking
* @listen_interval: listen interval of this station, when we're acting as AP
* @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
@@ -728,6 +748,7 @@ struct sta_info {
void *rate_ctrl_priv;
spinlock_t rate_ctrl_lock;
spinlock_t lock;
+ struct ieee80211_sta_qos_rcu __rcu *qos;
struct ieee80211_fast_tx __rcu *fast_tx;
struct ieee80211_fast_rx __rcu *fast_rx;
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index ea46c3cca21a3..ce69e5edd03f0 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3431,6 +3431,30 @@ TRACE_EVENT(drv_nan_peer_sched_changed,
)
);
+TRACE_EVENT(drv_qos_mgmt_cfg,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req),
+ TP_ARGS(local, sdata, sta, qm_req),
+ TP_STRUCT__entry(LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, qm_type)
+ __field(unsigned int, num_qm_desc)
+ ),
+ TP_fast_assign(LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_NAMED_ASSIGN(sta);
+ __entry->qm_type = qm_req->qm_type;
+ __entry->num_qm_desc = qm_req->num_qm_desc;
+ ),
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ " qm_type:%u num_qm_desc:%u",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->qm_type, __entry->num_qm_desc)
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 1601be5764145..feca08f281856 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -113,6 +113,52 @@ static u16 ieee80211_downgrade_queue(struct ieee80211_sub_if_data *sdata,
return ieee802_1d_to_ac[skb->priority];
}
+static void
+ieee80211_qos_mgmt_set_priority(struct sta_info *sta, struct sk_buff *skb)
+{
+ struct ieee80211_sta_qos_rcu *qos;
+ u8 qos_tag;
+ u8 qos_id;
+ u8 tid;
+
+ if (!sta)
+ return;
+
+ qos_tag = u32_get_bits(skb->mark, IEEE80211_QOS_MGMT_TAG_MASK);
+ qos_id = u32_get_bits(skb->mark, IEEE80211_QOS_MGMT_ID_MASK);
+ if (qos_tag != IEEE80211_QOS_MGMT_SCS_TAG &&
+ qos_tag != IEEE80211_QOS_MGMT_MSCS_TAG)
+ return;
+
+ if (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG && !qos_id)
+ return;
+
+ guard(rcu)();
+ qos = rcu_dereference(sta->qos);
+
+ if (!qos)
+ return;
+
+ if (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG) {
+ if (!qos->data.scs_enabled ||
+ !test_bit(qos_id, qos->data.active_scs_id))
+ return;
+
+ tid = qos->data.scs_id_tid_mapping[qos_id];
+ } else {
+ if (!qos->data.mscs_enabled ||
+ qos_id >= IEEE80211_QOS_MGMT_MAX_TID ||
+ !(qos->data.mscs_user_priority_bitmap & BIT(qos_id)))
+ return;
+
+ tid = min_t(u8, qos_id,
+ qos->data.mscs_user_priority_limit);
+ }
+
+ if (tid < IEEE80211_QOS_MGMT_MAX_TID)
+ skb->priority = tid;
+}
+
/* Indicate which queue to use for this fully formed 802.11 frame */
u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb,
@@ -179,6 +225,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
qos_map = rcu_dereference(sdata->qos_map);
skb->priority = cfg80211_classify8021d(skb, qos_map ?
&qos_map->qos_map : NULL);
+ ieee80211_qos_mgmt_set_priority(sta, skb);
downgrade:
return ieee80211_downgrade_queue(sdata, sta, skb);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d790e204aee36..d77363a7ed176 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -798,6 +798,93 @@ static const struct netlink_range_validation q_range = {
.max = INT_MAX,
};
+static const struct nla_policy
+nl80211_qm_tclas_type4_policy[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] = { .type = NLA_BINARY,
+ .len = NL80211_IPADDR_MAX_LEN },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] = { .type = NLA_BINARY,
+ .len = NL80211_IPADDR_MAX_LEN },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] = { .type = NLA_U16 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] = { .type = NLA_U16 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DSCP] = NLA_POLICY_MAX(NLA_U8, 63),
+ [NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL] =
+ NLA_POLICY_EXACT_LEN(NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN),
+};
+
+static const struct nla_policy
+nl80211_qm_tclas_type10_policy[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] = {
+ .type = NLA_BINARY,
+ .len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK] = {
+ .type = NLA_BINARY,
+ .len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },
+};
+
+static const struct nla_policy
+nl80211_qm_tclas_policy[NL80211_QM_TCLAS_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_ATTR_USER_PRIORITY] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
+ [NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_qm_tclas_type4_policy),
+ [NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_qm_tclas_type10_policy),
+};
+
+static const struct nla_policy
+nl80211_qm_qos_policy[NL80211_QM_QOS_ATTR_MAX + 1] = {
+ [NL80211_QM_QOS_ATTR_CONTROL_INFO] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MIN_DATA_RATE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_DELAY_BOUND] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE] = { .type = NLA_U16 },
+ [NL80211_QM_QOS_ATTR_SVC_START_TIME] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_MLD_MAX_NUM_LINKS - 1),
+ [NL80211_QM_QOS_ATTR_MEAN_DATA_RATE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_BURST_SIZE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MSDU_LIFETIME] = { .type = NLA_U16 },
+ [NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO] = { .type = NLA_U8 },
+ [NL80211_QM_QOS_ATTR_MEDIUM_TIME] = { .type = NLA_U16 },
+};
+
+static const struct nla_policy
+nl80211_qm_desc_params_policy[NL80211_QM_DESC_ATTR_MAX + 1] = {
+ [NL80211_QM_DESC_ATTR_QM_ID] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_REQUEST_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_QM_CHANGE_REQ),
+ [NL80211_QM_DESC_ATTR_PRIORITY] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_qm_tclas_policy),
+ [NL80211_QM_DESC_ATTR_TCLAS_PROCESSING] =
+ NLA_POLICY_MAX(NLA_U8,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST),
+ [NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES] =
+ NLA_POLICY_NESTED(nl80211_qm_qos_policy),
+ [NL80211_QM_DESC_ATTR_STATUS] = { .type = NLA_REJECT },
+ [NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
+ [NL80211_QM_DESC_ATTR_TCLAS_MASK] = { .type = NLA_U8 },
+};
+
+static const struct nla_policy
+nl80211_qm_policy[NL80211_QM_ATTR_MAX + 1] = {
+ [NL80211_QM_ATTR_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
+ [NL80211_QM_ATTR_QM_TYPE] = NLA_POLICY_MAX(NLA_U8,
+ NL80211_QM_TYPE_MAX - 1),
+ [NL80211_QM_ATTR_DESCRIPTOR_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_qm_desc_params_policy),
+};
+
static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
@@ -1201,6 +1288,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_ASSOC_CIP] = { .type = NLA_FLAG },
[NL80211_ATTR_CIP_CAPABILITIES] = { .type = NLA_U8 },
[NL80211_ATTR_ASSOC_PROTECTED_TWT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_QOS_MGMT] = NLA_POLICY_NESTED(nl80211_qm_policy),
};
/* policy for the key attributes */
@@ -20459,6 +20547,642 @@ static const struct genl_ops nl80211_ops[] = {
},
};
+static int
+nl80211_parse_qm_tclas4_elem(struct nlattr *tb_tclas_entry[],
+ struct cfg80211_qm_tclas4_params *type4_params)
+{
+ struct nlattr *tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 version;
+
+ if (nla_parse_nested(tb_tclas_type4, NL80211_QM_TCLAS_TYPE4_ATTR_MAX,
+ tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS],
+ nl80211_qm_tclas_type4_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK];
+ type4_params->classifier_mask = nla_get_u8(attr);
+ if (!(type4_params->classifier_mask &
+ NL80211_QM_TCLAS_TYPE4_MASK_VERSION))
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION];
+ type4_params->ip_ver = nla_get_u8(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT];
+ type4_params->src_port = nla_get_u16(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT];
+ type4_params->dst_port = nla_get_u16(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP];
+ type4_params->dscp = nla_get_u8(attr);
+
+ version = type4_params->ip_ver;
+ if (version == QM_IP_VERSION_4) {
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];
+ if (nla_len(attr) != QM_IPV4_LEN)
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];
+ if (nla_len(attr) != QM_IPV4_LEN)
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL];
+ type4_params->protocol = nla_get_u8(attr);
+
+ nla_memcpy(type4_params->src_ip.ipv4,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],
+ QM_IPV4_LEN);
+ nla_memcpy(type4_params->dst_ip.ipv4,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],
+ QM_IPV4_LEN);
+ } else if (version == QM_IP_VERSION_6) {
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];
+ if (nla_len(attr) != QM_IPV6_LEN)
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];
+ if (nla_len(attr) != QM_IPV6_LEN)
+ return -EINVAL;
+
+ nla_memcpy(type4_params->src_ip.ipv6,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],
+ QM_IPV6_LEN);
+ nla_memcpy(type4_params->dst_ip.ipv6,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],
+ QM_IPV6_LEN);
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER];
+ type4_params->next_header = nla_get_u8(attr);
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL];
+ nla_memcpy(type4_params->flow_label,
+ attr,
+ NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN);
+ } else {
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas10_elem(struct nlattr *tb_tclas_entry[],
+ struct cfg80211_qm_tclas10_params *type10_params)
+{
+ struct nlattr *tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 filter_value_len, filter_mask_len;
+
+ attr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS];
+ if (nla_parse_nested(tb_tclas_type10, NL80211_QM_TCLAS_TYPE10_ATTR_MAX,
+ attr,
+ nl80211_qm_tclas_type10_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK])
+ return -EINVAL;
+
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE];
+ type10_params->protocol_instance = nla_get_u8(attr);
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER];
+ type10_params->protocol_number = nla_get_u8(attr);
+
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE];
+ filter_value_len = nla_len(attr);
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK];
+ filter_mask_len = nla_len(attr);
+
+ if (filter_value_len != filter_mask_len ||
+ filter_value_len > NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN)
+ return -EINVAL;
+
+ type10_params->filter_len = filter_value_len;
+ nla_memcpy(type10_params->filter_value,
+ tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE],
+ type10_params->filter_len);
+ nla_memcpy(type10_params->filter_mask,
+ tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK],
+ type10_params->filter_len);
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas_elem(struct nlattr *tb_tclas,
+ struct cfg80211_qm_tclas_elements *tclas)
+{
+ struct nlattr *tb_tclas_entry[NL80211_QM_TCLAS_ATTR_MAX + 1];
+ struct cfg80211_qm_tclas4_params *type4_params;
+ struct cfg80211_qm_tclas10_params *type10_params;
+ struct nlattr *attr;
+ u8 classifier_type;
+ int ret;
+
+ if (nla_parse_nested(tb_tclas_entry, NL80211_QM_TCLAS_ATTR_MAX,
+ tb_tclas, nl80211_qm_tclas_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY] ||
+ !tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE])
+ return -EINVAL;
+
+ tclas->up =
+ nla_get_u8(tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY]);
+ attr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE];
+ tclas->classifier_type = nla_get_u8(attr);
+ classifier_type = tclas->classifier_type;
+ type4_params = &tclas->tclas_elem.type4_params;
+ type10_params = &tclas->tclas_elem.type10_params;
+
+ switch (classifier_type) {
+ case NL80211_QM_TCLAS_CLASSIFIER_TYPE4:
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS])
+ return -EINVAL;
+
+ ret = nl80211_parse_qm_tclas4_elem(tb_tclas_entry,
+ type4_params);
+ if (ret)
+ return ret;
+ break;
+
+ case NL80211_QM_TCLAS_CLASSIFIER_TYPE10:
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS])
+ return -EINVAL;
+
+ ret = nl80211_parse_qm_tclas10_elem(tb_tclas_entry,
+ type10_params);
+ if (ret)
+ return ret;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas(struct nlattr *tb[],
+ struct cfg80211_qm_req_desc_data *qm_req_desc)
+{
+ struct nlattr *tb_tclas;
+ struct nlattr *tclas_elements;
+ struct cfg80211_qm_tclas_elements *tclas_elem;
+ struct nlattr *attr;
+ int rem_tclas_desc;
+ unsigned int num_tclas_elements = 0;
+ unsigned int tclas_idx = 0;
+ int ret;
+
+ tclas_elements = tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS];
+ nla_for_each_nested(tb_tclas, tclas_elements, rem_tclas_desc)
+ num_tclas_elements++;
+
+ if (num_tclas_elements) {
+ qm_req_desc->tclas = kzalloc_objs(*qm_req_desc->tclas,
+ num_tclas_elements,
+ GFP_KERNEL);
+ if (!qm_req_desc->tclas)
+ return -ENOMEM;
+ }
+
+ nla_for_each_nested(tb_tclas, tclas_elements,
+ rem_tclas_desc) {
+ tclas_elem = &qm_req_desc->tclas[tclas_idx];
+ ret = nl80211_parse_qm_tclas_elem(tb_tclas, tclas_elem);
+ if (ret)
+ return ret;
+
+ tclas_idx++;
+ }
+
+ qm_req_desc->num_tclas_elements = num_tclas_elements;
+
+ attr = tb[NL80211_QM_DESC_ATTR_TCLAS_PROCESSING];
+ if (attr)
+ qm_req_desc->tclas_processing = nla_get_u8(attr);
+
+ return 0;
+}
+
+/*
+ * QoS characteristics control info bitfield masks, used only here to
+ * parse NL80211_QM_QOS_ATTR_CONTROL_INFO.
+ */
+#define QM_CTRL_INFO_DIRECTION_MASK GENMASK(1, 0)
+#define QM_CTRL_INFO_TID_MASK GENMASK(5, 2)
+#define QM_CTRL_INFO_UP_MASK GENMASK(8, 6)
+#define QM_CTRL_INFO_BITMAP_MASK GENMASK(24, 9)
+#define QM_CTRL_INFO_LINK_ID_MASK GENMASK(28, 25)
+#define QM_CTRL_INFO_RESERVED_MASK GENMASK(31, 29)
+
+/*
+ * MSDU delivery info bitfield masks, used only here to parse
+ * NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO.
+ */
+#define QM_MSDU_DELIVERY_INFO_RATIO_MASK GENMASK(3, 0)
+#define QM_MSDU_DELIVERY_INFO_COUNT_EXPONENT_MASK GENMASK(7, 4)
+
+#define GET_FIELD_FROM_QM_CTRL_INFO(ctrl_info, FIELD) \
+ u32_get_bits((ctrl_info), QM_CTRL_INFO_##FIELD##_MASK)
+
+#define GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info, FIELD) \
+ u8_get_bits((msdu_delivery_info), \
+ QM_MSDU_DELIVERY_INFO_##FIELD##_MASK)
+
+static int
+nl80211_parse_qm_qos_attr(struct nlattr *tb[],
+ struct cfg80211_qm_qos_attributes *qos_attr)
+{
+ struct nlattr *tb_qm_qos[NL80211_QM_QOS_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 msdu_delivery_info;
+ u32 control_info;
+
+ attr = tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES];
+ if (nla_parse_nested(tb_qm_qos, NL80211_QM_QOS_ATTR_MAX, attr,
+ nl80211_qm_qos_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND])
+ return -EINVAL;
+
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO];
+ control_info = nla_get_u32(attr);
+ qos_attr->direction =
+ GET_FIELD_FROM_QM_CTRL_INFO(control_info, DIRECTION);
+ qos_attr->tid = GET_FIELD_FROM_QM_CTRL_INFO(control_info, TID);
+ qos_attr->up = GET_FIELD_FROM_QM_CTRL_INFO(control_info, UP);
+ qos_attr->bitmap = GET_FIELD_FROM_QM_CTRL_INFO(control_info, BITMAP);
+ qos_attr->link_id = GET_FIELD_FROM_QM_CTRL_INFO(control_info, LINK_ID);
+
+ qos_attr->min_service_interval =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL]);
+ qos_attr->max_service_interval =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL]);
+ qos_attr->min_data_rate =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE]);
+ qos_attr->delay_bound =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND]);
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE];
+ qos_attr->max_msdu_size = nla_get_u16(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME];
+ qos_attr->service_start_time = nla_get_u32(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID];
+ qos_attr->service_start_time_link_id = nla_get_u8(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE];
+ qos_attr->mean_data_rate = nla_get_u32(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE])
+ qos_attr->burst_size =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE]);
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME];
+ qos_attr->msdu_lifetime = nla_get_u16(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO];
+ msdu_delivery_info = nla_get_u8(attr);
+
+ qos_attr->msdu_delivery_ratio =
+ GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,
+ RATIO);
+ qos_attr->msdu_count_exponent =
+ GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,
+ COUNT_EXPONENT);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME])
+ qos_attr->medium_time =
+ nla_get_u16(tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME]);
+
+ return 0;
+}
+
+static int nl80211_parse_qm_desc(struct nlattr *tb_qm_desc,
+ struct cfg80211_qm_req_desc_data *qm_req_desc,
+ enum nl80211_qm_type qm_type)
+{
+ struct nlattr *tb[NL80211_QM_DESC_ATTR_MAX + 1];
+ struct nlattr *attr;
+ int ret;
+
+ if (nla_parse_nested(tb, NL80211_QM_DESC_ATTR_MAX,
+ tb_qm_desc, nl80211_qm_desc_params_policy, NULL))
+ return -EINVAL;
+
+ if (!tb[NL80211_QM_DESC_ATTR_QM_ID] ||
+ !tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE])
+ return -EINVAL;
+
+ qm_req_desc->qm_id = nla_get_u8(tb[NL80211_QM_DESC_ATTR_QM_ID]);
+ if (!qm_req_desc->qm_id)
+ return -EINVAL;
+
+ qm_req_desc->request_type =
+ nla_get_u8(tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE]);
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_REMOVE_REQ:
+ return 0;
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch (qm_type) {
+ case NL80211_QM_TYPE_SCS:
+ if (tb[NL80211_QM_DESC_ATTR_PRIORITY]) {
+ attr = tb[NL80211_QM_DESC_ATTR_PRIORITY];
+ qm_req_desc->priority = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS]) {
+ ret = nl80211_parse_qm_tclas(tb, qm_req_desc);
+ if (ret)
+ return ret;
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES]) {
+ ret = nl80211_parse_qm_qos_attr(tb,
+ &qm_req_desc->qos_attr);
+ if (ret)
+ return ret;
+
+ qm_req_desc->is_qos_present = true;
+ }
+ break;
+
+ case NL80211_QM_TYPE_MSCS:
+ if (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP]) {
+ attr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP];
+ qm_req_desc->user_priority_bitmap = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT]) {
+ attr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT];
+ qm_req_desc->user_priority_limit = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_TCLAS_MASK]) {
+ attr = tb[NL80211_QM_DESC_ATTR_TCLAS_MASK];
+ qm_req_desc->tclas_mask = nla_get_u8(attr);
+ }
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_set_qm_resp_desc(struct sk_buff *msg,
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc,
+ int idx)
+{
+ struct nlattr *qm_desc_entry;
+
+ qm_desc_entry = nla_nest_start(msg, idx);
+ if (!qm_desc_entry)
+ return -ENOBUFS;
+
+ if (nla_put_u8(msg, NL80211_QM_DESC_ATTR_QM_ID,
+ qm_resp_desc->qm_id) ||
+ nla_put_u8(msg, NL80211_QM_DESC_ATTR_STATUS,
+ qm_resp_desc->status)) {
+ nla_nest_cancel(msg, qm_desc_entry);
+ return -ENOBUFS;
+ }
+
+ nla_nest_end(msg, qm_desc_entry);
+ return 0;
+}
+
+static int
+nl80211_qm_send_resp(struct genl_info *info,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct nlattr *qm, *qm_desc;
+ struct sk_buff *msg;
+ void *hdr;
+ int ret;
+ int idx;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
+ NL80211_CMD_QOS_MGMT);
+ if (!hdr) {
+ ret = -ENOBUFS;
+ goto nla_fail;
+ }
+
+ qm = nla_nest_start(msg, NL80211_ATTR_QOS_MGMT);
+ if (!qm) {
+ ret = -ENOBUFS;
+ goto nla_fail;
+ }
+
+ if (nla_put(msg, NL80211_QM_ATTR_MAC_ADDR, ETH_ALEN,
+ qm_req->peer_mac) ||
+ nla_put_u8(msg, NL80211_QM_ATTR_QM_TYPE,
+ qm_req->qm_type)) {
+ ret = -ENOBUFS;
+ goto nla_qm_fail;
+ }
+
+ qm_desc = nla_nest_start(msg, NL80211_QM_ATTR_DESCRIPTOR_PARAMS);
+ if (!qm_desc) {
+ ret = -ENOBUFS;
+ goto nla_qm_fail;
+ }
+
+ for (idx = 0; idx < qm_req->num_qm_desc; idx++) {
+ ret = nl80211_set_qm_resp_desc(msg, &qm_resp->qm_resp_desc[idx],
+ idx);
+ if (ret) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management response descriptor failed");
+ goto nla_qm_desc_fail;
+ }
+ }
+
+ nla_nest_end(msg, qm_desc);
+ nla_nest_end(msg, qm);
+ genlmsg_end(msg, hdr);
+
+ return genlmsg_reply(msg, info);
+
+nla_qm_desc_fail:
+ nla_nest_cancel(msg, qm_desc);
+nla_qm_fail:
+ nla_nest_cancel(msg, qm);
+nla_fail:
+ nlmsg_free(msg);
+ return ret;
+}
+
+static void
+nl80211_free_qm_req(struct cfg80211_qm_req_data *qm_req)
+{
+ unsigned int i;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++)
+ kfree(qm_req->qm_req_desc[i].tclas);
+
+ kfree(qm_req->qm_req_desc);
+}
+
+static int
+nl80211_qos_mgmt_cfg(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct nlattr *tb_qm[NL80211_QM_ATTR_MAX + 1];
+ struct cfg80211_qm_resp_data qm_resp = {};
+ struct cfg80211_qm_req_data qm_req = {};
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+ struct nlattr *tb_qm_desc;
+ int rem_qm_desc;
+ unsigned int num_qm_desc = 0;
+ unsigned int idx;
+ int ret;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP)
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_QOS_MGMT]) {
+ GENL_SET_ERR_MSG(info, "QoS Management attribute missing");
+ return -EINVAL;
+ }
+
+ if (nla_parse_nested(tb_qm, NL80211_QM_ATTR_MAX,
+ info->attrs[NL80211_ATTR_QOS_MGMT],
+ nl80211_qm_policy, NULL)) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management attribute parsing failed");
+ return -EINVAL;
+ }
+
+ if (!tb_qm[NL80211_QM_ATTR_MAC_ADDR] ||
+ !tb_qm[NL80211_QM_ATTR_QM_TYPE] ||
+ !tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS]) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management request attributes missing");
+ return -EINVAL;
+ }
+
+ nla_memcpy(qm_req.peer_mac, tb_qm[NL80211_QM_ATTR_MAC_ADDR], ETH_ALEN);
+ qm_req.qm_type = nla_get_u8(tb_qm[NL80211_QM_ATTR_QM_TYPE]);
+
+ nla_for_each_nested(tb_qm_desc,
+ tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],
+ rem_qm_desc)
+ num_qm_desc++;
+
+ if (!num_qm_desc) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management descriptor list is empty");
+ return -EINVAL;
+ }
+
+ qm_req.qm_req_desc = kzalloc_objs(*qm_req.qm_req_desc,
+ num_qm_desc, GFP_KERNEL);
+ if (!qm_req.qm_req_desc) {
+ ret = -ENOMEM;
+ goto free_qm;
+ }
+
+ nla_for_each_nested(tb_qm_desc,
+ tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],
+ rem_qm_desc) {
+ qm_req_desc = &qm_req.qm_req_desc[qm_req.num_qm_desc];
+ ret = nl80211_parse_qm_desc(tb_qm_desc, qm_req_desc,
+ qm_req.qm_type);
+ if (ret) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management descriptor parsing failed");
+ goto free_qm;
+ }
+ qm_req.num_qm_desc++;
+ }
+
+ if (qm_req.qm_type == NL80211_QM_TYPE_MSCS && qm_req.num_qm_desc != 1) {
+ GENL_SET_ERR_MSG(info,
+ "MSCS request must contain exactly one descriptor");
+ ret = -EINVAL;
+ goto free_qm;
+ }
+
+ qm_resp.qm_resp_desc = kzalloc_objs(*qm_resp.qm_resp_desc,
+ qm_req.num_qm_desc, GFP_KERNEL);
+ if (!qm_resp.qm_resp_desc) {
+ ret = -ENOMEM;
+ goto free_qm;
+ }
+
+ for (idx = 0; idx < qm_req.num_qm_desc; idx++) {
+ qm_resp.qm_resp_desc[idx].qm_id =
+ qm_req.qm_req_desc[idx].qm_id;
+ qm_resp.qm_resp_desc[idx].status = NL80211_QM_STATUS_DECLINED;
+ }
+
+ ret = rdev_set_qos_mgmt_cfg(rdev, dev, &qm_req, &qm_resp);
+ if (ret) {
+ GENL_SET_ERR_MSG(info, "set_qos_mgmt_cfg failed");
+ goto free_qm;
+ }
+
+ ret = nl80211_qm_send_resp(info, &qm_req, &qm_resp);
+
+free_qm:
+ kfree(qm_resp.qm_resp_desc);
+ nl80211_free_qm_req(&qm_req);
+ return ret;
+}
+
static const struct genl_small_ops nl80211_small_ops[] = {
{
.cmd = NL80211_CMD_SET_WIPHY,
@@ -21350,6 +22074,12 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NO_WIPHY_MTX),
},
+ {
+ .cmd = NL80211_CMD_QOS_MGMT,
+ .doit = nl80211_qos_mgmt_cfg,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index ae15cec9bf8b7..16698af390207 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1707,4 +1707,21 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int
+rdev_set_qos_mgmt_cfg(struct cfg80211_registered_device *rdev,
+ struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct wiphy *wiphy = &rdev->wiphy;
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_qos_mgmt_cfg(wiphy, dev, qm_req);
+ if (rdev->ops->set_qos_mgmt_cfg)
+ ret = rdev->ops->set_qos_mgmt_cfg(wiphy, dev, qm_req, qm_resp);
+ trace_rdev_return_int(wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 31000ffebe436..83bd63e1c7e26 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3281,6 +3281,26 @@ TRACE_EVENT(rdev_set_epcs,
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->val)
);
+TRACE_EVENT(rdev_set_qos_mgmt_cfg,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_qm_req_data *qm_req),
+ TP_ARGS(wiphy, netdev, qm_req),
+ TP_STRUCT__entry(WIPHY_ENTRY
+ NETDEV_ENTRY
+ __field(u8, qm_type)
+ __field(unsigned int, num_qm_desc)
+ ),
+ TP_fast_assign(WIPHY_ASSIGN;
+ NETDEV_ASSIGN;
+ __entry->qm_type = qm_req->qm_type;
+ __entry->num_qm_desc = qm_req->num_qm_desc;
+ ),
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT
+ ", qm_type=%u num_qm_desc=%u",
+ WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->qm_type,
+ __entry->num_qm_desc)
+);
+
/*************************************************************
* cfg80211 exported functions traces *
*************************************************************/
|
| 3/2 | 2026/10/15 07:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34785 output: 35 thoughts: 1134 Thoughts: **Analyzing the Patch for Syzkaller Fuzzing Potential** Okay, let's break this down. My initial thought is to figure out if this new `NL80211_CMD_QOS_MGMT` command added to `nl80211`, `cfg80211`, and `mac80211` is worth the effort of syzkaller fuzzing. First, let's quickly review the code changes. It looks like we've got definitions for the new command and related structures (`cfg80211_qm_req_data`, `cfg80211_qm_resp_data`, etc.) spread across headers and various source files (`ieee80211.h`, `cfg80211.h`, `mac80211.h`, `nl80211.h`). The implementation seems to involve handling this command within `nl80211.c`, including netlink attribute parsing and a call to `rdev_set_qos_mgmt_cfg`. We've got configuration functions (`ieee80211_set_qos_mgmt_cfg`, `ieee80211_qos_mgmt_cfg`, `ieee80211_qos_mgmt_update_scs`, `ieee80211_qos_mgmt_update_mscs`, `ieee80211_qos_mgmt_has_qos_char`) sprinkled through the MAC80211 stack (`cfg.c`, `mlme.c`, `rx.c`, `sta_info.c`, `wme.c`). There's also some tracing added, which is nice. The key question is, is this code reachable in a standard fuzzing environment, specifically QEMU? Yes, looks like virtual wireless devices like `mac80211_hwsim` or virtio / virtual wifi support `cfg80211/mac80211`. And, importantly, netlink commands can be sent from userspace. Syzkaller has pretty good netlink and mac80211 support, so that's a positive sign. The fact that `NL80211_CMD_QOS_MGMT` has the `.flags = GENL_UNS_ADMIN_PERM` is a big deal. This means a *unprivileged* user in a user namespace can potentially trigger this command if they have `CAP_NET_ADMIN` in that namespace. That's a huge accessibility win for fuzzing! Now, before I get too excited, let's make sure `mac80211_hwsim` is standard in most fuzzing environments and how nl80211 is reached. I'll need to double check the Kconfig options to be sure, using `grepper` or checking the files directly. |
| 4/2 | 2026/10/15 07:07 | tool | grepper |
0mArgs:{
"Expression": "config CFG80211",
"PathPrefixes": [
"net/wireless/Kconfig"
]
}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--\nnet/wireless/Kconfig=38=config NL80211_TESTMODE\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"
} |
| 5/2 | 2026/10/15 07:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37502 output: 39 thoughts: 20 Thoughts: Here's a summary of my thought process: **Diving Deeper into the Wi-Fi Configuration** Okay, I'm thinking we need to broaden the scope of our investigation. I've been focusing on [implied prior focus - perhaps a specific file or module], but to get a truly comprehensive understanding, I should also examine the `net/mac80211/Kconfig` file. It's a key configuration file for the mac80211 wireless subsystem, and often holds crucial definitions and dependencies that could be relevant to [implied problem or area of concern]. Checking Kconfig will allow me to consider the configuration aspects of [implied relevant elements] in relation to the current problem. I'm hoping to discover any related settings or configurations that I might have overlooked, or to clarify any existing assumptions. This will ensure I have a complete picture of the configurable elements and their dependencies within that specific part of the system. |
| 6/2 | 2026/10/15 07:07 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211",
"PathPrefixes": [
"net/mac80211/Kconfig"
]
}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--\nnet/mac80211/Kconfig=19=if MAC80211 != n\nnet/mac80211/Kconfig-20-\nnet/mac80211/Kconfig:21:config MAC80211_HAS_RC\nnet/mac80211/Kconfig-22-\tbool\nnet/mac80211/Kconfig-23-\nnet/mac80211/Kconfig:24:config MAC80211_RC_MINSTREL\nnet/mac80211/Kconfig-25-\tbool \"Minstrel\" if EXPERT\n--\nnet/mac80211/Kconfig=31=choice\n--\nnet/mac80211/Kconfig-40-\nnet/mac80211/Kconfig:41:config MAC80211_RC_DEFAULT_MINSTREL\nnet/mac80211/Kconfig-42-\tbool \"Minstrel\"\n--\nnet/mac80211/Kconfig=48=endchoice\nnet/mac80211/Kconfig-49-\nnet/mac80211/Kconfig:50:config MAC80211_RC_DEFAULT\nnet/mac80211/Kconfig-51-\tstring\n--\nnet/mac80211/Kconfig=57=comment \"Some wireless drivers require a rate control algorithm\"\n--\nnet/mac80211/Kconfig-59-\nnet/mac80211/Kconfig:60:config MAC80211_KUNIT_TEST\nnet/mac80211/Kconfig-61-\ttristate \"KUnit tests for mac80211\" if !KUNIT_ALL_TESTS\n--\nnet/mac80211/Kconfig-69-\nnet/mac80211/Kconfig:70:config MAC80211_MESH\nnet/mac80211/Kconfig-71-\tbool \"Enable mac80211 mesh networking support\"\n--\nnet/mac80211/Kconfig-78-\nnet/mac80211/Kconfig:79:config MAC80211_LEDS\nnet/mac80211/Kconfig-80-\tbool \"Enable LED triggers\"\n--\nnet/mac80211/Kconfig-87-\nnet/mac80211/Kconfig:88:config MAC80211_DEBUGFS\nnet/mac80211/Kconfig-89-\tbool \"Export mac80211 internals in DebugFS\"\n--\nnet/mac80211/Kconfig-96-\nnet/mac80211/Kconfig:97:config MAC80211_MESSAGE_TRACING\nnet/mac80211/Kconfig-98-\tbool \"Trace all mac80211 debug messages\"\n--\nnet/mac80211/Kconfig-109-\nnet/mac80211/Kconfig:110:menuconfig MAC80211_DEBUG_MENU\nnet/mac80211/Kconfig-111-\tbool \"Select mac80211 debugging features\"\n--\nnet/mac80211/Kconfig-115-\nnet/mac80211/Kconfig:116:config MAC80211_NOINLINE\nnet/mac80211/Kconfig-117-\tbool \"Do not inline TX/RX handlers\"\n--\nnet/mac80211/Kconfig-131-\nnet/mac80211/Kconfig:132:config MAC80211_VERBOSE_DEBUG\nnet/mac80211/Kconfig-133-\tbool \"Verbose debugging output\"\n--\nnet/mac80211/Kconfig-142-\nnet/mac80211/Kconfig:143:config MAC80211_MLME_DEBUG\nnet/mac80211/Kconfig-144-\tbool \"Verbose managed MLME output\"\n--\nnet/mac80211/Kconfig-153-\nnet/mac80211/Kconfig:154:config MAC80211_STA_DEBUG\nnet/mac80211/Kconfig-155-\tbool \"Verbose station debugging\"\n--\nnet/mac80211/Kconfig-162-\nnet/mac80211/Kconfig:163:config MAC80211_HT_DEBUG\nnet/mac80211/Kconfig-164-\tbool \"Verbose HT debugging\"\n--\nnet/mac80211/Kconfig-174-\nnet/mac80211/Kconfig:175:config MAC80211_OCB_DEBUG\nnet/mac80211/Kconfig-176-\tbool \"Verbose OCB debugging\"\n--\nnet/mac80211/Kconfig-185-\nnet/mac80211/Kconfig:186:config MAC80211_IBSS_DEBUG\nnet/mac80211/Kconfig-187-\tbool \"Verbose IBSS debugging\"\n--\nnet/mac80211/Kconfig-196-\nnet/mac80211/Kconfig:197:config MAC80211_PS_DEBUG\nnet/mac80211/Kconfig-198-\tbool \"Verbose powersave mode debugging\"\n--\nnet/mac80211/Kconfig-208-\nnet/mac80211/Kconfig:209:config MAC80211_MPL_DEBUG\nnet/mac80211/Kconfig-210-\tbool \"Verbose mesh peer link debugging\"\n--\nnet/mac80211/Kconfig-221-\nnet/mac80211/Kconfig:222:config MAC80211_MPATH_DEBUG\nnet/mac80211/Kconfig-223-\tbool \"Verbose mesh path debugging\"\n--\nnet/mac80211/Kconfig-234-\nnet/mac80211/Kconfig:235:config MAC80211_MHWMP_DEBUG\nnet/mac80211/Kconfig-236-\tbool \"Verbose mesh HWMP routing debugging\"\n--\nnet/mac80211/Kconfig-247-\nnet/mac80211/Kconfig:248:config MAC80211_MESH_SYNC_DEBUG\nnet/mac80211/Kconfig-249-\tbool \"Verbose mesh synchronization debugging\"\n--\nnet/mac80211/Kconfig-258-\nnet/mac80211/Kconfig:259:config MAC80211_MESH_CSA_DEBUG\nnet/mac80211/Kconfig-260-\tbool \"Verbose mesh channel switch debugging\"\n--\nnet/mac80211/Kconfig-269-\nnet/mac80211/Kconfig:270:config MAC80211_MESH_PS_DEBUG\nnet/mac80211/Kconfig-271-\tbool \"Verbose mesh powersave debugging\"\n--\nnet/mac80211/Kconfig-280-\nnet/mac80211/Kconfig:281:config MAC80211_TDLS_DEBUG\nnet/mac80211/Kconfig-282-\tbool \"Verbose TDLS debugging\"\n--\nnet/mac80211/Kconfig-292-\nnet/mac80211/Kconfig:293:config MAC80211_DEBUG_COUNTERS\nnet/mac80211/Kconfig-294-\tbool \"Extra statistics for TX/RX debugging\"\n--\nnet/mac80211/Kconfig-307-\nnet/mac80211/Kconfig:308:config MAC80211_STA_HASH_MAX_SIZE\nnet/mac80211/Kconfig-309-\tint \"Station hash table maximum size\" if MAC80211_DEBUG_MENU\n"
} |
| 7/2 | 2026/10/15 07:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39941 output: 32 thoughts: 47 Thoughts: Okay, here's my assessment of the situation: **Investigating Dependencies in the Wireless Subsystem** Alright, before I dive too deep into this, I need to understand the architectural landscape. I need to know the dependencies of `CFG80211` and `MAC80211`. Are these modules stand-alone, or do they rely on lower-level subsystems like `NET` and `WIRELESS`? If there are any dependencies, knowing them will allow me to better understand the code and how everything fits together. I'll start by checking the `net/wireless/Kconfig` file, paying close attention to the top lines. That should give me a quick overview of any immediate dependencies, and then I can dig deeper as needed. This will be my starting point. |
| 8/2 | 2026/10/15 07:07 | tool | read-file |
0mArgs:{
"File": "net/wireless/Kconfig",
"FirstLine": 1,
"LineCount": 30
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\tconfig WIRELESS_EXT\n 3:\t\tbool\n 4:\t\n 5:\tconfig WEXT_CORE\n 6:\t\tdef_bool y\n 7:\t\tdepends on CFG80211_WEXT || WIRELESS_EXT\n 8:\t\n 9:\tconfig WEXT_PROC\n 10:\t\tdef_bool y\n 11:\t\tdepends on PROC_FS\n 12:\t\tdepends on WEXT_CORE\n 13:\t\n 14:\tconfig WEXT_PRIV\n 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"
} |
| 9/2 | 2026/10/15 07:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40596 output: 37 thoughts: 20 Thoughts: Here's a summary of my thought process: **Diving into the Wi-Fi Kernel Configuration** Okay, time to get started. My immediate focus is on the `net/mac80211/Kconfig` file. I need to refresh my understanding of the top-level configuration options within the mac80211 framework. I'm going to scan the top lines of that Kconfig file. This is the starting point for understanding which features are enabled, disabled, and how the core mac80211 configuration is structured. I need to grasp the foundational settings before diving deeper. |
| 10/2 | 2026/10/15 07:07 | tool | read-file |
0mArgs:{
"File": "net/mac80211/Kconfig",
"FirstLine": 1,
"LineCount": 20
}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"
} |
| 11/2 | 2026/10/15 07:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41064 output: 38 thoughts: 44 Thoughts: Okay, here's my take on those thoughts, framed as my own: **Investigating mac80211 Driver Implementation** Right, so I'm thinking about *mac80211* and wondering which specific driver or virtual device actually *uses* it. My initial thought? *MAC80211_HWSIM*! That's the obvious candidate, isn't it? Seems a sensible place to begin. Time to dig into *MAC80211_HWSIM* and confirm my hunch. Need to understand how it leverages the *mac80211* framework. |
| 12/2 | 2026/10/15 07:07 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211_HWSIM",
"PathPrefixes": [
"drivers/net/wireless/"
]
}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"
} |
| 13/2 | 2026/10/15 07:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41350 output: 32 thoughts: 6300 Thoughts: **Detailed Analysis of QOS Management Code and Vulnerability Assessment** Okay, let's break this down. My initial inspection of the changes revealed a complex new subsystem within the wireless networking stack, specifically related to QoS Management (QoS Mgmt). I've traced the core flow and noticed several interesting aspects. The entry point, `nl80211_qos_mgmt_cfg`, is triggered by a Netlink command. It then parses a series of nested attributes, including MAC addresses, QoS Management types, and descriptor parameters. The parsing involves nested loops and calls to specialized parsing functions like `nl80211_parse_qm_desc`, `nl80211_parse_qm_tclas`, and their variants. These parsers handle complex data structures, including nested arrays, and are essential for defining the QoS configuration. The configuration then flows through a driver abstraction via `rdev_set_qos_mgmt_cfg`, eventually reaching the mac80211 layer. Here, the key function is `ieee80211_qos_mgmt_cfg`, which is the core logic. It does a station lookup, allocates memory for QoS configuration (`sta->qos`), and updates this configuration based on the type (SCS or MSCS). Crucially, it handles RCU (Read-Copy Update) updates to `sta->qos`, meaning concurrent reads and updates are supported safely. The code also interacts with the packet receive and transmit paths, setting MSCS marks on received packets via `ieee80211_qos_mgmt_mscs_set_mark` and selecting queue priorities for transmission using `ieee80211_qos_mgmt_set_priority`. The teardown path also frees the `sta->qos` RCU structure, using `rcu_replace_pointer` and `kfree_rcu` to maintain RCU safety during destruction. Now, let's get into the nitty-gritty and see if there are vulnerabilities. I found a subtle but critical memory leak in `nl80211_parse_qm_tclas`. If there's an error during the parsing of TCLAS elements within a descriptor (`nl80211_parse_qm_tclas_elem` returns an error), the allocated memory for `qm_req_desc->tclas` is leaked. The error handling in the surrounding code (`nl80211_parse_qm_tclas`, and its caller `nl80211_qos_mgmt_cfg`) doesn't account for incrementing the counter `qm_req.num_qm_desc` before freeing the memory. This means the allocated buffer isn't freed leading to a leak. I also observed an issue with the QoS response status. The code sets the status to `NL80211_QM_STATUS_DECLINED` initially. But, criticaly, for legacy SCS/MSCS (`ieee80211_qos_mgmt_has_qos_char` == false), nobody ever sets the `status` to `NL80211_QM_STATUS_SUCCESS`. This makes the core SCS/MSCS configuration logic within `ieee80211_qos_mgmt_update_scs` and `ieee80211_qos_mgmt_update_mscs` to do nothing. In addition, when `ieee80211_qos_mgmt_has_qos_char` is true, the call to the driver op `drv_qos_mgmt_cfg` returns `-EOPNOTSUPP` if the driver doesn't implement it, but this is not handled in the code, and so is an incomplete implementation. This is all very interesting from a fuzzing perspective. The complex parsing, RCU updates, and interaction with the packet path make this a prime target for fuzzing. Given that `nl80211` is a Netlink protocol (directly accessible from userspace), this satisfies all requirements for fuzzing with syzkaller, especially if combined with the `mac80211_hwsim` simulated driver. I'm confident that this merits an entry as `WorthFuzzing=true`. For FocusSymbols, I'm focusing on the entrypoints and critical parsing, and core functions: `nl80211_qos_mgmt_cfg`, `ieee80211_set_qos_mgmt_cfg`, `ieee80211_qos_mgmt_cfg`, `nl80211_parse_qm_desc`, `nl80211_parse_qm_tclas`, `nl80211_parse_qm_qos_attr`, `ieee80 |
| 14/2 | 2026/10/15 07:08 | tool | grepper |
0mArgs:{
"Expression": "nl80211",
"PathPrefixes": [
"net/wireless/Makefile"
]
}Results: {
"Output": "net/wireless/Makefile=7=obj-$(CONFIG_WEXT_PRIV) += wext-priv.o\nnet/wireless/Makefile-8-\nnet/wireless/Makefile:9:cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o\nnet/wireless/Makefile-10-cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o\n"
} |
| 15/2 | 2026/10/15 07:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 48852 output: 31 thoughts: 73 Thoughts: Here's my take on those lines of code, viewed through my expert lens: **Analyzing the cfg80211 Compilation Process** Okay, so I'm looking at how `cfg80211` gets built into the kernel. The first line, `cfg80211-y += ... nl80211.o`, indicates that `nl80211.o` and potentially other object files are going to be compiled and linked *into* the `cfg80211.o` module. This is pretty standard for modular kernel development; it's the core of how you build a complex driver or subsystem. Then, the line `obj-$(CONFIG_CFG80211) += cfg80211.o` in the `net/wireless/Makefile` is the crucial part. This line tells the kernel build system, that if `CONFIG_CFG80211` is enabled (either as a module or built-in), then `cfg80211.o` should be built and included. So, I need to check the dependencies. I should look into the `net/wireless/Makefile` file to understand the build process. I'll take a glance at the first 15 lines of this file to check on its dependencies. This is where the magic happens – where the build system figures out whether or not to include `cfg80211` based on the configuration options set during the kernel build process. Time to dig in and see how this all connects. |
| 16/2 | 2026/10/15 07:08 | tool | read-file |
0mArgs:{
"File": "net/wireless/Makefile",
"FirstLine": 1,
"LineCount": 15
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0\n 2:\tobj-$(CONFIG_CFG80211) += cfg80211.o\n 3:\tobj-y += tests/\n 4:\t\n 5:\tobj-$(CONFIG_WEXT_CORE) += wext-core.o\n 6:\tobj-$(CONFIG_WEXT_PROC) += wext-proc.o\n 7:\tobj-$(CONFIG_WEXT_PRIV) += wext-priv.o\n 8:\t\n 9:\tcfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o\n 10:\tcfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o\n 11:\tcfg80211-y += michael-mic.o pmsr.o\n 12:\tcfg80211-$(CONFIG_OF) += of.o\n 13:\tcfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o\n 14:\tcfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o\n 15:\t\n"
} |
| 17/2 | 2026/10/15 07:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 49649 output: 36 thoughts: 17 Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own: **Analyzing the Network Driver Build Process** Right, time to take a look at the build process for the wireless networking components. My intuition tells me that the place to start is the `net/mac80211/Makefile`. It's almost always the central point for managing the compilation of the `mac80211` subsystem, especially when considering the intricate dependencies involved. I anticipate this file will dictate how the various modules are compiled, linked, and installed within the kernel, and will likely provide insights into customization options and build flags. This is where the magic happens. |
| 18/2 | 2026/10/15 07:08 | tool | read-file |
0mArgs:{
"File": "net/mac80211/Makefile",
"FirstLine": 1,
"LineCount": 20
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0\n 2:\tobj-$(CONFIG_MAC80211) += mac80211.o\n 3:\t\n 4:\t# mac80211 objects\n 5:\tmac80211-y := \\\n 6:\t\tmain.o status.o \\\n 7:\t\tdriver-ops.o \\\n 8:\t\tsta_info.o \\\n 9:\t\twep.o \\\n 10:\t\taead_api.o \\\n 11:\t\twpa.o \\\n 12:\t\tscan.o offchannel.o \\\n 13:\t\tht.o agg-tx.o agg-rx.o \\\n 14:\t\tvht.o \\\n 15:\t\the.o \\\n 16:\t\ts1g.o \\\n 17:\t\tibss.o \\\n 18:\t\tiface.o \\\n 19:\t\tlink.o \\\n 20:\t\trate.o \\\n"
} |
| 19/2 | 2026/10/15 07:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 50117 output: 37 thoughts: 19 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Diving Back into the `net/mac80211/Makefile`** Right, let's circle back and take a look at the rest of the `net/mac80211/Makefile`. We've covered the core bits, the build flags, the dependency inclusions, and the core object definitions, but I know there's more there, and experience tells me there's usually a trove of interesting tidbits that are easily missed unless you really dig in. I need to refresh my memory on the handling of specific drivers, particularly how conditional compilation is managed and how different chipsets and features are brought into the build. I'm keen to examine how the Makefile handles device-specific quirks and optimizations, and how it deals with the ever-present challenge of cross-compilation and module loading. I'm also curious to see how the build system manages optional features and debug settings. What's the process for selecting which features are built when? What kind of clever hacks or optimizations might I find? Finally, given the scale and complexity of this area, I'm expecting some well-crafted abstractions or macros to avoid repetition, so let's see how well they did, and where they might be improved. I'm looking for the elegance and the warts – it's all part of the game. Let's see if we can find some hidden gems. |
| 20/2 | 2026/10/15 07:08 | tool | read-file |
0mArgs:{
"File": "net/mac80211/Makefile",
"FirstLine": 21,
"LineCount": 25
}Results: {
"Contents": " 21:\t\ttkip.o \\\n 22:\t\taes_cmac.o \\\n 23:\t\taes_gmac.o \\\n 24:\t\tfils_aead.o \\\n 25:\t\tcfg.o \\\n 26:\t\tethtool.o \\\n 27:\t\trx.o \\\n 28:\t\tspectmgmt.o \\\n 29:\t\ttx.o \\\n 30:\t\tkey.o \\\n 31:\t\tutil.o parse.o \\\n 32:\t\twme.o \\\n 33:\t\tchan.o ap.o \\\n 34:\t\ttrace.o mlme.o \\\n 35:\t\ttdls.o \\\n 36:\t\tocb.o \\\n 37:\t\tairtime.o \\\n 38:\t\teht.o uhr.o nan.o\n 39:\t\n 40:\tmac80211-$(CONFIG_MAC80211_LEDS) += led.o\n 41:\tmac80211-$(CONFIG_MAC80211_DEBUGFS) += \\\n 42:\t\tdebugfs.o \\\n 43:\t\tdebugfs_sta.o \\\n 44:\t\tdebugfs_netdev.o \\\n 45:\t\tdebugfs_key.o\n"
} |
| 21/2 | 2026/10/15 07:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 50820 output: 36 thoughts: 114 Thoughts: **Investigating the Core Wireless Stack Compilation** Okay, so I'm digging into how the wireless stack compiles, specifically looking at how things are linked together. It's clear that with `CONFIG_CFG80211` and `CONFIG_MAC80211` enabled, we're getting `net/wireless/nl80211.c` and a bunch of files from `net/mac80211/` compiled in. That makes sense; `nl80211` handles the userspace interface, and `mac80211` is the core MAC layer. But what about when `CONFIG_MAC80211_HWSIM` comes into play? I need to understand what pieces are affected. That's when it gets interesting. I need to trace this dependency and see how the hardware simulation integrates into the broader picture. My next step is to head over to `drivers/net/wireless/virtual/Kconfig` to see how the simulation module is defined and, more importantly, its dependencies. This should tell me what else gets pulled in or excluded when using this simulation setup. |
| 22/2 | 2026/10/15 07:08 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/Kconfig",
"FirstLine": 1,
"LineCount": 20
}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"
} |
| 23/2 | 2026/10/15 07:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 51541 output: 27 thoughts: 64 Thoughts: Okay, here's my take on those dependencies, from an expert's perspective: **Thinking Through the MAC80211 HWSIM Landscape** Right, so `MAC80211_HWSIM` – that simulated hardware environment – it's built on top of `MAC80211`, no surprise there. And `MAC80211`, in turn, relies on `CFG80211`. That's the core wireless configuration and regulatory interface, so that makes perfect sense. But I need to go a bit broader in the context of the whole networking stack to make sure I'm not missing anything. I need to make sure I'm not overlooking any underlying dependencies. Now, what about the more fundamental network configurations like `CONFIG_NET` and `CONFIG_WIRELESS`? Those are the real base layers, the foundational flags. I should really make sure those are properly set to support everything. Okay, time to consult the source. Let's dig into `net/Kconfig` and see how the wireless options are defined. I'll check how `MAC80211_HWSIM` is guarded and trace its dependencies to make sure there are no other subtle requirements lurking that need attention. It's always the hidden stuff that bites you. |
| 24/2 | 2026/10/15 07:09 | tool | grepper |
0mArgs:{
"Expression": "WIRELESS",
"PathPrefixes": [
"net/Kconfig"
]
}Results: {
"Output": "net/Kconfig=422=config FIB_RULES\n--\nnet/Kconfig-424-\nnet/Kconfig:425:menuconfig WIRELESS\nnet/Kconfig-426-\tbool \"Wireless\"\n--\nnet/Kconfig-429-\nnet/Kconfig:430:if WIRELESS\nnet/Kconfig-431-\n--\nnet/Kconfig=433=source \"net/mac80211/Kconfig\"\nnet/Kconfig-434-\nnet/Kconfig:435:endif # WIRELESS\nnet/Kconfig-436-\n"
} |
| 25/2 | 2026/10/15 07:09 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 52075 output: 355 thoughts: 956 Thoughts: **QoS Management in Wireless Networking: A Fuzzing Target** Okay, let's break this down. My initial assessment is that the `menuconfig WIRELESS` guards both `net/wireless/Kconfig` and `net/mac80211/Kconfig`, which directly implicates `CFG80211` and `MAC80211`. More specifically, `MAC80211_HWSIM` is crucial here because it provides the virtual devices, such as those that can be used in QEMU. Then, my attention is drawn to `nl80211_qos_mgmt_cfg`. Specifically, I note that if `wdev->iftype != NL80211_IFTYPE_AP` it results in `-EOPNOTSUPP`. Given syzkaller's ability to create simulated WiFi devices with `mac80211_hwsim`, and configure them as AP interfaces using `NL80211_CMD_SET_INTERFACE` or `NL80211_CMD_NEW_INTERFACE` and `NL80211_IFTYPE_AP`, I confirm that the `NL80211_CMD_QOS_MGMT` requires `GENL_UNS_ADMIN_PERM`, which syzkaller's user namespaces readily support. Therefore, the core configurations I need to focus on are: `NET`, `WIRELESS`, `CFG80211`, `MAC80211`, and `MAC80211_HWSIM`. I'll quickly check for other dependencies, though I'm fairly certain I'm on the right track. `NET` is standard. Let's revisit `CFG80211`: it depends on `RFKILL || !RFKILL`, and selects `FW_LOADER` and `CRC32`. `MAC80211` depends on `CFG80211`, and `MAC80211_HWSIM` depends on `MAC80211`, of course. Now, let's review the critical symbols: `nl80211_qos_mgmt_cfg`, `nl80211_parse_qm_desc`, `nl80211_parse_qm_tclas`, `nl80211_parse_qm_qos_attr`, `ieee80211_set_qos_mgmt_cfg`, `ieee80211_qos_mgmt_cfg`, `ieee80211_qos_mgmt_update_scs`, `ieee80211_qos_mgmt_update_mscs`, `ieee80211_qos_mgmt_mscs_set_mark`, and `ieee80211_qos_mgmt_set_priority`. None of these are ubiquitous kernel primitives. They are all very specific to QoS Management within the wireless stack (nl80211 / mac80211). That's a strong indicator. To recap and solidify, this patch introduces a new Netlink command, `NL80211_CMD_QOS_MGMT`, and implements QoS Management (SCS / MSCS) across `nl80211`, `cfg80211`, and `mac80211`. The handler parses nested attributes from userspace, allocates kernel structures, and manipulates RCU-protected station QoS structures. It also touches packet RX and TX paths. Crucially, the code is reachable from userspace (unprivileged users in a user namespace with `CAP_NET_ADMIN` via `GENL_UNS_ADMIN_PERM`) and can be fuzzed using `mac80211_hwsim` in QEMU. This makes fuzzing very appropriate, as it's likely to uncover memory leaks, state desynchronization, RCU bugs, and null pointer dereferences. This is a clear fuzzing target. Let's get the results set. |
| 26/2 | 2026/10/15 07:09 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"WIRELESS"
],
"FocusSymbols": [
"nl80211_qos_mgmt_cfg",
"nl80211_parse_qm_desc",
"nl80211_parse_qm_tclas",
"nl80211_parse_qm_qos_attr",
"ieee80211_set_qos_mgmt_cfg",
"ieee80211_qos_mgmt_cfg",
"ieee80211_qos_mgmt_update_scs",
"ieee80211_qos_mgmt_update_mscs",
"ieee80211_qos_mgmt_mscs_set_mark",
"ieee80211_qos_mgmt_set_priority"
],
"Reasoning": "The patch introduces a new Netlink command NL80211_CMD_QOS_MGMT and support for QoS Management (SCS and MSCS) across cfg80211 and mac80211. It adds complex nested Netlink attribute parsers, dynamic memory allocations, RCU-managed per-station QoS state updates, and hooks in both RX and TX data paths. This code is reachable from userspace in standard QEMU virtualized environments via mac80211_hwsim and warrants fuzzing.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"WIRELESS"
],
"FocusSymbols": [
"nl80211_qos_mgmt_cfg",
"nl80211_parse_qm_desc",
"nl80211_parse_qm_tclas",
"nl80211_parse_qm_qos_attr",
"ieee80211_set_qos_mgmt_cfg",
"ieee80211_qos_mgmt_cfg",
"ieee80211_qos_mgmt_update_scs",
"ieee80211_qos_mgmt_update_mscs",
"ieee80211_qos_mgmt_mscs_set_mark",
"ieee80211_qos_mgmt_set_priority"
],
"Reasoning": "The patch introduces a new Netlink command NL80211_CMD_QOS_MGMT and support for QoS Management (SCS and MSCS) across cfg80211 and mac80211. It adds complex nested Netlink attribute parsers, dynamic memory allocations, RCU-managed per-station QoS state updates, and hooks in both RX and TX data paths. This code is reachable from userspace in standard QEMU virtualized environments via mac80211_hwsim and warrants fuzzing.",
"WorthFuzzing": true
} |
| 27/1 | 2026/10/15 07:09 | action | If |
3mArgs:{
"WorthFuzzing": true
}Results: null |
| 28/2 | 2026/10/15 07:09 | agent | kmsan-evaluator |
3mModel:core Args: null Results: {
"KMSANReasoning": "The patch series adds support for QoS Management (Stream Classification Service / Mirrored SCS) configuration via nl80211 (NL80211_CMD_QOS_MGMT), implementing request parsing, response generation, mac80211 state management, and packet priority tagging.\n\nKMSAN vs KASAN Applicability:\n1. Heap and Stack Initialization: All newly introduced or modified structures and arrays are explicitly zero-initialized. Specifically, `struct cfg80211_qm_req_data qm_req` and `struct cfg80211_qm_resp_data qm_resp` on the stack are initialized with `= {}`. Dynamic buffers (`qm_req.qm_req_desc`, `qm_req_desc-\u003etclas`, and `qm_resp.qm_resp_desc`) are allocated with `kzalloc_objs()`. The RCU-managed per-station state (`new_qos`) is allocated with `kzalloc_obj()`.\n2. Kernel-to-User Info-leaks: The response message returned to userspace via Netlink (`nl80211_qm_send_resp`) only serializes discrete, fully-initialized fields (`qm_id` and `status` via `nla_put_u8`, and `peer_mac` via `nla_put` from validated input). Netlink's attribute reservation (`__nla_reserve`) explicitly zero-pads attributes. No kernel structs or padding bytes are copied raw to userspace.\n3. Fast-path packet processing: The RX mark setting (`ieee80211_qos_mgmt_mscs_set_mark`) and TX priority classification (`ieee80211_qos_mgmt_set_priority`) only read already-initialized packet fields (`skb-\u003emark`, `skb-\u003epriority`) and verified fields within the zero-initialized RCU QoS structure.\n4. Bugs that could potentially arise in this code (such as array out-of-bounds indexing, NULL pointer dereferences, RCU/lockdep locking inconsistencies, or memory leaks on early parse failures) are already detected by KASAN, LOCKDEP, and KMEMLEAK under the standard configuration.\n\nSince no uninitialized memory risks or uninitialized info-leaks are introduced, a dedicated KMSAN fuzzing session is not justified.",
"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 76cb85b08d3003181c80b3ef3091595db6ef5519
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 15 07:06:58 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 66f9ebe79c618..f235059cbebd4 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1821,6 +1821,7 @@ enum ieee80211_eid_ext {
WLAN_EID_EXT_SHORT_SSID_LIST = 58,
WLAN_EID_EXT_HE_6GHZ_CAPA = 59,
WLAN_EID_EXT_UL_MU_POWER_CAPA = 60,
+ WLAN_EID_EXT_MSCS_DESCRIPTOR = 88,
WLAN_EID_EXT_EHT_OPERATION = 106,
WLAN_EID_EXT_EHT_MULTI_LINK = 107,
WLAN_EID_EXT_EHT_CAPABILITY = 108,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f773856c18181..74abe25bb107a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4860,6 +4860,216 @@ struct cfg80211_update_owe_info {
u8 peer_mld_addr[ETH_ALEN] __aligned(2);
};
+/* QoS Management IP address lengths */
+#define QM_IPV4_LEN 4
+#define QM_IPV6_LEN 16
+
+/**
+ * enum cfg80211_qm_ip_version - IP protocol version identifiers used in
+ * QoS Management traffic classification
+ * @QM_IP_VERSION_4: Internet Protocol version 4 (IPv4)
+ * @QM_IP_VERSION_6: Internet Protocol version 6 (IPv6)
+ */
+enum cfg80211_qm_ip_version {
+ QM_IP_VERSION_4 = 4,
+ QM_IP_VERSION_6 = 6,
+};
+
+/**
+ * struct cfg80211_qm_tclas4_params - TCLAS classifier type 4 parameters
+ * @classifier_mask: bitmask indicating which fields are used for
+ * classification; the version bit is mandatory and the remaining bits
+ * identify fields used for classification, as defined by
+ * &enum nl80211_qm_tclas_type4_mask
+ * @ip_ver: IP version of @src_ip / @dst_ip
+ * @src_ip: source IP address (IPv4 or IPv6)
+ * @dst_ip: destination IP address (IPv4 or IPv6)
+ * @src_port: source port number
+ * @dst_port: destination port number
+ * @dscp: Differentiated Services Code Point
+ * @protocol: IP protocol number, valid for IPv4 only
+ * @next_header: next header field, valid for IPv6 only
+ * @flow_label: flow label, valid for IPv6 only
+ */
+struct cfg80211_qm_tclas4_params {
+ u8 classifier_mask;
+ enum cfg80211_qm_ip_version ip_ver;
+ union {
+ u8 ipv4[QM_IPV4_LEN];
+ u8 ipv6[QM_IPV6_LEN];
+ } src_ip;
+ union {
+ u8 ipv4[QM_IPV4_LEN];
+ u8 ipv6[QM_IPV6_LEN];
+ } dst_ip;
+ u16 src_port;
+ u16 dst_port;
+ u8 dscp;
+ u8 protocol;
+ u8 next_header;
+ u8 flow_label[NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN];
+};
+
+/**
+ * struct cfg80211_qm_tclas10_params - TCLAS classifier type 10 parameters
+ * @protocol_instance: protocol instance identifier
+ * @protocol_number: protocol number
+ * @filter_value: filter value bytes
+ * @filter_mask: filter mask bytes
+ * @filter_len: length of @filter_value / @filter_mask
+ */
+struct cfg80211_qm_tclas10_params {
+ u8 protocol_instance;
+ u8 protocol_number;
+ u8 filter_value[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];
+ u8 filter_mask[NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN];
+ u8 filter_len;
+};
+
+/**
+ * struct cfg80211_qm_tclas_elements - a single TCLAS element
+ * @up: user priority
+ * @classifier_type: classifier type, see
+ * &enum nl80211_qm_tclas_classifier_type
+ * @tclas_elem: classifier-specific parameters
+ */
+struct cfg80211_qm_tclas_elements {
+ u8 up;
+ enum nl80211_qm_tclas_classifier_type classifier_type;
+ union {
+ struct cfg80211_qm_tclas4_params type4_params;
+ struct cfg80211_qm_tclas10_params type10_params;
+ } tclas_elem;
+};
+
+/**
+ * struct cfg80211_qm_qos_attributes - QoS attributes of a QoS Management
+ * request
+ * @direction: traffic direction, see &enum nl80211_qm_direction
+ * @tid: traffic identifier
+ * @up: user priority
+ * @bitmap: TID/UP bitmap
+ * @link_id: link identifier
+ * @min_service_interval: minimum service interval, in microseconds
+ * @max_service_interval: maximum service interval, in microseconds
+ * @min_data_rate: minimum data rate, in kbps
+ * @delay_bound: delay bound, in microseconds
+ * @max_msdu_size: maximum MSDU size, in bytes
+ * @service_start_time: service start time, in microseconds
+ * @service_start_time_link_id: link ID for @service_start_time
+ * @mean_data_rate: mean data rate, in kbps
+ * @burst_size: burst size, in bytes
+ * @msdu_lifetime: MSDU lifetime, in milliseconds
+ * @msdu_delivery_ratio: MSDU delivery ratio
+ * @msdu_count_exponent: MSDU count exponent
+ * @medium_time: medium time, in units of 32 microseconds
+ */
+struct cfg80211_qm_qos_attributes {
+ enum nl80211_qm_direction direction;
+ u8 tid;
+ u8 up;
+ u16 bitmap;
+ u8 link_id;
+ u32 min_service_interval;
+ u32 max_service_interval;
+ u32 min_data_rate;
+ u32 delay_bound;
+ u16 max_msdu_size;
+ u32 service_start_time;
+ u8 service_start_time_link_id;
+ u32 mean_data_rate;
+ u32 burst_size;
+ u16 msdu_lifetime;
+ u8 msdu_delivery_ratio;
+ u8 msdu_count_exponent;
+ u16 medium_time;
+};
+
+/**
+ * struct cfg80211_qm_req_desc_data - a single QoS Management request
+ * descriptor
+ * @qm_id: identifier for this descriptor within the request
+ * @request_type: request type, see &enum nl80211_qm_req_type
+ * @priority: SCS descriptor priority
+ * @num_tclas_elements: number of entries in @tclas
+ * @tclas: SCS TCLAS elements used for traffic classification
+ * @tclas_processing: SCS TCLAS processing rule, see
+ * &enum nl80211_qm_tclas_processing
+ * @is_qos_present: whether @qos_attr is populated
+ * @qos_attr: SCS QoS attributes associated with this descriptor
+ * @user_priority_bitmap: user priority bitmap of TID values sent by the
+ * non-AP STA in an MSCS request
+ * @user_priority_limit: user priority limit sent by the non-AP STA in an
+ * MSCS request
+ * @tclas_mask: traffic classifier mask with a bitmap of parameters to
+ * match in an uplink flow for downlink prioritization
+ */
+struct cfg80211_qm_req_desc_data {
+ u8 qm_id;
+ enum nl80211_qm_req_type request_type;
+ u8 priority;
+ unsigned int num_tclas_elements;
+ struct cfg80211_qm_tclas_elements *tclas;
+ enum nl80211_qm_tclas_processing tclas_processing;
+ bool is_qos_present;
+ struct cfg80211_qm_qos_attributes qos_attr;
+ u8 user_priority_bitmap;
+ u8 user_priority_limit;
+ u8 tclas_mask;
+};
+
+/**
+ * struct cfg80211_qm_req_data - a complete QoS Management request for a
+ * peer
+ * @peer_mac: MAC address of the peer
+ * @qm_type: QoS Management protocol, see &enum nl80211_qm_type
+ * @num_qm_desc: number of entries in @qm_req_desc
+ * @qm_req_desc: QoS Management request descriptors
+ *
+ * This is the parsed representation passed to the driver by the
+ * &struct cfg80211_ops.set_qos_mgmt_cfg callback. The descriptor and TCLAS
+ * arrays are owned by cfg80211 and are valid only for the duration of the
+ * callback. The driver must not retain these pointers after the callback
+ * returns.
+ */
+struct cfg80211_qm_req_data {
+ u8 peer_mac[ETH_ALEN];
+ enum nl80211_qm_type qm_type;
+ unsigned int num_qm_desc;
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+};
+
+/**
+ * struct cfg80211_qm_resp_desc_data - result of processing a single QoS
+ * Management request descriptor
+ * @qm_id: identifier matching the corresponding request descriptor
+ * @status: response status, see &enum nl80211_qm_status
+ */
+struct cfg80211_qm_resp_desc_data {
+ u8 qm_id;
+ enum nl80211_qm_status status;
+};
+
+/**
+ * struct cfg80211_qm_resp_data - a complete QoS Management response
+ * @qm_resp_desc: response descriptors corresponding to the request
+ *
+ * cfg80211 allocates and initializes one response descriptor for each
+ * request descriptor with the corresponding
+ * &struct cfg80211_qm_req_desc_data.qm_id and a declined status.
+ * The driver updates the status for each descriptor it processes. The
+ * response array is parallel to the request descriptor array: entry @i
+ * corresponds to request descriptor @i, and the driver must update entries
+ * in place without reordering them. The initialized @qm_id values must be
+ * left unchanged. The response array is valid only for the duration of the
+ * callback and must not be retained by the driver.
+ * cfg80211/nl80211 supplies the peer address and protocol type from the
+ * request when it builds the reply.
+ */
+struct cfg80211_qm_resp_data {
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc;
+};
+
/**
* struct mgmt_frame_regs - management frame registrations data
* @global_stypes: bitmap of management frame subtypes registered
@@ -5332,6 +5542,13 @@ struct mgmt_frame_regs {
*
* @start_pd: Start the PD interface.
* @stop_pd: Stop the PD interface.
+ *
+ * @set_qos_mgmt_cfg: Configure QoS Management (QM) parameters such as
+ * traffic classification (TCLAS) and QoS attributes for a station. The
+ * request has already been parsed from the nested nl80211 attributes.
+ * The driver or firmware applies the protocol-specific configuration and
+ * populates the response structure with a status for each descriptor.
+ * This callback provides the control-path interface for the driver.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5730,6 +5947,9 @@ struct cfg80211_ops {
bool val);
int (*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
void (*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev);
+ int (*set_qos_mgmt_cfg)(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
};
/*
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a1a6409b44c12..a610d6eb92b4e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4760,6 +4760,9 @@ struct ieee80211_prep_tx_info {
* @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
* driver according to the parameter received in the EML Operating mode
* notification frame.
+ * @qos_mgmt_cfg: Configure QoS Management (QM) for a station. The request
+ * contains SCS or MSCS parameters, and the driver populates the
+ * per-descriptor response status.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5173,6 +5176,10 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_eml_params *eml_params);
+ int (*qos_mgmt_cfg)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b56a96f57bec2..4106fe6629454 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1468,6 +1468,10 @@
* and multiple can be nested in %NL80211_ATTR_MLO_LINKS but then the
* update isn't atomic if any failures happen.
* Only supported with %NL80211_EXT_FEATURE_UPDATE_BEACON.
+ * @NL80211_CMD_QOS_MGMT: QoS Management configuration for a station. Used
+ * by userspace to send QoS Management (QM) requests and to receive the
+ * corresponding status response via %NL80211_ATTR_QOS_MGMT.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1750,6 +1754,8 @@ enum nl80211_commands {
NL80211_CMD_UPDATE_BEACON,
+ NL80211_CMD_QOS_MGMT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3243,6 +3249,13 @@ enum nl80211_commands {
* @NL80211_ATTR_ASSOC_PROTECTED_TWT: Enable protected TWT for the association,
* requires protected TWT support (flag attribute)
*
+ * @NL80211_ATTR_QOS_MGMT: Used with %NL80211_CMD_QOS_MGMT to configure
+ * QoS Management (QM) features for a station. The nested payload is
+ * described by &enum nl80211_qm_attrs. It contains a nested array of
+ * &enum nl80211_qm_desc_attrs entries; SCS TCLAS and QoS attributes use
+ * &enum nl80211_qm_tclas_attrs and &enum nl80211_qm_qos_attrs,
+ * respectively.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3850,6 +3863,8 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_PROTECTED_TWT,
+ NL80211_ATTR_QOS_MGMT,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -9200,4 +9215,333 @@ enum nl80211_nan_peer_map_attrs {
#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff
+#define NL80211_IPADDR_MAX_LEN 16
+#define NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN 12
+#define NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN 3
+
+/*
+ * The TCLAS element (reference 9.4.2.29, IEEE Std 802.11-2024) is used by
+ * SCS for traffic classification.
+ */
+/**
+ * enum nl80211_qm_tclas_type4_attrs - TCLAS classifier type 4 attributes
+ *
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK: Classifier mask (u8), see
+ * &enum nl80211_qm_tclas_type4_mask
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION: IP version, 4 or 6 (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP: Source IP address
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP: Destination IP address
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT: Source port (u16)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT: Destination port (u16)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_DSCP: DSCP value, 0-63 (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL: IP protocol number, IPv4 only (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER: Next header, IPv6 only (u8)
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL: Flow label, IPv6 only
+ * @__NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_TYPE4_ATTR_MAX: highest type 4 attribute number currently
+ * defined
+ */
+enum nl80211_qm_tclas_type4_attrs {
+ NL80211_QM_TCLAS_TYPE4_ATTR_INVALID,
+ NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK,
+ NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION,
+ NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT,
+ NL80211_QM_TCLAS_TYPE4_ATTR_DSCP,
+ NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL,
+ NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER,
+ NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_TYPE4_ATTR_MAX =
+ __NL80211_QM_TCLAS_TYPE4_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_type10_attrs - TCLAS classifier type 10 attributes
+ *
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE: Protocol instance (u8)
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER: Protocol number (u8)
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE: Filter value bytes
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK: Filter mask bytes
+ * @__NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_TYPE10_ATTR_MAX: highest type 10 attribute number currently
+ * defined
+ */
+enum nl80211_qm_tclas_type10_attrs {
+ NL80211_QM_TCLAS_TYPE10_ATTR_INVALID,
+ NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE,
+ NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER,
+ NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE,
+ NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_TYPE10_ATTR_MAX =
+ __NL80211_QM_TCLAS_TYPE10_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_attrs - TCLAS element attributes
+ *
+ * @NL80211_QM_TCLAS_ATTR_INVALID: Invalid
+ * @NL80211_QM_TCLAS_ATTR_USER_PRIORITY: User priority, 0-7 (u8)
+ * @NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE: Classifier type, 4 or 10 (u8)
+ * @NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS: Nested type 4 classifier params, see
+ * &enum nl80211_qm_tclas_type4_attrs
+ * @NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS: Nested type 10 classifier params, see
+ * &enum nl80211_qm_tclas_type10_attrs
+ * @__NL80211_QM_TCLAS_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_TCLAS_ATTR_MAX: highest TCLAS attribute number currently defined
+ */
+enum nl80211_qm_tclas_attrs {
+ NL80211_QM_TCLAS_ATTR_INVALID,
+ NL80211_QM_TCLAS_ATTR_USER_PRIORITY,
+ NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE,
+ NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS,
+ NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS,
+
+ /* keep last */
+ __NL80211_QM_TCLAS_ATTR_AFTER_LAST,
+ NL80211_QM_TCLAS_ATTR_MAX = __NL80211_QM_TCLAS_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_tclas_classifier_type - TCLAS classifier type values sent
+ * in %NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE
+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE4: Classifier type 4, 5-tuple based;
+ * reference 9.4.2.29, IEEE Std 802.11-2024.
+ * @NL80211_QM_TCLAS_CLASSIFIER_TYPE10: Classifier type 10, filter based;
+ * reference 9.4.2.29, IEEE Std 802.11-2024.
+ *
+ * The SCS interface currently supports only classifier types 4 and 10.
+ */
+enum nl80211_qm_tclas_classifier_type {
+ NL80211_QM_TCLAS_CLASSIFIER_TYPE4 = 4,
+ NL80211_QM_TCLAS_CLASSIFIER_TYPE10 = 10,
+};
+
+/**
+ * enum nl80211_qm_tclas_type4_mask - classifier mask bits for TCLAS type 4
+ * @NL80211_QM_TCLAS_TYPE4_MASK_VERSION: IP version field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_IP: source IP address
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_IP: destination IP address
+ * @NL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT: source port
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DST_PORT: destination port
+ * @NL80211_QM_TCLAS_TYPE4_MASK_DSCP: DSCP field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL: protocol / next-header field
+ * @NL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL: IPv6 flow label
+ */
+enum nl80211_qm_tclas_type4_mask {
+ NL80211_QM_TCLAS_TYPE4_MASK_VERSION = 1 << 0,
+ NL80211_QM_TCLAS_TYPE4_MASK_SRC_IP = 1 << 1,
+ NL80211_QM_TCLAS_TYPE4_MASK_DST_IP = 1 << 2,
+ NL80211_QM_TCLAS_TYPE4_MASK_SRC_PORT = 1 << 3,
+ NL80211_QM_TCLAS_TYPE4_MASK_DST_PORT = 1 << 4,
+ NL80211_QM_TCLAS_TYPE4_MASK_DSCP = 1 << 5,
+ NL80211_QM_TCLAS_TYPE4_MASK_PROTOCOL = 1 << 6,
+ NL80211_QM_TCLAS_TYPE4_MASK_FLOW_LABEL = 1 << 7,
+};
+
+/**
+ * enum nl80211_qm_tclas_processing - TCLAS processing rules
+ *
+ * Processing field values are defined in 9.4.2.31, IEEE Std 802.11-2024.
+ *
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL: all TCLAS elements must match
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ANY: any TCLAS element may match
+ * @NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST: all except the first
+ * must match
+ */
+enum nl80211_qm_tclas_processing {
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL = 0,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ANY = 1,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST = 2,
+};
+
+/**
+ * enum nl80211_qm_qos_attrs - QoS Management QoS attributes
+ *
+ * The QoS Characteristics element is specified in 9.4.2.326,
+ * IEEE Std 802.11be-2024.
+ *
+ * @NL80211_QM_QOS_ATTR_INVALID: Invalid
+ * @NL80211_QM_QOS_ATTR_CONTROL_INFO: QoS characteristics control info (u32)
+ * @NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL: Minimum service interval, us (u32)
+ * @NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL: Maximum service interval, us (u32)
+ * @NL80211_QM_QOS_ATTR_MIN_DATA_RATE: Minimum data rate, kbps (u32)
+ * @NL80211_QM_QOS_ATTR_DELAY_BOUND: Delay bound, us (u32)
+ * @NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE: Maximum MSDU size, bytes (u16)
+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME: Service start time, us (u32)
+ * @NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID: Link ID for service start
+ * time (u8)
+ * @NL80211_QM_QOS_ATTR_MEAN_DATA_RATE: Mean data rate, kbps (u32)
+ * @NL80211_QM_QOS_ATTR_BURST_SIZE: Burst size, bytes (u32)
+ * @NL80211_QM_QOS_ATTR_MSDU_LIFETIME: MSDU lifetime, ms (u16)
+ * @NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO: MSDU delivery ratio and count
+ * exponent (u8)
+ * @NL80211_QM_QOS_ATTR_MEDIUM_TIME: Medium time, 32 us units (u16)
+ * @__NL80211_QM_QOS_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_QOS_ATTR_MAX: highest QoS attribute number currently defined
+ */
+enum nl80211_qm_qos_attrs {
+ NL80211_QM_QOS_ATTR_INVALID,
+ NL80211_QM_QOS_ATTR_CONTROL_INFO,
+ NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL,
+ NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL,
+ NL80211_QM_QOS_ATTR_MIN_DATA_RATE,
+ NL80211_QM_QOS_ATTR_DELAY_BOUND,
+ NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE,
+ NL80211_QM_QOS_ATTR_SVC_START_TIME,
+ NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID,
+ NL80211_QM_QOS_ATTR_MEAN_DATA_RATE,
+ NL80211_QM_QOS_ATTR_BURST_SIZE,
+ NL80211_QM_QOS_ATTR_MSDU_LIFETIME,
+ NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO,
+ NL80211_QM_QOS_ATTR_MEDIUM_TIME,
+
+ /* keep last */
+ __NL80211_QM_QOS_ATTR_AFTER_LAST,
+ NL80211_QM_QOS_ATTR_MAX = __NL80211_QM_QOS_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_desc_attrs - QoS Management descriptor attributes
+ *
+ * @NL80211_QM_DESC_ATTR_INVALID: Invalid
+ * @NL80211_QM_DESC_ATTR_QM_ID: Userspace-assigned identifier (u8) used
+ * to correlate a request descriptor with its response descriptor
+ * @NL80211_QM_DESC_ATTR_REQUEST_TYPE: Request type, see
+ * &enum nl80211_qm_req_type (u8)
+ * @NL80211_QM_DESC_ATTR_PRIORITY: SCS descriptor priority (u8)
+ * @NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS: Nested array of SCS TCLAS elements,
+ * see &enum nl80211_qm_tclas_attrs
+ * @NL80211_QM_DESC_ATTR_TCLAS_PROCESSING: SCS TCLAS processing rule (u8),
+ * see &enum nl80211_qm_tclas_processing
+ * @NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES: Nested SCS QoS attributes, see
+ * &enum nl80211_qm_qos_attrs
+ * @NL80211_QM_DESC_ATTR_STATUS: Response status for this descriptor (u8),
+ * see &enum nl80211_qm_status
+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP: MSCS user priority bitmap of
+ * TID values sent by the non-AP STA (u8)
+ * @NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT: MSCS user priority limit sent
+ * by the non-AP STA (u8)
+ * @NL80211_QM_DESC_ATTR_TCLAS_MASK: MSCS traffic classifier mask with a
+ * bitmap of parameters to match in an uplink flow for downlink
+ * prioritization (u8)
+ * @__NL80211_QM_DESC_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_DESC_ATTR_MAX: highest QoS Management descriptor attribute
+ * number currently defined
+ */
+enum nl80211_qm_desc_attrs {
+ NL80211_QM_DESC_ATTR_INVALID,
+ NL80211_QM_DESC_ATTR_QM_ID,
+ NL80211_QM_DESC_ATTR_REQUEST_TYPE,
+ NL80211_QM_DESC_ATTR_PRIORITY,
+ NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS,
+ NL80211_QM_DESC_ATTR_TCLAS_PROCESSING,
+ NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES,
+ NL80211_QM_DESC_ATTR_STATUS,
+ NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP,
+ NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT,
+ NL80211_QM_DESC_ATTR_TCLAS_MASK,
+
+ /* keep last */
+ __NL80211_QM_DESC_ATTR_AFTER_LAST,
+ NL80211_QM_DESC_ATTR_MAX = __NL80211_QM_DESC_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_attrs - QoS Management attributes
+ *
+ * @NL80211_QM_ATTR_INVALID: Invalid
+ * @NL80211_QM_ATTR_MAC_ADDR: Target station MAC address (6 bytes)
+ * @NL80211_QM_ATTR_QM_TYPE: QoS Management protocol type, see
+ * &enum nl80211_qm_type (u8)
+ * @NL80211_QM_ATTR_DESCRIPTOR_PARAMS: Nested array of QM descriptors, see
+ * &enum nl80211_qm_desc_attrs
+ * @__NL80211_QM_ATTR_AFTER_LAST: internal use
+ * @NL80211_QM_ATTR_MAX: highest QoS Management attribute number currently
+ * defined
+ */
+enum nl80211_qm_attrs {
+ NL80211_QM_ATTR_INVALID,
+ NL80211_QM_ATTR_MAC_ADDR,
+ NL80211_QM_ATTR_QM_TYPE,
+ NL80211_QM_ATTR_DESCRIPTOR_PARAMS,
+
+ /* keep last */
+ __NL80211_QM_ATTR_AFTER_LAST,
+ NL80211_QM_ATTR_MAX = __NL80211_QM_ATTR_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_qm_type - QoS Management protocol types
+ * @NL80211_QM_TYPE_SCS: Stream Classification Service (SCS) protocol,
+ * reference 11.25.2, IEEE Std 802.11-2024.
+ * @NL80211_QM_TYPE_MSCS: Mirrored Stream Classification Service (MSCS)
+ * protocol, reference 11.25.3, IEEE Std 802.11-2024.
+ * @NL80211_QM_TYPE_MAX: Maximum value for QoS Management protocol types
+ *
+ * Enumerates the QoS Management protocols supported through the generic
+ * QoS Management (QM) request/response framework.
+ *
+ */
+enum nl80211_qm_type {
+ NL80211_QM_TYPE_SCS,
+ NL80211_QM_TYPE_MSCS,
+ /* Future QM protocols to be added here */
+ NL80211_QM_TYPE_MAX,
+};
+
+/**
+ * enum nl80211_qm_direction - QoS Management descriptor
+ * traffic direction
+ * @NL80211_QM_DIRECTION_UPLINK: Traffic direction is uplink, from the
+ * non-AP STA to the AP.
+ * @NL80211_QM_DIRECTION_DOWNLINK: Traffic direction is downlink, from
+ * the AP to the non-AP STA.
+ * @NL80211_QM_DIRECTION_DIRECT: Direct link traffic between STAs (P2P).
+ *
+ * Encodes the QoS characteristics element direction subfield, denoting
+ * which traffic direction a set of QoS attributes applies to. The QoS
+ * Characteristics element is specified in 9.4.2.326, IEEE Std 802.11be-2024.
+ */
+enum nl80211_qm_direction {
+ NL80211_QM_DIRECTION_UPLINK = 0,
+ NL80211_QM_DIRECTION_DOWNLINK = 1,
+ NL80211_QM_DIRECTION_DIRECT = 2,
+};
+
+/**
+ * enum nl80211_qm_req_type - QoS Management request types
+ * @NL80211_QM_ADD_REQ: Add a new QoS Management configuration
+ * @NL80211_QM_REMOVE_REQ: Remove an existing QoS Management configuration
+ * @NL80211_QM_CHANGE_REQ: Modify an existing QoS Management configuration
+ *
+ * Identifies the operation requested in a QoS Management transaction.
+ * Reference 11.25.2 and 11.25.3, IEEE Std 802.11-2024, for the operation
+ * values.
+ */
+enum nl80211_qm_req_type {
+ NL80211_QM_ADD_REQ,
+ NL80211_QM_REMOVE_REQ,
+ NL80211_QM_CHANGE_REQ,
+};
+
+/**
+ * enum nl80211_qm_status - QoS Management response status codes
+ * @NL80211_QM_STATUS_SUCCESS: request accepted
+ * @NL80211_QM_STATUS_DECLINED: request declined
+ */
+enum nl80211_qm_status {
+ NL80211_QM_STATUS_SUCCESS = 0,
+ NL80211_QM_STATUS_DECLINED = 1,
+};
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9608c07bcea7d..f66f736adb922 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -6309,6 +6309,18 @@ ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy,
return ieee80211_nan_set_non_evac_channels(sdata, channels);
}
+static int
+ieee80211_set_qos_mgmt_cfg(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+ lockdep_assert_wiphy(wiphy);
+
+ return ieee80211_qos_mgmt_cfg(sdata, qm_req, qm_resp);
+}
+
const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -6432,4 +6444,5 @@ const struct cfg80211_ops mac80211_config_ops = {
.nan_set_local_sched = ieee80211_set_local_nan_sched,
.nan_set_peer_sched = ieee80211_set_peer_nan_sched,
.nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels,
+ .set_qos_mgmt_cfg = ieee80211_set_qos_mgmt_cfg,
};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 83dd15f2daf62..f1dc9ca9f8f70 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1804,4 +1804,32 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,
return ret;
}
+static inline int
+drv_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_local *local, struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ if (!check_sdata_in_driver(sdata))
+ return ret;
+
+ /*
+ * Called only for SCS descriptors carrying a QoS Characteristics
+ * element (9.4.2.326, IEEE Std 802.11be-2024). Legacy SCS and MSCS
+ * are handled in mac80211.
+ */
+ trace_drv_qos_mgmt_cfg(local, sdata, sta, qm_req);
+ if (local->ops->qos_mgmt_cfg)
+ ret = local->ops->qos_mgmt_cfg(&local->hw, &sdata->vif,
+ sta, qm_req, qm_resp);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1a6cbbb5a17d8..aa36289b3ae4e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -80,6 +80,20 @@ struct ieee80211_mesh_fast_tx;
#define IEEE80211_DEFAULT_MAX_SP_LEN \
IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
+/*
+ * TODO: Synchronize this skb->mark encoding with the userspace application
+ * (hostapd). These values reuse IEEE element IDs, but their use in skb->mark
+ * is an implementation contract between hostapd/nftables and mac80211.
+ */
+/* skb->mark bits [7:0] carry a QoS Management protocol tag. The values
+ * match the IEEE Std 802.11-2024 element IDs for the respective descriptors:
+ * WLAN_EID_SCS_DESCRIPTOR (185) and WLAN_EID_EXT_MSCS_DESCRIPTOR (88).
+ */
+#define IEEE80211_QOS_MGMT_TAG_MASK GENMASK(7, 0)
+#define IEEE80211_QOS_MGMT_SCS_TAG WLAN_EID_SCS_DESCRIPTOR
+#define IEEE80211_QOS_MGMT_MSCS_TAG WLAN_EID_EXT_MSCS_DESCRIPTOR
+#define IEEE80211_QOS_MGMT_ID_MASK GENMASK(15, 8)
+
extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
@@ -3020,6 +3034,10 @@ ieee80211_uhr_cap_ie_to_sta_uhr_cap(struct ieee80211_sub_if_data *sdata,
u8 uhr_cap_len,
struct link_sta_info *link_sta);
+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp);
+
#if IS_ENABLED(CONFIG_MAC80211_KUNIT_TEST)
#define EXPORT_SYMBOL_IF_MAC80211_KUNIT(sym) EXPORT_SYMBOL_IF_KUNIT(sym)
#define VISIBLE_IF_MAC80211_KUNIT
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6ec45a9f72214..2d853cd1c18aa 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -12036,3 +12036,168 @@ void ieee80211_sta_rx_queued_frame(struct ieee80211_sub_if_data *sdata,
break;
}
}
+
+static void
+ieee80211_qos_mgmt_update_scs(struct ieee80211_sta_qos *qos,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ u8 tid;
+ int i;
+
+ if (qm_req->qm_type != NL80211_QM_TYPE_SCS)
+ return;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++) {
+ struct cfg80211_qm_req_desc_data *qm_req_desc =
+ &qm_req->qm_req_desc[i];
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc =
+ &qm_resp->qm_resp_desc[i];
+
+ if (qm_resp_desc->qm_id != qm_req_desc->qm_id ||
+ qm_resp_desc->status != NL80211_QM_STATUS_SUCCESS)
+ continue;
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_REMOVE_REQ:
+ clear_bit(qm_req_desc->qm_id, qos->active_scs_id);
+ break;
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ /*
+ * For legacy SCS the TID is derived from the UP
+ * field of the first TCLAS element (11.25.2, IEEE
+ * Std 802.11-2024). For 802.11be SCS the TID is
+ * taken from the QoS
+ * Characteristics element (9.4.2.326, IEEE Std
+ * 802.11be-2024).
+ */
+ if (qm_req_desc->is_qos_present)
+ tid = qm_req_desc->qos_attr.tid;
+ else if (qm_req_desc->num_tclas_elements > 0)
+ tid = qm_req_desc->tclas[0].up;
+ else
+ continue;
+
+ if (tid >= IEEE80211_QOS_MGMT_MAX_TID)
+ continue;
+
+ qos->scs_id_tid_mapping[qm_req_desc->qm_id] = tid;
+ set_bit(qm_req_desc->qm_id, qos->active_scs_id);
+ break;
+ default:
+ break;
+ }
+ }
+
+ qos->scs_enabled =
+ !bitmap_empty(qos->active_scs_id,
+ IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);
+}
+
+static void
+ieee80211_qos_mgmt_update_mscs(struct ieee80211_sta_qos *qos,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc;
+
+ qm_req_desc = &qm_req->qm_req_desc[0];
+ qm_resp_desc = &qm_resp->qm_resp_desc[0];
+
+ if (qm_resp_desc->qm_id != qm_req_desc->qm_id ||
+ qm_resp_desc->status != NL80211_QM_STATUS_SUCCESS)
+ return;
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ qos->mscs_user_priority_bitmap =
+ qm_req_desc->user_priority_bitmap;
+ qos->mscs_user_priority_limit =
+ qm_req_desc->user_priority_limit;
+ qos->mscs_enabled = true;
+ break;
+ case NL80211_QM_REMOVE_REQ:
+ qos->mscs_user_priority_bitmap = 0;
+ qos->mscs_user_priority_limit = 0;
+ qos->mscs_enabled = false;
+ break;
+ default:
+ break;
+ }
+}
+
+static bool
+ieee80211_qos_mgmt_has_qos_char(struct cfg80211_qm_req_data *qm_req)
+{
+ unsigned int i;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++) {
+ if (qm_req->qm_req_desc[i].is_qos_present)
+ return true;
+ }
+ return false;
+}
+
+int ieee80211_qos_mgmt_cfg(struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_sta_qos_rcu *new_qos = NULL;
+ struct ieee80211_sta_qos_rcu *old_qos;
+ struct sta_info *sta;
+ int ret;
+
+ if (sdata->vif.type != NL80211_IFTYPE_AP)
+ return -EOPNOTSUPP;
+
+ sta = sta_info_get_bss(sdata, qm_req->peer_mac);
+ if (!sta)
+ return -ENOENT;
+
+ if (qm_req->qm_type == NL80211_QM_TYPE_SCS ||
+ qm_req->qm_type == NL80211_QM_TYPE_MSCS) {
+ new_qos = kzalloc_obj(*new_qos);
+ if (!new_qos)
+ return -ENOMEM;
+
+ old_qos = rcu_dereference_protected(sta->qos,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (old_qos)
+ new_qos->data = old_qos->data;
+ }
+
+ /*
+ * SCS descriptors carrying a QoS Characteristics element
+ * (9.4.2.326, IEEE Std 802.11be-2024) require hardware-specific
+ * scheduling support; forward the request to the driver. Legacy
+ * SCS and MSCS are handled in mac80211.
+ */
+ if (ieee80211_qos_mgmt_has_qos_char(qm_req)) {
+ ret = drv_qos_mgmt_cfg(sdata, local, &sta->sta,
+ qm_req, qm_resp);
+ if (ret) {
+ kfree(new_qos);
+ return ret;
+ }
+ }
+
+ if (!new_qos)
+ return 0;
+
+ if (qm_req->qm_type == NL80211_QM_TYPE_SCS)
+ ieee80211_qos_mgmt_update_scs(&new_qos->data, qm_req,
+ qm_resp);
+ else
+ ieee80211_qos_mgmt_update_mscs(&new_qos->data, qm_req,
+ qm_resp);
+ old_qos = rcu_replace_pointer(sta->qos, new_qos,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (old_qos)
+ kfree_rcu(old_qos, rcu_head);
+
+ return 0;
+}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ecee9348c70d4..930de5b412c5d 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1003,6 +1003,31 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
rx->skb->priority = (tid > 7) ? 0 : tid;
}
+static void ieee80211_qos_mgmt_mscs_set_mark(struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_sta_qos_rcu *qos;
+ u8 tid;
+
+ if (!rx->sta ||
+ (rx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ rx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ rx->seqno_idx >= IEEE80211_QOS_MGMT_MAX_TID)
+ return;
+
+ tid = rx->skb->priority;
+
+ qos = rcu_dereference(rx->sta->qos);
+ if (!qos || !qos->data.mscs_enabled ||
+ !(BIT(tid) & qos->data.mscs_user_priority_bitmap))
+ return;
+
+ rx->skb->mark = u32_replace_bits(rx->skb->mark,
+ IEEE80211_QOS_MGMT_MSCS_TAG,
+ IEEE80211_QOS_MGMT_TAG_MASK);
+ rx->skb->mark = u32_replace_bits(rx->skb->mark, tid,
+ IEEE80211_QOS_MGMT_ID_MASK);
+}
+
/**
* DOC: Packet alignment
*
@@ -3333,6 +3358,9 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
rx->skb->dev = dev;
+ if (!port_control)
+ ieee80211_qos_mgmt_mscs_set_mark(rx);
+
if (!ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS) &&
local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 &&
!is_multicast_ether_addr(
@@ -4996,6 +5024,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
stats->packets++;
skb->dev = fast_rx->dev;
+ ieee80211_qos_mgmt_mscs_set_mark(rx);
dev_sw_netstats_rx_add(fast_rx->dev, skb->len);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 5c95ffee257d3..e714b719e2f1e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -467,8 +467,15 @@ static void sta_remove_link(struct sta_info *sta, unsigned int link_id,
*/
void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
{
+ struct ieee80211_sta_qos_rcu *qos;
int i;
+ lockdep_assert_wiphy(local->hw.wiphy);
+ qos = rcu_replace_pointer(sta->qos, NULL,
+ lockdep_is_held(&local->hw.wiphy->mtx));
+ if (qos)
+ kfree_rcu(qos, rcu_head);
+
for (i = 0; i < ARRAY_SIZE(sta->link); i++) {
struct link_sta_info *link_sta;
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 8942541375b27..68acd8fdc6718 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -16,10 +16,29 @@
#include <linux/average.h>
#include <linux/bitfield.h>
#include <linux/etherdevice.h>
+#include <linux/rcupdate.h>
#include <linux/rhashtable.h>
#include <linux/u64_stats_sync.h>
#include "key.h"
+/* SCS IDs are in the range 1-255; zero is reserved. */
+#define IEEE80211_QOS_MGMT_MAX_SCS_ID 255
+#define IEEE80211_QOS_MGMT_MAX_TID 8
+
+struct ieee80211_sta_qos {
+ bool scs_enabled;
+ bool mscs_enabled;
+ DECLARE_BITMAP(active_scs_id, IEEE80211_QOS_MGMT_MAX_SCS_ID + 1);
+ u8 scs_id_tid_mapping[IEEE80211_QOS_MGMT_MAX_SCS_ID + 1];
+ u8 mscs_user_priority_bitmap;
+ u8 mscs_user_priority_limit;
+};
+
+struct ieee80211_sta_qos_rcu {
+ struct rcu_head rcu_head;
+ struct ieee80211_sta_qos data;
+};
+
/**
* enum ieee80211_sta_info_flags - Stations flags
*
@@ -657,6 +676,7 @@ struct ieee80211_sta_removed_link_stats {
* @rate_ctrl_priv: rate control private per-STA pointer
* @lock: used for locking all fields that require locking, see comments
* in the header file.
+ * @qos: RCU-published QoS Management state
* @drv_deliver_wk: used for delivering frames after driver PS unblocking
* @listen_interval: listen interval of this station, when we're acting as AP
* @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
@@ -728,6 +748,7 @@ struct sta_info {
void *rate_ctrl_priv;
spinlock_t rate_ctrl_lock;
spinlock_t lock;
+ struct ieee80211_sta_qos_rcu __rcu *qos;
struct ieee80211_fast_tx __rcu *fast_tx;
struct ieee80211_fast_rx __rcu *fast_rx;
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index ea46c3cca21a3..ce69e5edd03f0 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3431,6 +3431,30 @@ TRACE_EVENT(drv_nan_peer_sched_changed,
)
);
+TRACE_EVENT(drv_qos_mgmt_cfg,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_qm_req_data *qm_req),
+ TP_ARGS(local, sdata, sta, qm_req),
+ TP_STRUCT__entry(LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u8, qm_type)
+ __field(unsigned int, num_qm_desc)
+ ),
+ TP_fast_assign(LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_NAMED_ASSIGN(sta);
+ __entry->qm_type = qm_req->qm_type;
+ __entry->num_qm_desc = qm_req->num_qm_desc;
+ ),
+ TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ " qm_type:%u num_qm_desc:%u",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
+ __entry->qm_type, __entry->num_qm_desc)
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 1601be5764145..feca08f281856 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -113,6 +113,52 @@ static u16 ieee80211_downgrade_queue(struct ieee80211_sub_if_data *sdata,
return ieee802_1d_to_ac[skb->priority];
}
+static void
+ieee80211_qos_mgmt_set_priority(struct sta_info *sta, struct sk_buff *skb)
+{
+ struct ieee80211_sta_qos_rcu *qos;
+ u8 qos_tag;
+ u8 qos_id;
+ u8 tid;
+
+ if (!sta)
+ return;
+
+ qos_tag = u32_get_bits(skb->mark, IEEE80211_QOS_MGMT_TAG_MASK);
+ qos_id = u32_get_bits(skb->mark, IEEE80211_QOS_MGMT_ID_MASK);
+ if (qos_tag != IEEE80211_QOS_MGMT_SCS_TAG &&
+ qos_tag != IEEE80211_QOS_MGMT_MSCS_TAG)
+ return;
+
+ if (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG && !qos_id)
+ return;
+
+ guard(rcu)();
+ qos = rcu_dereference(sta->qos);
+
+ if (!qos)
+ return;
+
+ if (qos_tag == IEEE80211_QOS_MGMT_SCS_TAG) {
+ if (!qos->data.scs_enabled ||
+ !test_bit(qos_id, qos->data.active_scs_id))
+ return;
+
+ tid = qos->data.scs_id_tid_mapping[qos_id];
+ } else {
+ if (!qos->data.mscs_enabled ||
+ qos_id >= IEEE80211_QOS_MGMT_MAX_TID ||
+ !(qos->data.mscs_user_priority_bitmap & BIT(qos_id)))
+ return;
+
+ tid = min_t(u8, qos_id,
+ qos->data.mscs_user_priority_limit);
+ }
+
+ if (tid < IEEE80211_QOS_MGMT_MAX_TID)
+ skb->priority = tid;
+}
+
/* Indicate which queue to use for this fully formed 802.11 frame */
u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb,
@@ -179,6 +225,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
qos_map = rcu_dereference(sdata->qos_map);
skb->priority = cfg80211_classify8021d(skb, qos_map ?
&qos_map->qos_map : NULL);
+ ieee80211_qos_mgmt_set_priority(sta, skb);
downgrade:
return ieee80211_downgrade_queue(sdata, sta, skb);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d790e204aee36..d77363a7ed176 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -798,6 +798,93 @@ static const struct netlink_range_validation q_range = {
.max = INT_MAX,
};
+static const struct nla_policy
+nl80211_qm_tclas_type4_policy[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] = { .type = NLA_BINARY,
+ .len = NL80211_IPADDR_MAX_LEN },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] = { .type = NLA_BINARY,
+ .len = NL80211_IPADDR_MAX_LEN },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] = { .type = NLA_U16 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] = { .type = NLA_U16 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_DSCP] = NLA_POLICY_MAX(NLA_U8, 63),
+ [NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL] =
+ NLA_POLICY_EXACT_LEN(NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN),
+};
+
+static const struct nla_policy
+nl80211_qm_tclas_type10_policy[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] = {
+ .type = NLA_BINARY,
+ .len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },
+ [NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK] = {
+ .type = NLA_BINARY,
+ .len = NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN },
+};
+
+static const struct nla_policy
+nl80211_qm_tclas_policy[NL80211_QM_TCLAS_ATTR_MAX + 1] = {
+ [NL80211_QM_TCLAS_ATTR_USER_PRIORITY] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
+ [NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE] = { .type = NLA_U8 },
+ [NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_qm_tclas_type4_policy),
+ [NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS] =
+ NLA_POLICY_NESTED(nl80211_qm_tclas_type10_policy),
+};
+
+static const struct nla_policy
+nl80211_qm_qos_policy[NL80211_QM_QOS_ATTR_MAX + 1] = {
+ [NL80211_QM_QOS_ATTR_CONTROL_INFO] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MIN_DATA_RATE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_DELAY_BOUND] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE] = { .type = NLA_U16 },
+ [NL80211_QM_QOS_ATTR_SVC_START_TIME] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_MLD_MAX_NUM_LINKS - 1),
+ [NL80211_QM_QOS_ATTR_MEAN_DATA_RATE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_BURST_SIZE] = { .type = NLA_U32 },
+ [NL80211_QM_QOS_ATTR_MSDU_LIFETIME] = { .type = NLA_U16 },
+ [NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO] = { .type = NLA_U8 },
+ [NL80211_QM_QOS_ATTR_MEDIUM_TIME] = { .type = NLA_U16 },
+};
+
+static const struct nla_policy
+nl80211_qm_desc_params_policy[NL80211_QM_DESC_ATTR_MAX + 1] = {
+ [NL80211_QM_DESC_ATTR_QM_ID] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_REQUEST_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_QM_CHANGE_REQ),
+ [NL80211_QM_DESC_ATTR_PRIORITY] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_qm_tclas_policy),
+ [NL80211_QM_DESC_ATTR_TCLAS_PROCESSING] =
+ NLA_POLICY_MAX(NLA_U8,
+ NL80211_QM_TCLAS_PROCESSING_MATCH_ALL_EXCEPT_FIRST),
+ [NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES] =
+ NLA_POLICY_NESTED(nl80211_qm_qos_policy),
+ [NL80211_QM_DESC_ATTR_STATUS] = { .type = NLA_REJECT },
+ [NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP] = { .type = NLA_U8 },
+ [NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT] =
+ NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
+ [NL80211_QM_DESC_ATTR_TCLAS_MASK] = { .type = NLA_U8 },
+};
+
+static const struct nla_policy
+nl80211_qm_policy[NL80211_QM_ATTR_MAX + 1] = {
+ [NL80211_QM_ATTR_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
+ [NL80211_QM_ATTR_QM_TYPE] = NLA_POLICY_MAX(NLA_U8,
+ NL80211_QM_TYPE_MAX - 1),
+ [NL80211_QM_ATTR_DESCRIPTOR_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_qm_desc_params_policy),
+};
+
static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
@@ -1201,6 +1288,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_ASSOC_CIP] = { .type = NLA_FLAG },
[NL80211_ATTR_CIP_CAPABILITIES] = { .type = NLA_U8 },
[NL80211_ATTR_ASSOC_PROTECTED_TWT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_QOS_MGMT] = NLA_POLICY_NESTED(nl80211_qm_policy),
};
/* policy for the key attributes */
@@ -20459,6 +20547,642 @@ static const struct genl_ops nl80211_ops[] = {
},
};
+static int
+nl80211_parse_qm_tclas4_elem(struct nlattr *tb_tclas_entry[],
+ struct cfg80211_qm_tclas4_params *type4_params)
+{
+ struct nlattr *tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 version;
+
+ if (nla_parse_nested(tb_tclas_type4, NL80211_QM_TCLAS_TYPE4_ATTR_MAX,
+ tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS],
+ nl80211_qm_tclas_type4_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_CLASSIFIER_MASK];
+ type4_params->classifier_mask = nla_get_u8(attr);
+ if (!(type4_params->classifier_mask &
+ NL80211_QM_TCLAS_TYPE4_MASK_VERSION))
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_IP_VERSION];
+ type4_params->ip_ver = nla_get_u8(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_PORT];
+ type4_params->src_port = nla_get_u16(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_PORT];
+ type4_params->dst_port = nla_get_u16(attr);
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DSCP];
+ type4_params->dscp = nla_get_u8(attr);
+
+ version = type4_params->ip_ver;
+ if (version == QM_IP_VERSION_4) {
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];
+ if (nla_len(attr) != QM_IPV4_LEN)
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];
+ if (nla_len(attr) != QM_IPV4_LEN)
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_PROTOCOL];
+ type4_params->protocol = nla_get_u8(attr);
+
+ nla_memcpy(type4_params->src_ip.ipv4,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],
+ QM_IPV4_LEN);
+ nla_memcpy(type4_params->dst_ip.ipv4,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],
+ QM_IPV4_LEN);
+ } else if (version == QM_IP_VERSION_6) {
+ if (!tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER] ||
+ !tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL])
+ return -EINVAL;
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP];
+ if (nla_len(attr) != QM_IPV6_LEN)
+ return -EINVAL;
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP];
+ if (nla_len(attr) != QM_IPV6_LEN)
+ return -EINVAL;
+
+ nla_memcpy(type4_params->src_ip.ipv6,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_SRC_IP],
+ QM_IPV6_LEN);
+ nla_memcpy(type4_params->dst_ip.ipv6,
+ tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_DST_IP],
+ QM_IPV6_LEN);
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_NEXT_HEADER];
+ type4_params->next_header = nla_get_u8(attr);
+
+ attr = tb_tclas_type4[NL80211_QM_TCLAS_TYPE4_ATTR_FLOW_LABEL];
+ nla_memcpy(type4_params->flow_label,
+ attr,
+ NL80211_QM_TCLAS_TYPE4_FLOW_LABEL_LEN);
+ } else {
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas10_elem(struct nlattr *tb_tclas_entry[],
+ struct cfg80211_qm_tclas10_params *type10_params)
+{
+ struct nlattr *tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 filter_value_len, filter_mask_len;
+
+ attr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS];
+ if (nla_parse_nested(tb_tclas_type10, NL80211_QM_TCLAS_TYPE10_ATTR_MAX,
+ attr,
+ nl80211_qm_tclas_type10_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE] ||
+ !tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK])
+ return -EINVAL;
+
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_INSTANCE];
+ type10_params->protocol_instance = nla_get_u8(attr);
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_PROT_NUMBER];
+ type10_params->protocol_number = nla_get_u8(attr);
+
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE];
+ filter_value_len = nla_len(attr);
+ attr = tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK];
+ filter_mask_len = nla_len(attr);
+
+ if (filter_value_len != filter_mask_len ||
+ filter_value_len > NL80211_QM_TCLAS_TYPE10_MAX_FILTER_LEN)
+ return -EINVAL;
+
+ type10_params->filter_len = filter_value_len;
+ nla_memcpy(type10_params->filter_value,
+ tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_VALUE],
+ type10_params->filter_len);
+ nla_memcpy(type10_params->filter_mask,
+ tb_tclas_type10[NL80211_QM_TCLAS_TYPE10_ATTR_FILTER_MASK],
+ type10_params->filter_len);
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas_elem(struct nlattr *tb_tclas,
+ struct cfg80211_qm_tclas_elements *tclas)
+{
+ struct nlattr *tb_tclas_entry[NL80211_QM_TCLAS_ATTR_MAX + 1];
+ struct cfg80211_qm_tclas4_params *type4_params;
+ struct cfg80211_qm_tclas10_params *type10_params;
+ struct nlattr *attr;
+ u8 classifier_type;
+ int ret;
+
+ if (nla_parse_nested(tb_tclas_entry, NL80211_QM_TCLAS_ATTR_MAX,
+ tb_tclas, nl80211_qm_tclas_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY] ||
+ !tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE])
+ return -EINVAL;
+
+ tclas->up =
+ nla_get_u8(tb_tclas_entry[NL80211_QM_TCLAS_ATTR_USER_PRIORITY]);
+ attr = tb_tclas_entry[NL80211_QM_TCLAS_ATTR_CLASSIFIER_TYPE];
+ tclas->classifier_type = nla_get_u8(attr);
+ classifier_type = tclas->classifier_type;
+ type4_params = &tclas->tclas_elem.type4_params;
+ type10_params = &tclas->tclas_elem.type10_params;
+
+ switch (classifier_type) {
+ case NL80211_QM_TCLAS_CLASSIFIER_TYPE4:
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE4_PARAMS])
+ return -EINVAL;
+
+ ret = nl80211_parse_qm_tclas4_elem(tb_tclas_entry,
+ type4_params);
+ if (ret)
+ return ret;
+ break;
+
+ case NL80211_QM_TCLAS_CLASSIFIER_TYPE10:
+ if (!tb_tclas_entry[NL80211_QM_TCLAS_ATTR_TYPE10_PARAMS])
+ return -EINVAL;
+
+ ret = nl80211_parse_qm_tclas10_elem(tb_tclas_entry,
+ type10_params);
+ if (ret)
+ return ret;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_parse_qm_tclas(struct nlattr *tb[],
+ struct cfg80211_qm_req_desc_data *qm_req_desc)
+{
+ struct nlattr *tb_tclas;
+ struct nlattr *tclas_elements;
+ struct cfg80211_qm_tclas_elements *tclas_elem;
+ struct nlattr *attr;
+ int rem_tclas_desc;
+ unsigned int num_tclas_elements = 0;
+ unsigned int tclas_idx = 0;
+ int ret;
+
+ tclas_elements = tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS];
+ nla_for_each_nested(tb_tclas, tclas_elements, rem_tclas_desc)
+ num_tclas_elements++;
+
+ if (num_tclas_elements) {
+ qm_req_desc->tclas = kzalloc_objs(*qm_req_desc->tclas,
+ num_tclas_elements,
+ GFP_KERNEL);
+ if (!qm_req_desc->tclas)
+ return -ENOMEM;
+ }
+
+ nla_for_each_nested(tb_tclas, tclas_elements,
+ rem_tclas_desc) {
+ tclas_elem = &qm_req_desc->tclas[tclas_idx];
+ ret = nl80211_parse_qm_tclas_elem(tb_tclas, tclas_elem);
+ if (ret)
+ return ret;
+
+ tclas_idx++;
+ }
+
+ qm_req_desc->num_tclas_elements = num_tclas_elements;
+
+ attr = tb[NL80211_QM_DESC_ATTR_TCLAS_PROCESSING];
+ if (attr)
+ qm_req_desc->tclas_processing = nla_get_u8(attr);
+
+ return 0;
+}
+
+/*
+ * QoS characteristics control info bitfield masks, used only here to
+ * parse NL80211_QM_QOS_ATTR_CONTROL_INFO.
+ */
+#define QM_CTRL_INFO_DIRECTION_MASK GENMASK(1, 0)
+#define QM_CTRL_INFO_TID_MASK GENMASK(5, 2)
+#define QM_CTRL_INFO_UP_MASK GENMASK(8, 6)
+#define QM_CTRL_INFO_BITMAP_MASK GENMASK(24, 9)
+#define QM_CTRL_INFO_LINK_ID_MASK GENMASK(28, 25)
+#define QM_CTRL_INFO_RESERVED_MASK GENMASK(31, 29)
+
+/*
+ * MSDU delivery info bitfield masks, used only here to parse
+ * NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO.
+ */
+#define QM_MSDU_DELIVERY_INFO_RATIO_MASK GENMASK(3, 0)
+#define QM_MSDU_DELIVERY_INFO_COUNT_EXPONENT_MASK GENMASK(7, 4)
+
+#define GET_FIELD_FROM_QM_CTRL_INFO(ctrl_info, FIELD) \
+ u32_get_bits((ctrl_info), QM_CTRL_INFO_##FIELD##_MASK)
+
+#define GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info, FIELD) \
+ u8_get_bits((msdu_delivery_info), \
+ QM_MSDU_DELIVERY_INFO_##FIELD##_MASK)
+
+static int
+nl80211_parse_qm_qos_attr(struct nlattr *tb[],
+ struct cfg80211_qm_qos_attributes *qos_attr)
+{
+ struct nlattr *tb_qm_qos[NL80211_QM_QOS_ATTR_MAX + 1];
+ struct nlattr *attr;
+ u8 msdu_delivery_info;
+ u32 control_info;
+
+ attr = tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES];
+ if (nla_parse_nested(tb_qm_qos, NL80211_QM_QOS_ATTR_MAX, attr,
+ nl80211_qm_qos_policy, NULL))
+ return -EINVAL;
+
+ if (!tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE] ||
+ !tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND])
+ return -EINVAL;
+
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_CONTROL_INFO];
+ control_info = nla_get_u32(attr);
+ qos_attr->direction =
+ GET_FIELD_FROM_QM_CTRL_INFO(control_info, DIRECTION);
+ qos_attr->tid = GET_FIELD_FROM_QM_CTRL_INFO(control_info, TID);
+ qos_attr->up = GET_FIELD_FROM_QM_CTRL_INFO(control_info, UP);
+ qos_attr->bitmap = GET_FIELD_FROM_QM_CTRL_INFO(control_info, BITMAP);
+ qos_attr->link_id = GET_FIELD_FROM_QM_CTRL_INFO(control_info, LINK_ID);
+
+ qos_attr->min_service_interval =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_SVC_INTERVAL]);
+ qos_attr->max_service_interval =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_SVC_INTERVAL]);
+ qos_attr->min_data_rate =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_MIN_DATA_RATE]);
+ qos_attr->delay_bound =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_DELAY_BOUND]);
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MAX_MSDU_SIZE];
+ qos_attr->max_msdu_size = nla_get_u16(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME];
+ qos_attr->service_start_time = nla_get_u32(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_SVC_START_TIME_LINK_ID];
+ qos_attr->service_start_time_link_id = nla_get_u8(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MEAN_DATA_RATE];
+ qos_attr->mean_data_rate = nla_get_u32(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE])
+ qos_attr->burst_size =
+ nla_get_u32(tb_qm_qos[NL80211_QM_QOS_ATTR_BURST_SIZE]);
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_LIFETIME];
+ qos_attr->msdu_lifetime = nla_get_u16(attr);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO]) {
+ attr = tb_qm_qos[NL80211_QM_QOS_ATTR_MSDU_DELIVERY_INFO];
+ msdu_delivery_info = nla_get_u8(attr);
+
+ qos_attr->msdu_delivery_ratio =
+ GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,
+ RATIO);
+ qos_attr->msdu_count_exponent =
+ GET_FIELD_FROM_QM_MSDU_DELIVERY_INFO(msdu_delivery_info,
+ COUNT_EXPONENT);
+ }
+
+ if (tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME])
+ qos_attr->medium_time =
+ nla_get_u16(tb_qm_qos[NL80211_QM_QOS_ATTR_MEDIUM_TIME]);
+
+ return 0;
+}
+
+static int nl80211_parse_qm_desc(struct nlattr *tb_qm_desc,
+ struct cfg80211_qm_req_desc_data *qm_req_desc,
+ enum nl80211_qm_type qm_type)
+{
+ struct nlattr *tb[NL80211_QM_DESC_ATTR_MAX + 1];
+ struct nlattr *attr;
+ int ret;
+
+ if (nla_parse_nested(tb, NL80211_QM_DESC_ATTR_MAX,
+ tb_qm_desc, nl80211_qm_desc_params_policy, NULL))
+ return -EINVAL;
+
+ if (!tb[NL80211_QM_DESC_ATTR_QM_ID] ||
+ !tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE])
+ return -EINVAL;
+
+ qm_req_desc->qm_id = nla_get_u8(tb[NL80211_QM_DESC_ATTR_QM_ID]);
+ if (!qm_req_desc->qm_id)
+ return -EINVAL;
+
+ qm_req_desc->request_type =
+ nla_get_u8(tb[NL80211_QM_DESC_ATTR_REQUEST_TYPE]);
+
+ switch (qm_req_desc->request_type) {
+ case NL80211_QM_REMOVE_REQ:
+ return 0;
+ case NL80211_QM_ADD_REQ:
+ case NL80211_QM_CHANGE_REQ:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch (qm_type) {
+ case NL80211_QM_TYPE_SCS:
+ if (tb[NL80211_QM_DESC_ATTR_PRIORITY]) {
+ attr = tb[NL80211_QM_DESC_ATTR_PRIORITY];
+ qm_req_desc->priority = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_TCLAS_ELEMENTS]) {
+ ret = nl80211_parse_qm_tclas(tb, qm_req_desc);
+ if (ret)
+ return ret;
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_QOS_ATTRIBUTES]) {
+ ret = nl80211_parse_qm_qos_attr(tb,
+ &qm_req_desc->qos_attr);
+ if (ret)
+ return ret;
+
+ qm_req_desc->is_qos_present = true;
+ }
+ break;
+
+ case NL80211_QM_TYPE_MSCS:
+ if (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP]) {
+ attr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_BITMAP];
+ qm_req_desc->user_priority_bitmap = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT]) {
+ attr = tb[NL80211_QM_DESC_ATTR_USER_PRIORITY_LIMIT];
+ qm_req_desc->user_priority_limit = nla_get_u8(attr);
+ }
+
+ if (tb[NL80211_QM_DESC_ATTR_TCLAS_MASK]) {
+ attr = tb[NL80211_QM_DESC_ATTR_TCLAS_MASK];
+ qm_req_desc->tclas_mask = nla_get_u8(attr);
+ }
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int
+nl80211_set_qm_resp_desc(struct sk_buff *msg,
+ struct cfg80211_qm_resp_desc_data *qm_resp_desc,
+ int idx)
+{
+ struct nlattr *qm_desc_entry;
+
+ qm_desc_entry = nla_nest_start(msg, idx);
+ if (!qm_desc_entry)
+ return -ENOBUFS;
+
+ if (nla_put_u8(msg, NL80211_QM_DESC_ATTR_QM_ID,
+ qm_resp_desc->qm_id) ||
+ nla_put_u8(msg, NL80211_QM_DESC_ATTR_STATUS,
+ qm_resp_desc->status)) {
+ nla_nest_cancel(msg, qm_desc_entry);
+ return -ENOBUFS;
+ }
+
+ nla_nest_end(msg, qm_desc_entry);
+ return 0;
+}
+
+static int
+nl80211_qm_send_resp(struct genl_info *info,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct nlattr *qm, *qm_desc;
+ struct sk_buff *msg;
+ void *hdr;
+ int ret;
+ int idx;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+
+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
+ NL80211_CMD_QOS_MGMT);
+ if (!hdr) {
+ ret = -ENOBUFS;
+ goto nla_fail;
+ }
+
+ qm = nla_nest_start(msg, NL80211_ATTR_QOS_MGMT);
+ if (!qm) {
+ ret = -ENOBUFS;
+ goto nla_fail;
+ }
+
+ if (nla_put(msg, NL80211_QM_ATTR_MAC_ADDR, ETH_ALEN,
+ qm_req->peer_mac) ||
+ nla_put_u8(msg, NL80211_QM_ATTR_QM_TYPE,
+ qm_req->qm_type)) {
+ ret = -ENOBUFS;
+ goto nla_qm_fail;
+ }
+
+ qm_desc = nla_nest_start(msg, NL80211_QM_ATTR_DESCRIPTOR_PARAMS);
+ if (!qm_desc) {
+ ret = -ENOBUFS;
+ goto nla_qm_fail;
+ }
+
+ for (idx = 0; idx < qm_req->num_qm_desc; idx++) {
+ ret = nl80211_set_qm_resp_desc(msg, &qm_resp->qm_resp_desc[idx],
+ idx);
+ if (ret) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management response descriptor failed");
+ goto nla_qm_desc_fail;
+ }
+ }
+
+ nla_nest_end(msg, qm_desc);
+ nla_nest_end(msg, qm);
+ genlmsg_end(msg, hdr);
+
+ return genlmsg_reply(msg, info);
+
+nla_qm_desc_fail:
+ nla_nest_cancel(msg, qm_desc);
+nla_qm_fail:
+ nla_nest_cancel(msg, qm);
+nla_fail:
+ nlmsg_free(msg);
+ return ret;
+}
+
+static void
+nl80211_free_qm_req(struct cfg80211_qm_req_data *qm_req)
+{
+ unsigned int i;
+
+ for (i = 0; i < qm_req->num_qm_desc; i++)
+ kfree(qm_req->qm_req_desc[i].tclas);
+
+ kfree(qm_req->qm_req_desc);
+}
+
+static int
+nl80211_qos_mgmt_cfg(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct nlattr *tb_qm[NL80211_QM_ATTR_MAX + 1];
+ struct cfg80211_qm_resp_data qm_resp = {};
+ struct cfg80211_qm_req_data qm_req = {};
+ struct cfg80211_qm_req_desc_data *qm_req_desc;
+ struct nlattr *tb_qm_desc;
+ int rem_qm_desc;
+ unsigned int num_qm_desc = 0;
+ unsigned int idx;
+ int ret;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP)
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_QOS_MGMT]) {
+ GENL_SET_ERR_MSG(info, "QoS Management attribute missing");
+ return -EINVAL;
+ }
+
+ if (nla_parse_nested(tb_qm, NL80211_QM_ATTR_MAX,
+ info->attrs[NL80211_ATTR_QOS_MGMT],
+ nl80211_qm_policy, NULL)) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management attribute parsing failed");
+ return -EINVAL;
+ }
+
+ if (!tb_qm[NL80211_QM_ATTR_MAC_ADDR] ||
+ !tb_qm[NL80211_QM_ATTR_QM_TYPE] ||
+ !tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS]) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management request attributes missing");
+ return -EINVAL;
+ }
+
+ nla_memcpy(qm_req.peer_mac, tb_qm[NL80211_QM_ATTR_MAC_ADDR], ETH_ALEN);
+ qm_req.qm_type = nla_get_u8(tb_qm[NL80211_QM_ATTR_QM_TYPE]);
+
+ nla_for_each_nested(tb_qm_desc,
+ tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],
+ rem_qm_desc)
+ num_qm_desc++;
+
+ if (!num_qm_desc) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management descriptor list is empty");
+ return -EINVAL;
+ }
+
+ qm_req.qm_req_desc = kzalloc_objs(*qm_req.qm_req_desc,
+ num_qm_desc, GFP_KERNEL);
+ if (!qm_req.qm_req_desc) {
+ ret = -ENOMEM;
+ goto free_qm;
+ }
+
+ nla_for_each_nested(tb_qm_desc,
+ tb_qm[NL80211_QM_ATTR_DESCRIPTOR_PARAMS],
+ rem_qm_desc) {
+ qm_req_desc = &qm_req.qm_req_desc[qm_req.num_qm_desc];
+ ret = nl80211_parse_qm_desc(tb_qm_desc, qm_req_desc,
+ qm_req.qm_type);
+ if (ret) {
+ GENL_SET_ERR_MSG(info,
+ "QoS Management descriptor parsing failed");
+ goto free_qm;
+ }
+ qm_req.num_qm_desc++;
+ }
+
+ if (qm_req.qm_type == NL80211_QM_TYPE_MSCS && qm_req.num_qm_desc != 1) {
+ GENL_SET_ERR_MSG(info,
+ "MSCS request must contain exactly one descriptor");
+ ret = -EINVAL;
+ goto free_qm;
+ }
+
+ qm_resp.qm_resp_desc = kzalloc_objs(*qm_resp.qm_resp_desc,
+ qm_req.num_qm_desc, GFP_KERNEL);
+ if (!qm_resp.qm_resp_desc) {
+ ret = -ENOMEM;
+ goto free_qm;
+ }
+
+ for (idx = 0; idx < qm_req.num_qm_desc; idx++) {
+ qm_resp.qm_resp_desc[idx].qm_id =
+ qm_req.qm_req_desc[idx].qm_id;
+ qm_resp.qm_resp_desc[idx].status = NL80211_QM_STATUS_DECLINED;
+ }
+
+ ret = rdev_set_qos_mgmt_cfg(rdev, dev, &qm_req, &qm_resp);
+ if (ret) {
+ GENL_SET_ERR_MSG(info, "set_qos_mgmt_cfg failed");
+ goto free_qm;
+ }
+
+ ret = nl80211_qm_send_resp(info, &qm_req, &qm_resp);
+
+free_qm:
+ kfree(qm_resp.qm_resp_desc);
+ nl80211_free_qm_req(&qm_req);
+ return ret;
+}
+
static const struct genl_small_ops nl80211_small_ops[] = {
{
.cmd = NL80211_CMD_SET_WIPHY,
@@ -21350,6 +22074,12 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NO_WIPHY_MTX),
},
+ {
+ .cmd = NL80211_CMD_QOS_MGMT,
+ .doit = nl80211_qos_mgmt_cfg,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index ae15cec9bf8b7..16698af390207 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1707,4 +1707,21 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int
+rdev_set_qos_mgmt_cfg(struct cfg80211_registered_device *rdev,
+ struct net_device *dev,
+ struct cfg80211_qm_req_data *qm_req,
+ struct cfg80211_qm_resp_data *qm_resp)
+{
+ struct wiphy *wiphy = &rdev->wiphy;
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_qos_mgmt_cfg(wiphy, dev, qm_req);
+ if (rdev->ops->set_qos_mgmt_cfg)
+ ret = rdev->ops->set_qos_mgmt_cfg(wiphy, dev, qm_req, qm_resp);
+ trace_rdev_return_int(wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 31000ffebe436..83bd63e1c7e26 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3281,6 +3281,26 @@ TRACE_EVENT(rdev_set_epcs,
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->val)
);
+TRACE_EVENT(rdev_set_qos_mgmt_cfg,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_qm_req_data *qm_req),
+ TP_ARGS(wiphy, netdev, qm_req),
+ TP_STRUCT__entry(WIPHY_ENTRY
+ NETDEV_ENTRY
+ __field(u8, qm_type)
+ __field(unsigned int, num_qm_desc)
+ ),
+ TP_fast_assign(WIPHY_ASSIGN;
+ NETDEV_ASSIGN;
+ __entry->qm_type = qm_req->qm_type;
+ __entry->num_qm_desc = qm_req->num_qm_desc;
+ ),
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT
+ ", qm_type=%u num_qm_desc=%u",
+ WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->qm_type,
+ __entry->num_qm_desc)
+);
+
/*************************************************************
* cfg80211 exported functions traces *
*************************************************************/
|
| 29/3 | 2026/10/15 07:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 33997 output: 25 thoughts: 2013 Thoughts: **KMSAN Evaluation: QoS Management Configuration Patch Series**
Okay, let's break this down. The user's asking if this patch series warrants a KMSAN session due to potential uninitialized memory risks. Given my expertise, I need to methodically check all these changes against the KMSAN criteria.
My initial scan reveals a wide-ranging touch, indicating potentially complex interactions. A lot of new structures are defined in `cfg80211.h` along with new attributes in `nl80211.h`. New functions and modifications can be found in `mac80211`.
The KMSAN rules are clear, let's recap: we're looking for code that: 1) sends kernel structures to userspace without complete initialization, 2) relies on uninitialized variables in conditional logic, 3) allocates complex data structures with uninitialized fields, or 4) has sketchy bounds checks that could lead to reading uninitialized memory.
First, I'll hone in on the code paths that *actually* transmit data to user space. The primary candidate seems to be `net/wireless/nl80211.c`, particularly `nl80211_qm_send_resp`. This function uses Netlink to communicate data back to userspace, and that's a red flag. I'll examine the structure `cfg80211_qm_req_data` and where it is populated.
Inside `nl80211_qm_send_resp`, I see the following code block:
```c
if (nla_put(msg, NL80211_QM_ATTR_MAC_ADDR, ETH_ALEN,
qm_req->peer_mac) ||
nla_put_u8(msg, NL80211_QM_ATTR_QM_TYPE,
qm_req->qm_type)) {
...
```
Here, `qm_req`'s `peer_mac` and `qm_type` are being sent. Where does `qm_req` come from? It's allocated and initialized within the `nl80211_qos_mgmt_cfg` function: `struct cfg80211_qm_req_data qm_req = {};`. The `={}` initializes it to zero. Okay, that's good.
The code fills `peer_mac` using a `nla_memcpy`: `nla_memcpy(qm_req.peer_mac, tb_qm[NL80211_QM_ATTR_MAC_ADDR], ETH_ALEN);`. This looks safe, because the Netlink attribute (`NL80211_QM_ATTR_MAC_ADDR`) is specified as `NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN)`. This means it's expecting exactly `ETH_ALEN` bytes for the MAC address. I need to double-check this: if a shorter-than-expected MAC address were sent via Netlink, what happens? `NLA_POLICY_EXACT_LEN_WARN` warns, but does it actually *reject* the Netlink message? This needs further investigation.
My current assessment is that the use of `NLA_POLICY_EXACT_LEN_WARN` *should* prevent the copy of a partial MAC address. However, I need to confirm the exact behavior in the kernel code. If the code allows a shorter-than-expected length and does not reject it, KMSAN would be needed to catch an uninitialized memory read.
So far, I am leaning towards "No" to KMSAN, pending a deeper dive into `NLA_POLICY_EXACT_LEN_WARN`.
|
| 30/3 | 2026/10/15 07:09 | tool | grepper |
0mArgs:{
"Expression": "NLA_POLICY_EXACT_LEN_WARN"
}Results: {
"Output": "include/net/netlink.h=346=struct nla_policy {\n--\ninclude/net/netlink.h-389-#define NLA_POLICY_ETH_ADDR\t\tNLA_POLICY_EXACT_LEN(ETH_ALEN)\ninclude/net/netlink.h:390:#define NLA_POLICY_ETH_ADDR_COMPAT\tNLA_POLICY_EXACT_LEN_WARN(ETH_ALEN)\ninclude/net/netlink.h-391-\n--\ninclude/net/netlink.h-475-#define NLA_POLICY_EXACT_LEN(_len)\tNLA_POLICY_RANGE(NLA_BINARY, _len, _len)\ninclude/net/netlink.h:476:#define NLA_POLICY_EXACT_LEN_WARN(_len) {\t\t\t\\\ninclude/net/netlink.h-477-\t.type = NLA_BINARY,\t\t\t\t\t\\\n--\nnet/wireless/nl80211.c=650=static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {\n--\nnet/wireless/nl80211.c-654-\t\t\t\t.len = NL80211_MAX_SUPP_HT_RATES },\nnet/wireless/nl80211.c:655:\t[NL80211_TXRATE_VHT] = NLA_POLICY_EXACT_LEN_WARN(sizeof(struct nl80211_txrate_vht)),\nnet/wireless/nl80211.c-656-\t[NL80211_TXRATE_GI] = { .type = NLA_U8 },\n--\nnet/wireless/nl80211.c=880=nl80211_qm_policy[NL80211_QM_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c:881:\t[NL80211_QM_ATTR_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-882-\t[NL80211_QM_ATTR_QM_TYPE] = NLA_POLICY_MAX(NLA_U8,\n--\nnet/wireless/nl80211.c=888=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n--\nnet/wireless/nl80211.c-919-\nnet/wireless/nl80211.c:920:\t[NL80211_ATTR_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c:921:\t[NL80211_ATTR_PREV_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-922-\n--\nnet/wireless/nl80211.c-973-\nnet/wireless/nl80211.c:974:\t[NL80211_ATTR_HT_CAPABILITY] = NLA_POLICY_EXACT_LEN_WARN(NL80211_HT_CAPABILITY_LEN),\nnet/wireless/nl80211.c-975-\n--\nnet/wireless/nl80211.c-992-\t[NL80211_ATTR_STA_FLAGS2] =\nnet/wireless/nl80211.c:993:\t\tNLA_POLICY_EXACT_LEN_WARN(sizeof(struct nl80211_sta_flag_update)),\nnet/wireless/nl80211.c-994-\t[NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG },\n--\nnet/wireless/nl80211.c-1007-\t[NL80211_ATTR_4ADDR] = { .type = NLA_U8 },\nnet/wireless/nl80211.c:1008:\t[NL80211_ATTR_PMKID] = NLA_POLICY_EXACT_LEN_WARN(WLAN_PMKID_LEN),\nnet/wireless/nl80211.c-1009-\t[NL80211_ATTR_DURATION] = { .type = NLA_U32 },\n--\nnet/wireless/nl80211.c-1075-\nnet/wireless/nl80211.c:1076:\t[NL80211_ATTR_VHT_CAPABILITY] = NLA_POLICY_EXACT_LEN_WARN(NL80211_VHT_CAPABILITY_LEN),\nnet/wireless/nl80211.c-1077-\t[NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },\n--\nnet/wireless/nl80211.c-1120-\t\t\t\t\t\t IEEE80211_QOS_MAP_LEN_MAX),\nnet/wireless/nl80211.c:1121:\t[NL80211_ATTR_MAC_HINT] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1122-\t[NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 },\n--\nnet/wireless/nl80211.c-1132-\t[NL80211_ATTR_OPER_CLASS] = { .type = NLA_U8 },\nnet/wireless/nl80211.c:1133:\t[NL80211_ATTR_MAC_MASK] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1134-\t[NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG },\n--\nnet/wireless/nl80211.c-1144-\t},\nnet/wireless/nl80211.c:1145:\t[NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1146-\t[NL80211_ATTR_NAN_MASTER_PREF] = NLA_POLICY_MIN(NLA_U8, 1),\n--\nnet/wireless/nl80211.c-1151-\t\t\t\t .len = FILS_MAX_KEK_LEN },\nnet/wireless/nl80211.c:1152:\t[NL80211_ATTR_FILS_NONCES] = NLA_POLICY_EXACT_LEN_WARN(2 * FILS_NONCE_LEN),\nnet/wireless/nl80211.c-1153-\t[NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED] = { .type = NLA_FLAG, },\nnet/wireless/nl80211.c:1154:\t[NL80211_ATTR_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1155-\t[NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI] = { .type = NLA_S8 },\n--\nnet/wireless/nl80211.c-1166-\t\t\t\t\t.len = FILS_ERP_MAX_RRK_LEN },\nnet/wireless/nl80211.c:1167:\t[NL80211_ATTR_FILS_CACHE_ID] = NLA_POLICY_EXACT_LEN_WARN(2),\nnet/wireless/nl80211.c-1168-\t[NL80211_ATTR_PMK] = { .type = NLA_BINARY, .len = PMK_MAX_LEN },\n--\nnet/wireless/nl80211.c=1335=nl80211_wowlan_tcp_policy[NUM_NL80211_WOWLAN_TCP] = {\n--\nnet/wireless/nl80211.c-1337-\t[NL80211_WOWLAN_TCP_DST_IPV4] = { .type = NLA_U32 },\nnet/wireless/nl80211.c:1338:\t[NL80211_WOWLAN_TCP_DST_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1339-\t[NL80211_WOWLAN_TCP_SRC_PORT] = { .type = NLA_U16 },\n--\nnet/wireless/nl80211.c=1381=nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = {\n--\nnet/wireless/nl80211.c-1383-\t\t\t\t\t\t .len = IEEE80211_MAX_SSID_LEN },\nnet/wireless/nl80211.c:1384:\t[NL80211_SCHED_SCAN_MATCH_ATTR_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1385-\t[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI] = { .type = NLA_U32 },\n--\nnet/wireless/nl80211.c=1405=nl80211_nan_func_policy[NL80211_NAN_FUNC_ATTR_MAX + 1] = {\n--\nnet/wireless/nl80211.c-1414-\t[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID] = { .type = NLA_U8 },\nnet/wireless/nl80211.c:1415:\t[NL80211_NAN_FUNC_FOLLOW_UP_DEST] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),\nnet/wireless/nl80211.c-1416-\t[NL80211_NAN_FUNC_CLOSE_RANGE] = { .type = NLA_FLAG },\n"
} |
| 31/3 | 2026/10/15 07:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39571 output: 37 thoughts: 25 Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts: **Investigating NLA_POLICY_EXACT_LEN_WARN in lib/nlattr.c** Alright, I need to get my head back into the nitty-gritty of the Netlink attribute handling, specifically within `lib/nlattr.c`. I'm going to have a look at how `NLA_POLICY_EXACT_LEN_WARN` is implemented. I want a clear understanding of what it does, the context it's used in, and the kind of situations it's designed to flag. Is it about strict length checking, or is it about enforcing minimum/maximum lengths? Does it log warnings, or does it trigger errors? What happens if this "warning" condition is triggered – what's the broader impact on the attribute processing and the overall Netlink message handling? I need to understand any side effects. Time to open that file and get into the weeds. I'm looking for the specific code, any associated comments, and any dependencies on other functions or macros. Understanding that context is the key to mastering this functionality. |
| 32/3 | 2026/10/15 07:09 | tool | grepper |
0mError:no matches Args: {
"Expression": "case NLA_EXACT_LEN_WARN",
"PathPrefixes": [
"lib/nlattr.c"
]
}Results: {
"error": "no matches"
} |
| 33/3 | 2026/10/15 07:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39898 output: 36 thoughts: 26 Thoughts: Here's my thought process, as if I were thinking it: **Digging into Netlink Header Length Warnings** Okay, time to get to the bottom of this. I need to understand this `NLA_POLICY_EXACT_LEN_WARN` macro, and it's most likely used within the Netlink framework. Where would I find the definition? Ah, the standard include directory for net-related headers: `include/net/netlink.h`. That's the obvious starting point. I'll use `grep` to quickly locate instances of the macro within that file and see how it's being utilized. This will give me immediate context around how length warnings are being managed in the Netlink code and provide some insight into the nuances of this specific error handling policy. |
| 34/3 | 2026/10/15 07:09 | tool | read-file |
0mArgs:{
"File": "include/net/netlink.h",
"FirstLine": 470,
"LineCount": 20
}Results: {
"Contents": " 470:\t\t.validation_type = NLA_VALIDATE_FUNCTION,\t\\\n 471:\t\t.validate = fn,\t\t\t\t\t\\\n 472:\t\t.len = __VA_ARGS__ + 0,\t\t\t\t\\\n 473:\t}\n 474:\t\n 475:\t#define NLA_POLICY_EXACT_LEN(_len)\tNLA_POLICY_RANGE(NLA_BINARY, _len, _len)\n 476:\t#define NLA_POLICY_EXACT_LEN_WARN(_len) {\t\t\t\\\n 477:\t\t.type = NLA_BINARY,\t\t\t\t\t\\\n 478:\t\t.validation_type = NLA_VALIDATE_RANGE_WARN_TOO_LONG,\t\\\n 479:\t\t.min = _len,\t\t\t\t\t\t\\\n 480:\t\t.max = _len\t\t\t\t\t\t\\\n 481:\t}\n 482:\t#define NLA_POLICY_MIN_LEN(_len)\tNLA_POLICY_MIN(NLA_BINARY, _len)\n 483:\t#define NLA_POLICY_MAX_LEN(_len)\tNLA_POLICY_MAX(NLA_BINARY, _len)\n 484:\t\n 485:\t/**\n 486:\t * struct nl_info - netlink source information\n 487:\t * @nlh: Netlink message header of original request\n 488:\t * @nl_net: Network namespace\n 489:\t * @portid: Netlink PORTID of requesting application\n"
} |
| 35/3 | 2026/10/15 07:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40516 output: 18 thoughts: 1042 Thoughts: **Analyzing Potential Vulnerabilities in Qos Management Configuration** Okay, let's break this down. First, the `NLA_VALIDATE_RANGE_WARN_TOO_LONG` macro is intriguing. It enforces a minimum length, which is good. If something is *shorter* than the minimum, validation fails with -ERANGE. If it's *longer*, it just warns. Now, the `nla_memcpy` call ensures that `qm_req.peer_mac` is at least ETH_ALEN bytes long and properly initialized. That seems safe. Now, I'm looking at `qm_resp` and `nl80211_qos_mgmt_cfg`. The code allocates memory for `qm_resp.qm_resp_desc` using `kzalloc_objs`. This is promising, as `kzalloc` guarantees zero-initialization. Then it iterates, copying the `qm_id` from the request and setting the initial `status`. The critical part is the call to `rdev_set_qos_mgmt_cfg`, which is outside of my scope, and the call to `nl80211_qm_send_resp`. Inside the `nl80211_set_qm_resp_desc`, it uses `nla_put_u8` to write the `qm_id` and `status`. That's smart. That means it only writes a single byte. No potential for copying a struct with padding directly into userspace! Excellent. Now, let's dig deeper into the parsing code and memory allocations. The function `nl80211_parse_qm_tclas` looks interesting. It iterates through TCLAS elements within the request. It dynamically allocates memory for `qm_req_desc->tclas` using `kzalloc_objs`. Okay, this is another instance of zero-initialization which is a good protection against information leakage. Same thing for `qm_req.qm_req_desc`! But wait a minute, I need to check the definition of `kzalloc_objs`! I need to ensure that it allocates the correct number of bytes and zeros them out! I need to be sure! |
| 36/3 | 2026/10/15 07:10 | tool | grepper |
0mArgs:{
"Expression": "kzalloc_objs"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 14586 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (1538 files in total):\nDocumentation/process/coding-style.rst:2\nDocumentation/process/deprecated.rst:1\nDocumentation/translations/it_IT/process/coding-style.rst:2\nDocumentation/translations/it_IT/process/deprecated.rst:1\nDocumentation/translations/pt_BR/process/deprecated.rst:1\narch/alpha/kernel/module.c:1\narch/arm/kernel/vdso.c:1\narch/arm/mach-footbridge/dc21285.c:1\narch/arm/mach-omap1/mcbsp.c:1\narch/arm/mach-omap2/omap_device.c:1\narch/arm/mach-omap2/pm33xx-core.c:1\narch/arm/mach-omap2/sr_device.c:1\narch/arm/mach-versatile/spc.c:1\narch/arm/xen/enlighten.c:1\narch/arm64/kernel/vdso.c:1\narch/arm64/kvm/vgic/vgic-init.c:2\narch/arm64/kvm/vgic/vgic-irqfd.c:1\narch/arm64/kvm/vgic/vgic-v4.c:1\narch/csky/kernel/vdso.c:1\narch/loongarch/kernel/vdso.c:1\narch/loongarch/kvm/intc/pch_pic.c:1\narch/mips/alchemy/common/clock.c:2\narch/mips/alchemy/common/dbdma.c:1\narch/mips/alchemy/common/platform.c:1\narch/mips/alchemy/devboards/platform.c:2\narch/mips/bcm47xx/buttons.c:4\narch/mips/kernel/smp-cps.c:3\narch/parisc/kernel/vdso.c:1\narch/parisc/net/bpf_jit_core.c:1\narch/powerpc/kernel/smp.c:1\narch/powerpc/kernel/vdso.c:1\narch/powerpc/kvm/e500_mmu.c:4\narch/powerpc/mm/drmem.c:2\narch/powerpc/perf/imc-pmu.c:7\narch/powerpc/perf/vpa-dtl.c:1\narch/powerpc/platforms/44x/pci.c:1\narch/powerpc/platforms/powernv/idle.c:1\narch/powerpc/platforms/powernv/memtrace.c:1\narch/powerpc/platforms/powernv/opal-async.c:1\narch/powerpc/platforms/powernv/opal-imc.c:1\narch/powerpc/platforms/powernv/opal-irqchip.c:1\narch/powerpc/platforms/powernv/opal-powercap.c:3\narch/powerpc/platforms/powernv/opal-psr.c:1\narch/powerpc/platforms/powernv/opal-sensor-groups.c:3\narch/powerpc/platforms/powernv/opal-sysparam.c:1\narch/powerpc/platforms/pseries/papr_platform_attributes.c:2\narch/powerpc/sysdev/mpic.c:1\narch/powerpc/sysdev/mpic_msgr.c:1\narch/powerpc/sysdev/xive/common.c:1\narch/riscv/kernel/tests/kprobes/test-kprobes.c:1\n... and 1488 more files\n\nDocumentation/process/coding-style.rst=938=The kernel provides the following general purpose memory allocators:\nDocumentation/process/coding-style.rst:939:kmalloc(), kzalloc(), kmalloc_objs(), kzalloc_objs(), vmalloc(), and\nDocumentation/process/coding-style.rst-940-vzalloc(). Please refer to the API documentation for further information\n--\nDocumentation/process/coding-style.rst=964=The preferred form for allocating a zeroed array is the following:\n--\nDocumentation/process/coding-style.rst-967-\nDocumentation/process/coding-style.rst:968:\tp = kzalloc_objs(*p, n, ...);\nDocumentation/process/coding-style.rst-969-\n--\nDocumentation/process/deprecated.rst=398=become, respectively::\n--\nDocumentation/process/deprecated.rst-402-\tptr = kmalloc_objs(*ptr, count [, gfp] );\nDocumentation/process/deprecated.rst:403:\tptr = kzalloc_objs(*ptr, count [, gfp] );\nDocumentation/process/deprecated.rst-404-\tptr = kmalloc_flex(*ptr, flex_member, count [, gfp] );\n--\nDocumentation/translations/it_IT/process/coding-style.rst=940=Il kernel fornisce i seguenti assegnatori ad uso generico:\nDocumentation/translations/it_IT/process/coding-style.rst:941:kmalloc(), kzalloc(), kmalloc_objs(), kzalloc_objs(), vmalloc(), e vzalloc().\nDocumentation/translations/it_IT/process/coding-style.rst-942-Per maggiori informazioni, consultate la documentazione dell'API:\n--\nDocumentation/translations/it_IT/process/coding-style.rst=965=Il modo preferito per assegnare un vettore a zero è il seguente:\n--\nDocumentation/translations/it_IT/process/coding-style.rst-968-\nDocumentation/translations/it_IT/process/coding-style.rst:969:\tp = kzalloc_objs(*p, n, ...);\nDocumentation/translations/it_IT/process/coding-style.rst-970-\n--\nDocumentation/translations/it_IT/process/deprecated.rst=441=diventano, rispettivamente::\n--\nDocumentation/translations/it_IT/process/deprecated.rst-445-\tptr = kmalloc_objs(*ptr, count [, gfp] );\nDocumentation/translations/it_IT/process/deprecated.rst:446:\tptr = kzalloc_objs(*ptr, count [, gfp] );\nDocumentation/translations/it_IT/process/deprecated.rst-447-\tptr = kmalloc_flex(*ptr, flex_member, count [, gfp] );\n--\nDocumentation/translations/pt_BR/process/deprecated.rst=410=tornam-se, respectivamente::\n--\nDocumentation/translations/pt_BR/process/deprecated.rst-414- ptr = kmalloc_objs(*ptr, count [, gfp] );\nDocumentation/translations/pt_BR/process/deprecated.rst:415: ptr = kzalloc_objs(*ptr, count [, gfp] );\nDocumentation/translations/pt_BR/process/deprecated.rst-416- ptr = kmalloc_flex(*ptr, flex_member, count [, gfp] );\n--\narch/alpha/kernel/module.c=64=module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,\n--\narch/alpha/kernel/module.c-95-\tnsyms = symtab-\u003esh_size / sizeof(Elf64_Sym);\narch/alpha/kernel/module.c:96:\tchains = kzalloc_objs(struct got_entry, nsyms);\narch/alpha/kernel/module.c-97-\tif (!chains) {\n--\narch/arm/kernel/vdso.c=169=static int __init vdso_init(void)\n--\narch/arm/kernel/vdso.c-181-\t/* Allocate the VDSO text pagelist */\narch/arm/kernel/vdso.c:182:\tvdso_text_pagelist = kzalloc_objs(struct page *, text_pages);\narch/arm/kernel/vdso.c-183-\tif (vdso_text_pagelist == NULL)\n--\narch/arm/mach-footbridge/dc21285.c=261=int __init dc21285_setup(int nr, struct pci_sys_data *sys)\n--\narch/arm/mach-footbridge/dc21285.c-264-\narch/arm/mach-footbridge/dc21285.c:265:\tres = kzalloc_objs(struct resource, 2);\narch/arm/mach-footbridge/dc21285.c-266-\tif (!res) {\n--\narch/arm/mach-omap1/mcbsp.c=292=static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,\n--\narch/arm/mach-omap1/mcbsp.c-296-\narch/arm/mach-omap1/mcbsp.c:297:\tomap_mcbsp_devices = kzalloc_objs(struct platform_device *, size);\narch/arm/mach-omap1/mcbsp.c-298-\tif (!omap_mcbsp_devices) {\n--\narch/arm/mach-omap2/omap_device.c=131=static int omap_device_build_from_dt(struct platform_device *pdev)\n--\narch/arm/mach-omap2/omap_device.c-158-\narch/arm/mach-omap2/omap_device.c:159:\thwmods = kzalloc_objs(struct omap_hwmod *, oh_cnt);\narch/arm/mach-omap2/omap_device.c-160-\tif (!hwmods) {\n--\narch/arm/mach-omap2/pm33xx-core.c=379=static int __init amx3_idle_init(struct device_node *cpu_node, int cpu)\n--\narch/arm/mach-omap2/pm33xx-core.c-412-\narch/arm/mach-omap2/pm33xx-core.c:413:\tidle_states = kzalloc_objs(*idle_states, state_count);\narch/arm/mach-omap2/pm33xx-core.c-414-\tif (!idle_states)\n--\narch/arm/mach-omap2/sr_device.c=30=static void __init sr_set_nvalues(struct omap_volt_data *volt_data,\n--\narch/arm/mach-omap2/sr_device.c-41-\narch/arm/mach-omap2/sr_device.c:42:\tnvalue_table = kzalloc_objs(*nvalue_table, count);\narch/arm/mach-omap2/sr_device.c-43-\tif (!nvalue_table)\n--\narch/arm/mach-versatile/spc.c=393=static int ve_spc_populate_opps(uint32_t cluster)\n--\narch/arm/mach-versatile/spc.c-397-\narch/arm/mach-versatile/spc.c:398:\topps = kzalloc_objs(*opps, MAX_OPPS);\narch/arm/mach-versatile/spc.c-399-\tif (!opps)\n--\narch/arm/xen/enlighten.c=316=int __init arch_xen_unpopulated_init(struct resource **res)\n--\narch/arm/xen/enlighten.c-343-\narch/arm/xen/enlighten.c:344:\tregs = kzalloc_objs(*regs, nr_reg);\narch/arm/xen/enlighten.c-345-\tif (!regs) {\n--\narch/arm64/kernel/vdso.c=68=static int __init __vdso_init(enum vdso_abi abi)\n--\narch/arm64/kernel/vdso.c-83-\narch/arm64/kernel/vdso.c:84:\tvdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages);\narch/arm64/kernel/vdso.c-85-\tif (vdso_pagelist == NULL)\n--\narch/arm64/kvm/vgic/vgic-init.c=204=static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis)\n--\narch/arm64/kvm/vgic/vgic-init.c-213-\tdist-\u003eactive_spis = (atomic_t)ATOMIC_INIT(0);\narch/arm64/kvm/vgic/vgic-init.c:214:\tdist-\u003espis = kzalloc_objs(struct vgic_irq, nr_spis, GFP_KERNEL_ACCOUNT);\narch/arm64/kvm/vgic/vgic-init.c-215-\tif (!dist-\u003espis)\n--\narch/arm64/kvm/vgic/vgic-init.c=316=static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type)\n--\narch/arm64/kvm/vgic/vgic-init.c-331-\narch/arm64/kvm/vgic/vgic-init.c:332:\tvgic_cpu-\u003eprivate_irqs = kzalloc_objs(struct vgic_irq,\narch/arm64/kvm/vgic/vgic-init.c-333-\t\t\t\t\t num_private_irqs,\n--\narch/arm64/kvm/vgic/vgic-irqfd.c=142=int kvm_vgic_setup_default_irq_routing(struct kvm *kvm)\n--\narch/arm64/kvm/vgic/vgic-irqfd.c-148-\narch/arm64/kvm/vgic/vgic-irqfd.c:149:\tentries = kzalloc_objs(*entries, nr, GFP_KERNEL_ACCOUNT);\narch/arm64/kvm/vgic/vgic-irqfd.c-150-\tif (!entries)\n--\narch/arm64/kvm/vgic/vgic-v4.c=242=int vgic_v4_init(struct kvm *kvm)\n--\narch/arm64/kvm/vgic/vgic-v4.c-258-\narch/arm64/kvm/vgic/vgic-v4.c:259:\tdist-\u003eits_vm.vpes = kzalloc_objs(*dist-\u003eits_vm.vpes, nr_vcpus,\narch/arm64/kvm/vgic/vgic-v4.c-260-\t\t\t\t\t GFP_KERNEL_ACCOUNT);\n--\narch/csky/kernel/vdso.c=17=static int __init vdso_init(void)\n--\narch/csky/kernel/vdso.c-22-\tvdso_pagelist =\narch/csky/kernel/vdso.c:23:\t\tkzalloc_objs(struct page *, vdso_pages);\narch/csky/kernel/vdso.c-24-\tif (unlikely(vdso_pagelist == NULL)) {\n--\narch/loongarch/kernel/vdso.c=45=static int __init init_vdso(void)\n--\narch/loongarch/kernel/vdso.c-55-\tvdso_info.code_mapping.pages =\narch/loongarch/kernel/vdso.c:56:\t\tkzalloc_objs(struct page *, vdso_info.size / PAGE_SIZE);\narch/loongarch/kernel/vdso.c-57-\n--\narch/loongarch/kvm/intc/pch_pic.c=413=static int kvm_setup_default_irq_routing(struct kvm *kvm)\n--\narch/loongarch/kvm/intc/pch_pic.c-418-\narch/loongarch/kvm/intc/pch_pic.c:419:\tentries = kzalloc_objs(*entries, nr);\narch/loongarch/kvm/intc/pch_pic.c-420-\tif (!entries)\n--\narch/mips/alchemy/common/clock.c=754=static int __init alchemy_clk_init_fgens(int ctype)\n--\narch/mips/alchemy/common/clock.c-777-\narch/mips/alchemy/common/clock.c:778:\ta = kzalloc_objs(*a, 6);\narch/mips/alchemy/common/clock.c-779-\tif (!a)\n--\narch/mips/alchemy/common/clock.c=960=static int __init alchemy_clk_setup_imux(int ctype)\n--\narch/mips/alchemy/common/clock.c-998-\narch/mips/alchemy/common/clock.c:999:\ta = kzalloc_objs(*a, 6);\narch/mips/alchemy/common/clock.c-1000-\tif (!a)\n--\narch/mips/alchemy/common/dbdma.c=1056=static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)\n--\narch/mips/alchemy/common/dbdma.c-1059-\narch/mips/alchemy/common/dbdma.c:1060:\tdbdev_tab = kzalloc_objs(dbdev_tab_t, DBDEV_TAB_SIZE);\narch/mips/alchemy/common/dbdma.c-1061-\tif (!dbdev_tab)\n--\narch/mips/alchemy/common/platform.c=203=static int __init _new_usbres(struct resource **r, struct platform_device **d)\narch/mips/alchemy/common/platform.c-204-{\narch/mips/alchemy/common/platform.c:205:\t*r = kzalloc_objs(struct resource, 2);\narch/mips/alchemy/common/platform.c-206-\tif (!*r)\n--\narch/mips/alchemy/devboards/platform.c=70=int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,\n--\narch/mips/alchemy/devboards/platform.c-91-\narch/mips/alchemy/devboards/platform.c:92:\tsr = kzalloc_objs(struct resource, cnt);\narch/mips/alchemy/devboards/platform.c-93-\tif (!sr)\n--\narch/mips/alchemy/devboards/platform.c=154=int __init db1x_register_norflash(unsigned long size, int width,\n--\narch/mips/alchemy/devboards/platform.c-166-\tret = -ENOMEM;\narch/mips/alchemy/devboards/platform.c:167:\tparts = kzalloc_objs(struct mtd_partition, 5);\narch/mips/alchemy/devboards/platform.c-168-\tif (!parts)\n--\narch/mips/bcm47xx/buttons.c=501=bcm47xx_buttons_add(const struct bcm47xx_gpio_key *buttons, int nbuttons)\n--\narch/mips/bcm47xx/buttons.c-525-\tconst struct software_node **node_group __free(kfree) =\narch/mips/bcm47xx/buttons.c:526:\t\tkzalloc_objs(*node_group, 1 + nbuttons + 1);\narch/mips/bcm47xx/buttons.c-527-\tif (!node_group)\n--\narch/mips/bcm47xx/buttons.c-531-\tstruct property_entry *props __free(kfree) =\narch/mips/bcm47xx/buttons.c:532:\t\tkzalloc_objs(*props, nbuttons * 3);\narch/mips/bcm47xx/buttons.c-533-\tif (!props)\n--\narch/mips/bcm47xx/buttons.c-537-\tstruct software_node *nodes __free(kfree) =\narch/mips/bcm47xx/buttons.c:538:\t\tkzalloc_objs(*nodes, 1 + nbuttons);\narch/mips/bcm47xx/buttons.c-539-\tif (!nodes)\n--\narch/mips/bcm47xx/buttons.c-542-\tstruct software_node_ref_args *ref_args __free(kfree) =\narch/mips/bcm47xx/buttons.c:543:\t\tkzalloc_objs(*ref_args, nbuttons);\narch/mips/bcm47xx/buttons.c-544-\tif (!ref_args)\n--\narch/mips/kernel/smp-cps.c=295=static void __init cps_prepare_cpus(unsigned int max_cpus)\n--\narch/mips/kernel/smp-cps.c-343-\tnclusters = mips_cps_numclusters();\narch/mips/kernel/smp-cps.c:344:\tmips_cps_cluster_bootcfg = kzalloc_objs(*mips_cps_cluster_bootcfg,\narch/mips/kernel/smp-cps.c-345-\t\t\t\t\t\tnclusters);\n--\narch/mips/kernel/smp-cps.c-354-\t\tncores = mips_cps_numcores(cl);\n\n"
} |
| 37/3 | 2026/10/15 07:10 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 47473 output: 36 thoughts: 7572 Thoughts: **Comprehensive Analysis of QoS Management Configuration in mac80211** Okay, I've thoroughly examined the QoS management configuration process within mac80211, focusing on potential memory safety and logic issues. My primary concern was ensuring all allocated memory is properly initialized and that there are no uninitialized reads. First, I looked at the core function `ieee80211_qos_mgmt_cfg`. The `kzalloc_obj` macro, equivalent to `kcalloc` or `kzalloc`, is used consistently to zero-initialize the memory allocated for `new_qos` when SCS or MSCS is used. I've confirmed that all structures, including `cfg80211_qm_req_data` and `cfg80211_qm_resp_data`, and their sub-structures, are properly zero-initialized during allocation. Specifically, I traced the initialization of `qm_req`, `qm_resp`, and their member arrays and structures. I verified that all fields are explicitly assigned before use. Dynamic memory, such as `qm_req->qm_req_desc` and any `tclas` elements, is zero-initialized using `kzalloc_obj`. I looked at the parsing of the Netlink attributes, especially the TCLAS parameters within `nl80211_parse_qm_desc`, and its subordinate functions like `nl80211_parse_qm_tclas4_elem` and `nl80211_parse_qm_tclas10_elem`, and confirmed all fields that are parsed from netlink attributes are initialized before use. I specifically looked at the `qm_resp` structure. It is initialized to `NL80211_QM_STATUS_DECLINED` before `drv_qos_mgmt_cfg` is called. It is only changed if the driver sets it. If it is legacy SCS or MSCS without qos_char, `drv_qos_mgmt_cfg` is not called, so the status remains `NL80211_QM_STATUS_DECLINED`. The logic is sound here, and the initialized status is never overwritten by anything else. I reviewed the `ieee80211_qos_mgmt_update_scs` and `ieee80211_qos_mgmt_update_mscs` functions. These functions update the QoS settings based on the request type and I confirmed that all reads are on defined/initialized data. The bitmap and array indices used are within valid bounds. Also, the critical fields accessed within the `sta_info` structure (`qos->active_scs_id`, `qos->scs_id_tid_mapping`, `qos->mscs_user_priority_bitmap`, and `qos->mscs_user_priority_limit`) are managed correctly, with appropriate bounds and bit operations. I also inspected the receive and transmit path functions, particularly `ieee80211_qos_mgmt_mscs_set_mark` and `ieee80211_qos_mgmt_set_priority`, to ensure that the QoS tagging and priority setting utilize only initialized values. `rx->skb->priority` and `rx->skb->mark` are all initialized. The `qos` structure is properly dereferenced using `rcu_dereference` to avoid any race conditions. Finally, I checked `sta_info_free` to confirm there were no issues when the `sta_info` structure is freed. The `sta->qos` is replaced with `NULL` under the protection of the wiphy mutex, and I confirmed that `sta->qos` can be null. In summary, my detailed analysis indicates a high degree of memory safety. All allocated structures are zero-initialized, all parsed fields are checked, and all memory is freed. The logic appears sound, with no obvious race conditions or uninitialized reads. The control flow in the case where the driver doesn't set status is also valid. |
| 38/3 | 2026/10/15 07:11 | tool | grepper |
0mError:no matches Args: {
"Expression": "kzalloc.*sta_info",
"PathPrefixes": [
"net/mac80211/"
]
}Results: {
"error": "no matches"
} |
| 39/3 | 2026/10/15 07:11 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 55957 output: 37 thoughts: 48 Thoughts: Here's my thought process, summarized as you requested: **Digging into STA Info Allocation in mac80211** Okay, so I need to understand how station information is allocated and managed within the mac80211 framework. Specifically, I need to know where and how the `sta_info` structures are created and handled. My intuition tells me that the core logic likely resides within `net/mac80211/sta_info.c`. Therefore, I'm going to start by searching that file for instances of `sta_info_alloc`, `sta_info_create`, or any direct pointer allocations of `struct sta_info *`. That should quickly lead me to the relevant allocation functions or macros used by the framework, and I can then trace their usage. This will give me a clear picture of how station information objects are brought into existence. |
| 40/3 | 2026/10/15 07:11 | tool | grepper |
0mArgs:{
"Expression": "kzalloc",
"PathPrefixes": [
"net/mac80211/sta_info.c"
]
}Results: {
"Output": "net/mac80211/sta_info.c=640=__sta_info_alloc(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/sta_info.c-650-\nnet/mac80211/sta_info.c:651:\tsta = kzalloc(sizeof(*sta) + hw-\u003esta_data_size, gfp);\nnet/mac80211/sta_info.c-652-\tif (!sta)\n--\nnet/mac80211/sta_info.c-676-\tif (ieee80211_vif_is_mesh(\u0026sdata-\u003evif)) {\nnet/mac80211/sta_info.c:677:\t\tsta-\u003emesh = kzalloc_obj(*sta-\u003emesh, gfp);\nnet/mac80211/sta_info.c-678-\t\tif (!sta-\u003emesh)\n--\nnet/mac80211/sta_info.c=927=static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)\n--\nnet/mac80211/sta_info.c-941-\nnet/mac80211/sta_info.c:942:\tsinfo = kzalloc_obj(struct station_info);\nnet/mac80211/sta_info.c-943-\tif (!sinfo) {\n--\nnet/mac80211/sta_info.c=1550=static void __sta_info_destroy_part2(struct sta_info *sta, bool recalc)\n--\nnet/mac80211/sta_info.c-1604-\nnet/mac80211/sta_info.c:1605:\tsinfo = kzalloc_obj(*sinfo);\nnet/mac80211/sta_info.c-1606-\tif (sinfo)\n--\nnet/mac80211/sta_info.c=3429=int ieee80211_sta_allocate_link(struct sta_info *sta, unsigned int link_id)\n--\nnet/mac80211/sta_info.c-3446-\nnet/mac80211/sta_info.c:3447:\talloc = kzalloc_obj(*alloc);\nnet/mac80211/sta_info.c-3448-\tif (!alloc)\n"
} |
| 41/3 | 2026/10/15 07:11 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 56873 output: 37 thoughts: 2730 Thoughts: **Analyzing QoS Management Configuration and Memory Safety in nl80211** Okay, so I'm diving into this QoS management code within the nl80211 subsystem. I'm focusing on potential issues, especially memory-related ones, as this is always a crucial area. First, I see that the `sta` structure, including the `sta->qos` field, is zeroed out on allocation via `kzalloc`. That's good; it provides a clean slate. Now, let's scrutinize `nl80211_qos_mgmt_cfg`. Right, I need to methodically check all error paths and variable states in `nl80211_qos_mgmt_cfg`. The code seems generally sound at first glance. It correctly validates required attributes within the Netlink message. Importantly, it allocates `qm_req.qm_req_desc` using `kzalloc_objs`, which zeros the allocated memory. I like that; it mitigates risks of uninitialized memory access. I'm taking note of that `kzalloc_objs` usage. I'm paying close attention to the `nla_for_each_nested` loops used for parsing descriptors. I notice a counter, `num_qm_desc`, is incremented within the loops, indicating the number of valid descriptors parsed. The code allocates memory for `qm_req.qm_req_desc` based on this count. That's fine, however, a critical point pops up: the `nl80211_free_qm_req` function which is called in the case of a failure is important. Now, here's where my alarm bells start to ring: If `nl80211_parse_qm_desc` fails, it may have partially parsed some descriptors, incrementing `qm_req.num_qm_desc`, however, it can also have allocated resources for tclas, which are not freed in case of error. This is a potential memory leak! Okay, but this is a memory *leak*, not a KMSAN-detectable uninitialized memory read; kmemleak should catch this. I'm checking `nl80211_parse_qm_desc` itself, and in there, I need to look closely at `nl80211_parse_qm_tclas`, because `tclas` allocation happens there. If `nl80211_parse_qm_tclas` fails *midway*, it could mean partially allocated `tclas` elements, which is another memory leak if not handled properly. I'm checking `nl80211_parse_qm_qos_attr` as well. Its failing mid-way could mean that `qm_req.num_qm_desc` has NOT been incremented yet, so the tclas' memory gets leaked, as there is no corresponding decrement to match the failed operation. Again, this results in a memory leak. Okay, let's now check the response path. The code generates a response message using `nl80211_qm_send_resp`. I see the `qm_resp_desc->status` and `qm_resp_desc->qm_id` fields are put in the response message. A quick sanity check reveals everything gets packed into netlink attributes as 8-bit values using `nla_put_u8`. No data is packed outside of the attributes, or with padding; that part seems safe in terms of uninitialized reads. Just for thoroughness, I'll go through the `nla_put` calls to confirm how they handle the padding. Need to make sure the library doesn't leave uninitialized padding in the buffer. Okay, all looks good. |
| 42/3 | 2026/10/15 07:11 | tool | grepper |
0mError:no matches Args: {
"Expression": "static inline int nla_put\\(",
"PathPrefixes": [
"include/net/netlink.h"
]
}Results: {
"error": "no matches"
} |
| 43/3 | 2026/10/15 07:11 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 60454 output: 44 thoughts: 12 Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience: **Hunting Down `nla_put`** Right, let's get down to brass tacks. I need to nail down the precise definition of `nla_put`. It's a fundamental function in Netlink, and understanding its exact behavior, especially in relation to memory allocation and the Netlink attribute structure, is crucial. I need to quickly recall the nuances surrounding its use. Specifically, I need to know how it interacts with the attribute length, padding considerations and memory management, and any potential implications for performance. Is it an in-place modification, or does it require a copy? Are there documented edge cases I need to remember? Let's get to the source code and documentation. Time to dig in. |
| 44/3 | 2026/10/15 07:11 | tool | grepper |
0mArgs:{
"Expression": "int nla_put\\(",
"PathPrefixes": [
"include/net/netlink.h",
"lib/nlattr.c"
]
}Results: {
"Output": "include/net/netlink.h=566=void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);\ninclude/net/netlink.h:567:int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data);\ninclude/net/netlink.h-568-int nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,\n--\nlib/nlattr.c=1082=EXPORT_SYMBOL(__nla_put_nohdr);\n--\nlib/nlattr.c-1093- */\nlib/nlattr.c:1094:int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)\nlib/nlattr.c-1095-{\n"
} |
| 45/3 | 2026/10/15 07:11 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 60910 output: 35 thoughts: 20 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into `lib/nlattr.c`** Okay, let's zero in on `lib/nlattr.c` – specifically, around line 1094. I need to understand how they are handling that particular network link attribute. I'm hoping to get a clearer picture of the underlying data structure manipulation, especially with respect to the `nlattr` structure itself. Given the context, I'm expecting to find either attribute validation, data extraction for the specific link type or configuration, or maybe even a critical piece of the allocation/deallocation process related to this specific attribute. I'm looking for clues about potential vulnerabilities or, conversely, elegant implementations of data consistency or efficiency mechanisms. My primary aim is to gain a deeper insight into this attribute's role in the larger framework. Let’s see what they've done... |
| 46/3 | 2026/10/15 07:11 | tool | read-file |
0mArgs:{
"File": "lib/nlattr.c",
"FirstLine": 1090,
"LineCount": 20
}Results: {
"Contents": "1090:\t *\n1091:\t * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store\n1092:\t * the attribute header and payload.\n1093:\t */\n1094:\tint nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)\n1095:\t{\n1096:\t\tif (unlikely(skb_tailroom(skb) \u003c nla_total_size(attrlen)))\n1097:\t\t\treturn -EMSGSIZE;\n1098:\t\n1099:\t\t__nla_put(skb, attrtype, attrlen, data);\n1100:\t\treturn 0;\n1101:\t}\n1102:\tEXPORT_SYMBOL(nla_put);\n1103:\t\n1104:\t/**\n1105:\t * nla_put_64bit - Add a netlink attribute to a socket buffer and align it\n1106:\t * @skb: socket buffer to add attribute to\n1107:\t * @attrtype: attribute type\n1108:\t * @attrlen: length of attribute payload\n1109:\t * @data: head of attribute payload\n"
} |
| 47/3 | 2026/10/15 07:11 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 61490 output: 45 thoughts: 11 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Analyzing the Call to `__nla_put`** Right, let's dive into this. "Let's see `__nla_put`." This signals a focused examination of a specific function, `__nla_put`. Immediately, I'm thinking: this likely sits within the context of Netlink, or perhaps more broadly, within a system call interface that deals with attribute-value pairs, given the "nla" prefix suggesting "Netlink Attribute." My initial questions revolve around its purpose – is it a low-level helper for constructing Netlink messages, or is it exposed as part of a more general attribute management framework? I'll need to understand its parameters; what arguments are being passed? Likely, I'll be looking for things like the attribute type (NLA_*) the attribute length, a pointer to the attribute's data, and maybe even a pointer to the buffer where the attribute should be written. I'm keen to see if it's responsible for managing alignment or padding requirements, or if that is handled higher up in the call stack. Ultimately, my goal is to understand how it contributes to the larger message construction process and to evaluate its potential impact on performance and memory management. |
| 48/3 | 2026/10/15 07:12 | tool | grepper |
0mArgs:{
"Expression": "void __nla_put\\(",
"PathPrefixes": [
"include/net/netlink.h",
"lib/nlattr.c"
]
}Results: {
"Output": "include/net/netlink.h=561=void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen);\ninclude/net/netlink.h:562:void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,\ninclude/net/netlink.h-563-\t const void *data);\n--\nlib/nlattr.c=1023=EXPORT_SYMBOL(nla_reserve_nohdr);\n--\nlib/nlattr.c-1034- */\nlib/nlattr.c:1035:void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,\nlib/nlattr.c-1036-\t\t\t const void *data)\n"
} |
| 49/3 | 2026/10/15 07:12 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 62033 output: 35 thoughts: 19 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into `lib/nlattr.c`** Okay, let's zero in on `lib/nlattr.c` around line 1035. I'm going to jump in there directly because the code around that area is likely dealing with... well, based on the context of this project, I'm expecting something related to netlink attributes. Probably some manipulation, parsing, or maybe even construction of `nlattr` structures themselves. I need to understand what's happening at that specific point. It’s either a point of interest because of recent changes or a known location for some functionality I'm trying to wrap my head around. Perhaps I'm tracing a bug related to attribute handling, or maybe I’m attempting to optimize a certain part of the code and this is the specific function. I need to ascertain the intention of the original developer. I want to understand: is this structure well-formed? Are the data types correctly handled? Is there a subtle bug? Or am I about to discover a novel and more elegant way of implementing my idea? I need to get my hands dirty. |
| 50/3 | 2026/10/15 07:12 | tool | read-file |
0mArgs:{
"File": "lib/nlattr.c",
"FirstLine": 1030,
"LineCount": 25
}Results: {
"Contents": "1030:\t * @data: head of attribute payload\n1031:\t *\n1032:\t * The caller is responsible to ensure that the skb provides enough\n1033:\t * tailroom for the attribute header and payload.\n1034:\t */\n1035:\tvoid __nla_put(struct sk_buff *skb, int attrtype, int attrlen,\n1036:\t\t\t\t const void *data)\n1037:\t{\n1038:\t\tstruct nlattr *nla;\n1039:\t\n1040:\t\tnla = __nla_reserve(skb, attrtype, attrlen);\n1041:\t\tmemcpy(nla_data(nla), data, attrlen);\n1042:\t}\n1043:\tEXPORT_SYMBOL(__nla_put);\n1044:\t\n1045:\t/**\n1046:\t * __nla_put_64bit - Add a netlink attribute to a socket buffer and align it\n1047:\t * @skb: socket buffer to add attribute to\n1048:\t * @attrtype: attribute type\n1049:\t * @attrlen: length of attribute payload\n1050:\t * @data: head of attribute payload\n1051:\t * @padattr: attribute type for the padding\n1052:\t *\n1053:\t * The caller is responsible to ensure that the skb provides enough\n1054:\t * tailroom for the attribute header and payload.\n"
} |
| 51/3 | 2026/10/15 07:12 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 62733 output: 33 thoughts: 8 Thoughts: Okay, here's the summary, expressed as your thoughts, assuming you are an expert in your field. **Navigating the `__nla_reserve` Conundrum** Alright, let's break this down. When I see mention of `__nla_reserve`, my mind immediately jumps to Netlink attributes, particularly the need for pre-allocation and avoiding fragmentation headaches. This function, or likely a macro, is likely involved in reserving space within a Netlink attribute structure. It's almost certain this is happening during the construction phase of a Netlink message, either a generic message or one pertaining to a specific Netlink family. The "reserve" part implies that you're *guaranteeing* space, whether for headers, nested attributes, or data itself. This is crucial for avoiding later reallocation, which is slow and can introduce all sorts of problems in a concurrent environment, especially in kernel space. I'm guessing this function likely calculates the required length, does some alignment calculations based on the specified attribute type (`NLA_U8`, `NLA_STRING`, etc.) and the data to be added, and updates internal pointers or counters accordingly. The primary concern is, without a doubt, the efficiency of attribute serialization and, by extension, the overall performance of the Netlink communication, be it setting kernel variables, or fetching data. The context is essential here. Is it being used inside a macro, as part of a `struct nlattr` implementation, or perhaps in the serialization of an object. The actual implementation details would make a lot of difference. Any potential misuse could lead to buffer overflows and memory corruption, which is why you can't be careless about it. |
| 52/3 | 2026/10/15 07:12 | tool | grepper |
0mArgs:{
"Expression": "__nla_reserve\\(",
"PathPrefixes": [
"lib/nlattr.c"
]
}Results: {
"Output": "lib/nlattr.c=887=EXPORT_SYMBOL(nla_strcmp);\n--\nlib/nlattr.c-901- */\nlib/nlattr.c:902:struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)\nlib/nlattr.c-903-{\n--\nlib/nlattr.c=930=struct nlattr *__nla_reserve_64bit(struct sk_buff *skb, int attrtype,\n--\nlib/nlattr.c-934-\nlib/nlattr.c:935:\treturn __nla_reserve(skb, attrtype, attrlen);\nlib/nlattr.c-936-}\n--\nlib/nlattr.c=967=struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)\n--\nlib/nlattr.c-971-\nlib/nlattr.c:972:\treturn __nla_reserve(skb, attrtype, attrlen);\nlib/nlattr.c-973-}\n--\nlib/nlattr.c=1035=void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,\n--\nlib/nlattr.c-1039-\nlib/nlattr.c:1040:\tnla = __nla_reserve(skb, attrtype, attrlen);\nlib/nlattr.c-1041-\tmemcpy(nla_data(nla), data, attrlen);\n"
} |
| 53/3 | 2026/10/15 07:12 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 63527 output: 34 thoughts: 18 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Diving into `nlattr.c` Around Line 902** Alright, let's get down to brass tacks. I'm thinking, "right, where do we start?" and immediately zeroing in on `lib/nlattr.c` around line 902. This likely means I'm looking for something specific within the Netlink attribute handling code. My intuition is telling me that this particular section is important. It could be related to a specific attribute type, error handling, validation, perhaps even a crucial parsing or packing operation. Given the location within `nlattr.c`, it's probably concerned with a more intricate aspect of the attribute processing than something fundamental. Line 902 is likely the *start* of the important function, or *within* the significant lines of code. I'm probably anticipating a particular pattern or potential issue. Perhaps I'm trying to trace a bug, understand a specific behavior, or perhaps it's related to an optimization I'm considering. My experience says that by digging into this segment of the code I'll gain insight into how a network attribute is defined and how I can control this. |
| 54/3 | 2026/10/15 07:12 | tool | read-file |
0mArgs:{
"File": "lib/nlattr.c",
"FirstLine": 900,
"LineCount": 25
}Results: {
"Contents": " 900:\t * tailroom for the attribute header and payload.\n 901:\t */\n 902:\tstruct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)\n 903:\t{\n 904:\t\tstruct nlattr *nla;\n 905:\t\n 906:\t\tnla = skb_put(skb, nla_total_size(attrlen));\n 907:\t\tnla-\u003enla_type = attrtype;\n 908:\t\tnla-\u003enla_len = nla_attr_size(attrlen);\n 909:\t\n 910:\t\tmemset((unsigned char *) nla + nla-\u003enla_len, 0, nla_padlen(attrlen));\n 911:\t\n 912:\t\treturn nla;\n 913:\t}\n 914:\tEXPORT_SYMBOL(__nla_reserve);\n 915:\t\n 916:\t/**\n 917:\t * __nla_reserve_64bit - reserve room for attribute on the skb and align it\n 918:\t * @skb: socket buffer to reserve room on\n 919:\t * @attrtype: attribute type\n 920:\t * @attrlen: length of attribute payload\n 921:\t * @padattr: attribute type for the padding\n 922:\t *\n 923:\t * Adds a netlink attribute header to a socket buffer and reserves\n 924:\t * room for the payload but does not copy it. It also ensure that this\n"
} |
| 55/3 | 2026/10/15 07:12 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 64266 output: 20 thoughts: 821 Thoughts: **Analyzing QoS Management Configuration and Zeroing in mac80211** Okay, first things first, that `memset` call, `memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen));` properly zeros the netlink padding bytes. Good, we're not missing anything obvious there. Now, let's circle back to `nl80211_parse_qm_desc`. The `switch` statement handles the request types. If it's a `NL80211_QM_REMOVE_REQ`, it just returns 0. That makes sense. The `qm_req.qm_req_desc[i]` will then only have `qm_id` and `request_type` filled, and all the rest will be zero due to `kzalloc_objs`. This aligns with how `ieee80211_qos_mgmt_update_scs` behaves: it only uses the `qm_id` field in the `REMOVE_REQ` case, so all the zeroing is perfectly fine. Similarly, in `ieee80211_qos_mgmt_update_mscs`, the code just sets fields to 0 or false, so all is well there as well. Moving on to `ieee80211_qos_mgmt_cfg`: `kzalloc_obj` is employed here, which means the memory is zero-initialized. If there's an `old_qos` struct, we copy `old_qos->data` to the `new_qos` struct. The copy of data is fine here, as `old_qos` is already properly initialized. Hold on... what about the driver callback, `qos_mgmt_cfg`? The code calls `drv_qos_mgmt_cfg`. In there we have `trace_drv_qos_mgmt_cfg` and then the call to the driver's function: `local->ops->qos_mgmt_cfg(&local->hw, &sdata->vif, sta, qm_req, qm_resp);`. It seems that no driver currently implements this callback in this patch. So, it's just the framework/mac80211 at this point. But... are there any driver implementations in the kernel tree at all? I need to check if any driver has implemented that function before I can completely trust the framework handling. I will need to search the entire tree to be certain. |
| 56/3 | 2026/10/15 07:12 | tool | grepper |
0mError:no matches Args: {
"Expression": "\\.qos_mgmt_cfg"
}Results: {
"error": "no matches"
} |
| 57/3 | 2026/10/15 07:12 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 65658 output: 532 thoughts: 4023 Thoughts: **KMSAN Not Needed: No Uninitialized Memory Risks**
Okay, after carefully reviewing the code changes, I've concluded that this patch does *not* introduce any risks related to uninitialized memory. Therefore, `NeedsKMSAN = false`. My reasoning is as follows:
1. **Standard Detectors Adequately Cover Risks:** The changes primarily involve parsing Netlink attributes, managing Quality of Service (QoS) configurations, and tagging packets based on these configurations. Any potential issues stemming from this could be memory leaks (if errors happen during parsing), logic errors (like incorrect QoS handling), or concurrency problems (related to RCU and locking when accessing QoS state). However, these classes of bugs are already efficiently caught by standard kernel debuggers such as KASAN (Kernel Address Sanitizer), LOCKDEP (lock dependency validator), and kmemleak (kernel memory leak detector). I don't see any risks *specific* to KMSAN.
2. **Explicit Initialization of All Data Structures:** Every data structure introduced or modified in this patch is explicitly initialized:
* Stack variables like `qm_req`, `qm_resp` are zero-initialized using `= {}`.
* Heap allocations, such as the descriptions and associated structures (`qm_req.qm_req_desc`, `qm_req_desc->tclas`, `qm_resp.qm_resp_desc`, `new_qos`) are performed using `kzalloc_objs` or `kzalloc_obj`, which guarantee zero-initialization.
3. **Safe User-Space Data Exposure:** The Netlink message construction in `nl80211_qm_send_resp` is carefully managed. Data sent to user space (via `nla_put_u8`, `nla_put` with ETH_ALEN) involves explicit assignments of values derived from validated inputs or initialized structures. Notably, `nla_put` functions explicitly zero any padding within the Netlink attribute. No raw kernel structures or potentially uninitialized fields are copied directly to userspace. This ensures that no information leaks occur.
4. **RX/TX Fast Path Safety:** The modifications to the RX and TX fast paths (in `ieee80211_qos_mgmt_mscs_set_mark` and `ieee80211_qos_mgmt_set_priority`) operate on packet metadata like `skb->mark` and `skb->priority`, which are initialized by the kernel network stack, and state like `sta->qos` protected by RCU and initialized on allocation, guaranteeing there are no risks of uninitialized memory reads.
In short, there is no chance that this code introduces any situation where uninitialized memory would be read or leaked to userspace. All allocations are zero-initialized, all code paths operating on complex structures or passing information to userspace are carefully checked. Any bugs would be out-of-bounds accesses, leaks or standard memory errors covered by standard debuggers.
|
| 58/3 | 2026/10/15 07:12 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series adds support for QoS Management (Stream Classification Service / Mirrored SCS) configuration via nl80211 (NL80211_CMD_QOS_MGMT), implementing request parsing, response generation, mac80211 state management, and packet priority tagging.\n\nKMSAN vs KASAN Applicability:\n1. Heap and Stack Initialization: All newly introduced or modified structures and arrays are explicitly zero-initialized. Specifically, `struct cfg80211_qm_req_data qm_req` and `struct cfg80211_qm_resp_data qm_resp` on the stack are initialized with `= {}`. Dynamic buffers (`qm_req.qm_req_desc`, `qm_req_desc-\u003etclas`, and `qm_resp.qm_resp_desc`) are allocated with `kzalloc_objs()`. The RCU-managed per-station state (`new_qos`) is allocated with `kzalloc_obj()`.\n2. Kernel-to-User Info-leaks: The response message returned to userspace via Netlink (`nl80211_qm_send_resp`) only serializes discrete, fully-initialized fields (`qm_id` and `status` via `nla_put_u8`, and `peer_mac` via `nla_put` from validated input). Netlink's attribute reservation (`__nla_reserve`) explicitly zero-pads attributes. No kernel structs or padding bytes are copied raw to userspace.\n3. Fast-path packet processing: The RX mark setting (`ieee80211_qos_mgmt_mscs_set_mark`) and TX priority classification (`ieee80211_qos_mgmt_set_priority`) only read already-initialized packet fields (`skb-\u003emark`, `skb-\u003epriority`) and verified fields within the zero-initialized RCU QoS structure.\n4. Bugs that could potentially arise in this code (such as array out-of-bounds indexing, NULL pointer dereferences, RCU/lockdep locking inconsistencies, or memory leaks on early parse failures) are already detected by KASAN, LOCKDEP, and KMEMLEAK under the standard configuration.\n\nSince no uninitialized memory risks or uninitialized info-leaks are introduced, a dedicated KMSAN fuzzing session is not justified.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series adds support for QoS Management (Stream Classification Service / Mirrored SCS) configuration via nl80211 (NL80211_CMD_QOS_MGMT), implementing request parsing, response generation, mac80211 state management, and packet priority tagging.\n\nKMSAN vs KASAN Applicability:\n1. Heap and Stack Initialization: All newly introduced or modified structures and arrays are explicitly zero-initialized. Specifically, `struct cfg80211_qm_req_data qm_req` and `struct cfg80211_qm_resp_data qm_resp` on the stack are initialized with `= {}`. Dynamic buffers (`qm_req.qm_req_desc`, `qm_req_desc-\u003etclas`, and `qm_resp.qm_resp_desc`) are allocated with `kzalloc_objs()`. The RCU-managed per-station state (`new_qos`) is allocated with `kzalloc_obj()`.\n2. Kernel-to-User Info-leaks: The response message returned to userspace via Netlink (`nl80211_qm_send_resp`) only serializes discrete, fully-initialized fields (`qm_id` and `status` via `nla_put_u8`, and `peer_mac` via `nla_put` from validated input). Netlink's attribute reservation (`__nla_reserve`) explicitly zero-pads attributes. No kernel structs or padding bytes are copied raw to userspace.\n3. Fast-path packet processing: The RX mark setting (`ieee80211_qos_mgmt_mscs_set_mark`) and TX priority classification (`ieee80211_qos_mgmt_set_priority`) only read already-initialized packet fields (`skb-\u003emark`, `skb-\u003epriority`) and verified fields within the zero-initialized RCU QoS structure.\n4. Bugs that could potentially arise in this code (such as array out-of-bounds indexing, NULL pointer dereferences, RCU/lockdep locking inconsistencies, or memory leaks on early parse failures) are already detected by KASAN, LOCKDEP, and KMEMLEAK under the standard configuration.\n\nSince no uninitialized memory risks or uninitialized info-leaks are introduced, a dedicated KMSAN fuzzing session is not justified.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|