diff mbox series

[SRU,F:linux-bluefield,v2] netfilter: flowtable: Free block_cb when being deleted

Message ID 1622667400-218452-1-git-send-email-danielj@nvidia.com
State New
Headers show
Series [SRU,F:linux-bluefield,v2] netfilter: flowtable: Free block_cb when being deleted | expand

Commit Message

Daniel Jurgens June 2, 2021, 8:56 p.m. UTC
From: Roi Dayan <roid@mellanox.com>

BugLink: https://bugs.launchpad.net/bugs/1927252

Free block_cb memory when asked to be deleted.

Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(backported from commit bc8e71314e8444c6315c482441f3204c032ab327)
[danielj: backported because of the flow_block_lock change from mutex]
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

---
v2: Added reason for backport to commit message

 net/netfilter/nf_flow_table_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tim Gardner June 2, 2021, 9:28 p.m. UTC | #1
Acked-by: Tim Gardner <tim.gardner@canonical.com>

On 6/2/21 2:56 PM, Daniel Jurgens wrote:
> From: Roi Dayan <roid@mellanox.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1927252
> 
> Free block_cb memory when asked to be deleted.
> 
> Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
> Signed-off-by: Roi Dayan <roid@mellanox.com>
> Reviewed-by: Paul Blakey <paulb@mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> (backported from commit bc8e71314e8444c6315c482441f3204c032ab327)
> [danielj: backported because of the flow_block_lock change from mutex]
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> ---
> v2: Added reason for backport to commit message
> 
>   net/netfilter/nf_flow_table_core.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 5144e31..0336117 100644
> --- a/net/netfilter/nf_flow_table_core.c
> +++ b/net/netfilter/nf_flow_table_core.c
> @@ -427,10 +427,12 @@ void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
>   
>   	mutex_lock(&flow_table->flow_block_lock);
>   	block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> -	if (block_cb)
> +	if (block_cb) {
>   		list_del(&block_cb->list);
> -	else
> +		flow_block_cb_free(block_cb);
> +	} else {
>   		WARN_ON(true);
> +	}
>   	mutex_unlock(&flow_table->flow_block_lock);
>   }
>   EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb);
>
Krzysztof Kozlowski June 3, 2021, 9:07 a.m. UTC | #2
On 02/06/2021 22:56, Daniel Jurgens wrote:
> From: Roi Dayan <roid@mellanox.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1927252
> 
> Free block_cb memory when asked to be deleted.
> 
> Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
> Signed-off-by: Roi Dayan <roid@mellanox.com>
> Reviewed-by: Paul Blakey <paulb@mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> (backported from commit bc8e71314e8444c6315c482441f3204c032ab327)
> [danielj: backported because of the flow_block_lock change from mutex]
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> ---
> v2: Added reason for backport to commit message
> 
>  net/netfilter/nf_flow_table_core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof
Tim Gardner June 3, 2021, 1:31 p.m. UTC | #3
Applied to focal:linux-bluefield. Thanks.

This was actually a clean cherry-pick after the application of 
'netfilter: flowtable: Use rw sem as flow block lock', so the patch 
context is slightly different. I also cherry-picked using my SOB since 
it had changed slightly.

-rtg

On 6/2/21 2:56 PM, Daniel Jurgens wrote:
> From: Roi Dayan <roid@mellanox.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1927252
> 
> Free block_cb memory when asked to be deleted.
> 
> Fixes: 978703f42549 ("netfilter: flowtable: Add API for registering to flow table events")
> Signed-off-by: Roi Dayan <roid@mellanox.com>
> Reviewed-by: Paul Blakey <paulb@mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> (backported from commit bc8e71314e8444c6315c482441f3204c032ab327)
> [danielj: backported because of the flow_block_lock change from mutex]
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> ---
> v2: Added reason for backport to commit message
> 
>   net/netfilter/nf_flow_table_core.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 5144e31..0336117 100644
> --- a/net/netfilter/nf_flow_table_core.c
> +++ b/net/netfilter/nf_flow_table_core.c
> @@ -427,10 +427,12 @@ void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
>   
>   	mutex_lock(&flow_table->flow_block_lock);
>   	block_cb = flow_block_cb_lookup(block, cb, cb_priv);
> -	if (block_cb)
> +	if (block_cb) {
>   		list_del(&block_cb->list);
> -	else
> +		flow_block_cb_free(block_cb);
> +	} else {
>   		WARN_ON(true);
> +	}
>   	mutex_unlock(&flow_table->flow_block_lock);
>   }
>   EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb);
>
diff mbox series

Patch

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 5144e31..0336117 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -427,10 +427,12 @@  void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table,
 
 	mutex_lock(&flow_table->flow_block_lock);
 	block_cb = flow_block_cb_lookup(block, cb, cb_priv);
-	if (block_cb)
+	if (block_cb) {
 		list_del(&block_cb->list);
-	else
+		flow_block_cb_free(block_cb);
+	} else {
 		WARN_ON(true);
+	}
 	mutex_unlock(&flow_table->flow_block_lock);
 }
 EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb);