commit 3756888c2a2da9c7291d39cacd1184171111b49d
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Fri Apr 18 11:14:28 2014 +0200

    Linux 3.12.19

commit 61fae6dfba003b302fb16e26e8f815b984ac3e2d
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Mon Apr 7 15:38:29 2014 -0700

    exit: call disassociate_ctty() before exit_task_namespaces()
    
    commit c39df5fa37b0623589508c95515b4aa1531c524e upstream.
    
    Commit 8aac62706ada ("move exit_task_namespaces() outside of
    exit_notify()") breaks pppd and the exiting service crashes the kernel:
    
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
        IP: ppp_register_channel+0x13/0x20 [ppp_generic]
        Call Trace:
          ppp_asynctty_open+0x12b/0x170 [ppp_async]
          tty_ldisc_open.isra.2+0x27/0x60
          tty_ldisc_hangup+0x1e3/0x220
          __tty_hangup+0x2c4/0x440
          disassociate_ctty+0x61/0x270
          do_exit+0x7f2/0xa50
    
    ppp_register_channel() needs ->net_ns and current->nsproxy == NULL.
    
    Move disassociate_ctty() before exit_task_namespaces(), it doesn't make
    sense to delay it after perf_event_exit_task() or cgroup_exit().
    
    This also allows to use task_work_add() inside the (nontrivial) code
    paths in disassociate_ctty().
    
    Investigated by Peter Hurley.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Reported-by: Sree Harsha Totakura <sreeharsha@totakura.in>
    Cc: Peter Hurley <peter@hurleysoftware.com>
    Cc: Sree Harsha Totakura <sreeharsha@totakura.in>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Jeff Dike <jdike@addtoit.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Andrey Vagin <avagin@openvz.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit f3e9310e26ff2391d9007c2c47bd88a720e62c37
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Mon Apr 7 15:38:41 2014 -0700

    wait: fix reparent_leader() vs EXIT_DEAD->EXIT_ZOMBIE race
    
    commit dfccbb5e49a621c1b21a62527d61fc4305617aca upstream.
    
    wait_task_zombie() first does EXIT_ZOMBIE->EXIT_DEAD transition and
    drops tasklist_lock.  If this task is not the natural child and it is
    traced, we change its state back to EXIT_ZOMBIE for ->real_parent.
    
    The last transition is racy, this is even documented in 50b8d257486a
    "ptrace: partially fix the do_wait(WEXITED) vs EXIT_DEAD->EXIT_ZOMBIE
    race".  wait_consider_task() tries to detect this transition and clear
    ->notask_error but we can't rely on ptrace_reparented(), debugger can
    exit and do ptrace_unlink() before its sub-thread sets EXIT_ZOMBIE.
    
    And there is another problem which were missed before: this transition
    can also race with reparent_leader() which doesn't reset >exit_signal if
    EXIT_DEAD, assuming that this task must be reaped by someone else.  So
    the tracee can be re-parented with ->exit_signal != SIGCHLD, and if
    /sbin/init doesn't use __WALL it becomes unreapable.
    
    Change reparent_leader() to update ->exit_signal even if EXIT_DEAD.
    Note: this is the simple temporary hack for -stable, it doesn't try to
    solve all problems, it will be reverted by the next changes.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Reported-by: Jan Kratochvil <jan.kratochvil@redhat.com>
    Reported-by: Michal Schmidt <mschmidt@redhat.com>
    Tested-by: Michal Schmidt <mschmidt@redhat.com>
    Cc: Al Viro <viro@ZenIV.linux.org.uk>
    Cc: Lennart Poettering <lpoetter@redhat.com>
    Cc: Roland McGrath <roland@hack.frob.com>
    Cc: Tejun Heo <tj@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3f5bb90c762520fee214e7852897198e89b29630
Author: David S. Miller <davem@davemloft.net>
Date:   Mon Mar 24 14:45:12 2014 -0400

    sparc64: Make sure %pil interrupts are enabled during hypervisor yield.
    
    [ Upstream commit cb3042d609e30e6144024801c89be3925106752b ]
    
    In arch_cpu_idle() we must enable %pil based interrupts before
    potentially invoking the hypervisor cpu yield call.
    
    As per the Hypervisor API documentation for cpu_yield:
    
    	Interrupts which are blocked by some mechanism other that
    	pstate.ie (for example %pil) are not guaranteed to cause
    	a return from this service.
    
    It seems that only first generation Niagara chips are hit by this
    bug.  My best guess is that later chips implement this in hardware
    and wake up anyways from %pil events, whereas in first generation
    chips the yield is implemented completely in hypervisor code and
    requires %pil to be enabled in order to wake properly from this
    call.
    
    Fixes: 87fa05aeb3a5 ("sparc: Use generic idle loop")
    Reported-by: Fabio M. Di Nitto <fabbione@fabbione.net>
    Reported-by: Jan Engelhardt <jengelh@inai.de>
    Tested-by: Jan Engelhardt <jengelh@inai.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 094c49e05b7684cf4c81d1da2620c1a65fa8ced9
Author: Dave Kleikamp <dave.kleikamp@oracle.com>
Date:   Fri Mar 14 10:42:01 2014 -0500

    sparc64: don't treat 64-bit syscall return codes as 32-bit
    
    [ Upstream commit 1535bd8adbdedd60a0ee62e28fd5225d66434371 ]
    
    When checking a system call return code for an error,
    linux_sparc_syscall was sign-extending the lower 32-bit value and
    comparing it to -ERESTART_RESTARTBLOCK. lseek can return valid return
    codes whose lower 32-bits alone would indicate a failure (such as 4G-1).
    Use the whole 64-bit value to check for errors. Only the 32-bit path
    should sign extend the lower 32-bit value.
    
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Acked-by: Bob Picco <bob.picco@oracle.com>
    Acked-by: Allen Pais <allen.pais@oracle.com>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: sparclinux@vger.kernel.org
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 50aa539f0ea40ff117cc7ff263ed71bb9f2c4d86
Author: Paul Gortmaker <paul.gortmaker@windriver.com>
Date:   Thu Feb 13 13:57:44 2014 -0500

    sparc32: fix build failure for arch_jump_label_transform
    
    [ Upstream commit 4f6500fff5f7644a03c46728fd7ef0f62fa6940b ]
    
    In arch/sparc/Kernel/Makefile, we see:
    
       obj-$(CONFIG_SPARC64)   += jump_label.o
    
    However, the Kconfig selects HAVE_ARCH_JUMP_LABEL unconditionally
    for all SPARC.  This in turn leads to the following failure when
    doing allmodconfig coverage builds:
    
    kernel/built-in.o: In function `__jump_label_update':
    jump_label.c:(.text+0x8560c): undefined reference to `arch_jump_label_transform'
    kernel/built-in.o: In function `arch_jump_label_transform_static':
    (.text+0x85cf4): undefined reference to `arch_jump_label_transform'
    make: *** [vmlinux] Error 1
    
    Change HAVE_ARCH_JUMP_LABEL to be conditional on SPARC64 so that it
    matches the Makefile.
    
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7b87da3a8a0491eed7eb8800ccd198a077c9601b
Author: Li Zefan <lizefan@huawei.com>
Date:   Wed Feb 12 12:44:57 2014 -0800

    jffs2: remove from wait queue after schedule()
    
    commit 3ead9578443b66ddb3d50ed4f53af8a0c0298ec5 upstream.
    
    @wait is a local variable, so if we don't remove it from the wait queue
    list, later wake_up() may end up accessing invalid memory.
    
    This was spotted by eyes.
    
    Signed-off-by: Li Zefan <lizefan@huawei.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit ff308965e7189645ad5f8343c145388002ac49fe
Author: Li Zefan <lizefan@huawei.com>
Date:   Wed Feb 12 12:44:56 2014 -0800

    jffs2: avoid soft-lockup in jffs2_reserve_space_gc()
    
    commit 13b546d96207c131eeae15dc7b26c6e7d0f1cad7 upstream.
    
    We triggered soft-lockup under stress test on 2.6.34 kernel.
    
    BUG: soft lockup - CPU#1 stuck for 60009ms! [lockf2.test:14488]
    ...
    [<bf09a4d4>] (jffs2_do_reserve_space+0x420/0x440 [jffs2])
    [<bf09a528>] (jffs2_reserve_space_gc+0x34/0x78 [jffs2])
    [<bf0a1350>] (jffs2_garbage_collect_dnode.isra.3+0x264/0x478 [jffs2])
    [<bf0a2078>] (jffs2_garbage_collect_pass+0x9c0/0xe4c [jffs2])
    [<bf09a670>] (jffs2_reserve_space+0x104/0x2a8 [jffs2])
    [<bf09dc48>] (jffs2_write_inode_range+0x5c/0x4d4 [jffs2])
    [<bf097d8c>] (jffs2_write_end+0x198/0x2c0 [jffs2])
    [<c00e00a4>] (generic_file_buffered_write+0x158/0x200)
    [<c00e14f4>] (__generic_file_aio_write+0x3a4/0x414)
    [<c00e15c0>] (generic_file_aio_write+0x5c/0xbc)
    [<c012334c>] (do_sync_write+0x98/0xd4)
    [<c0123a84>] (vfs_write+0xa8/0x150)
    [<c0123d74>] (sys_write+0x3c/0xc0)]
    
    Fix this by adding a cond_resched() in the while loop.
    
    [akpm@linux-foundation.org: don't initialize `ret']
    Signed-off-by: Li Zefan <lizefan@huawei.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 0bf18cba4210dd3ae4a63cc961c8973c54045a62
Author: Ajesh Kunhipurayil Vijayan <ajesh@broadcom.com>
Date:   Mon Jan 6 19:06:55 2014 +0530

    jffs2: Fix crash due to truncation of csize
    
    commit 41bf1a24c1001f4d0d41a78e1ac575d2f14789d7 upstream.
    
    mounting JFFS2 partition sometimes crashes with this call trace:
    
    [ 1322.240000] Kernel bug detected[#1]:
    [ 1322.244000] Cpu 2
    [ 1322.244000] $ 0   : 0000000000000000 0000000000000018 000000003ff00070 0000000000000001
    [ 1322.252000] $ 4   : 0000000000000000 c0000000f3980150 0000000000000000 0000000000010000
    [ 1322.260000] $ 8   : ffffffffc09cd5f8 0000000000000001 0000000000000088 c0000000ed300de8
    [ 1322.268000] $12   : e5e19d9c5f613a45 ffffffffc046d464 0000000000000000 66227ba5ea67b74e
    [ 1322.276000] $16   : c0000000f1769c00 c0000000ed1e0200 c0000000f3980150 0000000000000000
    [ 1322.284000] $20   : c0000000f3a80000 00000000fffffffc c0000000ed2cfbd8 c0000000f39818f0
    [ 1322.292000] $24   : 0000000000000004 0000000000000000
    [ 1322.300000] $28   : c0000000ed2c0000 c0000000ed2cfab8 0000000000010000 ffffffffc039c0b0
    [ 1322.308000] Hi    : 000000000000023c
    [ 1322.312000] Lo    : 000000000003f802
    [ 1322.316000] epc   : ffffffffc039a9f8 check_tn_node+0x88/0x3b0
    [ 1322.320000]     Not tainted
    [ 1322.324000] ra    : ffffffffc039c0b0 jffs2_do_read_inode_internal+0x1250/0x1e48
    [ 1322.332000] Status: 5400f8e3    KX SX UX KERNEL EXL IE
    [ 1322.336000] Cause : 00800034
    [ 1322.340000] PrId  : 000c1004 (Netlogic XLP)
    [ 1322.344000] Modules linked in:
    [ 1322.348000] Process jffs2_gcd_mtd7 (pid: 264, threadinfo=c0000000ed2c0000, task=c0000000f0e68dd8, tls=0000000000000000)
    [ 1322.356000] Stack : c0000000f1769e30 c0000000ed010780 c0000000ed010780 c0000000ed300000
            c0000000f1769c00 c0000000f3980150 c0000000f3a80000 00000000fffffffc
            c0000000ed2cfbd8 ffffffffc039c0b0 ffffffffc09c6340 0000000000001000
            0000000000000dec ffffffffc016c9d8 c0000000f39805a0 c0000000f3980180
            0000008600000000 0000000000000000 0000000000000000 0000000000000000
            0001000000000dec c0000000f1769d98 c0000000ed2cfb18 0000000000010000
            0000000000010000 0000000000000044 c0000000f3a80000 c0000000f1769c00
            c0000000f3d207a8 c0000000f1769d98 c0000000f1769de0 ffffffffc076f9c0
            0000000000000009 0000000000000000 0000000000000000 ffffffffc039cf90
            0000000000000017 ffffffffc013fbdc 0000000000000001 000000010003e61c
            ...
    [ 1322.424000] Call Trace:
    [ 1322.428000] [<ffffffffc039a9f8>] check_tn_node+0x88/0x3b0
    [ 1322.432000] [<ffffffffc039c0b0>] jffs2_do_read_inode_internal+0x1250/0x1e48
    [ 1322.440000] [<ffffffffc039cf90>] jffs2_do_crccheck_inode+0x70/0xd0
    [ 1322.448000] [<ffffffffc03a1b80>] jffs2_garbage_collect_pass+0x160/0x870
    [ 1322.452000] [<ffffffffc03a392c>] jffs2_garbage_collect_thread+0xdc/0x1f0
    [ 1322.460000] [<ffffffffc01541c8>] kthread+0xb8/0xc0
    [ 1322.464000] [<ffffffffc0106d18>] kernel_thread_helper+0x10/0x18
    [ 1322.472000]
    [ 1322.472000]
    Code: 67bd0050  94a4002c  2c830001 <00038036> de050218  2403fffc  0080a82d  00431824  24630044
    [ 1322.480000] ---[ end trace b052bb90e97dfbf5 ]---
    
    The variable csize in structure jffs2_tmp_dnode_info is of type uint16_t, but it
    is used to hold the compressed data length(csize) which is declared as uint32_t.
    So, when the value of csize exceeds 16bits, it gets truncated when assigned to
    tn->csize. This is causing a kernel BUG.
    Changing the definition of csize in jffs2_tmp_dnode_info to uint32_t fixes the issue.
    
    Signed-off-by: Ajesh Kunhipurayil Vijayan <ajesh@broadcom.com>
    Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7e33def95196b4123dbab2635583dc6fb906f995
Author: Kamlakant Patel <kamlakant.patel@broadcom.com>
Date:   Mon Jan 6 19:06:54 2014 +0530

    jffs2: Fix segmentation fault found in stress test
    
    commit 3367da5610c50e6b83f86d366d72b41b350b06a2 upstream.
    
    Creating a large file on a JFFS2 partition sometimes crashes with this call
    trace:
    
    [  306.476000] CPU 13 Unable to handle kernel paging request at virtual address c0000000dfff8002, epc == ffffffffc03a80a8, ra == ffffffffc03a8044
    [  306.488000] Oops[#1]:
    [  306.488000] Cpu 13
    [  306.492000] $ 0   : 0000000000000000 0000000000000000 0000000000008008 0000000000008007
    [  306.500000] $ 4   : c0000000dfff8002 000000000000009f c0000000e0007cde c0000000ee95fa58
    [  306.508000] $ 8   : 0000000000000001 0000000000008008 0000000000010000 ffffffffffff8002
    [  306.516000] $12   : 0000000000007fa9 000000000000ff0e 000000000000ff0f 80e55930aebb92bb
    [  306.524000] $16   : c0000000e0000000 c0000000ee95fa5c c0000000efc80000 ffffffffc09edd70
    [  306.532000] $20   : ffffffffc2b60000 c0000000ee95fa58 0000000000000000 c0000000efc80000
    [  306.540000] $24   : 0000000000000000 0000000000000004
    [  306.548000] $28   : c0000000ee950000 c0000000ee95f738 0000000000000000 ffffffffc03a8044
    [  306.556000] Hi    : 00000000000574a5
    [  306.560000] Lo    : 6193b7a7e903d8c9
    [  306.564000] epc   : ffffffffc03a80a8 jffs2_rtime_compress+0x98/0x198
    [  306.568000]     Tainted: G        W
    [  306.572000] ra    : ffffffffc03a8044 jffs2_rtime_compress+0x34/0x198
    [  306.580000] Status: 5000f8e3    KX SX UX KERNEL EXL IE
    [  306.584000] Cause : 00800008
    [  306.588000] BadVA : c0000000dfff8002
    [  306.592000] PrId  : 000c1100 (Netlogic XLP)
    [  306.596000] Modules linked in:
    [  306.596000] Process dd (pid: 170, threadinfo=c0000000ee950000, task=c0000000ee6e0858, tls=0000000000c47490)
    [  306.608000] Stack : 7c547f377ddc7ee4 7ffc7f967f5d7fae 7f617f507fc37ff4 7e7d7f817f487f5f
            7d8e7fec7ee87eb3 7e977ff27eec7f9e 7d677ec67f917f67 7f3d7e457f017ed7
            7fd37f517f867eb2 7fed7fd17ca57e1d 7e5f7fe87f257f77 7fd77f0d7ede7fdb
            7fba7fef7e197f99 7fde7fe07ee37eb5 7f5c7f8c7fc67f65 7f457fb87f847e93
            7f737f3e7d137cd9 7f8e7e9c7fc47d25 7dbb7fac7fb67e52 7ff17f627da97f64
            7f6b7df77ffa7ec5 80057ef17f357fb3 7f767fa27dfc7fd5 7fe37e8e7fd07e53
            7e227fcf7efb7fa1 7f547e787fa87fcc 7fcb7fc57f5a7ffb 7fc07f6c7ea97e80
            7e2d7ed17e587ee0 7fb17f9d7feb7f31 7f607e797e887faa 7f757fdd7c607ff3
            7e877e657ef37fbd 7ec17fd67fe67ff7 7ff67f797ff87dc4 7eef7f3a7c337fa6
            7fe57fc97ed87f4b 7ebe7f097f0b8003 7fe97e2a7d997cba 7f587f987f3c7fa9
            ...
    [  306.676000] Call Trace:
    [  306.680000] [<ffffffffc03a80a8>] jffs2_rtime_compress+0x98/0x198
    [  306.684000] [<ffffffffc0394f10>] jffs2_selected_compress+0x110/0x230
    [  306.692000] [<ffffffffc039508c>] jffs2_compress+0x5c/0x388
    [  306.696000] [<ffffffffc039dc58>] jffs2_write_inode_range+0xd8/0x388
    [  306.704000] [<ffffffffc03971bc>] jffs2_write_end+0x16c/0x2d0
    [  306.708000] [<ffffffffc01d3d90>] generic_file_buffered_write+0xf8/0x2b8
    [  306.716000] [<ffffffffc01d4e7c>] __generic_file_aio_write+0x1ac/0x350
    [  306.720000] [<ffffffffc01d50a0>] generic_file_aio_write+0x80/0x168
    [  306.728000] [<ffffffffc021f7dc>] do_sync_write+0x94/0xf8
    [  306.732000] [<ffffffffc021ff6c>] vfs_write+0xa4/0x1a0
    [  306.736000] [<ffffffffc02202e8>] SyS_write+0x50/0x90
    [  306.744000] [<ffffffffc0116cc0>] handle_sys+0x180/0x1a0
    [  306.748000]
    [  306.748000]
    Code: 020b202d  0205282d  90a50000 <90840000> 14a40038  00000000  0060602d  0000282d  016c5823
    [  306.760000] ---[ end trace 79dd088435be02d0 ]---
    Segmentation fault
    
    This crash is caused because the 'positions' is declared as an array of signed
    short. The value of position is in the range 0..65535, and will be converted
    to a negative number when the position is greater than 32767 and causes a
    corruption and crash. Changing the definition to 'unsigned short' fixes this
    issue
    
    Signed-off-by: Jayachandran C <jchandra@broadcom.com>
    Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 1eccbcabcd88d6a110080fdd5c9bf46173d940b5
Author: Eric Whitney <enwlinux@gmail.com>
Date:   Tue Apr 1 19:49:30 2014 -0400

    ext4: fix premature freeing of partial clusters split across leaf blocks
    
    commit ad6599ab3ac98a4474544086e048ce86ec15a4d1 upstream.
    
    Xfstests generic/311 and shared/298 fail when run on a bigalloc file
    system.  Kernel error messages produced during the tests report that
    blocks to be freed are already on the to-be-freed list.  When e2fsck
    is run at the end of the tests, it typically reports bad i_blocks and
    bad free blocks counts.
    
    The bug that causes these failures is located in ext4_ext_rm_leaf().
    Code at the end of the function frees a partial cluster if it's not
    shared with an extent remaining in the leaf.  However, if all the
    extents in the leaf have been removed, the code dereferences an
    invalid extent pointer (off the front of the leaf) when the check for
    sharing is made.  This generally has the effect of unconditionally
    freeing the partial cluster, which leads to the observed failures
    when the partial cluster is shared with the last extent in the next
    leaf.
    
    Fix this by attempting to free the cluster only if extents remain in
    the leaf.  Any remaining partial cluster will be freed if possible
    when the next leaf is processed or when leaf removal is complete.
    
    Signed-off-by: Eric Whitney <enwlinux@gmail.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 23606f1b0b2a09aa32146b3c1f0687383699c164
Author: Eric Whitney <enwlinux@gmail.com>
Date:   Thu Mar 13 23:34:16 2014 -0400

    ext4: fix partial cluster handling for bigalloc file systems
    
    commit c06344939422bbd032ac967223a7863de57496b5 upstream.
    
    Commit 9cb00419fa, which enables hole punching for bigalloc file
    systems, exposed a bug introduced by commit 6ae06ff51e in an earlier
    release.  When run on a bigalloc file system, xfstests generic/013, 068,
    075, 083, 091, 100, 112, 127, 263, 269, and 270 fail with e2fsck errors
    or cause kernel error messages indicating that previously freed blocks
    are being freed again.
    
    The latter commit optimizes the selection of the starting extent in
    ext4_ext_rm_leaf() when hole punching by beginning with the extent
    supplied in the path argument rather than with the last extent in the
    leaf node (as is still done when truncating).  However, the code in
    rm_leaf that initially sets partial_cluster to track cluster sharing on
    extent boundaries is only guaranteed to run if rm_leaf starts with the
    last node in the leaf.  Consequently, partial_cluster is not correctly
    initialized when hole punching, and a cluster on the boundary of a
    punched region that should be retained may instead be deallocated.
    
    Signed-off-by: Eric Whitney <enwlinux@gmail.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit e3794f95677d19a6c31d7716c277ad8fb3f53884
Author: Eric Whitney <enwlinux@gmail.com>
Date:   Wed Feb 19 18:52:39 2014 -0500

    ext4: fix error return from ext4_ext_handle_uninitialized_extents()
    
    commit ce37c42919608e96ade3748fe23c3062a0a966c5 upstream.
    
    Commit 3779473246 breaks the return of error codes from
    ext4_ext_handle_uninitialized_extents() in ext4_ext_map_blocks().  A
    portion of the patch assigns that function's signed integer return
    value to an unsigned int.  Consequently, negatively valued error codes
    are lost and can be treated as a bogus allocated block count.
    
    Signed-off-by: Eric Whitney <enwlinux@gmail.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3717191e66ae2c1bec8fdd0bfabe1240f11bbf9e
Author: Josef Bacik <jbacik@fb.com>
Date:   Thu Mar 6 19:01:07 2014 -0500

    Btrfs: fix deadlock with nested trans handles
    
    commit 3bbb24b20a8800158c33eca8564f432dd14d0bf3 upstream.
    
    Zach found this deadlock that would happen like this
    
    btrfs_end_transaction <- reduce trans->use_count to 0
      btrfs_run_delayed_refs
        btrfs_cow_block
          find_free_extent
    	btrfs_start_transaction <- increase trans->use_count to 1
              allocate chunk
    	btrfs_end_transaction <- decrease trans->use_count to 0
    	  btrfs_run_delayed_refs
    	    lock tree block we are cowing above ^^
    
    We need to only decrease trans->use_count if it is above 1, otherwise leave it
    alone.  This will make nested trans be the only ones who decrease their added
    ref, and will let us get rid of the trans->use_count++ hack if we have to commit
    the transaction.  Thanks,
    
    Reported-by: Zach Brown <zab@redhat.com>
    Signed-off-by: Josef Bacik <jbacik@fb.com>
    Tested-by: Zach Brown <zab@redhat.com>
    Signed-off-by: Chris Mason <clm@fb.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d1dc14b5691178bf28297621dc0add0ba5d6b407
Author: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Date:   Wed Feb 5 16:34:38 2014 +0900

    Btrfs: skip submitting barrier for missing device
    
    commit f88ba6a2a44ee98e8d59654463dc157bb6d13c43 upstream.
    
    I got an error on v3.13:
     BTRFS error (device sdf1) in write_all_supers:3378: errno=-5 IO failure (errors while submitting device barriers.)
    
    how to reproduce:
      > mkfs.btrfs -f -d raid1 /dev/sdf1 /dev/sdf2
      > wipefs -a /dev/sdf2
      > mount -o degraded /dev/sdf1 /mnt
      > btrfs balance start -f -sconvert=single -mconvert=single -dconvert=single /mnt
    
    The reason of the error is that barrier_all_devices() failed to submit
    barrier to the missing device.  However it is clear that we cannot do
    anything on missing device, and also it is not necessary to care chunks
    on the missing device.
    
    This patch stops sending/waiting barrier if device is missing.
    
    Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Signed-off-by: Josef Bacik <jbacik@fb.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit fd4037cadecf7b5c0e288c19d958917ac1c62a83
Author: Mark Tinguely <tinguely@sgi.com>
Date:   Fri Apr 4 07:10:49 2014 +1100

    xfs: fix directory hash ordering bug
    
    commit c88547a8119e3b581318ab65e9b72f27f23e641d upstream.
    
    Commit f5ea1100 ("xfs: add CRCs to dir2/da node blocks") introduced
    in 3.10 incorrectly converted the btree hash index array pointer in
    xfs_da3_fixhashpath(). It resulted in the the current hash always
    being compared against the first entry in the btree rather than the
    current block index into the btree block's hash entry array. As a
    result, it was comparing the wrong hashes, and so could misorder the
    entries in the btree.
    
    For most cases, this doesn't cause any problems as it requires hash
    collisions to expose the ordering problem. However, when there are
    hash collisions within a directory there is a very good probability
    that the entries will be ordered incorrectly and that actually
    matters when duplicate hashes are placed into or removed from the
    btree block hash entry array.
    
    This bug results in an on-disk directory corruption and that results
    in directory verifier functions throwing corruption warnings into
    the logs. While no data or directory entries are lost, access to
    them may be compromised, and attempts to remove entries from a
    directory that has suffered from this corruption may result in a
    filesystem shutdown.  xfs_repair will fix the directory hash
    ordering without data loss occuring.
    
    [dchinner: wrote useful a commit message]
    
    Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: Mark Tinguely <tinguely@sgi.com>
    Reviewed-by: Ben Myers <bpm@sgi.com>
    Signed-off-by: Dave Chinner <david@fromorbit.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 626d6cde21ad38e531efeb37f3ae81920e8c9a2f
Author: Claudio Takahasi <claudio.takahasi@openbossa.org>
Date:   Thu Jul 25 16:34:24 2013 -0300

    Bluetooth: Fix removing Long Term Key
    
    commit 5981a8821b774ada0be512fd9bad7c241e17657e upstream.
    
    This patch fixes authentication failure on LE link re-connection when
    BlueZ acts as slave (peripheral). LTK is removed from the internal list
    after its first use causing PIN or Key missing reply when re-connecting
    the link. The LE Long Term Key Request event indicates that the master
    is attempting to encrypt or re-encrypt the link.
    
    Pre-condition: BlueZ host paired and running as slave.
    How to reproduce(master):
    
      1) Establish an ACL LE encrypted link
      2) Disconnect the link
      3) Try to re-establish the ACL LE encrypted link (fails)
    
    > HCI Event: LE Meta Event (0x3e) plen 19
          LE Connection Complete (0x01)
            Status: Success (0x00)
            Handle: 64
            Role: Slave (0x01)
    ...
    @ Device Connected: 00:02:72:DC:29:C9 (1) flags 0x0000
    > HCI Event: LE Meta Event (0x3e) plen 13
          LE Long Term Key Request (0x05)
            Handle: 64
            Random number: 875be18439d9aa37
            Encryption diversifier: 0x76ed
    < HCI Command: LE Long Term Key Request Reply (0x08|0x001a) plen 18
            Handle: 64
            Long term key: 2aa531db2fce9f00a0569c7d23d17409
    > HCI Event: Command Complete (0x0e) plen 6
          LE Long Term Key Request Reply (0x08|0x001a) ncmd 1
            Status: Success (0x00)
            Handle: 64
    > HCI Event: Encryption Change (0x08) plen 4
            Status: Success (0x00)
            Handle: 64
            Encryption: Enabled with AES-CCM (0x01)
    ...
    @ Device Disconnected: 00:02:72:DC:29:C9 (1) reason 3
    < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
            Advertising: Enabled (0x01)
    > HCI Event: Command Complete (0x0e) plen 4
          LE Set Advertise Enable (0x08|0x000a) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 19
          LE Connection Complete (0x01)
            Status: Success (0x00)
            Handle: 64
            Role: Slave (0x01)
    ...
    @ Device Connected: 00:02:72:DC:29:C9 (1) flags 0x0000
    > HCI Event: LE Meta Event (0x3e) plen 13
          LE Long Term Key Request (0x05)
            Handle: 64
            Random number: 875be18439d9aa37
            Encryption diversifier: 0x76ed
    < HCI Command: LE Long Term Key Request Neg Reply (0x08|0x001b) plen 2
            Handle: 64
    > HCI Event: Command Complete (0x0e) plen 6
          LE Long Term Key Request Neg Reply (0x08|0x001b) ncmd 1
            Status: Success (0x00)
            Handle: 64
    > HCI Event: Disconnect Complete (0x05) plen 4
            Status: Success (0x00)
            Handle: 64
            Reason: Authentication Failure (0x05)
    @ Device Disconnected: 00:02:72:DC:29:C9 (1) reason 0
    
    Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
    Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d2bba52561f3ea43a0323cd33687b068a69dd8cc
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Wed Apr 2 17:45:05 2014 +0200

    pid_namespace: pidns_get() should check task_active_pid_ns() != NULL
    
    commit d23082257d83e4bc89727d5aedee197e907999d2 upstream.
    
    pidns_get()->get_pid_ns() can hit ns == NULL. This task_struct can't
    go away, but task_active_pid_ns(task) is NULL if release_task(task)
    was already called. Alternatively we could change get_pid_ns(ns) to
    check ns != NULL, but it seems that other callers are fine.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Cc: Eric W. Biederman ebiederm@xmission.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 18b258a37ee54cab6d0fc33f70b3c9d0ecf2dfdb
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Sat Feb 22 07:31:21 2014 -0500

    tty: Fix low_latency BUG
    
    commit a9c3f68f3cd8d55f809fbdb0c138ed061ea1bd25 upstream.
    
    The user-settable knob, low_latency, has been the source of
    several BUG reports which stem from flush_to_ldisc() running
    in interrupt context. Since 3.12, which added several sleeping
    locks (termios_rwsem and buf->lock) to the input processing path,
    the frequency of these BUG reports has increased.
    
    Note that changes in 3.12 did not introduce this regression;
    sleeping locks were first added to the input processing path
    with the removal of the BKL from N_TTY in commit
    a88a69c91256418c5907c2f1f8a0ec0a36f9e6cc,
    'n_tty: Fix loss of echoed characters and remove bkl from n_tty'
    and later in commit 38db89799bdf11625a831c5af33938dcb11908b6,
    'tty: throttling race fix'. Since those changes, executing
    flush_to_ldisc() in interrupt_context (ie, low_latency set), is unsafe.
    
    However, since most devices do not validate if the low_latency
    setting is appropriate for the context (process or interrupt) in
    which they receive data, some reports are due to misconfiguration.
    Further, serial dma devices for which dma fails, resort to
    interrupt receiving as a backup without resetting low_latency.
    
    Historically, low_latency was used to force wake-up the reading
    process rather than wait for the next scheduler tick. The
    effect was to trim multiple milliseconds of latency from
    when the process would receive new data.
    
    Recent tests [1] have shown that the reading process now receives
    data with only 10's of microseconds latency without low_latency set.
    
    Remove the low_latency rx steering from tty_flip_buffer_push();
    however, leave the knob as an optional hint to drivers that can
    tune their rx fifos and such like. Cleanup stale code comments
    regarding low_latency.
    
    [1] https://lkml.org/lkml/2014/2/20/434
    
    "Yay.. thats an annoying historical pain in the butt gone."
    	-- Alan Cox
    
    Reported-by: Beat Bolli <bbolli@ewanet.ch>
    Reported-by: Pavel Roskin <proski@gnu.org>
    Acked-by: David Sterba <dsterba@suse.cz>
    Cc: Grant Edwards <grant.b.edwards@gmail.com>
    Cc: Stanislaw Gruszka <sgruszka@redhat.com>
    Cc: Hal Murray <murray+fedora@ip-64-139-1-69.sjc.megapath.net>
    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Alan Cox <alan@linux.intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8351a31147e36d656ce17846d38235dabbd63a5f
Author: Hannes Reinecke <hare@suse.de>
Date:   Thu Feb 27 12:30:51 2014 +0100

    tty: Set correct tty name in 'active' sysfs attribute
    
    commit 723abd87f6e536f1353c8f64f621520bc29523a3 upstream.
    
    The 'active' sysfs attribute should refer to the currently active tty
    devices the console is running on, not the currently active console. The
    console structure doesn't refer to any device in sysfs, only the tty the
    console is running on has. So we need to print out the tty names in
    'active', not the console names.
    
    There is one special-case, which is tty0. If the console is directed to
    it, we want 'tty0' to show up in the file, so user-space knows that the
    messages get forwarded to the active VT. The ->device() callback would
    resolve tty0, though. Hence, treat it special and don't call into the VT
    layer to resolve it (plymouth is known to depend on it).
    
    Cc: Lennart Poettering <lennart@poettering.net>
    Cc: Kay Sievers <kay@vrfy.org>
    Cc: Jiri Slaby <jslaby@suse.cz>
    Signed-off-by: Werner Fink <werner@suse.de>
    Signed-off-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit c78609380c224adcbdf21f138505c63d93d4ce7c
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Thu Mar 13 15:30:39 2014 +0000

    staging: comedi: 8255_pci: initialize MITE data window
    
    commit 268d1e799663b795cba15c64f5d29407786a9dd4 upstream.
    
    According to National Instruments' PCI-DIO-96/PXI-6508/PCI-6503 User
    Manual, the physical address in PCI BAR1 needs to be OR'ed with 0x80 and
    written to register offset 0xC0 in the "MITE" registers (BAR0).  Do so
    during initialization of the National Instruments boards handled by the
    "8255_pci" driver.  The boards were previously handled by the
    "ni_pcidio" driver, where the initialization was done by `mite_setup()`
    in the "mite" module.  The "mite" module comes with too much extra
    baggage for the "8255_pci" driver to deal with so use a local, simpler
    initialization function.
    
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit f437aa6910609ea707815c2af1621d7bd7a2a596
Author: Lan Tianyu <tianyu.lan@intel.com>
Date:   Sat Mar 15 13:37:13 2014 -0400

    ACPI / button: Add ACPI Button event via netlink routine
    
    commit 0bf6368ee8f25826d0645c0f7a4f17c8845356a4 upstream.
    
    Commit 1696d9d (ACPI: Remove the old /proc/acpi/event interface)
    removed ACPI Button event which originally was sent to userspace via
    /proc/acpi/event. This caused ACPI shutdown regression on gentoo
    in VirtualBox. Now ACPI events are sent to userspace via netlink,
    so add ACPI Button event back via netlink routine.
    
    References: https://bugzilla.kernel.org/show_bug.cgi?id=71721
    Reported-and-tested-by: Richard Musil <richard.musil@gmail.com>
    Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7cdf9eb02fea22b615156f5e35ca8974047ee224
Author: Mohit Kumar <mohit.kumar@st.com>
Date:   Wed Apr 16 10:23:34 2014 -0600

    PCI: designware: Fix iATU programming for cfg1, io and mem viewport
    
    commit 017fcdc30cdae18c0946eef1ece1f14b4c7897ba upstream.
    
    This patch corrects iATU programming for cfg1, io and mem viewport.  Enable
    ATU only after configuring it.
    
    Signed-off-by: Mohit Kumar <mohit.kumar@st.com>
    Signed-off-by: Ajay Khandelwal <ajay.khandelwal@st.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Jingoo Han <jg1.han@samsung.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 47495e3596d95047168e4a831b2a8ccdf7efafaa
Author: Mohit Kumar <mohit.kumar@st.com>
Date:   Wed Feb 19 17:34:35 2014 +0530

    PCI: designware: Fix RC BAR to be single 64-bit non-prefetchable memory BAR
    
    commit dbffdd6862e67d60703f2df66c558bf448f81d6e upstream.
    
    The Synopsys PCIe core provides one pair of 32-bit BARs (BAR 0 and BAR 1).
    The BARs can be configured as follows:
    
      - One 64-bit BAR: BARs 0 and 1 are combined to form a single 64-bit BAR
      - Two 32-bit BARs: BARs 0 and 1 are two independent 32-bit BARs
    
    This patch corrects 64-bit, non-prefetchable memory BAR configuration
    implemented in dw driver.
    
    Signed-off-by: Mohit Kumar <mohit.kumar@st.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Pratyush Anand <pratyush.anand@st.com>
    Cc: Jingoo Han <jg1.han@samsung.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 6226a60b08a72290df15598d4355a42bcf4bb65d
Author: Neil Horman <nhorman@tuxdriver.com>
Date:   Wed Mar 12 14:44:33 2014 -0400

    x86: Adjust irq remapping quirk for older revisions of 5500/5520 chipsets
    
    commit 6f8a1b335fde143b7407036e2368d3cd6eb55674 upstream.
    
    Commit 03bbcb2e7e2 (iommu/vt-d: add quirk for broken interrupt
    remapping on 55XX chipsets) properly disables irq remapping on the
    5500/5520 chipsets that don't correctly perform that feature.
    
    However, when I wrote it, I followed the errata sheet linked in that
    commit too closely, and explicitly tied the activation of the quirk to
    revision 0x13 of the chip, under the assumption that earlier revisions
    were not in the field.  Recently a system was reported to be suffering
    from this remap bug and the quirk hadn't triggered, because the
    revision id register read at a lower value that 0x13, so the quirk
    test failed improperly.  Given this, it seems only prudent to adjust
    this quirk so that any revision less than 0x13 has the quirk asserted.
    
    [ tglx: Removed the 0x12 comparison of pci id 3405 as this is covered
        	by the <= 0x13 check already ]
    
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/1394649873-14913-1-git-send-email-nhorman@tuxdriver.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 4eaff7d2f4cc1768e5b336128d1653522c8fcf82
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon Apr 14 16:58:55 2014 -0400

    user namespace: fix incorrect memory barriers
    
    commit e79323bd87808fdfbc68ce6c5371bd224d9672ee upstream.
    
    smp_read_barrier_depends() can be used if there is data dependency between
    the readers - i.e. if the read operation after the barrier uses address
    that was obtained from the read operation before the barrier.
    
    In this file, there is only control dependency, no data dependecy, so the
    use of smp_read_barrier_depends() is incorrect. The code could fail in the
    following way:
    * the cpu predicts that idx < entries is true and starts executing the
      body of the for loop
    * the cpu fetches map->extent[0].first and map->extent[0].count
    * the cpu fetches map->nr_extents
    * the cpu verifies that idx < extents is true, so it commits the
      instructions in the body of the for loop
    
    The problem is that in this scenario, the cpu read map->extent[0].first
    and map->nr_extents in the wrong order. We need a full read memory barrier
    to prevent it.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 43c5512d313281d04a91531aa205fac9aa2995a2
Author: Oliver Neukum <oneukum@suse.de>
Date:   Fri Jan 10 10:51:53 2014 +0100

    ACPI / sleep: remove panic in case hardware has changed after S4
    
    commit 5c551e624abba6782034edd5b9eb58ac6f146b38 upstream.
    
    Some BIOSes change hardware based on the state of
    a laptop's lid. If the lid is closed, the touchpad is
    disabled and the checksum changes. Windows 8 no longer
    aborts resume if the checksum has changed.
    
    Signed-off-by: Oliver Neukum <oneukum@suse.de>
    [rjw: Use pr_crit() for the message and don't break the string]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 1e37176ee50aba87e7c4a31bcd588d04706fea03
Author: LEROY Christophe <christophe.leroy@c-s.fr>
Date:   Fri Nov 22 17:57:31 2013 +0100

    powerpc/8xx: mfspr SPRN_TBRx in lieu of mftb/mftbu is not supported
    
    commit ae2163be10ac6090e7aeed72591e2d7fabb1cdda upstream.
    
    Commit beb2dc0a7a84be003ce54e98b95d65cc66e6e536 breaks the MPC8xx which
    seems to not support using mfspr SPRN_TBRx instead of mftb/mftbu
    despite what is written in the reference manual.
    
    This patch reverts to the use of mftb/mftbu when CONFIG_8xx is
    selected.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Scott Wood <scottwood@freescale.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit b7b78ca82179e609592c74afa721f5aca0269625
Author: Helge Deller <deller@gmx.de>
Date:   Sun Apr 13 00:03:55 2014 +0200

    parisc: fix epoll_pwait syscall on compat kernel
    
    commit ab3e55b119c9653b19ea4edffb86f04db867ac98 upstream.
    
    This bug was detected with the libio-epoll-perl debian package where the
    test case IO-Ppoll-compat.t failed.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    CC: stable@kernel.org   # 3.0+
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 95c3a5624ae783081cc9d9b0e3d24ea19b36590e
Author: Wang, Xiaoming <xiaoming.wang@intel.com>
Date:   Mon Apr 14 12:30:45 2014 -0400

    net: ipv4: current group_info should be put after using.
    
    commit b04c46190219a4f845e46a459e3102137b7f6cac upstream.
    
    Plug a group_info refcount leak in ping_init.
    group_info is only needed during initialization and
    the code failed to release the reference on exit.
    While here move grabbing the reference to a place
    where it is actually needed.
    
    Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
    Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
    Signed-off-by: xiaoming wang <xiaoming.wang@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 95846d96fc3739c515e6c20b0fcea97ab290f09c
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Fri Mar 28 20:41:50 2014 +0100

    KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155)
    
    commit 5678de3f15010b9022ee45673f33bcfc71d47b60 upstream.
    
    QE reported that they got the BUG_ON in ioapic_service to trigger.
    I cannot reproduce it, but there are two reasons why this could happen.
    
    The less likely but also easiest one, is when kvm_irq_delivery_to_apic
    does not deliver to any APIC and returns -1.
    
    Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that
    function is never reached.  However, you can target the similar loop in
    kvm_irq_delivery_to_apic_fast; just program a zero logical destination
    address into the IOAPIC, or an out-of-range physical destination address.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 10083c00587485c79d86b5c425464418cfc3c586
Author: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Date:   Mon Apr 14 09:46:51 2014 -0500

    ipmi: Fix a race restarting the timer
    
    commit 48e8ac2979920ffa39117e2d725afa3a749bfe8d upstream.
    
    With recent changes it is possible for the timer handler to detect an
    idle interface and not start the timer, but the thread to start an
    operation at the same time.  The thread will not start the timer in that
    instance, resulting in the timer not running.
    
    Instead, move all timer operations under the lock and start the timer in
    the thread if it detect non-idle and the timer is not already running.
    Moving under locks allows the last timeout to be set in both the thread
    and the timer.  'Timer is not running' means that the timer is not
    pending and smi_timeout() is not running.  So we need a flag to detect
    this correctly.
    
    Also fix a few other timeout bugs: setting the last timeout when the
    interrupt has to be disabled and the timer started, and setting the last
    timeout in check_start_timer_thread possibly racing with the timer
    
    Signed-off-by: Corey Minyard <cminyard@mvista.com>
    Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit fa8c40b770e8746d1f2e9737068e54098fc9e8dd
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Thu Mar 13 11:23:38 2014 +1030

    virtio_balloon: don't softlockup on huge balloon changes.
    
    commit 1f74ef0f2d7d692fcd615621e0e734c3e7771413 upstream.
    
    When adding or removing 100G from a balloon:
    
        BUG: soft lockup - CPU#0 stuck for 22s! [vballoon:367]
    
    We have a wait_event_interruptible(), but the condition is always true
    (more ballooning to do) so we don't ever sleep.  We also have a
    wait_event() for the host to ack, but that is also always true as QEMU
    is synchronous for balloon operations.
    
    Reported-by: Gopesh Kumar Chaudhary <gopchaud@in.ibm.com>
    Cc: stable@kernel.org
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit fa48decc1df0ec789d7bb2ea737f823f649a3cc3
Author: Jan Kara <jack@suse.cz>
Date:   Thu Apr 3 14:46:23 2014 -0700

    bdi: avoid oops on device removal
    
    commit 5acda9d12dcf1ad0d9a5a2a7c646de3472fa7555 upstream.
    
    After commit 839a8e8660b6 ("writeback: replace custom worker pool
    implementation with unbound workqueue") when device is removed while we
    are writing to it we crash in bdi_writeback_workfn() ->
    set_worker_desc() because bdi->dev is NULL.
    
    This can happen because even though bdi_unregister() cancels all pending
    flushing work, nothing really prevents new ones from being queued from
    balance_dirty_pages() or other places.
    
    Fix the problem by clearing BDI_registered bit in bdi_unregister() and
    checking it before scheduling of any flushing work.
    
    Fixes: 839a8e8660b6777e7fe4e80af1a048aebe2b5977
    
    Reviewed-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Cc: Derek Basehore <dbasehore@chromium.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 24239843f9734736d15bc22003a3c2467b7f0fb1
Author: Derek Basehore <dbasehore@chromium.org>
Date:   Thu Apr 3 14:46:22 2014 -0700

    backing_dev: fix hung task on sync
    
    commit 6ca738d60c563d5c6cf6253ee4b8e76fa77b2b9e upstream.
    
    bdi_wakeup_thread_delayed() used the mod_delayed_work() function to
    schedule work to writeback dirty inodes.  The problem with this is that
    it can delay work that is scheduled for immediate execution, such as the
    work from sync_inodes_sb().  This can happen since mod_delayed_work()
    can now steal work from a work_queue.  This fixes the problem by using
    queue_delayed_work() instead.  This is a regression caused by commit
    839a8e8660b6 ("writeback: replace custom worker pool implementation with
    unbound workqueue").
    
    The reason that this causes a problem is that laptop-mode will change
    the delay, dirty_writeback_centisecs, to 60000 (10 minutes) by default.
    In the case that bdi_wakeup_thread_delayed() races with
    sync_inodes_sb(), sync will be stopped for 10 minutes and trigger a hung
    task.  Even if dirty_writeback_centisecs is not long enough to cause a
    hung task, we still don't want to delay sync for that long.
    
    We fix the problem by using queue_delayed_work() when we want to
    schedule writeback sometime in future.  This function doesn't change the
    timer if it is already armed.
    
    For the same reason, we also change bdi_writeback_workfn() to
    immediately queue the work again in the case that the work_list is not
    empty.  The same problem can happen if the sync work is run on the
    rescue worker.
    
    [jack@suse.cz: update changelog, add comment, use bdi_wakeup_thread_delayed()]
    Signed-off-by: Derek Basehore <dbasehore@chromium.org>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Cc: Alexander Viro <viro@zento.linux.org.uk>
    Reviewed-by: Tejun Heo <tj@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
    Cc: Derek Basehore <dbasehore@chromium.org>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Benson Leung <bleung@chromium.org>
    Cc: Sonny Rao <sonnyrao@chromium.org>
    Cc: Luigi Semenzato <semenzato@chromium.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a9600ec90a49b7d1560f1e35fb83ead94f793b5b
Author: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Date:   Tue Jan 21 15:03:36 2014 -0600

    amd64_edac: Fix logic to determine channel for F15 M30h processors
    
    commit 9d0e8d8348d54d60005c6c938b87b94648005d1c upstream.
    
    Update current channel selection logic to include F15h, M30h memory
    controllers.
    
    Refer F15 M30h BKDG D18F2x110[7:6] (DRAM Controller Select Low)
    (Link:http://support.amd.com/TechDocs/49125_15h_Models_30h-3Fh_BKDG.pdf)
    
    Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
    Link: http://lkml.kernel.org/r/1390338216-3873-1-git-send-email-Aravind.Gopalakrishnan@amd.com
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8e0a45a8ca903015a88bf5008371cec9ee6ddebc
Author: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Date:   Thu Jan 23 16:13:32 2014 -0600

    x86/quirks: Add workaround for AMD F16h Erratum792
    
    commit fb53a1ab88d14848dc292842e35c3bda3a665997 upstream.
    
    The workaround for this Erratum is included in AGESA. But BIOSes
    spun only after Jan2014 will have the fix (atleast server
    versions of the chip). The erratum affects both embedded and
    server platforms and since we cannot say with certainity that
    ALL BIOSes on systems out in the field will have the fix, we
    should probably insulate ourselves in case BIOS does not do the
    right thing or someone is using old BIOSes.
    
    Refer to Revision Guide for AMD F16h models 00h-0fh, document 51810
    Rev. 3.04, November2013 for details on the Erratum.
    
    Tested the patch on Fam16h server platform and it works fine.
    
    Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
    Cc: <hmh@hmh.eng.br>
    Cc: <Kim.Naru@amd.com>
    Cc: <Suravee.Suthikulpanit@amd.com>
    Cc: <bp@suse.de>
    Cc: <sherry.hurwitz@amd.com>
    Link: http://lkml.kernel.org/r/1390515212-1824-1-git-send-email-Aravind.Gopalakrishnan@amd.com
    [ Minor edits. ]
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 4aeced5ed3e351ffad601615a11305b6e2eb16e1
Author: Sergey Dyasly <dserrg@gmail.com>
Date:   Tue Sep 24 16:38:00 2013 +0100

    ARM: 7840/1: LPAE: don't reject mapping /dev/mem above 4GB
    
    commit 3159f372354e8e1f5dee714663d705dd2c7e0759 upstream.
    
    With LPAE enabled, physical address space is larger than 4GB. Allow mapping any
    part of it via /dev/mem by using PHYS_MASK to determine valid range.
    
    PHYS_MASK covers 40 bits with LPAE enabled and 32 bits otherwise.
    
    Reported-by: Vassili Karpov <av1474@comtv.ru>
    Signed-off-by: Sergey Dyasly <dserrg@gmail.com>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3da1d25c3849e8a02d4f70feeae16711ad458eaf
Author: Kieran Clancy <clancy.kieran@gmail.com>
Date:   Wed Apr 30 00:21:20 2014 +0930

    ACPI / EC: Process rather than discard events in acpi_ec_clear
    
    commit 3eba563e280101209bad27d40bfc83ddf1489234 upstream.
    
    Address a regression caused by commit ad332c8a4533:
    (ACPI / EC: Clear stale EC events on Samsung systems)
    
    After the earlier patch, there was found to be a race condition on some
    earlier Samsung systems (N150/N210/N220). The function acpi_ec_clear was
    sometimes discarding a new EC event before its GPE was triggered by the
    system. In the case of these systems, this meant that the "lid open"
    event was not registered on resume if that was the cause of the wake,
    leading to problems when attempting to close the lid to suspend again.
    
    After testing on a number of Samsung systems, both those affected by the
    previous EC bug and those affected by the race condition, it seemed that
    the best course of action was to process rather than discard the events.
    On Samsung systems which accumulate stale EC events, there does not seem
    to be any adverse side-effects of running the associated _Q methods.
    
    This patch adds an argument to the static function acpi_ec_sync_query so
    that it may be used within the acpi_ec_clear loop in place of
    acpi_ec_query_unlocked which was used previously.
    
    With thanks to Stefan Biereigel for reporting the issue, and for all the
    people who helped test the new patch on affected systems.
    
    Fixes: ad332c8a4533 (ACPI / EC: Clear stale EC events on Samsung systems)
    References: https://lkml.kernel.org/r/532FE3B2.9060808@biereigel-wb.de
    References: https://bugzilla.kernel.org/show_bug.cgi?id=44161#c173
    Reported-by: Stefan Biereigel <stefan@biereigel.de>
    Signed-off-by: Kieran Clancy <clancy.kieran@gmail.com>
    Tested-by: Stefan Biereigel <stefan@biereigel.de>
    Tested-by: Dennis Jansen <dennis.jansen@web.de>
    Tested-by: Nicolas Porcel <nicolasporcel06@gmail.com>
    Tested-by: Maurizio D'Addona <mauritiusdadd@gmail.com>
    Tested-by: Juan Manuel Cabo <juanmanuel.cabo@gmail.com>
    Tested-by: Giannis Koutsou <giannis.koutsou@gmail.com>
    Tested-by: Kieran Clancy <clancy.kieran@gmail.com>
    Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit ee16a58677a12cd4b17e76ba8565117e435f5e1f
Author: David Ertman <davidx.m.ertman@intel.com>
Date:   Tue Mar 25 04:27:55 2014 +0000

    e1000e: Fix no connectivity when driver loaded with cable out
    
    commit b20a774495671f037e7160ea2ce8789af6b61533 upstream.
    
    In commit da1e2046e5, the flow for enabling/disabling an Si errata
    workaround (e1000_lv_jumbo_workaround_ich8lan) was changed to fix a problem
    with iAMT connections dropping on interface down with jumbo frames set.
    Part of this change was to move the function call disabling the workaround
    to e1000e_down() from the e1000_setup_rctl() function.  The mechanic for
    disabling of this workaround involves writing several MAC and PHY registers
    back to hardware defaults.
    
    After this commit, when the driver is loaded with the cable out, the PHY
    registers are not programmed with the correct default values.  This causes
    the device to be capable of transmitting packets, but is unable to recieve
    them until this workaround is called.
    
    The flow of e1000e's open code relies upon calling the above workaround to
    expicitly program these registers either with jumbo frame appropriate settings
    or h/w defaults on 82579 and newer hardware.
    
    Fix this issue by adding logic to e1000_setup_rctl() that not only calls
    e1000_lv_jumbo_workaround_ich8lan() when jumbo frames are set, to enable the
    workaround, but also calls this function to explicitly disable the workaround
    in the case that jumbo frames are not set.
    
    Signed-off-by: Dave Ertman <davidx.m.ertman@intel.com>
    Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 008c29f91e856d2e46104c082baaa518832bd2a3
Author: Chew, Kean ho <kean.ho.chew@intel.com>
Date:   Sat Mar 1 00:03:56 2014 +0800

    i2c: i801: enable Intel BayTrail SMBUS
    
    commit 1b31e9b76ef8c62291e698dfdb973499986a7f68 upstream.
    
    Add Device ID of Intel BayTrail SMBus Controller.
    
    Signed-off-by: Chew, Kean ho <kean.ho.chew@intel.com>
    Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
    Reviewed-by: Jean Delvare <jdelvare@suse.de>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit aeaf64c5a760c88e7af7b316536980d41bf312cf
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun Jan 26 12:37:55 2014 -0500

    __dentry_path() fixes
    
    commit f6500801522c61782d4990fa1ad96154cb397cd4 upstream.
    
    * we need to save the starting point for restarts
    * reject pathologically short buffers outright
    
    Spotted-by: Denys Vlasenko <dvlasenk@redhat.com>
    Spotted-by: Oleg Nesterov <oleg@redhat.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 12716b1214464dc9b5d418f8e7a9f465ae03e241
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Tue Apr 29 17:09:54 2014 -0400

    dcache: restore error on restart in prepend_path
    
    We need to restore all variables including error (as it is done in the
    upstream kernel). The variable error was errorneously not restored when
    backporting the patch ede4cebce16f5643c61aedd6d88d9070a1d23a68
    (prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts).
    
    This should be applied only to the 3.12 series.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit ec44c106c1641a532faaed93a7d26d4b3e90cc25
Author: Joe Perches <joe@perches.com>
Date:   Sat Oct 26 20:41:53 2013 -0700

    printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages
    
    commit 29fc2bc75393864bbc9b90a7a13a0d0e11c6f41e upstream.
    
    pr_debug_ratelimited should be coded similarly to dev_dbg_ratelimited
    to reduce the "callbacks suppressed" messages.
    
    Add #include <linux/dynamic_debug.h> to printk.h. Unfortunately, this
    new #include must be after the prototype/declaration of function printk.
    
    It may be better to split out these _ratelimited declarations into
    a separate file one day.
    
    Any use of these pr_<foo>_ratelimited functions must also have another
    specific #include <ratelimited.h>.  Most users have this done indirectly
    via #include <linux/kernel.h>
    
    printk.h may not #include <linux/ratelimit.h> as it causes circular
    dependencies and compilation failures.
    
    Signed-off-by: Joe Perches <joe@perches.com>
    Tested-by: Krzysztof Mazur <krzysiek@podlesie.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 1b667c7507f5a34d4f4d2a18c63ebba0139a6d70
Author: Joe Perches <joe@perches.com>
Date:   Sat Oct 26 20:49:24 2013 -0700

    usbatm: Fix dynamic_debug / ratelimited atm_dbg and atm_rldbg macros
    
    commit 32e24930fb71c47a1366325b6f139e039cacaca4 upstream.
    
    Fix atm_dbg to use normal pr_debug not dynamic_pr_debug
    because dynamic_pr_debug may not be compiled in at all.
    
    Signed-off-by: Joe Perches <joe@perches.com>
    Tested-by: Krzysztof Mazur <krzysiek@podlesie.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8152809394aea1d96e0ebf77700c9e4f2237d04e
Author: Jay Cornwall <jay.cornwall@amd.com>
Date:   Wed Feb 26 15:49:31 2014 -0600

    iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
    
    commit e8d2d82d4a73f37b3270e4fd19ba83e48b589656 upstream.
    
    This patch corrects the PASID format in the INVALIDATE_IOTLB_PAGES
    command, which was caused by incorrect information in
    the AMD IOMMU Architectural Specification v2.01 document.
    
        Incorrect format:
             cmd->data[0][16:23] = PASID[7:0]
             cmd->data[1][16:27] = PASID[19:8]
    
         Correct format:
             cmd->data[0][16:23] = PASID[15:8]
             cmd->data[1][16:23] = PASID[7:0]
    
    However, this does not affect the IOMMUv2 hardware implementation,
    and has been corrected since version 2.02 of the specification
    (available through AMD NDA).
    
    Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
    Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Signed-off-by: Joerg Roedel <joro@8bytes.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d4527ea4815ea643d7d4341ac69efbd528f19c0f
Author: Tedd Ho-Jeong An <tedd.an@intel.com>
Date:   Tue Nov 12 13:10:58 2013 -0800

    Bluetooth: Add support for Intel Bluetooth device [8087:0a2a]
    
    commit ef4e5e4a756ff077dbdbdb8481d0e3788a07c005 upstream.
    
    This patch adds support for new Intel Bluetooth device.
    
    T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12   MxCh= 0
    D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=8087 ProdID=0a2a Rev= 0.01
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    
    Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 831bb5573dcbeb0da783c82e21084ac191dafc24
Author: Ingo Molnar <mingo@elte.hu>
Date:   Fri Feb 14 15:32:20 2014 +0100

    drivers/net: tulip_remove_one needs to call pci_disable_device()
    
    commit c321f7d7c87cdc623c87845f6378620573e57512 upstream.
    
    Otherwise the device is not completely shut down.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3566e03b5bc9c06855b07423ab4c6e2710aa21e4
Author: Petr Tesarik <ptesarik@suse.cz>
Date:   Thu Jan 30 09:48:02 2014 +0100

    /dev/mem: handle out-of-bounds read/write
    
    commit 08d2d00b291ed4eb91530050274e67a761c1901d upstream.
    
    The loff_t type may be wider than phys_addr_t (e.g. on 32-bit systems).
    Consequently, the file offset may be truncated in the assignment.
    Currently, /dev/mem wraps around, which may cause applications to read
    or write incorrect regions of memory by accident.
    
    Let's follow POSIX file semantics here and return 0 when reading from
    and -EFBIG when writing to an offset that cannot be represented by a
    phys_addr_t.
    
    Note that the conditional is optimized out by the compiler if loff_t
    has the same size as phys_addr_t.
    
    Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit de0b7b0dd1b625c8b4730869ae3d651e9189617c
Author: Emil Goode <emilgoode@gmail.com>
Date:   Sun Mar 9 21:06:51 2014 +0100

    brcmsmac: fix deadlock on missing firmware
    
    commit 8fc1e8c240aab968db658b2d8d079b4391207a36 upstream.
    
    When brcm80211 firmware is not installed networking hangs.
    A deadlock happens because we call ieee80211_unregister_hw()
    from the .start callback of struct ieee80211_ops. When .start
    is called we are under rtnl lock and ieee80211_unregister_hw()
    tries to take it again.
    
    Function call stack:
    
    dev_change_flags()
    	__dev_change_flags()
    		__dev_open()
    			ASSERT_RTNL() <-- Assert rtnl lock
    			ops->ndo_open()
    
    .ndo_open = ieee80211_open,
    
    ieee80211_open()
    	ieee80211_do_open()
    		drv_start()
    			local->ops->start()
    
    .start = brcms_ops_start,
    
    brcms_ops_start()
    	brcms_remove()
    		ieee80211_unregister_hw()
    			rtnl_lock() <-- Here we deadlock
    
    Introduced by:
    commit 25b5632fb35ca61b8ae3eee235edcdc2883f7a5e
    ("brcmsmac: request firmware in .start() callback")
    
    This patch fixes the bug by removing the call to brcms_remove()
    and moves the brcms_request_fw() call to the top of the .start
    callback to not initiate anything unless firmware is installed.
    
    Signed-off-by: Emil Goode <emilgoode@gmail.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7d4f4737432af6216e86975e587331b9d8b08063
Author: Alexei Starovoitov <ast@plumgrid.com>
Date:   Tue Oct 15 14:54:11 2013 -0700

    openvswitch: fix vport-netdev unregister
    
    commit b07c26511e94ab856f3700c56d582c0da36d5b4d upstream.
    
    The combination of two commits:
    commit 8e4e1713e4
    ("openvswitch: Simplify datapath locking.")
    commit 2537b4dd0a
    ("openvswitch:: link upper device for port devices")
    
    introduced a bug where upper_dev wasn't unlinked upon
    netdev_unregister notification
    
    The following steps:
    
      modprobe openvswitch
      ovs-dpctl add-dp test
      ip tuntap add dev tap1 mode tap
      ovs-dpctl add-if test tap1
      ip tuntap del dev tap1 mode tap
    
    are causing multiple warnings:
    
    [   62.747557] gre: GRE over IPv4 demultiplexor driver
    [   62.749579] openvswitch: Open vSwitch switching datapath
    [   62.755087] device test entered promiscuous mode
    [   62.765911] device tap1 entered promiscuous mode
    [   62.766033] IPv6: ADDRCONF(NETDEV_UP): tap1: link is not ready
    [   62.769017] ------------[ cut here ]------------
    [   62.769022] WARNING: CPU: 1 PID: 3267 at net/core/dev.c:5501 rollback_registered_many+0x20f/0x240()
    [   62.769023] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
    [   62.769051] CPU: 1 PID: 3267 Comm: ip Not tainted 3.12.0-rc3+ #60
    [   62.769052] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
    [   62.769053]  0000000000000009 ffff8807f25cbd28 ffffffff8175e575 0000000000000006
    [   62.769055]  0000000000000000 ffff8807f25cbd68 ffffffff8105314c ffff8807f25cbd58
    [   62.769057]  ffff8807f2634000 ffff8807f25cbdc8 ffff8807f25cbd88 ffff8807f25cbdc8
    [   62.769059] Call Trace:
    [   62.769062]  [<ffffffff8175e575>] dump_stack+0x55/0x76
    [   62.769065]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
    [   62.769067]  [<ffffffff8105319a>] warn_slowpath_null+0x1a/0x20
    [   62.769069]  [<ffffffff8162a04f>] rollback_registered_many+0x20f/0x240
    [   62.769071]  [<ffffffff8162a101>] rollback_registered+0x31/0x40
    [   62.769073]  [<ffffffff8162a488>] unregister_netdevice_queue+0x58/0x90
    [   62.769075]  [<ffffffff8154f900>] __tun_detach+0x140/0x340
    [   62.769077]  [<ffffffff8154fb36>] tun_chr_close+0x36/0x60
    [   62.769080]  [<ffffffff811bddaf>] __fput+0xff/0x260
    [   62.769082]  [<ffffffff811bdf5e>] ____fput+0xe/0x10
    [   62.769084]  [<ffffffff8107b515>] task_work_run+0xb5/0xe0
    [   62.769087]  [<ffffffff810029b9>] do_notify_resume+0x59/0x80
    [   62.769089]  [<ffffffff813a41fe>] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [   62.769091]  [<ffffffff81770f5a>] int_signal+0x12/0x17
    [   62.769093] ---[ end trace 838756c62e156ffb ]---
    [   62.769481] ------------[ cut here ]------------
    [   62.769485] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0()
    [   62.769486] sysfs: can not remove 'master', no directory
    [   62.769486] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
    [   62.769514] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G        W    3.12.0-rc3+ #60
    [   62.769515] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
    [   62.769518] Workqueue: events ovs_dp_notify_wq [openvswitch]
    [   62.769519]  0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006
    [   62.769521]  ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b28
    [   62.769523]  0000000000000000 ffffffff81a87a1f ffff8807f2634000 ffff880037038500
    [   62.769525] Call Trace:
    [   62.769528]  [<ffffffff8175e575>] dump_stack+0x55/0x76
    [   62.769529]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
    [   62.769531]  [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50
    [   62.769533]  [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0
    [   62.769535]  [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30
    [   62.769538]  [<ffffffff81631ef7>] __netdev_adjacent_dev_remove+0xf7/0x150
    [   62.769540]  [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50
    [   62.769542]  [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50
    [   62.769544]  [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140
    [   62.769548]  [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch]
    [   62.769550]  [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch]
    [   62.769552]  [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch]
    [   62.769555]  [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch]
    [   62.769557]  [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0
    [   62.769559]  [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0
    [   62.769562]  [<ffffffff8107659b>] worker_thread+0x11b/0x370
    [   62.769564]  [<ffffffff81076480>] ? rescuer_thread+0x350/0x350
    [   62.769566]  [<ffffffff8107f44a>] kthread+0xea/0xf0
    [   62.769568]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
    [   62.769570]  [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0
    [   62.769572]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
    [   62.769573] ---[ end trace 838756c62e156ffc ]---
    [   62.769574] ------------[ cut here ]------------
    [   62.769576] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0()
    [   62.769577] sysfs: can not remove 'upper_test', no directory
    [   62.769577] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
    [   62.769603] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G        W    3.12.0-rc3+ #60
    [   62.769604] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
    [   62.769606] Workqueue: events ovs_dp_notify_wq [openvswitch]
    [   62.769607]  0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006
    [   62.769609]  ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b58
    [   62.769611]  0000000000000000 ffff880807ad3bd9 ffff8807f2634000 ffff880037038500
    [   62.769613] Call Trace:
    [   62.769615]  [<ffffffff8175e575>] dump_stack+0x55/0x76
    [   62.769617]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
    [   62.769619]  [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50
    [   62.769621]  [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0
    [   62.769622]  [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30
    [   62.769624]  [<ffffffff81631f22>] __netdev_adjacent_dev_remove+0x122/0x150
    [   62.769627]  [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50
    [   62.769629]  [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50
    [   62.769631]  [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140
    [   62.769633]  [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch]
    [   62.769636]  [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch]
    [   62.769638]  [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch]
    [   62.769640]  [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch]
    [   62.769642]  [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0
    [   62.769644]  [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0
    [   62.769646]  [<ffffffff8107659b>] worker_thread+0x11b/0x370
    [   62.769648]  [<ffffffff81076480>] ? rescuer_thread+0x350/0x350
    [   62.769650]  [<ffffffff8107f44a>] kthread+0xea/0xf0
    [   62.769652]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
    [   62.769654]  [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0
    [   62.769656]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
    [   62.769657] ---[ end trace 838756c62e156ffd ]---
    [   62.769724] device tap1 left promiscuous mode
    
    This patch also affects moving devices between net namespaces.
    
    OVS used to ignore netns move notifications which caused problems.
    Like:
      ovs-dpctl add-if test tap1
      ip link set tap1 netns 3512
    and then removing tap1 inside the namespace will cause hang on missing dev_put.
    
    With this patch OVS will detach dev upon receiving netns move event.
    
    Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
    Signed-off-by: Jesse Gross <jesse@nicira.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>