]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 30 Sep 2016 06:05:18 +0000 (23:05 -0700)
Orabug: 24690280
CVE: CVE-2016-3134

[ Upstream commit aa412ba225dd3bc36d404c28cdc3d674850d80d0 ]

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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 801cd32774d12dccfcfc0c22b0b26d84ed995c6f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c

index 8c2d13c96a82bb9d8a9bf4f4c522a9902f4ba7af..a86aa8dba47f8b86e14968261bb9f512b1ade10b 100644 (file)
@@ -489,14 +489,6 @@ static int mark_source_chains(const struct xt_table_info *newinfo,
        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);
@@ -586,7 +578,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;
 
@@ -1248,8 +1243,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 2a3f689f9ed7b96f98ce1baddfb472759c02bebd..077d682aff023333b70d81214c6f880c95c3d516 100644 (file)
@@ -582,15 +582,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)
 {
@@ -747,7 +738,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;
 
@@ -1514,8 +1508,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 a7de7c0e1b37894f83d9d1441668ed40aed77262..ca0c3478b5aa15162a89a33af9d0f25f81c6ae99 100644 (file)
@@ -595,15 +595,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;
@@ -761,7 +752,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;
 
@@ -1529,8 +1523,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;