]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/sched: act_ct: additional checks for outdated flows
authorVlad Buslov <vladbu@nvidia.com>
Tue, 24 Oct 2023 19:58:57 +0000 (21:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jan 2024 16:10:36 +0000 (17:10 +0100)
commit2be4e8ac2d167a89858fa2faec8fd13f02626fc0
tree3eb993acac7302f9f44c707196b2f705e03126d5
parent87318b7e374cbed6d4353748791faea605535d58
net/sched: act_ct: additional checks for outdated flows

commit a63b6622120cd03a304796dbccb80655b3a21798 upstream.

Current nf_flow_is_outdated() implementation considers any flow table flow
which state diverged from its underlying CT connection status for teardown
which can be problematic in the following cases:

- Flow has never been offloaded to hardware in the first place either
because flow table has hardware offload disabled (flag
NF_FLOWTABLE_HW_OFFLOAD is not set) or because it is still pending on 'add'
workqueue to be offloaded for the first time. The former is incorrect, the
later generates excessive deletions and additions of flows.

- Flow is already pending to be updated on the workqueue. Tearing down such
flows will also generate excessive removals from the flow table, especially
on highly loaded system where the latency to re-offload a flow via 'add'
workqueue can be quite high.

When considering a flow for teardown as outdated verify that it is both
offloaded to hardware and doesn't have any pending updates.

Fixes: 41f2c7c342d3 ("net/sched: act_ct: Fix promotion of offloaded unreplied tuple")
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_ct.c