Patch "md/raid10: fix memleak of md thread" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    md/raid10: fix memleak of md thread

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     md-raid10-fix-memleak-of-md-thread.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 27b907e7eba53ab9bfa71d5875806d9b10093b9f
Author: Yu Kuai <yukuai3@xxxxxxxxxx>
Date:   Fri Mar 10 15:38:55 2023 +0800

    md/raid10: fix memleak of md thread
    
    [ Upstream commit f0ddb83da3cbbf8a1f9087a642c448ff52ee9abd ]
    
    In raid10_run(), if setup_conf() succeed and raid10_run() failed before
    setting 'mddev->thread', then in the error path 'conf->thread' is not
    freed.
    
    Fix the problem by setting 'mddev->thread' right after setup_conf().
    
    Fixes: 43a521238aca ("md-cluster: choose correct label when clustered layout is not supported")
    Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230310073855.1337560-7-yukuai1@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 51f122db9668e..c6a196a10f894 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3752,6 +3752,9 @@ static int raid10_run(struct mddev *mddev)
 	if (!conf)
 		goto out;
 
+	mddev->thread = conf->thread;
+	conf->thread = NULL;
+
 	if (mddev_is_clustered(conf->mddev)) {
 		int fc, fo;
 
@@ -3764,9 +3767,6 @@ static int raid10_run(struct mddev *mddev)
 		}
 	}
 
-	mddev->thread = conf->thread;
-	conf->thread = NULL;
-
 	if (mddev->queue) {
 		blk_queue_max_discard_sectors(mddev->queue,
 					      mddev->chunk_sectors);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux