Skip to content

Commit 8710d34

Browse files
committed
netfilter: nf_tables: __nft_expr_type_get() selects specific family type
jira VULN-4969 subsystem-sync netfilter:nf_tables 4.18.0-553.16.1 commit-author Pablo Neira Ayuso <[email protected]> commit 9cff126 In case that there are two types, prefer the family specify extension. Signed-off-by: Pablo Neira Ayuso <[email protected]> (cherry picked from commit 9cff126) Signed-off-by: Greg Rose <[email protected]>
1 parent c2e9b8c commit 8710d34

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,14 +2460,17 @@ EXPORT_SYMBOL_GPL(nft_unregister_expr);
24602460
static const struct nft_expr_type *__nft_expr_type_get(u8 family,
24612461
struct nlattr *nla)
24622462
{
2463-
const struct nft_expr_type *type;
2463+
const struct nft_expr_type *type, *candidate = NULL;
24642464

24652465
list_for_each_entry(type, &nf_tables_expressions, list) {
2466-
if (!nla_strcmp(nla, type->name) &&
2467-
(!type->family || type->family == family))
2468-
return type;
2466+
if (!nla_strcmp(nla, type->name)) {
2467+
if (!type->family && !candidate)
2468+
candidate = type;
2469+
else if (type->family == family)
2470+
candidate = type;
2471+
}
24692472
}
2470-
return NULL;
2473+
return candidate;
24712474
}
24722475

24732476
#ifdef CONFIG_MODULES

0 commit comments

Comments
 (0)