Skip to content

Commit 0f538e3

Browse files
jankaraKAGA-KOKO
authored andcommitted
ucount: Make sure ucounts in /proc/sys/user don't regress again
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]
1 parent eeec26d commit 0f538e3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/ucount.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
8282
{
8383
#ifdef CONFIG_SYSCTL
8484
struct ctl_table *tbl;
85+
86+
BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
8587
setup_sysctl_set(&ns->set, &set_root, set_is_seen);
8688
tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
8789
if (tbl) {

0 commit comments

Comments
 (0)