Commit f91334b7 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Zhang Changzhong
Browse files

netfilter: ctnetlink: use helper function to calculate expect ID

stable inclusion
from stable-v5.10.224
commit eb4ca1a97e08ff5b920664ba292e576257e2d184
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IANOZB
CVE: CVE-2024-44944

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=eb4ca1a97e08ff5b920664ba292e576257e2d184



---------------------------

[ Upstream commit 782161895eb4ac45cf7cfa8db375bd4766cb8299 ]

Delete expectation path is missing a call to the nf_expect_get_id()
helper function to calculate the expectation ID, otherwise LSB of the
expectation object address is leaked to userspace.

Fixes: 3c791076 ("netfilter: ctnetlink: don't use conntrack/expect object addresses as id")
Reported-by: default avatar <zdi-disclosures@trendmicro.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent 683fc19e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3385,7 +3385,8 @@ static int ctnetlink_del_expect(struct net *net, struct sock *ctnl,

		if (cda[CTA_EXPECT_ID]) {
			__be32 id = nla_get_be32(cda[CTA_EXPECT_ID]);
			if (ntohl(id) != (u32)(unsigned long)exp) {

			if (id != nf_expect_get_id(exp)) {
				nf_ct_expect_put(exp);
				return -ENOENT;
			}