commit 8524c7870680e93cb3d8f1d3f90f927c3c0686b6
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Fri Aug 10 00:25:22 2012 +0100

    Linux 3.2.27

commit dbf6df1f6b4c2057a0e07b8a0f9c8f041b96f2d0
Author: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Date:   Fri Jul 6 17:19:43 2012 +0900

    pch_uart: Fix parity setting issue
    
    commit 38bd2a1ac736901d1cf4971c78ef952ba92ef78b upstream.
    
    Parity Setting value is reverse.
    E.G. In case of setting ODD parity, EVEN value is set.
    This patch inverts "if" condition.
    
    Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
    Acked-by: Alan Cox <alan@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0eaadc03ba1b2d870cec52f353adaa9c30b65db7
Author: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Date:   Fri Jul 6 17:19:42 2012 +0900

    pch_uart: Fix rx error interrupt setting issue
    
    commit 9539dfb7ac1c84522fe1f79bb7dac2990f3de44a upstream.
    
    Rx Error interrupt(E.G. parity error) is not enabled.
    So, when parity error occurs, error interrupt is not occurred.
    As a result, the received data is not dropped.
    
    This patch adds enable/disable rx error interrupt code.
    
    Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
    Acked-by: Alan Cox <alan@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [Backported by Tomoya MORINGA: adjusted context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 882cd0e86a1640fd70298d13b924c2c9fb8861a7
Author: Alan Cox <alan@linux.intel.com>
Date:   Mon Jul 2 18:51:38 2012 +0100

    pch_uart: Fix missing break for 16 byte fifo
    
    commit 9bc03743fff0770dc5a5324ba92e67cc377f16ca upstream.
    
    Otherwise we fall back to the wrong value.
    
    Reported-by: <dcb314@hotmail.com>
    Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44091
    Signed-off-by: Alan Cox <alan@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d4a6acbb4b73704d018e65cc090be2fd2cc4322b
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Jun 4 00:18:19 2012 +0000

    drop_monitor: dont sleep in atomic context
    
    commit bec4596b4e6770c7037f21f6bd27567b152dc0d6 upstream.
    
    drop_monitor calls several sleeping functions while in atomic context.
    
     BUG: sleeping function called from invalid context at mm/slub.c:943
     in_atomic(): 1, irqs_disabled(): 0, pid: 2103, name: kworker/0:2
     Pid: 2103, comm: kworker/0:2 Not tainted 3.5.0-rc1+ #55
     Call Trace:
      [<ffffffff810697ca>] __might_sleep+0xca/0xf0
      [<ffffffff811345a3>] kmem_cache_alloc_node+0x1b3/0x1c0
      [<ffffffff8105578c>] ? queue_delayed_work_on+0x11c/0x130
      [<ffffffff815343fb>] __alloc_skb+0x4b/0x230
      [<ffffffffa00b0360>] ? reset_per_cpu_data+0x160/0x160 [drop_monitor]
      [<ffffffffa00b022f>] reset_per_cpu_data+0x2f/0x160 [drop_monitor]
      [<ffffffffa00b03ab>] send_dm_alert+0x4b/0xb0 [drop_monitor]
      [<ffffffff810568e0>] process_one_work+0x130/0x4c0
      [<ffffffff81058249>] worker_thread+0x159/0x360
      [<ffffffff810580f0>] ? manage_workers.isra.27+0x240/0x240
      [<ffffffff8105d403>] kthread+0x93/0xa0
      [<ffffffff816be6d4>] kernel_thread_helper+0x4/0x10
      [<ffffffff8105d370>] ? kthread_freezable_should_stop+0x80/0x80
      [<ffffffff816be6d0>] ? gs_change+0xb/0xb
    
    Rework the logic to call the sleeping functions in right context.
    
    Use standard timer/workqueue api to let system chose any cpu to perform
    the allocation and netlink send.
    
    Also avoid a loop if reset_per_cpu_data() cannot allocate memory :
    use mod_timer() to wait 1/10 second before next try.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Neil Horman <nhorman@tuxdriver.com>
    Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1b51d69a5437f82c7345765d602771cb8452f2f6
Author: Neil Horman <nhorman@tuxdriver.com>
Date:   Tue May 1 08:18:02 2012 +0000

    drop_monitor: prevent init path from scheduling on the wrong cpu
    
    commit 4fdcfa12843bca38d0c9deff70c8720e4e8f515f upstream.
    
    I just noticed after some recent updates, that the init path for the drop
    monitor protocol has a minor error.  drop monitor maintains a per cpu structure,
    that gets initalized from a single cpu.  Normally this is fine, as the protocol
    isn't in use yet, but I recently made a change that causes a failed skb
    allocation to reschedule itself .  Given the current code, the implication is
    that this workqueue reschedule will take place on the wrong cpu.  If drop
    monitor is used early during the boot process, its possible that two cpus will
    access a single per-cpu structure in parallel, possibly leading to data
    corruption.
    
    This patch fixes the situation, by storing the cpu number that a given instance
    of this per-cpu data should be accessed from.  In the case of a need for a
    reschedule, the cpu stored in the struct is assigned the rescheule, rather than
    the currently executing cpu
    
    Tested successfully by myself.
    
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
    CC: David Miller <davem@davemloft.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ea39e338f9bb5eb5b3e568cbe7475549d67ef128
Author: Neil Horman <nhorman@tuxdriver.com>
Date:   Fri Apr 27 10:11:49 2012 +0000

    drop_monitor: Make updating data->skb smp safe
    
    commit 3885ca785a3618593226687ced84f3f336dc3860 upstream.
    
    Eric Dumazet pointed out to me that the drop_monitor protocol has some holes in
    its smp protections.  Specifically, its possible to replace data->skb while its
    being written.  This patch corrects that by making data->skb an rcu protected
    variable.  That will prevent it from being overwritten while a tracepoint is
    modifying it.
    
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
    Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
    CC: David Miller <davem@davemloft.net>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit caaf10b6ccdb774387b298f9935dc9a81b4a86bc
Author: Neil Horman <nhorman@tuxdriver.com>
Date:   Fri Apr 27 10:11:48 2012 +0000

    drop_monitor: fix sleeping in invalid context warning
    
    commit cde2e9a651b76d8db36ae94cd0febc82b637e5dd upstream.
    
    Eric Dumazet pointed out this warning in the drop_monitor protocol to me:
    
    [   38.352571] BUG: sleeping function called from invalid context at kernel/mutex.c:85
    [   38.352576] in_atomic(): 1, irqs_disabled(): 0, pid: 4415, name: dropwatch
    [   38.352580] Pid: 4415, comm: dropwatch Not tainted 3.4.0-rc2+ #71
    [   38.352582] Call Trace:
    [   38.352592]  [<ffffffff8153aaf0>] ? trace_napi_poll_hit+0xd0/0xd0
    [   38.352599]  [<ffffffff81063f2a>] __might_sleep+0xca/0xf0
    [   38.352606]  [<ffffffff81655b16>] mutex_lock+0x26/0x50
    [   38.352610]  [<ffffffff8153aaf0>] ? trace_napi_poll_hit+0xd0/0xd0
    [   38.352616]  [<ffffffff810b72d9>] tracepoint_probe_register+0x29/0x90
    [   38.352621]  [<ffffffff8153a585>] set_all_monitor_traces+0x105/0x170
    [   38.352625]  [<ffffffff8153a8ca>] net_dm_cmd_trace+0x2a/0x40
    [   38.352630]  [<ffffffff8154a81a>] genl_rcv_msg+0x21a/0x2b0
    [   38.352636]  [<ffffffff810f8029>] ? zone_statistics+0x99/0xc0
    [   38.352640]  [<ffffffff8154a600>] ? genl_rcv+0x30/0x30
    [   38.352645]  [<ffffffff8154a059>] netlink_rcv_skb+0xa9/0xd0
    [   38.352649]  [<ffffffff8154a5f0>] genl_rcv+0x20/0x30
    [   38.352653]  [<ffffffff81549a7e>] netlink_unicast+0x1ae/0x1f0
    [   38.352658]  [<ffffffff81549d76>] netlink_sendmsg+0x2b6/0x310
    [   38.352663]  [<ffffffff8150824f>] sock_sendmsg+0x10f/0x130
    [   38.352668]  [<ffffffff8150abe0>] ? move_addr_to_kernel+0x60/0xb0
    [   38.352673]  [<ffffffff81515f04>] ? verify_iovec+0x64/0xe0
    [   38.352677]  [<ffffffff81509c46>] __sys_sendmsg+0x386/0x390
    [   38.352682]  [<ffffffff810ffaf9>] ? handle_mm_fault+0x139/0x210
    [   38.352687]  [<ffffffff8165b5bc>] ? do_page_fault+0x1ec/0x4f0
    [   38.352693]  [<ffffffff8106ba4d>] ? set_next_entity+0x9d/0xb0
    [   38.352699]  [<ffffffff81310b49>] ? tty_ldisc_deref+0x9/0x10
    [   38.352703]  [<ffffffff8106d363>] ? pick_next_task_fair+0x63/0x140
    [   38.352708]  [<ffffffff8150b8d4>] sys_sendmsg+0x44/0x80
    [   38.352713]  [<ffffffff8165f8e2>] system_call_fastpath+0x16/0x1b
    
    It stems from holding a spinlock (trace_state_lock) while attempting to register
    or unregister tracepoint hooks, making in_atomic() true in this context, leading
    to the warning when the tracepoint calls might_sleep() while its taking a mutex.
    Since we only use the trace_state_lock to prevent trace protocol state races, as
    well as hardware stat list updates on an rcu write side, we can just convert the
    spinlock to a mutex to avoid this problem.
    
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
    Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
    CC: David Miller <davem@davemloft.net>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6cf299fa153c2933680a21f14c3fd583eb7b4e7c
Author: Jeongdo Son <sohn9086@gmail.com>
Date:   Fri Jun 15 02:28:01 2012 +0900

    rt2x00: Add support for BUFFALO WLI-UC-GNM2 to rt2800usb.
    
    commit a769f9577232afe2c754606a83aad85127e7052a upstream.
    
    This is a RT3070 based device.
    
    Signed-off-by: Jeongdo Son <sohn9086@gmail.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 38aa85100f8fa221dbaae7c4ac99ace6cbbcdeef
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Thu Jun 21 15:13:50 2012 -0700

    drm/i915: prefer wide & slow to fast & narrow in DP configs
    
    commit 2514bc510d0c3aadcc5204056bb440fa36845147 upstream.
    
    High frequency link configurations have the potential to cause trouble
    with long and/or cheap cables, so prefer slow and wide configurations
    instead.  This patch has the potential to cause trouble for eDP
    configurations that lie about available lanes, so if we run into that we
    can make it conditional on eDP.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45801
    Tested-by: peter@colberg.org
    Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 56c5dc342e25deddf6fdfbed82a1b9d9bc118113
Author: Andreas Schwab <schwab@linux-m68k.org>
Date:   Sat Jul 28 00:20:34 2012 +0200

    m68k: Make sys_atomic_cmpxchg_32 work on classic m68k
    
    commit 9e2760d18b3cf179534bbc27692c84879c61b97c upstream.
    
    User space access must always go through uaccess accessors, since on
    classic m68k user space and kernel space are completely separate.
    
    Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
    Tested-by: Thorsten Glaser <tg@debian.org>
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 922c97919db25e0950d180affa68d52af087a161
Author: Boaz Harrosh <bharrosh@panasas.com>
Date:   Wed Aug 1 17:48:36 2012 +0300

    ore: Fix out-of-bounds access in _ios_obj()
    
    commit 9e62bb4458ad2cf28bd701aa5fab380b846db326 upstream.
    
    _ios_obj() is accessed by group_index not device_table index.
    
    The oc->comps array is only a group_full of devices at a time
    it is not like ore_comp_dev() which is indexed by a global
    device_table index.
    
    This did not BUG until now because exofs only uses a single
    COMP for all devices. But with other FSs like PanFS this is
    not true.
    
    This bug was only in the write_path, all other users were
    using it correctly
    
    [This is a bug since 3.2 Kernel]
    
    Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 18fbe5a70ce1b692f2171bd4afe13c334ec778fc
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 2 09:04:39 2012 +0200

    ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC
    
    commit 707fba3fa76a4c8855552f5d4c1a12430c09bce8 upstream.
    
    Lenovo Thinkpad T530 with ALC269VC codec has a dock port but BIOS
    doesn't set up the pins properly.  Enable the pins as well as on
    Thinkpad X230 Tablet.
    
    Reported-and-tested-by: Mario <anyc@hadiko.de>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 768049e31e0ee380d0fc6884f691aca6bc397fd9
Author: Daniel Mack <zonque@gmail.com>
Date:   Wed Aug 1 10:16:53 2012 +0200

    ALSA: snd-usb: fix clock source validity index
    
    commit aff252a848ce21b431ba822de3dab9c4c94571cb upstream.
    
    uac_clock_source_is_valid() uses the control selector value to access
    the bmControls bitmap of the clock source unit. This is wrong, as
    control selector values start from 1, while the bitmap uses all
    available bits.
    
    In other words, "Clock Validity Control" is stored in D3..2, not D5..4
    of the clock selector unit's bmControls.
    
    Signed-off-by: Daniel Mack <zonque@gmail.com>
    Reported-by: Andreas Koch <andreas@akdesigninc.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6f72a41f67bb23a6478a0277d97f563830d3f25d
Author: Mel Gorman <mgorman@suse.de>
Date:   Tue Jul 31 16:46:20 2012 -0700

    mm: hugetlbfs: close race during teardown of hugetlbfs shared page tables
    
    commit d833352a4338dc31295ed832a30c9ccff5c7a183 upstream.
    
    If a process creates a large hugetlbfs mapping that is eligible for page
    table sharing and forks heavily with children some of whom fault and
    others which destroy the mapping then it is possible for page tables to
    get corrupted.  Some teardowns of the mapping encounter a "bad pmd" and
    output a message to the kernel log.  The final teardown will trigger a
    BUG_ON in mm/filemap.c.
    
    This was reproduced in 3.4 but is known to have existed for a long time
    and goes back at least as far as 2.6.37.  It was probably was introduced
    in 2.6.20 by [39dde65c: shared page table for hugetlb page].  The messages
    look like this;
    
    [  ..........] Lots of bad pmd messages followed by this
    [  127.164256] mm/memory.c:391: bad pmd ffff880412e04fe8(80000003de4000e7).
    [  127.164257] mm/memory.c:391: bad pmd ffff880412e04ff0(80000003de6000e7).
    [  127.164258] mm/memory.c:391: bad pmd ffff880412e04ff8(80000003de0000e7).
    [  127.186778] ------------[ cut here ]------------
    [  127.186781] kernel BUG at mm/filemap.c:134!
    [  127.186782] invalid opcode: 0000 [#1] SMP
    [  127.186783] CPU 7
    [  127.186784] Modules linked in: af_packet cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq mperf ext3 jbd dm_mod coretemp crc32c_intel usb_storage ghash_clmulni_intel aesni_intel i2c_i801 r8169 mii uas sr_mod cdrom sg iTCO_wdt iTCO_vendor_support shpchp serio_raw cryptd aes_x86_64 e1000e pci_hotplug dcdbas aes_generic container microcode ext4 mbcache jbd2 crc16 sd_mod crc_t10dif i915 drm_kms_helper drm i2c_algo_bit ehci_hcd ahci libahci usbcore rtc_cmos usb_common button i2c_core intel_agp video intel_gtt fan processor thermal thermal_sys hwmon ata_generic pata_atiixp libata scsi_mod
    [  127.186801]
    [  127.186802] Pid: 9017, comm: hugetlbfs-test Not tainted 3.4.0-autobuild #53 Dell Inc. OptiPlex 990/06D7TR
    [  127.186804] RIP: 0010:[<ffffffff810ed6ce>]  [<ffffffff810ed6ce>] __delete_from_page_cache+0x15e/0x160
    [  127.186809] RSP: 0000:ffff8804144b5c08  EFLAGS: 00010002
    [  127.186810] RAX: 0000000000000001 RBX: ffffea000a5c9000 RCX: 00000000ffffffc0
    [  127.186811] RDX: 0000000000000000 RSI: 0000000000000009 RDI: ffff88042dfdad00
    [  127.186812] RBP: ffff8804144b5c18 R08: 0000000000000009 R09: 0000000000000003
    [  127.186813] R10: 0000000000000000 R11: 000000000000002d R12: ffff880412ff83d8
    [  127.186814] R13: ffff880412ff83d8 R14: 0000000000000000 R15: ffff880412ff83d8
    [  127.186815] FS:  00007fe18ed2c700(0000) GS:ffff88042dce0000(0000) knlGS:0000000000000000
    [  127.186816] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [  127.186817] CR2: 00007fe340000503 CR3: 0000000417a14000 CR4: 00000000000407e0
    [  127.186818] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [  127.186819] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    [  127.186820] Process hugetlbfs-test (pid: 9017, threadinfo ffff8804144b4000, task ffff880417f803c0)
    [  127.186821] Stack:
    [  127.186822]  ffffea000a5c9000 0000000000000000 ffff8804144b5c48 ffffffff810ed83b
    [  127.186824]  ffff8804144b5c48 000000000000138a 0000000000001387 ffff8804144b5c98
    [  127.186825]  ffff8804144b5d48 ffffffff811bc925 ffff8804144b5cb8 0000000000000000
    [  127.186827] Call Trace:
    [  127.186829]  [<ffffffff810ed83b>] delete_from_page_cache+0x3b/0x80
    [  127.186832]  [<ffffffff811bc925>] truncate_hugepages+0x115/0x220
    [  127.186834]  [<ffffffff811bca43>] hugetlbfs_evict_inode+0x13/0x30
    [  127.186837]  [<ffffffff811655c7>] evict+0xa7/0x1b0
    [  127.186839]  [<ffffffff811657a3>] iput_final+0xd3/0x1f0
    [  127.186840]  [<ffffffff811658f9>] iput+0x39/0x50
    [  127.186842]  [<ffffffff81162708>] d_kill+0xf8/0x130
    [  127.186843]  [<ffffffff81162812>] dput+0xd2/0x1a0
    [  127.186845]  [<ffffffff8114e2d0>] __fput+0x170/0x230
    [  127.186848]  [<ffffffff81236e0e>] ? rb_erase+0xce/0x150
    [  127.186849]  [<ffffffff8114e3ad>] fput+0x1d/0x30
    [  127.186851]  [<ffffffff81117db7>] remove_vma+0x37/0x80
    [  127.186853]  [<ffffffff81119182>] do_munmap+0x2d2/0x360
    [  127.186855]  [<ffffffff811cc639>] sys_shmdt+0xc9/0x170
    [  127.186857]  [<ffffffff81410a39>] system_call_fastpath+0x16/0x1b
    [  127.186858] Code: 0f 1f 44 00 00 48 8b 43 08 48 8b 00 48 8b 40 28 8b b0 40 03 00 00 85 f6 0f 88 df fe ff ff 48 89 df e8 e7 cb 05 00 e9 d2 fe ff ff <0f> 0b 55 83 e2 fd 48 89 e5 48 83 ec 30 48 89 5d d8 4c 89 65 e0
    [  127.186868] RIP  [<ffffffff810ed6ce>] __delete_from_page_cache+0x15e/0x160
    [  127.186870]  RSP <ffff8804144b5c08>
    [  127.186871] ---[ end trace 7cbac5d1db69f426 ]---
    
    The bug is a race and not always easy to reproduce.  To reproduce it I was
    doing the following on a single socket I7-based machine with 16G of RAM.
    
    $ hugeadm --pool-pages-max DEFAULT:13G
    $ echo $((18*1048576*1024)) > /proc/sys/kernel/shmmax
    $ echo $((18*1048576*1024)) > /proc/sys/kernel/shmall
    $ for i in `seq 1 9000`; do ./hugetlbfs-test; done
    
    On my particular machine, it usually triggers within 10 minutes but
    enabling debug options can change the timing such that it never hits.
    Once the bug is triggered, the machine is in trouble and needs to be
    rebooted.  The machine will respond but processes accessing proc like "ps
    aux" will hang due to the BUG_ON.  shutdown will also hang and needs a
    hard reset or a sysrq-b.
    
    The basic problem is a race between page table sharing and teardown.  For
    the most part page table sharing depends on i_mmap_mutex.  In some cases,
    it is also taking the mm->page_table_lock for the PTE updates but with
    shared page tables, it is the i_mmap_mutex that is more important.
    
    Unfortunately it appears to be also insufficient. Consider the following
    situation
    
    Process A					Process B
    ---------					---------
    hugetlb_fault					shmdt
      						LockWrite(mmap_sem)
        						  do_munmap
    						    unmap_region
    						      unmap_vmas
    						        unmap_single_vma
    						          unmap_hugepage_range
          						            Lock(i_mmap_mutex)
    							    Lock(mm->page_table_lock)
    							    huge_pmd_unshare/unmap tables <--- (1)
    							    Unlock(mm->page_table_lock)
          						            Unlock(i_mmap_mutex)
      huge_pte_alloc				      ...
        Lock(i_mmap_mutex)				      ...
        vma_prio_walk, find svma, spte		      ...
        Lock(mm->page_table_lock)			      ...
        share spte					      ...
        Unlock(mm->page_table_lock)			      ...
        Unlock(i_mmap_mutex)			      ...
      hugetlb_no_page									  <--- (2)
    						      free_pgtables
    						        unlink_file_vma
    							hugetlb_free_pgd_range
    						    remove_vma_list
    
    In this scenario, it is possible for Process A to share page tables with
    Process B that is trying to tear them down.  The i_mmap_mutex on its own
    does not prevent Process A walking Process B's page tables.  At (1) above,
    the page tables are not shared yet so it unmaps the PMDs.  Process A sets
    up page table sharing and at (2) faults a new entry.  Process B then trips
    up on it in free_pgtables.
    
    This patch fixes the problem by adding a new function
    __unmap_hugepage_range_final that is only called when the VMA is about to
    be destroyed.  This function clears VM_MAYSHARE during
    unmap_hugepage_range() under the i_mmap_mutex.  This makes the VMA
    ineligible for sharing and avoids the race.  Superficially this looks like
    it would then be vunerable to truncate and madvise issues but hugetlbfs
    has its own truncate handlers so does not use unmap_mapping_range() and
    does not support madvise(DONTNEED).
    
    This should be treated as a -stable candidate if it is merged.
    
    Test program is as follows. The test case was mostly written by Michal
    Hocko with a few minor changes to reproduce this bug.
    
    ==== CUT HERE ====
    
    static size_t huge_page_size = (2UL << 20);
    static size_t nr_huge_page_A = 512;
    static size_t nr_huge_page_B = 5632;
    
    unsigned int get_random(unsigned int max)
    {
    	struct timeval tv;
    
    	gettimeofday(&tv, NULL);
    	srandom(tv.tv_usec);
    	return random() % max;
    }
    
    static void play(void *addr, size_t size)
    {
    	unsigned char *start = addr,
    		      *end = start + size,
    		      *a;
    	start += get_random(size/2);
    
    	/* we could itterate on huge pages but let's give it more time. */
    	for (a = start; a < end; a += 4096)
    		*a = 0;
    }
    
    int main(int argc, char **argv)
    {
    	key_t key = IPC_PRIVATE;
    	size_t sizeA = nr_huge_page_A * huge_page_size;
    	size_t sizeB = nr_huge_page_B * huge_page_size;
    	int shmidA, shmidB;
    	void *addrA = NULL, *addrB = NULL;
    	int nr_children = 300, n = 0;
    
    	if ((shmidA = shmget(key, sizeA, IPC_CREAT|SHM_HUGETLB|0660)) == -1) {
    		perror("shmget:");
    		return 1;
    	}
    
    	if ((addrA = shmat(shmidA, addrA, SHM_R|SHM_W)) == (void *)-1UL) {
    		perror("shmat");
    		return 1;
    	}
    	if ((shmidB = shmget(key, sizeB, IPC_CREAT|SHM_HUGETLB|0660)) == -1) {
    		perror("shmget:");
    		return 1;
    	}
    
    	if ((addrB = shmat(shmidB, addrB, SHM_R|SHM_W)) == (void *)-1UL) {
    		perror("shmat");
    		return 1;
    	}
    
    fork_child:
    	switch(fork()) {
    		case 0:
    			switch (n%3) {
    			case 0:
    				play(addrA, sizeA);
    				break;
    			case 1:
    				play(addrB, sizeB);
    				break;
    			case 2:
    				break;
    			}
    			break;
    		case -1:
    			perror("fork:");
    			break;
    		default:
    			if (++n < nr_children)
    				goto fork_child;
    			play(addrA, sizeA);
    			break;
    	}
    	shmdt(addrA);
    	shmdt(addrB);
    	do {
    		wait(NULL);
    	} while (--n > 0);
    	shmctl(shmidA, IPC_RMID, NULL);
    	shmctl(shmidB, IPC_RMID, NULL);
    	return 0;
    }
    
    [akpm@linux-foundation.org: name the declaration's args, fix CONFIG_HUGETLBFS=n build]
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Reviewed-by: Michal Hocko <mhocko@suse.cz>
    Signed-off-by: Mel Gorman <mgorman@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [bwh: Backported to 3.2:
     - Adjust context
     - Drop the mmu_gather * parameters]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5d7a60687ef06b2de46f4d2415863a2dffae96e5
Author: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Date:   Tue Jul 31 16:45:52 2012 -0700

    mm: mmu_notifier: fix freed page still mapped in secondary MMU
    
    commit 3ad3d901bbcfb15a5e4690e55350db0899095a68 upstream.
    
    mmu_notifier_release() is called when the process is exiting.  It will
    delete all the mmu notifiers.  But at this time the page belonging to the
    process is still present in page tables and is present on the LRU list, so
    this race will happen:
    
          CPU 0                 CPU 1
    mmu_notifier_release:    try_to_unmap:
       hlist_del_init_rcu(&mn->hlist);
                                ptep_clear_flush_notify:
                                      mmu nofifler not found
                                free page  !!!!!!
                                /*
                                 * At the point, the page has been
                                 * freed, but it is still mapped in
                                 * the secondary MMU.
                                 */
    
      mn->ops->release(mn, mm);
    
    Then the box is not stable and sometimes we can get this bug:
    
    [  738.075923] BUG: Bad page state in process migrate-perf  pfn:03bec
    [  738.075931] page:ffffea00000efb00 count:0 mapcount:0 mapping:          (null) index:0x8076
    [  738.075936] page flags: 0x20000000000014(referenced|dirty)
    
    The same issue is present in mmu_notifier_unregister().
    
    We can call ->release before deleting the notifier to ensure the page has
    been unmapped from the secondary MMU before it is freed.
    
    Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
    Cc: Avi Kivity <avi@redhat.com>
    Cc: Marcelo Tosatti <mtosatti@redhat.com>
    Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3927df7e5035769cea8c6646ebd28d9fdab86057
Author: Xishi Qiu <qiuxishi@huawei.com>
Date:   Tue Jul 31 16:43:19 2012 -0700

    mm: setup pageblock_order before it's used by sparsemem
    
    commit ca57df79d4f64e1a4886606af4289d40636189c5 upstream.
    
    On architectures with CONFIG_HUGETLB_PAGE_SIZE_VARIABLE set, such as
    Itanium, pageblock_order is a variable with default value of 0.  It's set
    to the right value by set_pageblock_order() in function
    free_area_init_core().
    
    But pageblock_order may be used by sparse_init() before free_area_init_core()
    is called along path:
    sparse_init()
        ->sparse_early_usemaps_alloc_node()
    	->usemap_size()
    	    ->SECTION_BLOCKFLAGS_BITS
    		->((1UL << (PFN_SECTION_SHIFT - pageblock_order)) *
    NR_PAGEBLOCK_BITS)
    
    The uninitialized pageblock_size will cause memory wasting because
    usemap_size() returns a much bigger value then it's really needed.
    
    For example, on an Itanium platform,
    sparse_init() pageblock_order=0 usemap_size=24576
    free_area_init_core() before pageblock_order=0, usemap_size=24576
    free_area_init_core() after pageblock_order=12, usemap_size=8
    
    That means 24K memory has been wasted for each section, so fix it by calling
    set_pageblock_order() from sparse_init().
    
    Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
    Signed-off-by: Jiang Liu <liuj97@gmail.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Yinghai Lu <yinghai@kernel.org>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Keping Chen <chenkeping@huawei.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 27c4b68bb5e9b5dd81ae5e156e4094643d127608
Author: Andrew Morton <akpm@linux-foundation.org>
Date:   Tue May 29 15:06:31 2012 -0700

    mm/page_alloc.c: remove pageblock_default_order()
    
    commit 955c1cd7401565671b064e499115344ec8067dfd upstream.
    
    This has always been broken: one version takes an unsigned int and the
    other version takes no arguments.  This bug was hidden because one
    version of set_pageblock_order() was a macro which doesn't evaluate its
    argument.
    
    Simplify it all and remove pageblock_default_order() altogether.
    
    Reported-by: rajman mekaco <rajman.mekaco@gmail.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Minchan Kim <minchan.kim@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2145a2c9d596f59f6dd32932c98f9a1025bbb3b8
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Mon Jul 30 18:24:19 2012 +0100

    ASoC: wm8962: Allow VMID time to fully ramp
    
    commit 9d40e5582c9c4cfb6977ba2a0ca9c2ed82c56f21 upstream.
    
    Required for reliable power up from cold.
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0776e23d7f8f42487a5c0fd42679cef115add2bc
Author: Colin Ian King <colin.king@canonical.com>
Date:   Mon Jul 30 16:06:42 2012 +0100

    USB: echi-dbgp: increase the controller wait time to come out of halt.
    
    commit f96a4216e85050c0a9d41a41ecb0ae9d8e39b509 upstream.
    
    The default 10 microsecond delay for the controller to come out of
    halt in dbgp_ehci_startup is too short, so increase it to 1 millisecond.
    
    This is based on emperical testing on various USB debug ports on
    modern machines such as a Lenovo X220i and an Ivybridge development
    platform that needed to wait ~450-950 microseconds.
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 83358b9b1d3438293794224b14787a806031cf98
Author: Russell King <rmk+kernel@arm.linux.org.uk>
Date:   Mon Jul 30 19:42:10 2012 +0100

    ARM: Fix undefined instruction exception handling
    
    commit 15ac49b65024f55c4371a53214879a9c77c4fbf9 upstream.
    
    While trying to get a v3.5 kernel booted on the cubox, I noticed that
    VFP does not work correctly with VFP bounce handling.  This is because
    of the confusion over 16-bit vs 32-bit instructions, and where PC is
    supposed to point to.
    
    The rule is that FP handlers are entered with regs->ARM_pc pointing at
    the _next_ instruction to be executed.  However, if the exception is
    not handled, regs->ARM_pc points at the faulting instruction.
    
    This is easy for ARM mode, because we know that the next instruction and
    previous instructions are separated by four bytes.  This is not true of
    Thumb2 though.
    
    Since all FP instructions are 32-bit in Thumb2, it makes things easy.
    We just need to select the appropriate adjustment.  Do this by moving
    the adjustment out of do_undefinstr() into the assembly code, as only
    the assembly code knows whether it's dealing with a 32-bit or 16-bit
    instruction.
    
    Acked-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1b48195822f358b7b5e44369cfa34463f0b9e09f
Author: Will Deacon <will.deacon@arm.com>
Date:   Fri Jul 20 18:24:55 2012 +0100

    ARM: 7478/1: errata: extend workaround for erratum #720789
    
    commit 5a783cbc48367cfc7b65afc75430953dfe60098f upstream.
    
    Commit cdf357f1 ("ARM: 6299/1: errata: TLBIASIDIS and TLBIMVAIS
    operations can broadcast a faulty ASID") replaced by-ASID TLB flushing
    operations with all-ASID variants to workaround A9 erratum #720789.
    
    This patch extends the workaround to include the tlb_range operations,
    which were overlooked by the original patch.
    
    Tested-by: Steve Capper <steve.capper@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cdab6eed39be615703f582831765e14fb0452842
Author: Colin Cross <ccross@android.com>
Date:   Fri Jul 20 02:03:42 2012 +0100

    ARM: 7477/1: vfp: Always save VFP state in vfp_pm_suspend on UP
    
    commit 24b35521b8ddf088531258f06f681bb7b227bf47 upstream.
    
    vfp_pm_suspend should save the VFP state in suspend after
    any lazy context switch.  If it only saves when the VFP is enabled,
    the state can get lost when, on a UP system:
      Thread 1 uses the VFP
      Context switch occurs to thread 2, VFP is disabled but the
         VFP context is not saved
      Thread 2 initiates suspend
      vfp_pm_suspend is called with the VFP disabled, and the unsaved
         VFP context of Thread 1 in the registers
    
    Modify vfp_pm_suspend to save the VFP context whenever
    vfp_current_hw_state is not NULL.
    
    Includes a fix from Ido Yariv <ido@wizery.com>, who pointed out that on
    SMP systems, the state pointer can be pointing to a freed task struct if
    a task exited on another cpu, fixed by using #ifndef CONFIG_SMP in the
    new if clause.
    
    Cc: Barry Song <bs14@csr.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Ido Yariv <ido@wizery.com>
    Cc: Daniel Drake <dsd@laptop.org>
    Cc: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Colin Cross <ccross@android.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fc257bc543a3b08545e2332574a12893f0e54c85
Author: Colin Cross <ccross@android.com>
Date:   Fri Jul 20 02:03:43 2012 +0100

    ARM: 7476/1: vfp: only clear vfp state for current cpu in vfp_pm_suspend
    
    commit a84b895a2348f0dbff31b71ddf954f70a6cde368 upstream.
    
    vfp_pm_suspend runs on each cpu, only clear the hardware state
    pointer for the current cpu.  Prevents a possible crash if one
    cpu clears the hw state pointer when another cpu has already
    checked if it is valid.
    
    Signed-off-by: Colin Cross <ccross@android.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c51cf2421d129a98183c2e9fd2209fa96297f118
Author: Will Deacon <will.deacon@arm.com>
Date:   Fri Jul 13 19:15:40 2012 +0100

    ARM: 7467/1: mutex: use generic xchg-based implementation for ARMv6+
    
    commit a76d7bd96d65fa5119adba97e1b58d95f2e78829 upstream.
    
    The open-coded mutex implementation for ARMv6+ cores suffers from a
    severe lack of barriers, so in the uncontended case we don't actually
    protect any accesses performed during the critical section.
    
    Furthermore, the code is largely a duplication of the ARMv6+ atomic_dec
    code but optimised to remove a branch instruction, as the mutex fastpath
    was previously inlined. Now that this is executed out-of-line, we can
    reuse the atomic access code for the locking (in fact, we use the xchg
    code as this produces shorter critical sections).
    
    This patch uses the generic xchg based implementation for mutexes on
    ARMv6+, which introduces barriers to the lock/unlock operations and also
    has the benefit of removing a fair amount of inline assembly code.
    
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Nicolas Pitre <nico@linaro.org>
    Reported-by: Shan Kang <kangshan0910@gmail.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2bd8f381a4382eaeef391e0a551230610bece057
Author: Shawn Guo <shawn.guo@linaro.org>
Date:   Fri Jul 13 08:19:34 2012 +0100

    ARM: 7466/1: disable interrupt before spinning endlessly
    
    commit 98bd8b96b26db3399a48202318dca4aaa2515355 upstream.
    
    The CPU will endlessly spin at the end of machine_halt and
    machine_restart calls.  However, this will lead to a soft lockup
    warning after about 20 seconds, if CONFIG_LOCKUP_DETECTOR is enabled,
    as system timer is still alive.
    
    Disable interrupt before going to spin endlessly, so that the lockup
    warning will never be seen.
    
    Reported-by: Marek Vasut <marex@denx.de>
    Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit baea16318bd48dbee1e0f1a5ca05ba932b64927a
Author: Stanislav Kinsbursky <skinsbursky@parallels.com>
Date:   Fri Jul 20 15:57:48 2012 +0400

    SUNRPC: return negative value in case rpcbind client creation error
    
    commit caea33da898e4e14f0ba58173e3b7689981d2c0b upstream.
    
    Without this patch kernel will panic on LockD start, because lockd_up() checks
    lockd_up_net() result for negative value.
    From my pow it's better to return negative value from rpcbind routines instead
    of replacing all such checks like in lockd_up().
    
    Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 58546c72065b70c1f4106a2f3126680cf6800af6
Author: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Date:   Mon Jul 30 14:42:07 2012 -0700

    nilfs2: fix deadlock issue between chcp and thaw ioctls
    
    commit 572d8b3945a31bee7c40d21556803e4807fd9141 upstream.
    
    An fs-thaw ioctl causes deadlock with a chcp or mkcp -s command:
    
     chcp            D ffff88013870f3d0     0  1325   1324 0x00000004
     ...
     Call Trace:
       nilfs_transaction_begin+0x11c/0x1a0 [nilfs2]
       wake_up_bit+0x20/0x20
       copy_from_user+0x18/0x30 [nilfs2]
       nilfs_ioctl_change_cpmode+0x7d/0xcf [nilfs2]
       nilfs_ioctl+0x252/0x61a [nilfs2]
       do_page_fault+0x311/0x34c
       get_unmapped_area+0x132/0x14e
       do_vfs_ioctl+0x44b/0x490
       __set_task_blocked+0x5a/0x61
       vm_mmap_pgoff+0x76/0x87
       __set_current_blocked+0x30/0x4a
       sys_ioctl+0x4b/0x6f
       system_call_fastpath+0x16/0x1b
     thaw            D ffff88013870d890     0  1352   1351 0x00000004
     ...
     Call Trace:
       rwsem_down_failed_common+0xdb/0x10f
       call_rwsem_down_write_failed+0x13/0x20
       down_write+0x25/0x27
       thaw_super+0x13/0x9e
       do_vfs_ioctl+0x1f5/0x490
       vm_mmap_pgoff+0x76/0x87
       sys_ioctl+0x4b/0x6f
       filp_close+0x64/0x6c
       system_call_fastpath+0x16/0x1b
    
    where the thaw ioctl deadlocked at thaw_super() when called while chcp was
    waiting at nilfs_transaction_begin() called from
    nilfs_ioctl_change_cpmode().  This deadlock is 100% reproducible.
    
    This is because nilfs_ioctl_change_cpmode() first locks sb->s_umount in
    read mode and then waits for unfreezing in nilfs_transaction_begin(),
    whereas thaw_super() locks sb->s_umount in write mode.  The locking of
    sb->s_umount here was intended to make snapshot mounts and the downgrade
    of snapshots to checkpoints exclusive.
    
    This fixes the deadlock issue by replacing the sb->s_umount usage in
    nilfs_ioctl_change_cpmode() with a dedicated mutex which protects snapshot
    mounts.
    
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Cc: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1b772a147a183c09462f0d23e041b077f158fa0f
Author: Dan Rosenberg <drosenberg@vsecurity.com>
Date:   Mon Jul 30 14:40:26 2012 -0700

    lib/vsprintf.c: kptr_restrict: fix pK-error in SysRq show-all-timers(Q)
    
    commit 3715c5309f6d175c3053672b73fd4f73be16fd07 upstream.
    
    When using ALT+SysRq+Q all the pointers are replaced with "pK-error" like
    this:
    
    	[23153.208033]   .base:               pK-error
    
    with echo h > /proc/sysrq-trigger it works:
    
    	[23107.776363]   .base:       ffff88023e60d540
    
    The intent behind this behavior was to return "pK-error" in cases where
    the %pK format specifier was used in interrupt context, because the
    CAP_SYSLOG check wouldn't be meaningful.  Clearly this should only apply
    when kptr_restrict is actually enabled though.
    
    Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>
    Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ffb709e6aa95c3ba44fa8af9f7815e3c6cfed04e
Author: Greg Pearson <greg.pearson@hp.com>
Date:   Mon Jul 30 14:39:05 2012 -0700

    pcdp: use early_ioremap/early_iounmap to access pcdp table
    
    commit 6c4088ac3a4d82779903433bcd5f048c58fb1aca upstream.
    
    efi_setup_pcdp_console() is called during boot to parse the HCDP/PCDP
    EFI system table and setup an early console for printk output.  The
    routine uses ioremap/iounmap to setup access to the HCDP/PCDP table
    information.
    
    The call to ioremap is happening early in the boot process which leads
    to a panic on x86_64 systems:
    
        panic+0x01ca
        do_exit+0x043c
        oops_end+0x00a7
        no_context+0x0119
        __bad_area_nosemaphore+0x0138
        bad_area_nosemaphore+0x000e
        do_page_fault+0x0321
        page_fault+0x0020
        reserve_memtype+0x02a1
        __ioremap_caller+0x0123
        ioremap_nocache+0x0012
        efi_setup_pcdp_console+0x002b
        setup_arch+0x03a9
        start_kernel+0x00d4
        x86_64_start_reservations+0x012c
        x86_64_start_kernel+0x00fe
    
    This replaces the calls to ioremap/iounmap in efi_setup_pcdp_console()
    with calls to early_ioremap/early_iounmap which can be called during
    early boot.
    
    This patch was tested on an x86_64 prototype system which uses the
    HCDP/PCDP table for early console setup.
    
    Signed-off-by: Greg Pearson <greg.pearson@hp.com>
    Acked-by: Khalid Aziz <khalid.aziz@hp.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 898ece8e5e5102c627f8f2ef26d281f71b439169
Author: NeilBrown <neilb@suse.de>
Date:   Tue Jul 31 10:05:34 2012 +1000

    md/raid1: don't abort a resync on the first badblock.
    
    commit b7219ccb33aa0df9949a60c68b5e9f712615e56f upstream.
    
    If a resync of a RAID1 array with 2 devices finds a known bad block
    one device it will neither read from, or write to, that device for
    this block offset.
    So there will be one read_target (The other device) and zero write
    targets.
    This condition causes md/raid1 to abort the resync assuming that it
    has finished - without known bad blocks this would be true.
    
    When there are no write targets because of the presence of bad blocks
    we should only skip over the area covered by the bad block.
    RAID10 already gets this right, raid1 doesn't.  Or didn't.
    
    As this can cause a 'sync' to abort early and appear to have succeeded
    it could lead to some data corruption, so it suitable for -stable.
    
    Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com>
    Signed-off-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1c88c581bfe3afd2d21a14b6dee7011af8512f91
Author: Jeff Layton <jlayton@redhat.com>
Date:   Mon Jul 23 13:58:51 2012 -0400

    nfs: skip commit in releasepage if we're freeing memory for fs-related reasons
    
    commit 5cf02d09b50b1ee1c2d536c9cf64af5a7d433f56 upstream.
    
    We've had some reports of a deadlock where rpciod ends up with a stack
    trace like this:
    
        PID: 2507   TASK: ffff88103691ab40  CPU: 14  COMMAND: "rpciod/14"
         #0 [ffff8810343bf2f0] schedule at ffffffff814dabd9
         #1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs]
         #2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f
         #3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8
         #4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs]
         #5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs]
         #6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670
         #7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271
         #8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638
         #9 [ffff8810343bf818] shrink_zone at ffffffff8112788f
        #10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e
        #11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f
        #12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad
        #13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942
        #14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a
        #15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9
        #16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b
        #17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808
        #18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c
        #19 [ffff8810343bfce8] inet_create at ffffffff81483ba6
        #20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7
        #21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc]
        #22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc]
        #23 [ffff8810343bfe38] worker_thread at ffffffff810887d0
        #24 [ffff8810343bfee8] kthread at ffffffff8108dd96
        #25 [ffff8810343bff48] kernel_thread at ffffffff8100c1ca
    
    rpciod is trying to allocate memory for a new socket to talk to the
    server. The VM ends up calling ->releasepage to get more memory, and it
    tries to do a blocking commit. That commit can't succeed however without
    a connected socket, so we deadlock.
    
    Fix this by setting PF_FSTRANS on the workqueue task prior to doing the
    socket allocation, and having nfs_release_page check for that flag when
    deciding whether to do a commit call. Also, set PF_FSTRANS
    unconditionally in rpc_async_schedule since that function can also do
    allocations sometimes.
    
    Signed-off-by: Jeff Layton <jlayton@redhat.com>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c929e9bc8cadd3dd1e914498e3905d3d4cc43f85
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Fri Jul 27 09:45:39 2012 +0200

    s390/mm: fix fault handling for page table walk case
    
    commit 008c2e8f247f0a8db1e8e26139da12f3a3abcda0 upstream.
    
    Make sure the kernel does not incorrectly create a SIGBUS signal during
    user space accesses:
    
    For user space accesses in the switched addressing mode case the kernel
    may walk page tables and access user address space via the kernel
    mapping. If a page table entry is invalid the function __handle_fault()
    gets called in order to emulate a page fault and trigger all the usual
    actions like paging in a missing page etc. by calling handle_mm_fault().
    
    If handle_mm_fault() returns with an error fixup handling is necessary.
    For the switched addressing mode case all errors need to be mapped to
    -EFAULT, so that the calling uaccess function can return -EFAULT to
    user space.
    
    Unfortunately the __handle_fault() incorrectly calls do_sigbus() if
    VM_FAULT_SIGBUS is set. This however should only happen if a page fault
    was triggered by a user space instruction. For kernel mode uaccesses
    the correct action is to only return -EFAULT.
    So user space may incorrectly see SIGBUS signals because of this bug.
    
    For current machines this would only be possible for the switched
    addressing mode case in conjunction with futex operations.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    [bwh: Backported to 3.2: do_exception() and do_sigbus() parameters differ]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e551857183b52b1af787e35b25a4e556fa0c0c75
Author: Asias He <asias@redhat.com>
Date:   Fri May 25 16:03:27 2012 +0800

    virtio-blk: Use block layer provided spinlock
    
    commit 2c95a3290919541b846bee3e0fbaa75860929f53 upstream.
    
    Block layer will allocate a spinlock for the queue if the driver does
    not provide one in blk_init_queue().
    
    The reason to use the internal spinlock is that blk_cleanup_queue() will
    switch to use the internal spinlock in the cleanup code path.
    
            if (q->queue_lock != &q->__queue_lock)
                    q->queue_lock = &q->__queue_lock;
    
    However, processes which are in D state might have taken the driver
    provided spinlock, when the processes wake up, they would release the
    block provided spinlock.
    
    =====================================
    [ BUG: bad unlock balance detected! ]
    3.4.0-rc7+ #238 Not tainted
    -------------------------------------
    fio/3587 is trying to release lock (&(&q->__queue_lock)->rlock) at:
    [<ffffffff813274d2>] blk_queue_bio+0x2a2/0x380
    but there are no more locks to release!
    
    other info that might help us debug this:
    1 lock held by fio/3587:
     #0:  (&(&vblk->lock)->rlock){......}, at:
    [<ffffffff8132661a>] get_request_wait+0x19a/0x250
    
    Other drivers use block layer provided spinlock as well, e.g. SCSI.
    
    Switching to the block layer provided spinlock saves a bit of memory and
    does not increase lock contention. Performance test shows no real
    difference is observed before and after this patch.
    
    Changes in v2: Improve commit log as Michael suggested.
    
    Cc: virtualization@lists.linux-foundation.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Asias He <asias@redhat.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 785781699d5534735e59edc74886fc59752dcabd
Author: Alex Hung <alex.hung@canonical.com>
Date:   Wed Jun 20 11:47:35 2012 +0800

    asus-wmi: use ASUS_WMI_METHODID_DSTS2 as default DSTS ID.
    
    commit 63a78bb1051b240417daad3a3fa9c1bb10646dca upstream.
    
    According to responses from the BIOS team, ASUS_WMI_METHODID_DSTS2
    (0x53545344) will be used as future DSTS ID. In addition, calling
    asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2, 0, 0, NULL) returns
    ASUS_WMI_UNSUPPORTED_METHOD in new ASUS laptop PCs. This patch fixes
    no DSTS ID will be assigned in this case.
    
    Signed-off-by: Alex Hung <alex.hung@canonical.com>
    Signed-off-by: Matthew Garrett <mjg@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7499bd63d777215d16810b6fc9bd58fe83b4e576
Author: H. Peter Anvin <hpa@linux.intel.com>
Date:   Fri Jul 27 22:26:08 2012 -0400

    random: mix in architectural randomness in extract_buf()
    
    commit d2e7c96af1e54b507ae2a6a7dd2baf588417a7e5 upstream.
    
    Mix in any architectural randomness in extract_buf() instead of
    xfer_secondary_buf().  This allows us to mix in more architectural
    randomness, and it also makes xfer_secondary_buf() faster, moving a
    tiny bit of additional CPU overhead to process which is extracting the
    randomness.
    
    [ Commit description modified by tytso to remove an extended
      advertisement for the RDRAND instruction. ]
    
    Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
    Acked-by: Ingo Molnar <mingo@kernel.org>
    Cc: DJ Johnston <dj.johnston@intel.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 46b4d87ec53d166d2a62aae30d15a24783c3275f
Author: Joe Thornber <ejt@redhat.com>
Date:   Fri Jul 27 15:08:05 2012 +0100

    dm thin: fix memory leak in process_prepared_mapping error paths
    
    commit 905386f82d08f66726912f303f3e6605248c60a3 upstream.
    
    Fix memory leak in process_prepared_mapping by always freeing
    the dm_thin_new_mapping structs from the mapping_pool mempool on
    the error paths.
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Alasdair G Kergon <agk@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 95dc400b2616a83ef7f3d4df8dde299c177e9236
Author: Alasdair G Kergon <agk@redhat.com>
Date:   Fri Jul 27 15:07:57 2012 +0100

    dm thin: reduce endio_hook pool size
    
    commit 7768ed33ccdc02801c4483fc5682dc66ace14aea upstream.
    
    Reduce the slab size used for the dm_thin_endio_hook mempool.
    
    Allocation has been seen to fail on machines with smaller amounts
    of memory due to fragmentation.
    
      lvm: page allocation failure. order:5, mode:0xd0
      device-mapper: table: 253:38: thin-pool: Error creating pool's endio_hook mempool
    
    Signed-off-by: Alasdair G Kergon <agk@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d0192ce751ef75b4f40f5b2d4264f2406080163b
Author: Tony Luck <tony.luck@intel.com>
Date:   Thu Jul 26 10:55:26 2012 -0700

    Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts
    
    commit a119365586b0130dfea06457f584953e0ff6481d upstream.
    
    The following build error occured during a ia64 build with
    swap-over-NFS patches applied.
    
    net/core/sock.c:274:36: error: initializer element is not constant
    net/core/sock.c:274:36: error: (near initialization for 'memalloc_socks')
    net/core/sock.c:274:36: error: initializer element is not constant
    
    This is identical to a parisc build error. Fengguang Wu, Mel Gorman
    and James Bottomley did all the legwork to track the root cause of
    the problem. This fix and entire commit log is shamelessly copied
    from them with one extra detail to change a dubious runtime use of
    ATOMIC_INIT() to atomic_set() in drivers/char/mspec.c
    
    Dave Anglin says:
    > Here is the line in sock.i:
    >
    > struct static_key memalloc_socks = ((struct static_key) { .enabled =
    > ((atomic_t) { (0) }) });
    
    The above line contains two compound literals.  It also uses a designated
    initializer to initialize the field enabled.  A compound literal is not a
    constant expression.
    
    The location of the above statement isn't fully clear, but if a compound
    literal occurs outside the body of a function, the initializer list must
    consist of constant expressions.
    
    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f22027d0e8398e377a42a62241137b77a35eda97
Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date:   Thu Jul 26 08:53:06 2012 +0200

    s390/mm: downgrade page table after fork of a 31 bit process
    
    commit 0f6f281b731d20bfe75c13f85d33f3f05b440222 upstream.
    
    The downgrade of the 4 level page table created by init_new_context is
    currently done only in start_thread31. If a 31 bit process forks the
    new mm uses a 4 level page table, including the task size of 2<<42
    that goes along with it. This is incorrect as now a 31 bit process
    can map memory beyond 2GB. Define arch_dup_mmap to do the downgrade
    after fork.
    
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 60ed9e385606f27c787710bba0dfdb7ff467bdf7
Author: Alan Cox <alan@linux.intel.com>
Date:   Wed Jul 25 16:28:19 2012 +0100

    x86, nops: Missing break resulting in incorrect selection on Intel
    
    commit d6250a3f12edb3a86db9598ffeca3de8b4a219e9 upstream.
    
    The Intel case falls through into the generic case which then changes
    the values.  For cases like the P6 it doesn't do the right thing so
    this seems to be a screwup.
    
    Signed-off-by: Alan Cox <alan@linux.intel.com>
    Link: http://lkml.kernel.org/n/tip-lww2uirad4skzjlmrm0vru8o@git.kernel.org
    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 67258e44992f03cd580e77b30d4c330f93eebaf7
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Jul 23 11:35:55 2012 +0200

    ALSA: mpu401: Fix missing initialization of irq field
    
    commit bc733d495267a23ef8660220d696c6e549ce30b3 upstream.
    
    The irq field of struct snd_mpu401 is supposed to be initialized to -1.
    Since it's set to zero as of now, a probing error before the irq
    installation results in a kernel warning "Trying to free already-free
    IRQ 0".
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2c7b0211095a9110d26fd1a0e96648336bafd028
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Jul 25 13:54:55 2012 +0200

    ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs
    
    commit 6162552b0de6ba80937c3dd53e084967851cd199 upstream.
    
    We've got a bug report about the silent output from the headphone on a
    mobo with VT2021, and spotted out that this was because of the wrong
    D3 state on the DAC for the headphone output.  The bug is triggered by
    the incomplete check for this DAC in set_widgets_power_state_vt1718S().
    It checks only the connectivity of the primary output (0x27) but
    doesn't consider the path from the headphone pin (0x28).
    
    Now this patch fixes the problem by checking both pins for DAC 0x0b.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [bwh: Backported to 3.2: keep using snd_hda_codec_write() as
     update_power_state() is missing]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2028a493b8ff0cfb853be5839759e9522a6da64a
Author: Seth Forshee <seth.forshee@canonical.com>
Date:   Tue Jul 24 23:54:11 2012 -0700

    Input: synaptics - handle out of bounds values from the hardware
    
    commit c0394506e69b37c47d391c2a7bbea3ea236d8ec8 upstream.
    
    The touchpad on the Acer Aspire One D250 will report out of range values
    in the extreme lower portion of the touchpad. These appear as abrupt
    changes in the values reported by the hardware from very low values to
    very high values, which can cause unexpected vertical jumps in the
    position of the mouse pointer.
    
    What seems to be happening is that the value is wrapping to a two's
    compliment negative value of higher resolution than the 13-bit value
    reported by the hardware, with the high-order bits being truncated. This
    patch adds handling for these values by converting them to the
    appropriate negative values.
    
    The only tricky part about this is deciding when to treat a number as
    negative. It stands to reason that if out of range values can be
    reported on the low end then it could also happen on the high end, so
    not all out of range values should be treated as negative. The approach
    taken here is to split the difference between the maximum legitimate
    value for the axis and the maximum possible value that the hardware can
    report, treating values greater than this number as negative and all
    other values as positive. This can be tweaked later if hardware is found
    that operates outside of these parameters.
    
    BugLink: http://bugs.launchpad.net/bugs/1001251
    Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
    Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit efb6d7d667e9b142c7608666da2c7dd4d6bbbee3
Author: Alexander Holler <holler@ahsoftware.de>
Date:   Sat Apr 21 00:11:07 2012 +0200

    video/smscufx: fix line counting in fb_write
    
    commit 2fe2d9f47cfe1a3e66e7d087368b3d7155b04c15 upstream.
    
    Line 0 and 1 were both written to line 0 (on the display) and all subsequent
    lines had an offset of -1. The result was that the last line on the display
    was never overwritten by writes to /dev/fbN.
    
    The origin of this bug seems to have been udlfb.
    
    Signed-off-by: Alexander Holler <holler@ahsoftware.de>
    Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4344b8578fb31bb06abd397219ac0376f116f6f2
Author: Darren Hart <dvhart@linux.intel.com>
Date:   Fri Jul 20 11:53:31 2012 -0700

    futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi()
    
    commit 6f7b0a2a5c0fb03be7c25bd1745baa50582348ef upstream.
    
    If uaddr == uaddr2, then we have broken the rule of only requeueing
    from a non-pi futex to a pi futex with this call. If we attempt this,
    as the trinity test suite manages to do, we miss early wakeups as
    q.key is equal to key2 (because they are the same uaddr). We will then
    attempt to dereference the pi_mutex (which would exist had the futex_q
    been properly requeued to a pi futex) and trigger a NULL pointer
    dereference.
    
    Signed-off-by: Darren Hart <dvhart@linux.intel.com>
    Cc: Dave Jones <davej@redhat.com>
    Link: http://lkml.kernel.org/r/ad82bfe7f7d130247fbe2b5b4275654807774227.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4ccf9739188a122c229a7839ee0af89c91f26029
Author: Darren Hart <dvhart@linux.intel.com>
Date:   Fri Jul 20 11:53:30 2012 -0700

    futex: Fix bug in WARN_ON for NULL q.pi_state
    
    commit f27071cb7fe3e1d37a9dbe6c0dfc5395cd40fa43 upstream.
    
    The WARN_ON in futex_wait_requeue_pi() for a NULL q.pi_state was testing
    the address (&q.pi_state) of the pointer instead of the value
    (q.pi_state) of the pointer. Correct it accordingly.
    
    Signed-off-by: Darren Hart <dvhart@linux.intel.com>
    Cc: Dave Jones <davej@redhat.com>
    Link: http://lkml.kernel.org/r/1c85d97f6e5f79ec389a4ead3e367363c74bd09a.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c2da76144f8b38d0a958ff1cd669d5b78e5c3018
Author: Darren Hart <dvhart@linux.intel.com>
Date:   Fri Jul 20 11:53:29 2012 -0700

    futex: Test for pi_mutex on fault in futex_wait_requeue_pi()
    
    commit b6070a8d9853eda010a549fa9a09eb8d7269b929 upstream.
    
    If fixup_pi_state_owner() faults, pi_mutex may be NULL. Test
    for pi_mutex != NULL before testing the owner against current
    and possibly unlocking it.
    
    Signed-off-by: Darren Hart <dvhart@linux.intel.com>
    Cc: Dave Jones <davej@redhat.com>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Link: http://lkml.kernel.org/r/dc59890338fc413606f04e5c5b131530734dae3d.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 842b98aa6a3a5c5efb7212aec56985cc06674f12
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Fri Jun 22 17:21:17 2012 +0100

    ASoC: wm8994: Ensure there are enough BCLKs for four channels
    
    commit b8edf3e5522735c8ce78b81845f7a1a2d4a08626 upstream.
    
    Otherwise if someone tries to use all four channels on AIF1 with the
    device in master mode we won't be able to clock out all the data.
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3da77549a1d212c47e134c05333e1e5ed72981c5
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Thu Jul 5 20:23:21 2012 +0000

    mfd: wm831x: Feed the device UUID into device_add_randomness()
    
    commit 27130f0cc3ab97560384da437e4621fc4e94f21c upstream.
    
    wm831x devices contain a unique ID value. Feed this into the newly added
    device_add_randomness() to add some per device seed data to the pool.
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 648deda0d74ebefa062b78acbe12e45e0b20803d
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Thu Jul 5 20:19:17 2012 +0000

    rtc: wm831x: Feed the write counter into device_add_randomness()
    
    commit 9dccf55f4cb011a7552a8a2749a580662f5ed8ed upstream.
    
    The tamper evident features of the RTC include the "write counter" which
    is a pseudo-random number regenerated whenever we set the RTC. Since this
    value is unpredictable it should provide some useful seeding to the random
    number generator.
    
    Only do this on boot since the goal is to seed the pool rather than add
    useful entropy.
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7f5d5266f8a1f7f54707c15e028f220d329726f4
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Jul 5 10:35:23 2012 -0400

    random: add new get_random_bytes_arch() function
    
    commit c2557a303ab6712bb6e09447df828c557c710ac9 upstream.
    
    Create a new function, get_random_bytes_arch() which will use the
    architecture-specific hardware random number generator if it is
    present.  Change get_random_bytes() to not use the HW RNG, even if it
    is avaiable.
    
    The reason for this is that the hw random number generator is fast (if
    it is present), but it requires that we trust the hardware
    manufacturer to have not put in a back door.  (For example, an
    increasing counter encrypted by an AES key known to the NSA.)
    
    It's unlikely that Intel (for example) was paid off by the US
    Government to do this, but it's impossible for them to prove otherwise

commit 060bc1d0cb527cf8b77f049ff6a595ddb68a41c8
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Jul 5 10:21:01 2012 -0400

    random: use the arch-specific rng in xfer_secondary_pool
    
    commit e6d4947b12e8ad947add1032dd754803c6004824 upstream.
    
    If the CPU supports a hardware random number generator, use it in
    xfer_secondary_pool(), where it will significantly improve things and
    where we can afford it.
    
    Also, remove the use of the arch-specific rng in
    add_timer_randomness(), since the call is significantly slower than
    get_cycles(), and we're much better off using it in
    xfer_secondary_pool() anyway.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 322f326e39b1c06a24e2e927db0a46e6e054cd2b
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Jul 4 21:23:25 2012 -0400

    net: feed /dev/random with the MAC address when registering a device
    
    commit 7bf2357524408b97fec58344caf7397f8140c3fd upstream.
    
    Cc: David Miller <davem@davemloft.net>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4e28e08b4dbd6c38c9c9e2d1f171949520c708f7
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Jul 4 11:22:20 2012 -0400

    usb: feed USB device information to the /dev/random driver
    
    commit b04b3156a20d395a7faa8eed98698d1e17a36000 upstream.
    
    Send the USB device's serial, product, and manufacturer strings to the
    /dev/random driver to help seed its pools.
    
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Acked-by: Greg KH <greg@kroah.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 369e589b542f8ef0d56a95350997819d1b2222fd
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed Jul 4 11:16:01 2012 -0400

    random: create add_device_randomness() interface
    
    commit a2080a67abe9e314f9e9c2cc3a4a176e8a8f8793 upstream.
    
    Add a new interface, add_device_randomness() for adding data to the
    random pool that is likely to differ between two devices (or possibly
    even per boot).  This would be things like MAC addresses or serial
    numbers, or the read-out of the RTC. This does *not* add any actual
    entropy to the pool, but it initializes the pool to different values
    for devices that might otherwise be identical and have very little
    entropy available to them (particularly common in the embedded world).
    
    [ Modified by tytso to mix in a timestamp, since there may be some
      variability caused by the time needed to detect/configure the hardware
      in question. ]
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f4fe3e0cc3eb906174269681102860f22ed76d51
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Jul 4 10:38:30 2012 -0400

    random: use lockless techniques in the interrupt path
    
    commit 902c098a3663de3fa18639efbb71b6080f0bcd3c upstream.
    
    The real-time Linux folks don't like add_interrupt_randomness() taking
    a spinlock since it is called in the low-level interrupt routine.
    This also allows us to reduce the overhead in the fast path, for the
    random driver, which is the interrupt collection path.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7069678424c5a5ab11938a274e2c03b1dd0b3302
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Mon Jul 2 07:52:16 2012 -0400

    random: make 'add_interrupt_randomness()' do something sane
    
    commit 775f4b297b780601e61787b766f306ed3e1d23eb upstream.
    
    We've been moving away from add_interrupt_randomness() for various
    reasons: it's too expensive to do on every interrupt, and flooding the
    CPU with interrupts could theoretically cause bogus floods of entropy
    from a somewhat externally controllable source.
    
    This solves both problems by limiting the actual randomness addition
    to just once a second or after 64 interrupts, whicever comes first.
    During that time, the interrupt cycle data is buffered up in a per-cpu
    pool.  Also, we make sure the the nonblocking pool used by urandom is
    initialized before we start feeding the normal input pool.  This
    assures that /dev/urandom is returning unpredictable data as soon as
    possible.
    
    (Based on an original patch by Linus, but significantly modified by
    tytso.)
    
    Tested-by: Eric Wustrow <ewust@umich.edu>
    Reported-by: Eric Wustrow <ewust@umich.edu>
    Reported-by: Nadia Heninger <nadiah@cs.ucsd.edu>
    Reported-by: Zakir Durumeric <zakir@umich.edu>
    Reported-by: J. Alex Halderman <jhalderm@umich.edu>.
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5046e32b00df4d28b7235af6b4e6faea975049b7
Author: H. Peter Anvin <hpa@linux.intel.com>
Date:   Mon Jan 16 11:23:29 2012 -0800

    random: Adjust the number of loops when initializing
    
    commit 2dac8e54f988ab58525505d7ef982493374433c3 upstream.
    
    When we are initializing using arch_get_random_long() we only need to
    loop enough times to touch all the bytes in the buffer; using
    poolwords for that does twice the number of operations necessary on a
    64-bit machine, since in the random number generator code "word" means
    32 bits.
    
    Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
    Cc: "Theodore Ts'o" <tytso@mit.edu>
    Link: http://lkml.kernel.org/r/1324589281-31931-1-git-send-email-tytso@mit.edu
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1d1e71f1bd606f77b5e49d9077d6ce23d3f8fc06
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Dec 22 16:28:01 2011 -0500

    random: Use arch-specific RNG to initialize the entropy store
    
    commit 3e88bdff1c65145f7ba297ccec69c774afe4c785 upstream.
    
    If there is an architecture-specific random number generator (such as
    RDRAND for Intel architectures), use it to initialize /dev/random's
    entropy stores.  Even in the worst case, if RDRAND is something like
    AES(NSA_KEY, counter++), it won't hurt, and it will definitely help
    against any other adversaries.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Link: http://lkml.kernel.org/r/1324589281-31931-1-git-send-email-tytso@mit.edu
    Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e50d73fccd7e6f9a9f902b58620fc286195a4a1c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Dec 22 11:36:22 2011 -0800

    random: Use arch_get_random_int instead of cycle counter if avail
    
    commit cf833d0b9937874b50ef2867c4e8badfd64948ce upstream.
    
    We still don't use rdrand in /dev/random, which just seems stupid. We
    accept the *cycle*counter* as a random input, but we don't accept
    rdrand? That's just broken.
    
    Sure, people can do things in user space (write to /dev/random, use
    rdrand in addition to /dev/random themselves etc etc), but that
    *still* seems to be a particularly stupid reason for saying "we
    shouldn't bother to try to do better in /dev/random".
    
    And even if somebody really doesn't trust rdrand as a source of random
    bytes, it seems singularly stupid to trust the cycle counter *more*.
    
    So I'd suggest the attached patch. I'm not going to even bother
    arguing that we should add more bits to the entropy estimate, because
    that's not the point - I don't care if /dev/random fills up slowly or
    not, I think it's just stupid to not use the bits we can get from
    rdrand and mix them into the strong randomness pool.
    
    Link: http://lkml.kernel.org/r/CA%2B55aFwn59N1=m651QAyTy-1gO1noGbK18zwKDwvwqnravA84A@mail.gmail.com
    Acked-by: "David S. Miller" <davem@davemloft.net>
    Acked-by: "Theodore Ts'o" <tytso@mit.edu>
    Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
    Cc: Matt Mackall <mpm@selenic.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit bab9409a251e351bf1a2c1c62cdad22691f32668
Author: J. Bruce Fields <bfields@redhat.com>
Date:   Tue Jun 5 16:52:06 2012 -0400

    nfsd4: our filesystems are normally case sensitive
    
    commit 2930d381d22b9c56f40dd4c63a8fa59719ca2c3c upstream.
    
    Actually, xfs and jfs can optionally be case insensitive; we'll handle
    that case in later patches.
    
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 492ef8589a3622b8c5d58b37d539cfa381c1b118
Author: Luis Henriques <luis.henriques@canonical.com>
Date:   Tue Jun 19 11:29:49 2012 -0300

    ene_ir: Fix driver initialisation
    
    commit b31b021988fed9e3741a46918f14ba9b063811db upstream.
    
    commit 9ef449c6b31bb6a8e6dedc24de475a3b8c79be20 ("[media] rc: Postpone ISR
    registration") fixed an early ISR registration on several drivers.  It did
    however also introduced a bug by moving the invocation of pnp_port_start()
    to the end of the probe function.
    
    This patch fixes this issue by moving the invocation of pnp_port_start() to
    an earlier stage in the probe function.
    
    Cc: Jarod Wilson <jarod@redhat.com>
    Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1f5d7d0ba028a91f63291ce521ebce558b8c2fb8
Author: Mikael Pettersson <mikpe@it.uu.se>
Date:   Thu Apr 19 00:53:36 2012 +0200

    m68k: Correct the Atari ALLOWINT definition
    
    commit c663600584a596b5e66258cc10716fb781a5c2c9 upstream.
    
    Booting a 3.2, 3.3, or 3.4-rc4 kernel on an Atari using the
    `nfeth' ethernet device triggers a WARN_ONCE() in generic irq
    handling code on the first irq for that device:
    
    WARNING: at kernel/irq/handle.c:146 handle_irq_event_percpu+0x134/0x142()
    irq 3 handler nfeth_interrupt+0x0/0x194 enabled interrupts
    Modules linked in:
    Call Trace: [<000299b2>] warn_slowpath_common+0x48/0x6a
     [<000299c0>] warn_slowpath_common+0x56/0x6a
     [<00029a4c>] warn_slowpath_fmt+0x2a/0x32
     [<0005b34c>] handle_irq_event_percpu+0x134/0x142
     [<0005b34c>] handle_irq_event_percpu+0x134/0x142
     [<0000a584>] nfeth_interrupt+0x0/0x194
     [<001ba0a8>] schedule_preempt_disabled+0x0/0xc
     [<0005b37a>] handle_irq_event+0x20/0x2c
     [<0005add4>] generic_handle_irq+0x2c/0x3a
     [<00002ab6>] do_IRQ+0x20/0x32
     [<0000289e>] auto_irqhandler_fixup+0x4/0x6
     [<00003144>] cpu_idle+0x22/0x2e
     [<001b8a78>] printk+0x0/0x18
     [<0024d112>] start_kernel+0x37a/0x386
     [<0003021d>] __do_proc_dointvec+0xb1/0x366
     [<0003021d>] __do_proc_dointvec+0xb1/0x366
     [<0024c31e>] _sinittext+0x31e/0x9c0
    
    After invoking the irq's handler the kernel sees !irqs_disabled()
    and concludes that the handler erroneously enabled interrupts.
    
    However, debugging shows that !irqs_disabled() is true even before
    the handler is invoked, which indicates a problem in the platform
    code rather than the specific driver.
    
    The warning does not occur in 3.1 or older kernels.
    
    It turns out that the ALLOWINT definition for Atari is incorrect.
    
    The Atari definition of ALLOWINT is ~0x400, the stated purpose of
    that is to avoid taking HSYNC interrupts.  irqs_disabled() returns
    true if the 3-bit ipl & 4 is non-zero.  The nfeth interrupt runs at
    ipl 3 (it's autovector 3), but 3 & 4 is zero so irqs_disabled() is
    false, and the warning above is generated.
    
    When interrupts are explicitly disabled, ipl is set to 7.  When they
    are enabled, ipl is masked with ALLOWINT.  On Atari this will result
    in ipl = 3, which blocks interrupts at ipl 3 and below.  So how come
    nfeth interrupts at ipl 3 are received at all?  That's because ipl
    is reset to 2 by Atari-specific code in default_idle(), again with
    the stated purpose of blocking HSYNC interrupts.  This discrepancy
    means that ipl 3 can remain blocked for longer than intended.
    
    Both default_idle() and falcon_hblhandler() identify HSYNC with
    ipl 2, and the "Atari ST/.../F030 Hardware Register Listing" agrees,
    but ALLOWINT is defined as if HSYNC was ipl 3.
    
    [As an experiment I modified default_idle() to reset ipl to 3, and
    as expected that resulted in all nfeth interrupts being blocked.]
    
    The fix is simple: define ALLOWINT as ~0x500 instead.  This makes
    arch_local_irq_enable() consistent with default_idle(), and prevents
    the !irqs_disabled() problems for ipl 3 interrupts.
    
    Tested on Atari running in an Aranym VM.
    
    Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
    Tested-by: Michael Schmitz <schmitzmic@googlemail.com> (on Falcon/CT60)
    [Geert Uytterhoeven: This version applies to v3.2..v3.4.]
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f0618dab274183ec2b8e0d0f3c2adafd994caf02
Author: Liang Li <liang.li@windriver.com>
Date:   Thu Aug 2 18:55:41 2012 -0400

    cfg80211: fix interface combinations check for ADHOC(IBSS)
    
    partial of commit 8e8b41f9d8c8e63fc92f899ace8da91a490ac573 upstream.
    
    As part of commit 463454b5dbd8 ("cfg80211: fix interface
    combinations check"), this extra check was introduced:
    
           if ((all_iftypes & used_iftypes) != used_iftypes)
                   goto cont;
    
    However, most wireless NIC drivers did not advertise ADHOC in
    wiphy.iface_combinations[i].limits[] and hence we'll get -EBUSY
    when we bring up a ADHOC wlan with commands similar to:
    
     # iwconfig wlan0 mode ad-hoc && ifconfig wlan0 up
    
    In commit 8e8b41f9d8c8e ("cfg80211: enforce lack of interface
    combinations"), the change below fixes the issue:
    
           if (total == 1)
                   return 0;
    
    But it also introduces other dependencies for stable. For example,
    a full cherry pick of 8e8b41f9d8c8e would introduce additional
    regressions unless we also start cherry picking driver specific
    fixes like the following:
    
      9b4760e  ath5k: add possible wiphy interface combinations
      1ae2fc2  mac80211_hwsim: advertise interface combinations
      20c8e8d  ath9k: add possible wiphy interface combinations
    
    And the purpose of the 'if (total == 1)' is to cover the specific
    use case (IBSS, adhoc) that was mentioned above. So we just pick
    the specific part out from 8e8b41f9d8c8e here.
    
    Doing so gives stable kernels a way to fix the change introduced
    by 463454b5dbd8, without having to make cherry picks specific to
    various NIC drivers.
    
    Signed-off-by: Liang Li <liang.li@windriver.com>
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b27a5970350225f8e834d57eac3095034abd4cd9
Author: David Henningsson <david.henningsson@canonical.com>
Date:   Fri Jul 20 10:37:25 2012 +0200

    ALSA: hda - add dock support for Thinkpad X230 Tablet
    
    commit 108cc108a3bb42fe4705df1317ff98e1e29428a6 upstream.
    
    Also add a model/fixup string "lenovo-dock", so that other Thinkpad
    users will be able to test this fixup easily, to see if it enables
    dock I/O for them as well.
    
    BugLink: https://bugs.launchpad.net/bugs/1026953
    Tested-by: John McCarron <john.mccarron@canonical.com>
    Signed-off-by: David Henningsson <david.henningsson@canonical.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6b6deb8a6bcaa43b7ea365de9b97ef11f6ffd316
Author: Paul Gortmaker <paul.gortmaker@windriver.com>
Date:   Tue Jun 5 11:15:50 2012 -0400

    stable: update references to older 2.6 versions for 3.x
    
    commit 2584f5212d97b664be250ad5700a2d0fee31a10d upstream.
    
    Also add information on where the respective trees are.
    
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    Acked-by: Rob Landley <rob@landley.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 76a65f00049d773d4f508bc2a6c19f7bb546f49d
Author: Jarod Wilson <jarod@redhat.com>
Date:   Mon Jun 4 13:05:24 2012 -0300

    lirc_sir: make device registration work
    
    commit 4b71ca6bce8fab3d08c61bf330e781f957934ae1 upstream.
    
    For one, the driver device pointer needs to be filled in, or the lirc core
    will refuse to load the driver. And we really need to wire up all the
    platform_device bits. This has been tested via the lirc sourceforge tree
    and verified to work, been sitting there for months, finally getting
    around to sending it. :\
    
    CC: Josh Boyer <jwboyer@redhat.com>
    Signed-off-by: Jarod Wilson <jarod@redhat.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a044f5527ce679e7997386926a9d932d30cfb0fc
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed May 23 18:57:20 2012 +0100

    xen: mark local pages as FOREIGN in the m2p_override
    
    commit b9e0d95c041ca2d7ad297ee37c2e9cfab67a188f upstream.
    
    When the frontend and the backend reside on the same domain, even if we
    add pages to the m2p_override, these pages will never be returned by
    mfn_to_pfn because the check "get_phys_to_machine(pfn) != mfn" will
    always fail, so the pfn of the frontend will be returned instead
    (resulting in a deadlock because the frontend pages are already locked).
    
    INFO: task qemu-system-i38:1085 blocked for more than 120 seconds.
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    qemu-system-i38 D ffff8800cfc137c0     0  1085      1 0x00000000
     ffff8800c47ed898 0000000000000282 ffff8800be4596b0 00000000000137c0
     ffff8800c47edfd8 ffff8800c47ec010 00000000000137c0 00000000000137c0
     ffff8800c47edfd8 00000000000137c0 ffffffff82213020 ffff8800be4596b0
    Call Trace:
     [<ffffffff81101ee0>] ? __lock_page+0x70/0x70
     [<ffffffff81a0fdd9>] schedule+0x29/0x70
     [<ffffffff81a0fe80>] io_schedule+0x60/0x80
     [<ffffffff81101eee>] sleep_on_page+0xe/0x20
     [<ffffffff81a0e1ca>] __wait_on_bit_lock+0x5a/0xc0
     [<ffffffff81101ed7>] __lock_page+0x67/0x70
     [<ffffffff8106f750>] ? autoremove_wake_function+0x40/0x40
     [<ffffffff811867e6>] ? bio_add_page+0x36/0x40
     [<ffffffff8110b692>] set_page_dirty_lock+0x52/0x60
     [<ffffffff81186021>] bio_set_pages_dirty+0x51/0x70
     [<ffffffff8118c6b4>] do_blockdev_direct_IO+0xb24/0xeb0
     [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
     [<ffffffff8118ca95>] __blockdev_direct_IO+0x55/0x60
     [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
     [<ffffffff811e91c8>] ext3_direct_IO+0xf8/0x390
     [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
     [<ffffffff81004b60>] ? xen_mc_flush+0xb0/0x1b0
     [<ffffffff81104027>] generic_file_aio_read+0x737/0x780
     [<ffffffff813bedeb>] ? gnttab_map_refs+0x15b/0x1e0
     [<ffffffff811038f0>] ? find_get_pages+0x150/0x150
     [<ffffffff8119736c>] aio_rw_vect_retry+0x7c/0x1d0
     [<ffffffff811972f0>] ? lookup_ioctx+0x90/0x90
     [<ffffffff81198856>] aio_run_iocb+0x66/0x1a0
     [<ffffffff811998b8>] do_io_submit+0x708/0xb90
     [<ffffffff81199d50>] sys_io_submit+0x10/0x20
     [<ffffffff81a18d69>] system_call_fastpath+0x16/0x1b
    
    The explanation is in the comment within the code:
    
    We need to do this because the pages shared by the frontend
    (xen-blkfront) can be already locked (lock_page, called by
    do_read_cache_page); when the userspace backend tries to use them
    with direct_IO, mfn_to_pfn returns the pfn of the frontend, so
    do_blockdev_direct_IO is going to try to lock the same pages
    again resulting in a deadlock.
    
    A simplified call graph looks like this:
    
    pygrub                          QEMU
    -----------------------------------------------
    do_read_cache_page              io_submit
      |                              |
    lock_page                       ext3_direct_IO
                                     |
                                    bio_add_page
                                     |
                                    lock_page
    
    Internally the xen-blkback uses m2p_add_override to swizzle (temporarily)
    a 'struct page' to have a different MFN (so that it can point to another
    guest). It also can easily find out whether another pfn corresponding
    to the mfn exists in the m2p, and can set the FOREIGN bit
    in the p2m, making sure that mfn_to_pfn returns the pfn of the backend.
    
    This allows the backend to perform direct_IO on these pages, but as a
    side effect prevents the frontend from using get_user_pages_fast on
    them while they are being shared with the backend.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e5dd68ebb5ee6c2defe90afd9ef98dca7e5a70b7
Author: Vivek Goyal <vgoyal@redhat.com>
Date:   Wed Feb 8 20:03:38 2012 +0100

    floppy: Cleanup disk->queue before caling put_disk() if add_disk() was never called
    
    commit 3f9a5aabd0a9fe0e0cd308506f48963d79169aa7 upstream.
    
    add_disk() takes gendisk reference on request queue. If driver failed during
    initialization and never called add_disk() then that extra reference is not
    taken. That reference is put in put_disk(). floppy driver allocates the
    disk, allocates queue, sets disk->queue and then relizes that floppy
    controller is not present. It tries to tear down everything and tries to
    put a reference down in put_disk() which was never taken.
    
    In such error cases cleanup disk->queue before calling put_disk() so that
    we never try to put down a reference which was never taken in first place.
    
    Reported-and-tested-by: Suresh Jayaraman <sjayaraman@suse.com>
    Tested-by: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
    Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
    Acked-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b75bfc42974aaf089ae7eae5d3c6bf362f57ee93
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri Jun 22 13:36:05 2012 +0200

    sched: Fix race in task_group()
    
    commit 8323f26ce3425460769605a6aece7a174edaa7d1 upstream
    
    Stefan reported a crash on a kernel before a3e5d1091c1 ("sched:
    Don't call task_group() too many times in set_task_rq()"), he
    found the reason to be that the multiple task_group()
    invocations in set_task_rq() returned different values.
    
    Looking at all that I found a lack of serialization and plain
    wrong comments.
    
    The below tries to fix it using an extra pointer which is
    updated under the appropriate scheduler locks. Its not pretty,
    but I can't really see another way given how all the cgroup
    stuff works.
    
    Reported-and-tested-by: Stefan Bader <stefan.bader@canonical.com>
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1340364965.18025.71.camel@twins
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    
    (backported to previous file names and layout)
    Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>