linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Murali Karicheri <m-karicheri2@ti.com>,
	Johan Hovold <johan@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: [PATCH 4.4 03/22] PCI: keystone: Fix interrupt-controller-node lookup
Date: Mon, 26 Feb 2018 21:16:03 +0100	[thread overview]
Message-ID: <20180226201558.873205932@linuxfoundation.org> (raw)
In-Reply-To: <20180226201558.681421374@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit eac56aa3bc8af3d9b9850345d0f2da9d83529134 upstream.

Fix child-node lookup during initialisation which was using the wrong
OF-helper and ended up searching the whole device tree depth-first
starting at the parent rather than just matching on its children.

To make things worse, the parent pci node could end up being prematurely
freed as of_find_node_by_name() drops a reference to its first argument.
Any matching child interrupt-controller node was also leaked.

Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
Cc: stable <stable@vger.kernel.org>     # 3.18
Acked-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
[lorenzo.pieralisi@arm.com: updated commit subject]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
[johan: backport to 4.4]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/host/pci-keystone.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -179,14 +179,16 @@ static int ks_pcie_get_irq_controller_in
 	}
 
 	/* interrupt controller is in a child node */
-	*np_temp = of_find_node_by_name(np_pcie, controller);
+	*np_temp = of_get_child_by_name(np_pcie, controller);
 	if (!(*np_temp)) {
 		dev_err(dev, "Node for %s is absent\n", controller);
 		goto out;
 	}
 	temp = of_irq_count(*np_temp);
-	if (!temp)
+	if (!temp) {
+		of_node_put(*np_temp);
 		goto out;
+	}
 	if (temp > max_host_irqs)
 		dev_warn(dev, "Too many %s interrupts defined %u\n",
 			(legacy ? "legacy" : "MSI"), temp);
@@ -200,6 +202,9 @@ static int ks_pcie_get_irq_controller_in
 		if (!host_irqs[temp])
 			break;
 	}
+
+	of_node_put(*np_temp);
+
 	if (temp) {
 		*num_irqs = temp;
 		ret = 0;

  parent reply	other threads:[~2018-02-26 20:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 20:16 [PATCH 4.4 00/22] 4.4.119-stable review Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 01/22] netfilter: drop outermost socket lock in getsockopt() Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 02/22] powerpc/64s: Fix RFI flush dependency on HARDLOCKUP_DETECTOR Greg Kroah-Hartman
2018-02-26 20:16 ` Greg Kroah-Hartman [this message]
2018-02-26 20:16 ` [PATCH 4.4 04/22] ip_tunnel: replace dst_cache with generic implementation Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 05/22] ip_tunnel: fix preempt warning in ip tunnel creation/updating Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 06/22] xtensa: fix high memory/reserved memory collision Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 07/22] scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 08/22] cfg80211: fix cfg80211_beacon_dup Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 09/22] iio: buffer: check if a buffer has been set up when poll is called Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 10/22] iio: adis_lib: Initialize trigger before requesting interrupt Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 11/22] x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 12/22] irqchip/gic-v3: Use wmb() instead of smb_wmb() in gic_raise_softirq() Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 13/22] usb: ohci: Proper handling of ed_rm_list to handle race condition between usb_kill_urb() and finish_unlinks() Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 14/22] arm64: Disable unhandled signal log messages by default Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 15/22] Add delay-init quirk for Corsair K70 RGB keyboards Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 16/22] drm/edid: Add 6 bpc quirk for CPT panel in Asus UX303LA Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 17/22] usb: dwc3: gadget: Set maxpacket size for ep0 IN Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 18/22] usb: ldusb: add PIDs for new CASSY devices supported by this driver Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 19/22] usb: gadget: f_fs: Process all descriptors during bind Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 20/22] usb: renesas_usbhs: missed the "running" flag in usb_dmac with rx path Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 21/22] drm/amdgpu: Avoid leaking PM domain on driver unbind (v2) Greg Kroah-Hartman
2018-02-26 20:16 ` [PATCH 4.4 22/22] binder: add missing binder_unlock() Greg Kroah-Hartman
2018-02-27  0:08 ` [PATCH 4.4 00/22] 4.4.119-stable review Nathan Chancellor
2018-02-27 13:10   ` Greg Kroah-Hartman
2018-02-27  0:56 ` Shuah Khan
2018-02-27  4:18 ` kernelci.org bot
2018-02-27  7:17 ` Naresh Kamboju
2018-02-27 10:56 ` Guenter Roeck
2018-02-27 18:33   ` Greg Kroah-Hartman
2018-02-27 14:55 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180226201558.873205932@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=m-karicheri2@ti.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).