lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 08 Mar 2007 21:20:13 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	netdev@...r.kernel.org
Subject: [PATCH]: Fix RB-tree comparisons


While reviewing Ilpo's lost marking code I noticed that the
RB-tree code was doing raw comparisons on sequence numbers
which is always wrong.

I checked the following into net-2.6.22 to cure that:

[TCP]: Fix sequence number comparisons in RB-tree code.

Need to use after(), before(), etc. to handle wrapping
correctly.

Signed-off-by: David S. Miller <davem@...emloft.net>

diff --git a/include/net/tcp.h b/include/net/tcp.h
index b94debb..813fa8b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1233,9 +1233,9 @@ static inline struct sk_buff *tcp_write_queue_find(struct sock *sk, __u32 seq)
 
 	while (rb_node) {
 		struct sk_buff *tmp = rb_entry(rb_node,struct sk_buff,rb);
-		if (TCP_SKB_CB(tmp)->end_seq > seq) {
+		if (after(TCP_SKB_CB(tmp)->end_seq, seq)) {
 			skb = tmp;
-			if (TCP_SKB_CB(tmp)->seq <= seq)
+			if (!after(TCP_SKB_CB(tmp)->seq, seq))
 				break;
 			rb_node = rb_node->rb_left;
 		} else
@@ -1257,8 +1257,8 @@ static inline void tcp_rb_insert(struct sk_buff *skb, struct rb_root *root)
 
 		rb_parent = *rb_link;
 		tmp = rb_entry(rb_parent,struct sk_buff,rb);
-		if (TCP_SKB_CB(tmp)->end_seq > seq) {
-			BUG_ON(TCP_SKB_CB(tmp)->seq <= seq);
+		if (after(TCP_SKB_CB(tmp)->end_seq, seq)) {
+			BUG_ON(!after(TCP_SKB_CB(tmp)->seq, seq));
 			rb_link = &rb_parent->rb_left;
 		} else {
 			rb_link = &rb_parent->rb_right;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ