From: Pablo Neira Ayuso Date: Sat, 13 Jul 2024 14:47:38 +0000 (+0200) Subject: netfilter: ctnetlink: use helper function to calculate expect ID X-Git-Tag: v6.11-rc1~104^2~1^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=782161895eb4ac45cf7cfa8db375bd4766cb8299;p=thirdparty%2Fkernel%2Flinux.git netfilter: ctnetlink: use helper function to calculate expect ID 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: 3c79107631db ("netfilter: ctnetlink: don't use conntrack/expect object addresses as id") Reported-by: zdi-disclosures@trendmicro.com Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 3b846cbdc050d..4cbf71d0786b0 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -3420,7 +3420,8 @@ static int ctnetlink_del_expect(struct sk_buff *skb, 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; }