diff mbox series

[11/15,net-next,v2] net: flow_offload: don't allow subsystem to reuse blocks

Message ID 20190704234843.6601-12-pablo@netfilter.org
State Changes Requested
Delegated to: David Miller
Headers show
Series netfilter: add hardware offload infrastructure | expand

Commit Message

Pablo Neira Ayuso July 4, 2019, 11:48 p.m. UTC
Drivers need to be updated to support this, return EBUSY by now.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v2: no changes.

 net/core/flow_offload.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index 0b8d088d822e..8c20f4740800 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -206,6 +206,12 @@  struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb,
 {
 	struct flow_block_cb *block_cb;
 
+	list_for_each_entry(block_cb, &flow_block_cb_list, global_list) {
+		if (block_cb->cb == cb &&
+		    block_cb->cb_ident == cb_ident)
+			return ERR_PTR(-EBUSY);
+	}
+
 	block_cb = kzalloc(sizeof(*block_cb), GFP_KERNEL);
 	if (IS_ERR(block_cb))
 		return block_cb;