diff mbox series

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

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

Commit Message

Daniel Jurgens May 18, 2021, 9:42 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)
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

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

Comments

Kleber Sacilotto de Souza May 19, 2021, 1:27 p.m. UTC | #1
On 18.05.21 23:42, 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)
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

Taking into consideration my comments below when applying this patch:

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Thanks

> 
> ---
>   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);
> 


Please note that there is another patch submitted ("netfilter: flowtable: Use rw sem
as flow block lock") touching the same block above, replacing mutex_lock. So some
context adjustments will be needed when applying them.

This patch doesn't need to be resubmitted, this is just a note for whoever will be
applying these patches.

Kleber
Daniel Jurgens May 19, 2021, 3:26 p.m. UTC | #2
> -----Original Message-----
> From: Kleber Souza <kleber.souza@canonical.com>
> Subject: ACK/cmnt: [SRU][F:linux-bluefield][PATCH] netfilter: flowtable: Free
> block_cb when being deleted
> 
> On 18.05.21 23:42, 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)
> > Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> Taking into consideration my comments below when applying this patch:
> 
> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
> 
> Thanks
> 
> >
> > ---
> >   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);
> >
> 
> 
> Please note that there is another patch submitted ("netfilter: flowtable: Use
> rw sem as flow block lock") touching the same block above, replacing
> mutex_lock. So some context adjustments will be needed when applying
> them.
> 
> This patch doesn't need to be resubmitted, this is just a note for whoever will
> be applying these patches.

Thanks, I had originally submitted them in a series for this reason, but it was NACKed because of multiple bugs in on submission.

> 
> Kleber
Krzysztof Kozlowski May 19, 2021, 3:48 p.m. UTC | #3
On 18/05/2021 17:42, 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)
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>


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

Best regards,
Krzysztof
Kelsey Skunberg May 29, 2021, 12:29 a.m. UTC | #4
On 2021-05-19 00:42:24 , 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: <I guess context adjustments>]
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 

This patch was on the mailing list twice. Stefan reviewed the other one
and requested a line like the above gets included when applying please. 

-Kelsey

> ---
>  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);
> -- 
> 1.8.3.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Stefan Bader June 2, 2021, 7:58 a.m. UTC | #5
On 18.05.21 23:42, 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)
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> ---
>   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);
>
Stefan Bader June 2, 2021, 8:05 a.m. UTC | #6
On 02.06.21 09:58, Stefan Bader wrote:
> On 18.05.21 23:42, 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)
>> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
>>
>> ---
>>   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);
>>
> 
> 
> 

missing actially the comment...

There was a NACK which appears to be meant for this but not as a reply to the 
thread.

-Stefan
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);