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 1D512485505; Thu, 20 Aug 2026 17:41:54 +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=1787247715; cv=none; b=dAdDVhcZv0OiUnKVHnMblyq/7pQ02OsOJKgB8WL8lSP7MsERfDXaSDHfoDl665lkRCmEK9hfqEplQjL5qedk07aXFGDSoBsih/78QJRogoMWdLB8CAolzwCMudbV0kX7A5rrhnWYlKRXFgUuH9P9IMzLk4BPU99nWp2zBzXr+tE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247715; c=relaxed/simple; bh=VFJ0ZcjxJE+g7XDsFLLV86nsHNuhFlWV+kJpgFaykK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OKGm1eDDUcOzAF7rhxHXDdK/9U0t3PvrGog0y6rW1LKFuEXZZcQcjubibLXYKJc2tS6PFWSvnSIMoj5RThB0wP6ZrYCV3z3fcTcl5DQZIzJJpJYloiXgFoBN+Wl8w5TbZkvefVwvnvf6Uu2tZOtH/yWxI+gAPoDGUrD5sh96xrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ynzgyI0/; 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="ynzgyI0/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 699921F000E9; Thu, 20 Aug 2026 17:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787247714; bh=u9qUALc6ggesyDHWaiL78ATUZVAkMNPGsLD3W3aAgYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ynzgyI0/i1GrIz6J5C43r8/GaKsJdyzwUK7B7+EKRgRF9p6/tPOtSWJzalXKOg8Es eLgEVI8ljutNKpRAyEIquSCpRzO9Pcd04KHICtIJljmZQNhNoBlZydHf6f5juRoeSe nCjY2nAPqjw5eZRzypBotdqreXOjO788O90kr5dg= 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 6.6 143/166] netfilter: ipset: let destroy callbacks adjust ext mem size Date: Thu, 20 Aug 2026 16:56:42 +0200 Message-ID: <20260820145215.473756039@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145211.194104353@linuxfoundation.org> References: <20260820145211.194104353@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 6.6-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 40f0383883f9d..605d54d2bd7e6 100644 --- a/net/netfilter/ipset/ip_set_bitmap_gen.h +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h @@ -75,7 +75,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 e417ab37b69c7..720f05340b477 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