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 <[EMAIL PROTECTED]>

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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to