netfilter: nfnetlink_hook: fix array index out-of-bounds error
Currently the array net->nf.hooks_ipv6 is accessed by index hook
before hook is sanity checked. Fix this by moving the sanity check
to before the array access.
Addresses-Coverity: ("Out-of-bounds access")
Fixes: e2cf17d377
("netfilter: add new hook nfnl subsystem")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
cf6b5ffdce
commit
5302560bb4
1 changed files with 1 additions and 1 deletions
|
@ -181,9 +181,9 @@ nfnl_hook_entries_head(u8 pf, unsigned int hook, struct net *net, const char *de
|
||||||
hook_head = rcu_dereference(net->nf.hooks_ipv4[hook]);
|
hook_head = rcu_dereference(net->nf.hooks_ipv4[hook]);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]);
|
|
||||||
if (hook >= ARRAY_SIZE(net->nf.hooks_ipv6))
|
if (hook >= ARRAY_SIZE(net->nf.hooks_ipv6))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_ARP:
|
case NFPROTO_ARP:
|
||||||
#ifdef CONFIG_NETFILTER_FAMILY_ARP
|
#ifdef CONFIG_NETFILTER_FAMILY_ARP
|
||||||
|
|
Loading…
Add table
Reference in a new issue