diff options
-rw-r--r-- | init/Kconfig | 1 | ||||
-rw-r--r-- | net/netfilter/xt_recent.c | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/init/Kconfig b/init/Kconfig index c8911eb6d500..40f50204dddb 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -944,7 +944,6 @@ config UIDGID_CONVERTED | |||
944 | # Networking | 944 | # Networking |
945 | depends on NET_9P = n | 945 | depends on NET_9P = n |
946 | depends on NETFILTER_XT_MATCH_OWNER = n | 946 | depends on NETFILTER_XT_MATCH_OWNER = n |
947 | depends on NETFILTER_XT_MATCH_RECENT = n | ||
948 | depends on AF_RXRPC = n | 947 | depends on AF_RXRPC = n |
949 | depends on NET_KEY = n | 948 | depends on NET_KEY = n |
950 | depends on DNS_RESOLVER = n | 949 | depends on DNS_RESOLVER = n |
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index ae2ad1eec8d0..4635c9b00459 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -317,6 +317,8 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
317 | struct recent_table *t; | 317 | struct recent_table *t; |
318 | #ifdef CONFIG_PROC_FS | 318 | #ifdef CONFIG_PROC_FS |
319 | struct proc_dir_entry *pde; | 319 | struct proc_dir_entry *pde; |
320 | kuid_t uid; | ||
321 | kgid_t gid; | ||
320 | #endif | 322 | #endif |
321 | unsigned int i; | 323 | unsigned int i; |
322 | int ret = -EINVAL; | 324 | int ret = -EINVAL; |
@@ -372,6 +374,13 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
372 | for (i = 0; i < ip_list_hash_size; i++) | 374 | for (i = 0; i < ip_list_hash_size; i++) |
373 | INIT_LIST_HEAD(&t->iphash[i]); | 375 | INIT_LIST_HEAD(&t->iphash[i]); |
374 | #ifdef CONFIG_PROC_FS | 376 | #ifdef CONFIG_PROC_FS |
377 | uid = make_kuid(&init_user_ns, ip_list_uid); | ||
378 | gid = make_kgid(&init_user_ns, ip_list_gid); | ||
379 | if (!uid_valid(uid) || !gid_valid(gid)) { | ||
380 | kfree(t); | ||
381 | ret = -EINVAL; | ||
382 | goto out; | ||
383 | } | ||
375 | pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, | 384 | pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, |
376 | &recent_mt_fops, t); | 385 | &recent_mt_fops, t); |
377 | if (pde == NULL) { | 386 | if (pde == NULL) { |
@@ -379,8 +388,8 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
379 | ret = -ENOMEM; | 388 | ret = -ENOMEM; |
380 | goto out; | 389 | goto out; |
381 | } | 390 | } |
382 | pde->uid = ip_list_uid; | 391 | pde->uid = uid; |
383 | pde->gid = ip_list_gid; | 392 | pde->gid = gid; |
384 | #endif | 393 | #endif |
385 | spin_lock_bh(&recent_lock); | 394 | spin_lock_bh(&recent_lock); |
386 | list_add_tail(&t->list, &recent_net->tables); | 395 | list_add_tail(&t->list, &recent_net->tables); |