aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-10-14 06:43:50 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-10-14 06:52:40 -0400
commit493618a92c6afdd3f6224ab586f169d6a259bb06 (patch)
tree53888e90a90e3a663d23581dc072f60364bf922d
parent7210e4e38f945dfa173c4a4e59ad827c9ecad541 (diff)
netfilter: nft_compat: fix hook validation for non-base chains
Set hook_mask to zero for non-base chains, otherwise people may hit bogus errors from the xt_check_target() and xt_check_match() when validating the uninitialized hook_mask. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nft_compat.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 7e2683c8a44a..44ae273b4391 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -95,6 +95,8 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par,
95 const struct nf_hook_ops *ops = &basechain->ops[0]; 95 const struct nf_hook_ops *ops = &basechain->ops[0];
96 96
97 par->hook_mask = 1 << ops->hooknum; 97 par->hook_mask = 1 << ops->hooknum;
98 } else {
99 par->hook_mask = 0;
98 } 100 }
99 par->family = ctx->afi->family; 101 par->family = ctx->afi->family;
100} 102}
@@ -293,6 +295,8 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx,
293 const struct nf_hook_ops *ops = &basechain->ops[0]; 295 const struct nf_hook_ops *ops = &basechain->ops[0];
294 296
295 par->hook_mask = 1 << ops->hooknum; 297 par->hook_mask = 1 << ops->hooknum;
298 } else {
299 par->hook_mask = 0;
296 } 300 }
297 par->family = ctx->afi->family; 301 par->family = ctx->afi->family;
298} 302}