Commit 30a24c66 authored by Florian Westphal's avatar Florian Westphal Committed by Ben Hutchings

netfilter: x_tables: kill check_entry helper

commit aa412ba2 upstream.

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: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b39be8f1
...@@ -474,14 +474,6 @@ static int mark_source_chains(const struct xt_table_info *newinfo, ...@@ -474,14 +474,6 @@ static int mark_source_chains(const struct xt_table_info *newinfo,
return 1; 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) static inline int check_target(struct arpt_entry *e, const char *name)
{ {
struct xt_entry_target *t = arpt_get_target(e); struct xt_entry_target *t = arpt_get_target(e);
...@@ -571,7 +563,10 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, ...@@ -571,7 +563,10 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
return -EINVAL; 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) if (err)
return err; return err;
...@@ -1230,8 +1225,10 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e, ...@@ -1230,8 +1225,10 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,
return -EINVAL; return -EINVAL;
} }
/* For purposes of check_entry casting the compat entry is fine */ if (!arp_checkentry(&e->arp))
ret = check_entry((struct arpt_entry *)e); return -EINVAL;
ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
if (ret) if (ret)
return ret; return ret;
......
...@@ -567,15 +567,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net) ...@@ -567,15 +567,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net)
module_put(par.match->me); 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 static int
check_match(struct xt_entry_match *m, struct xt_mtchk_param *par) check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
{ {
...@@ -732,7 +723,10 @@ check_entry_size_and_hooks(struct ipt_entry *e, ...@@ -732,7 +723,10 @@ check_entry_size_and_hooks(struct ipt_entry *e,
return -EINVAL; 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) if (err)
return err; return err;
...@@ -1496,8 +1490,10 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, ...@@ -1496,8 +1490,10 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
return -EINVAL; return -EINVAL;
} }
/* For purposes of check_entry casting the compat entry is fine */ if (!ip_checkentry(&e->ip))
ret = check_entry((struct ipt_entry *)e); return -EINVAL;
ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
if (ret) if (ret)
return ret; return ret;
......
...@@ -577,15 +577,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net) ...@@ -577,15 +577,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net)
module_put(par.match->me); 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) static int check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
{ {
const struct ip6t_ip6 *ipv6 = par->entryinfo; const struct ip6t_ip6 *ipv6 = par->entryinfo;
...@@ -743,7 +734,10 @@ check_entry_size_and_hooks(struct ip6t_entry *e, ...@@ -743,7 +734,10 @@ check_entry_size_and_hooks(struct ip6t_entry *e,
return -EINVAL; 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) if (err)
return err; return err;
...@@ -1508,8 +1502,10 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, ...@@ -1508,8 +1502,10 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
return -EINVAL; return -EINVAL;
} }
/* For purposes of check_entry casting the compat entry is fine */ if (!ip6_checkentry(&e->ipv6))
ret = check_entry((struct ip6t_entry *)e); return -EINVAL;
ret = xt_check_entry_offsets(e, e->target_offset, e->next_offset);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment