diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-04 16:48:54 -0600 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-03-12 10:15:18 -0700 |
commit | e406f12dde1a8375d77ea02d91f313fb1a9c6aec (patch) | |
tree | b11f0208ee191c21233ebc8a6c318d35daae1f5e /drivers/md/raid5.c | |
parent | b761dcf1217760a42f7897c31dcb649f59b2333e (diff) | |
download | lwn-e406f12dde1a8375d77ea02d91f313fb1a9c6aec.tar.gz lwn-e406f12dde1a8375d77ea02d91f313fb1a9c6aec.zip |
md: Fix failed allocation of md_register_thread
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>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 09562d7cc080..992fd08437d8 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7403,6 +7403,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 */ |