Files
linux/drivers/md
Zilin Guan 6abc7d5dcf md/raid1: fix memory leak in raid1_run()
raid1_run() calls setup_conf() which registers a thread via
md_register_thread(). If raid1_set_limits() fails, the previously
registered thread is not unregistered, resulting in a memory leak
of the md_thread structure and the thread resource itself.

Add md_unregister_thread() to the error path to properly cleanup
the thread, which aligns with the error handling logic of other paths
in this function.

Compile tested only. Issue found using a prototype static analysis tool
and code review.

Link: https://lore.kernel.org/linux-raid/20260126071533.606263-1-zilin@seu.edu.cn
Fixes: 97894f7d3c ("md/raid1: use the atomic queue limit update APIs")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Li Nan <linan122@huawei.com>
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
2026-02-02 15:35:03 +08:00
..
2024-04-01 11:53:37 -06:00
2025-08-19 11:12:50 +02:00
2023-02-14 14:23:07 -05:00
2024-02-20 14:22:51 -05:00
2025-12-10 19:28:22 +01:00
2023-02-14 14:23:06 -05:00
2024-11-20 11:38:04 +01:00
2025-11-05 08:07:21 -07:00
2025-01-13 07:36:29 -08:00
2026-01-26 13:17:38 +08:00
2026-01-26 13:17:38 +08:00
2026-01-26 13:17:38 +08:00
2026-01-26 13:17:38 +08:00
2026-01-26 13:17:38 +08:00