Commit 53d30f64 authored by David S. Miller's avatar David S. Miller

[TCP]: Use proper time_*() comparisons on jiffies.

parent d1c4a48c
...@@ -1363,7 +1363,7 @@ static inline void syn_flood_warning(struct sk_buff *skb) ...@@ -1363,7 +1363,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
{ {
static unsigned long warntime; static unsigned long warntime;
if (jiffies - warntime > HZ * 60) { if (time_after(jiffies, (warntime + HZ * 60))) {
warntime = jiffies; warntime = jiffies;
printk(KERN_INFO printk(KERN_INFO
"possible SYN flooding on port %d. Sending cookies.\n", "possible SYN flooding on port %d. Sending cookies.\n",
......
...@@ -563,7 +563,7 @@ void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo) ...@@ -563,7 +563,7 @@ void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo)
tcp_twcal_timer.expires = tcp_twcal_jiffie + (slot<<TCP_TW_RECYCLE_TICK); tcp_twcal_timer.expires = tcp_twcal_jiffie + (slot<<TCP_TW_RECYCLE_TICK);
add_timer(&tcp_twcal_timer); add_timer(&tcp_twcal_timer);
} else { } else {
if ((long)(tcp_twcal_timer.expires - jiffies) > (slot<<TCP_TW_RECYCLE_TICK)) if (time_after(tcp_twcal_timer.expires, jiffies + (slot<<TCP_TW_RECYCLE_TICK)))
mod_timer(&tcp_twcal_timer, jiffies + (slot<<TCP_TW_RECYCLE_TICK)); mod_timer(&tcp_twcal_timer, jiffies + (slot<<TCP_TW_RECYCLE_TICK));
slot = (tcp_twcal_hand + slot)&(TCP_TW_RECYCLE_SLOTS-1); slot = (tcp_twcal_hand + slot)&(TCP_TW_RECYCLE_SLOTS-1);
} }
...@@ -596,7 +596,7 @@ void tcp_twcal_tick(unsigned long dummy) ...@@ -596,7 +596,7 @@ void tcp_twcal_tick(unsigned long dummy)
j = tcp_twcal_jiffie; j = tcp_twcal_jiffie;
for (n=0; n<TCP_TW_RECYCLE_SLOTS; n++) { for (n=0; n<TCP_TW_RECYCLE_SLOTS; n++) {
if ((long)(j - now) <= 0) { if (time_before_eq(j, now)) {
struct tcp_tw_bucket *tw; struct tcp_tw_bucket *tw;
while((tw = tcp_twcal_row[slot]) != NULL) { while((tw = tcp_twcal_row[slot]) != NULL) {
......
...@@ -227,7 +227,7 @@ static void tcp_delack_timer(unsigned long data) ...@@ -227,7 +227,7 @@ static void tcp_delack_timer(unsigned long data)
if (sk->sk_state == TCP_CLOSE || !(tp->ack.pending & TCP_ACK_TIMER)) if (sk->sk_state == TCP_CLOSE || !(tp->ack.pending & TCP_ACK_TIMER))
goto out; goto out;
if ((long)(tp->ack.timeout - jiffies) > 0) { if (time_after(tp->ack.timeout, jiffies)) {
if (!mod_timer(&tp->delack_timer, tp->ack.timeout)) if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
sock_hold(sk); sock_hold(sk);
goto out; goto out;
...@@ -436,7 +436,7 @@ static void tcp_write_timer(unsigned long data) ...@@ -436,7 +436,7 @@ static void tcp_write_timer(unsigned long data)
if (sk->sk_state == TCP_CLOSE || !tp->pending) if (sk->sk_state == TCP_CLOSE || !tp->pending)
goto out; goto out;
if ((long)(tp->timeout - jiffies) > 0) { if (time_after(tp->timeout, jiffies)) {
if (!mod_timer(&tp->retransmit_timer, tp->timeout)) if (!mod_timer(&tp->retransmit_timer, tp->timeout))
sock_hold(sk); sock_hold(sk);
goto out; goto out;
...@@ -516,7 +516,7 @@ static void tcp_synack_timer(struct sock *sk) ...@@ -516,7 +516,7 @@ static void tcp_synack_timer(struct sock *sk)
do { do {
reqp=&lopt->syn_table[i]; reqp=&lopt->syn_table[i];
while ((req = *reqp) != NULL) { while ((req = *reqp) != NULL) {
if ((long)(now - req->expires) >= 0) { if (time_after_eq(now, req->expires)) {
if ((req->retrans < thresh || if ((req->retrans < thresh ||
(req->acked && req->retrans < max_retries)) (req->acked && req->retrans < max_retries))
&& !req->class->rtx_syn_ack(sk, req, NULL)) { && !req->class->rtx_syn_ack(sk, req, NULL)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment