From: Faisal Latif Date: Mon, 27 Apr 2009 20:38:31 +0000 (-0700) Subject: RDMA/nes: Check for sequence number wrap-around X-Git-Tag: firefly_0821_release~14296^2^5~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c11470f9f4d4490cd7e9563f604c4c7868caf6de;p=firefly-linux-kernel-4.4.55.git RDMA/nes: Check for sequence number wrap-around check_seq() was not checking if the seq#s have wrapped. Fix it. Signed-off-by: Faisal Latif Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 1efe0beca063..1f7a659e6e9a 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c @@ -56,6 +56,7 @@ #include #include #include +#include #include "nes.h" @@ -1514,7 +1515,7 @@ static int check_seq(struct nes_cm_node *cm_node, struct tcphdr *tcph, rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; if (ack_seq != loc_seq_num) err = 1; - else if ((seq + rcv_wnd) < rcv_nxt) + else if (!between(seq, rcv_nxt, (rcv_nxt+rcv_wnd))) err = 1; if (err) { nes_debug(NES_DBG_CM, "%s[%u] create abort for cm_node=%p "