Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Lion Ackermann <nnamrec@gmail.com>
Subject: Re: [PATCH 1/1] netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type
Date: Thu, 6 Jun 2024 00:24:40 +0200	[thread overview]
Message-ID: <ZmDlqGtGv_LdMj6k@calendula> (raw)
In-Reply-To: <20240604135803.2462674-2-kadlec@netfilter.org>

Hi Jozsef,

On Tue, Jun 04, 2024 at 03:58:03PM +0200, Jozsef Kadlecsik wrote:
[...]
> @@ -424,14 +428,8 @@ static void
>  list_set_destroy(struct ip_set *set)
>  {
>  	struct list_set *map = set->data;
> -	struct set_elem *e, *n;
>  
> -	list_for_each_entry_safe(e, n, &map->members, list) {
> -		list_del(&e->list);
> -		ip_set_put_byindex(map->net, e->id);
> -		ip_set_ext_destroy(set, e);
> -		kfree(e);
> -	}
> +	BUG_ON(!list_empty(&map->members));

It would probably be better to turn this is WARN_ON_ONCE, such as:

        WARN_ON_ONCE(!list_empty(&map->members);

BUG_ON is only allowed to be used in very particular cases these days.

I can update this patch if you are fine with it.

>  	kfree(map);
>  
>  	set->data = NULL;
> -- 
> 2.39.2
> 

  reply	other threads:[~2024-06-05 22:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 13:58 [PATCH 0/1] ipset patch for nf tree Jozsef Kadlecsik
2024-06-04 13:58 ` [PATCH 1/1] netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type Jozsef Kadlecsik
2024-06-05 22:24   ` Pablo Neira Ayuso [this message]
2024-06-06  6:44     ` Jozsef Kadlecsik
2024-06-11 16:45     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZmDlqGtGv_LdMj6k@calendula \
    --to=pablo@netfilter.org \
    --cc=kadlec@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nnamrec@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox