Files
linux/fs/ntfs/sysctl.c
Namjae Jeon a8fde8be9a ntfs: fix sysctl table registration and path
The presence of a sentinel (an empty {}) at the end of the ctl_table array
now causes a "sysctl table check failed" error because the kernel attempts
to validate the null entry as a functional node.
Deleted the empty {} from the ntfs_sysctls array to prevent
the "procname is null" and "No proc_handler" errors and updated the base
path from "fs" to "fs/ntfs" to ensure the ntfs-debug node is correctly
located under /proc/sys/fs/ntfs/.

Reported-by: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-03-01 14:53:37 +09:00

55 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Code for sysctl handling in NTFS Linux kernel driver.
*
* Copyright (C) 1997 Martin von Löwis, Régis Duchesne
* Copyright (c) 2002-2005 Anton Altaparmakov
*/
#ifdef DEBUG
#include <linux/module.h>
#ifdef CONFIG_SYSCTL
#include <linux/proc_fs.h>
#include <linux/sysctl.h>
#include "sysctl.h"
#include "debug.h"
/* Definition of the ntfs sysctl. */
static const struct ctl_table ntfs_sysctls[] = {
{
.procname = "ntfs-debug",
.data = &debug_msgs, /* Data pointer and size. */
.maxlen = sizeof(debug_msgs),
.mode = 0644, /* Mode, proc handler. */
.proc_handler = proc_dointvec
},
};
/* Storage for the sysctls header. */
static struct ctl_table_header *sysctls_root_table;
/*
* ntfs_sysctl - add or remove the debug sysctl
* @add: add (1) or remove (0) the sysctl
*
* Add or remove the debug sysctl. Return 0 on success or -errno on error.
*/
int ntfs_sysctl(int add)
{
if (add) {
sysctls_root_table = register_sysctl("fs/ntfs", ntfs_sysctls);
if (!sysctls_root_table)
return -ENOMEM;
} else {
unregister_sysctl_table(sysctls_root_table);
sysctls_root_table = NULL;
}
return 0;
}
#endif /* CONFIG_SYSCTL */
#endif /* DEBUG */