fix oops in do_tcp_sendpages 98/6798/1
authorPavel Boldin <pboldin@mirantis.com>
Tue, 19 May 2015 12:36:38 +0000 (15:36 +0300)
committerPavel Boldin <pboldin@mirantis.com>
Tue, 19 May 2015 13:07:15 +0000 (16:07 +0300)
Apply the upstream patch http://git.kernel.org/cgit/linux/kernel/git/stable/\
linux-stable.git/commit/?id=64022d0b4e93ea432e95db55a72b8a1c5775f3c0 to fix
the oops in `do_tcp_sendpages'.

Change-Id: Id0f6d1ccd9e0abd856da385f2ad461a022431a7e
Closes-Bug: #1456605
Related-Bug: #1449977

fix-do_tcp_sendpages.patch [new file with mode: 0644]
kernel.spec

diff --git a/fix-do_tcp_sendpages.patch b/fix-do_tcp_sendpages.patch
new file mode 100644 (file)
index 0000000..1203b4d
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/net/ipv4/tcp.c   2014-10-31 14:27:58.000000000 +0200
++++ b/net/ipv4/tcp.c   2015-05-19 15:34:22.078802741 +0300
+@@ -763,8 +763,8 @@ static int tcp_send_mss(struct sock *sk,
+       return mss_now;
+ }
+-static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffset,
+-                       size_t psize, int flags)
++static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
++                              size_t size, int flags)
+ {
+       struct tcp_sock *tp = tcp_sk(sk);
+       int mss_now, size_goal;
+@@ -786,12 +786,9 @@ static ssize_t do_tcp_sendpages(struct s
+       if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
+               goto out_err;
+-      while (psize > 0) {
++      while (size > 0) {
+               struct sk_buff *skb = tcp_write_queue_tail(sk);
+-              struct page *page = pages[poffset / PAGE_SIZE];
+               int copy, i, can_coalesce;
+-              int offset = poffset % PAGE_SIZE;
+-              int size = min_t(size_t, psize, PAGE_SIZE - offset);
+               if (!tcp_send_head(sk) || (copy = size_goal - skb->len) <= 0) {
+ new_segment:
+@@ -840,8 +837,8 @@ new_segment:
+                       TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH;
+               copied += copy;
+-              poffset += copy;
+-              if (!(psize -= copy))
++              offset += copy;
++              if (!(size -= copy))
+                       goto out;
+               if (skb->len < size_goal || (flags & MSG_OOB))
+@@ -890,7 +887,7 @@ ssize_t tcp_sendpage(struct socket *sock
+       lock_sock(sk);
+       TCP_CHECK_TIMER(sk);
+-      res = do_tcp_sendpages(sk, &page, offset, size, flags);
++      res = do_tcp_sendpages(sk, page, offset, size, flags);
+       TCP_CHECK_TIMER(sk);
+       release_sock(sk);
+       return res;
index 635c5f76188b16f2ba50fb8388ab5c2e89abe4e1..ac9e6bd68e096c6e53f07b6c5c401af32c62f378 100644 (file)
@@ -15,7 +15,7 @@ Summary: The Linux kernel
 # that the kernel isn't the stock distribution kernel, for example,
 # by setting the define to ".local" or ".bz123456"
 #
-# % define buildid .local
+%define buildid .mos61
 
 %define distro_build 504.1.3
 %define signmodules 1
@@ -614,6 +614,8 @@ Source84: config-s390x-generic-rhel
 Source85: config-powerpc64-debug-rhel
 Source86: config-s390x-debug-rhel
 
+# Fix LP#1456605
+Patch1: fix-do_tcp_sendpages.patch
 # empty final patch file to facilitate testing of kernel patches
 Patch999999: linux-kernel-test.patch
 
@@ -936,6 +938,7 @@ cp %{SOURCE15} %{SOURCE1} %{SOURCE16} %{SOURCE17} %{SOURCE18} .
 # Dynamically generate kernel .config files from config-* files
 make -f %{SOURCE20} VERSION=%{version} configs
 
+ApplyPatch fix-do_tcp_sendpages.patch
 ApplyOptionalPatch linux-kernel-test.patch
 
 # Any further pre-build tree manipulations happen here.