Files
linux-stable-mirror/include/linux
Petr Pavlu 2d079caf9c module: Fix freeing of charp module parameters when CONFIG_SYSFS=n
[ Upstream commit deffe1edba ]

When setting a charp module parameter, the param_set_charp() function
allocates memory to store a copy of the input value. Later, when the module
is potentially unloaded, the destroy_params() function is called to free
this allocated memory.

However, destroy_params() is available only when CONFIG_SYSFS=y, otherwise
only a dummy variant is present. In the unlikely case that the kernel is
configured with CONFIG_MODULES=y and CONFIG_SYSFS=n, this results in
a memory leak of charp values when a module is unloaded.

Fix this issue by making destroy_params() always available when
CONFIG_MODULES=y. Rename the function to module_destroy_params() to clarify
that it is intended for use by the module loader.

Fixes: e180a6b775 ("param: fix charp parameters set via sysfs")
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-05-23 13:04:21 +02:00
..
2026-03-04 07:19:39 -05:00
2026-03-04 07:20:22 -05:00
2026-03-04 07:19:26 -05:00
2025-11-02 22:15:22 +09:00
2025-10-15 12:00:03 +02:00
2025-09-11 17:21:46 +02:00
2025-12-18 13:55:17 +01:00
2025-05-29 11:03:25 +02:00
2026-01-08 10:13:54 +01:00
2026-01-08 10:14:34 +01:00
2025-09-09 18:58:04 +02:00
2025-05-29 11:03:25 +02:00
2026-04-11 14:24:32 +02:00
2025-12-18 13:55:18 +01:00
2025-06-19 15:32:18 +02:00
2026-02-11 13:40:25 +01:00
2025-08-15 12:13:35 +02:00
2026-05-14 15:29:29 +02:00
2026-01-08 10:14:11 +01:00
2026-02-11 13:40:25 +01:00
2026-03-04 07:19:35 -05:00
2025-08-01 09:48:43 +01:00