When the WMI_RX_STATUS_EXT_INFO flag is set in a management frame rx event, ath10k reads sizeof(struct wmi_mgmt_rx_ext_info) (8 bytes) starting at ALIGN(msdu_len, 4) from the skb. However, the bounds check only validates that skb->len >= msdu_len, not that the skb is large enough for the aligned offset plus the ext_info struct. If msdu_len is close to skb->len (e.g., msdu_len=99, skb->len=99), ALIGN(99, 4)=100, and the 8-byte ext_info read accesses bytes [100..107], up to 9 bytes past the validated region. Add a bounds check ensuring skb->len is large enough for the aligned buffer length plus the ext_info struct before accessing it. Both ath10k_wmi_op_pull_mgmt_rx_ev() and ath10k_wmi_10_4_op_pull_mgmt_rx_ev() are fixed. Fixes: 7d5efd088833 ("ath10k: parse Rx MAC timestamp in mgmt frame for FW 10.4") Cc: stable@vger.kernel.org Signed-off-by: Tanuj Sharma --- drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index e57588c..91142ab 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -2346,6 +2346,8 @@ static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb, if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) { len = ALIGN(le32_to_cpu(arg->buf_len), 4); + if (skb->len < len + sizeof(struct wmi_mgmt_rx_ext_info)) + return -EPROTO; ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len); memcpy(&arg->ext_info, ext_info, sizeof(struct wmi_mgmt_rx_ext_info)); @@ -2390,6 +2392,8 @@ static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar, if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) { len = ALIGN(le32_to_cpu(arg->buf_len), 4); + if (skb->len < len + sizeof(struct wmi_mgmt_rx_ext_info)) + return -EPROTO; ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len); memcpy(&arg->ext_info, ext_info, sizeof(struct wmi_mgmt_rx_ext_info)); -- 2.43.0