Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1228483

[PATCH 3.14 26/29] of/address: Dont loop forever in of_find_matching_node_by_address().

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.14 26/29] of/address: Dont loop forever in of_find_matching_node_by_address().
Date 2015-09-19 19:30 +0200
Message-ID <qau7v-80f-3@gated-at.bofh.it> (permalink)
References <qau7v-80f-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

From: David Daney <david.daney@cavium.com>

commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab upstream.

If the internal call to of_address_to_resource() fails, we end up
looping forever in of_find_matching_node_by_address().  This can be
caused by a defective device tree, or calling with an incorrect
matches argument.

Fix by calling of_find_matching_node() unconditionally at the end of
the loop.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/of/address.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -704,10 +704,10 @@ struct device_node *of_find_matching_nod
 	struct resource res;
 
 	while (dn) {
-		if (of_address_to_resource(dn, 0, &res))
-			continue;
-		if (res.start == base_address)
+		if (!of_address_to_resource(dn, 0, &res) &&
+		    res.start == base_address)
 			return dn;
+
 		dn = of_find_matching_node(dn, matches);
 	}
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.14 00/29] 3.14.53-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 26/29] of/address: Dont loop forever in of_find_matching_node_by_address(). Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 27/29] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 28/29] drivercore: Fix unregistration path of platform devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 29/29] hpfs: update ctime and mtime on directory modification Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 16/29] serial: 8250: dont bind to SMSC IrCC IR port Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 19:30 +0200
  [PATCH 3.14 24/29] Doc: ABI: testing: configfs-usb-gadget-sourcesink Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 08/29] iio: adis16480: Fix scale factors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 17/29] crypto: ghash-clmulni: specify context size for ghash async algorithm Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 12/29] USB: symbolserial: Use usb_get_serial_port_data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 22/29] devres: fix devres_get() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 20/29] xtensa: fix threadptr reload on return to userspace Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 07/29] iio: Add inverse unit conversion macros Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 06/29] iio: industrialio-buffer: Fix iio_buffer_poll return value Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 03/29] s390/sclp: fix compile error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 21/29] xtensa: fix kernel register spilling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 15/29] usb: host: ehci-sys: delete useless bus_to_hcd conversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 13/29] USB: ftdi_sio: Added custom PID for CustomWare products Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 09/29] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 10/29] clk: versatile: off by one in clk_sp810_timerclken_of_get() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 25/29] auxdisplay: ks0108: fix refcount Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 04/29] iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 14/29] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 19/29] KVM: MMU: fix validation of mmio page fault Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 01/29] DRM - radeon: Dont link train DisplayPort on HPD until we get the dpcd Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 02/29] drm/qxl: validate monitors config modes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 23/29] Doc: ABI: testing: configfs-usb-gadget-loopback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 11/29] PCI: Fix TI816X class code quirk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 18/29] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  [PATCH 3.14 05/29] iio: event: Remove negative error code from iio_event_poll Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-19 20:40 +0200
  Re: [PATCH 3.14 00/29] 3.14.53-stable review Guenter Roeck <linux@roeck-us.net> - 2015-09-20 02:20 +0200
    Re: [PATCH 3.14 00/29] 3.14.53-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-09-21 06:40 +0200
  Re: [PATCH 3.14 00/29] 3.14.53-stable review Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-21 09:10 +0200

csiph-web