commit 390caeedd4fdb95b2225768305d163c291f21b5a
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Feb 14 15:26:10 2017 -0800

    Linux 4.9.10

commit e5c2e51470c2aadaf53a17acb677bb95529ac4d1
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Jan 31 11:27:10 2017 +0100

    perf/core: Fix crash in perf_event_read()
    
    commit 451d24d1e5f40bad000fa9abe36ddb16fc9928cb upstream.
    
    Alexei had his box explode because doing read() on a package
    (rapl/uncore) event that isn't currently scheduled in ends up doing an
    out-of-bounds load.
    
    Rework the code to more explicitly deal with event->oncpu being -1.
    
    Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
    Tested-by: Alexei Starovoitov <ast@kernel.org>
    Tested-by: David Carrillo-Cisneros <davidcc@google.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: eranian@google.com
    Fixes: d6a2f9035bfc ("perf/core: Introduce PMU_EV_CAP_READ_ACTIVE_PKG")
    Link: http://lkml.kernel.org/r/20170131102710.GL6515@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit de65c300c7f0d1e18f5a92ea7a6c1cc9a0734202
Author: Namhyung Kim <namhyung@kernel.org>
Date:   Wed Jan 18 14:14:56 2017 +0900

    perf diff: Fix segfault on 'perf diff -o N' option
    
    commit 8381cdd0e32dd748bd34ca3ace476949948bd793 upstream.
    
    The -o/--order option is to select column number to sort a diff result.
    
    It does the job by adding a hpp field at the beginning of the sort list.
    But it should not be added to the output field list as it has no
    callbacks required by a output field.
    
    During the setup_sorting(), the perf_hpp__setup_output_field() appends
    the given sort keys to the output field if it's not there already.
    
    Originally it was checked by fmt->list being non-empty.  But commit
    3f931f2c4274 ("perf hists: Make hpp setup function generic") changed it
    to check the ->equal callback.
    
    Anyways, we don't need to add the pseudo hpp field to the output field
    list since it won't be used for output.  So just skip fields if they
    have no ->color or ->entry callbacks.
    
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Fixes: 3f931f2c4274 ("perf hists: Make hpp setup function generic")
    Link: http://lkml.kernel.org/r/20170118051457.30946-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 85df621b18e2f20731a1a6eb4defd8b704487064
Author: Namhyung Kim <namhyung@kernel.org>
Date:   Wed Jan 18 14:14:57 2017 +0900

    perf diff: Fix -o/--order option behavior (again)
    
    commit a1c9f97f0b64e6337d9cfcc08c134450934fdd90 upstream.
    
    Commit 21e6d8428664 ("perf diff: Use perf_hpp__register_sort_field
    interface") changed list_add() to perf_hpp__register_sort_field().
    
    This resulted in a behavior change since the field was added to the tail
    instead of the head.  So the -o option is mostly ignored due to its
    order in the list.
    
    This patch fixes it by adding perf_hpp__prepend_sort_field().
    
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Fixes: 21e6d8428664 ("perf diff: Use perf_hpp__register_sort_field interface")
    Link: http://lkml.kernel.org/r/20170118051457.30946-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b4af0dab8934b046776a65fdd6e91658f500060
Author: Omar Sandoval <osandov@fb.com>
Date:   Tue Feb 7 15:33:20 2017 -0800

    stacktrace, lockdep: Fix address, newline ugliness
    
    commit bfeda41d06d85ad9d52f2413cfc2b77be5022f75 upstream.
    
    Since KERN_CONT became meaningful again, lockdep stack traces have had
    annoying extra newlines, like this:
    
    [    5.561122] -> #1 (B){+.+...}:
    [    5.561528]
    [    5.561532] [<ffffffff810d8873>] lock_acquire+0xc3/0x210
    [    5.562178]
    [    5.562181] [<ffffffff816f6414>] mutex_lock_nested+0x74/0x6d0
    [    5.562861]
    [    5.562880] [<ffffffffa01aa3c3>] init_btrfs_fs+0x21/0x196 [btrfs]
    [    5.563717]
    [    5.563721] [<ffffffff81000472>] do_one_initcall+0x52/0x1b0
    [    5.564554]
    [    5.564559] [<ffffffff811a3af6>] do_init_module+0x5f/0x209
    [    5.565357]
    [    5.565361] [<ffffffff81122f4d>] load_module+0x218d/0x2b80
    [    5.566020]
    [    5.566021] [<ffffffff81123beb>] SyS_finit_module+0xeb/0x120
    [    5.566694]
    [    5.566696] [<ffffffff816fd241>] entry_SYSCALL_64_fastpath+0x1f/0xc2
    
    That's happening because each printk() call now gets printed on its own
    line, and we do a separate call to print the spaces before the symbol.
    Fix it by doing the printk() directly instead of using the
    print_ip_sym() helper.
    
    Additionally, the symbol address isn't very helpful, so let's get rid of
    that, too. The final result looks like this:
    
    [    5.194518] -> #1 (B){+.+...}:
    [    5.195002]        lock_acquire+0xc3/0x210
    [    5.195439]        mutex_lock_nested+0x74/0x6d0
    [    5.196491]        do_one_initcall+0x52/0x1b0
    [    5.196939]        do_init_module+0x5f/0x209
    [    5.197355]        load_module+0x218d/0x2b80
    [    5.197792]        SyS_finit_module+0xeb/0x120
    [    5.198251]        entry_SYSCALL_64_fastpath+0x1f/0xc2
    
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Omar Sandoval <osandov@fb.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: kernel-team@fb.com
    Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
    Link: http://lkml.kernel.org/r/43b4e114724b2bdb0308fa86cb33aa07d3d67fad.1486510315.git.osandov@fb.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b7dd5edc3dd9191f2cb1bd508279b0ff7274c5aa
Author: Eyal Itkin <eyal.itkin@gmail.com>
Date:   Tue Feb 7 16:45:19 2017 +0300

    IB/rxe: Fix mem_check_range integer overflow
    
    commit 647bf3d8a8e5777319da92af672289b2a6c4dc66 upstream.
    
    Update the range check to avoid integer-overflow in edge case.
    Resolves CVE 2016-8636.
    
    Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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 5476efeec1351d6df008a38c528099be65bfed0f
Author: Eyal Itkin <eyal.itkin@gmail.com>
Date:   Tue Feb 7 16:43:05 2017 +0300

    IB/rxe: Fix resid update
    
    commit 628f07d33c1f2e7bf31e0a4a988bb07914bd5e73 upstream.
    
    Update the response's resid field when larger than MTU, instead of only
    updating the local resid variable.
    
    Fixes: 8700e3e7c485 ("Soft RoCE driver")
    Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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 c8cbc219d87cdbe33430b92350cb687b3f2201e6
Author: Yazen Ghannam <Yazen.Ghannam@amd.com>
Date:   Sun Feb 5 11:50:22 2017 +0100

    x86/CPU/AMD: Fix Zen SMT topology
    
    commit 08b259631b5a1d912af4832847b5642f377d9101 upstream.
    
    After:
    
      a33d331761bc ("x86/CPU/AMD: Fix Bulldozer topology")
    
    our  SMT scheduling topology for Fam17h systems is broken, because
    the ThreadId is included in the ApicId when SMT is enabled.
    
    So, without further decoding cpu_core_id is unique for each thread
    rather than the same for threads on the same core. This didn't affect
    systems with SMT disabled. Make cpu_core_id be what it is defined to be.
    
    Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    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/20170205105022.8705-2-bp@alien8.de
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6e306c5907a075ba6d46f6ee33c689abf4bfb733
Author: Borislav Petkov <bp@suse.de>
Date:   Sun Feb 5 11:50:21 2017 +0100

    x86/CPU/AMD: Bring back Compute Unit ID
    
    commit 79a8b9aa388b0620cc1d525d7c0f0d9a8a85e08e upstream.
    
    Commit:
    
      a33d331761bc ("x86/CPU/AMD: Fix Bulldozer topology")
    
    restored the initial approach we had with the Fam15h topology of
    enumerating CU (Compute Unit) threads as cores. And this is still
    correct - they're beefier than HT threads but still have some
    shared functionality.
    
    Our current approach has a problem with the Mad Max Steam game, for
    example. Yves Dionne reported a certain "choppiness" while playing on
    v4.9.5.
    
    That problem stems most likely from the fact that the CU threads share
    resources within one CU and when we schedule to a thread of a different
    compute unit, this incurs latency due to migrating the working set to a
    different CU through the caches.
    
    When the thread siblings mask mirrors that aspect of the CUs and
    threads, the scheduler pays attention to it and tries to schedule within
    one CU first. Which takes care of the latency, of course.
    
    Reported-by: Yves Dionne <yves.dionne@gmail.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: Brice Goglin <Brice.Goglin@inria.fr>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Yazen Ghannam <yazen.ghannam@amd.com>
    Link: http://lkml.kernel.org/r/20170205105022.8705-1-bp@alien8.de
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3cc4259f8322fef4f59e719b05b07bc6833d8f9
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Feb 10 12:54:05 2017 +0300

    x86/mm/ptdump: Fix soft lockup in page table walker
    
    commit 146fbb766934dc003fcbf755b519acef683576bf upstream.
    
    CONFIG_KASAN=y needs a lot of virtual memory mapped for its shadow.
    In that case ptdump_walk_pgd_level_core() takes a lot of time to
    walk across all page tables and doing this without
    a rescheduling causes soft lockups:
    
     NMI watchdog: BUG: soft lockup - CPU#3 stuck for 23s! [swapper/0:1]
     ...
     Call Trace:
      ptdump_walk_pgd_level_core+0x40c/0x550
      ptdump_walk_pgd_level_checkwx+0x17/0x20
      mark_rodata_ro+0x13b/0x150
      kernel_init+0x2f/0x120
      ret_from_fork+0x2c/0x40
    
    I guess that this issue might arise even without KASAN on huge machines
    with several terabytes of RAM.
    
    Stick cond_resched() in pgd loop to fix this.
    
    Reported-by: Tobias Regnery <tobias.regnery@gmail.com>
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: kasan-dev@googlegroups.com
    Cc: Alexander Potapenko <glider@google.com>
    Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Link: http://lkml.kernel.org/r/20170210095405.31802-1-aryabinin@virtuozzo.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34f840fc0d8918fc015ee8bd8a2e1a457c7094e2
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Feb 7 09:32:30 2017 +0100

    Revert "ALSA: line6: Only determine control port properties if needed"
    
    commit f3d83317a69e7d658e7c83e24f8b31ac533c39e3 upstream.
    
    This reverts commit f6a0dd107ad0c8b59d1c9735eea4b8cb9f460949.
    
    The commit caused a regression on LINE6 Transport that has no control
    caps.  Although reverting the commit may result back in a spurious
    error message for some device again, it's the simplest regression fix,
    hence it's taken as is at first.  The further code fix will follow
    later.
    
    Fixes: f6a0dd107ad0 ("ALSA: line6: Only determine control port properties if needed")
    Reported-by: Igor Zinovev <zinigor@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23b1595b977c9ce4fe498363c636a555c216a9e2
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Feb 6 15:09:48 2017 +0100

    ALSA: seq: Don't handle loop timeout at snd_seq_pool_done()
    
    commit 37a7ea4a9b81f6a864c10a7cb0b96458df5310a3 upstream.
    
    snd_seq_pool_done() syncs with closing of all opened threads, but it
    aborts the wait loop with a timeout, and proceeds to the release
    resource even if not all threads have been closed.  The timeout was 5
    seconds, and if you run a crazy stuff, it can exceed easily, and may
    result in the access of the invalid memory address -- this is what
    syzkaller detected in a bug report.
    
    As a fix, let the code graduate from naiveness, simply remove the loop
    timeout.
    
    BugLink: http://lkml.kernel.org/r/CACT4Y+YdhDV2H5LLzDTJDVF-qiYHUHhtRaW4rbb4gUhTCQB81w@mail.gmail.com
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5024b2fb8e49091044e450a0548979bb711588d6
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Feb 8 12:35:39 2017 +0100

    ALSA: seq: Fix race at creating a queue
    
    commit 4842e98f26dd80be3623c4714a244ba52ea096a8 upstream.
    
    When a sequencer queue is created in snd_seq_queue_alloc(),it adds the
    new queue element to the public list before referencing it.  Thus the
    queue might be deleted before the call of snd_seq_queue_use(), and it
    results in the use-after-free error, as spotted by syzkaller.
    
    The fix is to reference the queue object at the right time.
    
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e0feb524caccbe9c061997f63b97e4f695e816e
Author: Hui Wang <hui.wang@canonical.com>
Date:   Thu Feb 9 09:20:54 2017 +0800

    ALSA: hda - adding a new NV HDMI/DP codec ID in the driver
    
    commit af677166cf63c179dc2485053166e02c4aea01eb upstream.
    
    Without this change, the HDMI/DP codec will be recognised as a
    generic codec, and there is no sound when playing through this codec.
    
    As suggested by NVidia side, after adding the new ID in the driver,
    the sound playing works well.
    
    Signed-off-by: Hui Wang <hui.wang@canonical.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 765c0f9089fcfebd3f5875a38c00f882ccff62ed
Author: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Date:   Mon Jan 30 12:45:46 2017 -0500

    xen-netfront: Delete rx_refill_timer in xennet_disconnect_backend()
    
    commit 74470954857c264168d2b5a113904cf0cfd27d18 upstream.
    
    rx_refill_timer should be deleted as soon as we disconnect from the
    backend since otherwise it is possible for the timer to go off before
    we get to xennet_destroy_queues(). If this happens we may dereference
    queue->rx.sring which is set to NULL in xennet_disconnect_backend().
    
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e7f9f10bcc8dbbf0e09aba6765e9e07bc59910f1
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Tue Feb 7 11:35:31 2017 +1100

    powerpc/powernv: Fix CPU hotplug to handle waking on HVI
    
    commit 9b256714979fad61ae11d90b53cf67dd5e6484eb upstream.
    
    The IPIs come in as HVI not EE, so we need to test the appropriate
    SRR1 bits. The encoding is such that it won't have false positives
    on P7 and P8 so we can just test it like that. We also need to handle
    the icp-opal variant of the flush.
    
    Fixes: d74361881f0d ("powerpc/xics: Add ICP OPAL backend")
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3433972d049f256a57b3538b2d29a7ee38748019
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Mon Feb 6 13:05:16 2017 +1100

    powerpc/mm/radix: Update ERAT flushes when invalidating TLB
    
    commit 90c1e3c2fafec57fcb55b5d69bcf293b1a5fc8b3 upstream.
    
    Three tiny changes to the ERAT flushing logic: First don't make
    it depend on DD1. It hasn't been decided yet but we might run
    DD2 in a mode that also requires explicit flushes for performance
    reasons so make it unconditional. We also add a missing isync, and
    finally remove the flush from _tlbiel_va as it is only necessary
    for congruence-class invalidations (PID, LPID and full TLB), not
    targetted invalidations.
    
    Fixes: 96ed1fe511a8 ("powerpc/mm/radix: Invalidate ERAT on tlbiel for POWER9 DD1")
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93fb043478b8d81cfa0d2399223bbf96bdb138e8
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Mon Feb 6 19:39:09 2017 -0500

    btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls
    
    commit 2a362249187a8d0f6d942d6e1d763d150a296f47 upstream.
    
    Commit 4c63c2454ef incorrectly assumed that returning -ENOIOCTLCMD would
    cause the native ioctl to be called.  The ->compat_ioctl callback is
    expected to handle all ioctls, not just compat variants.  As a result,
    when using 32-bit userspace on 64-bit kernels, everything except those
    three ioctls would return -ENOTTY.
    
    Fixes: 4c63c2454ef ("btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl")
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76a9ac048b4876849b6e95fa4b20cca949f2bf0a
Author: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Date:   Wed Jan 25 22:07:06 2017 -0200

    scsi: qla2xxx: Avoid that issuing a LIP triggers a kernel crash
    
    commit 2780f3c8f0233de90b6b47a23fc422b7780c5436 upstream.
    
    Avoid that issuing a LIP as follows:
    
      find /sys -name 'issue_lip'|while read f; do echo 1 > $f; done
    
    triggers the following:
    
    BUG: unable to handle kernel NULL pointer dereference at (null)
    Call Trace:
     qla2x00_abort_all_cmds+0xed/0x140 [qla2xxx]
     qla2x00_abort_isp_cleanup+0x1e3/0x280 [qla2xxx]
     qla2x00_abort_isp+0xef/0x690 [qla2xxx]
     qla2x00_do_dpc+0x36c/0x880 [qla2xxx]
     kthread+0x10c/0x140
    
    [mkp: consolidated Mauricio's and Bart's fixes]
    
    Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
    Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
    Fixes: 1535aa75a3d8 ("qla2xxx: fix invalid DMA access after command aborts in PCI device remove")
    Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b5d5f2877c8d447f56a9b5477e485e6361fcd2d3
Author: ojab <ojab@ojab.ru>
Date:   Wed Dec 28 11:05:24 2016 +0000

    scsi: mpt3sas: disable ASPM for MPI2 controllers
    
    commit ffdadd68af5a397b8a52289ab39d62e1acb39e63 upstream.
    
    MPI2 controllers sometimes got lost (i.e. disappear from
    /sys/bus/pci/devices) if ASMP is enabled.
    
    Signed-off-by: Slava Kardakov <ojab@ojab.ru>
    Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=60644
    Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5684c7db4e1076ce95e38deccd261d59fb612649
Author: Dave Carroll <david.carroll@microsemi.com>
Date:   Thu Feb 9 11:04:47 2017 -0700

    scsi: aacraid: Fix INTx/MSI-x issue with older controllers
    
    commit 8af8e1c22f9994bb1849c01d66c24fe23f9bc9a0 upstream.
    
    commit 78cbccd3bd68 ("aacraid: Fix for KDUMP driver hang")
    
    caused a problem on older controllers which do not support MSI-x (namely
    ASR3405,ASR3805). This patch conditionalizes the previous patch to
    controllers which support MSI-x
    
    Fixes: 78cbccd3bd68 ("aacraid: Fix for KDUMP driver hang")
    Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
    Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
    Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e19722449e736d4811f24f68e3a36d4d8e5d429e
Author: Steffen Maier <maier@linux.vnet.ibm.com>
Date:   Wed Feb 8 15:34:22 2017 +0100

    scsi: zfcp: fix use-after-free by not tracing WKA port open/close on failed send
    
    commit 2dfa6688aafdc3f74efeb1cf05fb871465d67f79 upstream.
    
    Dan Carpenter kindly reported:
    <quote>
    The patch d27a7cb91960: "zfcp: trace on request for open and close of
    WKA port" from Aug 10, 2016, leads to the following static checker
    warning:
    
            drivers/s390/scsi/zfcp_fsf.c:1615 zfcp_fsf_open_wka_port()
            warn: 'req' was already freed.
    
    drivers/s390/scsi/zfcp_fsf.c
      1609          zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
      1610          retval = zfcp_fsf_req_send(req);
      1611          if (retval)
      1612                  zfcp_fsf_req_free(req);
                                              ^^^
    Freed.
    
      1613  out:
      1614          spin_unlock_irq(&qdio->req_q_lock);
      1615          if (req && !IS_ERR(req))
      1616                  zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id);
                                                                      ^^^^^^^^^^^
    Use after free.
    
      1617          return retval;
      1618  }
    
    Same thing for zfcp_fsf_close_wka_port() as well.
    </quote>
    
    Rather than relying on req being NULL (or ERR_PTR) for all cases where
    we don't want to trace or should not trace,
    simply check retval which is unconditionally initialized with -EIO != 0
    and it can only become 0 on successful retval = zfcp_fsf_req_send(req).
    With that we can also remove the then again unnecessary unconditional
    initialization of req which was introduced with that earlier commit.
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Suggested-by: Benjamin Block <bblock@linux.vnet.ibm.com>
    Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
    Fixes: d27a7cb91960 ("zfcp: trace on request for open and close of WKA port")
    Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
    Reviewed-by: Jens Remus <jremus@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1cf897fcc5a99e5ecf2f6fb12adec6d485a17e14
Author: Dexuan Cui <decui@microsoft.com>
Date:   Sat Jan 28 11:46:02 2017 -0700

    Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read()
    
    commit 433e19cf33d34bb6751c874a9c00980552fe508c upstream.
    
    Commit a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in
    hv_need_to_signal_on_read()")
    added the proper mb(), but removed the test "prev_write_sz < pending_sz"
    when making the signal decision.
    
    As a result, the guest can signal the host unnecessarily,
    and then the host can throttle the guest because the host
    thinks the guest is buggy or malicious; finally the user
    running stress test can perceive intermittent freeze of
    the guest.
    
    This patch brings back the test, and properly handles the
    in-place consumption APIs used by NetVSC (see get_next_pkt_raw(),
    put_pkt_raw() and commit_rd_index()).
    
    Fixes: a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in
    hv_need_to_signal_on_read()")
    
    Signed-off-by: Dexuan Cui <decui@microsoft.com>
    Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Tested-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Cc: "K. Y. Srinivasan" <kys@microsoft.com>
    Cc: Haiyang Zhang <haiyangz@microsoft.com>
    Cc: Stephen Hemminger <sthemmin@microsoft.com>
    Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
    Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 964dfbe3dd2d36f9d35018568e303d9847fc1026
Author: K. Y. Srinivasan <kys@microsoft.com>
Date:   Sun Nov 6 13:14:18 2016 -0800

    Drivers: hv: vmbus: On the read path cleanup the logic to interrupt the host
    
    commit 3372592a140db69fd63837e81f048ab4abf8111e upstream.
    
    Signal the host when we determine the host is to be signaled -
    on th read path. The currrent code determines the need to signal in the
    ringbuffer code and actually issues the signal elsewhere. This can result
    in the host viewing this interrupt as spurious since the host may also
    poll the channel. Make the necessary adjustments.
    
    Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
    Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e2fdf7841cb32128685ddcd6db7a51d0e3c3c739
Author: K. Y. Srinivasan <kys@microsoft.com>
Date:   Sun Nov 6 13:14:17 2016 -0800

    Drivers: hv: vmbus: On write cleanup the logic to interrupt the host
    
    commit 1f6ee4e7d83586c8b10bd4f2f4346353d04ce884 upstream.
    
    Signal the host when we determine the host is to be signaled.
    The currrent code determines the need to signal in the ringbuffer
    code and actually issues the signal elsewhere. This can result
    in the host viewing this interrupt as spurious since the host may also
    poll the channel. Make the necessary adjustments.
    
    Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
    Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afbb98f91d3be20c62bcbdf0de084056325b7be2
Author: K. Y. Srinivasan <kys@microsoft.com>
Date:   Sun Nov 6 13:14:16 2016 -0800

    Drivers: hv: vmbus: Base host signaling strictly on the ring state
    
    commit 74198eb4a42c4a3c4fbef08fa01a291a282f7c2e upstream.
    
    One of the factors that can result in the host concluding that a given
    guest in mounting a DOS attack is if the guest generates interrupts
    to the host when the host is not expecting it. If these "spurious"
    interrupts reach a certain rate, the host can throttle the guest to
    minimize the impact. The host computation of the "expected number
    of interrupts" is strictly based on the ring transitions. Until
    the host logic is fixed, base the guest logic to interrupt solely
    on the ring state.
    
    Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
    Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e68f0dbb6bb0f0487a8ae2a117ae1950b6656f1a
Author: Gal Pressman <galp@mellanox.com>
Date:   Wed Jan 11 14:32:26 2017 +0200

    net/mlx5e: Modify TIRs hash only when it's needed
    
    commit 1d3398facd08a7fd4202f269317a95668eb880b9 upstream.
    
    We don't need to modify our TIRs unless the user requested a change in
    the hash function/key, for example when changing indirection only.
    
    Tested:
     # Modify TIRs hash is needed
    ethtool -X ethX hkey  <new key>
    ethtool -X ethX hfunc <new func>
    
     # Modify TIRs hash is not needed
    ethtool -X ethX equal <new indirection table>
    
    All cases are verified with TCP Multi-Stream traffic over IPv4 & IPv6.
    
    Fixes: bdfc028de1b3 ("net/mlx5e: Fix ethtool RX hash func configuration change")
    Signed-off-by: Gal Pressman <galp@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a1981ef15a5bb52c46ab109a63cf1d4ddaee992
Author: Thorsten Horstmann <thorsten@defutech.de>
Date:   Fri Feb 3 14:38:29 2017 +0100

    mac80211: Fix adding of mesh vendor IEs
    
    commit da7061c82e4a1bc6a5e134ef362c86261906c860 upstream.
    
    The function ieee80211_ie_split_vendor doesn't return 0 on errors. Instead
    it returns any offset < ielen when WLAN_EID_VENDOR_SPECIFIC is found. The
    return value in mesh_add_vendor_ies must therefore be checked against
    ifmsh->ie_len and not 0. Otherwise all ifmsh->ie starting with
    WLAN_EID_VENDOR_SPECIFIC will be rejected.
    
    Fixes: 082ebb0c258d ("mac80211: fix mesh beacon format")
    Signed-off-by: Thorsten Horstmann <thorsten@defutech.de>
    Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fit.fraunhofer.de>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    [sven@narfation.org: Add commit message]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f9bd791be5b8755746528df95885a2b4a25b6ff6
Author: Masashi Honma <masashi.honma@gmail.com>
Date:   Thu Jan 26 08:56:13 2017 +0900

    nl80211: Fix mesh HT operation check
    
    commit fd551bac4795854adaa87bad7e5136083719802b upstream.
    
    A previous change to fix checks for NL80211_MESHCONF_HT_OPMODE
    missed setting the flag when replacing FILL_IN_MESH_PARAM_IF_SET
    with checking codes. This results in dropping the received HT
    operation value when called by nl80211_update_mesh_config(). Fix
    this by setting the flag properly.
    
    Fixes: 9757235f451c ("nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value")
    Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
    [rewrite commit message to use Fixes: line]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8920a7f28ad837661bc5b9333240425dbcdc6720
Author: Michał Winiarski <michal.winiarski@intel.com>
Date:   Tue Feb 7 20:55:59 2017 +0100

    drm/i915: Always convert incoming exec offsets to non-canonical
    
    commit 6e7eb1783be7f19eb071c96ddda0bbf22279ff46 upstream.
    
    We're using non-canonical addresses in drm_mm, and we're making sure that
    userspace is using canonical addressing - both in case of softpin
    (verifying incoming offset) and when relocating (converting to canonical
    when updating offset returned to userspace).
    Unfortunately when considering the need for relocations, we're comparing
    offset from userspace (in canonical form) with drm_mm node (in
    non-canonical form), and as a result, we end up always relocating if our
    offsets are in the "problematic" range.
    Let's always convert the offsets to avoid the performance impact of
    relocations.
    
    Fixes: a5f0edf63bdf ("drm/i915: Avoid writing relocs with addresses in non-canonical form")
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Michel Thierry <michel.thierry@intel.com>
    Reported-by: Michał Pyrzowski <michal.pyrzowski@intel.com>
    Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/20170207195559.18798-1-michal.winiarski@intel.com
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    (cherry picked from commit 038c95a313e4ca954ee5ab8a0c7559a646b0f462)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 916d03a6aa3f095477c24840595169390d50df6d
Author: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date:   Tue Jan 17 21:10:11 2017 +0100

    ARM: 8642/1: LPAE: catch pending imprecise abort on unmask
    
    commit 97a98ae5b8acf08d07d972c087b2def060bc9b73 upstream.
    
    Asynchronous external abort is coded differently in DFSR with LPAE enabled.
    
    Fixes: 9254970c "ARM: 8447/1: catch pending imprecise abort on unmask".
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
    Cc: Russell King <linux@armlinux.org.uk>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 126ed953f4461da31ecc04bbc9a431787b33b81b
Author: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Date:   Wed Jan 18 11:09:51 2017 +0100

    ARM: dts: imx6dl: fix GPIO4 range
    
    commit 7f59b319111bbc3a5f32730c8a43b201e9522f52 upstream.
    
    GPIO4_11 is on pin 152(MX6DL_PAD_KEY_ROW2) and not on pin
    151(MX6DL_PAD_KEY_ROW1).
    
    I found the error while booting a mainline kernel on APF6S SoM and
    noticed the following message:
    
    [    2.609337] imx6dl-pinctrl 20e0000.iomuxc: pin MX6DL_PAD_KEY_ROW1
    already requested by 20a8000.gpio:105; cannot claim for 20a8000.gpio:107
    [    2.621884] imx6dl-pinctrl 20e0000.iomuxc: pin-151 (20a8000.gpio:107)
    status -22
    [    2.629303] spi_imx 2008000.ecspi: Can't get CS GPIO 107
    
    With this patch, the message is gone and spi_imx driver probes correctly.
    
    Fixes: bb728d662bed ("ARM: dts: add gpio-ranges property to iMX GPIO controllers")
    Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 84d209b75e7254fba5de26ee2d3b31e638337a82
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Mon Feb 6 14:28:09 2017 -0800

    target: Fix COMPARE_AND_WRITE ref leak for non GOOD status
    
    commit 9b2792c3da1e80f2d460167d319302a24c9ca2b7 upstream.
    
    This patch addresses a long standing bug where the commit phase
    of COMPARE_AND_WRITE would result in a se_cmd->cmd_kref reference
    leak if se_cmd->scsi_status returned non SAM_STAT_GOOD.
    
    This would manifest first as a lost SCSI response, and eventual
    hung task during fabric driver logout or re-login, as existing
    shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref
    to reach zero.
    
    To address this bug, compare_and_write_post() has been changed
    to drop the incorrect !cmd->scsi_status conditional that was
    preventing *post_ret = 1 for being set during non SAM_STAT_GOOD
    status.
    
    This patch has been tested with SAM_STAT_CHECK_CONDITION status
    from normal target_complete_cmd() callback path, as well as the
    incoming __target_execute_cmd() submission failure path when
    se_cmd->execute_cmd() returns non zero status.
    
    Reported-by: Donald White <dew@datera.io>
    Cc: Donald White <dew@datera.io>
    Tested-by: Gary Guo <ghg@datera.io>
    Cc: Gary Guo <ghg@datera.io>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4978149de58d816f101daabaf089464b6108ad84
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Wed Dec 7 12:55:54 2016 -0800

    target: Fix multi-session dynamic se_node_acl double free OOPs
    
    commit 01d4d673558985d9a118e1e05026633c3e2ade9b upstream.
    
    This patch addresses a long-standing bug with multi-session
    (eg: iscsi-target + iser-target) se_node_acl dynamic free
    withini transport_deregister_session().
    
    This bug is caused when a storage endpoint is configured with
    demo-mode (generate_node_acls = 1 + cache_dynamic_acls = 1)
    initiators, and initiator login creates a new dynamic node acl
    and attaches two sessions to it.
    
    After that, demo-mode for the storage instance is disabled via
    configfs (generate_node_acls = 0 + cache_dynamic_acls = 0) and
    the existing dynamic acl is never converted to an explicit ACL.
    
    The end result is dynamic acl resources are released twice when
    the sessions are shutdown in transport_deregister_session().
    
    If the storage instance is not changed to disable demo-mode,
    or the dynamic acl is converted to an explict ACL, or there
    is only a single session associated with the dynamic ACL,
    the bug is not triggered.
    
    To address this big, move the release of dynamic se_node_acl
    memory into target_complete_nacl() so it's only freed once
    when se_node_acl->acl_kref reaches zero.
    
    (Drop unnecessary list_del_init usage - HCH)
    
    Reported-by: Rob Millner <rlm@daterainc.com>
    Tested-by: Rob Millner <rlm@daterainc.com>
    Cc: Rob Millner <rlm@daterainc.com>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 88e865c5d813e400ad0b135c39fe5842e95df6f4
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Tue Dec 6 22:45:46 2016 -0800

    target: Fix early transport_generic_handle_tmr abort scenario
    
    commit c54eeffbe9338fa982dc853d816fda9202a13b5a upstream.
    
    This patch fixes a bug where incoming task management requests
    can be explicitly aborted during an active LUN_RESET, but who's
    struct work_struct are canceled in-flight before execution.
    
    This occurs when core_tmr_drain_tmr_list() invokes cancel_work_sync()
    for the incoming se_tmr_req->task_cmd->work, resulting in cmd->work
    for target_tmr_work() never getting invoked and the aborted TMR
    waiting indefinately within transport_wait_for_tasks().
    
    To address this case, perform a CMD_T_ABORTED check early in
    transport_generic_handle_tmr(), and invoke the normal path via
    transport_cmd_check_stop_to_fabric() to complete any TMR kthreads
    blocked waiting for CMD_T_STOP in transport_wait_for_tasks().
    
    Also, move the TRANSPORT_ISTATE_PROCESSING assignment earlier
    into transport_generic_handle_tmr() so the existing check in
    core_tmr_drain_tmr_list() avoids attempting abort the incoming
    se_tmr_req->task_cmd->work if it has already been queued into
    se_device->tmr_wq.
    
    Reported-by: Rob Millner <rlm@daterainc.com>
    Tested-by: Rob Millner <rlm@daterainc.com>
    Cc: Rob Millner <rlm@daterainc.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4b99bb2e3643d2be438393b95a0572593c5205cf
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Mon Oct 31 00:54:40 2016 -0700

    target: Use correct SCSI status during EXTENDED_COPY exception
    
    commit 0583c261e6325f392c1f7a1b9112e31298e1a4bd upstream.
    
    This patch adds the missing target_complete_cmd() SCSI status
    parameter change in target_xcopy_do_work(), that was originally
    missing in commit 926317de33.
    
    It correctly propigates up the correct SCSI status during
    EXTENDED_COPY exception cases, instead of always using the
    hardcoded SAM_STAT_CHECK_CONDITION from original code.
    
    This is required for ESX host environments that expect to
    hit SAM_STAT_RESERVATION_CONFLICT for certain scenarios,
    and SAM_STAT_CHECK_CONDITION results in non-retriable
    status for these cases.
    
    Reported-by: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Tested-by: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Cc: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eb49824ca9c9fb1030cf9a6e51a89fa2471422fa
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Sun Oct 23 14:28:15 2016 -0700

    target: Don't BUG_ON during NodeACL dynamic -> explicit conversion
    
    commit 391e2a6de9781e4906dd7e0b1cc097050bf43e11 upstream.
    
    After the v4.2+ RCU conversion to se_node_acl->lun_entry_hlist,
    a BUG_ON() was added in core_enable_device_list_for_node() to
    detect when the located orig->se_lun_acl contains an existing
    se_lun_acl pointer reference.
    
    However, this scenario can happen when a dynamically generated
    NodeACL is being converted to an explicit NodeACL, when the
    explicit NodeACL contains a different LUN mapping than the
    default provided by the WWN endpoint.
    
    So instead of triggering BUG_ON(), go ahead and fail instead
    following the original pre RCU conversion logic.
    
    Reported-by: Benjamin ESTRABAUD <ben.estrabaud@mpstor.com>
    Cc: Benjamin ESTRABAUD <ben.estrabaud@mpstor.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cd462c7f2b6fcc208aebf44f2c831681feaa925
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date:   Tue Jan 31 10:25:25 2017 +0100

    drm/atomic: Fix double free in drm_atomic_state_default_clear
    
    commit 92c715fca907686f5298220ece53423e38ba3aed upstream.
    
    drm_atomic_helper_page_flip and drm_atomic_ioctl set their own events
    in crtc_state->event. But when it's set the event is freed in 2 places.
    
    Solve this by only freeing the event in the atomic ioctl when it
    allocated its own event.
    
    This has been broken twice. The first time when the code was introduced,
    but only in the corner case when an event is allocated, but more crtc's
    were included by atomic check and then failing. This can mostly
    happen when you do an atomic modeset in i915 and the display clock is
    changed, which forces all crtc's to be included to the state.
    
    This has been broken worse by adding in-fences support, which caused
    the double free to be done unconditionally.
    
    [IGT] kms_rotation_crc: starting subtest primary-rotation-180
    =============================================================================
    BUG kmalloc-128 (Tainted: G     U         ): Object already free
    -----------------------------------------------------------------------------
    
    Disabling lock debugging due to kernel taint
    INFO: Allocated in drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] age=0 cpu=3 pid=1529
     ___slab_alloc+0x308/0x3b0
     __slab_alloc+0xd/0x20
     kmem_cache_alloc_trace+0x92/0x1c0
     drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper]
     intel_atomic_commit+0x35/0x4f0 [i915]
     drm_atomic_commit+0x46/0x50 [drm]
     drm_mode_atomic_ioctl+0x7d4/0xab0 [drm]
     drm_ioctl+0x2b3/0x490 [drm]
     do_vfs_ioctl+0x69c/0x700
     SyS_ioctl+0x4e/0x80
     entry_SYSCALL_64_fastpath+0x13/0x94
    INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529
     __slab_free+0x48/0x2e0
     kfree+0x159/0x1a0
     drm_event_cancel_free+0xa3/0xb0 [drm]
     drm_mode_atomic_ioctl+0x86d/0xab0 [drm]
     drm_ioctl+0x2b3/0x490 [drm]
     do_vfs_ioctl+0x69c/0x700
     SyS_ioctl+0x4e/0x80
     entry_SYSCALL_64_fastpath+0x13/0x94
    INFO: Slab 0xffffde1f0997b080 objects=17 used=2 fp=0xffff92fb65ec2578 flags=0x200000000008101
    INFO: Object 0xffff92fb65ec2578 @offset=1400 fp=0xffff92fb65ec2ae8
    
    Redzone ffff92fb65ec2570: bb bb bb bb bb bb bb bb                          ........
    Object ffff92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    Object ffff92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
    Redzone ffff92fb65ec25f8: bb bb bb bb bb bb bb bb                          ........
    Padding ffff92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
    CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: G    BU          4.10.0-rc6-patser+ #5039
    Hardware name:                  /NUC5PPYB, BIOS PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015
    Workqueue: events intel_atomic_helper_free_state [i915]
    Call Trace:
     dump_stack+0x4d/0x6d
     print_trailer+0x20c/0x220
     free_debug_processing+0x1c6/0x330
     ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
     __slab_free+0x48/0x2e0
     ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
     kfree+0x159/0x1a0
     drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
     ? drm_atomic_state_clear+0x30/0x30 [drm]
     intel_atomic_state_clear+0xd/0x20 [i915]
     drm_atomic_state_clear+0x1a/0x30 [drm]
     __drm_atomic_state_free+0x13/0x60 [drm]
     intel_atomic_helper_free_state+0x5d/0x70 [i915]
     process_one_work+0x260/0x4a0
     worker_thread+0x2d1/0x4f0
     kthread+0x127/0x130
     ? process_one_work+0x4a0/0x4a0
     ? kthread_stop+0x120/0x120
     ret_from_fork+0x29/0x40
    FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed
    
    Fixes: 3b24f7d67581 ("drm/atomic: Add struct drm_crtc_commit to track async updates")
    Fixes: 9626014258a5 ("drm/fence: add in-fences support")
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
    CC: koos vriezen <koos.vriezen@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 32c67a2cdf4c2210f9bc7d3747da744d5b3ce866
Author: Lee, Shawn C <shawn.c.lee@intel.com>
Date:   Fri Feb 3 12:32:09 2017 +0800

    drm/i915/bxt: Add MST support when do DPLL calculation
    
    commit 789ea12500e5ce3911d0a6a822277c3133451927 upstream.
    
    Add the missing INTEL_OUTPUT_DP_MST case in bxt_get_dpll()
    to correctly initialize the crtc_state and port plls when
    link training a DP MST monitor on BXT/APL devices.
    
    Fixes: a277ca7dc01d ("drm/i915: Split bxt_ddi_pll_select()")
    Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=99572
    Reviewed-by: Cooper Chiou <cooper.chiou@intel.com>
    Reviewed-by: Gary C Wang <gary.c.wang@intel.com>
    Reviewed-by: Ciobanu, Nathan D <nathan.d.ciobanu@intel.com>
    Reviewed-by: Herbert, Marc <marc.herbert@intel.com>
    Reviewed-by: Bride, Jim <jim.bride@intel.com>
    Reviewed-by: Navare, Manasi D <manasi.d.navare@intel.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/1486096329-6255-1-git-send-email-shawn.c.lee@intel.com
    (cherry picked from commit 0aab2c721d81590012a5021a516f00666646741f)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ebe976ac0c3872f4591c0bcda7f12062e9071074
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Jan 26 17:32:11 2017 +0300

    drm/i915: fix use-after-free in page_flip_completed()
    
    commit 5351fbb1bf1413f6024892093528280769ca852f upstream.
    
    page_flip_completed() dereferences 'work' variable after executing
    queue_work(). This is not safe as the 'work' item might be already freed
    by queued work:
    
        BUG: KASAN: use-after-free in page_flip_completed+0x3ff/0x490 at addr ffff8803dc010f90
        Call Trace:
         __asan_report_load8_noabort+0x59/0x80
         page_flip_completed+0x3ff/0x490
         intel_finish_page_flip_mmio+0xe3/0x130
         intel_pipe_handle_vblank+0x2d/0x40
         gen8_irq_handler+0x4a7/0xed0
         __handle_irq_event_percpu+0xf6/0x860
         handle_irq_event_percpu+0x6b/0x160
         handle_irq_event+0xc7/0x1b0
         handle_edge_irq+0x1f4/0xa50
         handle_irq+0x41/0x70
         do_IRQ+0x9a/0x200
         common_interrupt+0x89/0x89
    
        Freed:
         kfree+0x113/0x4d0
         intel_unpin_work_fn+0x29a/0x3b0
         process_one_work+0x79e/0x1b70
         worker_thread+0x611/0x1460
         kthread+0x241/0x3a0
         ret_from_fork+0x27/0x40
    
    Move queue_work() after trace_i915_flip_complete() to fix this.
    
    Fixes: e5510fac98a7 ("drm/i915: add tracepoints for flip requests & completions")
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/20170126143211.24013-1-aryabinin@virtuozzo.com
    (cherry picked from commit 05c41f926fcc7ef838c80a6a99d84f67b4e0b824)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bd7d069c7635da0276ce0f25155514b117b0b1eb
Author: Dave Martin <Dave.Martin@arm.com>
Date:   Wed Jan 18 17:11:56 2017 +0100

    ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write
    
    commit 228dbbfb5d77f8e047b2a1d78da14b7158433027 upstream.
    
    Ensure that if userspace supplies insufficient data to
    PTRACE_SETREGSET to fill all the registers, the thread's old
    registers are preserved.
    
    Fixes: 5be6f62b0059 ("ARM: 6883/1: ptrace: Migrate to regsets framework")
    Signed-off-by: Dave Martin <Dave.Martin@arm.com>
    Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 14cdf0f590447c4f7c5e1567ce73c81b2d9fe80b
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Feb 3 17:35:46 2017 +0100

    hns: avoid stack overflow with CONFIG_KASAN
    
    commit b3f2d07f4649adcf6905953a10d217b5683e4077 upstream.
    
    The use of ACCESS_ONCE() looks like a micro-optimization to force gcc to use
    an indexed load for the register address, but it has an absolutely detrimental
    effect on builds with gcc-5 and CONFIG_KASAN=y, leading to a very likely
    kernel stack overflow aside from very complex object code:
    
    hisilicon/hns/hns_dsaf_gmac.c: In function 'hns_gmac_update_stats':
    hisilicon/hns/hns_dsaf_gmac.c:419:1: error: the frame size of 2912 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_ppe.c: In function 'hns_ppe_reset_common':
    hisilicon/hns/hns_dsaf_ppe.c:390:1: error: the frame size of 1184 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_ppe.c: In function 'hns_ppe_get_regs':
    hisilicon/hns/hns_dsaf_ppe.c:621:1: error: the frame size of 3632 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_rcb.c: In function 'hns_rcb_get_common_regs':
    hisilicon/hns/hns_dsaf_rcb.c:970:1: error: the frame size of 2784 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_gmac.c: In function 'hns_gmac_get_regs':
    hisilicon/hns/hns_dsaf_gmac.c:641:1: error: the frame size of 5728 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_rcb.c: In function 'hns_rcb_get_ring_regs':
    hisilicon/hns/hns_dsaf_rcb.c:1021:1: error: the frame size of 2208 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_comm_init':
    hisilicon/hns/hns_dsaf_main.c:1209:1: error: the frame size of 1904 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_xgmac.c: In function 'hns_xgmac_get_regs':
    hisilicon/hns/hns_dsaf_xgmac.c:748:1: error: the frame size of 4704 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_update_stats':
    hisilicon/hns/hns_dsaf_main.c:2420:1: error: the frame size of 1088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_get_regs':
    hisilicon/hns/hns_dsaf_main.c:2753:1: error: the frame size of 10768 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
    
    This does not seem to happen any more with gcc-7, but removing the ACCESS_ONCE
    seems safe anyway and it avoids a serious issue for some people. I have verified
    that with gcc-5.3.1, the object code we get is better in the new version
    both with and without CONFIG_KASAN, as we no longer allocate a 1344 byte
    stack frame for hns_dsaf_get_regs() but otherwise have practically identical
    object code.
    
    With gcc-7.0.0, removing ACCESS_ONCE has no effect, the object code is already
    good either way.
    
    This patch is probably not urgent to get into 4.11 as only KASAN=y builds
    with certain compilers are affected, but I still think it makes sense to
    backport into older kernels.
    
    Fixes: 511e6bc ("net: add Hisilicon Network Subsystem DSAF support")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b10a704325a26d6f6495001e827b8601a170c3b
Author: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Date:   Mon Feb 6 10:04:28 2017 -0600

    ibmvscsis: Add SGL limit
    
    commit b22bc27868e8c11fe3f00937a341b44f80b50364 upstream.
    
    This patch adds internal LIO sgl limit since the driver already
    sets a max transfer limit on transport layer of 1MB to the client.
    
    Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
    Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 49f68ccccf8e502bce967126207211f5a27feb4c
Author: Sean Rees <sean@erifax.org>
Date:   Wed Feb 8 14:30:59 2017 -0800

    mm/slub.c: fix random_seq offset destruction
    
    commit a810007afe239d59c1115fcaa06eb5b480f876e9 upstream.
    
    Commit 210e7a43fa90 ("mm: SLUB freelist randomization") broke USB hub
    initialisation as described in
    
      https://bugzilla.kernel.org/show_bug.cgi?id=177551.
    
    Bail out early from init_cache_random_seq if s->random_seq is already
    initialised.  This prevents destroying the previously computed
    random_seq offsets later in the function.
    
    If the offsets are destroyed, then shuffle_freelist will truncate
    page->freelist to just the first object (orphaning the rest).
    
    Fixes: 210e7a43fa90 ("mm: SLUB freelist randomization")
    Link: http://lkml.kernel.org/r/20170207140707.20824-1-sean@erifax.org
    Signed-off-by: Sean Rees <sean@erifax.org>
    Reported-by: <userwithuid@gmail.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Thomas Garnier <thgarnie@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c4236b0c71169b6e5fb5f2272dd0292156c81e97
Author: Tejun Heo <tj@kernel.org>
Date:   Wed Feb 8 14:30:56 2017 -0800

    cpumask: use nr_cpumask_bits for parsing functions
    
    commit 4d59b6ccf000862beed6fc0765d3209f98a8d8a2 upstream.
    
    Commit 513e3d2d11c9 ("cpumask: always use nr_cpu_ids in formatting and
    parsing functions") converted both cpumask printing and parsing
    functions to use nr_cpu_ids instead of nr_cpumask_bits.  While this was
    okay for the printing functions as it just picked one of the two output
    formats that we were alternating between depending on a kernel config,
    doing the same for parsing wasn't okay.
    
    nr_cpumask_bits can be either nr_cpu_ids or NR_CPUS.  We can always use
    nr_cpu_ids but that is a variable while NR_CPUS is a constant, so it can
    be more efficient to use NR_CPUS when we can get away with it.
    Converting the printing functions to nr_cpu_ids makes sense because it
    affects how the masks get presented to userspace and doesn't break
    anything; however, using nr_cpu_ids for parsing functions can
    incorrectly leave the higher bits uninitialized while reading in these
    masks from userland.  As all testing and comparison functions use
    nr_cpumask_bits which can be larger than nr_cpu_ids, the parsed cpumasks
    can erroneously yield false negative results.
    
    This made the taskstats interface incorrectly return -EINVAL even when
    the inputs were correct.
    
    Fix it by restoring the parse functions to use nr_cpumask_bits instead
    of nr_cpu_ids.
    
    Link: http://lkml.kernel.org/r/20170206182442.GB31078@htj.duckdns.org
    Fixes: 513e3d2d11c9 ("cpumask: always use nr_cpu_ids in formatting and parsing functions")
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Reported-by: Martin Steigerwald <martin.steigerwald@teamix.de>
    Debugged-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d2485c03ce8db7246e2b00cb8d9af82cea32ab60
Author: Jurij Smakov <jurij@wooyd.org>
Date:   Mon Jan 30 15:41:36 2017 -0600

    rtlwifi: rtl8192ce: Fix loading of incorrect firmware
    
    commit 52f5631a4c056ad01682393be56d2be237e81610 upstream.
    
    In commit cf4747d7535a ("rtlwifi: Fix regression caused by commit
    d86e64768859, an error in the edit results in the wrong firmware
    being loaded for some models of the RTL8188/8192CE. In this condition,
    the connection suffered from high ping latency, slow transfer rates,
     and required higher signal strengths to work at all
    
    See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853073,
    https://bugzilla.opensuse.org/show_bug.cgi?id=1017471, and
    https://github.com/lwfinger/rtlwifi_new/issues/203 for descriptions
    of the problems. This patch fixes all of those problems.
    
    Fixes: cf4747d7535a ("rtlwifi: Fix regression caused by commit d86e64768859")
    Signed-off-by: Jurij Smakov <jurij@wooyd.org>
    Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d9985610c6bee5998db6d0b39d06cbbc5447e7e1
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed Feb 8 18:08:29 2017 -0800

    Revert "x86/ioapic: Restore IO-APIC irq_chip retrigger callback"
    
    commit d966564fcdc19e13eb6ba1fbe6b8101070339c3d upstream.
    
    This reverts commit 020eb3daaba2857b32c4cf4c82f503d6a00a67de.
    
    Gabriel C reports that it causes his machine to not boot, and we haven't
    tracked down the reason for it yet.  Since the bug it fixes has been
    around for a longish time, we're better off reverting the fix for now.
    
    Gabriel says:
     "It hangs early and freezes with a lot RCU warnings.
    
      I bisected it down to :
    
      > Ruslan Ruslichenko (1):
      >       x86/ioapic: Restore IO-APIC irq_chip retrigger callback
    
      Reverting this one fixes the problem for me..
    
      The box is a PRIMERGY TX200 S5 , 2 socket , 2 x E5520 CPU(s) installed"
    
    and Ruslan and Thomas are currently stumped.
    
    Reported-and-bisected-by: Gabriel C <nix.or.die@gmail.com>
    Cc: Ruslan Ruslichenko <rruslich@cisco.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6cbaf7b94373743deb42fd410173aab81f8945fe
Author: Stephen Smalley <sds@tycho.nsa.gov>
Date:   Tue Jan 31 11:54:04 2017 -0500

    selinux: fix off-by-one in setprocattr
    
    commit 0c461cb727d146c9ef2d3e86214f498b78b7d125 upstream.
    
    SELinux tries to support setting/clearing of /proc/pid/attr attributes
    from the shell by ignoring terminating newlines and treating an
    attribute value that begins with a NUL or newline as an attempt to
    clear the attribute.  However, the test for clearing attributes has
    always been wrong; it has an off-by-one error, and this could further
    lead to reading past the end of the allocated buffer since commit
    bb646cdb12e75d82258c2f2e7746d5952d3e321a ("proc_pid_attr_write():
    switch to memdup_user()").  Fix the off-by-one error.
    
    Even with this fix, setting and clearing /proc/pid/attr attributes
    from the shell is not straightforward since the interface does not
    support multiple write() calls (so shells that write the value and
    newline separately will set and then immediately clear the attribute,
    requiring use of echo -n to set the attribute), whereas trying to use
    echo -n "" to clear the attribute causes the shell to skip the
    write() call altogether since POSIX says that a zero-length write
    causes no side effects. Thus, one must use echo -n to set and echo
    without -n to clear, as in the following example:
    $ echo -n unconfined_u:object_r:user_home_t:s0 > /proc/$$/attr/fscreate
    $ cat /proc/$$/attr/fscreate
    unconfined_u:object_r:user_home_t:s0
    $ echo "" > /proc/$$/attr/fscreate
    $ cat /proc/$$/attr/fscreate
    
    Note the use of /proc/$$ rather than /proc/self, as otherwise
    the cat command will read its own attribute value, not that of the shell.
    
    There are no users of this facility to my knowledge; possibly we
    should just get rid of it.
    
    UPDATE: Upon further investigation it appears that a local process
    with the process:setfscreate permission can cause a kernel panic as a
    result of this bug.  This patch fixes CVE-2017-2618.
    
    Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
    [PM: added the update about CVE-2017-2618 to the commit description]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    Signed-off-by: James Morris <james.l.morris@oracle.com>

commit 2089e4563d50c44f187df1ed63a906e05708cf51
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Tue Jan 31 14:56:43 2017 -0800

    Input: uinput - fix crash when mixing old and new init style
    
    commit 601bbbe0517303c9f8eb3d75e11d64efed1293c9 upstream.
    
    If user tries to initialize uinput device mixing old and new style
    initialization (i.e. using old UI_SET_ABSBIT instead of UI_ABS_SETUP,
    we forget to allocate input->absinfo and will crash when trying to send
    absolute events:
    
            ioctl(ui, UI_DEV_SETUP, &us);
            ioctl(ui, UI_SET_PHYS, "Test");
    
            ioctl(ui, UI_SET_EVBIT, EV_ABS);
            ioctl(ui, UI_SET_ABSBIT, ABS_X);
            ioctl(ui, UI_SET_ABSBIT, ABS_Y);
            ioctl(ui, UI_DEV_CREATE, 0);
    
    Reported-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=191811
    Fixes: fbae10db0940 ("Input: uinput - rework ABS validation")
    Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a815c52d57ebf35bfb516eafada98eeda292d66
Author: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Date:   Tue Feb 7 09:44:58 2017 -0800

    ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup
    
    commit a524c218bc94c705886a0e0fedeee45d1931da32 upstream.
    
    Reported-by: Jo-Philipp Wich <jo@mein.io>
    Fixes: 9aed02feae57bf7 ("ARC: [arcompact] handle unaligned access delay slot")
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-snps-arc@lists.infradead.org
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f77e7b119ff18d4732b6e08b3d10c4e324de9442
Author: Gary R Hook <gary.hook@amd.com>
Date:   Fri Jan 27 17:09:04 2017 -0600

    crypto: ccp - Fix double add when creating new DMA command
    
    commit e5da5c5667381d2772374ee6a2967b3576c9483d upstream.
    
    Eliminate a double-add by creating a new list to manage
    command descriptors when created; move the descriptor to
    the pending list when the command is submitted.
    
    Signed-off-by: Gary R Hook <gary.hook@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1105ccf25118894ffde5b50d43c52b9e39fe3fc9
Author: Gary R Hook <gary.hook@amd.com>
Date:   Fri Jan 27 15:28:45 2017 -0600

    crypto: ccp - Fix DMA operations when IOMMU is enabled
    
    commit 500c0106e638e08c2c661c305ed57d6b67e10908 upstream.
    
    An I/O page fault occurs when the IOMMU is enabled on a
    system that supports the v5 CCP.  DMA operations use a
    Request ID value that does not match what is expected by
    the IOMMU, resulting in the I/O page fault.  Setting the
    Request ID value to 0 corrects this issue.
    
    Signed-off-by: Gary R Hook <gary.hook@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7aa88a14eb059cdc9c82206cd3ee8ccb6f62ee6
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Thu Dec 22 15:00:24 2016 +0000

    crypto: qat - zero esram only for DH85x devices
    
    commit 685ce0626840e2673fe64ea8807684f7324fec5f upstream.
    
    Zero embedded ram in DH85x devices. This is not
    needed for newer generations as it is done by HW.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2d5dd056884e147a369aa1f6aa786e65a36e624a
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Thu Dec 22 15:00:12 2016 +0000

    crypto: qat - fix bar discovery for c62x
    
    commit 3484ecbe0e9deb94afb0b9b6172d77e98eb72b94 upstream.
    
    Some accelerators of the c62x series have only two bars.
    This patch skips BAR0 if the accelerator does not have it.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4de8af91b8ab9a604a5acd78b0d8763cf5818b5
Author: Harsh Jain <harsh@chelsio.com>
Date:   Tue Jan 24 10:34:33 2017 +0530

    crypto: chcr - Check device is allocated before use
    
    commit f5f7bebc91ab378dea5aad5277c4d283e46472d9 upstream.
    
    Ensure dev is allocated for crypto uld context before using the device
    for crypto operations.
    
    Signed-off-by: Atul Gupta <atul.gupta@chelsio.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 066a7166c5412ea4c04b1946faf2aa7cda48ee60
Author: Harsh Jain <harsh@chelsio.com>
Date:   Wed Feb 1 21:10:28 2017 +0530

    crypto: algif_aead - Fix kernel panic on list_del
    
    commit 0b529f143e8baad441a5aac9ad55ec2434d8fb46 upstream.
    
    Kernel panics when userspace program try to access AEAD interface.
    Remove node from Linked List before freeing its memory.
    
    Signed-off-by: Harsh Jain <harsh@chelsio.com>
    Reviewed-by: Stephan Müller <smueller@chronox.de>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 621d101a7ebb7965ee3332e4e6e8d17bdd8f0555
Author: Mike Snitzer <snitzer@redhat.com>
Date:   Wed Jan 25 16:24:52 2017 +0100

    dm rq: cope with DM device destruction while in dm_old_request_fn()
    
    commit 4087a1fffe38106e10646606a27f10d40451862d upstream.
    
    Fixes a crash in dm_table_find_target() due to a NULL struct dm_table
    being passed from dm_old_request_fn() that races with DM device
    destruction.
    
    Reported-by: artem@flashgrid.io
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cd755677d9444d718ac04a693523c9ff5a7f79ec
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Sat Feb 4 14:47:31 2017 -0800

    libnvdimm, pfn: fix memmap reservation size versus 4K alignment
    
    commit bfb34527a32a1a576d9bfb7026d3ab0369a6cd60 upstream.
    
    When vmemmap_populate() allocates space for the memmap it does so in 2MB
    sized chunks. The libnvdimm-pfn driver incorrectly accounts for this
    when the alignment of the device is set to 4K. When this happens we
    trigger memory allocation failures in altmap_alloc_block_buf() and
    trigger warnings of the form:
    
     WARNING: CPU: 0 PID: 3376 at arch/x86/mm/init_64.c:656 arch_add_memory+0xe4/0xf0
     [..]
     Call Trace:
      dump_stack+0x86/0xc3
      __warn+0xcb/0xf0
      warn_slowpath_null+0x1d/0x20
      arch_add_memory+0xe4/0xf0
      devm_memremap_pages+0x29b/0x4e0
    
    Fixes: 315c562536c4 ("libnvdimm, pfn: add 'align' attribute, default to HPAGE_SIZE")
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ebffa7bc77c88218a484a47ab61822943539b252
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Wed Jan 25 00:54:07 2017 +0530

    libnvdimm, namespace: do not delete namespace-id 0
    
    commit 9d032f4201d39e5cf43a8709a047e481f5723fdc upstream.
    
    Given that the naming of pmem devices changes from the pmemX form to the
    pmemX.Y form when namespace id is greater than 0, arrange for namespaces
    with id-0 to be exempt from deletion. Otherwise a simple reconfiguration
    of an existing namespace to a new mode results in a name change of the
    resulting block device:
    
        # ndctl list --namespace=namespace1.0
        {
          "dev":"namespace1.0",
          "mode":"raw",
          "size":2147483648,
          "uuid":"3dadf3dc-89b9-4b24-b20e-abc8a4707ce3",
          "blockdev":"pmem1"
        }
    
        # ndctl create-namespace --reconfig=namespace1.0 --mode=memory --force
        {
          "dev":"namespace1.1",
          "mode":"memory",
          "size":2111832064,
          "uuid":"7b4a6341-7318-4219-a02c-fb57c0bbf613",
          "blockdev":"pmem1.1"
        }
    
    This change does require tooling changes to explicitly look for
    namespaceX.0 if the seed has already advanced to another namespace.
    
    Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 46cf1520ed9167f83196022d651f0625152ea79b
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Thu Feb 2 10:31:00 2017 -0800

    acpi, nfit: fix acpi_nfit_flush_probe() crash
    
    commit e471486c13b82b1338d49c798f78bb62b1ed0a9e upstream.
    
    We queue an on-stack work item to 'nfit_wq' and wait for it to complete
    as part of a 'flush_probe' request. However, if the user cancels the
    wait we need to make sure the item is flushed from the queue otherwise
    we are leaving an out-of-scope stack address on the work list.
    
     BUG: unable to handle kernel paging request at ffffbcb3c72f7cd0
     IP: [<ffffffffa9413a7b>] __list_add+0x1b/0xb0
     [..]
     RIP: 0010:[<ffffffffa9413a7b>]  [<ffffffffa9413a7b>] __list_add+0x1b/0xb0
     RSP: 0018:ffffbcb3c7ba7c00  EFLAGS: 00010046
     [..]
     Call Trace:
      [<ffffffffa90bb11a>] insert_work+0x3a/0xc0
      [<ffffffffa927fdda>] ? seq_open+0x5a/0xa0
      [<ffffffffa90bb30a>] __queue_work+0x16a/0x460
      [<ffffffffa90bbb08>] queue_work_on+0x38/0x40
      [<ffffffffc0cf2685>] acpi_nfit_flush_probe+0x95/0xc0 [nfit]
      [<ffffffffc0cf25d0>] ? nfit_visible+0x40/0x40 [nfit]
      [<ffffffffa9571495>] wait_probe_show+0x25/0x60
      [<ffffffffa9546b30>] dev_attr_show+0x20/0x50
    
    Fixes: 7ae0fa439faf ("nfit, libnvdimm: async region scrub workqueue")
    Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a6b1dc61bcf45fbc03a2e62f007cd36410e5e269
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Fri Feb 3 14:18:39 2017 -0800

    cpufreq: intel_pstate: Disable energy efficiency optimization
    
    commit 6e978b22efa1db9f6e71b24440b5f1d93e968ee3 upstream.
    
    Some Kabylake desktop processors may not reach max turbo when running in
    HWP mode, even if running under sustained 100% utilization.
    
    This occurs when the HWP.EPP (Energy Performance Preference) is set to
    "balance_power" (0x80) -- the default on most systems.
    
    It occurs because the platform BIOS may erroneously enable an
    energy-efficiency setting -- MSR_IA32_POWER_CTL BIT-EE, which is not
    recommended to be enabled on this SKU.
    
    On the failing systems, this BIOS issue was not discovered when the
    desktop motherboard was tested with Windows, because the BIOS also
    neglects to provide the ACPI/CPPC table, that Windows requires to enable
    HWP, and so Windows runs in legacy P-state mode, where this setting has
    no effect.
    
    Linux' intel_pstate driver does not require ACPI/CPPC to enable HWP, and
    so it runs in HWP mode, exposing this incorrect BIOS configuration.
    
    There are several ways to address this problem.
    
    First, Linux can also run in legacy P-state mode on this system.
    As intel_pstate is how Linux enables HWP, booting with
    "intel_pstate=disable"
    will run in acpi-cpufreq/ondemand legacy p-state mode.
    
    Or second, the "performance" governor can be used with intel_pstate,
    which will modify HWP.EPP to 0.
    
    Or third, starting in 4.10, the
    /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
    attribute in can be updated from "balance_power" to "performance".
    
    Or fourth, apply this patch, which fixes the erroneous setting of
    MSR_IA32_POWER_CTL BIT_EE on this model, allowing the default
    configuration to function as designed.
    
    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Reviewed-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>