commit 0d1097ae44c2566bb8c9eacccd795c456d08c8a5
Author: Sasha Levin <alexander.levin@verizon.com>
Date:   Fri Jul 29 21:41:44 2016 -0400

    Linux 3.18.38
    
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 52c84a95dc6af6c9e856c6a0f7745fd19afccd4e
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Thu Jul 14 17:55:21 2016 -0400

    4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival"
    
    When I pulled in 4.1.28 into my stable 4.1-rt tree and ran the tests,
    it crashed with a severe OOM killing everything. I then tested 4.1.28
    without -rt and it had the same issue. I did a bisect between 4.1.27
    and 4.1.28 and found that the bug started at:
    
    commit 8f182270dfec "mm/swap.c: flush lru pvecs on compound page
    arrival"
    
    Looking at that patch and what's in mainline, I see that there's a
    mismatch in one of the hunks:
    
    Mainline:
    
    @@ -391,9 +391,8 @@ static void __lru_cache_add(struct page *page)
            struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
    
            get_page(page);
    -       if (!pagevec_space(pvec))
    +       if (!pagevec_add(pvec, page) || PageCompound(page))
                    __pagevec_lru_add(pvec);
    -       pagevec_add(pvec, page);
            put_cpu_var(lru_add_pvec);
     }
    
    Stable 4.1.28:
    
    @@ -631,9 +631,8 @@ static void __lru_cache_add(struct page *page)
            struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
    
            page_cache_get(page);
    -       if (!pagevec_space(pvec))
    +       if (!pagevec_space(pvec) || PageCompound(page))
                    __pagevec_lru_add(pvec);
    -       pagevec_add(pvec, page);
            put_cpu_var(lru_add_pvec);
     }
    
    Where mainline replace pagevec_space() with pagevec_add, and stable did
    not.
    
    Fixing this makes the OOM go away.
    
    Note, 3.18 has the same bug.
    
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit da3e7add10e11c1ed81b11e95213fc3aace2aedd
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Thu Jul 14 21:10:37 2016 +1000

    powerpc: Fix build break due to missing PPC_FEATURE2_HTM_NOSC
    
    The backport of 4705e02498d6 ("powerpc: Update TM user feature bits in
    scan_features()") (f49eb503f0f9), missed the fact that 4.1 doesn't
    include the commit that added PPC_FEATURE2_HTM_NOSC.
    
    The correct fix is simply to omit PPC_FEATURE2_HTM_NOSC.
    
    Fixes: f49eb503f0f9 ("powerpc: Update TM user feature bits in scan_features()")
    Reported-by: Christian Zigotzky <chzigotzky@bayern-mail.de>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 8c8e669bb8c5f690976883dd3b7a32d605c58d9a
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Tue Jul 5 17:32:30 2016 -0400

    ecryptfs: don't allow mmap when the lower fs doesn't support it
    
    [ Upstream commit f0fe970df3838c202ef6c07a4c2b36838ef0a88b ]
    
    There are legitimate reasons to disallow mmap on certain files, notably
    in sysfs or procfs.  We shouldn't emulate mmap support on file systems
    that don't offer support natively.
    
    CVE-2016-1583
    
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    Cc: stable@vger.kernel.org
    [tyhicks: clean up f_op check by using ecryptfs_file_to_lower()]
    Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
    
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 050216f65a9d2caa4385996a4a226c1b6f4969f7
Author: Jan Beulich <JBeulich@suse.com>
Date:   Fri Jul 8 06:15:07 2016 -0600

    xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7
    
    [ Upstream commit 6f2d9d99213514360034c6d52d2c3919290b3504 ]
    
    As of Xen 4.7 PV CPUID doesn't expose either of CPUID[1].ECX[7] and
    CPUID[0x80000007].EDX[7] anymore, causing the driver to fail to load on
    both Intel and AMD systems. Doing any kind of hardware capability
    checks in the driver as a prerequisite was wrong anyway: With the
    hypervisor being in charge, all such checking should be done by it. If
    ACPI data gets uploaded despite some missing capability, the hypervisor
    is free to ignore part or all of that data.
    
    Ditch the entire check_prereq() function, and do the only valid check
    (xen_initial_domain()) in the caller in its place.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 38cd765b6d7cbb473c7ff29a9213336fde059330
Author: Jan Beulich <JBeulich@suse.com>
Date:   Thu Jul 7 01:32:04 2016 -0600

    xenbus: don't bail early from xenbus_dev_request_and_reply()
    
    [ Upstream commit 7469be95a487319514adce2304ad2af3553d2fc9 ]
    
    xenbus_dev_request_and_reply() needs to track whether a transaction is
    open.  For XS_TRANSACTION_START messages it calls transaction_start()
    and for XS_TRANSACTION_END messages it calls transaction_end().
    
    If sending an XS_TRANSACTION_START message fails or responds with an
    an error, the transaction is not open and transaction_end() must be
    called.
    
    If sending an XS_TRANSACTION_END message fails, the transaction is
    still open, but if an error response is returned the transaction is
    closed.
    
    Commit 027bd7e89906 ("xen/xenbus: Avoid synchronous wait on XenBus
    stalling shutdown/restart") introduced a regression where failed
    XS_TRANSACTION_START messages were leaving the transaction open.  This
    can cause problems with suspend (and migration) as all transactions
    must be closed before suspending.
    
    It appears that the problematic change was added accidentally, so just
    remove it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit e6e8b5344c40aa04414e09ad6c92ba511bde5bc5
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Tue Jul 5 17:32:29 2016 -0400

    Revert "ecryptfs: forbid opening files without mmap handler"
    
    [ Upstream commit 78c4e172412de5d0456dc00d2b34050aa0b683b5 ]
    
    This reverts commit 2f36db71009304b3f0b95afacd8eba1f9f046b87.
    
    It fixed a local root exploit but also introduced a dependency on
    the lower file system implementing an mmap operation just to open a file,
    which is a bit of a heavy hammer.  The right fix is to have mmap depend
    on the existence of the mmap handler instead.
    
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 19f46e355fc211e071896916b7e4ec1f9b243d90
Author: Jan Beulich <JBeulich@suse.com>
Date:   Thu Jul 7 01:23:57 2016 -0600

    xenbus: don't BUG() on user mode induced condition
    
    [ Upstream commit 0beef634b86a1350c31da5fcc2992f0d7c8a622b ]
    
    Inability to locate a user mode specified transaction ID should not
    lead to a kernel crash. For other than XS_TRANSACTION_START also
    don't issue anything to xenbus if the specified ID doesn't match that
    of any active transaction.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 12d75ae734c265f419cf063e750d476a6a2d99ff
Author: Jennifer Herbert <Jennifer.Herbert@citrix.com>
Date:   Thu Feb 5 14:45:40 2015 +0000

    xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
    
    [ Upstream commit a2e75bc2ee207351e6806e77a5379c6c1dd4598a ]
    
    If Xenstore sends back a XS_ERROR for TRANSACTION_END, the driver BUGs
    because it cannot find the matching transaction in the list.  For
    TRANSACTION_START, it leaks memory.
    
    Check the message as returned from xenbus_dev_request_and_reply(), and
    clean up for TRANSACTION_START or discard the error for
    TRANSACTION_END.
    
    Signed-off-by: Jennifer Herbert <Jennifer.Herbert@citrix.com>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit aad82778ead7e9fa63b07a420eb1d5bab7dcbb0e
Author: David Daney <david.daney@cavium.com>
Date:   Thu Jun 16 15:50:31 2016 -0700

    MIPS: Fix page table corruption on THP permission changes.
    
    [ Upstream commit 88d02a2ba6c52350f9a73ff1b01a5be839c3ca17 ]
    
    When the core THP code is modifying the permissions of a huge page it
    calls pmd_modify(), which unfortunately was clearing the _PAGE_HUGE bit
    of the page table entry.  The result can be kernel messages like:
    
    mm/memory.c:397: bad pmd 000000040080004d.
    mm/memory.c:397: bad pmd 00000003ff00004d.
    mm/memory.c:397: bad pmd 000000040100004d.
    
    or:
    
    ------------[ cut here ]------------
    WARNING: at mm/mmap.c:3200 exit_mmap+0x150/0x158()
    Modules linked in: ipv6 at24 octeon3_ethernet octeon_srio_nexus m25p80
    CPU: 12 PID: 1295 Comm: pmderr Not tainted 3.10.87-rt80-Cavium-Octeon #4
    Stack : 0000000040808000 0000000014009ce1 0000000000400004 ffffffff81076ba0
              0000000000000000 0000000000000000 ffffffff85110000 0000000000000119
              0000000000000004 0000000000000000 0000000000000119 43617669756d2d4f
              0000000000000000 ffffffff850fda40 ffffffff85110000 0000000000000000
              0000000000000000 0000000000000009 ffffffff809207a0 0000000000000c80
              ffffffff80f1bf20 0000000000000001 000000ffeca36828 0000000000000001
              0000000000000000 0000000000000001 000000ffeca7e700 ffffffff80886924
              80000003fd7a0000 80000003fd7a39b0 80000003fdea8000 ffffffff80885780
              80000003fdea8000 ffffffff80f12218 000000000000000c 000000000000050f
              0000000000000000 ffffffff80865c4c 0000000000000000 0000000000000000
              ...
    Call Trace:
    [<ffffffff80865c4c>] show_stack+0x6c/0xf8
    [<ffffffff80885780>] warn_slowpath_common+0x78/0xa8
    [<ffffffff809207a0>] exit_mmap+0x150/0x158
    [<ffffffff80882d44>] mmput+0x5c/0x110
    [<ffffffff8088b450>] do_exit+0x230/0xa68
    [<ffffffff8088be34>] do_group_exit+0x54/0x1d0
    [<ffffffff8088bfc0>] __wake_up_parent+0x0/0x18
    
    ---[ end trace c7b38293191c57dc ]---
    BUG: Bad rss-counter state mm:80000003fa168000 idx:1 val:1536
    
    Fix by not clearing _PAGE_HUGE bit.
    
    Signed-off-by: David Daney <david.daney@cavium.com>
    Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com>
    Cc: stable@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13687/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 8c2cb775fec8e3e4c930e9eb213faf6424eb7219
Author: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date:   Mon Jul 4 14:07:16 2016 +0200

    qeth: delete napi struct when removing a qeth device
    
    [ Upstream commit 7831b4ff0d926e0deeaabef9db8800ed069a2757 ]
    
    A qeth_card contains a napi_struct linked to the net_device during
    device probing. This struct must be deleted when removing the qeth
    device, otherwise Panic on oops can occur when qeth devices are
    repeatedly removed and added.
    
    Fixes: a1c3ed4c9ca ("qeth: NAPI support for l2 and l3 discipline")
    Cc: stable@vger.kernel.org # v2.6.37+
    Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
    Tested-by: Alexander Klein <ALKL@de.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit a851e568525bde7790c8a2bdd49a0258b02accf7
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Jul 4 14:02:15 2016 +0200

    ALSA: timer: Fix negative queue usage by racy accesses
    
    [ Upstream commit 3fa6993fef634e05d200d141a85df0b044572364 ]
    
    The user timer tu->qused counter may go to a negative value when
    multiple concurrent reads are performed since both the check and the
    decrement of tu->qused are done in two individual locked contexts.
    This results in bogus read outs, and the endless loop in the
    user-space side.
    
    The fix is to move the decrement of the tu->qused counter into the
    same spinlock context as the zero-check of the counter.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit b86ef7ef23554d978422ab49366223932ce976d4
Author: Omar Sandoval <osandov@fb.com>
Date:   Fri Jul 1 00:39:35 2016 -0700

    block: fix use-after-free in sys_ioprio_get()
    
    [ Upstream commit 8ba8682107ee2ca3347354e018865d8e1967c5f4 ]
    
    get_task_ioprio() accesses the task->io_context without holding the task
    lock and thus can race with exit_io_context(), leading to a
    use-after-free. The reproducer below hits this within a few seconds on
    my 4-core QEMU VM:
    
    #define _GNU_SOURCE
    #include <assert.h>
    #include <unistd.h>
    #include <sys/syscall.h>
    #include <sys/wait.h>
    
    int main(int argc, char **argv)
    {
            pid_t pid, child;
            long nproc, i;
    
            /* ioprio_set(IOPRIO_WHO_PROCESS, 0, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)); */
            syscall(SYS_ioprio_set, 1, 0, 0x6000);
    
            nproc = sysconf(_SC_NPROCESSORS_ONLN);
    
            for (i = 0; i < nproc; i++) {
                    pid = fork();
                    assert(pid != -1);
                    if (pid == 0) {
                            for (;;) {
                                    pid = fork();
                                    assert(pid != -1);
                                    if (pid == 0) {
                                            _exit(0);
                                    } else {
                                            child = wait(NULL);
                                            assert(child == pid);
                                    }
                            }
                    }
    
                    pid = fork();
                    assert(pid != -1);
                    if (pid == 0) {
                            for (;;) {
                                    /* ioprio_get(IOPRIO_WHO_PGRP, 0); */
                                    syscall(SYS_ioprio_get, 2, 0);
                            }
                    }
            }
    
            for (;;) {
                    /* ioprio_get(IOPRIO_WHO_PGRP, 0); */
                    syscall(SYS_ioprio_get, 2, 0);
            }
    
            return 0;
    }
    
    This gets us KASAN dumps like this:
    
    [   35.526914] ==================================================================
    [   35.530009] BUG: KASAN: out-of-bounds in get_task_ioprio+0x7b/0x90 at addr ffff880066f34e6c
    [   35.530009] Read of size 2 by task ioprio-gpf/363
    [   35.530009] =============================================================================
    [   35.530009] BUG blkdev_ioc (Not tainted): kasan: bad access detected
    [   35.530009] -----------------------------------------------------------------------------
    
    [   35.530009] Disabling lock debugging due to kernel taint
    [   35.530009] INFO: Allocated in create_task_io_context+0x2b/0x370 age=0 cpu=0 pid=360
    [   35.530009]  ___slab_alloc+0x55d/0x5a0
    [   35.530009]  __slab_alloc.isra.20+0x2b/0x40
    [   35.530009]  kmem_cache_alloc_node+0x84/0x200
    [   35.530009]  create_task_io_context+0x2b/0x370
    [   35.530009]  get_task_io_context+0x92/0xb0
    [   35.530009]  copy_process.part.8+0x5029/0x5660
    [   35.530009]  _do_fork+0x155/0x7e0
    [   35.530009]  SyS_clone+0x19/0x20
    [   35.530009]  do_syscall_64+0x195/0x3a0
    [   35.530009]  return_from_SYSCALL_64+0x0/0x6a
    [   35.530009] INFO: Freed in put_io_context+0xe7/0x120 age=0 cpu=0 pid=1060
    [   35.530009]  __slab_free+0x27b/0x3d0
    [   35.530009]  kmem_cache_free+0x1fb/0x220
    [   35.530009]  put_io_context+0xe7/0x120
    [   35.530009]  put_io_context_active+0x238/0x380
    [   35.530009]  exit_io_context+0x66/0x80
    [   35.530009]  do_exit+0x158e/0x2b90
    [   35.530009]  do_group_exit+0xe5/0x2b0
    [   35.530009]  SyS_exit_group+0x1d/0x20
    [   35.530009]  entry_SYSCALL_64_fastpath+0x1a/0xa4
    [   35.530009] INFO: Slab 0xffffea00019bcd00 objects=20 used=4 fp=0xffff880066f34ff0 flags=0x1fffe0000004080
    [   35.530009] INFO: Object 0xffff880066f34e58 @offset=3672 fp=0x0000000000000001
    [   35.530009] ==================================================================
    
    Fix it by grabbing the task lock while we poke at the io_context.
    
    Cc: stable@vger.kernel.org
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Omar Sandoval <osandov@fb.com>
    Signed-off-by: Jens Axboe <axboe@fb.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 82736d510a43d7362f0899f7cc61429f0b342647
Author: Borislav Petkov <bp@suse.de>
Date:   Thu Jun 16 19:13:49 2016 +0200

    x86/amd_nb: Fix boot crash on non-AMD systems
    
    [ Upstream commit 1ead852dd88779eda12cb09cc894a03d9abfe1ec ]
    
    Fix boot crash that triggers if this driver is built into a kernel and
    run on non-AMD systems.
    
    AMD northbridges users call amd_cache_northbridges() and it returns
    a negative value to signal that we weren't able to cache/detect any
    northbridges on the system.
    
    At least, it should do so as all its callers expect it to do so. But it
    does return a negative value only when kmalloc() fails.
    
    Fix it to return -ENODEV if there are no NBs cached as otherwise, amd_nb
    users like amd64_edac, for example, which relies on it to know whether
    it should load or not, gets loaded on systems like Intel Xeons where it
    shouldn't.
    
    Reported-and-tested-by: Tony Battersby <tonyb@cybernetics.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: <stable@vger.kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1466097230-5333-2-git-send-email-bp@alien8.de
    Link: https://lkml.kernel.org/r/5761BEB0.9000807@cybernetics.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit fa48403aa5c34a02e39f17d08cfd1da134205928
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Jun 29 15:23:08 2016 +0200

    ALSA: au88x0: Fix calculation in vortex_wtdma_bufshift()
    
    [ Upstream commit 62db7152c924e4c060e42b34a69cd39658e8a0dc ]
    
    vortex_wtdma_bufshift() function does calculate the page index
    wrongly, first masking then shift, which always results in zero.
    The proper computation is to first shift, then mask.
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 9f0a4f41de5d93907d09c6c18bc782d623b255ab
Author: Brian King <brking@linux.vnet.ibm.com>
Date:   Mon Jun 27 09:09:40 2016 -0500

    ipr: Clear interrupt on croc/crocodile when running with LSI
    
    [ Upstream commit 54e430bbd490e18ab116afa4cd90dcc45787b3df ]
    
    If we fall back to using LSI on the Croc or Crocodile chip we need to
    clear the interrupt so we don't hang the system.
    
    Cc: <stable@vger.kernel.org>
    Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

commit 9d17157617df7e7d3888e4b9b98eb58410987fb2
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Jun 27 21:06:51 2016 +0200

    ALSA: echoaudio: Fix memory allocation
    
    [ Upstream commit 9c6795a9b3cbb56a9fbfaf43909c5c22999ba317 ]
    
    'commpage_bak' is allocated with 'sizeof(struct echoaudio)' bytes.
    We then copy 'sizeof(struct comm_page)' bytes in it.
    On my system, smatch complains because one is 2960 and the other is 3072.
    
    This would result in memory corruption or a oops.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@verizon.com>