]> git.karo-electronics.de Git - linux-beck.git/blobdiff - net/ipv4/tcp_output.c
tcp: fix 0 divide in __tcp_select_window()
[linux-beck.git] / net / ipv4 / tcp_output.c
index b45101f3d2bd2e0f0077305a061add4f7ea0de27..8ce50dc3ab8cac821b8a2c3e0d31f0aa42f5c9d5 100644 (file)
@@ -769,6 +769,7 @@ static void tcp_tasklet_func(unsigned long data)
                list_del(&tp->tsq_node);
 
                sk = (struct sock *)tp;
+               smp_mb__before_atomic();
                clear_bit(TSQ_QUEUED, &sk->sk_tsq_flags);
 
                if (!sk->sk_lock.owned &&
@@ -1037,7 +1038,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        skb_shinfo(skb)->gso_size = tcp_skb_mss(skb);
 
        /* Our usage of tstamp should remain private */
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
 
        /* Cleanup our debris for IP stacks */
        memset(skb->cb, 0, max(sizeof(struct inet_skb_parm),
@@ -2517,9 +2518,11 @@ u32 __tcp_select_window(struct sock *sk)
        int full_space = min_t(int, tp->window_clamp, allowed_space);
        int window;
 
-       if (mss > full_space)
+       if (unlikely(mss > full_space)) {
                mss = full_space;
-
+               if (mss <= 0)
+                       return 0;
+       }
        if (free_space < (full_space >> 1)) {
                icsk->icsk_ack.quick = 0;
 
@@ -3202,7 +3205,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
 #endif
 
        /* Do not fool tcpdump (if any), clean our debris */
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
        return skb;
 }
 EXPORT_SYMBOL(tcp_make_synack);