]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 May 2021 15:33:10 +0000 (17:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 May 2021 15:33:10 +0000 (17:33 +0200)
added patches:
ath10k-add-ccmp-pn-replay-protection-for-fragmented-frames-for-pcie.patch
ath10k-drop-fragments-with-multicast-da-for-pcie.patch
ath10k-drop-fragments-with-multicast-da-for-sdio.patch
ath10k-drop-mpdu-which-has-discard-flag-set-by-firmware-for-sdio.patch
ath10k-fix-tkip-michael-mic-verification-for-pcie.patch
ath10k-validate-first-subframe-of-a-msdu-before-processing-the-list.patch
ath11k-clear-the-fragment-cache-during-key-install.patch
dm-snapshot-properly-fix-a-crash-when-an-origin-has-no-snapshots.patch
drm-amd-pm-correct-mgpufanboost-setting.patch
drm-amdgpu-jpeg2.0-add-cancel_delayed_work_sync-before-power-gate.patch
drm-amdgpu-vcn1-add-cancel_delayed_work_sync-before-power-gate.patch
drm-amdgpu-vcn2.0-add-cancel_delayed_work_sync-before-power-gate.patch
drm-amdgpu-vcn2.5-add-cancel_delayed_work_sync-before-power-gate.patch
drm-amdkfd-correct-sienna_cichlid-sdma-rlc-register-offset-error.patch
mac80211-do-not-accept-forward-invalid-eapol-frames.patch
mac80211-extend-protection-against-mixed-key-and-fragment-cache-attacks.patch

17 files changed:
queue-5.10/ath10k-add-ccmp-pn-replay-protection-for-fragmented-frames-for-pcie.patch [new file with mode: 0644]
queue-5.10/ath10k-drop-fragments-with-multicast-da-for-pcie.patch [new file with mode: 0644]
queue-5.10/ath10k-drop-fragments-with-multicast-da-for-sdio.patch [new file with mode: 0644]
queue-5.10/ath10k-drop-mpdu-which-has-discard-flag-set-by-firmware-for-sdio.patch [new file with mode: 0644]
queue-5.10/ath10k-fix-tkip-michael-mic-verification-for-pcie.patch [new file with mode: 0644]
queue-5.10/ath10k-validate-first-subframe-of-a-msdu-before-processing-the-list.patch [new file with mode: 0644]
queue-5.10/ath11k-clear-the-fragment-cache-during-key-install.patch [new file with mode: 0644]
queue-5.10/dm-snapshot-properly-fix-a-crash-when-an-origin-has-no-snapshots.patch [new file with mode: 0644]
queue-5.10/drm-amd-pm-correct-mgpufanboost-setting.patch [new file with mode: 0644]
queue-5.10/drm-amdgpu-jpeg2.0-add-cancel_delayed_work_sync-before-power-gate.patch [new file with mode: 0644]
queue-5.10/drm-amdgpu-vcn1-add-cancel_delayed_work_sync-before-power-gate.patch [new file with mode: 0644]
queue-5.10/drm-amdgpu-vcn2.0-add-cancel_delayed_work_sync-before-power-gate.patch [new file with mode: 0644]
queue-5.10/drm-amdgpu-vcn2.5-add-cancel_delayed_work_sync-before-power-gate.patch [new file with mode: 0644]
queue-5.10/drm-amdkfd-correct-sienna_cichlid-sdma-rlc-register-offset-error.patch [new file with mode: 0644]
queue-5.10/mac80211-do-not-accept-forward-invalid-eapol-frames.patch [new file with mode: 0644]
queue-5.10/mac80211-extend-protection-against-mixed-key-and-fragment-cache-attacks.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/ath10k-add-ccmp-pn-replay-protection-for-fragmented-frames-for-pcie.patch b/queue-5.10/ath10k-add-ccmp-pn-replay-protection-for-fragmented-frames-for-pcie.patch
new file mode 100644 (file)
index 0000000..c1fd4e2
--- /dev/null
@@ -0,0 +1,189 @@
+From a1166b2653db2f3de7338b9fb8a0f6e924b904ee Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:52 +0200
+Subject: ath10k: add CCMP PN replay protection for fragmented frames for PCIe
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit a1166b2653db2f3de7338b9fb8a0f6e924b904ee upstream.
+
+PN replay check for not fragmented frames is finished in the firmware,
+but this was not done for fragmented frames when ath10k is used with
+QCA6174/QCA6377 PCIe. mac80211 has the function
+ieee80211_rx_h_defragment() for PN replay check for fragmented frames,
+but this does not get checked with QCA6174 due to the
+ieee80211_has_protected() condition not matching the cleared Protected
+bit case.
+
+Validate the PN of received fragmented frames within ath10k when CCMP is
+used and drop the fragment if the PN is not correct (incremented by
+exactly one from the previous fragment). This applies only for
+QCA6174/QCA6377 PCIe.
+
+Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.9ba2664866a4.I756e47b67e210dba69966d989c4711ffc02dc6bc@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt.h    |    1 
+ drivers/net/wireless/ath/ath10k/htt_rx.c |   99 +++++++++++++++++++++++++++++--
+ 2 files changed, 96 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath10k/htt.h
++++ b/drivers/net/wireless/ath/ath10k/htt.h
+@@ -845,6 +845,7 @@ enum htt_security_types {
+ #define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2
+ #define ATH10K_TXRX_NUM_EXT_TIDS 19
++#define ATH10K_TXRX_NON_QOS_TID 16
+ enum htt_security_flags {
+ #define HTT_SECURITY_TYPE_MASK 0x7F
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -1746,16 +1746,87 @@ static void ath10k_htt_rx_h_csum_offload
+       msdu->ip_summed = ath10k_htt_rx_get_csum_state(msdu);
+ }
++static u64 ath10k_htt_rx_h_get_pn(struct ath10k *ar, struct sk_buff *skb,
++                                u16 offset,
++                                enum htt_rx_mpdu_encrypt_type enctype)
++{
++      struct ieee80211_hdr *hdr;
++      u64 pn = 0;
++      u8 *ehdr;
++
++      hdr = (struct ieee80211_hdr *)(skb->data + offset);
++      ehdr = skb->data + offset + ieee80211_hdrlen(hdr->frame_control);
++
++      if (enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) {
++              pn = ehdr[0];
++              pn |= (u64)ehdr[1] << 8;
++              pn |= (u64)ehdr[4] << 16;
++              pn |= (u64)ehdr[5] << 24;
++              pn |= (u64)ehdr[6] << 32;
++              pn |= (u64)ehdr[7] << 40;
++      }
++      return pn;
++}
++
++static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar,
++                                        struct sk_buff *skb,
++                                        u16 peer_id,
++                                        u16 offset,
++                                        enum htt_rx_mpdu_encrypt_type enctype)
++{
++      struct ath10k_peer *peer;
++      union htt_rx_pn_t *last_pn, new_pn = {0};
++      struct ieee80211_hdr *hdr;
++      bool more_frags;
++      u8 tid, frag_number;
++      u32 seq;
++
++      peer = ath10k_peer_find_by_id(ar, peer_id);
++      if (!peer) {
++              ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid peer for frag pn check\n");
++              return false;
++      }
++
++      hdr = (struct ieee80211_hdr *)(skb->data + offset);
++      if (ieee80211_is_data_qos(hdr->frame_control))
++              tid = ieee80211_get_tid(hdr);
++      else
++              tid = ATH10K_TXRX_NON_QOS_TID;
++
++      last_pn = &peer->frag_tids_last_pn[tid];
++      new_pn.pn48 = ath10k_htt_rx_h_get_pn(ar, skb, offset, enctype);
++      more_frags = ieee80211_has_morefrags(hdr->frame_control);
++      frag_number = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
++      seq = (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
++
++      if (frag_number == 0) {
++              last_pn->pn48 = new_pn.pn48;
++              peer->frag_tids_seq[tid] = seq;
++      } else {
++              if (seq != peer->frag_tids_seq[tid])
++                      return false;
++
++              if (new_pn.pn48 != last_pn->pn48 + 1)
++                      return false;
++
++              last_pn->pn48 = new_pn.pn48;
++      }
++
++      return true;
++}
++
+ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
+                                struct sk_buff_head *amsdu,
+                                struct ieee80211_rx_status *status,
+                                bool fill_crypt_header,
+                                u8 *rx_hdr,
+-                               enum ath10k_pkt_rx_err *err)
++                               enum ath10k_pkt_rx_err *err,
++                               u16 peer_id,
++                               bool frag)
+ {
+       struct sk_buff *first;
+       struct sk_buff *last;
+-      struct sk_buff *msdu;
++      struct sk_buff *msdu, *temp;
+       struct htt_rx_desc *rxd;
+       struct ieee80211_hdr *hdr;
+       enum htt_rx_mpdu_encrypt_type enctype;
+@@ -1768,6 +1839,7 @@ static void ath10k_htt_rx_h_mpdu(struct
+       bool is_decrypted;
+       bool is_mgmt;
+       u32 attention;
++      bool frag_pn_check = true;
+       if (skb_queue_empty(amsdu))
+               return;
+@@ -1866,6 +1938,24 @@ static void ath10k_htt_rx_h_mpdu(struct
+       }
+       skb_queue_walk(amsdu, msdu) {
++              if (frag && !fill_crypt_header && is_decrypted &&
++                  enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
++                      frag_pn_check = ath10k_htt_rx_h_frag_pn_check(ar,
++                                                                    msdu,
++                                                                    peer_id,
++                                                                    0,
++                                                                    enctype);
++
++              if (!frag_pn_check) {
++                      /* Discard the fragment with invalid PN */
++                      temp = msdu->prev;
++                      __skb_unlink(msdu, amsdu);
++                      dev_kfree_skb_any(msdu);
++                      msdu = temp;
++                      frag_pn_check = true;
++                      continue;
++              }
++
+               ath10k_htt_rx_h_csum_offload(msdu);
+               ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
+                                       is_decrypted);
+@@ -2071,7 +2161,8 @@ static int ath10k_htt_rx_handle_amsdu(st
+               ath10k_htt_rx_h_unchain(ar, &amsdu, &drop_cnt, &unchain_cnt);
+       ath10k_htt_rx_h_filter(ar, &amsdu, rx_status, &drop_cnt_filter);
+-      ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err);
++      ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err, 0,
++                           false);
+       msdus_to_queue = skb_queue_len(&amsdu);
+       ath10k_htt_rx_h_enqueue(ar, &amsdu, rx_status);
+@@ -3027,7 +3118,7 @@ static int ath10k_htt_rx_in_ord_ind(stru
+                       ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
+                       ath10k_htt_rx_h_filter(ar, &amsdu, status, NULL);
+                       ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false, NULL,
+-                                           NULL);
++                                           NULL, peer_id, frag);
+                       ath10k_htt_rx_h_enqueue(ar, &amsdu, status);
+                       break;
+               case -EAGAIN:
diff --git a/queue-5.10/ath10k-drop-fragments-with-multicast-da-for-pcie.patch b/queue-5.10/ath10k-drop-fragments-with-multicast-da-for-pcie.patch
new file mode 100644 (file)
index 0000000..5ff54c5
--- /dev/null
@@ -0,0 +1,75 @@
+From 65c415a144ad8132b6a6d97d4a1919ffc728e2d1 Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:53 +0200
+Subject: ath10k: drop fragments with multicast DA for PCIe
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit 65c415a144ad8132b6a6d97d4a1919ffc728e2d1 upstream.
+
+Fragmentation is not used with multicast frames. Discard unexpected
+fragments with multicast DA. This fixes CVE-2020-26145.
+
+Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.5a0bd289bda8.Idd6ebea20038fb1cfee6de924aa595e5647c9eae@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt_rx.c |   23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -1768,6 +1768,16 @@ static u64 ath10k_htt_rx_h_get_pn(struct
+       return pn;
+ }
++static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar,
++                                               struct sk_buff *skb,
++                                               u16 offset)
++{
++      struct ieee80211_hdr *hdr;
++
++      hdr = (struct ieee80211_hdr *)(skb->data + offset);
++      return !is_multicast_ether_addr(hdr->addr1);
++}
++
+ static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar,
+                                         struct sk_buff *skb,
+                                         u16 peer_id,
+@@ -1839,7 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct
+       bool is_decrypted;
+       bool is_mgmt;
+       u32 attention;
+-      bool frag_pn_check = true;
++      bool frag_pn_check = true, multicast_check = true;
+       if (skb_queue_empty(amsdu))
+               return;
+@@ -1946,13 +1956,20 @@ static void ath10k_htt_rx_h_mpdu(struct
+                                                                     0,
+                                                                     enctype);
+-              if (!frag_pn_check) {
+-                      /* Discard the fragment with invalid PN */
++              if (frag)
++                      multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar,
++                                                                             msdu,
++                                                                             0);
++
++              if (!frag_pn_check || !multicast_check) {
++                      /* Discard the fragment with invalid PN or multicast DA
++                       */
+                       temp = msdu->prev;
+                       __skb_unlink(msdu, amsdu);
+                       dev_kfree_skb_any(msdu);
+                       msdu = temp;
+                       frag_pn_check = true;
++                      multicast_check = true;
+                       continue;
+               }
diff --git a/queue-5.10/ath10k-drop-fragments-with-multicast-da-for-sdio.patch b/queue-5.10/ath10k-drop-fragments-with-multicast-da-for-sdio.patch
new file mode 100644 (file)
index 0000000..848a772
--- /dev/null
@@ -0,0 +1,49 @@
+From 40e7462dad6f3d06efdb17d26539e61ab6e34db1 Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:54 +0200
+Subject: ath10k: drop fragments with multicast DA for SDIO
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit 40e7462dad6f3d06efdb17d26539e61ab6e34db1 upstream.
+
+Fragmentation is not used with multicast frames. Discard unexpected
+fragments with multicast DA. This fixes CVE-2020-26145.
+
+Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.9ca6ca7945a9.I1e18b514590af17c155bda86699bc3a971a8dcf4@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt_rx.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -2617,6 +2617,13 @@ static bool ath10k_htt_rx_proc_rx_frag_i
+       rx_desc = (struct htt_hl_rx_desc *)(skb->data + tot_hdr_len);
+       rx_desc_info = __le32_to_cpu(rx_desc->info);
++      hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len);
++
++      if (is_multicast_ether_addr(hdr->addr1)) {
++              /* Discard the fragment with multicast DA */
++              goto err;
++      }
++
+       if (!MS(rx_desc_info, HTT_RX_DESC_HL_INFO_ENCRYPTED)) {
+               spin_unlock_bh(&ar->data_lock);
+               return ath10k_htt_rx_proc_rx_ind_hl(htt, &resp->rx_ind_hl, skb,
+@@ -2624,8 +2631,6 @@ static bool ath10k_htt_rx_proc_rx_frag_i
+                                                   HTT_RX_NON_TKIP_MIC);
+       }
+-      hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len);
+-
+       if (ieee80211_has_retry(hdr->frame_control))
+               goto err;
diff --git a/queue-5.10/ath10k-drop-mpdu-which-has-discard-flag-set-by-firmware-for-sdio.patch b/queue-5.10/ath10k-drop-mpdu-which-has-discard-flag-set-by-firmware-for-sdio.patch
new file mode 100644 (file)
index 0000000..0dda096
--- /dev/null
@@ -0,0 +1,63 @@
+From 079a108feba474b4b32bd3471db03e11f2f83b81 Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:55 +0200
+Subject: ath10k: drop MPDU which has discard flag set by firmware for SDIO
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit 079a108feba474b4b32bd3471db03e11f2f83b81 upstream.
+
+When the discard flag is set by the firmware for an MPDU, it should be
+dropped. This allows a mitigation for CVE-2020-24588 to be implemented
+in the firmware.
+
+Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.11968c725b5c.Idd166365ebea2771c0c0a38c78b5060750f90e17@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt_rx.c  |    5 +++++
+ drivers/net/wireless/ath/ath10k/rx_desc.h |   14 +++++++++++++-
+ 2 files changed, 18 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -2312,6 +2312,11 @@ static bool ath10k_htt_rx_proc_rx_ind_hl
+       fw_desc = &rx->fw_desc;
+       rx_desc_len = fw_desc->len;
++      if (fw_desc->u.bits.discard) {
++              ath10k_dbg(ar, ATH10K_DBG_HTT, "htt discard mpdu\n");
++              goto err;
++      }
++
+       /* I have not yet seen any case where num_mpdu_ranges > 1.
+        * qcacld does not seem handle that case either, so we introduce the
+        * same limitiation here as well.
+--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
++++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
+@@ -1282,7 +1282,19 @@ struct fw_rx_desc_base {
+ #define FW_RX_DESC_UDP              (1 << 6)
+ struct fw_rx_desc_hl {
+-      u8 info0;
++      union {
++              struct {
++              u8 discard:1,
++                 forward:1,
++                 any_err:1,
++                 dup_err:1,
++                 reserved:1,
++                 inspect:1,
++                 extension:2;
++              } bits;
++              u8 info0;
++      } u;
++
+       u8 version;
+       u8 len;
+       u8 flags;
diff --git a/queue-5.10/ath10k-fix-tkip-michael-mic-verification-for-pcie.patch b/queue-5.10/ath10k-fix-tkip-michael-mic-verification-for-pcie.patch
new file mode 100644 (file)
index 0000000..6e612e4
--- /dev/null
@@ -0,0 +1,57 @@
+From 0dc267b13f3a7e8424a898815dd357211b737330 Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:56 +0200
+Subject: ath10k: Fix TKIP Michael MIC verification for PCIe
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit 0dc267b13f3a7e8424a898815dd357211b737330 upstream.
+
+TKIP Michael MIC was not verified properly for PCIe cases since the
+validation steps in ieee80211_rx_h_michael_mic_verify() in mac80211 did
+not get fully executed due to unexpected flag values in
+ieee80211_rx_status.
+
+Fix this by setting the flags property to meet mac80211 expectations for
+performing Michael MIC validation there. This fixes CVE-2020-26141. It
+does the same as ath10k_htt_rx_proc_rx_ind_hl() for SDIO which passed
+MIC verification case. This applies only to QCA6174/QCA9377 PCIe.
+
+Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.c3f1d42c6746.I795593fcaae941c471425b8c7d5f7bb185d29142@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt_rx.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -1974,6 +1974,11 @@ static void ath10k_htt_rx_h_mpdu(struct
+               }
+               ath10k_htt_rx_h_csum_offload(msdu);
++
++              if (frag && !fill_crypt_header &&
++                  enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
++                      status->flag &= ~RX_FLAG_MMIC_STRIPPED;
++
+               ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
+                                       is_decrypted);
+@@ -1991,6 +1996,11 @@ static void ath10k_htt_rx_h_mpdu(struct
+               hdr = (void *)msdu->data;
+               hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED);
++
++              if (frag && !fill_crypt_header &&
++                  enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
++                      status->flag &= ~RX_FLAG_IV_STRIPPED &
++                                      ~RX_FLAG_MMIC_STRIPPED;
+       }
+ }
diff --git a/queue-5.10/ath10k-validate-first-subframe-of-a-msdu-before-processing-the-list.patch b/queue-5.10/ath10k-validate-first-subframe-of-a-msdu-before-processing-the-list.patch
new file mode 100644 (file)
index 0000000..b185575
--- /dev/null
@@ -0,0 +1,117 @@
+From 62a8ff67eba52dae9b107e1fb8827054ed00a265 Mon Sep 17 00:00:00 2001
+From: Sriram R <srirrama@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:57 +0200
+Subject: ath10k: Validate first subframe of A-MSDU before processing the list
+
+From: Sriram R <srirrama@codeaurora.org>
+
+commit 62a8ff67eba52dae9b107e1fb8827054ed00a265 upstream.
+
+In certain scenarios a normal MSDU can be received as an A-MSDU when
+the A-MSDU present bit of a QoS header gets flipped during reception.
+Since this bit is unauthenticated, the hardware crypto engine can pass
+the frame to the driver without any error indication.
+
+This could result in processing unintended subframes collected in the
+A-MSDU list. Hence, validate A-MSDU list by checking if the first frame
+has a valid subframe header.
+
+Comparing the non-aggregated MSDU and an A-MSDU, the fields of the first
+subframe DA matches the LLC/SNAP header fields of a normal MSDU.
+In order to avoid processing such frames, add a validation to
+filter such A-MSDU frames where the first subframe header DA matches
+with the LLC/SNAP header pattern.
+
+Tested-on: QCA9984 hw1.0 PCI 10.4-3.10-00047
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Sriram R <srirrama@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.e6f5eb7b9847.I38a77ae26096862527a5eab73caebd7346af8b66@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath10k/htt_rx.c |   61 ++++++++++++++++++++++++++++---
+ 1 file changed, 57 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -2108,14 +2108,62 @@ static void ath10k_htt_rx_h_unchain(stru
+       ath10k_unchain_msdu(amsdu, unchain_cnt);
+ }
++static bool ath10k_htt_rx_validate_amsdu(struct ath10k *ar,
++                                       struct sk_buff_head *amsdu)
++{
++      u8 *subframe_hdr;
++      struct sk_buff *first;
++      bool is_first, is_last;
++      struct htt_rx_desc *rxd;
++      struct ieee80211_hdr *hdr;
++      size_t hdr_len, crypto_len;
++      enum htt_rx_mpdu_encrypt_type enctype;
++      int bytes_aligned = ar->hw_params.decap_align_bytes;
++
++      first = skb_peek(amsdu);
++
++      rxd = (void *)first->data - sizeof(*rxd);
++      hdr = (void *)rxd->rx_hdr_status;
++
++      is_first = !!(rxd->msdu_end.common.info0 &
++                    __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU));
++      is_last = !!(rxd->msdu_end.common.info0 &
++                   __cpu_to_le32(RX_MSDU_END_INFO0_LAST_MSDU));
++
++      /* Return in case of non-aggregated msdu */
++      if (is_first && is_last)
++              return true;
++
++      /* First msdu flag is not set for the first msdu of the list */
++      if (!is_first)
++              return false;
++
++      enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0),
++                   RX_MPDU_START_INFO0_ENCRYPT_TYPE);
++
++      hdr_len = ieee80211_hdrlen(hdr->frame_control);
++      crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype);
++
++      subframe_hdr = (u8 *)hdr + round_up(hdr_len, bytes_aligned) +
++                     crypto_len;
++
++      /* Validate if the amsdu has a proper first subframe.
++       * There are chances a single msdu can be received as amsdu when
++       * the unauthenticated amsdu flag of a QoS header
++       * gets flipped in non-SPP AMSDU's, in such cases the first
++       * subframe has llc/snap header in place of a valid da.
++       * return false if the da matches rfc1042 pattern
++       */
++      if (ether_addr_equal(subframe_hdr, rfc1042_header))
++              return false;
++
++      return true;
++}
++
+ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
+                                       struct sk_buff_head *amsdu,
+                                       struct ieee80211_rx_status *rx_status)
+ {
+-      /* FIXME: It might be a good idea to do some fuzzy-testing to drop
+-       * invalid/dangerous frames.
+-       */
+-
+       if (!rx_status->freq) {
+               ath10k_dbg(ar, ATH10K_DBG_HTT, "no channel configured; ignoring frame(s)!\n");
+               return false;
+@@ -2126,6 +2174,11 @@ static bool ath10k_htt_rx_amsdu_allowed(
+               return false;
+       }
++      if (!ath10k_htt_rx_validate_amsdu(ar, amsdu)) {
++              ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid amsdu received\n");
++              return false;
++      }
++
+       return true;
+ }
diff --git a/queue-5.10/ath11k-clear-the-fragment-cache-during-key-install.patch b/queue-5.10/ath11k-clear-the-fragment-cache-during-key-install.patch
new file mode 100644 (file)
index 0000000..67cfbb3
--- /dev/null
@@ -0,0 +1,86 @@
+From c3944a5621026c176001493d48ee66ff94e1a39a Mon Sep 17 00:00:00 2001
+From: Sriram R <srirrama@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:58 +0200
+Subject: ath11k: Clear the fragment cache during key install
+
+From: Sriram R <srirrama@codeaurora.org>
+
+commit c3944a5621026c176001493d48ee66ff94e1a39a upstream.
+
+Currently the fragment cache setup during peer assoc is
+cleared only during peer delete. In case a key reinstallation
+happens with the same peer, the same fragment cache with old
+fragments added before key installation could be clubbed
+with fragments received after. This might be exploited
+to mix fragments of different data resulting in a proper
+unintended reassembled packet to be passed up the stack.
+
+Hence flush the fragment cache on every key installation to prevent
+potential attacks (CVE-2020-24587).
+
+Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1 v2
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Sriram R <srirrama@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.218dc777836f.I9af6fc76215a35936c4152552018afb5079c5d8c@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/ath/ath11k/dp_rx.c |   18 ++++++++++++++++++
+ drivers/net/wireless/ath/ath11k/dp_rx.h |    1 +
+ drivers/net/wireless/ath/ath11k/mac.c   |    6 ++++++
+ 3 files changed, 25 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
+@@ -832,6 +832,24 @@ static void ath11k_dp_rx_frags_cleanup(s
+       __skb_queue_purge(&rx_tid->rx_frags);
+ }
++void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer)
++{
++      struct dp_rx_tid *rx_tid;
++      int i;
++
++      lockdep_assert_held(&ar->ab->base_lock);
++
++      for (i = 0; i <= IEEE80211_NUM_TIDS; i++) {
++              rx_tid = &peer->rx_tid[i];
++
++              spin_unlock_bh(&ar->ab->base_lock);
++              del_timer_sync(&rx_tid->frag_timer);
++              spin_lock_bh(&ar->ab->base_lock);
++
++              ath11k_dp_rx_frags_cleanup(rx_tid, true);
++      }
++}
++
+ void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer)
+ {
+       struct dp_rx_tid *rx_tid;
+--- a/drivers/net/wireless/ath/ath11k/dp_rx.h
++++ b/drivers/net/wireless/ath/ath11k/dp_rx.h
+@@ -49,6 +49,7 @@ int ath11k_dp_peer_rx_pn_replay_config(s
+                                      const u8 *peer_addr,
+                                      enum set_key_cmd key_cmd,
+                                      struct ieee80211_key_conf *key);
++void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer);
+ void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer);
+ void ath11k_peer_rx_tid_delete(struct ath11k *ar,
+                              struct ath11k_peer *peer, u8 tid);
+--- a/drivers/net/wireless/ath/ath11k/mac.c
++++ b/drivers/net/wireless/ath/ath11k/mac.c
+@@ -2525,6 +2525,12 @@ static int ath11k_mac_op_set_key(struct
+        */
+       spin_lock_bh(&ab->base_lock);
+       peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr);
++
++      /* flush the fragments cache during key (re)install to
++       * ensure all frags in the new frag list belong to the same key.
++       */
++      if (peer && cmd == SET_KEY)
++              ath11k_peer_frags_flush(ar, peer);
+       spin_unlock_bh(&ab->base_lock);
+       if (!peer) {
diff --git a/queue-5.10/dm-snapshot-properly-fix-a-crash-when-an-origin-has-no-snapshots.patch b/queue-5.10/dm-snapshot-properly-fix-a-crash-when-an-origin-has-no-snapshots.patch
new file mode 100644 (file)
index 0000000..7d080d5
--- /dev/null
@@ -0,0 +1,35 @@
+From 7e768532b2396bcb7fbf6f82384b85c0f1d2f197 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Tue, 25 May 2021 13:17:19 -0400
+Subject: dm snapshot: properly fix a crash when an origin has no snapshots
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 7e768532b2396bcb7fbf6f82384b85c0f1d2f197 upstream.
+
+If an origin target has no snapshots, o->split_boundary is set to 0.
+This causes BUG_ON(sectors <= 0) in block/bio.c:bio_split().
+
+Fix this by initializing chunk_size, and in turn split_boundary, to
+rounddown_pow_of_two(UINT_MAX) -- the largest power of two that fits
+into "unsigned" type.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-snap.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/md/dm-snap.c
++++ b/drivers/md/dm-snap.c
+@@ -854,7 +854,7 @@ static int dm_add_exception(void *contex
+ static uint32_t __minimum_chunk_size(struct origin *o)
+ {
+       struct dm_snapshot *snap;
+-      unsigned chunk_size = 0;
++      unsigned chunk_size = rounddown_pow_of_two(UINT_MAX);
+       if (o)
+               list_for_each_entry(snap, &o->snapshots, list)
diff --git a/queue-5.10/drm-amd-pm-correct-mgpufanboost-setting.patch b/queue-5.10/drm-amd-pm-correct-mgpufanboost-setting.patch
new file mode 100644 (file)
index 0000000..3d2e0ba
--- /dev/null
@@ -0,0 +1,69 @@
+From 1a0b713c73688c6bafbe6faf8c90390b11b26fc6 Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Tue, 18 May 2021 09:01:47 +0800
+Subject: drm/amd/pm: correct MGpuFanBoost setting
+
+From: Evan Quan <evan.quan@amd.com>
+
+commit 1a0b713c73688c6bafbe6faf8c90390b11b26fc6 upstream.
+
+No MGpuFanBoost setting for those ASICs which do not support it.
+Otherwise, it may breaks their fan control feature.
+
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1580
+
+Signed-off-by: Evan Quan <evan.quan@amd.com>
+Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         |    9 +++++++++
+ drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |   10 ++++++++++
+ 2 files changed, 19 insertions(+)
+
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+@@ -2606,6 +2606,8 @@ static ssize_t navi10_get_gpu_metrics(st
+ static int navi10_enable_mgpu_fan_boost(struct smu_context *smu)
+ {
++      struct smu_table_context *table_context = &smu->smu_table;
++      PPTable_t *smc_pptable = table_context->driver_pptable;
+       struct amdgpu_device *adev = smu->adev;
+       uint32_t param = 0;
+@@ -2613,6 +2615,13 @@ static int navi10_enable_mgpu_fan_boost(
+       if (adev->asic_type == CHIP_NAVI12)
+               return 0;
++      /*
++       * Skip the MGpuFanBoost setting for those ASICs
++       * which do not support it
++       */
++      if (!smc_pptable->MGpuFanBoostLimitRpm)
++              return 0;
++
+       /* Workaround for WS SKU */
+       if (adev->pdev->device == 0x7312 &&
+           adev->pdev->revision == 0)
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+@@ -2715,6 +2715,16 @@ static ssize_t sienna_cichlid_get_gpu_me
+ static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
+ {
++      struct smu_table_context *table_context = &smu->smu_table;
++      PPTable_t *smc_pptable = table_context->driver_pptable;
++
++      /*
++       * Skip the MGpuFanBoost setting for those ASICs
++       * which do not support it
++       */
++      if (!smc_pptable->MGpuFanBoostLimitRpm)
++              return 0;
++
+       return smu_cmn_send_smc_msg_with_param(smu,
+                                              SMU_MSG_SetMGpuFanBoostLimitRpm,
+                                              0,
diff --git a/queue-5.10/drm-amdgpu-jpeg2.0-add-cancel_delayed_work_sync-before-power-gate.patch b/queue-5.10/drm-amdgpu-jpeg2.0-add-cancel_delayed_work_sync-before-power-gate.patch
new file mode 100644 (file)
index 0000000..5f8d059
--- /dev/null
@@ -0,0 +1,36 @@
+From ff48f6dbf0ff896c98d167a67a5b975fb034356b Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Wed, 19 May 2021 11:42:48 -0400
+Subject: drm/amdgpu/jpeg2.0: add cancel_delayed_work_sync before power gate
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit ff48f6dbf0ff896c98d167a67a5b975fb034356b upstream.
+
+Add cancel_delayed_work_sync before set power gating state
+to avoid race condition issue when power gating.
+
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Leo Liu <leo.liu@amd.com>
+Acked-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
+@@ -172,6 +172,8 @@ static int jpeg_v2_0_hw_fini(void *handl
+ {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
++      cancel_delayed_work_sync(&adev->vcn.idle_work);
++
+       if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
+             RREG32_SOC15(JPEG, 0, mmUVD_JRBC_STATUS))
+               jpeg_v2_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
diff --git a/queue-5.10/drm-amdgpu-vcn1-add-cancel_delayed_work_sync-before-power-gate.patch b/queue-5.10/drm-amdgpu-vcn1-add-cancel_delayed_work_sync-before-power-gate.patch
new file mode 100644 (file)
index 0000000..5ef4555
--- /dev/null
@@ -0,0 +1,42 @@
+From b95f045ea35673572ef46d6483ad8bd6d353d63c Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Tue, 18 May 2021 10:58:22 -0400
+Subject: drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit b95f045ea35673572ef46d6483ad8bd6d353d63c upstream.
+
+Add cancel_delayed_work_sync before set power gating state
+to avoid race condition issue when power gating.
+
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Leo Liu <leo.liu@amd.com>
+Acked-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+@@ -232,9 +232,13 @@ static int vcn_v1_0_hw_fini(void *handle
+ {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
++      cancel_delayed_work_sync(&adev->vcn.idle_work);
++
+       if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
+-              RREG32_SOC15(VCN, 0, mmUVD_STATUS))
++              (adev->vcn.cur_state != AMD_PG_STATE_GATE &&
++               RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
+               vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
++      }
+       return 0;
+ }
diff --git a/queue-5.10/drm-amdgpu-vcn2.0-add-cancel_delayed_work_sync-before-power-gate.patch b/queue-5.10/drm-amdgpu-vcn2.0-add-cancel_delayed_work_sync-before-power-gate.patch
new file mode 100644 (file)
index 0000000..fa52e51
--- /dev/null
@@ -0,0 +1,36 @@
+From 0c6013377b4027e69d8f3e63b6bf556b6cb87802 Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Wed, 19 May 2021 11:26:32 -0400
+Subject: drm/amdgpu/vcn2.0: add cancel_delayed_work_sync before power gate
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit 0c6013377b4027e69d8f3e63b6bf556b6cb87802 upstream.
+
+Add cancel_delayed_work_sync before set power gating state
+to avoid race condition issue when power gating.
+
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Leo Liu <leo.liu@amd.com>
+Acked-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+@@ -262,6 +262,8 @@ static int vcn_v2_0_hw_fini(void *handle
+ {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
++      cancel_delayed_work_sync(&adev->vcn.idle_work);
++
+       if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
+           (adev->vcn.cur_state != AMD_PG_STATE_GATE &&
+             RREG32_SOC15(VCN, 0, mmUVD_STATUS)))
diff --git a/queue-5.10/drm-amdgpu-vcn2.5-add-cancel_delayed_work_sync-before-power-gate.patch b/queue-5.10/drm-amdgpu-vcn2.5-add-cancel_delayed_work_sync-before-power-gate.patch
new file mode 100644 (file)
index 0000000..be4e8da
--- /dev/null
@@ -0,0 +1,36 @@
+From 2fb536ea42d557f39f70c755f68e1aa1ad466c55 Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Wed, 19 May 2021 11:40:39 -0400
+Subject: drm/amdgpu/vcn2.5: add cancel_delayed_work_sync before power gate
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit 2fb536ea42d557f39f70c755f68e1aa1ad466c55 upstream.
+
+Add cancel_delayed_work_sync before set power gating state
+to avoid race condition issue when power gating.
+
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Leo Liu <leo.liu@amd.com>
+Acked-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
+@@ -321,6 +321,8 @@ static int vcn_v2_5_hw_fini(void *handle
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       int i;
++      cancel_delayed_work_sync(&adev->vcn.idle_work);
++
+       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+               if (adev->vcn.harvest_config & (1 << i))
+                       continue;
diff --git a/queue-5.10/drm-amdkfd-correct-sienna_cichlid-sdma-rlc-register-offset-error.patch b/queue-5.10/drm-amdkfd-correct-sienna_cichlid-sdma-rlc-register-offset-error.patch
new file mode 100644 (file)
index 0000000..f679d0c
--- /dev/null
@@ -0,0 +1,59 @@
+From ba515a5821dc0d101ded0379b14b1d1471ebfaba Mon Sep 17 00:00:00 2001
+From: Kevin Wang <kevin1.wang@amd.com>
+Date: Wed, 19 May 2021 11:03:11 +0800
+Subject: drm/amdkfd: correct sienna_cichlid SDMA RLC register offset error
+
+From: Kevin Wang <kevin1.wang@amd.com>
+
+commit ba515a5821dc0d101ded0379b14b1d1471ebfaba upstream.
+
+1.correct KFD SDMA RLC queue register offset error.
+(all sdma rlc register offset is base on SDMA0.RLC0_RLC0_RB_CNTL)
+2.HQD_N_REGS (19+6+7+12)
+  12: the 2 more resgisters than navi1x (SDMAx_RLCy_MIDCMD_DATA{9,10})
+
+the patch also can be fixed NULL pointer issue when read
+/sys/kernel/debug/kfd/hqds on sienna_cichlid chip.
+
+Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
+Reviewed-by: Likun Gao <Likun.Gao@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c
+@@ -157,16 +157,16 @@ static uint32_t get_sdma_rlc_reg_offset(
+                               mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       case 1:
+-              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA1, 0,
++              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
+                               mmSDMA1_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       case 2:
+-              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA2, 0,
+-                              mmSDMA2_RLC0_RB_CNTL) - mmSDMA2_RLC0_RB_CNTL;
++              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
++                              mmSDMA2_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       case 3:
+-              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA3, 0,
+-                              mmSDMA3_RLC0_RB_CNTL) - mmSDMA2_RLC0_RB_CNTL;
++              sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
++                              mmSDMA3_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       }
+@@ -451,7 +451,7 @@ static int hqd_sdma_dump_v10_3(struct kg
+                       engine_id, queue_id);
+       uint32_t i = 0, reg;
+ #undef HQD_N_REGS
+-#define HQD_N_REGS (19+6+7+10)
++#define HQD_N_REGS (19+6+7+12)
+       *dump = kmalloc(HQD_N_REGS*2*sizeof(uint32_t), GFP_KERNEL);
+       if (*dump == NULL)
diff --git a/queue-5.10/mac80211-do-not-accept-forward-invalid-eapol-frames.patch b/queue-5.10/mac80211-do-not-accept-forward-invalid-eapol-frames.patch
new file mode 100644 (file)
index 0000000..2e14267
--- /dev/null
@@ -0,0 +1,103 @@
+From a8c4d76a8dd4fb9666fc8919a703d85fb8f44ed8 Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Tue, 11 May 2021 20:02:50 +0200
+Subject: mac80211: do not accept/forward invalid EAPOL frames
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit a8c4d76a8dd4fb9666fc8919a703d85fb8f44ed8 upstream.
+
+EAPOL frames are used for authentication and key management between the
+AP and each individual STA associated in the BSS. Those frames are not
+supposed to be sent by one associated STA to another associated STA
+(either unicast for broadcast/multicast).
+
+Similarly, in 802.11 they're supposed to be sent to the authenticator
+(AP) address.
+
+Since it is possible for unexpected EAPOL frames to result in misbehavior
+in supplicant implementations, it is better for the AP to not allow such
+cases to be forwarded to other clients either directly, or indirectly if
+the AP interface is part of a bridge.
+
+Accept EAPOL (control port) frames only if they're transmitted to the
+own address, or, due to interoperability concerns, to the PAE group
+address.
+
+Disable forwarding of EAPOL (or well, the configured control port
+protocol) frames back to wireless medium in all cases. Previously, these
+frames were accepted from fully authenticated and authorized stations
+and also from unauthenticated stations for one of the cases.
+
+Additionally, to avoid forwarding by the bridge, rewrite the PAE group
+address case to the local MAC address.
+
+Cc: stable@vger.kernel.org
+Co-developed-by: Jouni Malinen <jouni@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.cb327ed0cabe.Ib7dcffa2a31f0913d660de65ba3c8aca75b1d10f@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mac80211/rx.c |   33 +++++++++++++++++++++++++++------
+ 1 file changed, 27 insertions(+), 6 deletions(-)
+
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -2541,13 +2541,13 @@ static bool ieee80211_frame_allowed(stru
+       struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data;
+       /*
+-       * Allow EAPOL frames to us/the PAE group address regardless
+-       * of whether the frame was encrypted or not.
++       * Allow EAPOL frames to us/the PAE group address regardless of
++       * whether the frame was encrypted or not, and always disallow
++       * all other destination addresses for them.
+        */
+-      if (ehdr->h_proto == rx->sdata->control_port_protocol &&
+-          (ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) ||
+-           ether_addr_equal(ehdr->h_dest, pae_group_addr)))
+-              return true;
++      if (unlikely(ehdr->h_proto == rx->sdata->control_port_protocol))
++              return ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) ||
++                     ether_addr_equal(ehdr->h_dest, pae_group_addr);
+       if (ieee80211_802_1x_port_control(rx) ||
+           ieee80211_drop_unencrypted(rx, fc))
+@@ -2572,8 +2572,28 @@ static void ieee80211_deliver_skb_to_loc
+               cfg80211_rx_control_port(dev, skb, noencrypt);
+               dev_kfree_skb(skb);
+       } else {
++              struct ethhdr *ehdr = (void *)skb_mac_header(skb);
++
+               memset(skb->cb, 0, sizeof(skb->cb));
++              /*
++               * 802.1X over 802.11 requires that the authenticator address
++               * be used for EAPOL frames. However, 802.1X allows the use of
++               * the PAE group address instead. If the interface is part of
++               * a bridge and we pass the frame with the PAE group address,
++               * then the bridge will forward it to the network (even if the
++               * client was not associated yet), which isn't supposed to
++               * happen.
++               * To avoid that, rewrite the destination address to our own
++               * address, so that the authenticator (e.g. hostapd) will see
++               * the frame, but bridge won't forward it anywhere else. Note
++               * that due to earlier filtering, the only other address can
++               * be the PAE group address.
++               */
++              if (unlikely(skb->protocol == sdata->control_port_protocol &&
++                           !ether_addr_equal(ehdr->h_dest, sdata->vif.addr)))
++                      ether_addr_copy(ehdr->h_dest, sdata->vif.addr);
++
+               /* deliver to local stack */
+               if (rx->list)
+                       list_add_tail(&skb->list, rx->list);
+@@ -2613,6 +2633,7 @@ ieee80211_deliver_skb(struct ieee80211_r
+       if ((sdata->vif.type == NL80211_IFTYPE_AP ||
+            sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
+           !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
++          ehdr->h_proto != rx->sdata->control_port_protocol &&
+           (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) {
+               if (is_multicast_ether_addr(ehdr->h_dest) &&
+                   ieee80211_vif_get_num_mcast_if(sdata) != 0) {
diff --git a/queue-5.10/mac80211-extend-protection-against-mixed-key-and-fragment-cache-attacks.patch b/queue-5.10/mac80211-extend-protection-against-mixed-key-and-fragment-cache-attacks.patch
new file mode 100644 (file)
index 0000000..4b69427
--- /dev/null
@@ -0,0 +1,76 @@
+From 3edc6b0d6c061a70d8ca3c3c72eb1f58ce29bfb1 Mon Sep 17 00:00:00 2001
+From: Wen Gong <wgong@codeaurora.org>
+Date: Tue, 11 May 2021 20:02:51 +0200
+Subject: mac80211: extend protection against mixed key and fragment cache attacks
+
+From: Wen Gong <wgong@codeaurora.org>
+
+commit 3edc6b0d6c061a70d8ca3c3c72eb1f58ce29bfb1 upstream.
+
+For some chips/drivers, e.g., QCA6174 with ath10k, the decryption is
+done by the hardware, and the Protected bit in the Frame Control field
+is cleared in the lower level driver before the frame is passed to
+mac80211. In such cases, the condition for ieee80211_has_protected() is
+not met in ieee80211_rx_h_defragment() of mac80211 and the new security
+validation steps are not executed.
+
+Extend mac80211 to cover the case where the Protected bit has been
+cleared, but the frame is indicated as having been decrypted by the
+hardware. This extends protection against mixed key and fragment cache
+attack for additional drivers/chips. This fixes CVE-2020-24586 and
+CVE-2020-24587 for such cases.
+
+Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Wen Gong <wgong@codeaurora.org>
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+Link: https://lore.kernel.org/r/20210511200110.037aa5ca0390.I7bb888e2965a0db02a67075fcb5deb50eb7408aa@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mac80211/rx.c |   13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -2239,6 +2239,7 @@ ieee80211_rx_h_defragment(struct ieee802
+       unsigned int frag, seq;
+       struct ieee80211_fragment_entry *entry;
+       struct sk_buff *skb;
++      struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
+       hdr = (struct ieee80211_hdr *)rx->skb->data;
+       fc = hdr->frame_control;
+@@ -2297,7 +2298,9 @@ ieee80211_rx_h_defragment(struct ieee802
+                                    sizeof(rx->key->u.gcmp.rx_pn[queue]));
+                       BUILD_BUG_ON(IEEE80211_CCMP_PN_LEN !=
+                                    IEEE80211_GCMP_PN_LEN);
+-              } else if (rx->key && ieee80211_has_protected(fc)) {
++              } else if (rx->key &&
++                         (ieee80211_has_protected(fc) ||
++                          (status->flag & RX_FLAG_DECRYPTED))) {
+                       entry->is_protected = true;
+                       entry->key_color = rx->key->color;
+               }
+@@ -2342,13 +2345,19 @@ ieee80211_rx_h_defragment(struct ieee802
+                       return RX_DROP_UNUSABLE;
+               memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN);
+       } else if (entry->is_protected &&
+-                 (!rx->key || !ieee80211_has_protected(fc) ||
++                 (!rx->key ||
++                  (!ieee80211_has_protected(fc) &&
++                   !(status->flag & RX_FLAG_DECRYPTED)) ||
+                   rx->key->color != entry->key_color)) {
+               /* Drop this as a mixed key or fragment cache attack, even
+                * if for TKIP Michael MIC should protect us, and WEP is a
+                * lost cause anyway.
+                */
+               return RX_DROP_UNUSABLE;
++      } else if (entry->is_protected && rx->key &&
++                 entry->key_color != rx->key->color &&
++                 (status->flag & RX_FLAG_DECRYPTED)) {
++              return RX_DROP_UNUSABLE;
+       }
+       skb_pull(rx->skb, ieee80211_hdrlen(fc));
index f5fdb06863d5353f4af95ee114ce4b6bc55ccd18..812d747cb0a0a8071301495e49e6267b42c1d2d4 100644 (file)
@@ -28,6 +28,22 @@ mac80211-drop-a-msdus-on-old-ciphers.patch
 mac80211-add-fragment-cache-to-sta_info.patch
 mac80211-check-defrag-pn-against-current-frame.patch
 mac80211-prevent-attacks-on-tkip-wep-as-well.patch
+mac80211-do-not-accept-forward-invalid-eapol-frames.patch
+mac80211-extend-protection-against-mixed-key-and-fragment-cache-attacks.patch
+ath10k-add-ccmp-pn-replay-protection-for-fragmented-frames-for-pcie.patch
+ath10k-drop-fragments-with-multicast-da-for-pcie.patch
+ath10k-drop-fragments-with-multicast-da-for-sdio.patch
+ath10k-drop-mpdu-which-has-discard-flag-set-by-firmware-for-sdio.patch
+ath10k-fix-tkip-michael-mic-verification-for-pcie.patch
+ath10k-validate-first-subframe-of-a-msdu-before-processing-the-list.patch
+ath11k-clear-the-fragment-cache-during-key-install.patch
+dm-snapshot-properly-fix-a-crash-when-an-origin-has-no-snapshots.patch
+drm-amd-pm-correct-mgpufanboost-setting.patch
+drm-amdgpu-vcn1-add-cancel_delayed_work_sync-before-power-gate.patch
+drm-amdkfd-correct-sienna_cichlid-sdma-rlc-register-offset-error.patch
+drm-amdgpu-vcn2.0-add-cancel_delayed_work_sync-before-power-gate.patch
+drm-amdgpu-vcn2.5-add-cancel_delayed_work_sync-before-power-gate.patch
+drm-amdgpu-jpeg2.0-add-cancel_delayed_work_sync-before-power-gate.patch
 selftests-gpio-use-test_gen_progs_extended.patch
 selftests-gpio-move-include-of-lib.mk-up.patch
 selftests-gpio-fix-build-when-source-tree-is-read-on.patch