Skip to contentSkip to conversation

Patch "netfilter: nft_set_rbtree: handle element re-addition after deletion" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message Jun 12, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

netfilter: nft_set_rbtree: handle element re-addition after deletion

to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
netfilter-nft_set_rbtree-handle-element-re-addition-after-deletion.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From d2df92e98a34a5619dadd29c6291113c009181e7 Mon Sep 17 00:00:00 2001

From: Pablo Neira Ayuso <[email protected]>
Date: Sun, 21 May 2017 00:37:10 +0200
Subject: netfilter: nft_set_rbtree: handle element re-addition after deletion

From: Pablo Neira Ayuso <[email protected]>

commit d2df92e98a34a5619dadd29c6291113c009181e7 upstream.

The existing code selects no next branch to be inspected when re-inserting an inactive element into the rb-tree, looping endlessly. This patch restricts the check for active elements to the EEXIST case only.

Fixes e701001e7cbe ("netfilter: nft_rbtree: allow adjacent intervals with dynamic updates")
---
 net/netfilter/nft_set_rbtree.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
net/netfilter/nft_set_rbtree.c +11 -11
@@ -117,17 +117,17 @@ static int __nft_rbtree_insert(const str
 		else if (d > 0)
 			p = &parent->rb_right;
 		else {
-			if (nft_set_elem_active(&rbe->ext, genmask)) {
-				if (nft_rbtree_interval_end(rbe) &&
-				    !nft_rbtree_interval_end(new))
-					p = &parent->rb_left;
-				else if (!nft_rbtree_interval_end(rbe) &&
-					 nft_rbtree_interval_end(new))
-					p = &parent->rb_right;
-				else {
-					*ext = &rbe->ext;
-					return -EEXIST;
-				}
+			if (nft_rbtree_interval_end(rbe) &&
+			    !nft_rbtree_interval_end(new)) {
+				p = &parent->rb_left;
+			} else if (!nft_rbtree_interval_end(rbe) &&
+				   nft_rbtree_interval_end(new)) {
+				p = &parent->rb_right;
+			} else if (nft_set_elem_active(&rbe->ext, genmask)) {
+				*ext = &rbe->ext;
+				return -EEXIST;
+			} else {
+				p = &parent->rb_left;
 			}
 		}
 	}

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/netfilter-nft_set_rbtree-handle-element-re-addition-after-deletion.patch