linux-yocto/drivers/base/regmap
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
..
internal.h regmap: maple: Provide lockdep (sub)class for maple tree's internal lock 2024-12-14 20:03:40 +01:00
Kconfig
Makefile
regcache-flat.c regcache: use map->alloc_flags also for allocating cache 2024-08-28 13:52:29 +01:00
regcache-maple.c regmap: maple: Provide lockdep (sub)class for maple tree's internal lock 2024-12-14 20:03:40 +01:00
regcache-rbtree.c regcache: use map->alloc_flags also for allocating cache 2024-08-28 13:52:29 +01:00
regcache.c regmap: Hold the regmap lock when allocating and freeing the cache 2024-08-23 11:03:11 +01:00
regmap-ac97.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-debugfs.c
regmap-fsi.c
regmap-i2c.c regmap-i2c: add missing MODULE_DESCRIPTION() macro 2024-06-14 15:23:14 +01:00
regmap-i3c.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-irq.c regmap-irq: Add missing kfree() 2025-02-21 14:01:37 +01:00
regmap-kunit.c regmap: kunit: Add coverage of spinlocked regmaps 2024-09-02 12:56:16 +01:00
regmap-mdio.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-mmio.c
regmap-ram.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-raw-ram.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-sccb.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-sdw-mbq.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-sdw.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-slimbus.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-spi-avmm.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-spi.c regmap: spi: Fix potential off-by-one when calculating reserved size 2024-06-05 22:23:52 +01:00
regmap-spmi.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-w1.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap.c regmap: fix potential memory leak of regmap_bus 2025-08-01 09:48:40 +01:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00