Files
u-boot/drivers
Mattijs Korpershoek c76a7090f6 usb: gadget: f_mass_storage: Fix memory leak of fsg buffers
In fsg_common_init, we allocate some buffers via memalign().
However, these buffers are never freed.

Because of that, we cannot call => ums command multiple times on boards
with low memory (CONFIG_SYS_MALLOC_LEN=0x81000):

=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
|crq->brequest:0x0
CTRL+C - Operation aborted
=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
failed to start <NULL>: -12
g_dnl_register: failed!, error: -12
g_dnl_register failed

Make sure the fsg buffers are freed when the gadget is unbound by
calling fsg_common_release() in fsg_unbind().

Reported-by: Zixun LI <admin@hifiphile.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-4-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:00:24 +02:00
..
2025-04-08 16:23:27 -06:00
2024-10-11 11:44:48 -06:00
2025-04-08 11:43:23 -06:00
2024-11-20 17:57:58 +01:00
2024-10-11 11:44:48 -06:00
2025-03-04 12:07:23 -06:00
2025-04-08 11:43:23 -06:00
2025-03-27 00:26:35 +00:00
2025-03-19 03:36:19 +01:00
2023-11-07 14:50:51 -05:00
2024-04-26 08:28:35 +03:00
2025-02-11 20:10:58 -06:00
2025-02-18 08:26:43 -06:00