]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
netfilter: x_tables: kill check_entry helper
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:24 +0000 (14:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Apr 2016 22:30:36 +0000 (00:30 +0200)
Once we add more sanity testing to xt_check_entry_offsets it
becomes relvant if we're expecting a 32bit 'config_compat' blob
or a normal one.

Since we already have a lot of similar-named functions (check_entry,
compat_check_entry, find_and_check_entry, etc.) and the current
incarnation is short just fold its contents into the callers.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c

index 74668c1d3243d0fa2df9f5d60472df41ce9a08c1..24ad92a60b7ad86f57b77db36d437e0037278200 100644 (file)
@@ -494,14 +494,6 @@ next:
        return 1;
 }
 
-static inline int check_entry(const struct arpt_entry *e)
-{
-       if (!arp_checkentry(&e->arp))
-               return -EINVAL;
-
-       return xt_check_entry_offsets(e, e->target_offset, e->next_offset);
-}
-
 static inline int check_target(struct arpt_entry *e, const char *name)
 {
        struct xt_entry_target *t = arpt_get_target(e);
@@ -597,7 +589,10 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
                return -EINVAL;
        }
 
-       err = check_entry(e);
+       if (!arp_checkentry(&e->arp))
+               return -EINVAL;
+
+       err = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (err)
                return err;
 
@@ -1256,8 +1251,10 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,
                return -EINVAL;
        }
 
-       /* For purposes of check_entry casting the compat entry is fine */
-       ret = check_entry((struct arpt_entry *)e);
+       if (!arp_checkentry(&e->arp))
+               return -EINVAL;
+
+       ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (ret)
                return ret;
 
index 71c204d4ca5f80e8fc7f12686ecc27809315c941..cdf18502a0475c837e916c6e80177b289057e4a6 100644 (file)
@@ -587,15 +587,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net)
        module_put(par.match->me);
 }
 
-static int
-check_entry(const struct ipt_entry *e)
-{
-       if (!ip_checkentry(&e->ip))
-               return -EINVAL;
-
-       return xt_check_entry_offsets(e, e->target_offset, e->next_offset);
-}
-
 static int
 check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
 {
@@ -760,7 +751,10 @@ check_entry_size_and_hooks(struct ipt_entry *e,
                return -EINVAL;
        }
 
-       err = check_entry(e);
+       if (!ip_checkentry(&e->ip))
+               return -EINVAL;
+
+       err = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (err)
                return err;
 
@@ -1516,8 +1510,10 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
                return -EINVAL;
        }
 
-       /* For purposes of check_entry casting the compat entry is fine */
-       ret = check_entry((struct ipt_entry *)e);
+       if (!ip_checkentry(&e->ip))
+               return -EINVAL;
+
+       ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (ret)
                return ret;
 
index 24ae7f458b3be4d939f1f642d8f311e3d85d5520..e3783116ed48ef8b77e5e0d650dd1483df5ff676 100644 (file)
@@ -599,15 +599,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net)
        module_put(par.match->me);
 }
 
-static int
-check_entry(const struct ip6t_entry *e)
-{
-       if (!ip6_checkentry(&e->ipv6))
-               return -EINVAL;
-
-       return xt_check_entry_offsets(e, e->target_offset, e->next_offset);
-}
-
 static int check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
 {
        const struct ip6t_ip6 *ipv6 = par->entryinfo;
@@ -772,7 +763,10 @@ check_entry_size_and_hooks(struct ip6t_entry *e,
                return -EINVAL;
        }
 
-       err = check_entry(e);
+       if (!ip6_checkentry(&e->ipv6))
+               return -EINVAL;
+
+       err = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (err)
                return err;
 
@@ -1528,8 +1522,10 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
                return -EINVAL;
        }
 
-       /* For purposes of check_entry casting the compat entry is fine */
-       ret = check_entry((struct ip6t_entry *)e);
+       if (!ip6_checkentry(&e->ipv6))
+               return -EINVAL;
+
+       ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
        if (ret)
                return ret;