Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp519428pxb; Thu, 19 Nov 2020 07:11:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnip/gFYzYXeGNLdhltHDQT5A4q0jqUgRc7BpaVALVZnw/bNCKYd2uFfkDmPlriR93mDz6 X-Received: by 2002:a50:875d:: with SMTP id 29mr12356207edv.172.1605798694641; Thu, 19 Nov 2020 07:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605798694; cv=none; d=google.com; s=arc-20160816; b=s2YyqU6mmtO5j/A2f1TUE4O6KtAzCsXl3mL43PncwwFVnqIQwF85qKWC4NkRjHGC+Z vdrikp2WOE016bYDSoy9jvQhWcbpEnuQ6smVH/vcOmT+g5RYleYi2PeVX0qVj+151VWv TBEMzTkB1q+47H+GkZv3ZJoiyZuqfyHtep/BEiFyD9wCbY9RamiPyCosuSLav5IzSH9N JItSEodj0qZBWNUk30jc3W9UWu4jLae0dWnHytz3pA4gt/rlMotfIvaAfz5BwXVR4UGl oHn3cNUKxxX1UPjVHl9hTq+0u37Sm+UeW3QHHOZHW/vs6vlK695plEz0z3/ch3gX3/1V Zffg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QAB02+/JKvAreox33eAGXaLpOOGb6c+roXTp6gkh2kg=; b=NM+oZP5NoMk9a+ov6uW8UC/dTaiMpPXBiSrI+QCM2CHQxDwmAETM+rxQDaDZtcGLMy v/IKQrVKkYtxP/kJlMDmophXykJxXTA1MhYu8r9Z4XiQSytp1YVBJyu7z8fkofA8P4sK HVnw/nGO7CZd4RHYOK0N/nPA7HsxGdAy+vdTEXoW05GyIUkPZZGVtrFZsoZUMb7WOZWb sc9Ib6rGgPAf1f9km6x/LTFSAtO8arFEToI0Us7+Wi9L/Y/nXaqcc0rp4ODwMwHxR8gh BbCwETklcksNqL0U+M3JL50abt5oxtaw4OAFvugkFGoVrei+hUMJxGyRR9PeLPWMRVEj b4Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=p3JdzyAp; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si16726592ejd.678.2020.11.19.07.11.09; Thu, 19 Nov 2020 07:11:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=p3JdzyAp; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728359AbgKSPHZ (ORCPT + 99 others); Thu, 19 Nov 2020 10:07:25 -0500 Received: from dvalin.narfation.org ([213.160.73.56]:44584 "EHLO dvalin.narfation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbgKSPHY (ORCPT ); Thu, 19 Nov 2020 10:07:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1605798442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QAB02+/JKvAreox33eAGXaLpOOGb6c+roXTp6gkh2kg=; b=p3JdzyApjqwpQ914tVTHYoA8ncNUEJeSrZK3FMLWxQ/oUYjsAok39uxme72RaryfJQ4kiz wNnkhCkt0H2s8R7r7XJfTGbrPYOhZ7RB6aNWSo3j6yDv+xkdWwnMkn1+H3BwN8CkIjtQ/2 teyo7SarT2XvDbAAoc2x3sRB5UfJ6r0= From: Sven Eckelmann To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Sven Eckelmann Subject: [PATCH 1/2] ath11k: Don't cast ath11k_skb_cb to ieee80211_tx_info.control Date: Thu, 19 Nov 2020 16:06:13 +0100 Message-Id: <20201119150614.216644-1-sven@narfation.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The driver_data area of ieee80211_tx_info is used in ath11k for ath11k_skb_cb. The first function in the TX patch which rewrites it to ath11k_skb_cb is already ath11k_mac_op_tx. No one else in the code path must use it for something else before it reinitializes it. Otherwise the data has to be considered uninitialized or corrupt. But the ieee80211_tx_info.control shares exactly the same area as ieee80211_tx_info.driver_data and ath11k is still using it. This results in best case in a ath11k c000000.wifi1: no vif found for mgmt frame, flags 0x0 or (slightly worse) in a kernel oops. Instead, the interesting data must be moved first into the ath11k_skb_cb and ieee80211_tx_info.control must then not be used anymore. Tested-on: IPQ8074 hw2.0 WLAN.HK.2.4.0.1.r1-00026-QCAHKSWPL_SILICONZ-2 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Sven Eckelmann --- drivers/net/wireless/ath/ath11k/mac.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 7f8dd47d2333..0296ba925455 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3977,21 +3977,20 @@ static void ath11k_mgmt_over_wmi_tx_purge(struct ath11k *ar) static void ath11k_mgmt_over_wmi_tx_work(struct work_struct *work) { struct ath11k *ar = container_of(work, struct ath11k, wmi_mgmt_tx_work); - struct ieee80211_tx_info *info; + struct ath11k_skb_cb *skb_cb; struct ath11k_vif *arvif; struct sk_buff *skb; int ret; while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { - info = IEEE80211_SKB_CB(skb); - if (!info->control.vif) { - ath11k_warn(ar->ab, "no vif found for mgmt frame, flags 0x%x\n", - info->control.flags); + skb_cb = ATH11K_SKB_CB(skb); + if (!skb_cb->vif) { + ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); ieee80211_free_txskb(ar->hw, skb); continue; } - arvif = ath11k_vif_to_arvif(info->control.vif); + arvif = ath11k_vif_to_arvif(skb_cb->vif); if (ar->allocated_vdev_map & (1LL << arvif->vdev_id) && arvif->is_started) { ret = ath11k_mac_mgmt_tx_wmi(ar, arvif, skb); @@ -4004,8 +4003,8 @@ static void ath11k_mgmt_over_wmi_tx_work(struct work_struct *work) } } else { ath11k_warn(ar->ab, - "dropping mgmt frame for vdev %d, flags 0x%x is_started %d\n", - arvif->vdev_id, info->control.flags, + "dropping mgmt frame for vdev %d, is_started %d\n", + arvif->vdev_id, arvif->is_started); ieee80211_free_txskb(ar->hw, skb); } @@ -4053,10 +4052,13 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif = info->control.vif; struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + u32 info_flags = info->flags; bool is_prb_rsp; int ret; - if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { + skb_cb->vif = vif; + + if (info_flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; } else if (ieee80211_is_mgmt(hdr->frame_control)) { is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); -- 2.29.2