--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
-@@ -1178,18 +1178,6 @@ static bool gc_worker_can_early_drop(con
+@@ -1206,18 +1206,6 @@ static bool gc_worker_can_early_drop(con
return false;
}
static void gc_worker(struct work_struct *work)
{
unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u);
-@@ -1226,10 +1214,8 @@ static void gc_worker(struct work_struct
+@@ -1254,10 +1242,8 @@ static void gc_worker(struct work_struct
tmp = nf_ct_tuplehash_to_ctrack(h);
scanned++;
nf_ct_gc_expired(tmp);
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
-@@ -183,10 +183,29 @@ static const struct rhashtable_params nf
+@@ -198,10 +198,29 @@ static const struct rhashtable_params nf
.automatic_shrinking = true,
};
flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
err = rhashtable_insert_fast(&flow_table->rhashtable,
-@@ -317,6 +336,8 @@ static int nf_flow_offload_gc_step(struc
+@@ -304,6 +323,7 @@ nf_flow_table_iterate(struct nf_flowtabl
rhashtable_walk_start(&hti);
while ((tuplehash = rhashtable_walk_next(&hti))) {
-+ bool teardown;
+
if (IS_ERR(tuplehash)) {
- err = PTR_ERR(tuplehash);
- if (err != -EAGAIN)
-@@ -329,9 +350,13 @@ static int nf_flow_offload_gc_step(struc
-
- flow = container_of(tuplehash, struct flow_offload, tuplehash[0]);
+ if (PTR_ERR(tuplehash) != -EAGAIN) {
+ err = PTR_ERR(tuplehash);
+@@ -328,10 +348,17 @@ static void nf_flow_offload_gc_step(stru
+ {
+ struct nf_flowtable *flow_table = data;
+ struct flow_offload_entry *e;
++ bool teardown;
-- if (nf_flow_has_expired(flow) ||
-- (flow->flags & (FLOW_OFFLOAD_DYING |
-- FLOW_OFFLOAD_TEARDOWN)))
-+ teardown = flow->flags & (FLOW_OFFLOAD_DYING |
-+ FLOW_OFFLOAD_TEARDOWN);
+ e = container_of(flow, struct flow_offload_entry, flow);
+- if (nf_flow_has_expired(flow) || nf_ct_is_dying(e->ct) ||
+- (flow->flags & (FLOW_OFFLOAD_DYING | FLOW_OFFLOAD_TEARDOWN)))
++
++ teardown = flow->flags & (FLOW_OFFLOAD_DYING |
++ FLOW_OFFLOAD_TEARDOWN);
+
-+ if (!teardown)
-+ nf_ct_offload_timeout(flow);
++ if (!teardown)
++ nf_ct_offload_timeout(flow);
+
-+ if (nf_flow_has_expired(flow) || teardown)
- flow_offload_del(flow_table, flow);
- }
- out:
++ if (nf_flow_has_expired(flow) || teardown)
+ flow_offload_del(flow_table, flow);
+ }
+