From 250c220e88eaee9fbfcd39aafbbd9b7e4cf0d504 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Fri, 25 May 2012 16:26:52 -0600 Subject: [PATCH] --- yaml --- r: 327236 b: refs/heads/master c: da7428080a15189c7acd266d514324f2a2e89e14 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/init/Kconfig | 1 - trunk/net/netfilter/xt_recent.c | 13 +++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index de33d3c0606b..0fa534309910 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8c6e2a941ae74d850a7bf0e5b3f4cd567e0f27dc +refs/heads/master: da7428080a15189c7acd266d514324f2a2e89e14 diff --git a/trunk/init/Kconfig b/trunk/init/Kconfig index c8911eb6d500..40f50204dddb 100644 --- a/trunk/init/Kconfig +++ b/trunk/init/Kconfig @@ -944,7 +944,6 @@ config UIDGID_CONVERTED # Networking depends on NET_9P = n depends on NETFILTER_XT_MATCH_OWNER = n - depends on NETFILTER_XT_MATCH_RECENT = n depends on AF_RXRPC = n depends on NET_KEY = n depends on DNS_RESOLVER = n diff --git a/trunk/net/netfilter/xt_recent.c b/trunk/net/netfilter/xt_recent.c index ae2ad1eec8d0..4635c9b00459 100644 --- a/trunk/net/netfilter/xt_recent.c +++ b/trunk/net/netfilter/xt_recent.c @@ -317,6 +317,8 @@ static int recent_mt_check(const struct xt_mtchk_param *par, struct recent_table *t; #ifdef CONFIG_PROC_FS struct proc_dir_entry *pde; + kuid_t uid; + kgid_t gid; #endif unsigned int i; int ret = -EINVAL; @@ -372,6 +374,13 @@ static int recent_mt_check(const struct xt_mtchk_param *par, for (i = 0; i < ip_list_hash_size; i++) INIT_LIST_HEAD(&t->iphash[i]); #ifdef CONFIG_PROC_FS + uid = make_kuid(&init_user_ns, ip_list_uid); + gid = make_kgid(&init_user_ns, ip_list_gid); + if (!uid_valid(uid) || !gid_valid(gid)) { + kfree(t); + ret = -EINVAL; + goto out; + } pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, &recent_mt_fops, t); if (pde == NULL) { @@ -379,8 +388,8 @@ static int recent_mt_check(const struct xt_mtchk_param *par, ret = -ENOMEM; goto out; } - pde->uid = ip_list_uid; - pde->gid = ip_list_gid; + pde->uid = uid; + pde->gid = gid; #endif spin_lock_bh(&recent_lock); list_add_tail(&t->list, &recent_net->tables);