tcp_skb_pcount(skb));
 }
 
-/* SND.NXT, if window was not shrunk.
+/* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
+ * window scaling factor due to loss of precision.
  * If window has been shrunk, what should we make? It is not clear at all.
  * Using SND.UNA we will fail to open window, SND.NXT is out of window. :-(
  * Anything in between SND.UNA...SND.UNA+SND.WND also can be already
 {
        const struct tcp_sock *tp = tcp_sk(sk);
 
-       if (!before(tcp_wnd_end(tp), tp->snd_nxt))
+       if (!before(tcp_wnd_end(tp), tp->snd_nxt) ||
+           (tp->rx_opt.wscale_ok &&
+            ((tp->snd_nxt - tcp_wnd_end(tp)) < (1 << tp->rx_opt.rcv_wscale))))
                return tp->snd_nxt;
        else
                return tcp_wnd_end(tp);