[PATCH openEuler-1.0-LTS] md/raid10: fix memleak of md thread
From: Yu Kuai <yukuai3@huawei.com> stable inclusion from stable-v4.19.283 commit abf4d67060c8f63caff096e5fca1564bfef1e5d4 category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/13133 CVE: CVE-2023-54294 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=... ------------------ [ 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@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230310073855.1337560-7-yukuai1@huaweicloud.com Signed-off-by: Sasha Levin <sashal@kernel.org> Conflicts: drivers/md/raid10.c [Context conflicts.] Signed-off-by: Zheng Qixing <zhengqixing@huawei.com> --- drivers/md/raid10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8b7de02f5796..b46713e7e3c9 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3824,6 +3824,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; @@ -3836,9 +3839,6 @@ static int raid10_run(struct mddev *mddev) } } - mddev->thread = conf->thread; - conf->thread = NULL; - chunk_size = mddev->chunk_sectors << 9; if (mddev->queue) { blk_queue_max_discard_sectors(mddev->queue, -- 2.39.2
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/20434 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UCQ... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/20434 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UCQ...
participants (2)
-
patchwork bot -
Zheng Qixing