linux-yocto/drivers/base
Abdun Nihaal 1b102d2cc4 regmap: fix potential memory leak of regmap_bus
[ Upstream commit c871c199ac ]

When __regmap_init() is called from __regmap_init_i2c() and
__regmap_init_spi() (and their devm versions), the bus argument
obtained from regmap_get_i2c_bus() and regmap_get_spi_bus(), may be
allocated using kmemdup() to support quirks. In those cases, the
bus->free_on_exit field is set to true.

However, inside __regmap_init(), buf is not freed on any error path.
This could lead to a memory leak of regmap_bus when __regmap_init()
fails. Fix that by freeing bus on error path when free_on_exit is set.

Fixes: ea030ca688 ("regmap-i2c: Set regmap max raw r/w from quirks")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://patch.msgid.link/20250626172823.18725-1-abdun.nihaal@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-01 09:48:40 +01:00
..
firmware_loader firmware_loader: Fix possible resource leak in fw_log_firmware_info() 2024-12-05 14:02:38 +01:00
power PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() 2025-06-27 11:11:28 +01:00
regmap regmap: fix potential memory leak of regmap_bus 2025-08-01 09:48:40 +01:00
test drivers: base: test: Make property entry API test modular 2023-10-05 13:11:44 +02:00
arch_numa.c arch_numa: Restore nid checks before registering a memblock with a node 2024-12-14 20:03:31 +01:00
arch_topology.c ACPI: processor: Move arch_init_invariance_cppc() call later 2024-11-06 21:31:36 +01:00
attribute_container.c driver core: attribute_container: Remove unused functions 2024-09-13 15:41:42 +02:00
auxiliary_sysfs.c driver core: auxiliary bus: show auxiliary device IRQs 2024-07-11 14:17:03 -07:00
auxiliary.c drivers/base: Introduce device_match_t for device finding APIs 2024-09-03 12:48:51 +02:00
base.h driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:59:29 +02:00
bus.c driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:59:29 +02:00
cacheinfo.c cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU 2024-12-14 20:03:27 +01:00
class.c driver core: class: Fix wild pointer dereferences in API class_dev_iter_next() 2025-02-08 09:57:58 +01:00
component.c driver core: component: fix spellos 2024-01-30 15:58:06 -08:00
container.c driver core: container: make container_subsys const 2023-12-21 13:56:10 +01:00
core.c driver core: fix potential NULL pointer dereference in dev_uevent() 2025-05-02 07:59:29 +02:00
cpu.c x86/bugs: Add a Transient Scheduler Attacks mitigation 2025-07-10 16:05:14 +02:00
dd.c driver core: introduce device_set_driver() helper 2025-05-02 07:59:28 +02:00
devcoredump.c devcoredump: Add dev_coredumpm_timeout() 2024-06-12 11:29:36 -04:00
devres.c drivers: base: devres: Allow to release group on device release 2025-04-20 10:15:24 +02:00
devtmpfs.c driver core: clean up the logic to determine which /sys/dev/ directory to use 2023-03-31 17:45:07 +02:00
driver.c drivers/base: Introduce device_match_t for device finding APIs 2024-09-03 12:48:51 +02:00
firmware.c
hypervisor.c
init.c drivers: base: Move cpu_dev_init() after node_dev_init() 2023-12-06 12:41:49 +09:00
isa.c driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
Kconfig arch_numa: switch over to numa_memblks 2024-09-03 21:15:32 -07:00
Makefile driver core: auxiliary bus: show auxiliary device IRQs 2024-07-11 14:17:03 -07:00
map.c
memory.c crash: add a new kexec flag for hotplug support 2024-04-23 14:59:01 +10:00
module.c drivers: base: handle module_kobject creation 2025-05-09 09:50:52 +02:00
node.c cxl/region: Deal with numa nodes not enumerated by SRAT 2024-03-12 14:54:03 -07:00
physical_location.c driver core: location: Free struct acpi_pld_info *pld before return false 2023-01-20 14:20:30 +01:00
physical_location.h driver core: physical_location.h remove extern from function prototypes 2023-03-24 15:35:48 +01:00
pinctrl.c
platform-msi.c platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() 2025-06-27 11:11:27 +01:00
platform.c platform: Make platform_bus_type constant 2024-09-03 13:00:50 +02:00
property.c Char/Misc and other driver subsystem changes for 6.10-rc1 2024-05-22 12:26:46 -07:00
soc.c driver core: mark remaining local bus_type variables as const 2023-12-21 13:56:30 +01:00
swnode.c software node: Correct a OOB check in software_node_get_reference_args() 2025-06-27 11:11:34 +01:00
syscore.c
topology.c topology: Keep the cpumask unchanged when printing cpumap 2025-01-17 13:40:53 +01:00
trace.c
trace.h devres: Fix page faults when tracing devres from unloaded modules 2024-12-05 14:02:36 +01:00
transport_class.c drivers: base: transport_class: fix resource leak when transport_add_device() fails 2023-01-20 14:22:53 +01:00