Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9cff126f authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: nf_tables: __nft_expr_type_get() selects specific family type



In case that there are two types, prefer the family specify extension.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent b9c04ae7
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -2009,14 +2009,17 @@ EXPORT_SYMBOL_GPL(nft_unregister_expr);
static const struct nft_expr_type *__nft_expr_type_get(u8 family,
						       struct nlattr *nla)
{
	const struct nft_expr_type *type;
	const struct nft_expr_type *type, *candidate = NULL;

	list_for_each_entry(type, &nf_tables_expressions, list) {
		if (!nla_strcmp(nla, type->name) &&
		    (!type->family || type->family == family))
			return type;
		if (!nla_strcmp(nla, type->name)) {
			if (!type->family && !candidate)
				candidate = type;
			else if (type->family == family)
				candidate = type;
		}
	return NULL;
	}
	return candidate;
}

#ifdef CONFIG_MODULES