From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34D10367B9F; Thu, 20 Aug 2026 15:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787238678; cv=none; b=cj2K1ZgaX3MA8AE0lDXt3IAdYDbkMA9CwnXYohCVerHk1paVxmuGeOyLsQkOUowKodlRiWBwQopW4bqK54MoyJTP1rnxPZYqtg3XicsUPbekl/QCWA5Z2GK82dX9UNfphUYgiUJf/jbo2fSjtShEsByyuImMnejTTo/Ha+cBLoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787238678; c=relaxed/simple; bh=cjnDmL9sYNLXJwZB5bff9FTXrXRzqNhurNMDop0MNmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rnHqjlH5fW3uQ18evHLKGAj3WCzalBK+gJ2f33/lNoV3TBevBM3CKKZERDupEztWRsh2cDjCMt19qT9pheogZ8SfUWpcw60/xD8jtF5UY/py1Rc17qv9MDywx+OtCZmaCjSDgKVtBe16mqReqyTr5dycMUftqAf62P5/gOtuzno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xlNhp+dO; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xlNhp+dO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90D2B1F000E9; Thu, 20 Aug 2026 15:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787238677; bh=C+GmSDAnXEY8rr4A1JqzOf6Kg/oUmbdhymqZmd+KWw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xlNhp+dOn477x0KVdGq+DZi6JEpR8bk3DU7rxI4vDTv1ufAMjCWb7Z9AahLy/Jzag rN8Hp8p55xtPD9qb8UZJHij2/SHflQKvGWRPh9rcZsBjDxL0C9ePusIWHoZugFyyxC g1HEWuBSa0vWjRNh/oG/MNRQI+mKr1l131t1vCBY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jozsef Kadlecsik , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 7.1 192/228] netfilter: ipset: let destroy callbacks adjust ext mem size Date: Thu, 20 Aug 2026 16:55:34 +0200 Message-ID: <20260820145250.552341675@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145244.450574346@linuxfoundation.org> References: <20260820145244.450574346@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 490937b88cb592cc0c5367758edd700fd5abd15c ] For bitmap this change makes no difference, because destructors are called synchronously. List type however calls them via call_rcu() so accounting decrement can happen after list_set_flush() set ext_size to 0. 'set->elements = 0' can be removed for the same reason in the list type case, it calls 'set->elements--' for each element. Fixes: 9e41f26a505c ("netfilter: ipset: Count non-static extension memory for userspace") Suggested-by: Jozsef Kadlecsik Signed-off-by: Florian Westphal Acked-by: Jozsef Kadlecsik Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +- net/netfilter/ipset/ip_set_list_set.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h index 226fdf17b6832..d6a7e66045422 100644 --- a/net/netfilter/ipset/ip_set_bitmap_gen.h +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h @@ -77,7 +77,7 @@ mtype_flush(struct ip_set *set) mtype_ext_cleanup(set); bitmap_zero(map->members, map->elements); set->elements = 0; - atomic64_set(&set->ext_size, 0); + DEBUG_NET_WARN_ON_ONCE(atomic64_read(&set->ext_size) > 0); } /* Calculate the actual memory size of the set data */ diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c index 0bc2370773af3..f070088742d60 100644 --- a/net/netfilter/ipset/ip_set_list_set.c +++ b/net/netfilter/ipset/ip_set_list_set.c @@ -423,8 +423,7 @@ list_set_flush(struct ip_set *set) list_for_each_entry_safe(e, n, &map->members, list) list_set_del(set, e); - set->elements = 0; - atomic64_set(&set->ext_size, 0); + DEBUG_NET_WARN_ON_ONCE(set->elements > 0); } static void -- 2.53.0