fs/proc: Fix memory leak in sysctl-restrict

In sysctl_restrict_open(), single_open() is used, so we should use the
corresponding single_release(), instead of seq_release(), otherwise it
will cause a memory leak.

Fixes: 6ac873e2f630 ("sysctl: restrict the writing for key parameters")
Signed-off-by: Juntong Deng <juntongdeng@tencent.com>
Signed-off-by: yilingjin <yilingjin@tencent.com>
Reviewed-by: Hui Li <caelli@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
This commit is contained in:
Juntong Deng 2024-06-12 13:08:38 +08:00 committed by Jianping Liu
parent f0d260bacf
commit 87ceafb2b4
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ static const struct file_operations sysctl_restrict_file_ops = {
.read = seq_read,
.write = sysctl_restrict_write,
.llseek = seq_lseek,
.release = seq_release
.release = single_release
};
static int __init sysctl_restrict_init(void)