]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Sun, 1 Dec 2019 17:02:53 +0000 (12:02 -0500)
committerSasha Levin <sashal@kernel.org>
Sun, 1 Dec 2019 17:02:53 +0000 (12:02 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/ath10k-restore-qca9880-ar1a-v1-detection.patch [new file with mode: 0644]
queue-4.19/mm-gup-add-missing-refcount-overflow-checks-on-s390.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/ath10k-restore-qca9880-ar1a-v1-detection.patch b/queue-4.19/ath10k-restore-qca9880-ar1a-v1-detection.patch
new file mode 100644 (file)
index 0000000..6c09118
--- /dev/null
@@ -0,0 +1,83 @@
+From d705560bc42836428cdd6dff5e04f6c010c3e4ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Nov 2019 21:52:14 +0100
+Subject: ath10k: restore QCA9880-AR1A (v1) detection
+
+From: Christian Lamparter <chunkeey@gmail.com>
+
+commit f8914a14623a79b73f72b2b1ee4cd9b2cb91b735 upstream
+
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath10k/pci.c | 27 +++++++++++++++++++++------
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
+index 50a801a5d4f15..b74d7b99cf899 100644
+--- a/drivers/net/wireless/ath/ath10k/pci.c
++++ b/drivers/net/wireless/ath/ath10k/pci.c
+@@ -3482,7 +3482,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
+       struct ath10k_pci *ar_pci;
+       enum ath10k_hw_rev hw_rev;
+       u32 chip_id;
+-      bool pci_ps;
++      bool pci_ps, is_qca988x = false;
+       int (*pci_soft_reset)(struct ath10k *ar);
+       int (*pci_hard_reset)(struct ath10k *ar);
+       u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar, u32 addr);
+@@ -3492,6 +3492,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
+       case QCA988X_2_0_DEVICE_ID:
+               hw_rev = ATH10K_HW_QCA988X;
+               pci_ps = false;
++              is_qca988x = true;
+               pci_soft_reset = ath10k_pci_warm_reset;
+               pci_hard_reset = ath10k_pci_qca988x_chip_reset;
+               targ_cpu_to_ce_addr = ath10k_pci_qca988x_targ_cpu_to_ce_addr;
+@@ -3611,6 +3612,19 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
+               goto err_deinit_irq;
+       }
++      /* Read CHIP_ID before reset to catch QCA9880-AR1A v1 devices that
++       * fall off the bus during chip_reset. These chips have the same pci
++       * device id as the QCA9880 BR4A or 2R4E. So that's why the check.
++       */
++      if (is_qca988x) {
++              chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
++              if (chip_id != 0xffffffff) {
++                      if (!ath10k_pci_chip_is_supported(pdev->device,
++                                                        chip_id))
++                              goto err_unsupported;
++              }
++      }
++
+       ret = ath10k_pci_chip_reset(ar);
+       if (ret) {
+               ath10k_err(ar, "failed to reset chip: %d\n", ret);
+@@ -3623,11 +3637,8 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
+               goto err_free_irq;
+       }
+-      if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) {
+-              ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n",
+-                         pdev->device, chip_id);
+-              goto err_free_irq;
+-      }
++      if (!ath10k_pci_chip_is_supported(pdev->device, chip_id))
++              goto err_unsupported;
+       ret = ath10k_core_register(ar, chip_id);
+       if (ret) {
+@@ -3637,6 +3648,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
+       return 0;
++err_unsupported:
++      ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n",
++                 pdev->device, bus_params.chip_id);
++
+ err_free_irq:
+       ath10k_pci_free_irq(ar);
+       ath10k_pci_rx_retry_sync(ar);
+-- 
+2.20.1
+
diff --git a/queue-4.19/mm-gup-add-missing-refcount-overflow-checks-on-s390.patch b/queue-4.19/mm-gup-add-missing-refcount-overflow-checks-on-s390.patch
new file mode 100644 (file)
index 0000000..835d60d
--- /dev/null
@@ -0,0 +1,64 @@
+From 40bf93282e1af37607d66d8726f72807e4a5813d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Nov 2019 10:03:51 +0100
+Subject: mm, gup: add missing refcount overflow checks on s390
+
+From: Vlastimil Babka <vbabka@suse.cz>
+
+The mainline commit 8fde12ca79af ("mm: prevent get_user_pages() from
+overflowing page refcount") was backported to 4.19.y stable as commit
+d972ebbf42ba. The backport however missed that in 4.19, there are several
+arch-specific gup.c versions with fast gup implementations, so these do not
+prevent refcount overflow.
+
+This stable-only commit fixes the s390 version, and is based on the backport in
+SUSE SLES/openSUSE 4.12-based kernels.
+
+The remaining architectures with own gup.c are sparc, mips, sh. It's unlikely
+the known overflow scenario based on FUSE, which needs 140GB of RAM, is a
+problem for those architectures, and I don't feel confident enough to patch
+them.
+
+Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/mm/gup.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
+index 2809d11c7a283..9b5b866d8adf1 100644
+--- a/arch/s390/mm/gup.c
++++ b/arch/s390/mm/gup.c
+@@ -39,7 +39,8 @@ static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
+               VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
+               page = pte_page(pte);
+               head = compound_head(page);
+-              if (!page_cache_get_speculative(head))
++              if (unlikely(WARN_ON_ONCE(page_ref_count(head) < 0)
++                  || !page_cache_get_speculative(head)))
+                       return 0;
+               if (unlikely(pte_val(pte) != pte_val(*ptep))) {
+                       put_page(head);
+@@ -77,7 +78,8 @@ static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
+               refs++;
+       } while (addr += PAGE_SIZE, addr != end);
+-      if (!page_cache_add_speculative(head, refs)) {
++      if (unlikely(WARN_ON_ONCE(page_ref_count(head) < 0)
++          || !page_cache_add_speculative(head, refs))) {
+               *nr -= refs;
+               return 0;
+       }
+@@ -151,7 +153,8 @@ static int gup_huge_pud(pud_t *pudp, pud_t pud, unsigned long addr,
+               refs++;
+       } while (addr += PAGE_SIZE, addr != end);
+-      if (!page_cache_add_speculative(head, refs)) {
++      if (unlikely(WARN_ON_ONCE(page_ref_count(head) < 0)
++          || !page_cache_add_speculative(head, refs))) {
+               *nr -= refs;
+               return 0;
+       }
+-- 
+2.20.1
+
index d43467b5b4da5385ea9beb2f5fb0e406fe0b8871..1e788da5e63c50a9e7b19231cf9c13d4f628fc61 100644 (file)
@@ -261,3 +261,5 @@ f2fs-fix-to-data-block-override-node-segment-by-mist.patch
 powerpc-pseries-dlpar-fix-a-missing-check-in-dlpar_p.patch
 xdp-fix-cpumap-redirect-skb-creation-bug.patch
 mtd-remove-a-debug-trace-in-mtdpart.c.patch
+ath10k-restore-qca9880-ar1a-v1-detection.patch
+mm-gup-add-missing-refcount-overflow-checks-on-s390.patch