summaryrefslogtreecommitdiff
path: root/kernel/ucount.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2020-04-07 18:46:43 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-04-07 22:51:27 +0300
commit0f538e3e712a517bd351607de50cd298102c7c08 (patch)
treede1caf1fe11058ab0f429502bd3c54bcc7727031 /kernel/ucount.c
parenteeec26d5da8248ea4e240b8795bb4364213d3247 (diff)
downloadlinux-0f538e3e712a517bd351607de50cd298102c7c08.tar.xz
ucount: Make sure ucounts in /proc/sys/user don't regress again
Commit 769071ac9f20 "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 eeec26d5da82 "time/namespace: Add max_time_namespaces ucount". Add BUILD_BUG_ON to catch a similar problem in the future. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Andrei Vagin <avagin@gmail.com> Link: https://lkml.kernel.org/r/20200407154643.10102-1-jack@suse.cz
Diffstat (limited to 'kernel/ucount.c')
-rw-r--r--kernel/ucount.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/ucount.c b/kernel/ucount.c
index 29c60eb4ec9b..11b1596e2542 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -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) {