Skip to content

Commit

Permalink
sysctl: fix duplicate path separator in printed entries
Browse files Browse the repository at this point in the history
sysctl_print_dir() always terminates the printed path name with a slash,
so printing a slash before the file part causes a duplicate like in

    sysctl duplicate entry: /kernel//perf_user_access

Fix this by dropping the extra slash.

Link: https://lkml.kernel.org/r/e3054d605dc56f83971e4b6d2f5fa63a978720ad.1641551872.git.geert+renesas@glider.be
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Iurii Zaikin <yzaikin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
geertu authored and torvalds committed Jan 20, 2022
1 parent 51a1873 commit 153ee1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry)
else {
pr_err("sysctl duplicate entry: ");
sysctl_print_dir(head->parent);
pr_cont("/%s\n", entry->procname);
pr_cont("%s\n", entry->procname);
return -EEXIST;
}
}
Expand Down Expand Up @@ -1020,8 +1020,8 @@ static struct ctl_dir *get_subdir(struct ctl_dir *dir,
if (IS_ERR(subdir)) {
pr_err("sysctl could not get directory: ");
sysctl_print_dir(dir);
pr_cont("/%*.*s %ld\n",
namelen, namelen, name, PTR_ERR(subdir));
pr_cont("%*.*s %ld\n", namelen, namelen, name,
PTR_ERR(subdir));
}
drop_sysctl_table(&dir->header);
if (new)
Expand Down Expand Up @@ -1626,7 +1626,7 @@ static void put_links(struct ctl_table_header *header)
else {
pr_err("sysctl link missing during unregister: ");
sysctl_print_dir(parent);
pr_cont("/%s\n", name);
pr_cont("%s\n", name);
}
}
}
Expand Down

0 comments on commit 153ee1c

Please sign in to comment.