netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netfilter: flowtable: Fix flushing of offloaded flows on free
@ 2020-03-19  9:52 Paul Blakey
  2020-03-19 20:04 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Blakey @ 2020-03-19  9:52 UTC (permalink / raw)
  To: Paul Blakey, Oz Shlomo, Pablo Neira Ayuso, Majd Dibbiny,
	Roi Dayan, netdev
  Cc: netfilter-devel

Freeing a flowtable with offloaded flows, the flow are deleted from
hardware but are not deleted from the flow table, leaking them,
and leaving their offload bit on.

Add a second pass of the disabled gc to delete the these flows from
the flow table before freeing it.

Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
---
 net/netfilter/nf_flow_table_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 8af28e1..70ebeba 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -554,6 +554,9 @@ void nf_flow_table_free(struct nf_flowtable *flow_table)
 	nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL);
 	nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, flow_table);
 	nf_flow_table_offload_flush(flow_table);
+	if (nf_flowtable_hw_offload(flow_table))
+		nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step,
+				      flow_table);
 	rhashtable_destroy(&flow_table->rhashtable);
 }
 EXPORT_SYMBOL_GPL(nf_flow_table_free);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] netfilter: flowtable: Fix flushing of offloaded flows on free
  2020-03-19  9:52 [PATCH net] netfilter: flowtable: Fix flushing of offloaded flows on free Paul Blakey
@ 2020-03-19 20:04 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-19 20:04 UTC (permalink / raw)
  To: Paul Blakey; +Cc: Oz Shlomo, Majd Dibbiny, Roi Dayan, netdev, netfilter-devel

On Thu, Mar 19, 2020 at 11:52:25AM +0200, Paul Blakey wrote:
> Freeing a flowtable with offloaded flows, the flow are deleted from
> hardware but are not deleted from the flow table, leaking them,
> and leaving their offload bit on.
> 
> Add a second pass of the disabled gc to delete the these flows from
> the flow table before freeing it.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-19 20:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  9:52 [PATCH net] netfilter: flowtable: Fix flushing of offloaded flows on free Paul Blakey
2020-03-19 20:04 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).