linux/drivers/of
Grant Likely 09b6f88e36 of: Fix overflow bug in string property parsing functions
commit a87fa1d81a upstream.

The string property read helpers will run off the end of the buffer if
it is handed a malformed string property. Rework the parsers to make
sure that doesn't happen. At the same time add new test cases to make
sure the functions behave themselves.

The original implementations of of_property_read_string_index() and
of_property_count_strings() both open-coded the same block of parsing
code, each with it's own subtly different bugs. The fix here merges
functions into a single helper and makes the original functions static
inline wrappers around the helper.

One non-bugfix aspect of this patch is the addition of a new wrapper,
of_property_read_string_array(). The new wrapper is needed by the
device_properties feature that Rafael is working on and planning to
merge for v3.19. The implementation is identical both with and without
the new static inline wrapper, so it just got left in to reduce the
churn on the header file.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Darren Hart <darren.hart@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-14 09:00:13 -08:00
..
testcase-data of: Fix overflow bug in string property parsing functions 2014-11-14 09:00:13 -08:00
Kconfig of/Kconfig: Spelling s/one/once/ 2013-12-30 10:23:25 -06:00
Makefile Revert "drivers: of: add initialization code for dma reserved memory" 2013-10-15 09:26:07 +01:00
address.c of: fix PCI bus match for PCIe slots 2014-02-05 09:59:20 -06:00
base.c of: Fix overflow bug in string property parsing functions 2014-11-14 09:00:13 -08:00
device.c platform: introduce OF style 'modalias' support for platform bus 2014-01-17 01:59:15 +01:00
fdt.c of: Fix NULL dereference in unflatten_and_copy() 2013-12-11 13:40:30 +00:00
irq.c of/irq: Fix lookup to use 'interrupts-extended' property first 2014-10-05 14:52:10 -07:00
of_mdio.c of_mdio: fix phy interrupt passing 2014-02-18 18:12:53 -05:00
of_mtd.c of: mtd: nuke useless const qualifier 2012-07-10 10:32:06 -05:00
of_net.c phylib: introduce PHY_INTERFACE_MODE_XGMII for 10G PHY 2014-01-13 14:29:48 -08:00
of_pci.c of: implement pci_address_to_pio as weak function 2013-10-09 20:04:06 -05:00
of_pci_irq.c Merge remote-tracking branch 'grant/devicetree/next' into for-next 2013-11-07 10:34:46 -06:00
of_private.h of: Output devicetree alias names in uevent 2013-02-06 11:06:35 +00:00
pdt.c of: remove unnecessary prom.h includes 2013-10-09 20:03:59 -05:00
platform.c of/irq: do irq resolution in platform_get_irq 2014-06-07 10:28:07 -07:00
selftest.c of: Fix overflow bug in string property parsing functions 2014-11-14 09:00:13 -08:00