[Devel] [PATCH RHEL7 COMMIT] ms/netfilter: nft_compat: check extension hook mask only if set

Vasily Averin vvs at virtuozzo.com
Thu Feb 25 13:40:29 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.11.1.vz7.172.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.11.1.vz7.172.17
------>
commit bd895c2a81375fc790aac8b0e3e2871d887a905b
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Thu Feb 25 13:40:29 2021 +0300

    ms/netfilter: nft_compat: check extension hook mask only if set
    
    If the x_tables extension comes with no hook mask, skip this validation.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
    (cherry picked from commit f7fb77fc12352d15180dc3c08ffba10573d5167d)
    
    This patch fixes start of weavenet CNI pod of k8s
    https://jira.sw.ru/browse/PSBM-125884
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 net/netfilter/nft_compat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 4a87537..de51ae3 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -309,7 +309,7 @@ static int nft_target_validate(const struct nft_ctx *ctx,
 		const struct nf_hook_ops *ops = &basechain->ops[0];
 
 		hook_mask = 1 << ops->hooknum;
-		if (!(hook_mask & target->hooks))
+		if (target->hooks && !(hook_mask & target->hooks))
 			return -EINVAL;
 
 		ret = nft_compat_chain_validate_dependency(target->table,
@@ -493,7 +493,7 @@ static int nft_match_validate(const struct nft_ctx *ctx,
 		const struct nf_hook_ops *ops = &basechain->ops[0];
 
 		hook_mask = 1 << ops->hooknum;
-		if (!(hook_mask & match->hooks))
+		if (match->hooks && !(hook_mask & match->hooks))
 			return -EINVAL;
 
 		ret = nft_compat_chain_validate_dependency(match->table,


More information about the Devel mailing list