Skip to content

Commit

Permalink
ucount: Make sure ucounts in /proc/sys/user don't regress again
Browse files Browse the repository at this point in the history
Commit 769071a "ns: Introduce Time Namespace" broke reporting of
inotify ucounts (max_inotify_instances, max_inotify_watches) in
/proc/sys/user because it has added UCOUNT_TIME_NAMESPACES into enum
ucount_type but didn't properly update reporting in
kernel/ucount.c:setup_userns_sysctls(). This problem got fixed in commit
eeec26d "time/namespace: Add max_time_namespaces ucount".

Add BUILD_BUG_ON to catch a similar problem in the future.

Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Andrei Vagin <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
jankara authored and KAGA-KOKO committed Apr 7, 2020
1 parent eeec26d commit 0f538e3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/ucount.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
{
#ifdef CONFIG_SYSCTL
struct ctl_table *tbl;

BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
setup_sysctl_set(&ns->set, &set_root, set_is_seen);
tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
if (tbl) {
Expand Down

0 comments on commit 0f538e3

Please sign in to comment.