]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Apr 2025 13:56:50 +0000 (15:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Apr 2025 13:56:50 +0000 (15:56 +0200)
added patches:
ntb-use-64-bit-arithmetic-for-the-msi-doorbell-mask.patch
of-irq-fix-device-node-refcount-leakage-in-api-irq_of_parse_and_map.patch
of-irq-fix-device-node-refcount-leakages-in-of_irq_count.patch
of-irq-fix-device-node-refcount-leakages-in-of_irq_init.patch
pci-brcmstb-fix-missing-of_node_put-in-brcm_pcie_probe.patch
pci-fix-reference-leak-in-pci_alloc_child_bus.patch
pinctrl-qcom-clear-latched-interrupt-status-when-changing-irq-type.patch

queue-5.10/ntb-use-64-bit-arithmetic-for-the-msi-doorbell-mask.patch [new file with mode: 0644]
queue-5.10/of-irq-fix-device-node-refcount-leakage-in-api-irq_of_parse_and_map.patch [new file with mode: 0644]
queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_count.patch [new file with mode: 0644]
queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_init.patch [new file with mode: 0644]
queue-5.10/pci-brcmstb-fix-missing-of_node_put-in-brcm_pcie_probe.patch [new file with mode: 0644]
queue-5.10/pci-fix-reference-leak-in-pci_alloc_child_bus.patch [new file with mode: 0644]
queue-5.10/pinctrl-qcom-clear-latched-interrupt-status-when-changing-irq-type.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/ntb-use-64-bit-arithmetic-for-the-msi-doorbell-mask.patch b/queue-5.10/ntb-use-64-bit-arithmetic-for-the-msi-doorbell-mask.patch
new file mode 100644 (file)
index 0000000..0add706
--- /dev/null
@@ -0,0 +1,40 @@
+From fd5625fc86922f36bedee5846fefd647b7e72751 Mon Sep 17 00:00:00 2001
+From: Fedor Pchelkin <pchelkin@ispras.ru>
+Date: Wed, 15 Jan 2025 21:28:17 +0300
+Subject: ntb: use 64-bit arithmetic for the MSI doorbell mask
+
+From: Fedor Pchelkin <pchelkin@ispras.ru>
+
+commit fd5625fc86922f36bedee5846fefd647b7e72751 upstream.
+
+msi_db_mask is of type 'u64', still the standard 'int' arithmetic is
+performed to compute its value.
+
+While most of the ntb_hw drivers actually don't utilize the higher 32
+bits of the doorbell mask now, this may be the case for Switchtec - see
+switchtec_ntb_init_db().
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE static
+analysis tool.
+
+Fixes: 2b0569b3b7e6 ("NTB: Add MSI interrupt support to ntb_transport")
+Cc: stable@vger.kernel.org
+Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
+Reviewed-by: Dave Jiang <dave.jiang@intel.com>
+Signed-off-by: Jon Mason <jdmason@kudzu.us>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ntb/ntb_transport.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/ntb/ntb_transport.c
++++ b/drivers/ntb/ntb_transport.c
+@@ -1340,7 +1340,7 @@ static int ntb_transport_probe(struct nt
+       qp_count = ilog2(qp_bitmap);
+       if (nt->use_msi) {
+               qp_count -= 1;
+-              nt->msi_db_mask = 1 << qp_count;
++              nt->msi_db_mask = BIT_ULL(qp_count);
+               ntb_db_clear_mask(ndev, nt->msi_db_mask);
+       }
diff --git a/queue-5.10/of-irq-fix-device-node-refcount-leakage-in-api-irq_of_parse_and_map.patch b/queue-5.10/of-irq-fix-device-node-refcount-leakage-in-api-irq_of_parse_and_map.patch
new file mode 100644 (file)
index 0000000..806a8cd
--- /dev/null
@@ -0,0 +1,44 @@
+From 962a2805e47b933876ba0e4c488d9e89ced2dd29 Mon Sep 17 00:00:00 2001
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+Date: Sun, 9 Feb 2025 20:58:59 +0800
+Subject: of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()
+
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+
+commit 962a2805e47b933876ba0e4c488d9e89ced2dd29 upstream.
+
+In irq_of_parse_and_map(), refcount of device node @oirq.np was got
+by successful of_irq_parse_one() invocation, but it does not put the
+refcount before return, so causes @oirq.np refcount leakage.
+
+Fix by putting @oirq.np refcount before return.
+
+Fixes: e3873444990d ("of/irq: Move irq_of_parse_and_map() to common code")
+Cc: stable@vger.kernel.org
+Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
+Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-6-93e3a2659aa7@quicinc.com
+Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/irq.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/of/irq.c
++++ b/drivers/of/irq.c
+@@ -36,11 +36,15 @@
+ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
+ {
+       struct of_phandle_args oirq;
++      unsigned int ret;
+       if (of_irq_parse_one(dev, index, &oirq))
+               return 0;
+-      return irq_create_of_mapping(&oirq);
++      ret = irq_create_of_mapping(&oirq);
++      of_node_put(oirq.np);
++
++      return ret;
+ }
+ EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
diff --git a/queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_count.patch b/queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_count.patch
new file mode 100644 (file)
index 0000000..4de7db5
--- /dev/null
@@ -0,0 +1,40 @@
+From bbf71f44aaf241d853759a71de7e7ebcdb89be3d Mon Sep 17 00:00:00 2001
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+Date: Sun, 9 Feb 2025 20:58:58 +0800
+Subject: of/irq: Fix device node refcount leakages in of_irq_count()
+
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+
+commit bbf71f44aaf241d853759a71de7e7ebcdb89be3d upstream.
+
+of_irq_count() invokes of_irq_parse_one() to count IRQs, and successful
+invocation of the later will get device node @irq.np refcount, but the
+former does not put the refcount before next iteration invocation, hence
+causes device node refcount leakages.
+
+Fix by putting @irq.np refcount before the next iteration invocation.
+
+Fixes: 3da5278727a8 ("of/irq: Rework of_irq_count()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
+Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-5-93e3a2659aa7@quicinc.com
+Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/irq.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/of/irq.c
++++ b/drivers/of/irq.c
+@@ -443,8 +443,10 @@ int of_irq_count(struct device_node *dev
+       struct of_phandle_args irq;
+       int nr = 0;
+-      while (of_irq_parse_one(dev, nr, &irq) == 0)
++      while (of_irq_parse_one(dev, nr, &irq) == 0) {
++              of_node_put(irq.np);
+               nr++;
++      }
+       return nr;
+ }
diff --git a/queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_init.patch b/queue-5.10/of-irq-fix-device-node-refcount-leakages-in-of_irq_init.patch
new file mode 100644 (file)
index 0000000..b998736
--- /dev/null
@@ -0,0 +1,53 @@
+From 708124d9e6e7ac5ebf927830760679136b23fdf0 Mon Sep 17 00:00:00 2001
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+Date: Sun, 9 Feb 2025 20:59:00 +0800
+Subject: of/irq: Fix device node refcount leakages in of_irq_init()
+
+From: Zijun Hu <quic_zijuhu@quicinc.com>
+
+commit 708124d9e6e7ac5ebf927830760679136b23fdf0 upstream.
+
+of_irq_init() will leak interrupt controller device node refcounts
+in two places as explained below:
+
+1) Leak refcounts of both @desc->dev and @desc->interrupt_parent when
+   suffers @desc->irq_init_cb() failure.
+2) Leak refcount of @desc->interrupt_parent when cleans up list
+   @intc_desc_list in the end.
+
+Refcounts of both @desc->dev and @desc->interrupt_parent were got in
+the first loop, but of_irq_init() does not put them before kfree(@desc)
+in places mentioned above, so causes refcount leakages.
+
+Fix by putting refcounts involved before kfree(@desc).
+
+Fixes: 8363ccb917c6 ("of/irq: add missing of_node_put")
+Fixes: c71a54b08201 ("of/irq: introduce of_irq_init")
+Cc: stable@vger.kernel.org
+Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
+Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-7-93e3a2659aa7@quicinc.com
+Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/irq.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/of/irq.c
++++ b/drivers/of/irq.c
+@@ -555,6 +555,8 @@ void __init of_irq_init(const struct of_
+                                               desc->interrupt_parent);
+                       if (ret) {
+                               of_node_clear_flag(desc->dev, OF_POPULATED);
++                              of_node_put(desc->interrupt_parent);
++                              of_node_put(desc->dev);
+                               kfree(desc);
+                               continue;
+                       }
+@@ -585,6 +587,7 @@ void __init of_irq_init(const struct of_
+ err:
+       list_for_each_entry_safe(desc, temp_desc, &intc_desc_list, list) {
+               list_del(&desc->list);
++              of_node_put(desc->interrupt_parent);
+               of_node_put(desc->dev);
+               kfree(desc);
+       }
diff --git a/queue-5.10/pci-brcmstb-fix-missing-of_node_put-in-brcm_pcie_probe.patch b/queue-5.10/pci-brcmstb-fix-missing-of_node_put-in-brcm_pcie_probe.patch
new file mode 100644 (file)
index 0000000..e719298
--- /dev/null
@@ -0,0 +1,61 @@
+From 2df181e1aea4628a8fd257f866026625d0519627 Mon Sep 17 00:00:00 2001
+From: Stanimir Varbanov <svarbanov@suse.de>
+Date: Thu, 23 Jan 2025 00:29:55 +0200
+Subject: PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Stanimir Varbanov <svarbanov@suse.de>
+
+commit 2df181e1aea4628a8fd257f866026625d0519627 upstream.
+
+A call to of_parse_phandle() is incrementing the refcount, and as such,
+the of_node_put() must be called when the reference is no longer needed.
+
+Thus, refactor the existing code and add a missing of_node_put() call
+following the check to ensure that "msi_np" matches "pcie->np" and after
+MSI initialization, but only if the MSI support is enabled system-wide.
+
+Cc: stable@vger.kernel.org # v5.10+
+Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
+Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
+Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
+Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+Link: https://lore.kernel.org/r/20250122222955.1752778-1-svarbanov@suse.de
+[kwilczynski: commit log]
+Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/pcie-brcmstb.c |   13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+--- a/drivers/pci/controller/pcie-brcmstb.c
++++ b/drivers/pci/controller/pcie-brcmstb.c
+@@ -1215,7 +1215,7 @@ static const struct of_device_id brcm_pc
+ static int brcm_pcie_probe(struct platform_device *pdev)
+ {
+-      struct device_node *np = pdev->dev.of_node, *msi_np;
++      struct device_node *np = pdev->dev.of_node;
+       struct pci_host_bridge *bridge;
+       const struct pcie_cfg_data *data;
+       struct brcm_pcie *pcie;
+@@ -1280,9 +1280,14 @@ static int brcm_pcie_probe(struct platfo
+       pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION);
+-      msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
+-      if (pci_msi_enabled() && msi_np == pcie->np) {
+-              ret = brcm_pcie_enable_msi(pcie);
++      if (pci_msi_enabled()) {
++              struct device_node *msi_np = of_parse_phandle(pcie->np, "msi-parent", 0);
++
++              if (msi_np == pcie->np)
++                      ret = brcm_pcie_enable_msi(pcie);
++
++              of_node_put(msi_np);
++
+               if (ret) {
+                       dev_err(pcie->dev, "probe of internal MSI failed");
+                       goto fail;
diff --git a/queue-5.10/pci-fix-reference-leak-in-pci_alloc_child_bus.patch b/queue-5.10/pci-fix-reference-leak-in-pci_alloc_child_bus.patch
new file mode 100644 (file)
index 0000000..4c41df7
--- /dev/null
@@ -0,0 +1,42 @@
+From 1f2768b6a3ee77a295106e3a5d68458064923ede Mon Sep 17 00:00:00 2001
+From: Ma Ke <make24@iscas.ac.cn>
+Date: Sun, 2 Feb 2025 14:23:57 +0800
+Subject: PCI: Fix reference leak in pci_alloc_child_bus()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ma Ke <make24@iscas.ac.cn>
+
+commit 1f2768b6a3ee77a295106e3a5d68458064923ede upstream.
+
+If device_register(&child->dev) fails, call put_device() to explicitly
+release child->dev, per the comment at device_register().
+
+Found by code review.
+
+Link: https://lore.kernel.org/r/20250202062357.872971-1-make24@iscas.ac.cn
+Fixes: 4f535093cf8f ("PCI: Put pci_dev in device tree as early as possible")
+Signed-off-by: Ma Ke <make24@iscas.ac.cn>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/probe.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/pci/probe.c
++++ b/drivers/pci/probe.c
+@@ -1105,7 +1105,10 @@ static struct pci_bus *pci_alloc_child_b
+ add_dev:
+       pci_set_bus_msi_domain(child);
+       ret = device_register(&child->dev);
+-      WARN_ON(ret < 0);
++      if (WARN_ON(ret < 0)) {
++              put_device(&child->dev);
++              return NULL;
++      }
+       pcibios_add_bus(child);
diff --git a/queue-5.10/pinctrl-qcom-clear-latched-interrupt-status-when-changing-irq-type.patch b/queue-5.10/pinctrl-qcom-clear-latched-interrupt-status-when-changing-irq-type.patch
new file mode 100644 (file)
index 0000000..da29ee2
--- /dev/null
@@ -0,0 +1,107 @@
+From e225128c3f8be879e7d4eb71a25949e188b420ae Mon Sep 17 00:00:00 2001
+From: Stephan Gerhold <stephan.gerhold@linaro.org>
+Date: Wed, 12 Mar 2025 14:19:27 +0100
+Subject: pinctrl: qcom: Clear latched interrupt status when changing IRQ type
+
+From: Stephan Gerhold <stephan.gerhold@linaro.org>
+
+commit e225128c3f8be879e7d4eb71a25949e188b420ae upstream.
+
+When submitting the TLMM test driver, Bjorn reported that some of the test
+cases are failing for GPIOs that not are backed by PDC (i.e. "non-wakeup"
+GPIOs that are handled directly in pinctrl-msm). Basically, lingering
+latched interrupt state is still being delivered at IRQ request time, e.g.:
+
+  ok 1 tlmm_test_silent_rising
+  tlmm_test_silent_falling: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
+  Expected atomic_read(&priv->intr_count) == 0, but
+      atomic_read(&priv->intr_count) == 1 (0x1)
+  not ok 2 tlmm_test_silent_falling
+  tlmm_test_silent_low: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
+  Expected atomic_read(&priv->intr_count) == 0, but
+      atomic_read(&priv->intr_count) == 1 (0x1)
+  not ok 3 tlmm_test_silent_low
+  ok 4 tlmm_test_silent_high
+
+Whether to report interrupts that came in while the IRQ was unclaimed
+doesn't seem to be well-defined in the Linux IRQ API. However, looking
+closer at these specific cases, we're actually reporting events that do not
+match the interrupt type requested by the driver:
+
+ 1. After "ok 1 tlmm_test_silent_rising", the GPIO is in low state and
+    configured for IRQF_TRIGGER_RISING.
+
+ 2. (a) In preparation for "tlmm_test_silent_falling", the GPIO is switched
+        to high state. The rising interrupt gets latched.
+    (b) The GPIO is re-configured for IRQF_TRIGGER_FALLING, but the latched
+        interrupt isn't cleared.
+    (c) The IRQ handler is called for the latched interrupt, but there
+        wasn't any falling edge.
+
+ 3. (a) For "tlmm_test_silent_low", the GPIO remains in high state.
+    (b) The GPIO is re-configured for IRQF_TRIGGER_LOW. This seems to
+        result in a phantom interrupt that gets latched.
+    (c) The IRQ handler is called for the latched interrupt, but the GPIO
+        isn't in low state.
+
+ 4. (a) For "tlmm_test_silent_high", the GPIO is switched to low state.
+    (b) This doesn't result in a latched interrupt, because RAW_STATUS_EN
+        was cleared when masking the level-triggered interrupt.
+
+Fix this by clearing the interrupt state whenever making any changes to the
+interrupt configuration. This includes previously disabled interrupts, but
+also any changes to interrupt polarity or detection type.
+
+With this change, all 16 test cases are now passing for the non-wakeup
+GPIOs in the TLMM.
+
+Cc: stable@vger.kernel.org
+Fixes: cf9d052aa600 ("pinctrl: qcom: Don't clear pending interrupts when enabling")
+Reported-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
+Closes: https://lore.kernel.org/r/20250227-tlmm-test-v1-1-d18877b4a5db@oss.qualcomm.com/
+Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
+Tested-by: Bjorn Andersson <andersson@kernel.org>
+Reviewed-by: Bjorn Andersson <andersson@kernel.org>
+Link: https://lore.kernel.org/20250312-pinctrl-msm-type-latch-v1-1-ce87c561d3d7@linaro.org
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pinctrl/qcom/pinctrl-msm.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c
++++ b/drivers/pinctrl/qcom/pinctrl-msm.c
+@@ -955,8 +955,7 @@ static int msm_gpio_irq_set_type(struct
+       struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
+       const struct msm_pingroup *g;
+       unsigned long flags;
+-      bool was_enabled;
+-      u32 val;
++      u32 val, oldval;
+       if (msm_gpio_needs_dual_edge_parent_workaround(d, type)) {
+               set_bit(d->hwirq, pctrl->dual_edge_irqs);
+@@ -1016,8 +1015,7 @@ static int msm_gpio_irq_set_type(struct
+        * internal circuitry of TLMM, toggling the RAW_STATUS
+        * could cause the INTR_STATUS to be set for EDGE interrupts.
+        */
+-      val = msm_readl_intr_cfg(pctrl, g);
+-      was_enabled = val & BIT(g->intr_raw_status_bit);
++      val = oldval = msm_readl_intr_cfg(pctrl, g);
+       val |= BIT(g->intr_raw_status_bit);
+       if (g->intr_detection_width == 2) {
+               val &= ~(3 << g->intr_detection_bit);
+@@ -1070,9 +1068,11 @@ static int msm_gpio_irq_set_type(struct
+       /*
+        * The first time we set RAW_STATUS_EN it could trigger an interrupt.
+        * Clear the interrupt.  This is safe because we have
+-       * IRQCHIP_SET_TYPE_MASKED.
++       * IRQCHIP_SET_TYPE_MASKED. When changing the interrupt type, we could
++       * also still have a non-matching interrupt latched, so clear whenever
++       * making changes to the interrupt configuration.
+        */
+-      if (!was_enabled)
++      if (val != oldval)
+               msm_ack_intr_status(pctrl, g);
+       if (test_bit(d->hwirq, pctrl->dual_edge_irqs))
index 6c534d1f947ef85a5c5836039b07cd702c0f1eda..e279f81558e1bd574d511abbd7410cc3548c5305 100644 (file)
@@ -88,3 +88,10 @@ crypto-ccp-fix-check-for-the-primary-asp-device.patch
 dm-integrity-set-ti-error-on-memory-allocation-failure.patch
 ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch
 gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch
+ntb-use-64-bit-arithmetic-for-the-msi-doorbell-mask.patch
+of-irq-fix-device-node-refcount-leakages-in-of_irq_count.patch
+of-irq-fix-device-node-refcount-leakage-in-api-irq_of_parse_and_map.patch
+of-irq-fix-device-node-refcount-leakages-in-of_irq_init.patch
+pci-brcmstb-fix-missing-of_node_put-in-brcm_pcie_probe.patch
+pci-fix-reference-leak-in-pci_alloc_child_bus.patch
+pinctrl-qcom-clear-latched-interrupt-status-when-changing-irq-type.patch