linux-stable/drivers/of
Sergey Shtylyov ee332023ad of: module: add buffer overflow check in of_modalias()
[ Upstream commit cf7385cb26 ]

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: Sasha Levin <sashal@kernel.org>
2024-05-30 09:49:48 +02:00
..
unittest-data of: Fix double free in of_parse_phandle_with_args_map 2024-01-09 12:54:02 -06:00
Kconfig of: make OF_EARLY_FLATTREE depend on HAS_IOMEM 2023-07-10 08:48:35 -06:00
Makefile Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
address.c dma-mapping: don't store redundant offsets 2023-12-15 12:32:42 +01:00
base.c of: Fix double free in of_parse_phandle_with_args_map 2024-01-09 12:54:02 -06:00
cpu.c of: Move CPU node related functions to their own file 2023-04-13 17:46:34 -05:00
device.c IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
dynamic.c of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:38:18 +02:00
fdt.c Devicetree fixes for 6.4, part 1: 2023-05-05 13:27:59 -07:00
fdt_address.c
irq.c of/irq: add missing of_node_put() for interrupt parent node 2023-01-18 11:31:42 -06:00
kexec.c mm,ima,kexec,of: use memblock_free_late from ima_free_kexec_buffer 2023-08-18 11:47:45 -05:00
kobj.c of: make of_node_ktype constant 2023-02-06 11:03:00 -06:00
module.c of: module: add buffer overflow check in of_modalias() 2024-05-30 09:49:48 +02: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: Move of_platform_register_reconfig_notifier() into DT core 2023-08-04 11:36:33 -06:00
of_reserved_mem.c of: reserved_mem: Use stable allocation order 2023-06-20 09:34:58 -06:00
overlay.c of: overlay: enable of_overlay_fdt_apply() kerneldoc 2023-11-15 11:37:56 -06:00
pdt.c
platform.c Char/Misc and other Driver changes for 6.8-rc1 2024-01-17 16:47:17 -08:00
property.c of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing 2024-03-01 15:28:17 -06:00
resolver.c
unittest.c of: unittest: Fix compile in the non-dynamic case 2024-01-31 16:04:18 -06:00