mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
md: Fix failed allocation of md_register_thread
commit e406f12dde
upstream.
mddev->sync_thread can be set to NULL on kzalloc failure downstream.
The patch checks for such a scenario and frees allocated resources.
Committer node:
Added similar fix to raid5.c, as suggested by Guoqing.
Cc: stable@vger.kernel.org # v3.16+
Acked-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
73e0b59ffb
commit
d287b65e26
|
@ -3821,6 +3821,8 @@ static int raid10_run(struct mddev *mddev)
|
|||
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
|
||||
mddev->sync_thread = md_register_thread(md_do_sync, mddev,
|
||||
"reshape");
|
||||
if (!mddev->sync_thread)
|
||||
goto out_free_conf;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -7370,6 +7370,8 @@ static int raid5_run(struct mddev *mddev)
|
|||
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
|
||||
mddev->sync_thread = md_register_thread(md_do_sync, mddev,
|
||||
"reshape");
|
||||
if (!mddev->sync_thread)
|
||||
goto abort;
|
||||
}
|
||||
|
||||
/* Ok, everything is just fine now */
|
||||
|
|
Loading…
Reference in New Issue
Block a user