Unverified Commit 19bb53ac authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7095 CVE-2024-27020

Merge Pull Request from: @ci-robot 
 
PR sync from: Ziyang Xuan <william.xuanziyang@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/SK5UXKT3ZDSHQ5IJE7V4MM2JLNZN5UYE/ 
Patchset of CVE-2024-27020.

Pablo Neira Ayuso (1):
  netfilter: nf_tables: __nft_expr_type_get() selects specific family
    type

Ziyang Xuan (1):
  netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()


-- 
2.25.1
 
https://gitee.com/src-openeuler/kernel/issues/I9L5P0 
 
Link:https://gitee.com/openeuler/kernel/pulls/7095

 

Reviewed-by: default avatarLiu YongQiang <liuyongqiang13@huawei.com>
Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents cf06096f f3e29671
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -2034,14 +2034,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;
	list_for_each_entry_rcu(type, &nf_tables_expressions, list) {
		if (!nla_strcmp(nla, type->name)) {
			if (!type->family && !candidate)
				candidate = type;
			else if (type->family == family)
				candidate = type;
		}
	return NULL;
	}
	return candidate;
}

static const struct nft_expr_type *nft_expr_type_get(struct net *net,
@@ -2053,9 +2056,13 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net,
	if (nla == NULL)
		return ERR_PTR(-EINVAL);

	rcu_read_lock();
	type = __nft_expr_type_get(family, nla);
	if (type != NULL && try_module_get(type->owner))
	if (type != NULL && try_module_get(type->owner)) {
		rcu_read_unlock();
		return type;
	}
	rcu_read_unlock();

	lockdep_nfnl_nft_mutex_not_held();
#ifdef CONFIG_MODULES