1: 9e8af434fb8a ! 1: d91b71b1d2f4 wifi: ath11k: validate DMA buffer release TLV lengths @@ drivers/net/wireless/ath/ath11k/wmi.c: static const struct wmi_tlv_policy wmi_tl .min_len = sizeof(struct wmi_p2p_noa_event) }, [WMI_TAG_PDEV_CSA_SWITCH_COUNT_STATUS_EVENT] = { .min_len = sizeof(struct wmi_pdev_csa_switch_ev) }, ++ [WMI_TAG_DMA_BUF_RELEASE] = { ++ .min_len = sizeof(struct ath11k_wmi_dma_buf_release_fixed_param) },  + [WMI_TAG_DMA_BUF_RELEASE_ENTRY] = {  + .min_len = sizeof(struct wmi_dma_buf_release_entry) - TLV_HDR_SIZE },  + [WMI_TAG_DMA_BUF_RELEASE_SPECTRAL_META_DATA] = { 2: bf49bddd1b25 = 2: 69ce2d4665ac wifi: ath11k: validate hardware mode capability TLVs 3: 46fdca8899e4 = 3: c14bd9d5552d wifi: ath11k: validate DMA ring capability TLVs 4: 83c54fae31de ! 4: 25d956025f7e wifi: ath12k: validate DMA buffer release fixed TLV length @@ Metadata Author: Jiale Yao   ## Commit message ## - wifi: ath12k: validate DMA buffer release fixed TLV length + wifi: ath12k: validate DMA buffer release TLV lengths  - The DMA buffer release parser copies the fixed parameters from a - firmware TLV without checking that its payload contains the complete - structure. A short TLV can therefore make the structure copy read past - the declared payload. + The DMA buffer release parser copies fixed parameters and counts nested + entry and metadata TLVs. It does not ensure that their payloads cover + the complete structures later read by the parser and direct buffer ring + handler. Short firmware TLVs can therefore lead to out-of-bounds reads.  - Add a minimum-length policy for the fixed DMA buffer release TLV. + Add minimum-length policies for the fixed TLV and both nested TLV types.  Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Cc: stable@vger.kernel.org @@ drivers/net/wireless/ath/ath12k/wmi.c: static const struct ath12k_wmi_tlv_policy .min_len = sizeof(struct ath12k_wmi_pdev_csa_event) },  + [WMI_TAG_DMA_BUF_RELEASE] = {  + .min_len = sizeof(struct ath12k_wmi_dma_buf_release_fixed_params) }, ++ [WMI_TAG_DMA_BUF_RELEASE_ENTRY] = { ++ .min_len = sizeof(struct ath12k_wmi_dma_buf_release_entry_params) - ++ TLV_HDR_SIZE }, ++ [WMI_TAG_DMA_BUF_RELEASE_SPECTRAL_META_DATA] = { ++ .min_len = sizeof(struct ath12k_wmi_dma_buf_release_meta_data_params) - ++ TLV_HDR_SIZE }, };  __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) 5: da4e4a764b45 ! 5: de7e1681834b wifi: ath12k: validate service-ready capability TLV lengths @@ Commit message  ## drivers/net/wireless/ath/ath12k/wmi.c ##  @@ drivers/net/wireless/ath/ath12k/wmi.c: static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = { - .min_len = sizeof(struct ath12k_wmi_pdev_csa_event) }, - [WMI_TAG_DMA_BUF_RELEASE] = { - .min_len = sizeof(struct ath12k_wmi_dma_buf_release_fixed_params) }, + [WMI_TAG_DMA_BUF_RELEASE_SPECTRAL_META_DATA] = { + .min_len = sizeof(struct ath12k_wmi_dma_buf_release_meta_data_params) - + TLV_HDR_SIZE },  + [WMI_TAG_HW_MODE_CAPABILITIES] = {  + .min_len = sizeof(struct ath12k_wmi_hw_mode_cap_params) - TLV_HDR_SIZE },  + [WMI_TAG_DMA_RING_CAPABILITIES] = {