]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nft_quota: match correctly when the quota just depleted
authorZhongqiu Duan <dzq.aishenghu0@gmail.com>
Thu, 17 Apr 2025 15:49:30 +0000 (15:49 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:12 +0000 (11:05 +0100)
commite9022196bdbe556c721152f35e6d9b253c69596b
treee39d99e4fa927ce8c8c4b4ebc9d40d9d599d9732
parentba18b0b9272f5e2fc9ebe408e594c4a39527821a
netfilter: nft_quota: match correctly when the quota just depleted

[ Upstream commit bfe7cfb65c753952735c3eed703eba9a8b96a18d ]

The xt_quota compares skb length with remaining quota, but the nft_quota
compares it with consumed bytes.

The xt_quota can match consumed bytes up to quota at maximum. But the
nft_quota break match when consumed bytes equal to quota.

i.e., nft_quota match consumed bytes in [0, quota - 1], not [0, quota].

Fixes: 795595f68d6c ("netfilter: nft_quota: dump consumed quota")
Signed-off-by: Zhongqiu Duan <dzq.aishenghu0@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nft_quota.c