linux/drivers/of
Sergey Shtylyov 5d59fd637a of: module: add buffer overflow check in of_modalias()
commit cf7385cb26 upstream.

In of_modalias(), if the buffer happens to be too small even for the 1st
snprintf() call, the len parameter will become negative and str parameter
(if not NULL initially) will point beyond the buffer's end. Add the buffer
overflow check after the 1st snprintf() call and fix such check after the
strlen() call (accounting for the terminating NUL char).

Fixes: bc575064d6 ("of/device: use of_property_for_each_string to parse compatible strings")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/bbfc6be0-c687-62b6-d015-5141b93f313e@omp.ru
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-02 07:47:08 +02:00
..
unittest-data of/address: Add support for 3 address cell bus 2025-01-17 13:34:47 +01:00
address.c of: address: Preserve the flags portion on 1:1 dma-ranges mapping 2025-01-17 13:34:48 +01:00
base.c of: Fix of_find_node_opts_by_path() handling of alias+path+options 2025-02-21 13:49:42 +01:00
device.c of: module: add buffer overflow check in of_modalias() 2025-05-02 07:47:08 +02:00
dynamic.c of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:28:32 +02:00
fdt.c Revert "mm: kmemleak: alloc gray object for reserved region with direct map" 2023-02-09 11:28:20 +01:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
irq.c of/irq: Fix device node refcount leakages in of_irq_init() 2025-04-25 10:43:46 +02:00
Kconfig of: net: move of_net under net/ 2021-10-07 13:39:51 +01:00
kexec.c mm,ima,kexec,of: use memblock_free_late from ima_free_kexec_buffer 2023-08-30 16:11:06 +02:00
kobj.c of: kobj: make of_node_is_(initialized|attached) parameters const 2021-10-20 13:37:25 -05:00
Makefile of: net: move of_net under net/ 2021-10-07 13:39:51 +01:00
of_numa.c of, numa: Fetch empty NUMA node ID from distance map 2021-10-04 13:13:44 -05:00
of_private.h of/irq: Factor out parsing of interrupt-map parent phandle+args from of_irq_parse_raw() 2024-07-25 09:49:10 +02:00
of_reserved_mem.c Revert "of: reserved-memory: Fix using wrong number of cells to get property 'alignment'" 2025-03-13 12:53:11 +01:00
overlay.c of: overlay: Reorder struct fragment fields kerneldoc 2024-03-06 14:45:04 +00:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c treewide: Fix probing of devices in DT overlays 2023-09-13 09:43:05 +02:00
property.c of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing 2024-03-06 14:45:09 +00:00
resolver.c of: resolver: Fix device node refcount leakage in of_resolve_phandles() 2025-05-02 07:46:52 +02:00
unittest.c of/address: Add support for 3 address cell bus 2025-01-17 13:34:47 +01:00