|
|
ac684a |
From 0e284af80adefc8d8738c7191eff0ca7c6ad64a6 Mon Sep 17 00:00:00 2001
|
|
|
ac684a |
From: Phil Sutter <psutter@redhat.com>
|
|
|
ac684a |
Date: Wed, 27 Apr 2022 14:46:47 +0200
|
|
|
ac684a |
Subject: [PATCH] rule: fix element cache update in __do_add_setelems()
|
|
|
ac684a |
|
|
|
ac684a |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2073287
|
|
|
ac684a |
Upstream Status: nftables commit e68938f2bf89f
|
|
|
ac684a |
|
|
|
ac684a |
commit e68938f2bf89fcc9a99e12c9b7a10c1838f2a133
|
|
|
ac684a |
Author: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
ac684a |
Date: Thu Apr 30 16:30:15 2020 +0200
|
|
|
ac684a |
|
|
|
ac684a |
rule: fix element cache update in __do_add_setelems()
|
|
|
ac684a |
|
|
|
ac684a |
The set->init and expr arguments might actually refer to the same list
|
|
|
ac684a |
of elements. Skip set element cache update introduced by dd44081d91ce
|
|
|
ac684a |
("segtree: Fix add and delete of element in same batch") otherwise
|
|
|
ac684a |
list_splice_tail_init() actually operates with the same list as
|
|
|
ac684a |
arguments. Valgrind reports this problem as a memleak since the result
|
|
|
ac684a |
of this operation was an empty set element list.
|
|
|
ac684a |
|
|
|
ac684a |
Fixes: dd44081d91ce ("segtree: Fix add and delete of element in same batch")
|
|
|
ac684a |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
ac684a |
---
|
|
|
ac684a |
src/rule.c | 2 +-
|
|
|
ac684a |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
ac684a |
|
|
|
ac684a |
diff --git a/src/rule.c b/src/rule.c
|
|
|
ac684a |
index b2aa1d7..9ae6d19 100644
|
|
|
ac684a |
--- a/src/rule.c
|
|
|
ac684a |
+++ b/src/rule.c
|
|
|
ac684a |
@@ -1512,7 +1512,7 @@ static int __do_add_setelems(struct netlink_ctx *ctx, struct set *set,
|
|
|
ac684a |
return -1;
|
|
|
ac684a |
|
|
|
ac684a |
if (!set_is_anonymous(set->flags) &&
|
|
|
ac684a |
- set->init != NULL &&
|
|
|
ac684a |
+ set->init != NULL && set->init != expr &&
|
|
|
ac684a |
set->flags & NFT_SET_INTERVAL &&
|
|
|
ac684a |
set->desc.field_count <= 1) {
|
|
|
ac684a |
interval_map_decompose(expr);
|
|
|
ac684a |
--
|
|
|
ac684a |
2.34.1
|
|
|
ac684a |
|