summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Granados <j.granados@samsung.com>2024-06-04 08:29:26 +0200
committerJoel Granados <j.granados@samsung.com>2024-06-13 10:50:52 +0200
commitacc154691fc75e1a178fc36624bdeee1420585a4 (patch)
tree3c8e81f5f75a432dad2b2fcde281a1e636ab3e70
parent3717540377c500e28f4304b17a46dd5b025a61ac (diff)
sysctl: Warn on an empty procname element
Add a pr_err warning in case a ctl_table is registered with a sentinel element containing a NULL procname. Signed-off-by: Joel Granados <j.granados@samsung.com>
-rw-r--r--fs/proc/proc_sysctl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 87396f9d599d..9553e77c9d31 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1131,6 +1131,8 @@ static int sysctl_check_table(const char *path, struct ctl_table_header *header)
struct ctl_table *entry;
int err = 0;
list_for_each_table_entry(entry, header) {
+ if (!entry->procname)
+ err |= sysctl_err(path, entry, "procname is null");
if ((entry->proc_handler == proc_dostring) ||
(entry->proc_handler == proc_dobool) ||
(entry->proc_handler == proc_dointvec) ||