commit deb3303f665b31c29210ef4b30b1e69cb06cc397
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Oct 13 09:18:59 2018 +0200

    Linux 4.9.133

commit 62dd223bec262d663c5099d40630d0256a05c338
Author: Andy Lutomirski <luto@kernel.org>
Date:   Mon Oct 17 14:40:11 2016 -0700

    x86/fpu: Finish excising 'eagerfpu'
    
    commit e63650840e8b053aa09ad934877e87e9941ed135 upstream.
    
    Now that eagerfpu= is gone, remove it from the docs and some
    comments.  Also sync the changes to tools/.
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/cf430dd4481d41280e93ac6cf0def1007a67fc8e.1476740397.git.luto@kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit de8e1e51fd4110f2eb2f102ac506e06eb95814ea
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Oct 11 16:22:49 2018 +0200

    Revert "perf: sync up x86/.../cpufeatures.h"
    
    This reverts commit f09a7b0eead737b33d940bf5c2509ca1441e9590
    
    Daniel writes:
            Because the modification in this patch actually belongs to
            e63650840e8b ("x86/fpu: Finish excising 'eagerfpu'")
    
    Reported-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 60696d91bbd62586eec75b53ef03bfa92565afc1
Author: Rik van Riel <riel@redhat.com>
Date:   Tue Oct 4 20:34:34 2016 -0400

    x86/fpu: Remove struct fpu::counter
    
    commit 3913cc3507575273beb165a5e027a081913ed507 upstream.
    
    With the lazy FPU code gone, we no longer use the counter field
    in struct fpu for anything. Get rid it.
    
    Signed-off-by: Rik van Riel <riel@redhat.com>
    Reviewed-by: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: pbonzini@redhat.com
    Link: http://lkml.kernel.org/r/1475627678-20788-6-git-send-email-riel@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fd0aa7800151c26f7eab4573e2ade7ae8f548b2
Author: Andy Lutomirski <luto@kernel.org>
Date:   Tue Oct 4 20:34:33 2016 -0400

    x86/fpu: Remove use_eager_fpu()
    
    commit c592b57347069abfc0dcad3b3a302cf882602597 upstream.
    
    This removes all the obvious code paths that depend on lazy FPU mode.
    It shouldn't change the generated code at all.
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Signed-off-by: Rik van Riel <riel@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: pbonzini@redhat.com
    Link: http://lkml.kernel.org/r/1475627678-20788-5-git-send-email-riel@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fcbd4cc28b190277f77d9a82c1e4d736224bc8c6
Author: Gao Feng <gfree.wind@vip.163.com>
Date:   Tue May 16 09:30:18 2017 +0800

    ebtables: arpreply: Add the standard target sanity check
    
    commit c953d63548207a085abcb12a15fefc8a11ffdf0a upstream.
    
    The info->target comes from userspace and it would be used directly.
    So we need to add the sanity check to make sure it is a valid standard
    target, although the ebtables tool has already checked it. Kernel needs
    to validate anything coming from userspace.
    
    If the target is set as an evil value, it would break the ebtables
    and cause a panic. Because the non-standard target is treated as one
    offset.
    
    Now add one helper function ebt_invalid_target, and we would replace
    the macro INVALID_TARGET later.
    
    Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Cc: Loic <hackurx@opensec.fr>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 25f15a9283442a80b78de2d14ffe52666ea384eb
Author: Zhi Chen <zhichen@codeaurora.org>
Date:   Mon Jun 18 17:00:39 2018 +0300

    ath10k: fix scan crash due to incorrect length calculation
    
    commit c8291988806407e02a01b4b15b4504eafbcc04e0 upstream.
    
    Length of WMI scan message was not calculated correctly. The allocated
    buffer was smaller than what we expected. So WMI message corrupted
    skb_info, which is at the end of skb->data. This fix takes TLV header
    into account even if the element is zero-length.
    
    Crash log:
      [49.629986] Unhandled kernel unaligned access[#1]:
      [49.634932] CPU: 0 PID: 1176 Comm: logd Not tainted 4.4.60 #180
      [49.641040] task: 83051460 ti: 8329c000 task.ti: 8329c000
      [49.646608] $ 0   : 00000000 00000001 80984a80 00000000
      [49.652038] $ 4   : 45259e89 8046d484 8046df30 8024ba70
      [49.657468] $ 8   : 00000000 804cc4c0 00000001 20306320
      [49.662898] $12   : 33322037 000110f2 00000000 31203930
      [49.668327] $16   : 82792b40 80984a80 00000001 804207fc
      [49.673757] $20   : 00000000 0000012c 00000040 80470000
      [49.679186] $24   : 00000000 8024af7c
      [49.684617] $28   : 8329c000 8329db88 00000001 802c58d0
      [49.690046] Hi    : 00000000
      [49.693022] Lo    : 453c0000
      [49.696013] epc   : 800efae4 put_page+0x0/0x58
      [49.700615] ra    : 802c58d0 skb_release_data+0x148/0x1d4
      [49.706184] Status: 1000fc03 KERNEL EXL IE
      [49.710531] Cause : 00800010 (ExcCode 04)
      [49.714669] BadVA : 45259e89
      [49.717644] PrId  : 00019374 (MIPS 24Kc)
    
    Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Cc: Brian Norris <briannorris@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4b934d68ea1352335ceced5102415a425d01ce55
Author: Richard Weinberger <richard@nod.at>
Date:   Mon Sep 3 23:06:23 2018 +0200

    ubifs: Check for name being NULL while mounting
    
    commit 37f31b6ca4311b94d985fb398a72e5399ad57925 upstream.
    
    The requested device name can be NULL or an empty string.
    Check for that and refuse to continue. UBIFS has to do this manually
    since we cannot use mount_bdev(), which checks for this condition.
    
    Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
    Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d66949b1a16432969f96d6fd135777c2689843a
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Wed Sep 12 16:27:44 2018 -0700

    ucma: fix a use-after-free in ucma_resolve_ip()
    
    commit 5fe23f262e0548ca7f19fb79f89059a60d087d22 upstream.
    
    There is a race condition between ucma_close() and ucma_resolve_ip():
    
    CPU0                            CPU1
    ucma_resolve_ip():              ucma_close():
    
    ctx = ucma_get_ctx(file, cmd.id);
    
            list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) {
                    mutex_lock(&mut);
                    idr_remove(&ctx_idr, ctx->id);
                    mutex_unlock(&mut);
                    ...
                    mutex_lock(&mut);
                    if (!ctx->closing) {
                            mutex_unlock(&mut);
                            rdma_destroy_id(ctx->cm_id);
                    ...
                    ucma_free_ctx(ctx);
    
    ret = rdma_resolve_addr();
    ucma_put_ctx(ctx);
    
    Before idr_remove(), ucma_get_ctx() could still find the ctx
    and after rdma_destroy_id(), rdma_resolve_addr() may still
    access id_priv pointer. Also, ucma_put_ctx() may use ctx after
    ucma_free_ctx() too.
    
    ucma_close() should call ucma_put_ctx() too which tests the
    refcnt and waits for the last one releasing it. The similar
    pattern is already used by ucma_destroy_id().
    
    Reported-and-tested-by: syzbot+da2591e115d57a9cbb8b@syzkaller.appspotmail.com
    Reported-by: syzbot+cfe3c1e8ef634ba8964b@syzkaller.appspotmail.com
    Cc: Jason Gunthorpe <jgg@mellanox.com>
    Cc: Doug Ledford <dledford@redhat.com>
    Cc: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a87e1bd5d8f7b31154c12450a710ef695d16e983
Author: Chao Yu <yuchao0@huawei.com>
Date:   Thu Aug 2 22:59:12 2018 +0800

    f2fs: fix invalid memory access
    
    commit d3f07c049dab1a3f1740f476afd3d5e5b738c21c upstream.
    
    syzbot found the following crash on:
    
    HEAD commit:    d9bd94c0bcaa Add linux-next specific files for 20180801
    git tree:       linux-next
    console output: https://syzkaller.appspot.com/x/log.txt?x=1001189c400000
    kernel config:  https://syzkaller.appspot.com/x/.config?x=cc8964ea4d04518c
    dashboard link: https://syzkaller.appspot.com/bug?extid=c966a82db0b14aa37e81
    compiler:       gcc (GCC) 8.0.1 20180413 (experimental)
    
    Unfortunately, I don't have any reproducer for this crash yet.
    
    IMPORTANT: if you fix the bug, please add the following tag to the commit:
    Reported-by: syzbot+c966a82db0b14aa37e81@syzkaller.appspotmail.com
    
    loop7: rw=12288, want=8200, limit=20
    netlink: 65342 bytes leftover after parsing attributes in process `syz-executor4'.
    openvswitch: netlink: Message has 8 unknown bytes.
    kasan: CONFIG_KASAN_INLINE enabled
    kasan: GPF could be caused by NULL-ptr deref or user memory access
    general protection fault: 0000 [#1] SMP KASAN
    CPU: 1 PID: 7615 Comm: syz-executor7 Not tainted 4.18.0-rc7-next-20180801+ #29
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:__read_once_size include/linux/compiler.h:188 [inline]
    RIP: 0010:compound_head include/linux/page-flags.h:142 [inline]
    RIP: 0010:PageLocked include/linux/page-flags.h:272 [inline]
    RIP: 0010:f2fs_put_page fs/f2fs/f2fs.h:2011 [inline]
    RIP: 0010:validate_checkpoint+0x66d/0xec0 fs/f2fs/checkpoint.c:835
    Code: e8 58 05 7f fe 4c 8d 6b 80 4d 8d 74 24 08 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1 ea 03 c6 04 02 00 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 f4 06 00 00 4c 89 ea 4d 8b 7c 24 08 48 b8 00 00
    RSP: 0018:ffff8801937cebe8 EFLAGS: 00010246
    RAX: dffffc0000000000 RBX: ffff8801937cef30 RCX: ffffc90006035000
    RDX: 0000000000000000 RSI: ffffffff82fd9658 RDI: 0000000000000005
    RBP: ffff8801937cef58 R08: ffff8801ab254700 R09: fffff94000d9e026
    R10: fffff94000d9e026 R11: ffffea0006cf0137 R12: fffffffffffffffb
    R13: ffff8801937ceeb0 R14: 0000000000000003 R15: ffff880193419b40
    FS:  00007f36a61d5700(0000) GS:ffff8801db100000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fc04ff93000 CR3: 00000001d0562000 CR4: 00000000001426e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     f2fs_get_valid_checkpoint+0x436/0x1ec0 fs/f2fs/checkpoint.c:860
     f2fs_fill_super+0x2d42/0x8110 fs/f2fs/super.c:2883
     mount_bdev+0x314/0x3e0 fs/super.c:1344
     f2fs_mount+0x3c/0x50 fs/f2fs/super.c:3133
     legacy_get_tree+0x131/0x460 fs/fs_context.c:729
     vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
     do_new_mount fs/namespace.c:2603 [inline]
     do_mount+0x6f2/0x1e20 fs/namespace.c:2927
     ksys_mount+0x12d/0x140 fs/namespace.c:3143
     __do_sys_mount fs/namespace.c:3157 [inline]
     __se_sys_mount fs/namespace.c:3154 [inline]
     __x64_sys_mount+0xbe/0x150 fs/namespace.c:3154
     do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x45943a
    Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 bd 8a fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 9a 8a fb ff c3 66 0f 1f 84 00 00 00 00 00
    RSP: 002b:00007f36a61d4a88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
    RAX: ffffffffffffffda RBX: 00007f36a61d4b30 RCX: 000000000045943a
    RDX: 00007f36a61d4ad0 RSI: 0000000020000100 RDI: 00007f36a61d4af0
    RBP: 0000000020000100 R08: 00007f36a61d4b30 R09: 00007f36a61d4ad0
    R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000013
    R13: 0000000000000000 R14: 00000000004c8ea0 R15: 0000000000000000
    Modules linked in:
    Dumping ftrace buffer:
       (ftrace buffer empty)
    ---[ end trace bd8550c129352286 ]---
    RIP: 0010:__read_once_size include/linux/compiler.h:188 [inline]
    RIP: 0010:compound_head include/linux/page-flags.h:142 [inline]
    RIP: 0010:PageLocked include/linux/page-flags.h:272 [inline]
    RIP: 0010:f2fs_put_page fs/f2fs/f2fs.h:2011 [inline]
    RIP: 0010:validate_checkpoint+0x66d/0xec0 fs/f2fs/checkpoint.c:835
    Code: e8 58 05 7f fe 4c 8d 6b 80 4d 8d 74 24 08 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1 ea 03 c6 04 02 00 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 f4 06 00 00 4c 89 ea 4d 8b 7c 24 08 48 b8 00 00
    RSP: 0018:ffff8801937cebe8 EFLAGS: 00010246
    RAX: dffffc0000000000 RBX: ffff8801937cef30 RCX: ffffc90006035000
    RDX: 0000000000000000 RSI: ffffffff82fd9658 RDI: 0000000000000005
    netlink: 65342 bytes leftover after parsing attributes in process `syz-executor4'.
    RBP: ffff8801937cef58 R08: ffff8801ab254700 R09: fffff94000d9e026
    openvswitch: netlink: Message has 8 unknown bytes.
    R10: fffff94000d9e026 R11: ffffea0006cf0137 R12: fffffffffffffffb
    R13: ffff8801937ceeb0 R14: 0000000000000003 R15: ffff880193419b40
    FS:  00007f36a61d5700(0000) GS:ffff8801db100000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fc04ff93000 CR3: 00000001d0562000 CR4: 00000000001426e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    
    In validate_checkpoint(), if we failed to call get_checkpoint_version(), we
    will pass returned invalid page pointer into f2fs_put_page, cause accessing
    invalid memory, this patch tries to handle error path correctly to fix this
    issue.
    
    Signed-off-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

commit 3a8304b7ad2e291777e8499e39390145d932a2fd
Author: Feng Tang <feng.tang@intel.com>
Date:   Thu Sep 20 10:58:28 2018 +0800

    x86/mm: Expand static page table for fixmap space
    
    commit 05ab1d8a4b36ee912b7087c6da127439ed0a903e upstream.
    
    We met a kernel panic when enabling earlycon, which is due to the fixmap
    address of earlycon is not statically setup.
    
    Currently the static fixmap setup in head_64.S only covers 2M virtual
    address space, while it actually could be in 4M space with different
    kernel configurations, e.g. when VSYSCALL emulation is disabled.
    
    So increase the static space to 4M for now by defining FIXMAP_PMD_NUM to 2,
    and add a build time check to ensure that the fixmap is covered by the
    initial static page tables.
    
    Fixes: 1ad83c858c7d ("x86_64,vsyscall: Make vsyscall emulation configurable")
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Feng Tang <feng.tang@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: kernel test robot <rong.a.chen@intel.com>
    Reviewed-by: Juergen Gross <jgross@suse.com> (Xen parts)
    Cc: H Peter Anvin <hpa@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Yinghai Lu <yinghai@kernel.org>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Andy Lutomirsky <luto@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20180920025828.23699-1-feng.tang@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e82f7903a6b55e673297e6bccce120569c7426e4
Author: Vineet Gupta <vgupta@synopsys.com>
Date:   Fri Oct 5 12:48:48 2018 -0700

    ARC: clone syscall to setp r25 as thread pointer
    
    commit c58a584f05e35d1d4342923cd7aac07d9c3d3d16 upstream.
    
    Per ARC TLS ABI, r25 is designated TP (thread pointer register).
    However so far kernel didn't do any special treatment, like setting up
    usermode r25, even for CLONE_SETTLS. We instead relied on libc runtime
    to do this, in say clone libc wrapper [1]. This was deliberate to keep
    kernel ABI agnostic (userspace could potentially change TP, specially
    for different ARC ISA say ARCompact vs. ARCv2 with different spare
    registers etc)
    
    However userspace setting up r25, after clone syscall opens a race, if
    child is not scheduled and gets a signal instead. It starts off in
    userspace not in clone but in a signal handler and anything TP sepcific
    there such as pthread_self() fails which showed up with uClibc
    testsuite nptl/tst-kill6 [2]
    
    Fix this by having kernel populate r25 to TP value. So this locks in
    ABI, but it was not going to change anyways, and fwiw is same for both
    ARCompact (arc700 core) and ARCvs (HS3x cores)
    
    [1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/clone.S
    [2] https://github.com/wbx-github/uclibc-ng-test/blob/master/test/nptl/tst-kill6.c
    
    Fixes: ARC STAR 9001378481
    Cc: stable@vger.kernel.org
    Reported-by: Nikita Sobolev <sobolev@synopsys.com>
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3d39d256e52ee60a9faa9c33bdea23e9b27914a
Author: Michal Suchanek <msuchanek@suse.de>
Date:   Sat May 27 17:46:15 2017 +0200

    powerpc/fadump: Return error when fadump registration fails
    
    commit 98b8cd7f75643e0a442d7a4c1cef2c9d53b7e92b upstream.
    
     - log an error message when registration fails and no error code listed
       in the switch is returned
     - translate the hv error code to posix error code and return it from
       fw_register
     - return the posix error code from fw_register to the process writing
       to sysfs
     - return EEXIST on re-registration
     - return success on deregistration when fadump is not registered
     - return ENODEV when no memory is reserved for fadump
    
    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
    Tested-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
    [mpe: Use pr_err() to shrink the error print]
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e9b8dfbc3f6668b0616b8c5f9a83fa32fadc475
Author: Yu Wang <yyuwang@codeaurora.org>
Date:   Tue Jan 30 14:06:08 2018 +0200

    ath10k: fix kernel panic issue during pci probe
    
    commit 50e79e25250bf928369996277e85b00536b380c7 upstream.
    
    If device gone during chip reset, ar->normal_mode_fw.board is not
    initialized, but ath10k_debug_print_hwfw_info() will try to access its
    member, which will cause 'kernel NULL pointer' issue. This was found
    using a faulty device (pci link went down sometimes) in a random
    insmod/rmmod/other-op test.
    To fix it, check ar->normal_mode_fw.board before accessing the member.
    
    pci 0000:02:00.0: BAR 0: assigned [mem 0xf7400000-0xf75fffff 64bit]
    ath10k_pci 0000:02:00.0: enabling device (0000 -> 0002)
    ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
    ath10k_pci 0000:02:00.0: failed to read device register, device is gone
    ath10k_pci 0000:02:00.0: failed to wait for target init: -5
    ath10k_pci 0000:02:00.0: failed to warm reset: -5
    ath10k_pci 0000:02:00.0: firmware crashed during chip reset
    ath10k_pci 0000:02:00.0: firmware crashed! (uuid 5d018951-b8e1-404a-8fde-923078b4423a)
    ath10k_pci 0000:02:00.0: (null) target 0x00000000 chip_id 0x00340aff sub 0000:0000
    ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1
    ath10k_pci 0000:02:00.0: firmware ver  api 0 features  crc32 00000000
    ...
    BUG: unable to handle kernel NULL pointer dereference at 00000004
    ...
    Call Trace:
     [<fb4e7882>] ath10k_print_driver_info+0x12/0x20 [ath10k_core]
     [<fb62b7dd>] ath10k_pci_fw_crashed_dump+0x6d/0x4d0 [ath10k_pci]
     [<fb629f07>] ? ath10k_pci_sleep.part.19+0x57/0xc0 [ath10k_pci]
     [<fb62c8ee>] ath10k_pci_hif_power_up+0x14e/0x1b0 [ath10k_pci]
     [<c10477fb>] ? do_page_fault+0xb/0x10
     [<fb4eb934>] ath10k_core_register_work+0x24/0x840 [ath10k_core]
     [<c18a00d8>] ? netlbl_unlhsh_remove+0x178/0x410
     [<c10477f0>] ? __do_page_fault+0x480/0x480
     [<c1068e44>] process_one_work+0x114/0x3e0
     [<c1069d07>] worker_thread+0x37/0x4a0
     [<c106e294>] kthread+0xa4/0xc0
     [<c1069cd0>] ? create_worker+0x180/0x180
     [<c106e1f0>] ? kthread_park+0x50/0x50
     [<c18ab4f7>] ret_from_fork+0x1b/0x28
     Code: 78 80 b8 50 09 00 00 00 75 5d 8d 75 94 c7 44 24 08 aa d7 52 fb c7 44 24 04 64 00 00 00
     89 34 24 e8 82 52 e2 c5 8b 83 dc 08 00 00 <8b> 50 04 8b 08 31 c0 e8 20 57 e3 c5 89 44 24 10 8b 83 58 09 00
     EIP: [<fb4e7754>]-
     ath10k_debug_print_board_info+0x34/0xb0 [ath10k_core]
     SS:ESP 0068:f4921d90
     CR2: 0000000000000004
    
    Signed-off-by: Yu Wang <yyuwang@codeaurora.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    [AmitP: Minor rebasing for 4.14.y and 4.9.y]
    Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bbb4cc291ccd34511189829b69f8f9ce4c6bd2ef
Author: Carl Huang <cjhuang@codeaurora.org>
Date:   Mon Mar 5 14:44:02 2018 +0800

    ath10k: fix use-after-free in ath10k_wmi_cmd_send_nowait
    
    commit 9ef0f58ed7b4a55da4a64641d538e0d9e46579ac upstream.
    
    The skb may be freed in tx completion context before
    trace_ath10k_wmi_cmd is called. This can be easily captured when
    KASAN(Kernel Address Sanitizer) is enabled. The fix is to move
    trace_ath10k_wmi_cmd before the send operation. As the ret has no
    meaning in trace_ath10k_wmi_cmd then, so remove this parameter too.
    
    Signed-off-by: Carl Huang <cjhuang@codeaurora.org>
    Tested-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Brian Norris <briannorris@chromium.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 35b80e75a642b6bebda61571176e46b43de0d5dd
Author: Prateek Sood <prsood@codeaurora.org>
Date:   Tue Dec 19 12:56:57 2017 +0530

    cgroup: Fix deadlock in cpu hotplug path
    
    commit 116d2f7496c51b2e02e8e4ecdd2bdf5fb9d5a641 upstream.
    
    Deadlock during cgroup migration from cpu hotplug path when a task T is
    being moved from source to destination cgroup.
    
    kworker/0:0
    cpuset_hotplug_workfn()
       cpuset_hotplug_update_tasks()
          hotplug_update_tasks_legacy()
            remove_tasks_in_empty_cpuset()
              cgroup_transfer_tasks() // stuck in iterator loop
                cgroup_migrate()
                  cgroup_migrate_add_task()
    
    In cgroup_migrate_add_task() it checks for PF_EXITING flag of task T.
    Task T will not migrate to destination cgroup. css_task_iter_start()
    will keep pointing to task T in loop waiting for task T cg_list node
    to be removed.
    
    Task T
    do_exit()
      exit_signals() // sets PF_EXITING
      exit_task_namespaces()
        switch_task_namespaces()
          free_nsproxy()
            put_mnt_ns()
              drop_collected_mounts()
                namespace_unlock()
                  synchronize_rcu()
                    _synchronize_rcu_expedited()
                      schedule_work() // on cpu0 low priority worker pool
                      wait_event() // waiting for work item to execute
    
    Task T inserted a work item in the worklist of cpu0 low priority
    worker pool. It is waiting for expedited grace period work item
    to execute. This work item will only be executed once kworker/0:0
    complete execution of cpuset_hotplug_workfn().
    
    kworker/0:0 ==> Task T ==>kworker/0:0
    
    In case of PF_EXITING task being migrated from source to destination
    cgroup, migrate next available task in source cgroup.
    
    Signed-off-by: Prateek Sood <prsood@codeaurora.org>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    [AmitP: Upstream commit cherry-pick failed, so I picked the
            backported changes from CAF/msm-4.9 tree instead:
            https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=49b74f1696417b270c89cd893ca9f37088928078]
    Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0050338e0d3c3e3047507c4998b132e52baafc44
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Jun 13 00:51:28 2018 -0400

    ext4: always verify the magic number in xattr blocks
    
    commit 513f86d73855ce556ea9522b6bfd79f87356dc3a upstream.
    
    If there an inode points to a block which is also some other type of
    metadata block (such as a block allocation bitmap), the
    buffer_verified flag can be set when it was validated as that other
    metadata block type; however, it would make a really terrible external
    attribute block.  The reason why we use the verified flag is to avoid
    constantly reverifying the block.  However, it doesn't take much
    overhead to make sure the magic number of the xattr block is correct,
    and this will avoid potential crashes.
    
    This addresses CVE-2018-10879.
    
    https://bugzilla.kernel.org/show_bug.cgi?id=200001
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Reviewed-by: Andreas Dilger <adilger@dilger.ca>
    [Backported to 4.9: adjust context]
    Signed-off-by: Daniel Rosenberg <drosen@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b469713e0c0cf3dadc9bbc59e9fd6780e1853c5a
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Jun 13 00:23:11 2018 -0400

    ext4: add corruption check in ext4_xattr_set_entry()
    
    commit 5369a762c882c0b6e9599e4ebbb3a9ba9eee7e2d upstream.
    
    In theory this should have been caught earlier when the xattr list was
    verified, but in case it got missed, it's simple enough to add check
    to make sure we don't overrun the xattr buffer.
    
    This addresses CVE-2018-10879.
    
    https://bugzilla.kernel.org/show_bug.cgi?id=200001
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Reviewed-by: Andreas Dilger <adilger@dilger.ca>
    [bwh: Backported to 3.16:
     - Add inode parameter to ext4_xattr_set_entry() and update callers
     - Return -EIO instead of -EFSCORRUPTED on error
     - Adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    [adjusted context for 4.9]
    Signed-off-by: Daniel Rosenberg <drosen@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a57f5010e8e72537acdc36166a2f9adc483ab60d
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Tue Sep 25 21:06:24 2018 -0700

    of: unittest: Disable interrupt node tests for old world MAC systems
    
    commit 8894891446c9380709451b99ab45c5c53adfd2fc upstream.
    
    On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the
    devicetree interrupt parsing code is different, causing unit tests of
    devicetree interrupt nodes to fail. Due to a bug in unittest code, which
    tries to dereference an uninitialized pointer, this results in a crash.
    
    OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property
    Unable to handle kernel paging request for data at address 0x00bc616e
    Faulting instruction address: 0xc08e9468
    Oops: Kernel access of bad area, sig: 11 [#1]
    BE PREEMPT PowerMac
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1
    task: cf8e0000 task.stack: cf8da000
    NIP:  c08e9468 LR: c08ea5bc CTR: c08ea5ac
    REGS: cf8dbb50 TRAP: 0300   Not tainted  (4.14.72-rc1-yocto-standard+)
    MSR:  00001032 <ME,IR,DR,RI>  CR: 82004044  XER: 00000000
    DAR: 00bc616e DSISR: 40000000
    GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002
    GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000
    GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8
    GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517
    
    NIP [c08e9468] device_node_gen_full_name+0x30/0x15c
    LR [c08ea5bc] device_node_string+0x190/0x3c8
    Call Trace:
    [cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable)
    [cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8
    [cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0
    [cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec
    [cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48
    [cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c
    [cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130
    [cf8dbdd0] [c008ff54] printk+0x5c/0x6c
    [cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8
    [cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184
    [cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8
    [cf8dbf30] [c0004814] kernel_init+0x24/0x118
    [cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64
    
    The problem was observed when running a qemu test for the g3beige machine
    with devicetree unittests enabled.
    
    Disable interrupt node tests on affected systems to avoid both false
    unittest failures and the crash.
    
    With this patch in place, unittest on the affected system passes with
    the following message.
    
            dt-test ### end of unittest - 144 passed, 0 failed
    
    Fixes: 53a42093d96ef ("of: Add device tree selftests")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Reviewed-by: Frank Rowand <frank.rowand@sony.com>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 381d8ecd1058f739d34969d940a9ad5c19befa40
Author: Dmitry Safonov <dima@arista.com>
Date:   Tue Sep 18 00:52:52 2018 +0100

    tty: Drop tty->count on tty_reopen() failure
    
    commit fe32416790093b31364c08395727de17ec96ace1 upstream.
    
    In case of tty_ldisc_reinit() failure, tty->count should be decremented
    back, otherwise we will never release_tty().
    Tetsuo reported that it fixes noisy warnings on tty release like:
      pts pts4033: tty_release: tty->count(10529) != (#fd's(7) + #kopen's(0))
    
    Fixes: commit 892d1fa7eaae ("tty: Destroy ldisc instance on hangup")
    
    Cc: stable@vger.kernel.org # v4.6+
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Jiri Slaby <jslaby@suse.com>
    Reviewed-by: Jiri Slaby <jslaby@suse.cz>
    Tested-by: Jiri Slaby <jslaby@suse.com>
    Tested-by: Mark Rutland <mark.rutland@arm.com>
    Tested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
    Signed-off-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 71ef91bfe8647cdb232b9746f8bc213edd32cde7
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Sep 24 15:28:10 2018 +0200

    USB: serial: simple: add Motorola Tetra MTP6550 id
    
    commit f5fad711c06e652f90f581fc7c2caee327c33d31 upstream.
    
    Add device-id for the Motorola Tetra radio MTP6550.
    
    Bus 001 Device 004: ID 0cad:9012 Motorola CGISS
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass            0 (Defined at Interface level)
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0        64
      idVendor           0x0cad Motorola CGISS
      idProduct          0x9012
      bcdDevice           24.16
      iManufacturer           1 Motorola Solutions, Inc.
      iProduct                2 TETRA PEI interface
      iSerial                 0
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength           55
        bNumInterfaces          2
        bConfigurationValue     1
        iConfiguration          3 Generic Serial config
        bmAttributes         0x80
          (Bus Powered)
        MaxPower              500mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass       255 Vendor Specific Class
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass       255 Vendor Specific Class
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x02  EP 2 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
    Device Qualifier (for other device speed):
      bLength                10
      bDescriptorType         6
      bcdUSB               2.00
      bDeviceClass            0 (Defined at Interface level)
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0        64
      bNumConfigurations      1
    Device Status:     0x0000
      (Bus Powered)
    
    Reported-by: Hans Hult <hanshult35@gmail.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 343ec21925bcc0ca339b998f3c2613e202a8fc6e
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Oct 1 18:36:08 2018 +0300

    usb: xhci-mtk: resume USB3 roothub first
    
    commit 555df5820e733cded7eb8d0bf78b2a791be51d75 upstream.
    
    Give USB3 devices a better chance to enumerate at USB3 speeds if
    they are connected to a suspended host.
    Porting from "671ffdff5b13 xhci: resume USB 3 roothub first"
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90a7afb91bf00d2979527d181b2ed90336d4a133
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Mon Oct 1 18:36:07 2018 +0300

    xhci: Add missing CAS workaround for Intel Sunrise Point xHCI
    
    commit ffe84e01bb1b38c7eb9c6b6da127a6c136d251df upstream.
    
    The workaround for missing CAS bit is also needed for xHC on Intel
    sunrisepoint PCH. For more details see:
    
    Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47c085c51d35e14d2e85aa10fa6f978b17ad6f9b
Author: Mike Snitzer <snitzer@redhat.com>
Date:   Tue Sep 25 20:56:02 2018 -0400

    dm cache: fix resize crash if user doesn't reload cache table
    
    commit 5d07384a666d4b2f781dc056bfeec2c27fbdf383 upstream.
    
    A reload of the cache's DM table is needed during resize because
    otherwise a crash will occur when attempting to access smq policy
    entries associated with the portion of the cache that was recently
    extended.
    
    The reason is cache-size based data structures in the policy will not be
    resized, the only way to safely extend the cache is to allow for a
    proper cache policy initialization that occurs when the cache table is
    loaded.  For example the smq policy's space_init(), init_allocator(),
    calc_hotspot_params() must be sized based on the extended cache size.
    
    The fix for this is to disallow cache resizes of this pattern:
    1) suspend "cache" target's device
    2) resize the fast device used for the cache
    3) resume "cache" target's device
    
    Instead, the last step must be a full reload of the cache's DM table.
    
    Fixes: 66a636356 ("dm cache: add stochastic-multi-queue (smq) policy")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8bf0cc33eddc8d1c5267115f460a3bc4a714ea88
Author: Joe Thornber <ejt@redhat.com>
Date:   Mon Sep 24 16:19:30 2018 -0400

    dm cache metadata: ignore hints array being too small during resize
    
    commit 4561ffca88c546f96367f94b8f1e4715a9c62314 upstream.
    
    Commit fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to
    on-disk superblock") enabled previously written policy hints to be
    used after a cache is reactivated.  But in doing so the cache
    metadata's hint array was left exposed to out of bounds access because
    on resize the metadata's on-disk hint array wasn't ever extended.
    
    Fix this by ignoring that there are no on-disk hints associated with the
    newly added cache blocks.  An expanded on-disk hint array is later
    rewritten upon the next clean shutdown of the cache.
    
    Fixes: fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to on-disk superblock")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 75b66cc009433bff1dd31382d06b9d64d8e1cc25
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Oct 4 11:08:12 2018 +0200

    PM / core: Clear the direct_complete flag on errors
    
    commit 69e445ab8b66a9f30519842ef18be555d3ee9b51 upstream.
    
    If __device_suspend() runs asynchronously (in which case the device
    passed to it is in dpm_suspended_list at that point) and it returns
    early on an error or pending wakeup, and the power.direct_complete
    flag has been set for the device already, the subsequent
    device_resume() will be confused by that and it will call
    pm_runtime_enable() incorrectly, as runtime PM has not been
    disabled for the device by __device_suspend().
    
    To avoid that, clear power.direct_complete if __device_suspend()
    is not going to disable runtime PM for the device before returning.
    
    Fixes: aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily)
    Reported-by: Al Cooper <alcooperx@gmail.com>
    Tested-by: Al Cooper <alcooperx@gmail.com>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
    Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e487b5a7905950926f1bdc1d658fd9ec1151a7cc
Author: Felix Fietkau <nbd@nbd.name>
Date:   Sat Sep 29 16:01:58 2018 +0200

    mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys
    
    commit 211710ca74adf790b46ab3867fcce8047b573cd1 upstream.
    
    key->sta is only valid after ieee80211_key_link, which is called later
    in this function. Because of that, the IEEE80211_KEY_FLAG_RX_MGMT is
    never set when management frame protection is enabled.
    
    Fixes: e548c49e6dc6b ("mac80211: add key flag for management keys")
    Cc: stable@vger.kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c4cad25a9a6056a8d67a8f06d431f89fcc179b4
Author: Daniel Drake <drake@endlessm.com>
Date:   Thu Sep 27 15:47:33 2018 -0500

    PCI: Reprogram bridge prefetch registers on resume
    
    commit 083874549fdfefa629dfa752785e20427dde1511 upstream.
    
    On 38+ Intel-based ASUS products, the NVIDIA GPU becomes unusable after S3
    suspend/resume.  The affected products include multiple generations of
    NVIDIA GPUs and Intel SoCs.  After resume, nouveau logs many errors such
    as:
    
      fifo: fault 00 [READ] at 0000005555555000 engine 00 [GR] client 04
            [HUB/FE] reason 4a [] on channel -1 [007fa91000 unknown]
      DRM: failed to idle channel 0 [DRM]
    
    Similarly, the NVIDIA proprietary driver also fails after resume (black
    screen, 100% CPU usage in Xorg process).  We shipped a sample to NVIDIA for
    diagnosis, and their response indicated that it's a problem with the parent
    PCI bridge (on the Intel SoC), not the GPU.
    
    Runtime suspend/resume works fine, only S3 suspend is affected.
    
    We found a workaround: on resume, rewrite the Intel PCI bridge
    'Prefetchable Base Upper 32 Bits' register (PCI_PREF_BASE_UPPER32).  In the
    cases that I checked, this register has value 0 and we just have to rewrite
    that value.
    
    Linux already saves and restores PCI config space during suspend/resume,
    but this register was being skipped because upon resume, it already has
    value 0 (the correct, pre-suspend value).
    
    Intel appear to have previously acknowledged this behaviour and the
    requirement to rewrite this register:
    https://bugzilla.kernel.org/show_bug.cgi?id=116851#c23
    
    Based on that, rewrite the prefetch register values even when that appears
    unnecessary.
    
    We have confirmed this solution on all the affected models we have in-hands
    (X542UQ, UX533FD, X530UN, V272UN).
    
    Additionally, this solves an issue where r8169 MSI-X interrupts were broken
    after S3 suspend/resume on ASUS X441UAR.  This issue was recently worked
    around in commit 7bb05b85bc2d ("r8169: don't use MSI-X on RTL8106e").  It
    also fixes the same issue on RTL6186evl/8111evl on an Aimfor-tech laptop
    that we had not yet patched.  I suspect it will also fix the issue that was
    worked around in commit 7c53a722459c ("r8169: don't use MSI-X on
    RTL8168g").
    
    Thomas Martitz reports that this change also solves an issue where the AMD
    Radeon Polaris 10 GPU on the HP Zbook 14u G5 is unresponsive after S3
    suspend/resume.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=201069
    Signed-off-by: Daniel Drake <drake@endlessm.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-By: Peter Wu <peter@lekensteyn.nl>
    CC: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1bdd5e26bf24e0d8228d722e6e2af3e1c2340f32
Author: Andy Lutomirski <luto@kernel.org>
Date:   Wed Oct 3 16:23:49 2018 -0700

    x86/vdso: Fix vDSO syscall fallback asm constraint regression
    
    commit 02e425668f5c9deb42787d10001a3b605993ad15 upstream.
    
    When I added the missing memory outputs, I failed to update the
    index of the first argument (ebx) on 32-bit builds, which broke the
    fallbacks.  Somehow I must have screwed up my testing or gotten
    lucky.
    
    Add another test to cover gettimeofday() as well.
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Fixes: 715bd9d12f84 ("x86/vdso: Fix asm constraints on vDSO syscall fallbacks")
    Link: http://lkml.kernel.org/r/21bd45ab04b6d838278fa5bebfa9163eceffa13c.1538608971.git.luto@kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9f14d89a13164552038977e7d1bc5b2e3c31f56a
Author: Andy Lutomirski <luto@kernel.org>
Date:   Mon Oct 1 12:52:15 2018 -0700

    x86/vdso: Fix asm constraints on vDSO syscall fallbacks
    
    commit 715bd9d12f84d8f5cc8ad21d888f9bc304a8eb0b upstream.
    
    The syscall fallbacks in the vDSO have incorrect asm constraints.
    They are not marked as writing to their outputs -- instead, they are
    marked as clobbering "memory", which is useless.  In particular, gcc
    is smart enough to know that the timespec parameter hasn't escaped,
    so a memory clobber doesn't clobber it.  And passing a pointer as an
    asm *input* does not tell gcc that the pointed-to value is changed.
    
    Add in the fact that the asm instructions weren't volatile, and gcc
    was free to omit them entirely unless their sole output (the return
    value) is used.  Which it is (phew!), but that stops happening with
    some upcoming patches.
    
    As a trivial example, the following code:
    
    void test_fallback(struct timespec *ts)
    {
            vdso_fallback_gettime(CLOCK_MONOTONIC, ts);
    }
    
    compiles to:
    
    00000000000000c0 <test_fallback>:
      c0:   c3                      retq
    
    To add insult to injury, the RCX and R11 clobbers on 64-bit
    builds were missing.
    
    The "memory" clobber is also unnecessary -- no ordering with respect to
    other memory operations is needed, but that's going to be fixed in a
    separate not-for-stable patch.
    
    Fixes: 2aae950b21e4 ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/2c0231690551989d2fafa60ed0e7b5cc8b403908.1538422295.git.luto@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2962761863cb161d419c94f3dde7443af0e63c31
Author: Jan Beulich <JBeulich@suse.com>
Date:   Tue Sep 25 02:12:30 2018 -0600

    xen-netback: fix input validation in xenvif_set_hash_mapping()
    
    commit 780e83c259fc33e8959fed8dfdad17e378d72b62 upstream.
    
    Both len and off are frontend specified values, so we need to make
    sure there's no overflow when adding the two for the bounds check. We
    also want to avoid undefined behavior and hence use off to index into
    ->hash.mapping[] only after bounds checking. This at the same time
    allows to take care of not applying off twice for the bounds checking
    against vif->num_queues.
    
    It is also insufficient to bounds check copy_op.len, as this is len
    truncated to 16 bits.
    
    This is XSA-270 / CVE-2018-15471.
    
    Reported-by: Felix Wilhelm <fwilhelm@google.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
    Tested-by: Paul Durrant <paul.durrant@citrix.com>
    Cc: stable@vger.kernel.org [4.7 onwards]
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 22feb4d4f4547a495b51c6a03c55989643ac712a
Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
Date:   Wed Sep 26 18:11:22 2018 +0200

    fbdev/omapfb: fix omapfb_memory_read infoleak
    
    commit 1bafcbf59fed92af58955024452f45430d3898c5 upstream.
    
    OMAPFB_MEMORY_READ ioctl reads pixels from the LCD's memory and copies
    them to a userspace buffer. The code has two issues:
    
    - The user provided width and height could be large enough to overflow
      the calculations
    - The copy_to_user() can copy uninitialized memory to the userspace,
      which might contain sensitive kernel information.
    
    Fix these by limiting the width & height parameters, and only copying
    the amount of data that we actually received from the LCD.
    
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Reported-by: Jann Horn <jannh@google.com>
    Cc: stable@vger.kernel.org
    Cc: security@kernel.org
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e308fb9f145abcdb7f3fbd58f425dc4f00eba869
Author: Jann Horn <jannh@google.com>
Date:   Fri Oct 5 15:52:07 2018 -0700

    mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly
    
    commit 58bc4c34d249bf1bc50730a9a209139347cfacfe upstream.
    
    5dd0b16cdaff ("mm/vmstat: Make NR_TLB_REMOTE_FLUSH_RECEIVED available even
    on UP") made the availability of the NR_TLB_REMOTE_FLUSH* counters inside
    the kernel unconditional to reduce #ifdef soup, but (either to avoid
    showing dummy zero counters to userspace, or because that code was missed)
    didn't update the vmstat_array, meaning that all following counters would
    be shown with incorrect values.
    
    This only affects kernel builds with
    CONFIG_VM_EVENT_COUNTERS=y && CONFIG_DEBUG_TLBFLUSH=y && CONFIG_SMP=n.
    
    Link: http://lkml.kernel.org/r/20181001143138.95119-2-jannh@google.com
    Fixes: 5dd0b16cdaff ("mm/vmstat: Make NR_TLB_REMOTE_FLUSH_RECEIVED available even on UP")
    Signed-off-by: Jann Horn <jannh@google.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Roman Gushchin <guro@fb.com>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Christoph Lameter <clameter@sgi.com>
    Cc: Kemi Wang <kemi.wang@intel.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>