]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 20:54:35 +0000 (13:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 20:54:35 +0000 (13:54 -0700)
added patches:
arm-7748-1-oabi-handle-faults-when-loading-swi-instruction-from-userspace.patch
ipvs-avoid-netns-exit-crash-on-ip_vs_conn_drop_conntrack.patch
ipvs-fix-ipv6-hook-registration-for-local-replies.patch
ipvs-maintain-all-dscp-and-ecn-bits-for-ipv6-tun-forwarding.patch
md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch
netfilter-nf_conntrack-avoid-large-timeout-for-mid-stream-pickup.patch
pm-sleep-add-state-field-to-pm_states-entries.patch
pm-sleep-use-valid_state-for-platform-dependent-sleep-states-only.patch
serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch

queue-3.10/arm-7748-1-oabi-handle-faults-when-loading-swi-instruction-from-userspace.patch [new file with mode: 0644]
queue-3.10/ipvs-avoid-netns-exit-crash-on-ip_vs_conn_drop_conntrack.patch [new file with mode: 0644]
queue-3.10/ipvs-fix-ipv6-hook-registration-for-local-replies.patch [new file with mode: 0644]
queue-3.10/ipvs-maintain-all-dscp-and-ecn-bits-for-ipv6-tun-forwarding.patch [new file with mode: 0644]
queue-3.10/md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch [new file with mode: 0644]
queue-3.10/netfilter-nf_conntrack-avoid-large-timeout-for-mid-stream-pickup.patch [new file with mode: 0644]
queue-3.10/pm-sleep-add-state-field-to-pm_states-entries.patch [new file with mode: 0644]
queue-3.10/pm-sleep-use-valid_state-for-platform-dependent-sleep-states-only.patch [new file with mode: 0644]
queue-3.10/serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/arm-7748-1-oabi-handle-faults-when-loading-swi-instruction-from-userspace.patch b/queue-3.10/arm-7748-1-oabi-handle-faults-when-loading-swi-instruction-from-userspace.patch
new file mode 100644 (file)
index 0000000..bcbf3e2
--- /dev/null
@@ -0,0 +1,123 @@
+From 1aa2b3b7a6c4f3dbd3671171113a20e6a6190e3b Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Wed, 5 Jun 2013 11:25:13 +0100
+Subject: ARM: 7748/1: oabi: handle faults when loading swi instruction from userspace
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 1aa2b3b7a6c4f3dbd3671171113a20e6a6190e3b upstream.
+
+Running an OABI_COMPAT kernel on an SMP platform can lead to fun and
+games with page aging.
+
+If one CPU issues a swi instruction immediately before another CPU
+decides to mkold the page containing the swi instruction, then we will
+fault attempting to load the instruction during the vector_swi handler
+in order to retrieve its immediate field. Since this fault is not
+currently dealt with by our exception tables, this results in a panic:
+
+  Unable to handle kernel paging request at virtual address 4020841c
+  pgd = c490c000
+  [4020841c] *pgd=84451831, *pte=bf05859d, *ppte=00000000
+  Internal error: Oops: 17 [#1] PREEMPT SMP ARM
+  Modules linked in: hid_sony(O)
+  CPU: 1    Tainted: G        W  O  (3.4.0-perf-gf496dca-01162-gcbcc62b #1)
+  PC is at vector_swi+0x28/0x88
+  LR is at 0x40208420
+
+This patch wraps all of the swi instruction loads with the USER macro
+and provides a shared exception table entry which simply rewinds the
+saved user PC and returns from the system call (without setting tbl, so
+there's no worries with tracing or syscall restarting). Returning to
+userspace will re-enter the page fault handler, from where we will
+probably send SIGSEGV to the current task.
+
+Reported-by: Wang, Yalin <yalin.wang@sonymobile.com>
+Reviewed-by: Nicolas Pitre <nico@linaro.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Cc: Sheng Yong <shengyong1@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kernel/entry-common.S |   42 ++++++++++++++++++++++++++++-------------
+ 1 file changed, 29 insertions(+), 13 deletions(-)
+
+--- a/arch/arm/kernel/entry-common.S
++++ b/arch/arm/kernel/entry-common.S
+@@ -362,6 +362,16 @@ ENTRY(vector_swi)
+       str     r0, [sp, #S_OLD_R0]             @ Save OLD_R0
+       zero_fp
++#ifdef CONFIG_ALIGNMENT_TRAP
++      ldr     ip, __cr_alignment
++      ldr     ip, [ip]
++      mcr     p15, 0, ip, c1, c0              @ update control register
++#endif
++
++      enable_irq
++      ct_user_exit
++      get_thread_info tsk
++
+       /*
+        * Get the system call number.
+        */
+@@ -375,9 +385,9 @@ ENTRY(vector_swi)
+ #ifdef CONFIG_ARM_THUMB
+       tst     r8, #PSR_T_BIT
+       movne   r10, #0                         @ no thumb OABI emulation
+-      ldreq   r10, [lr, #-4]                  @ get SWI instruction
++ USER(        ldreq   r10, [lr, #-4]          )       @ get SWI instruction
+ #else
+-      ldr     r10, [lr, #-4]                  @ get SWI instruction
++ USER(        ldr     r10, [lr, #-4]          )       @ get SWI instruction
+ #endif
+ #ifdef CONFIG_CPU_ENDIAN_BE8
+       rev     r10, r10                        @ little endian instruction
+@@ -392,22 +402,13 @@ ENTRY(vector_swi)
+       /* Legacy ABI only, possibly thumb mode. */
+       tst     r8, #PSR_T_BIT                  @ this is SPSR from save_user_regs
+       addne   scno, r7, #__NR_SYSCALL_BASE    @ put OS number in
+-      ldreq   scno, [lr, #-4]
++ USER(        ldreq   scno, [lr, #-4]         )
+ #else
+       /* Legacy ABI only. */
+-      ldr     scno, [lr, #-4]                 @ get SWI instruction
++ USER(        ldr     scno, [lr, #-4]         )       @ get SWI instruction
+ #endif
+-#ifdef CONFIG_ALIGNMENT_TRAP
+-      ldr     ip, __cr_alignment
+-      ldr     ip, [ip]
+-      mcr     p15, 0, ip, c1, c0              @ update control register
+-#endif
+-      enable_irq
+-      ct_user_exit
+-
+-      get_thread_info tsk
+       adr     tbl, sys_call_table             @ load syscall table pointer
+ #if defined(CONFIG_OABI_COMPAT)
+@@ -442,6 +443,21 @@ local_restart:
+       eor     r0, scno, #__NR_SYSCALL_BASE    @ put OS number back
+       bcs     arm_syscall     
+       b       sys_ni_syscall                  @ not private func
++
++#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
++      /*
++       * We failed to handle a fault trying to access the page
++       * containing the swi instruction, but we're not really in a
++       * position to return -EFAULT. Instead, return back to the
++       * instruction and re-enter the user fault handling path trying
++       * to page it in. This will likely result in sending SEGV to the
++       * current task.
++       */
++9001:
++      sub     lr, lr, #4
++      str     lr, [sp, #S_PC]
++      b       ret_fast_syscall
++#endif
+ ENDPROC(vector_swi)
+       /*
diff --git a/queue-3.10/ipvs-avoid-netns-exit-crash-on-ip_vs_conn_drop_conntrack.patch b/queue-3.10/ipvs-avoid-netns-exit-crash-on-ip_vs_conn_drop_conntrack.patch
new file mode 100644 (file)
index 0000000..36df365
--- /dev/null
@@ -0,0 +1,33 @@
+From 2627b7e15c5064ddd5e578e4efd948d48d531a3f Mon Sep 17 00:00:00 2001
+From: Julian Anastasov <ja@ssi.bg>
+Date: Thu, 10 Jul 2014 09:24:01 +0300
+Subject: ipvs: avoid netns exit crash on ip_vs_conn_drop_conntrack
+
+From: Julian Anastasov <ja@ssi.bg>
+
+commit 2627b7e15c5064ddd5e578e4efd948d48d531a3f upstream.
+
+commit 8f4e0a18682d91 ("IPVS netns exit causes crash in conntrack")
+added second ip_vs_conn_drop_conntrack call instead of just adding
+the needed check. As result, the first call still can cause
+crash on netns exit. Remove it.
+
+Signed-off-by: Julian Anastasov <ja@ssi.bg>
+Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/ipvs/ip_vs_conn.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/net/netfilter/ipvs/ip_vs_conn.c
++++ b/net/netfilter/ipvs/ip_vs_conn.c
+@@ -797,7 +797,6 @@ static void ip_vs_conn_expire(unsigned l
+                       ip_vs_control_del(cp);
+               if (cp->flags & IP_VS_CONN_F_NFCT) {
+-                      ip_vs_conn_drop_conntrack(cp);
+                       /* Do not access conntracks during subsys cleanup
+                        * because nf_conntrack_find_get can not be used after
+                        * conntrack cleanup for the net.
diff --git a/queue-3.10/ipvs-fix-ipv6-hook-registration-for-local-replies.patch b/queue-3.10/ipvs-fix-ipv6-hook-registration-for-local-replies.patch
new file mode 100644 (file)
index 0000000..124dfd6
--- /dev/null
@@ -0,0 +1,40 @@
+From eb90b0c734ad793d5f5bf230a9e9a4dcc48df8aa Mon Sep 17 00:00:00 2001
+From: Julian Anastasov <ja@ssi.bg>
+Date: Fri, 22 Aug 2014 17:53:41 +0300
+Subject: ipvs: fix ipv6 hook registration for local replies
+
+From: Julian Anastasov <ja@ssi.bg>
+
+commit eb90b0c734ad793d5f5bf230a9e9a4dcc48df8aa upstream.
+
+commit fc604767613b6d2036cdc35b660bc39451040a47
+("ipvs: changes for local real server") from 2.6.37
+introduced DNAT support to local real server but the
+IPv6 LOCAL_OUT handler ip_vs_local_reply6() is
+registered incorrectly as IPv4 hook causing any outgoing
+IPv4 traffic to be dropped depending on the IP header values.
+
+Chris tracked down the problem to CONFIG_IP_VS_IPV6=y
+Bug report: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1349768
+
+Reported-by: Chris J Arges <chris.j.arges@canonical.com>
+Tested-by: Chris J Arges <chris.j.arges@canonical.com>
+Signed-off-by: Julian Anastasov <ja@ssi.bg>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/ipvs/ip_vs_core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/netfilter/ipvs/ip_vs_core.c
++++ b/net/netfilter/ipvs/ip_vs_core.c
+@@ -1898,7 +1898,7 @@ static struct nf_hook_ops ip_vs_ops[] __
+       {
+               .hook           = ip_vs_local_reply6,
+               .owner          = THIS_MODULE,
+-              .pf             = NFPROTO_IPV4,
++              .pf             = NFPROTO_IPV6,
+               .hooknum        = NF_INET_LOCAL_OUT,
+               .priority       = NF_IP6_PRI_NAT_DST + 1,
+       },
diff --git a/queue-3.10/ipvs-maintain-all-dscp-and-ecn-bits-for-ipv6-tun-forwarding.patch b/queue-3.10/ipvs-maintain-all-dscp-and-ecn-bits-for-ipv6-tun-forwarding.patch
new file mode 100644 (file)
index 0000000..5770991
--- /dev/null
@@ -0,0 +1,34 @@
+From 76f084bc10004b3050b2cff9cfac29148f1f6088 Mon Sep 17 00:00:00 2001
+From: Alex Gartrell <agartrell@fb.com>
+Date: Wed, 16 Jul 2014 15:57:34 -0700
+Subject: ipvs: Maintain all DSCP and ECN bits for ipv6 tun forwarding
+
+From: Alex Gartrell <agartrell@fb.com>
+
+commit 76f084bc10004b3050b2cff9cfac29148f1f6088 upstream.
+
+Previously, only the four high bits of the tclass were maintained in the
+ipv6 case.  This matches the behavior of ipv4, though whether or not we
+should reflect ECN bits may be up for debate.
+
+Signed-off-by: Alex Gartrell <agartrell@fb.com>
+Acked-by: Julian Anastasov <ja@ssi.bg>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/ipvs/ip_vs_xmit.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/netfilter/ipvs/ip_vs_xmit.c
++++ b/net/netfilter/ipvs/ip_vs_xmit.c
+@@ -967,8 +967,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb
+       iph->nexthdr            =       IPPROTO_IPV6;
+       iph->payload_len        =       old_iph->payload_len;
+       be16_add_cpu(&iph->payload_len, sizeof(*old_iph));
+-      iph->priority           =       old_iph->priority;
+       memset(&iph->flow_lbl, 0, sizeof(iph->flow_lbl));
++      ipv6_change_dsfield(iph, 0, ipv6_get_dsfield(old_iph));
+       iph->daddr = cp->daddr.in6;
+       iph->saddr = saddr;
+       iph->hop_limit          =       old_iph->hop_limit;
diff --git a/queue-3.10/md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch b/queue-3.10/md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch
new file mode 100644 (file)
index 0000000..349bc49
--- /dev/null
@@ -0,0 +1,51 @@
+From b8cb6b4c121e1bf1963c16ed69e7adcb1bc301cd Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Thu, 18 Sep 2014 11:09:04 +1000
+Subject: md/raid1: fix_read_error should act on all non-faulty devices.
+
+From: NeilBrown <neilb@suse.de>
+
+commit b8cb6b4c121e1bf1963c16ed69e7adcb1bc301cd upstream.
+
+If a devices is being recovered it is not InSync and is not Faulty.
+
+If a read error is experienced on that device, fix_read_error()
+will be called, but it ignores non-InSync devices.  So it will
+neither fix the error nor fail the device.
+
+It is incorrect that fix_read_error() ignores non-InSync devices.
+It should only ignore Faulty devices.  So fix it.
+
+This became a bug when we allowed reading from a device that was being
+recovered.  It is suitable for any subsequent -stable kernel.
+
+Fixes: da8840a747c0dbf49506ec906757a6b87b9741e9
+Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com>
+Tested-by: Alexander Lyakas <alex.bolshoy@gmail.com>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/raid1.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -2051,7 +2051,7 @@ static void fix_read_error(struct r1conf
+                       d--;
+                       rdev = conf->mirrors[d].rdev;
+                       if (rdev &&
+-                          test_bit(In_sync, &rdev->flags))
++                          !test_bit(Faulty, &rdev->flags))
+                               r1_sync_page_io(rdev, sect, s,
+                                               conf->tmppage, WRITE);
+               }
+@@ -2063,7 +2063,7 @@ static void fix_read_error(struct r1conf
+                       d--;
+                       rdev = conf->mirrors[d].rdev;
+                       if (rdev &&
+-                          test_bit(In_sync, &rdev->flags)) {
++                          !test_bit(Faulty, &rdev->flags)) {
+                               if (r1_sync_page_io(rdev, sect, s,
+                                                   conf->tmppage, READ)) {
+                                       atomic_add(s, &rdev->corrected_errors);
diff --git a/queue-3.10/netfilter-nf_conntrack-avoid-large-timeout-for-mid-stream-pickup.patch b/queue-3.10/netfilter-nf_conntrack-avoid-large-timeout-for-mid-stream-pickup.patch
new file mode 100644 (file)
index 0000000..e195c8d
--- /dev/null
@@ -0,0 +1,54 @@
+From 6547a221871f139cc56328a38105d47c14874cbe Mon Sep 17 00:00:00 2001
+From: Florian Westphal <fw@strlen.de>
+Date: Thu, 13 Jun 2013 17:31:28 +0200
+Subject: netfilter: nf_conntrack: avoid large timeout for mid-stream pickup
+
+From: Florian Westphal <fw@strlen.de>
+
+commit 6547a221871f139cc56328a38105d47c14874cbe upstream.
+
+When loose tracking is enabled (default), non-syn packets cause
+creation of new conntracks in established state with default timeout for
+established state (5 days).  This causes the table to fill up with UNREPLIED
+when the 'new ack' packet happened to be the last-ack of a previous,
+already timed-out connection.
+
+Consider:
+
+A 192.168.x.52792 > 10.184.y.80: F, 426:426(0) ack 9237 win 255
+B 10.184.y.80 > 192.168.x.52792: ., ack 427 win 123
+<61 second pause>
+C 10.184.y.80 > 192.168.x.52792: F, 9237:9237(0) ack 427 win 123
+D 192.168.x.52792 > 10.184.y.80: ., ack 9238 win 255
+
+B moves conntrack to CLOSE_WAIT and will kill it after 60 second timeout,
+C is ignored (FIN set), but last packet (D) causes new ct with 5-days timeout.
+
+Use UNACK timeout (5 minutes) instead to get rid of these entries sooner
+when in ESTABLISHED state without having seen traffic in both directions.
+
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Cc: Florian Koch <florian.koch1981@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/nf_conntrack_proto_tcp.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/net/netfilter/nf_conntrack_proto_tcp.c
++++ b/net/netfilter/nf_conntrack_proto_tcp.c
+@@ -1043,6 +1043,12 @@ static int tcp_packet(struct nf_conn *ct
+                       nf_ct_kill_acct(ct, ctinfo, skb);
+                       return NF_ACCEPT;
+               }
++              /* ESTABLISHED without SEEN_REPLY, i.e. mid-connection
++               * pickup with loose=1. Avoid large ESTABLISHED timeout.
++               */
++              if (new_state == TCP_CONNTRACK_ESTABLISHED &&
++                  timeout > timeouts[TCP_CONNTRACK_UNACK])
++                      timeout = timeouts[TCP_CONNTRACK_UNACK];
+       } else if (!test_bit(IPS_ASSURED_BIT, &ct->status)
+                  && (old_state == TCP_CONNTRACK_SYN_RECV
+                      || old_state == TCP_CONNTRACK_ESTABLISHED)
diff --git a/queue-3.10/pm-sleep-add-state-field-to-pm_states-entries.patch b/queue-3.10/pm-sleep-add-state-field-to-pm_states-entries.patch
new file mode 100644 (file)
index 0000000..bf5b68b
--- /dev/null
@@ -0,0 +1,180 @@
+From 27ddcc6596e50cb8f03d2e83248897667811d8f6 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Mon, 26 May 2014 13:40:47 +0200
+Subject: PM / sleep: Add state field to pm_states[] entries
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+commit 27ddcc6596e50cb8f03d2e83248897667811d8f6 upstream.
+
+To allow sleep states corresponding to the "mem", "standby" and
+"freeze" lables to be different from the pm_states[] indexes of
+those strings, introduce struct pm_sleep_state, consisting of
+a string label and a state number, and turn pm_states[] into an
+array of objects of that type.
+
+This modification should not lead to any functional changes.
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Cc: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/power/main.c         |   16 ++++++++--------
+ kernel/power/power.h        |    7 ++++++-
+ kernel/power/suspend.c      |   12 ++++++------
+ kernel/power/suspend_test.c |   22 ++++++++++------------
+ 4 files changed, 30 insertions(+), 27 deletions(-)
+
+--- a/kernel/power/main.c
++++ b/kernel/power/main.c
+@@ -293,12 +293,12 @@ static ssize_t state_show(struct kobject
+ {
+       char *s = buf;
+ #ifdef CONFIG_SUSPEND
+-      int i;
++      suspend_state_t i;
++
++      for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
++              if (valid_state(i))
++                      s += sprintf(s,"%s ", pm_states[i].label);
+-      for (i = 0; i < PM_SUSPEND_MAX; i++) {
+-              if (pm_states[i] && valid_state(i))
+-                      s += sprintf(s,"%s ", pm_states[i]);
+-      }
+ #endif
+ #ifdef CONFIG_HIBERNATION
+       s += sprintf(s, "%s\n", "disk");
+@@ -314,7 +314,7 @@ static suspend_state_t decode_state(cons
+ {
+ #ifdef CONFIG_SUSPEND
+       suspend_state_t state = PM_SUSPEND_MIN;
+-      const char * const *s;
++      struct pm_sleep_state *s;
+ #endif
+       char *p;
+       int len;
+@@ -328,7 +328,7 @@ static suspend_state_t decode_state(cons
+ #ifdef CONFIG_SUSPEND
+       for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++)
+-              if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
++              if (len == strlen(s->label) && !strncmp(buf, s->label, len))
+                       return state;
+ #endif
+@@ -446,7 +446,7 @@ static ssize_t autosleep_show(struct kob
+ #ifdef CONFIG_SUSPEND
+       if (state < PM_SUSPEND_MAX)
+               return sprintf(buf, "%s\n", valid_state(state) ?
+-                                              pm_states[state] : "error");
++                                      pm_states[state].label : "error");
+ #endif
+ #ifdef CONFIG_HIBERNATION
+       return sprintf(buf, "disk\n");
+--- a/kernel/power/power.h
++++ b/kernel/power/power.h
+@@ -175,8 +175,13 @@ extern void swsusp_show_speed(struct tim
+                               unsigned int, char *);
+ #ifdef CONFIG_SUSPEND
++struct pm_sleep_state {
++      const char *label;
++      suspend_state_t state;
++};
++
+ /* kernel/power/suspend.c */
+-extern const char *const pm_states[];
++extern struct pm_sleep_state pm_states[];
+ extern bool valid_state(suspend_state_t state);
+ extern int suspend_devices_and_enter(suspend_state_t state);
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -29,10 +29,10 @@
+ #include "power.h"
+-const char *const pm_states[PM_SUSPEND_MAX] = {
+-      [PM_SUSPEND_FREEZE]     = "freeze",
+-      [PM_SUSPEND_STANDBY]    = "standby",
+-      [PM_SUSPEND_MEM]        = "mem",
++struct pm_sleep_state pm_states[PM_SUSPEND_MAX] = {
++      [PM_SUSPEND_FREEZE] = { "freeze", PM_SUSPEND_FREEZE },
++      [PM_SUSPEND_STANDBY] = { "standby", PM_SUSPEND_STANDBY },
++      [PM_SUSPEND_MEM] = { "mem", PM_SUSPEND_MEM },
+ };
+ static const struct platform_suspend_ops *suspend_ops;
+@@ -337,7 +337,7 @@ static int enter_state(suspend_state_t s
+       sys_sync();
+       printk("done.\n");
+-      pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
++      pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label);
+       error = suspend_prepare(state);
+       if (error)
+               goto Unlock;
+@@ -345,7 +345,7 @@ static int enter_state(suspend_state_t s
+       if (suspend_test(TEST_FREEZER))
+               goto Finish;
+-      pr_debug("PM: Entering %s sleep\n", pm_states[state]);
++      pr_debug("PM: Entering %s sleep\n", pm_states[state].label);
+       pm_restrict_gfp_mask();
+       error = suspend_devices_and_enter(state);
+       pm_restore_gfp_mask();
+--- a/kernel/power/suspend_test.c
++++ b/kernel/power/suspend_test.c
+@@ -92,13 +92,13 @@ static void __init test_wakealarm(struct
+       }
+       if (state == PM_SUSPEND_MEM) {
+-              printk(info_test, pm_states[state]);
++              printk(info_test, pm_states[state].label);
+               status = pm_suspend(state);
+               if (status == -ENODEV)
+                       state = PM_SUSPEND_STANDBY;
+       }
+       if (state == PM_SUSPEND_STANDBY) {
+-              printk(info_test, pm_states[state]);
++              printk(info_test, pm_states[state].label);
+               status = pm_suspend(state);
+       }
+       if (status < 0)
+@@ -136,18 +136,16 @@ static char warn_bad_state[] __initdata
+ static int __init setup_test_suspend(char *value)
+ {
+-      unsigned i;
++      suspend_state_t i;
+       /* "=mem" ==> "mem" */
+       value++;
+-      for (i = 0; i < PM_SUSPEND_MAX; i++) {
+-              if (!pm_states[i])
+-                      continue;
+-              if (strcmp(pm_states[i], value) != 0)
+-                      continue;
+-              test_state = (__force suspend_state_t) i;
+-              return 0;
+-      }
++      for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
++              if (!strcmp(pm_states[i].label, value)) {
++                      test_state = pm_states[i].state;
++                      return 0;
++              }
++
+       printk(warn_bad_state, value);
+       return 0;
+ }
+@@ -165,7 +163,7 @@ static int __init test_suspend(void)
+       if (test_state == PM_SUSPEND_ON)
+               goto done;
+       if (!valid_state(test_state)) {
+-              printk(warn_bad_state, pm_states[test_state]);
++              printk(warn_bad_state, pm_states[test_state].label);
+               goto done;
+       }
diff --git a/queue-3.10/pm-sleep-use-valid_state-for-platform-dependent-sleep-states-only.patch b/queue-3.10/pm-sleep-use-valid_state-for-platform-dependent-sleep-states-only.patch
new file mode 100644 (file)
index 0000000..272658b
--- /dev/null
@@ -0,0 +1,185 @@
+From 43e8317b0bba1d6eb85f38a4a233d82d7c20d732 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Mon, 26 May 2014 13:40:53 +0200
+Subject: PM / sleep: Use valid_state() for platform-dependent sleep states only
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+commit 43e8317b0bba1d6eb85f38a4a233d82d7c20d732 upstream.
+
+Use the observation that, for platform-dependent sleep states
+(PM_SUSPEND_STANDBY, PM_SUSPEND_MEM), a given state is either
+always supported or always unsupported and store that information
+in pm_states[] instead of calling valid_state() every time we
+need to check it.
+
+Also do not use valid_state() for PM_SUSPEND_FREEZE, which is always
+valid, and move the pm_test_level validity check for PM_SUSPEND_FREEZE
+directly into enter_state().
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Cc: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/power/main.c         |    9 +++---
+ kernel/power/power.h        |    2 -
+ kernel/power/suspend.c      |   60 ++++++++++++++++++++++----------------------
+ kernel/power/suspend_test.c |    2 -
+ 4 files changed, 36 insertions(+), 37 deletions(-)
+
+--- a/kernel/power/main.c
++++ b/kernel/power/main.c
+@@ -296,7 +296,7 @@ static ssize_t state_show(struct kobject
+       suspend_state_t i;
+       for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
+-              if (valid_state(i))
++              if (pm_states[i].state)
+                       s += sprintf(s,"%s ", pm_states[i].label);
+ #endif
+@@ -328,8 +328,9 @@ static suspend_state_t decode_state(cons
+ #ifdef CONFIG_SUSPEND
+       for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++)
+-              if (len == strlen(s->label) && !strncmp(buf, s->label, len))
+-                      return state;
++              if (s->state && len == strlen(s->label)
++                  && !strncmp(buf, s->label, len))
++                      return s->state;
+ #endif
+       return PM_SUSPEND_ON;
+@@ -445,7 +446,7 @@ static ssize_t autosleep_show(struct kob
+ #ifdef CONFIG_SUSPEND
+       if (state < PM_SUSPEND_MAX)
+-              return sprintf(buf, "%s\n", valid_state(state) ?
++              return sprintf(buf, "%s\n", pm_states[state].state ?
+                                       pm_states[state].label : "error");
+ #endif
+ #ifdef CONFIG_HIBERNATION
+--- a/kernel/power/power.h
++++ b/kernel/power/power.h
+@@ -183,14 +183,12 @@ struct pm_sleep_state {
+ /* kernel/power/suspend.c */
+ extern struct pm_sleep_state pm_states[];
+-extern bool valid_state(suspend_state_t state);
+ extern int suspend_devices_and_enter(suspend_state_t state);
+ #else /* !CONFIG_SUSPEND */
+ static inline int suspend_devices_and_enter(suspend_state_t state)
+ {
+       return -ENOSYS;
+ }
+-static inline bool valid_state(suspend_state_t state) { return false; }
+ #endif /* !CONFIG_SUSPEND */
+ #ifdef CONFIG_PM_TEST_SUSPEND
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -30,9 +30,9 @@
+ #include "power.h"
+ struct pm_sleep_state pm_states[PM_SUSPEND_MAX] = {
+-      [PM_SUSPEND_FREEZE] = { "freeze", PM_SUSPEND_FREEZE },
+-      [PM_SUSPEND_STANDBY] = { "standby", PM_SUSPEND_STANDBY },
+-      [PM_SUSPEND_MEM] = { "mem", PM_SUSPEND_MEM },
++      [PM_SUSPEND_FREEZE] = { .label = "freeze", .state = PM_SUSPEND_FREEZE },
++      [PM_SUSPEND_STANDBY] = { .label = "standby", },
++      [PM_SUSPEND_MEM] = { .label = "mem", },
+ };
+ static const struct platform_suspend_ops *suspend_ops;
+@@ -62,42 +62,34 @@ void freeze_wake(void)
+ }
+ EXPORT_SYMBOL_GPL(freeze_wake);
++static bool valid_state(suspend_state_t state)
++{
++      /*
++       * PM_SUSPEND_STANDBY and PM_SUSPEND_MEM states need low level
++       * support and need to be valid to the low level
++       * implementation, no valid callback implies that none are valid.
++       */
++      return suspend_ops && suspend_ops->valid && suspend_ops->valid(state);
++}
++
+ /**
+  * suspend_set_ops - Set the global suspend method table.
+  * @ops: Suspend operations to use.
+  */
+ void suspend_set_ops(const struct platform_suspend_ops *ops)
+ {
++      suspend_state_t i;
++
+       lock_system_sleep();
++
+       suspend_ops = ops;
++      for (i = PM_SUSPEND_STANDBY; i <= PM_SUSPEND_MEM; i++)
++              pm_states[i].state = valid_state(i) ? i : 0;
++
+       unlock_system_sleep();
+ }
+ EXPORT_SYMBOL_GPL(suspend_set_ops);
+-bool valid_state(suspend_state_t state)
+-{
+-      if (state == PM_SUSPEND_FREEZE) {
+-#ifdef CONFIG_PM_DEBUG
+-              if (pm_test_level != TEST_NONE &&
+-                  pm_test_level != TEST_FREEZER &&
+-                  pm_test_level != TEST_DEVICES &&
+-                  pm_test_level != TEST_PLATFORM) {
+-                      printk(KERN_WARNING "Unsupported pm_test mode for "
+-                                      "freeze state, please choose "
+-                                      "none/freezer/devices/platform.\n");
+-                      return false;
+-              }
+-#endif
+-                      return true;
+-      }
+-      /*
+-       * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel
+-       * support and need to be valid to the lowlevel
+-       * implementation, no valid callback implies that none are valid.
+-       */
+-      return suspend_ops && suspend_ops->valid && suspend_ops->valid(state);
+-}
+-
+ /**
+  * suspend_valid_only_mem - Generic memory-only valid callback.
+  *
+@@ -324,9 +316,17 @@ static int enter_state(suspend_state_t s
+ {
+       int error;
+-      if (!valid_state(state))
+-              return -ENODEV;
+-
++      if (state == PM_SUSPEND_FREEZE) {
++#ifdef CONFIG_PM_DEBUG
++              if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
++                      pr_warning("PM: Unsupported test mode for freeze state,"
++                                 "please choose none/freezer/devices/platform.\n");
++                      return -EAGAIN;
++              }
++#endif
++      } else if (!valid_state(state)) {
++              return -EINVAL;
++      }
+       if (!mutex_trylock(&pm_mutex))
+               return -EBUSY;
+--- a/kernel/power/suspend_test.c
++++ b/kernel/power/suspend_test.c
+@@ -162,7 +162,7 @@ static int __init test_suspend(void)
+       /* PM is initialized by now; is that state testable? */
+       if (test_state == PM_SUSPEND_ON)
+               goto done;
+-      if (!valid_state(test_state)) {
++      if (!pm_states[test_state].state) {
+               printk(warn_bad_state, pm_states[test_state].label);
+               goto done;
+       }
diff --git a/queue-3.10/serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch b/queue-3.10/serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch
new file mode 100644 (file)
index 0000000..6839518
--- /dev/null
@@ -0,0 +1,56 @@
+From d4089a332883ad969700aac5dd4dd5f1c4fee825 Mon Sep 17 00:00:00 2001
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Date: Mon, 28 Apr 2014 15:59:56 +0300
+Subject: serial: 8250_dma: check the result of TX buffer mapping
+
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+
+commit d4089a332883ad969700aac5dd4dd5f1c4fee825 upstream.
+
+Using dma_mapping_error() to make sure the mapping did not
+fail.
+
+Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Cc: "Petallo, MauriceX R" <mauricex.r.petallo@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/8250/8250_dma.c |   17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+--- a/drivers/tty/serial/8250/8250_dma.c
++++ b/drivers/tty/serial/8250/8250_dma.c
+@@ -192,21 +192,28 @@ int serial8250_request_dma(struct uart_8
+       dma->rx_buf = dma_alloc_coherent(dma->rxchan->device->dev, dma->rx_size,
+                                       &dma->rx_addr, GFP_KERNEL);
+-      if (!dma->rx_buf) {
+-              dma_release_channel(dma->rxchan);
+-              dma_release_channel(dma->txchan);
+-              return -ENOMEM;
+-      }
++      if (!dma->rx_buf)
++              goto err;
+       /* TX buffer */
+       dma->tx_addr = dma_map_single(dma->txchan->device->dev,
+                                       p->port.state->xmit.buf,
+                                       UART_XMIT_SIZE,
+                                       DMA_TO_DEVICE);
++      if (dma_mapping_error(dma->txchan->device->dev, dma->tx_addr)) {
++              dma_free_coherent(dma->rxchan->device->dev, dma->rx_size,
++                                dma->rx_buf, dma->rx_addr);
++              goto err;
++      }
+       dev_dbg_ratelimited(p->port.dev, "got both dma channels\n");
+       return 0;
++err:
++      dma_release_channel(dma->rxchan);
++      dma_release_channel(dma->txchan);
++
++      return -ENOMEM;
+ }
+ EXPORT_SYMBOL_GPL(serial8250_request_dma);
index 3d1bfa102d9a735cebc353f545cbb3f70cb4fdee..adf17d991ef88d51c2f0860c7d947f8bd347cc04 100644 (file)
@@ -124,3 +124,12 @@ perf-fix-a-race-condition-in-perf_remove_from_context.patch
 perf-kmem-make-it-work-again-on-non-numa-machines.patch
 fix-nasty-32-bit-overflow-bug-in-buffer-i-o-code.patch
 media-cx18-fix-kernel-oops-with-tda8290-tuner.patch
+md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch
+ipvs-avoid-netns-exit-crash-on-ip_vs_conn_drop_conntrack.patch
+ipvs-maintain-all-dscp-and-ecn-bits-for-ipv6-tun-forwarding.patch
+ipvs-fix-ipv6-hook-registration-for-local-replies.patch
+pm-sleep-add-state-field-to-pm_states-entries.patch
+pm-sleep-use-valid_state-for-platform-dependent-sleep-states-only.patch
+netfilter-nf_conntrack-avoid-large-timeout-for-mid-stream-pickup.patch
+arm-7748-1-oabi-handle-faults-when-loading-swi-instruction-from-userspace.patch
+serial-8250_dma-check-the-result-of-tx-buffer-mapping.patch