Thread (4 messages) 4 messages, 3 authors, 2019-03-12

Re: [PATCH] md: Fix failed allocation of md_register_thread

From: Guoqing Jiang <hidden>
Date: 2019-03-08 03:13:00
Also in: lkml


On 3/5/19 6:48 AM, Aditya Pakki wrote:
quoted hunk ↗ jump to hunk
mddev->sync_thread can be set to NULL on kzalloc failure downstream.
The patch checks for such a scenario and frees allocated resources.

Signed-off-by: Aditya Pakki <redacted>
---
  drivers/md/raid10.c | 2 ++
  1 file changed, 2 insertions(+)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index abb5d382f64d..f52b4d9bcd24 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3939,6 +3939,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;
Could you make the change for raid5 as well? It also doesn't check the 
failure
in raid5_run.

Thanks,
Guoqing
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help