diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 854f6d0c4bb3..cbcc9fc47783 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -769,19 +769,23 @@ new_segment: | |||
769 | if (off == PAGE_SIZE) { | 769 | if (off == PAGE_SIZE) { |
770 | put_page(page); | 770 | put_page(page); |
771 | TCP_PAGE(sk) = page = NULL; | 771 | TCP_PAGE(sk) = page = NULL; |
772 | TCP_OFF(sk) = off = 0; | ||
772 | } | 773 | } |
773 | } | 774 | } else |
775 | BUG_ON(off); | ||
776 | |||
777 | if (copy > PAGE_SIZE - off) | ||
778 | copy = PAGE_SIZE - off; | ||
779 | |||
780 | if (!sk_stream_wmem_schedule(sk, copy)) | ||
781 | goto wait_for_memory; | ||
774 | 782 | ||
775 | if (!page) { | 783 | if (!page) { |
776 | /* Allocate new cache page. */ | 784 | /* Allocate new cache page. */ |
777 | if (!(page = sk_stream_alloc_page(sk))) | 785 | if (!(page = sk_stream_alloc_page(sk))) |
778 | goto wait_for_memory; | 786 | goto wait_for_memory; |
779 | off = 0; | ||
780 | } | 787 | } |
781 | 788 | ||
782 | if (copy > PAGE_SIZE - off) | ||
783 | copy = PAGE_SIZE - off; | ||
784 | |||
785 | /* Time to copy data. We are close to | 789 | /* Time to copy data. We are close to |
786 | * the end! */ | 790 | * the end! */ |
787 | err = skb_copy_to_page(sk, from, skb, page, | 791 | err = skb_copy_to_page(sk, from, skb, page, |