mac80211: Fix rt2x00 exports
[openwrt/staging/luka.git] / package / kernel / mac80211 / patches / subsys / 354-mac80211-fix-overwriting-of-qos_ctrl.tid-field.patch
1 commit 753ffad3d6243303994227854d951ff5c70fa9e0
2 Author: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
3 Date: Tue Nov 19 14:34:51 2019 +0100
4
5 mac80211: fix TID field in monitor mode transmit
6
7 Fix overwriting of the qos_ctrl.tid field for encrypted frames injected on
8 a monitor interface. While qos_ctrl.tid is not encrypted, it's used as an
9 input into the encryption algorithm so it's protected, and thus cannot be
10 modified after encryption. For injected frames, the encryption may already
11 have been done in userspace, so we cannot change any fields.
12
13 Before passing the frame to the driver, the qos_ctrl.tid field is updated
14 from skb->priority. Prior to dbd50a851c50 skb->priority was updated in
15 ieee80211_select_queue_80211(), but this function is no longer always
16 called.
17
18 Update skb->priority in ieee80211_monitor_start_xmit() so that the value
19 is stored, and when later code 'modifies' the TID it really sets it to
20 the same value as before, preserving the encryption.
21
22 Fixes: dbd50a851c50 ("mac80211: only allocate one queue when using iTXQs")
23 Signed-off-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
24 Link: https://lore.kernel.org/r/20191119133451.14711-1-fredrik.olofsson@anyfinetworks.com
25 [rewrite commit message based on our discussion]
26 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
27
28 --- a/net/mac80211/tx.c
29 +++ b/net/mac80211/tx.c
30 @@ -2269,6 +2269,15 @@ netdev_tx_t ieee80211_monitor_start_xmit
31 payload[7]);
32 }
33
34 + /*
35 + * Initialize skb->priority for QoS frames. This is put in the TID field
36 + * of the frame before passing it to the driver.
37 + */
38 + if (ieee80211_is_data_qos(hdr->frame_control)) {
39 + u8 *p = ieee80211_get_qos_ctl(hdr);
40 + skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
41 + }
42 +
43 memset(info, 0, sizeof(*info));
44
45 info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |