Re: [PATCH OLK-5.10 4/4] eulerfs: fix potential sbi->persisters free error

在 2022/6/2 17:15, Yu Kuai 写道:
在 2022/06/02 10:51, Gou Hao 写道:
uniontech inclusion category: bugfix bugzilla: NA CVE: NA
-------------------
After alloc the sbi->persisters memory, dep_init will call dep_fini when error happened.Because sbi->persisters is not set to 0, kthread_stop may happened error.
Looks good to me, just one language fixup:
sbi->persisters is not set to 0 -> dep_fini() can be called with sbi->persisters[] uninitialized, thus kthread_stop() can be called with random value.
ok, thank you : )
Thanks, Kuai
Signed-off-by: Gou Hao <gouhao@uniontech.com> --- fs/eulerfs/dep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/eulerfs/dep.c b/fs/eulerfs/dep.c index da826a18fa31..62fd1376f980 100644 --- a/fs/eulerfs/dep.c +++ b/fs/eulerfs/dep.c @@ -728,8 +728,8 @@ int dep_init(struct super_block *sb) node_num++; sbi->persister_num = node_num * persisters_per_socket; - - sbi->persisters = kmalloc(sizeof(struct task_struct *) * + + sbi->persisters = kzalloc(sizeof(struct task_struct *) * sbi->persister_num, GFP_KERNEL); if (!sbi->persisters) { err = -ENOMEM;
-- thanks, Gou Hao
-
Gou Hao