Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5470005pxu; Tue, 22 Dec 2020 19:07:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWH4/WW3e72CN27kItSdWdXkCsRbYQrIJ7QW0w8AroXefJJ3VwLgXVubHpK6A/dQru9rf/ X-Received: by 2002:aa7:c547:: with SMTP id s7mr22643704edr.240.1608692879072; Tue, 22 Dec 2020 19:07:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608692879; cv=none; d=google.com; s=arc-20160816; b=Ci9XiRJKSjUUSM946NYl2/SMPqN23DUZrT/RIof2Yp5RLr6hKXfZFcuR1CB5HEuP1+ QKGlE3s8YVQ0hlmyUkW0fhw/UsM0R58wunXdtoMjud03opiDkoMpuuRe+2jOvdN6CrYG fRxG12UaNY29e3487No40LlK11zG/XwjFj5jqFNHb8Dn9Mb4jTWztKB+mmUNlr/NOBZe 6PtI9My0SLt+0ls/y/KTGcT7LO2pkddvyx1eHSGmF05xdFjmDTltzAB341D6NelWLMfF KInPTvVIGig3jIyuyBdEZtDDSlj9w9d4xxMuGDyzO9L0cSBxtY4SaVfrDs/90D7Ud31x jCzw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YD/oe18dTHWBJwbPdm3cLXbR4UqvqRRmCWGt6/s4PtQ=; b=vZiiIsAnQy3zqkXFC2hqAilCLT/3PZ2GvGDf5UU22UhW3detRwkgj8P0Oji22fjv2e 8jh8PyvEnZxLbs+kNmsDxspjJdCs42uhyEfWDcpXhB93/zzeWeFAdBDACtfDhP80NX/y 0iNfA45pDlPvJIxeQOJd+PHgxXirRd1P7kw2vtbOlBrAw3hpJa50fWpglSzVOvgI7gqG IR1E+k1xf+VFpdlUNaqIVmvRHuNE/Sr31aPmkvM4aNWzIQX7K0dbhr/ZUuOy5Aj/Pzo9 QaBjPJrAqv1LFU0Uq7+IoXVtRHtbnDIix1OZaZf/AGf31MV43Q2YXhmHpnmf2a6m/9TQ wDBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KRX5gJNg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz13si11285625ejc.437.2020.12.22.19.07.36; Tue, 22 Dec 2020 19:07:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=KRX5gJNg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729031AbgLWDEv (ORCPT + 99 others); Tue, 22 Dec 2020 22:04:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:45510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728543AbgLWCTO (ORCPT ); Tue, 22 Dec 2020 21:19:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9217A2312E; Wed, 23 Dec 2020 02:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608689914; bh=RdtcM6zViuzlK2Nkml3KLpxbfyMc0DyP2XN/pSqi9Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRX5gJNg4nHXjBAYzkc7vqiiWRCGI5ztss5klPlveW8mE2UHP7R4iqDnes49BpFqh wvj2Z/ZoOik0laJVP2qsrR7/UnImFnM9MB5lFwCK3w8l5BHDJZTP3qs6TeGLlxHGxd 7dRIbqArTZQQ3W3KOJ4bTQPCx3rifAVsjkFhlb/ptF1A8FZOdV+t1uY5HcQSUr9qO9 zSMhkeK26aixkRlTDdUYWDhJ1679xcm6/Hn/hgPO2Hl299OrhWvbkrfQWemJcY/hHs WG60upA51w/ofTYauBzOvx5+BkLnfv/M8w5n3vZAhl4ttQph2h6upyL9j/wqrrv9rg Qf7YS3py7h6KA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mathy Vanhoef , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 015/130] mac80211: don't overwrite QoS TID of injected frames Date: Tue, 22 Dec 2020 21:16:18 -0500 Message-Id: <20201223021813.2791612-15-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223021813.2791612-1-sashal@kernel.org> References: <20201223021813.2791612-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathy Vanhoef [ Upstream commit 527d675969a1dff17baa270d4447ac1c87058299 ] Currently ieee80211_set_qos_hdr sets the QoS TID of all frames based on the value assigned to skb->priority. This means it will also overwrite the QoS TID of injected frames. The commit 753ffad3d624 ("mac80211: fix TID field in monitor mode transmit") prevented injected frames from being modified because of this by setting skb->priority to the TID of the injected frame, which assured the QoS TID will not be changed to a different value. Unfortunately, this workaround complicates the handling of injected frames because we can't set skb->priority without affecting the TID value in the QoS field of injected frames. To avoid this, and to simplify the next patch, detect if a frame is injected in ieee80211_set_qos_hdr and if so do not change its QoS field. Signed-off-by: Mathy Vanhoef Link: https://lore.kernel.org/r/20201104061823.197407-4-Mathy.Vanhoef@kuleuven.be [fix typos in commit message] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 5 +---- net/mac80211/wme.c | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 30a0c7c6224b3..11085a4b5ee3a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2280,10 +2280,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, payload[7]); } - /* - * Initialize skb->priority for QoS frames. This is put in the TID field - * of the frame before passing it to the driver. - */ + /* Initialize skb->priority for QoS frames */ if (ieee80211_is_data_qos(hdr->frame_control)) { u8 *p = ieee80211_get_qos_ctl(hdr); skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 72920d82928c4..8cd157e67fc77 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -249,6 +249,14 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, p = ieee80211_get_qos_ctl(hdr); + /* don't overwrite the QoS field of injected frames */ + if (info->flags & IEEE80211_TX_CTL_INJECTED) { + /* do take into account Ack policy of injected frames */ + if (*p & IEEE80211_QOS_CTL_ACK_POLICY_NOACK) + info->flags |= IEEE80211_TX_CTL_NO_ACK; + return; + } + /* set up the first byte */ /* -- 2.27.0