Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1301328ybt; Thu, 25 Jun 2020 02:46:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVTO23sXx7af9fwcdowo+765COcLDKFvGb4fFF5byHXxRrJdCOQjXrXCXdavaCoK9l9ury X-Received: by 2002:a17:906:94c4:: with SMTP id d4mr15527428ejy.232.1593078414237; Thu, 25 Jun 2020 02:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593078414; cv=none; d=google.com; s=arc-20160816; b=n3qaEG5MZuj4vaaUlarn/4mAjQ3lz04nX+aJ0XtGYHuStQKLWWAQvWq459jA81iIr5 q4foXDJMW8SzsTjBgcOewmM1CSBNgFK1czHFRXqmzvHNc4VItYxIXcbhZTmFiorPYjlW RSHGJoMlpIpZbZZO+VhIJm0a2X1w17pUiqbXQLgVc+ABoWFBMrJaI5Gv907qTgoBfrGD QCJQ03f9VH/E8uqczH8dfk/2pBCsvkPLUR1NuwE6Xvy+6zqE+q0eMVcxxS0Jel1DEDLg 8CkpEdbt5lsnRqXl5f/bvWdeabR4OyKclG5zqCdKhxVqaRAZK+/BDvVbroQGQIYQf+xt Yk+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ejBKRLzqWfSU7RYmkorlKoQoTAjvJvLG36V6vWfHA8I=; b=oD138OL8/Yn3QXbYgWMNSDYwbkfpFDjFfTdQZ1XKziSASG1UKusgEs95hYsNx8KZuq 2tfQ+d8ZWkmkMWytxiMHhtysQBfY/HRttKg4KpNvpKZbB14+UaqUaJTQ7j4y8bGSO04C wKT8CY9INigGbQfOCXqTeja6gojOe7YrfTY0GJzJNdsxz2bnBJJ0T/4q/w2f7YMBv9v7 oxThBop8LrAld46FGv6EfXVTZHgUZIGwNzJ6k6jx9VvOuxapVgXXSw20NeDTlhI9TYQH +oISuAmcpIf4zNm17bSROyUQbTODPVMXvsuHE0wiBGVn4U4P5xCtSeW/z7EsYtJPjA9k nSPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si15966366edr.468.2020.06.25.02.46.30; Thu, 25 Jun 2020 02:46:54 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403793AbgFYIsf (ORCPT + 99 others); Thu, 25 Jun 2020 04:48:35 -0400 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:50048 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390216AbgFYIsf (ORCPT ); Thu, 25 Jun 2020 04:48:35 -0400 Received: from legolas.prakinf.tu-ilmenau.de (unknown [141.24.207.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 9D4B358005E; Thu, 25 Jun 2020 10:48:32 +0200 (CEST) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, j@w1.fi, Markus Theil , kernel test robot Subject: [PATCH v4] mac80211: fix control port tx status check Date: Thu, 25 Jun 2020 10:48:31 +0200 Message-Id: <20200625084831.5094-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The initial control port tx status patch assumed, that we have IEEE 802.11 frames, but actually ethernet frames are stored in the ack skb. Fix this by checking for the correct ethertype and skb protocol 802.3. Also allow tx status reports for ETH_P_PREAUTH, as preauth frames can also be send over the nl80211 control port. Fixes: a7528198add8 ("mac80211: support control port TX status reporting") Reported-by: kernel test robot Reported-by: Jouni Malinen Signed-off-by: Markus Theil --- v4: add cast, reported by Intel kernel test robot v3: also check for ETH_P_PREAUTH v2: use __be16, as suggested by Johannes Berg net/mac80211/status.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 7b1bacac39c6..d6edd3acda0a 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -639,11 +639,23 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie; struct ieee80211_sub_if_data *sdata; struct ieee80211_hdr *hdr = (void *)skb->data; + __be16 ethertype = (__be16)0xffff; + + if (skb->len >= ETH_HLEN && skb->protocol == cpu_to_be16(ETH_P_802_3)) + skb_copy_bits(skb, 2 * ETH_ALEN, ðertype, ETH_TLEN); rcu_read_lock(); sdata = ieee80211_sdata_from_skb(local, skb); if (sdata) { - if (ieee80211_is_any_nullfunc(hdr->frame_control)) + if (ethertype == sdata->control_port_protocol || + ethertype == cpu_to_be16(ETH_P_PREAUTH)) + cfg80211_control_port_tx_status(&sdata->wdev, + cookie, + skb->data, + skb->len, + acked, + GFP_ATOMIC); + else if (ieee80211_is_any_nullfunc(hdr->frame_control)) cfg80211_probe_status(sdata->dev, hdr->addr1, cookie, acked, info->status.ack_signal, @@ -654,12 +666,8 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, skb->data, skb->len, acked, GFP_ATOMIC); else - cfg80211_control_port_tx_status(&sdata->wdev, - cookie, - skb->data, - skb->len, - acked, - GFP_ATOMIC); + pr_warn("Unknown status report in ack skb\n"); + } rcu_read_unlock(); -- 2.27.0