commit 830f9674e76d08d04585e53fc200ae8af99966e7
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Aug 9 12:20:36 2018 +0200

    Linux 3.18.118

commit 31430f2b98f6053933482e51d008124fc31bc3e0
Author: Shankara Pailoor <shankarapailoor@gmail.com>
Date:   Tue Jun 5 08:33:27 2018 -0500

    jfs: Fix inconsistency between memory allocation and ea_buf->max_size
    
    commit 92d34134193e5b129dc24f8d79cb9196626e8d7a upstream.
    
    The code is assuming the buffer is max_size length, but we weren't
    allocating enough space for it.
    
    Signed-off-by: Shankara Pailoor <shankarapailoor@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fed22131f5b2740acbf184910133179b558aecc0
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Jul 14 01:28:15 2018 +0900

    ring_buffer: tracing: Inherit the tracing setting to next ring buffer
    
    commit 73c8d8945505acdcbae137c2e00a1232e0be709f upstream.
    
    Maintain the tracing on/off setting of the ring_buffer when switching
    to the trace buffer snapshot.
    
    Taking a snapshot is done by swapping the backup ring buffer
    (max_tr_buffer). But since the tracing on/off setting is defined
    by the ring buffer, when swapping it, the tracing on/off setting
    can also be changed. This causes a strange result like below:
    
      /sys/kernel/debug/tracing # cat tracing_on
      1
      /sys/kernel/debug/tracing # echo 0 > tracing_on
      /sys/kernel/debug/tracing # cat tracing_on
      0
      /sys/kernel/debug/tracing # echo 1 > snapshot
      /sys/kernel/debug/tracing # cat tracing_on
      1
      /sys/kernel/debug/tracing # echo 1 > snapshot
      /sys/kernel/debug/tracing # cat tracing_on
      0
    
    We don't touch tracing_on, but snapshot changes tracing_on
    setting each time. This is an anomaly, because user doesn't know
    that each "ring_buffer" stores its own tracing-enable state and
    the snapshot is done by swapping ring buffers.
    
    Link: http://lkml.kernel.org/r/153149929558.11274.11730609978254724394.stgit@devbox
    
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
    Cc: Hiraku Toyooka <hiraku.toyooka@cybertrust.co.jp>
    Cc: stable@vger.kernel.org
    Fixes: debdd57f5145 ("tracing: Make a snapshot feature available from userspace")
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    [ Updated commit log and comment in the code ]
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fa4bbed870c492b899cd779c05f8714c1b205e12
Author: Anil Gurumurthy <anil.gurumurthy@cavium.com>
Date:   Wed Jul 18 14:29:55 2018 -0700

    scsi: qla2xxx: Return error when TMF returns
    
    commit b4146c4929ef61d5afca011474d59d0918a0cd82 upstream.
    
    Propagate the task management completion status properly to avoid
    unnecessary waits for commands to complete.
    
    Fixes: faef62d13463 ("[SCSI] qla2xxx: Fix Task Management command asynchronous handling")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Anil Gurumurthy <anil.gurumurthy@cavium.com>
    Signed-off-by: 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 2de35a8aac3f627a900cf4d259511860f83bb5a3
Author: Quinn Tran <quinn.tran@cavium.com>
Date:   Wed Jul 18 14:29:54 2018 -0700

    scsi: qla2xxx: Fix ISP recovery on unload
    
    commit b08abbd9f5996309f021684f9ca74da30dcca36a upstream.
    
    During unload process, the chip can encounter problem where a FW dump would
    be captured. For this case, the full reset sequence will be skip to bring
    the chip back to full operational state.
    
    Fixes: e315cd28b9ef ("[SCSI] qla2xxx: Code changes for qla data structure refactoring")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
    Signed-off-by: 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 f42178c0f2f09d6e87b0a35dff3c8484eeaaa197
Author: Tony Battersby <tonyb@cybernetics.com>
Date:   Thu Jul 12 16:30:45 2018 -0400

    scsi: sg: fix minor memory leak in error path
    
    commit c170e5a8d222537e98aa8d4fddb667ff7a2ee114 upstream.
    
    Fix a minor memory leak when there is an error opening a /dev/sg device.
    
    Fixes: cc833acbee9d ("sg: O_EXCL and other lock handling")
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
    Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc7ec0c4ef5c29fc0679e12a02e22869b3092370
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Fri Jul 13 16:12:32 2018 +0800

    crypto: padlock-aes - Fix Nano workaround data corruption
    
    commit 46d8c4b28652d35dc6cfb5adf7f54e102fc04384 upstream.
    
    This was detected by the self-test thanks to Ard's chunking patch.
    
    I finally got around to testing this out on my ancient Via box.  It
    turns out that the workaround got the assembly wrong and we end up
    doing count + initial cycles of the loop instead of just count.
    
    This obviously causes corruption, either by overwriting the source
    that is yet to be processed, or writing over the end of the buffer.
    
    On CPUs that don't require the workaround only ECB is affected.
    On Nano CPUs both ECB and CBC are affected.
    
    This patch fixes it by doing the subtraction prior to the assembly.
    
    Fixes: a76c1c23d0c3 ("crypto: padlock-aes - work around Nano CPU...")
    Cc: <stable@vger.kernel.org>
    Reported-by: Jamie Heilman <jamie@audible.transient.net>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c4682ea443b921c88d6b6165619d6ab973fe41c1
Author: Jiang Biao <jiang.biao2@zte.com.cn>
Date:   Wed Jul 18 10:29:28 2018 +0800

    virtio_balloon: fix another race between migration and ballooning
    
    commit 89da619bc18d79bca5304724c11d4ba3b67ce2c6 upstream.
    
    Kernel panic when with high memory pressure, calltrace looks like,
    
    PID: 21439 TASK: ffff881be3afedd0 CPU: 16 COMMAND: "java"
     #0 [ffff881ec7ed7630] machine_kexec at ffffffff81059beb
     #1 [ffff881ec7ed7690] __crash_kexec at ffffffff81105942
     #2 [ffff881ec7ed7760] crash_kexec at ffffffff81105a30
     #3 [ffff881ec7ed7778] oops_end at ffffffff816902c8
     #4 [ffff881ec7ed77a0] no_context at ffffffff8167ff46
     #5 [ffff881ec7ed77f0] __bad_area_nosemaphore at ffffffff8167ffdc
     #6 [ffff881ec7ed7838] __node_set at ffffffff81680300
     #7 [ffff881ec7ed7860] __do_page_fault at ffffffff8169320f
     #8 [ffff881ec7ed78c0] do_page_fault at ffffffff816932b5
     #9 [ffff881ec7ed78f0] page_fault at ffffffff8168f4c8
        [exception RIP: _raw_spin_lock_irqsave+47]
        RIP: ffffffff8168edef RSP: ffff881ec7ed79a8 RFLAGS: 00010046
        RAX: 0000000000000246 RBX: ffffea0019740d00 RCX: ffff881ec7ed7fd8
        RDX: 0000000000020000 RSI: 0000000000000016 RDI: 0000000000000008
        RBP: ffff881ec7ed79a8 R8: 0000000000000246 R9: 000000000001a098
        R10: ffff88107ffda000 R11: 0000000000000000 R12: 0000000000000000
        R13: 0000000000000008 R14: ffff881ec7ed7a80 R15: ffff881be3afedd0
        ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
    
    It happens in the pagefault and results in double pagefault
    during compacting pages when memory allocation fails.
    
    Analysed the vmcore, the page leads to second pagefault is corrupted
    with _mapcount=-256, but private=0.
    
    It's caused by the race between migration and ballooning, and lock
    missing in virtballoon_migratepage() of virtio_balloon driver.
    This patch fix the bug.
    
    Fixes: e22504296d4f64f ("virtio_balloon: introduce migration primitives to balloon pages")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
    Signed-off-by: Huang Chong <huang.chong@zte.com.cn>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a64e47ee1fa0d9fd506ad84fedba380381965ae5
Author: Anton Vasilyev <vasilyev@ispras.ru>
Date:   Fri Jul 27 18:50:42 2018 +0300

    can: ems_usb: Fix memory leak on ems_usb_disconnect()
    
    commit 72c05f32f4a5055c9c8fe889bb6903ec959c0aad upstream.
    
    ems_usb_probe() allocates memory for dev->tx_msg_buffer, but there
    is no its deallocation in ems_usb_disconnect().
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4a60e5435410a27e7daea64d1ed550dd8238936b
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Aug 2 08:43:35 2018 -0700

    squashfs: more metadata hardenings
    
    commit 71755ee5350b63fb1f283de8561cdb61b47f4d1d upstream.
    
    The squashfs fragment reading code doesn't actually verify that the
    fragment is inside the fragment table.  The end result _is_ verified to
    be inside the image when actually reading the fragment data, but before
    that is done, we may end up taking a page fault because the fragment
    table itself might not even exist.
    
    Another report from Anatoly and his endless squashfs image fuzzing.
    
    Reported-by: Анатолий Тросиненко <anatoly.trosinenko@gmail.com>
    Acked-by:: Phillip Lougher <phillip.lougher@gmail.com>,
    Cc: Willy Tarreau <w@1wt.eu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a220a703b9d844662104f5db3862f12eb426c758
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Mon Jul 30 14:27:15 2018 -0700

    squashfs: more metadata hardening
    
    commit d512584780d3e6a7cacb2f482834849453d444a1 upstream.
    
    Anatoly reports another squashfs fuzzing issue, where the decompression
    parameters themselves are in a compressed block.
    
    This causes squashfs_read_data() to be called in order to read the
    decompression options before the decompression stream having been set
    up, making squashfs go sideways.
    
    Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
    Acked-by: Phillip Lougher <phillip.lougher@gmail.com>
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1aa222b3b245f2e656b90271b9994232f9b786a2
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Tue Jul 31 17:12:52 2018 -0700

    net: dsa: Do not suspend/resume closed slave_dev
    
    [ Upstream commit a94c689e6c9e72e722f28339e12dff191ee5a265 ]
    
    If a DSA slave network device was previously disabled, there is no need
    to suspend or resume it.
    
    Fixes: 2446254915a7 ("net: dsa: allow switch drivers to implement suspend/resume hooks")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 95478b56ac4fddc84ade05c4cf95a524af58d16c
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Jul 30 20:09:11 2018 -0700

    inet: frag: enforce memory limits earlier
    
    [ Upstream commit 56e2c94f055d328f5f6b0a5c1721cca2f2d4e0a1 ]
    
    We currently check current frags memory usage only when
    a new frag queue is created. This allows attackers to first
    consume the memory budget (default : 4 MB) creating thousands
    of frag queues, then sending tiny skbs to exceed high_thresh
    limit by 2 to 3 order of magnitude.
    
    Note that before commit 648700f76b03 ("inet: frags: use rhashtables
    for reassembly units"), work queue could be starved under DOS,
    getting no cpu cycles.
    After commit 648700f76b03, only the per frag queue timer can eventually
    remove an incomplete frag queue and its skbs.
    
    Fixes: b13d3cbfb8e8 ("inet: frag: move eviction of queues to work queue")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: Jann Horn <jannh@google.com>
    Cc: Florian Westphal <fw@strlen.de>
    Cc: Peter Oskolkov <posk@google.com>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Acked-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 88b3bd57867606b98fc04be05b4aa299f1587780
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Fri Jul 27 18:15:46 2018 +0200

    ipv4: remove BUG_ON() from fib_compute_spec_dst
    
    [ Upstream commit 9fc12023d6f51551d6ca9ed7e02ecc19d79caf17 ]
    
    Remove BUG_ON() from fib_compute_spec_dst routine and check
    in_dev pointer during flowi4 data structure initialization.
    fib_compute_spec_dst routine can be run concurrently with device removal
    where ip_ptr net_device pointer is set to NULL. This can happen
    if userspace enables pkt info on UDP rx socket and the device
    is removed while traffic is flowing
    
    Fixes: 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper")
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6f46f91cb5727c7ecf7a2475245517da85b7bc5a
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Jun 27 08:47:21 2018 -0700

    tcp: add one more quick ack after after ECN events
    
    [ Upstream commit 15ecbe94a45ef88491ca459b26efdd02f91edb6d ]
    
    Larry Brakmo proposal ( https://patchwork.ozlabs.org/patch/935233/
    tcp: force cwnd at least 2 in tcp_cwnd_reduction) made us rethink
    about our recent patch removing ~16 quick acks after ECN events.
    
    tcp_enter_quickack_mode(sk, 1) makes sure one immediate ack is sent,
    but in the case the sender cwnd was lowered to 1, we do not want
    to have a delayed ack for the next packet we will receive.
    
    Fixes: 522040ea5fdd ("tcp: do not aggressively quick ack after ECN events")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: Neal Cardwell <ncardwell@google.com>
    Cc: Lawrence Brakmo <brakmo@fb.com>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ecfeef99e88e66ae9c2a9555be4eb43908b463c
Author: Yousuk Seung <ysseung@google.com>
Date:   Mon Jun 4 15:29:51 2018 -0700

    tcp: refactor tcp_ecn_check_ce to remove sk type cast
    
    [ Upstream commit f4c9f85f3b2cb7669830cd04d0be61192a4d2436 ]
    
    Refactor tcp_ecn_check_ce and __tcp_ecn_check_ce to accept struct sock*
    instead of tcp_sock* to clean up type casts. This is a pure refactor
    patch.
    
    Signed-off-by: Yousuk Seung <ysseung@google.com>
    Signed-off-by: Neal Cardwell <ncardwell@google.com>
    Signed-off-by: Yuchung Cheng <ycheng@google.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d8c80fae49027ee5fce46df8f9bcc92d4b855771
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon May 21 15:08:57 2018 -0700

    tcp: do not aggressively quick ack after ECN events
    
    [ Upstream commit 522040ea5fdd1c33bbf75e1d7c7c0422b96a94ef ]
    
    ECN signals currently forces TCP to enter quickack mode for
    up to 16 (TCP_MAX_QUICKACKS) following incoming packets.
    
    We believe this is not needed, and only sending one immediate ack
    for the current packet should be enough.
    
    This should reduce the extra load noticed in DCTCP environments,
    after congestion events.
    
    This is part 2 of our effort to reduce pure ACK packets.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
    Acked-by: Yuchung Cheng <ycheng@google.com>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c4af434936605e294485f220d0f92e956ccbd58d
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon May 21 15:08:56 2018 -0700

    tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
    
    [ Upstream commit 9a9c9b51e54618861420093ae6e9b50a961914c5 ]
    
    We want to add finer control of the number of ACK packets sent after
    ECN events.
    
    This patch is not changing current behavior, it only enables following
    change.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit de0e6404535a0455d4d0c81ebf98c9ea2599ccab
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu May 17 14:47:25 2018 -0700

    tcp: do not force quickack when receiving out-of-order packets
    
    [ Upstream commit a3893637e1eb0ef5eb1bbc52b3a8d2dfa317a35d ]
    
    As explained in commit 9f9843a751d0 ("tcp: properly handle stretch
    acks in slow start"), TCP stacks have to consider how many packets
    are acknowledged in one single ACK, because of GRO, but also
    because of ACK compression or losses.
    
    We plan to add SACK compression in the following patch, we
    must therefore not call tcp_enter_quickack_mode()
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fb062d5267ecdf55d8e7bc4765aa3f6b9e7388b7
Author: Xiao Liang <xiliang@redhat.com>
Date:   Fri Jul 27 17:56:08 2018 +0800

    xen-netfront: wait xenbus state change when load module manually
    
    [ Upstream commit 822fb18a82abaf4ee7058793d95d340f5dab7bfc ]
    
    When loading module manually, after call xenbus_switch_state to initializes
    the state of the netfront device, the driver state did not change so fast
    that may lead no dev created in latest kernel. This patch adds wait to make
    sure xenbus knows the driver is not in closed/unknown state.
    
    Current state:
    [vm]# ethtool eth0
    Settings for eth0:
            Link detected: yes
    [vm]# modprobe -r xen_netfront
    [vm]# modprobe  xen_netfront
    [vm]# ethtool eth0
    Settings for eth0:
    Cannot get device settings: No such device
    Cannot get wake-on-lan settings: No such device
    Cannot get message level: No such device
    Cannot get link status: No such device
    No data available
    
    With the patch installed.
    [vm]# ethtool eth0
    Settings for eth0:
            Link detected: yes
    [vm]# modprobe -r xen_netfront
    [vm]# modprobe xen_netfront
    [vm]# ethtool eth0
    Settings for eth0:
            Link detected: yes
    
    Signed-off-by: Xiao Liang <xiliang@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 30a1af4f5ab1d457afade268298f9f9f3943a2dc
Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Date:   Thu Jul 26 15:05:37 2018 +0300

    NET: stmmac: align DMA stuff to largest cache line length
    
    [ Upstream commit 9939a46d90c6c76f4533d534dbadfa7b39dc6acc ]
    
    As for today STMMAC_ALIGN macro (which is used to align DMA stuff)
    relies on L1 line length (L1_CACHE_BYTES).
    This isn't correct in case of system with several cache levels
    which might have L1 cache line length smaller than L2 line. This
    can lead to sharing one cache line between DMA buffer and other
    data, so we can lose this data while invalidate DMA buffer before
    DMA transaction.
    
    Fix that by using SMP_CACHE_BYTES instead of L1_CACHE_BYTES for
    aligning.
    
    Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2474de0a61ad4c3756dd6b834807d929215eb899
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Jul 29 12:44:46 2018 -0700

    squashfs: be more careful about metadata corruption
    
    commit 01cfb7937a9af2abb1136c7e89fbf3fd92952956 upstream.
    
    Anatoly Trosinenko reports that a corrupted squashfs image can cause a
    kernel oops.  It turns out that squashfs can end up being confused about
    negative fragment lengths.
    
    The regular squashfs_read_data() does check for negative lengths, but
    squashfs_read_metadata() did not, and the fragment size code just
    blindly trusted the on-disk value.  Fix both the fragment parsing and
    the metadata reading code.
    
    Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Phillip Lougher <phillip@squashfs.org.uk>
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 84b819b34c0474994f8124fe6d4b86dec50f56eb
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Sat Jul 14 23:55:57 2018 -0400

    random: mix rdrand with entropy sent in from userspace
    
    commit 81e69df38e2911b642ec121dec319fad2a4782f3 upstream.
    
    Fedora has integrated the jitter entropy daemon to work around slow
    boot problems, especially on VM's that don't support virtio-rng:
    
        https://bugzilla.redhat.com/show_bug.cgi?id=1572944
    
    It's understandable why they did this, but the Jitter entropy daemon
    works fundamentally on the principle: "the CPU microarchitecture is
    **so** complicated and we can't figure it out, so it *must* be
    random".  Yes, it uses statistical tests to "prove" it is secure, but
    AES_ENCRYPT(NSA_KEY, COUNTER++) will also pass statistical tests with
    flying colors.
    
    So if RDRAND is available, mix it into entropy submitted from
    userspace.  It can't hurt, and if you believe the NSA has backdoored
    RDRAND, then they probably have enough details about the Intel
    microarchitecture that they can reverse engineer how the Jitter
    entropy daemon affects the microarchitecture, and attack its output
    stream.  And if RDRAND is in fact an honest DRNG, it will immeasurably
    improve on what the Jitter entropy daemon might produce.
    
    This also provides some protection against someone who is able to read
    or set the entropy seed file.
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@vger.kernel.org
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c2663418fae42a6f13917bd91f67d5d1d3e650a
Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date:   Fri Apr 6 07:54:51 2018 -0400

    media: si470x: fix __be16 annotations
    
    [ Upstream commit 90db5c829692a0a7845e977e45719b4699216bd4 ]
    
    The annotations there are wrong as warned:
       drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:129:24: warning: incorrect type in assignment (different base types)
       drivers/media/radio/si470x/radio-si470x-i2c.c:129:24:    expected unsigned short [unsigned] [short] <noident>
       drivers/media/radio/si470x/radio-si470x-i2c.c:129:24:    got restricted __be16 [usertype] <noident>
       drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16
       drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c567f08fdbe1750294cbf3d45d883777c3e1155
Author: Suman Anna <s-anna@ti.com>
Date:   Wed Mar 14 11:41:36 2018 -0400

    media: omap3isp: fix unbalanced dma_iommu_mapping
    
    [ Upstream commit b7e1e6859fbf60519fd82d7120cee106a6019512 ]
    
    The OMAP3 ISP driver manages its MMU mappings through the IOMMU-aware
    ARM DMA backend. The current code creates a dma_iommu_mapping and
    attaches this to the ISP device, but never detaches the mapping in
    either the probe failure paths or the driver remove path resulting
    in an unbalanced mapping refcount and a memory leak. Fix this properly.
    
    Reported-by: Pavel Machek <pavel@ucw.cz>
    Signed-off-by: Suman Anna <s-anna@ti.com>
    Tested-by: Pavel Machek <pavel@ucw.cz>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 75a89c2ada6f42ec30e093f6c97e003600c074ab
Author: Tudor-Dan Ambarus <tudor.ambarus@microchip.com>
Date:   Tue Apr 3 09:39:00 2018 +0300

    crypto: authenc - don't leak pointers to authenc keys
    
    [ Upstream commit ad2fdcdf75d169e7a5aec6c7cb421c0bec8ec711 ]
    
    In crypto_authenc_setkey we save pointers to the authenc keys in
    a local variable of type struct crypto_authenc_keys and we don't
    zeroize it after use. Fix this and don't leak pointers to the
    authenc keys.
    
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit da49259e29bc6b44acee52a9d93f89432bb893fd
Author: Tudor-Dan Ambarus <tudor.ambarus@microchip.com>
Date:   Tue Apr 3 09:39:01 2018 +0300

    crypto: authencesn - don't leak pointers to authenc keys
    
    [ Upstream commit 31545df391d58a3bb60e29b1192644a6f2b5a8dd ]
    
    In crypto_authenc_esn_setkey we save pointers to the authenc keys
    in a local variable of type struct crypto_authenc_keys and we don't
    zeroize it after use. Fix this and don't leak pointers to the
    authenc keys.
    
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1b2c23459c3335ee9e0dd2cd2e2856d0201852e5
Author: Dominik Bozek <dominikx.bozek@intel.com>
Date:   Fri Apr 13 10:42:31 2018 -0700

    usb: hub: Don't wait for connect state at resume for powered-off ports
    
    [ Upstream commit 5d111f5190848d6fb1c414dc57797efea3526a2f ]
    
    wait_for_connected() wait till a port change status to
    USB_PORT_STAT_CONNECTION, but this is not possible if
    the port is unpowered. The loop will only exit at timeout.
    
    Such case take place if an over-current incident happen
    while system is in S3. Then during resume wait_for_connected()
    will wait 2s, which may be noticeable by the user.
    
    Signed-off-by: Dominik Bozek <dominikx.bozek@intel.com>
    Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1813d388889169d63c9d1a75ca608d63a7c230cb
Author: Michal Simek <michal.simek@xilinx.com>
Date:   Tue Apr 10 15:05:42 2018 +0200

    microblaze: Fix simpleImage format generation
    
    [ Upstream commit ece97f3a5fb50cf5f98886fbc63c9665f2bb199d ]
    
    simpleImage generation was broken for some time. This patch is fixing
    steps how simpleImage.*.ub file is generated. Steps are objdump of
    vmlinux and create .ub.
    Also make sure that there is striped elf version with .strip suffix.
    
    Signed-off-by: Michal Simek <michal.simek@xilinx.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d882e521074e1b7c8e22bcf21376fae5de58d82e
Author: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Date:   Wed Apr 11 12:13:32 2018 +0530

    rsi: Fix 'invalid vdd' warning in mmc
    
    [ Upstream commit 78e450719c702784e42af6da912d3692fd3da0cb ]
    
    While performing cleanup, driver is messing with card->ocr
    value by not masking rocr against ocr_avail. Below panic
    is observed with some of the SDIO host controllers due to
    this. Issue is resolved by reverting incorrect modifications
    to vdd.
    
    [  927.423821] mmc1: Invalid vdd 0x1f
    [  927.423925] Modules linked in: rsi_sdio(+) cmac bnep arc4 rsi_91x
                   mac80211 cfg80211 btrsi rfcomm bluetooth ecdh_generic
    [  927.424073] CPU: 0 PID: 1624 Comm: insmod Tainted: G         W        4.15.0-1000-caracalla #1
    [  927.424075] Hardware name: Dell Inc. Edge Gateway    3003/      , BIOS 01.00.06 01/22/2018
    [  927.424082] RIP: 0010:sdhci_set_power_noreg+0xdd/0x190[sdhci]
    [  927.424085] RSP: 0018:ffffac3fc064b930 EFLAGS:  00010282
    [  927.424107] Call Trace:
    [  927.424118]  sdhci_set_power+0x5a/0x60 [sdhci]
    [  927.424125]  sdhci_set_ios+0x360/0x3b0 [sdhci]
    [  927.424133]  mmc_set_initial_state+0x92/0x120
    [  927.424137]  mmc_power_up.part.34+0x33/0x1d0
    [  927.424141]  mmc_power_up+0x17/0x20
    [  927.424147]  mmc_sdio_runtime_resume+0x2d/0x50
    [  927.424151]  mmc_runtime_resume+0x17/0x20
    [  927.424156]  __rpm_callback+0xc4/0x200
    [  927.424161]  ? idr_alloc_cyclic+0x57/0xd0
    [  927.424165]  ? mmc_runtime_suspend+0x20/0x20
    [  927.424169]  rpm_callback+0x24/0x80
    [  927.424172]  ? mmc_runtime_suspend+0x20/0x20
    [  927.424176]  rpm_resume+0x4b3/0x6c0
    [  927.424181]  __pm_runtime_resume+0x4e/0x80
    [  927.424188]  driver_probe_device+0x41/0x490
    [  927.424192]  __driver_attach+0xdf/0xf0
    [  927.424196]  ? driver_probe_device+0x490/0x490
    [  927.424201]  bus_for_each_dev+0x6c/0xc0
    [  927.424205]  driver_attach+0x1e/0x20
    [  927.424209]  bus_add_driver+0x1f4/0x270
    [  927.424217]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
    [  927.424221]  driver_register+0x60/0xe0
    [  927.424227]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
    [  927.424231]  sdio_register_driver+0x20/0x30
    [  927.424237]  rsi_module_init+0x16/0x40 [rsi_sdio]
    
    Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
    Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d06c846db135bbe3f7ddf65759f2387626a66596
Author: Chris Novakovic <chris@chrisn.me.uk>
Date:   Tue Apr 24 03:56:37 2018 +0100

    ipconfig: Correctly initialise ic_nameservers
    
    [ Upstream commit 300eec7c0a2495f771709c7642aa15f7cc148b83 ]
    
    ic_nameservers, which stores the list of name servers discovered by
    ipconfig, is initialised (i.e. has all of its elements set to NONE, or
    0xffffffff) by ic_nameservers_predef() in the following scenarios:
    
     - before the "ip=" and "nfsaddrs=" kernel command line parameters are
       parsed (in ip_auto_config_setup());
     - before autoconfiguring via DHCP or BOOTP (in ic_bootp_init()), in
       order to clear any values that may have been set after parsing "ip="
       or "nfsaddrs=" and are no longer needed.
    
    This means that ic_nameservers_predef() is not called when neither "ip="
    nor "nfsaddrs=" is specified on the kernel command line. In this
    scenario, every element in ic_nameservers remains set to 0x00000000,
    which is indistinguishable from ANY and causes pnp_seq_show() to write
    the following (bogus) information to /proc/net/pnp:
    
      #MANUAL
      nameserver 0.0.0.0
      nameserver 0.0.0.0
      nameserver 0.0.0.0
    
    This is potentially problematic for systems that blindly link
    /etc/resolv.conf to /proc/net/pnp.
    
    Ensure that ic_nameservers is also initialised when neither "ip=" nor
    "nfsaddrs=" are specified by calling ic_nameservers_predef() in
    ip_auto_config(), but only when ip_auto_config_setup() was not called
    earlier. This causes the following to be written to /proc/net/pnp, and
    is consistent with what gets written when ipconfig is configured
    manually but no name servers are specified on the kernel command line:
    
      #MANUAL
    
    Signed-off-by: Chris Novakovic <chris@chrisn.me.uk>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3944d0e0307f03ad114d217193214971bc610776
Author: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Date:   Tue Apr 24 15:14:57 2018 +0200

    drm/gma500: fix psb_intel_lvds_mode_valid()'s return type
    
    [ Upstream commit 2ea009095c6e7396915a1d0dd480c41f02985f79 ]
    
    The method struct drm_connector_helper_funcs::mode_valid is defined
    as returning an 'enum drm_mode_status' but the driver implementation
    for this method, psb_intel_lvds_mode_valid(), uses an 'int' for it.
    
    Fix this by using 'enum drm_mode_status' for psb_intel_lvds_mode_valid().
    
    Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180424131458.2060-1-luc.vanoostenryck@gmail.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf35cb47cc9265a482410b492ba9646aea408e8c
Author: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Date:   Wed May 2 22:48:16 2018 +0900

    ALSA: hda/ca0132: fix build failure when a local macro is defined
    
    [ Upstream commit 8e142e9e628975b0dddd05cf1b095331dff6e2de ]
    
    DECLARE_TLV_DB_SCALE (alias of SNDRV_CTL_TLVD_DECLARE_DB_SCALE) is used but
    tlv.h is not included. This causes build failure when local macro is
    defined by comment-out.
    
    This commit fixes the bug. At the same time, the alias macro is replaced
    with a destination macro added at a commit 46e860f76804 ("ALSA: rename
    TLV-related macros so that they're friendly to user applications")
    
    Reported-by: Connor McAdams <conmanx360@gmail.com>
    Fixes: 44f0c9782cc6 ('ALSA: hda/ca0132: Add tuning controls')
    Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 44daa6a4435a4a9ee456a8e99a8cd2acd70469eb
Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date:   Fri Apr 20 08:32:16 2018 -0400

    media: siano: get rid of __le32/__le16 cast warnings
    
    [ Upstream commit e1b7f11b37def5f3021c06e8c2b4953e099357aa ]
    
    Those are all false-positives that appear with smatch when building for
    arm:
    
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32
      drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
      drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
    
    Get rid of them by adding explicit forced casts.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59b3c7d45af4dcf47213af559bc914b898573071
Author: Jakub Kicinski <jakub.kicinski@netronome.com>
Date:   Thu May 3 18:37:17 2018 -0700

    bpf: fix references to free_bpf_prog_info() in comments
    
    [ Upstream commit ab7f5bf0928be2f148d000a6eaa6c0a36e74750e ]
    
    Comments in the verifier refer to free_bpf_prog_info() which
    seems to have never existed in tree.  Replace it with
    free_used_maps().
    
    Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
    Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac64c4d046cfbb59e7830f1a615d6a0286cb3abf
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu May 3 13:54:32 2018 +0300

    scsi: megaraid: silence a static checker bug
    
    [ Upstream commit 27e833dabab74ee665e487e291c9afc6d71effba ]
    
    If we had more than 32 megaraid cards then it would cause memory
    corruption.  That's not likely, of course, but it's handy to enforce it
    and make the static checker happy.
    
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 120f719ade096921502045cab895914f9a3c02c8
Author: Wenwen Wang <wang6495@umn.edu>
Date:   Mon May 7 19:54:01 2018 -0500

    scsi: 3w-xxxx: fix a missing-check bug
    
    [ Upstream commit 9899e4d3523faaef17c67141aa80ff2088f17871 ]
    
    In tw_chrdev_ioctl(), the length of the data buffer is firstly copied
    from the userspace pointer 'argp' and saved to the kernel object
    'data_buffer_length'. Then a security check is performed on it to make
    sure that the length is not more than 'TW_MAX_IOCTL_SECTORS *
    512'. Otherwise, an error code -EINVAL is returned. If the security
    check is passed, the entire ioctl command is copied again from the
    'argp' pointer and saved to the kernel object 'tw_ioctl'. Then, various
    operations are performed on 'tw_ioctl' according to the 'cmd'. Given
    that the 'argp' pointer resides in userspace, a malicious userspace
    process can race to change the buffer length between the two
    copies. This way, the user can bypass the security check and inject
    invalid data buffer length. This can cause potential security issues in
    the following execution.
    
    This patch checks for capable(CAP_SYS_ADMIN) in tw_chrdev_open() to
    avoid the above issues.
    
    Signed-off-by: Wenwen Wang <wang6495@umn.edu>
    Acked-by: Adam Radford <aradford@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02b36483d5a368badd5876472f310e0b6d96b504
Author: Wenwen Wang <wang6495@umn.edu>
Date:   Mon May 7 19:46:43 2018 -0500

    scsi: 3w-9xxx: fix a missing-check bug
    
    [ Upstream commit c9318a3e0218bc9dacc25be46b9eec363259536f ]
    
    In twa_chrdev_ioctl(), the ioctl driver command is firstly copied from
    the userspace pointer 'argp' and saved to the kernel object
    'driver_command'.  Then a security check is performed on the data buffer
    size indicated by 'driver_command', which is
    'driver_command.buffer_length'. If the security check is passed, the
    entire ioctl command is copied again from the 'argp' pointer and saved
    to the kernel object 'tw_ioctl'. Then, various operations are performed
    on 'tw_ioctl' according to the 'cmd'. Given that the 'argp' pointer
    resides in userspace, a malicious userspace process can race to change
    the buffer size between the two copies. This way, the user can bypass
    the security check and inject invalid data buffer size. This can cause
    potential security issues in the following execution.
    
    This patch checks for capable(CAP_SYS_ADMIN) in twa_chrdev_open()t o
    avoid the above issues.
    
    Signed-off-by: Wenwen Wang <wang6495@umn.edu>
    Acked-by: Adam Radford <aradford@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 745255bd21c47468a70471c378080fcfded0b11c
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Tue May 8 07:53:39 2018 +0200

    perf: fix invalid bit in diagnostic entry
    
    [ Upstream commit 3c0a83b14ea71fef5ccc93a3bd2de5f892be3194 ]
    
    The s390 CPU measurement facility sampling mode supports basic entries
    and diagnostic entries. Each entry has a valid bit to indicate the
    status of the entry as valid or invalid.
    
    This bit is bit 31 in the diagnostic entry, but the bit mask definition
    refers to bit 30.
    
    Fix this by making the reserved field one bit larger.
    
    Fixes: 7e75fc3ff4cf ("s390/cpum_sf: Add raw data sampling to support the diagnostic-sampling function")
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bdd9b84854b65deca5e5bce02f57fecbe7b5ed49
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Tue May 8 10:18:39 2018 +0200

    s390/cpum_sf: Add data entry sizes to sampling trailer entry
    
    [ Upstream commit 77715b7ddb446bd39a06f3376e85f4bb95b29bb8 ]
    
    The CPU Measurement sampling facility creates a trailer entry for each
    Sample-Data-Block of stored samples. The trailer entry contains the sizes
    (in bytes) of the stored sampling types:
     - basic-sampling data entry size
     - diagnostic-sampling data entry size
    Both sizes are 2 bytes long.
    
    This patch changes the trailer entry definition to reflect this.
    
    Fixes: fcc77f507333 ("s390/cpum_sf: Atomically reset trailer entry fields of sample-data-blocks")
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cd181d859be102b85909af2e403ea0a68b17d090
Author: Brad Love <brad@nextdimension.cc>
Date:   Fri May 4 17:53:35 2018 -0400

    media: saa7164: Fix driver name in debug output
    
    [ Upstream commit 0cc4655cb57af0b7e105d075c4f83f8046efafe7 ]
    
    This issue was reported by a user who downloaded a corrupt saa7164
    firmware, then went looking for a valid xc5000 firmware to fix the
    error displayed...but the device in question has no xc5000, thus after
    much effort, the wild goose chase eventually led to a support call.
    
    The xc5000 has nothing to do with saa7164 (as far as I can tell),
    so replace the string with saa7164 as well as give a meaningful
    hint on the firmware mismatch.
    
    Signed-off-by: Brad Love <brad@nextdimension.cc>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 95d6785b9a61f2db8608e054118132a7f81affef
Author: Damien Le Moal <damien.lemoal@wdc.com>
Date:   Wed May 9 09:28:12 2018 +0900

    libata: Fix command retry decision
    
    [ Upstream commit 804689ad2d9b66d0d3920b48cf05881049d44589 ]
    
    For failed commands with valid sense data (e.g. NCQ commands),
    scsi_check_sense() is used in ata_analyze_tf() to determine if the
    command can be retried. In such case, rely on this decision and ignore
    the command error mask based decision done in ata_worth_retry().
    
    This fixes useless retries of commands such as unaligned writes on zoned
    disks (TYPE_ZAC).
    
    Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d9cd12792270773fab9e5a129daff328d61ef9e
Author: DaeRyong Jeong <threeearcat@gmail.com>
Date:   Tue May 1 00:27:04 2018 +0900

    tty: Fix data race in tty_insert_flip_string_fixed_flag
    
    [ Upstream commit b6da31b2c07c46f2dcad1d86caa835227a16d9ff ]
    
    Unlike normal serials, in pty layer, there is no guarantee that multiple
    threads don't insert input characters at the same time. If it is happened,
    tty_insert_flip_string_fixed_flag can be executed concurrently. This can
    lead slab out-of-bounds write in tty_insert_flip_string_fixed_flag.
    
    Call sequences are as follows.
    CPU0                                    CPU1
    n_tty_ioctl_helper                      n_tty_ioctl_helper
    __start_tty                             tty_send_xchar
    tty_wakeup                              pty_write
    n_hdlc_tty_wakeup                       tty_insert_flip_string
    n_hdlc_send_frames                      tty_insert_flip_string_fixed_flag
    pty_write
    tty_insert_flip_string
    tty_insert_flip_string_fixed_flag
    
    To fix the race, acquire port->lock in pty_write() before it inserts input
    characters to tty buffer. It prevents multiple threads from inserting
    input characters concurrently.
    
    The crash log is as follows:
    BUG: KASAN: slab-out-of-bounds in tty_insert_flip_string_fixed_flag+0xb5/
    0x130 drivers/tty/tty_buffer.c:316 at addr ffff880114fcc121
    Write of size 1792 by task syz-executor0/30017
    CPU: 1 PID: 30017 Comm: syz-executor0 Not tainted 4.8.0 #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
     0000000000000000 ffff88011638f888 ffffffff81694cc3 ffff88007d802140
     ffff880114fcb300 ffff880114fcc300 ffff880114fcb300 ffff88011638f8b0
     ffffffff8130075c ffff88011638f940 ffff88007d802140 ffff880194fcc121
    Call Trace:
     __dump_stack lib/dump_stack.c:15 [inline]
     dump_stack+0xb3/0x110 lib/dump_stack.c:51
     kasan_object_err+0x1c/0x70 mm/kasan/report.c:156
     print_address_description mm/kasan/report.c:194 [inline]
     kasan_report_error+0x1f7/0x4e0 mm/kasan/report.c:283
     kasan_report+0x36/0x40 mm/kasan/report.c:303
     check_memory_region_inline mm/kasan/kasan.c:292 [inline]
     check_memory_region+0x13e/0x1a0 mm/kasan/kasan.c:299
     memcpy+0x37/0x50 mm/kasan/kasan.c:335
     tty_insert_flip_string_fixed_flag+0xb5/0x130 drivers/tty/tty_buffer.c:316
     tty_insert_flip_string include/linux/tty_flip.h:35 [inline]
     pty_write+0x7f/0xc0 drivers/tty/pty.c:115
     n_hdlc_send_frames+0x1d4/0x3b0 drivers/tty/n_hdlc.c:419
     n_hdlc_tty_wakeup+0x73/0xa0 drivers/tty/n_hdlc.c:496
     tty_wakeup+0x92/0xb0 drivers/tty/tty_io.c:601
     __start_tty.part.26+0x66/0x70 drivers/tty/tty_io.c:1018
     __start_tty+0x34/0x40 drivers/tty/tty_io.c:1013
     n_tty_ioctl_helper+0x146/0x1e0 drivers/tty/tty_ioctl.c:1138
     n_hdlc_tty_ioctl+0xb3/0x2b0 drivers/tty/n_hdlc.c:794
     tty_ioctl+0xa85/0x16d0 drivers/tty/tty_io.c:2992
     vfs_ioctl fs/ioctl.c:43 [inline]
     do_vfs_ioctl+0x13e/0xba0 fs/ioctl.c:679
     SYSC_ioctl fs/ioctl.c:694 [inline]
     SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
     entry_SYSCALL_64_fastpath+0x1f/0xbd
    
    Signed-off-by: DaeRyong Jeong <threeearcat@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ad4d00d20c69c9f3a39edfde22b279810aaf3c8c
Author: Dmitry Torokhov <dtor@chromium.org>
Date:   Wed May 9 12:12:15 2018 -0700

    HID: i2c-hid: check if device is there before really probing
    
    [ Upstream commit b3a81b6c4fc6730ac49e20d789a93c0faabafc98 ]
    
    On many Chromebooks touch devices are multi-sourced; the components are
    electrically compatible and one can be freely swapped for another without
    changing the OS image or firmware.
    
    To avoid bunch of scary messages when device is not actually present in the
    system let's try testing basic communication with it and if there is no
    response terminate probe early with -ENXIO.
    
    Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
    Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a9b0f0830e384f699644465912ad36657f34e0b
Author: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Date:   Thu May 10 23:59:19 2018 +0200

    powerpc/embedded6xx/hlwd-pic: Prevent interrupts from being handled by Starlet
    
    [ Upstream commit 9dcb3df4281876731e4e8bff7940514d72375154 ]
    
    The interrupt controller inside the Wii's Hollywood chip is connected to
    two masters, the "Broadway" PowerPC and the "Starlet" ARM926, each with
    their own interrupt status and mask registers.
    
    When booting the Wii with mini[1], interrupts from the SD card
    controller (IRQ 7) are handled by the ARM, because mini provides SD
    access over IPC. Linux however can't currently use or disable this IPC
    service, so both sides try to handle IRQ 7 without coordination.
    
    Let's instead make sure that all interrupts that are unmasked on the PPC
    side are masked on the ARM side; this will also make sure that Linux can
    properly talk to the SD card controller (and potentially other devices).
    
    If access to a device through IPC is desired in the future, interrupts
    from that device should not be handled by Linux directly.
    
    [1]: https://github.com/lewurm/mini
    
    Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c70d92d28f5537ae15464781a5fdb13f329458f6
Author: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Date:   Tue Apr 24 15:15:13 2018 +0200

    drm/radeon: fix mode_valid's return type
    
    [ Upstream commit 7a47f20eb1fb8fa8d7a8fe3a4fd8c721f04c2174 ]
    
    The method struct drm_connector_helper_funcs::mode_valid is defined
    as returning an 'enum drm_mode_status' but the driver implementation
    for this method uses an 'int' for it.
    
    Fix this by using 'enum drm_mode_status' in the driver too.
    
    Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ee7b57a2099fcde6cef65c6086acf3e42e400be0
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed May 16 20:07:18 2018 +0200

    ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
    
    [ Upstream commit 377a879d9832f4ba69bd6a1fc996bb4181b1e504 ]
    
    retire_capture_urb() may print warning messages when the given URB
    doesn't align, and this may flood the system log easily.
    Put the rate limit to the message for avoiding it.
    
    Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1093485
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 55d1f04913219fc98e6cc2a02aa29ac6eed718cc
Author: Colin Ian King <colin.king@canonical.com>
Date:   Wed Apr 25 11:04:21 2018 -0400

    media: smiapp: fix timeout checking in smiapp_read_nvm
    
    [ Upstream commit 7a2148dfda8001c983f0effd9afd8a7fa58e99c4 ]
    
    The current code decrements the timeout counter i and the end of
    each loop i is incremented, so the check for timeout will always
    be false and hence the timeout mechanism is just a dead code path.
    Potentially, if the RD_READY bit is not set, we could end up in
    an infinite loop.
    
    Fix this so the timeout starts from 1000 and decrements to zero,
    if at the end of the loop i is zero we have a timeout condition.
    
    Detected by CoverityScan, CID#1324008 ("Logically dead code")
    
    Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver")
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 85733056dbf8a32e1af4fc47e17882fd10f20dfe
Author: Yufen Yu <yuyufen@huawei.com>
Date:   Fri May 4 18:08:10 2018 +0800

    md: fix NULL dereference of mddev->pers in remove_and_add_spares()
    
    [ Upstream commit c42a0e2675721e1444f56e6132a07b7b1ec169ac ]
    
    We met NULL pointer BUG as follow:
    
    [  151.760358] BUG: unable to handle kernel NULL pointer dereference at 0000000000000060
    [  151.761340] PGD 80000001011eb067 P4D 80000001011eb067 PUD 1011ea067 PMD 0
    [  151.762039] Oops: 0000 [#1] SMP PTI
    [  151.762406] Modules linked in:
    [  151.762723] CPU: 2 PID: 3561 Comm: mdadm-test Kdump: loaded Not tainted 4.17.0-rc1+ #238
    [  151.763542] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014
    [  151.764432] RIP: 0010:remove_and_add_spares.part.56+0x13c/0x3a0
    [  151.765061] RSP: 0018:ffffc90001d7fcd8 EFLAGS: 00010246
    [  151.765590] RAX: 0000000000000000 RBX: ffff88013601d600 RCX: 0000000000000000
    [  151.766306] RDX: 0000000000000000 RSI: ffff88013601d600 RDI: ffff880136187000
    [  151.767014] RBP: ffff880136187018 R08: 0000000000000003 R09: 0000000000000051
    [  151.767728] R10: ffffc90001d7fed8 R11: 0000000000000000 R12: ffff88013601d600
    [  151.768447] R13: ffff8801298b1300 R14: ffff880136187000 R15: 0000000000000000
    [  151.769160] FS:  00007f2624276700(0000) GS:ffff88013ae80000(0000) knlGS:0000000000000000
    [  151.769971] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  151.770554] CR2: 0000000000000060 CR3: 0000000111aac000 CR4: 00000000000006e0
    [  151.771272] Call Trace:
    [  151.771542]  md_ioctl+0x1df2/0x1e10
    [  151.771906]  ? __switch_to+0x129/0x440
    [  151.772295]  ? __schedule+0x244/0x850
    [  151.772672]  blkdev_ioctl+0x4bd/0x970
    [  151.773048]  block_ioctl+0x39/0x40
    [  151.773402]  do_vfs_ioctl+0xa4/0x610
    [  151.773770]  ? dput.part.23+0x87/0x100
    [  151.774151]  ksys_ioctl+0x70/0x80
    [  151.774493]  __x64_sys_ioctl+0x16/0x20
    [  151.774877]  do_syscall_64+0x5b/0x180
    [  151.775258]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    For raid6, when two disk of the array are offline, two spare disks can
    be added into the array. Before spare disks recovery completing,
    system reboot and mdadm thinks it is ok to restart the degraded
    array by md_ioctl(). Since disks in raid6 is not only_parity(),
    raid5_run() will abort, when there is no PPL feature or not setting
    'start_dirty_degraded' parameter. Therefore, mddev->pers is NULL.
    
    But, mddev->raid_disks has been set and it will not be cleared when
    raid5_run abort. md_ioctl() can execute cmd 'HOT_REMOVE_DISK' to
    remove a disk by mdadm, which will cause NULL pointer dereference
    in remove_and_add_spares() finally.
    
    Signed-off-by: Yufen Yu <yuyufen@huawei.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac34de0dff6a408595bf34c1b1f8be37681ce682
Author: Anson Huang <Anson.Huang@nxp.com>
Date:   Thu May 17 15:27:22 2018 +0800

    regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops
    
    [ Upstream commit 0b01fd3d40fe6402e5fa3b491ef23109feb1aaa5 ]
    
    If is_enabled() is not defined, regulator core will assume
    this regulator is already enabled, then it can NOT be really
    enabled after disabled.
    
    Based on Li Jun's patch from the NXP kernel tree.
    
    Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ee9460d400aca613555368532dd304d49fd7764b
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu May 17 20:02:23 2018 +0200

    ALSA: emu10k1: Rate-limit error messages about page errors
    
    [ Upstream commit 11d42c81036324697d367600bfc16f6dd37636fd ]
    
    The error messages at sanity checks of memory pages tend to repeat too
    many times once when it hits, and without the rate limit, it may flood
    and become unreadable.  Replace such messages with the *_ratelimited()
    variant.
    
    Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=1093027
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c656aaac05092baa90e4fd37fc4bbe684c2d40d1
Author: Maya Erez <merez@codeaurora.org>
Date:   Thu May 3 16:37:16 2018 +0530

    scsi: ufs: fix exception event handling
    
    [ Upstream commit 2e3611e9546c2ed4def152a51dfd34e8dddae7a5 ]
    
    The device can set the exception event bit in one of the response UPIU,
    for example to notify the need for urgent BKOPs operation.  In such a
    case, the host driver calls ufshcd_exception_event_handler to handle
    this notification.  When trying to check the exception event status (for
    finding the cause for the exception event), the device may be busy with
    additional SCSI commands handling and may not respond within the 100ms
    timeout.
    
    To prevent that, we need to block SCSI commands during handling of
    exception events and allow retransmissions of the query requests, in
    case of timeout.
    
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    Signed-off-by: Maya Erez <merez@codeaurora.org>
    Signed-off-by: Can Guo <cang@codeaurora.org>
    Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
    Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6af19d06df562a5393e8d5a2c6d5b7739caf313e
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Wed May 23 17:19:22 2018 -0500

    PCI: pciehp: Request control of native hotplug only if supported
    
    [ Upstream commit 408fec36a1ab3d14273c2116b449ef1e9be3cb8b ]
    
    Currently we request control of native PCIe hotplug unconditionally.
    Native PCIe hotplug events are handled by the pciehp driver, and if it is
    not enabled those events will be lost.
    
    Request control of native PCIe hotplug only if the pciehp driver is
    enabled, so we will actually handle native PCIe hotplug events.
    
    Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 723139e8e04ece9b299379db50e3b598d10177a1
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Thu May 24 11:02:06 2018 +0000

    powerpc/8xx: fix invalid register expression in head_8xx.S
    
    [ Upstream commit e4ccb1dae6bdef228d729c076c38161ef6e7ca34 ]
    
    New binutils generate the following warning
    
      AS      arch/powerpc/kernel/head_8xx.o
    arch/powerpc/kernel/head_8xx.S: Assembler messages:
    arch/powerpc/kernel/head_8xx.S:916: Warning: invalid register expression
    
    This patch fixes it.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9261dfa009fcf768057b68484afb9a48e624632c
Author: Mathieu Malaterre <malat@debian.org>
Date:   Wed Apr 4 22:07:46 2018 +0200

    powerpc/powermac: Mark variable x as unused
    
    [ Upstream commit 5a4b475cf8511da721f20ba432c244061db7139f ]
    
    Since the value of x is never intended to be read, declare it with gcc
    attribute as unused. Fix warning treated as error with W=1:
    
      arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable]
    
    Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 12a9b5fc3130284c3fa667f577858ef4a5ba647e
Author: Mathieu Malaterre <malat@debian.org>
Date:   Wed Apr 4 22:13:05 2018 +0200

    powerpc/powermac: Add missing prototype for note_bootable_part()
    
    [ Upstream commit f72cf3f1d49f2c35d6cb682af2e8c93550f264e4 ]
    
    Add a missing prototype for function `note_bootable_part` to silence a
    warning treated as error with W=1:
    
      arch/powerpc/platforms/powermac/setup.c:361:12: error: no previous prototype for ‘note_bootable_part’ [-Werror=missing-prototypes]
    
    Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d5f93d2f252c9d3e69fdac3ded39cd8c112acfe
Author: Mathieu Malaterre <malat@debian.org>
Date:   Thu Mar 22 21:19:56 2018 +0100

    powerpc/chrp/time: Make some functions static, add missing header include
    
    [ Upstream commit b87a358b4a1421abd544c0b554b1b7159b2b36c0 ]
    
    Add a missing include <platforms/chrp/chrp.h>.
    
    These functions can all be static, make it so. Fix warnings treated as
    errors with W=1:
    
      arch/powerpc/platforms/chrp/time.c:41:13: error: no previous prototype for ‘chrp_time_init’ [-Werror=missing-prototypes]
      arch/powerpc/platforms/chrp/time.c:66:5: error: no previous prototype for ‘chrp_cmos_clock_read’ [-Werror=missing-prototypes]
      arch/powerpc/platforms/chrp/time.c:74:6: error: no previous prototype for ‘chrp_cmos_clock_write’ [-Werror=missing-prototypes]
      arch/powerpc/platforms/chrp/time.c:86:5: error: no previous prototype for ‘chrp_set_rtc_time’ [-Werror=missing-prototypes]
      arch/powerpc/platforms/chrp/time.c:130:6: error: no previous prototype for ‘chrp_get_rtc_time’ [-Werror=missing-prototypes]
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a4b3eaf0bb6f753e10ab7b19acb77844a8b4b78c
Author: Mathieu Malaterre <malat@debian.org>
Date:   Thu Mar 22 21:20:03 2018 +0100

    powerpc/32: Add a missing include header
    
    [ Upstream commit c89ca593220931c150cffda24b4d4ccf82f13fc8 ]
    
    The header file <linux/syscalls.h> was missing from the includes. Fix the
    following warning, treated as error with W=1:
    
      arch/powerpc/kernel/pci_32.c:286:6: error: no previous prototype for ‘sys_pciconfig_iobase’ [-Werror=missing-prototypes]
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 84e90658ed8d5dbc8701d76b491206208cbeb86b
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:09:53 2018 +0300

    ath: Add regulatory mapping for Bahamas
    
    [ Upstream commit 699e2302c286a14afe7b7394151ce6c4e1790cc1 ]
    
    The country code is used by the ath to detect the ISO 3166-1 alpha-2 name
    and to select the correct conformance test limits (CTL) for a country. If
    the country isn't available and it is still programmed in the EEPROM then
    it will cause an error and stop the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this country are:
    
    * 2.4GHz: ETSI
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c40849333bd44ef96068bebe226cb5d3531ad2a
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:09:59 2018 +0300

    ath: Add regulatory mapping for Bermuda
    
    [ Upstream commit 9c790f2d234f65697e3b0948adbfdf36dbe63dd7 ]
    
    The country code is used by the ath to detect the ISO 3166-1 alpha-2 name
    and to select the correct conformance test limits (CTL) for a country. If
    the country isn't available and it is still programmed in the EEPROM then
    it will cause an error and stop the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this country are:
    
    * 2.4GHz: FCC
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bbd7480ed12baae07655de385075bc496f5f68bb
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:10:43 2018 +0300

    ath: Add regulatory mapping for Serbia
    
    [ Upstream commit 2a3169a54bb53717928392a04fb84deb765b51f1 ]
    
    The country code is used by the ath to detect the ISO 3166-1 alpha-2 name
    and to select the correct conformance test limits (CTL) for a country. If
    the country isn't available and it is still programmed in the EEPROM then
    it will cause an error and stop the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this country are:
    
    * 2.4GHz: ETSI
    * 5GHz: ETSI
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4b2c7cf52e4bead28ada187cf9617af442b4d00a
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:10:48 2018 +0300

    ath: Add regulatory mapping for Tanzania
    
    [ Upstream commit 667ddac5745fb9fddfe8f7fd2523070f50bd4442 ]
    
    The country code is used by the ath to detect the ISO 3166-1 alpha-2 name
    and to select the correct conformance test limits (CTL) for a country. If
    the country isn't available and it is still programmed in the EEPROM then
    it will cause an error and stop the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this country are:
    
    * 2.4GHz: ETSI
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f0589b82d272b183225b6a8cd8c9f78359e6ca65
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:10:54 2018 +0300

    ath: Add regulatory mapping for Uganda
    
    [ Upstream commit 1ea3986ad2bc72081c69f3fbc1e5e0eeb3c44f17 ]
    
    The country code is used by the ath to detect the ISO 3166-1 alpha-2 name
    and to select the correct conformance test limits (CTL) for a country. If
    the country isn't available and it is still programmed in the EEPROM then
    it will cause an error and stop the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this country are:
    
    * 2.4GHz: ETSI
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 396b5e67999be8537924c22e5d6eeaa89e585152
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:11:05 2018 +0300

    ath: Add regulatory mapping for APL2_FCCA
    
    [ Upstream commit 4f183687e3fad3ce0e06e38976cad81bc4541990 ]
    
    The regdomain code is used to select the correct the correct conformance
    test limits (CTL) for a country. If the regdomain code isn't available and
    it is still programmed in the EEPROM then it will cause an error and stop
    the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this regdomain code are:
    
    * 2.4GHz: FCC
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 55d4979643b1e4c0a53de84924ba5a95c5ab67f6
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:11:14 2018 +0300

    ath: Add regulatory mapping for APL13_WORLD
    
    [ Upstream commit 9ba8df0c52b3e6baa436374b429d3d73bd09a320 ]
    
    The regdomain code is used to select the correct the correct conformance
    test limits (CTL) for a country. If the regdomain code isn't available and
    it is still programmed in the EEPROM then it will cause an error and stop
    the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this regdomain code are:
    
    * 2.4GHz: ETSI
    * 5GHz: ETSI
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 31d83e727318298c83847a12f895e358b24da462
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:11:18 2018 +0300

    ath: Add regulatory mapping for ETSI8_WORLD
    
    [ Upstream commit 45faf6e096da8bb80e1ddf8c08a26a9601d9469e ]
    
    The regdomain code is used to select the correct the correct conformance
    test limits (CTL) for a country. If the regdomain code isn't available and
    it is still programmed in the EEPROM then it will cause an error and stop
    the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this regdomain code are:
    
    * 2.4GHz: ETSI
    * 5GHz: ETSI
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3fbe970e457ab5382615644b205a0adc1fb19e5
Author: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date:   Wed May 23 11:11:30 2018 +0300

    ath: Add regulatory mapping for FCC3_ETSIC
    
    [ Upstream commit 01fb2994a98dc72c8818c274f7b5983d5dd885c7 ]
    
    The regdomain code is used to select the correct the correct conformance
    test limits (CTL) for a country. If the regdomain code isn't available and
    it is still programmed in the EEPROM then it will cause an error and stop
    the initialization with:
    
      Invalid EEPROM contents
    
    The current CTL mappings for this regdomain code are:
    
    * 2.4GHz: ETSI
    * 5GHz: FCC
    
    Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0bedc117bab4a0ac92de0e856e896e1f708f1c57
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri May 18 18:56:24 2018 +0200

    PCI: Prevent sysfs disable of device while driver is attached
    
    [ Upstream commit 6f5cdfa802733dcb561bf664cc89d203f2fd958f ]
    
    Manipulating the enable_cnt behind the back of the driver will wreak
    complete havoc with the kernel state, so disallow it.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Acked-by: Keith Busch <keith.busch@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8362d3e90c1105380b4b2b1bd232a638e3f3f807
Author: Eyal Reizer <eyalreizer@gmail.com>
Date:   Mon May 28 11:36:42 2018 +0300

    wlcore: sdio: check for valid platform device data before suspend
    
    [ Upstream commit 6e91d48371e79862ea2c05867aaebe4afe55a865 ]
    
    the wl pointer can be null In case only wlcore_sdio is probed while
    no WiLink module is successfully probed, as in the case of mounting a
    wl12xx module while using a device tree file configured with wl18xx
    related settings.
    In this case the system was crashing in wl1271_suspend() as platform
    device data is not set.
    Make sure wl the pointer is valid before using it.
    
    Signed-off-by: Eyal Reizer <eyalr@ti.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cb0d96f440671ac822e5301e64adea817276d18b
Author: Ganapathi Bhat <gbhat@marvell.com>
Date:   Thu May 24 19:18:27 2018 +0530

    mwifiex: handle race during mwifiex_usb_disconnect
    
    [ Upstream commit b817047ae70c0bd67b677b65d0d69d72cd6e9728 ]
    
    Race condition is observed during rmmod of mwifiex_usb:
    
    1. The rmmod thread will call mwifiex_usb_disconnect(), download
       SHUTDOWN command and do wait_event_interruptible_timeout(),
       waiting for response.
    
    2. The main thread will handle the response and will do a
       wake_up_interruptible(), unblocking rmmod thread.
    
    3. On getting unblocked, rmmod thread  will make rx_cmd.urb = NULL in
       mwifiex_usb_free().
    
    4. The main thread will try to resubmit rx_cmd.urb in
       mwifiex_usb_submit_rx_urb(), which is NULL.
    
    To fix, wait for main thread to complete before calling
    mwifiex_usb_free().
    
    Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a7bb99f521843297a25ec6c4eeba96dd80092a90
Author: Kai Chieh Chuang <kaichieh.chuang@mediatek.com>
Date:   Mon May 28 10:18:18 2018 +0800

    ASoC: dpcm: fix BE dai not hw_free and shutdown
    
    [ Upstream commit 9c0ac70ad24d76b873c1551e27790c7f6a815d5c ]
    
    In case, one BE is used by two FE1/FE2
    FE1--->BE-->
           |
    FE2----]
    when FE1/FE2 call dpcm_be_dai_hw_free() together
    the BE users will be 2 (> 1), hence cannot be hw_free
    the be state will leave at, ex. SND_SOC_DPCM_STATE_STOP
    
    later FE1/FE2 call dpcm_be_dai_shutdown(),
    will be skip due to wrong state.
    leaving the BE not being hw_free and shutdown.
    
    The BE dai will be hw_free later when calling
    dpcm_be_dai_shutdown() if still in invalid state.
    
    Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c5061ffff5e9cad1fffba721546550af15dbda15
Author: Kan Liang <kan.liang@intel.com>
Date:   Thu May 3 11:25:07 2018 -0700

    perf/x86/intel/uncore: Correct fixed counter index check for NHM
    
    [ Upstream commit d71f11c076c420c4e2fceb4faefa144e055e0935 ]
    
    For Nehalem and Westmere, there is only one fixed counter for W-Box.
    There is no index which is bigger than UNCORE_PMC_IDX_FIXED.
    It is not correct to use >= to check fixed counter.
    The code quality issue will bring problem when new counter index is
    introduced.
    
    Signed-off-by: Kan Liang <kan.liang@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: acme@kernel.org
    Cc: eranian@google.com
    Link: http://lkml.kernel.org/r/1525371913-10597-2-git-send-email-kan.liang@intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a461ae00464937f66812feae551c9e0526bce769
Author: Kan Liang <kan.liang@intel.com>
Date:   Thu May 3 11:25:08 2018 -0700

    perf/x86/intel/uncore: Correct fixed counter index check in generic code
    
    [ Upstream commit 4749f8196452eeb73cf2086a6a9705bae479d33d ]
    
    There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only
    exception is client IMC uncore, which has been specially handled.
    For generic code, it is not correct to use >= to check fixed counter.
    The code quality issue will bring problem when a new counter index is
    introduced.
    
    Signed-off-by: Kan Liang <kan.liang@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: acme@kernel.org
    Cc: eranian@google.com
    Link: http://lkml.kernel.org/r/1525371913-10597-3-git-send-email-kan.liang@intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 031e96b6ffde712a300b7697bc8375351eb8bccf
Author: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Date:   Tue May 29 16:13:03 2018 -0600

    usbip: usbip_detach: Fix memory, udev context and udev leak
    
    [ Upstream commit d179f99a651685b19333360e6558110da2fe9bd7 ]
    
    detach_port() fails to call usbip_vhci_driver_close() from its error
    path after usbip_vhci_detach_device() returns failure, leaking memory
    allocated in usbip_vhci_driver_open() and holding udev_context and udev
    references. Fix it to call usbip_vhci_driver_close().
    
    Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b3ab448458ed69f6cb3c408c30d38e29acc06001
Author: Leon Romanovsky <leonro@mellanox.com>
Date:   Tue May 29 14:56:19 2018 +0300

    RDMA/mad: Convert BUG_ONs to error flows
    
    [ Upstream commit 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf ]
    
    Let's perform checks in-place instead of BUG_ONs.
    
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7bae72078bff8f87173f4ce2543cbb35970af1e6
Author: Stewart Smith <stewart@linux.ibm.com>
Date:   Thu Mar 29 17:02:46 2018 +1100

    hvc_opal: don't set tb_ticks_per_usec in udbg_init_opal_common()
    
    [ Upstream commit 447808bf500a7cc92173266a59f8a494e132b122 ]
    
    time_init() will set up tb_ticks_per_usec based on reality.
    time_init() is called *after* udbg_init_opal_common() during boot.
    
    from arch/powerpc/kernel/time.c:
      unsigned long tb_ticks_per_usec = 100; /* sane default */
    
    Currently, all powernv systems have a timebase frequency of 512mhz
    (512000000/1000000 == 0x200) - although there's nothing written
    down anywhere that I can find saying that we couldn't make that
    different based on the requirements in the ISA.
    
    So, we've been (accidentally) thwacking the (currently) correct
    (for powernv at least) value for tb_ticks_per_usec earlier than
    we otherwise would have.
    
    The "sane default" seems to be adequate for our purposes between
    udbg_init_opal_common() and time_init() being called, and if it isn't,
    then we should probably be setting it somewhere that isn't hvc_opal.c!
    
    Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 77e6abf43c95a39fd97a5fb644c26e303bd60459
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Fri Jun 1 11:31:44 2018 -0700

    infiniband: fix a possible use-after-free bug
    
    [ Upstream commit cb2595c1393b4a5211534e6f0a0fbad369e21ad8 ]
    
    ucma_process_join() will free the new allocated "mc" struct,
    if there is any error after that, especially the copy_to_user().
    
    But in parallel, ucma_leave_multicast() could find this "mc"
    through idr_find() before ucma_process_join() frees it, since it
    is already published.
    
    So "mc" could be used in ucma_leave_multicast() after it is been
    allocated and freed in ucma_process_join(), since we don't refcnt
    it.
    
    Fix this by separating "publish" from ID allocation, so that we
    can get an ID first and publish it later after copy_to_user().
    
    Fixes: c8f6a362bf3e ("RDMA/cma: Add multicast communication support")
    Reported-by: Noam Rathaus <noamr@beyondsecurity.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bef7079cf332be466968d501998df5242ce3e058
Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date:   Tue Jun 5 23:09:14 2018 +0200

    rtc: ensure rtc_set_alarm fails when alarms are not supported
    
    [ Upstream commit abfdff44bc38e9e2ef7929f633fb8462632299d4 ]
    
    When using RTC_ALM_SET or RTC_WKALM_SET with rtc_wkalrm.enabled not set,
    rtc_timer_enqueue() is not called and rtc_set_alarm() may succeed but the
    subsequent RTC_AIE_ON ioctl will fail. RTC_ALM_READ would also fail in that
    case.
    
    Ensure rtc_set_alarm() fails when alarms are not supported to avoid letting
    programs think the alarms are working for a particular RTC when they are
    not.
    
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4148e331c422900f63a7bb7ec2474663311ce921
Author: Mathieu Malaterre <malat@debian.org>
Date:   Thu Jun 7 17:05:17 2018 -0700

    mm/slub.c: add __printf verification to slab_err()
    
    [ Upstream commit a38965bf941b7c2af50de09c96bc5f03e136caef ]
    
    __printf is useful to verify format and arguments.  Remove the following
    warning (with W=1):
    
      mm/slub.c:721:2: warning: function might be possible candidate for `gnu_printf' format attribute [-Wsuggest-attribute=format]
    
    Link: http://lkml.kernel.org/r/20180505200706.19986-1-malat@debian.org
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    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>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f6581cff8a28891c64128e88db36f04a04be11ba
Author: Chintan Pandya <cpandya@codeaurora.org>
Date:   Thu Jun 7 17:06:50 2018 -0700

    mm: vmalloc: avoid racy handling of debugobjects in vunmap
    
    [ Upstream commit f3c01d2f3ade6790db67f80fef60df84424f8964 ]
    
    Currently, __vunmap flow is,
     1) Release the VM area
     2) Free the debug objects corresponding to that vm area.
    
    This leave some race window open.
     1) Release the VM area
     1.5) Some other client gets the same vm area
     1.6) This client allocates new debug objects on the same
          vm area
     2) Free the debug objects corresponding to this vm area.
    
    Here, we actually free 'other' client's debug objects.
    
    Fix this by freeing the debug objects first and then releasing the VM
    area.
    
    Link: http://lkml.kernel.org/r/1523961828-9485-2-git-send-email-cpandya@codeaurora.org
    Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Byungchul Park <byungchul.park@lge.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Laura Abbott <labbott@redhat.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Wei Yang <richard.weiyang@gmail.com>
    Cc: Yisheng Xie <xieyisheng1@huawei.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 942172d5ffc63c4bd16fa86812a9623701e8cdac
Author: Zhouyang Jia <jiazhouyang09@gmail.com>
Date:   Mon Jun 11 16:04:06 2018 +0800

    ALSA: fm801: add error handling for snd_ctl_add
    
    [ Upstream commit ef1ffbe7889e99f5b5cccb41c89e5c94f50f3218 ]
    
    When snd_ctl_add fails, the lack of error-handling code may
    cause unexpected results.
    
    This patch adds error-handling code after calling snd_ctl_add.
    
    Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
    Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit da2858dce9a74580d2ce234fe6da99e22eef5b1a
Author: Zhouyang Jia <jiazhouyang09@gmail.com>
Date:   Mon Jun 11 16:18:40 2018 +0800

    ALSA: emu10k1: add error handling for snd_ctl_add
    
    [ Upstream commit 6d531e7b972cb62ded011c2dfcc2d9f72ea6c421 ]
    
    When snd_ctl_add fails, the lack of error-handling code may
    cause unexpected results.
    
    This patch adds error-handling code after calling snd_ctl_add.
    
    Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 490106d9760e34ec0f85139e8ec900f2aa6974e9
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Wed Jul 25 22:28:56 2018 -0400

    tracing: Quiet gcc warning about maybe unused link variable
    
    commit 2519c1bbe38d7acacc9aacba303ca6f97482ed53 upstream.
    
    Commit 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on
    enable_trace_kprobe() failure") added an if statement that depends on another
    if statement that gcc doesn't see will initialize the "link" variable and
    gives the warning:
    
     "warning: 'link' may be used uninitialized in this function"
    
    It is really a false positive, but to quiet the warning, and also to make
    sure that it never actually is used uninitialized, initialize the "link"
    variable to NULL and add an if (!WARN_ON_ONCE(!link)) where the compiler
    thinks it could be used uninitialized.
    
    Cc: stable@vger.kernel.org
    Fixes: 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure")
    Reported-by: kbuild test robot <lkp@intel.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15165b72aa41f623e1519e03e5e1de9ee92cad73
Author: Artem Savkov <asavkov@redhat.com>
Date:   Wed Jul 25 16:20:38 2018 +0200

    tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
    
    commit 57ea2a34adf40f3a6e88409aafcf803b8945619a upstream.
    
    If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe
    it returns an error, but does not unset the tp flags it set previously.
    This results in a probe being considered enabled and failures like being
    unable to remove the probe through kprobe_events file since probes_open()
    expects every probe to be disabled.
    
    Link: http://lkml.kernel.org/r/20180725102826.8300-1-asavkov@redhat.com
    Link: http://lkml.kernel.org/r/20180725142038.4765-1-asavkov@redhat.com
    
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: stable@vger.kernel.org
    Fixes: 41a7dd420c57 ("tracing/kprobes: Support ftrace_event_file base multibuffer")
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Artem Savkov <asavkov@redhat.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 606ce67d88427994b5add25c0ab27bb4ccd44cd9
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Wed Jul 25 16:02:06 2018 -0400

    tracing: Fix possible double free in event_enable_trigger_func()
    
    commit 15cc78644d0075e76d59476a4467e7143860f660 upstream.
    
    There was a case that triggered a double free in event_trigger_callback()
    due to the called reg() function freeing the trigger_data and then it
    getting freed again by the error return by the caller. The solution there
    was to up the trigger_data ref count.
    
    Code inspection found that event_enable_trigger_func() has the same issue,
    but is not as easy to trigger (requires harder to trigger failures). It
    needs to be solved slightly different as it needs more to clean up when the
    reg() function fails.
    
    Link: http://lkml.kernel.org/r/20180725124008.7008e586@gandalf.local.home
    
    Cc: stable@vger.kernel.org
    Fixes: 7862ad1846e99 ("tracing: Add 'enable_event' and 'disable_event' event trigger commands")
    Reivewed-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4361f73aad0243f57acef79eaf2508ab223e9745
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Tue Jul 24 19:13:31 2018 -0400

    tracing: Fix double free of event_trigger_data
    
    commit 1863c387259b629e4ebfb255495f67cd06aa229b upstream.
    
    Running the following:
    
     # cd /sys/kernel/debug/tracing
     # echo 500000 > buffer_size_kb
    [ Or some other number that takes up most of memory ]
     # echo snapshot > events/sched/sched_switch/trigger
    
    Triggers the following bug:
    
     ------------[ cut here ]------------
     kernel BUG at mm/slub.c:296!
     invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC PTI
     CPU: 6 PID: 6878 Comm: bash Not tainted 4.18.0-rc6-test+ #1066
     Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016
     RIP: 0010:kfree+0x16c/0x180
     Code: 05 41 0f b6 72 51 5b 5d 41 5c 4c 89 d7 e9 ac b3 f8 ff 48 89 d9 48 89 da 41 b8 01 00 00 00 5b 5d 41 5c 4c 89 d6 e9 f4 f3 ff ff <0f> 0b 0f 0b 48 8b 3d d9 d8 f9 00 e9 c1 fe ff ff 0f 1f 40 00 0f 1f
     RSP: 0018:ffffb654436d3d88 EFLAGS: 00010246
     RAX: ffff91a9d50f3d80 RBX: ffff91a9d50f3d80 RCX: ffff91a9d50f3d80
     RDX: 00000000000006a4 RSI: ffff91a9de5a60e0 RDI: ffff91a9d9803500
     RBP: ffffffff8d267c80 R08: 00000000000260e0 R09: ffffffff8c1a56be
     R10: fffff0d404543cc0 R11: 0000000000000389 R12: ffffffff8c1a56be
     R13: ffff91a9d9930e18 R14: ffff91a98c0c2890 R15: ffffffff8d267d00
     FS:  00007f363ea64700(0000) GS:ffff91a9de580000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 000055c1cacc8e10 CR3: 00000000d9b46003 CR4: 00000000001606e0
     Call Trace:
      event_trigger_callback+0xee/0x1d0
      event_trigger_write+0xfc/0x1a0
      __vfs_write+0x33/0x190
      ? handle_mm_fault+0x115/0x230
      ? _cond_resched+0x16/0x40
      vfs_write+0xb0/0x190
      ksys_write+0x52/0xc0
      do_syscall_64+0x5a/0x160
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
     RIP: 0033:0x7f363e16ab50
     Code: 73 01 c3 48 8b 0d 38 83 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 79 db 2c 00 00 75 10 b8 01 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 1e e3 01 00 48 89 04 24
     RSP: 002b:00007fff9a4c6378 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
     RAX: ffffffffffffffda RBX: 0000000000000009 RCX: 00007f363e16ab50
     RDX: 0000000000000009 RSI: 000055c1cacc8e10 RDI: 0000000000000001
     RBP: 000055c1cacc8e10 R08: 00007f363e435740 R09: 00007f363ea64700
     R10: 0000000000000073 R11: 0000000000000246 R12: 0000000000000009
     R13: 0000000000000001 R14: 00007f363e4345e0 R15: 00007f363e4303c0
     Modules linked in: ip6table_filter ip6_tables snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_seq snd_seq_device i915 snd_pcm snd_timer i2c_i801 snd soundcore i2c_algo_bit drm_kms_helper
    86_pkg_temp_thermal video kvm_intel kvm irqbypass wmi e1000e
     ---[ end trace d301afa879ddfa25 ]---
    
    The cause is because the register_snapshot_trigger() call failed to
    allocate the snapshot buffer, and then called unregister_trigger()
    which freed the data that was passed to it. Then on return to the
    function that called register_snapshot_trigger(), as it sees it
    failed to register, it frees the trigger_data again and causes
    a double free.
    
    By calling event_trigger_init() on the trigger_data (which only ups
    the reference counter for it), and then event_trigger_free() afterward,
    the trigger_data would not get freed by the registering trigger function
    as it would only up and lower the ref count for it. If the register
    trigger function fails, then the event_trigger_free() called after it
    will free the trigger data normally.
    
    Link: http://lkml.kernel.org/r/20180724191331.738eb819@gandalf.local.home
    
    Cc: stable@vger.kerne.org
    Fixes: 93e31ffbf417 ("tracing: Add 'snapshot' event trigger command")
    Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>