netfilter: ctnetlink: use helper function to calculate expect ID
[ 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: 3c79107631db ("netfilter: ctnetlink: don't use conntrack/expect object addresses as id") Reported-by: zdi-disclosures@trendmicro.com Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a4914e32a2
commit
42ea0c1913
1 changed files with 2 additions and 1 deletions
|
@ -3413,7 +3413,8 @@ static int ctnetlink_del_expect(struct net *net, struct sock *ctnl,
|
||||||
|
|
||||||
if (cda[CTA_EXPECT_ID]) {
|
if (cda[CTA_EXPECT_ID]) {
|
||||||
__be32 id = nla_get_be32(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);
|
nf_ct_expect_put(exp);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue