netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nf_tables: use correct lock to protect gc_list
@ 2023-08-21 12:33 Pablo Neira Ayuso
  2023-08-21 13:13 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2023-08-21 12:33 UTC (permalink / raw)
  To: netfilter-devel

Use nf_tables_gc_list_lock spinlock, not nf_tables_destroy_list_lock to
protect the destroy list.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index a255456efae4..eb8b1167dced 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -9456,9 +9456,9 @@ static void nft_trans_gc_work(struct work_struct *work)
 	struct nft_trans_gc *trans, *next;
 	LIST_HEAD(trans_gc_list);
 
-	spin_lock(&nf_tables_destroy_list_lock);
+	spin_lock(&nf_tables_gc_list_lock);
 	list_splice_init(&nf_tables_gc_list, &trans_gc_list);
-	spin_unlock(&nf_tables_destroy_list_lock);
+	spin_unlock(&nf_tables_gc_list_lock);
 
 	list_for_each_entry_safe(trans, next, &trans_gc_list, list) {
 		list_del(&trans->list);
-- 
2.30.2


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

* Re: [PATCH nf] netfilter: nf_tables: use correct lock to protect gc_list
  2023-08-21 12:33 [PATCH nf] netfilter: nf_tables: use correct lock to protect gc_list Pablo Neira Ayuso
@ 2023-08-21 13:13 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2023-08-21 13:13 UTC (permalink / raw)
  To: netfilter-devel

On Mon, Aug 21, 2023 at 02:33:32PM +0200, Pablo Neira Ayuso wrote:
> Use nf_tables_gc_list_lock spinlock, not nf_tables_destroy_list_lock to
> protect the destroy list.

For the record, this text should be instead:

  ... to protect the gc_list.

> Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
>  net/netfilter/nf_tables_api.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index a255456efae4..eb8b1167dced 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -9456,9 +9456,9 @@ static void nft_trans_gc_work(struct work_struct *work)
>  	struct nft_trans_gc *trans, *next;
>  	LIST_HEAD(trans_gc_list);
>  
> -	spin_lock(&nf_tables_destroy_list_lock);
> +	spin_lock(&nf_tables_gc_list_lock);
>  	list_splice_init(&nf_tables_gc_list, &trans_gc_list);
> -	spin_unlock(&nf_tables_destroy_list_lock);
> +	spin_unlock(&nf_tables_gc_list_lock);
>  
>  	list_for_each_entry_safe(trans, next, &trans_gc_list, list) {
>  		list_del(&trans->list);
> -- 
> 2.30.2
> 

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

end of thread, other threads:[~2023-08-21 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 12:33 [PATCH nf] netfilter: nf_tables: use correct lock to protect gc_list Pablo Neira Ayuso
2023-08-21 13:13 ` 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).