commit 35c308d7828de5c5784bb75efcf848996b3a82d1
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jul 21 09:06:09 2019 +0200

    Linux 4.9.186

commit 2aa57f707fe9f187bd731475c1ec85147afc5bdb
Author: Julian Wiedmann <jwi@linux.ibm.com>
Date:   Tue Jun 18 13:12:20 2019 +0200

    s390/qdio: don't touch the dsci in tiqdio_add_input_queues()
    
    commit ac6639cd3db607d386616487902b4cc1850a7be5 upstream.
    
    Current code sets the dsci to 0x00000080. Which doesn't make any sense,
    as the indicator area is located in the _left-most_ byte.
    
    Worse: if the dsci is the _shared_ indicator, this potentially clears
    the indication of activity for a _different_ device.
    tiqdio_thinint_handler() will then have no reason to call that device's
    IRQ handler, and the device ends up stalling.
    
    Fixes: d0c9d4a89fff ("[S390] qdio: set correct bit in dsci")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 355dbc42bfb47a9033d740b69c1ea4dcfbe009f8
Author: Julian Wiedmann <jwi@linux.ibm.com>
Date:   Tue Jun 18 11:25:59 2019 +0200

    s390/qdio: (re-)initialize tiqdio list entries
    
    commit e54e4785cb5cb4896cf4285964aeef2125612fb2 upstream.
    
    When tiqdio_remove_input_queues() removes a queue from the tiq_list as
    part of qdio_shutdown(), it doesn't re-initialize the queue's list entry
    and the prev/next pointers go stale.
    
    If a subsequent qdio_establish() fails while sending the ESTABLISH cmd,
    it calls qdio_shutdown() again in QDIO_IRQ_STATE_ERR state and
    tiqdio_remove_input_queues() will attempt to remove the queue entry a
    second time. This dereferences the stale pointers, and bad things ensue.
    Fix this by re-initializing the list entry after removing it from the
    list.
    
    For good practice also initialize the list entry when the queue is first
    allocated, and remove the quirky checks that papered over this omission.
    Note that prior to
    commit e521813468f7 ("s390/qdio: fix access to uninitialized qdio_q fields"),
    these checks were bogus anyway.
    
    setup_queues_misc() clears the whole queue struct, and thus needs to
    re-init the prev/next pointers as well.
    
    Fixes: 779e6e1c724d ("[S390] qdio: new qdio driver.")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c016de667d828cf3d9b72be152c8118545bfd67
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Mon Jun 17 14:02:41 2019 +0200

    s390: fix stfle zero padding
    
    commit 4f18d869ffd056c7858f3d617c71345cf19be008 upstream.
    
    The stfle inline assembly returns the number of double words written
    (condition code 0) or the double words it would have written
    (condition code 3), if the memory array it got as parameter would have
    been large enough.
    
    The current stfle implementation assumes that the array is always
    large enough and clears those parts of the array that have not been
    written to with a subsequent memset call.
    
    If however the array is not large enough memset will get a negative
    length parameter, which means that memset clears memory until it gets
    an exception and the kernel crashes.
    
    To fix this simply limit the maximum length. Move also the inline
    assembly to an extra function to avoid clobbering of register 0, which
    might happen because of the added min_t invocation together with code
    instrumentation.
    
    The bug was introduced with commit 14375bc4eb8d ("[S390] cleanup
    facility list handling") but was rather harmless, since it would only
    write to a rather large array. It became a potential problem with
    commit 3ab121ab1866 ("[S390] kernel: Add z/VM LGR detection"). Since
    then it writes to an array with only four double words, while some
    machines already deliver three double words. As soon as machines have
    a facility bit within the fifth double a crash on IPL would happen.
    
    Fixes: 14375bc4eb8d ("[S390] cleanup facility list handling")
    Cc: <stable@vger.kernel.org> # v2.6.37+
    Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59f32fb7740889d16281e0900931d8216e62b37f
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Jul 3 15:39:25 2019 +0200

    ARC: hide unused function unw_hdr_alloc
    
    commit fd5de2721ea7d16e2b16c4049ac49f229551b290 upstream.
    
    As kernelci.org reports, this function is not used in
    vdk_hs38_defconfig:
    
    arch/arc/kernel/unwind.c:188:14: warning: 'unw_hdr_alloc' defined but not used [-Wunused-function]
    
    Fixes: bc79c9a72165 ("ARC: dw2 unwind: Reinstante unwinding out of modules")
    Link: https://kernelci.org/build/id/5d1cae3f59b514300340c132/logs/
    Cc: stable@vger.kernel.org
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7357febe9ec5a854f59dd6e6df50e279e54a8e5a
Author: Milan Broz <gmazyland@gmail.com>
Date:   Thu Jun 20 13:00:19 2019 +0200

    dm verity: use message limit for data block corruption message
    
    [ Upstream commit 2eba4e640b2c4161e31ae20090a53ee02a518657 ]
    
    DM verity should also use DMERR_LIMIT to limit repeat data block
    corruption messages.
    
    Signed-off-by: Milan Broz <gmazyland@gmail.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 65b8d1872e2eeb889c1e5ae221ae11a2c6ece383
Author: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Date:   Tue Jun 18 17:58:34 2019 +0200

    ARM: dts: imx6ul: fix PWM[1-4] interrupts
    
    [ Upstream commit 3cf10132ac8d536565f2c02f60a3aeb315863a52 ]
    
    According to the i.MX6UL/L RM, table 3.1 "ARM Cortex A7 domain interrupt
    summary", the interrupts for the PWM[1-4] go from 83 to 86.
    
    Fixes: b9901fe84f02 ("ARM: dts: imx6ul: add pwm[1-4] nodes")
    Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
    Reviewed-by: Fabio Estevam <festevam@gmail.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 338d1d62fcb4aa48575e20243aa7eff528a0ee78
Author: Sergej Benilov <sergej.benilov@googlemail.com>
Date:   Thu Jun 20 11:02:18 2019 +0200

    sis900: fix TX completion
    
    [ Upstream commit 8ac8a01092b2added0749ef937037bf1912e13e3 ]
    
    Since commit 605ad7f184b60cfaacbc038aa6c55ee68dee3c89 "tcp: refine TSO autosizing",
    outbound throughput is dramatically reduced for some connections, as sis900
    is doing TX completion within idle states only.
    
    Make TX completion happen after every transmitted packet.
    
    Test:
    netperf
    
    before patch:
    > netperf -H remote -l -2000000 -- -s 1000000
    MIGRATED TCP STREAM TEST from 0.0.0.0 () port 0 AF_INET to 95.223.112.76 () port 0 AF_INET : demo
    Recv   Send    Send
    Socket Socket  Message  Elapsed
    Size   Size    Size     Time     Throughput
    bytes  bytes   bytes    secs.    10^6bits/sec
    
     87380 327680 327680    253.44      0.06
    
    after patch:
    > netperf -H remote -l -10000000 -- -s 1000000
    MIGRATED TCP STREAM TEST from 0.0.0.0 () port 0 AF_INET to 95.223.112.76 () port 0 AF_INET : demo
    Recv   Send    Send
    Socket Socket  Message  Elapsed
    Size   Size    Size     Time     Throughput
    bytes  bytes   bytes    secs.    10^6bits/sec
    
     87380 327680 327680    5.38       14.89
    
    Thx to Dave Miller and Eric Dumazet for helpful hints
    
    Signed-off-by: Sergej Benilov <sergej.benilov@googlemail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a31ba8ec66cca7fe08f6f4a0d5e63eb36b503664
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Jun 19 15:34:07 2019 +0200

    ppp: mppe: Add softdep to arc4
    
    [ Upstream commit aad1dcc4f011ea409850e040363dff1e59aa4175 ]
    
    The arc4 crypto is mandatory at ppp_mppe probe time, so let's put a
    softdep line, so that the corresponding module gets prepared
    gracefully.  Without this, a simple inclusion to initrd via dracut
    failed due to the missing dependency, for example.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 79568282985283f21b5597fa2aef3bde5cbf1f6a
Author: Petr Oros <poros@redhat.com>
Date:   Wed Jun 19 14:29:42 2019 +0200

    be2net: fix link failure after ethtool offline test
    
    [ Upstream commit 2e5db6eb3c23e5dc8171eb8f6af7a97ef9fcf3a9 ]
    
    Certain cards in conjunction with certain switches need a little more
    time for link setup that results in ethtool link test failure after
    offline test. Patch adds a loop that waits for a link setup finish.
    
    Changes in v2:
    - added fixes header
    
    Fixes: 4276e47e2d1c ("be2net: Add link test to list of ethtool self tests.")
    Signed-off-by: Petr Oros <poros@redhat.com>
    Reviewed-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d2921e316908b83ce7af45e9f01599beb139d18d
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Jun 19 15:04:54 2019 +0200

    ARM: omap2: remove incorrect __init annotation
    
    [ Upstream commit 27e23d8975270df6999f8b5b3156fc0c04927451 ]
    
    omap3xxx_prm_enable_io_wakeup() is marked __init, but its caller is not, so
    we get a warning with clang-8:
    
    WARNING: vmlinux.o(.text+0x343c8): Section mismatch in reference from the function omap3xxx_prm_late_init() to the function .init.text:omap3xxx_prm_enable_io_wakeup()
    The function omap3xxx_prm_late_init() references
    the function __init omap3xxx_prm_enable_io_wakeup().
    This is often because omap3xxx_prm_late_init lacks a __init
    annotation or the annotation of omap3xxx_prm_enable_io_wakeup is wrong.
    
    When building with gcc, omap3xxx_prm_enable_io_wakeup() is always
    inlined, so we never noticed in the past.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
    Acked-by: Tony Lindgren <tony@atomide.com>
    Reviewed-by: Andrew Murray <andrew.murray@arm.com>
    Signed-off-by: Olof Johansson <olof@lixom.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b32df66680923454b03a7b74b0bd8df917f4197c
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed May 29 14:37:24 2019 +0200

    perf/core: Fix perf_sample_regs_user() mm check
    
    [ Upstream commit 085ebfe937d7a7a5df1729f35a12d6d655fea68c ]
    
    perf_sample_regs_user() uses 'current->mm' to test for the presence of
    userspace, but this is insufficient, consider use_mm().
    
    A better test is: '!(current->flags & PF_KTHREAD)', exec() clears
    PF_KTHREAD after it sets the new ->mm but before it drops to userspace
    for the first time.
    
    Possibly obsoletes: bf05fc25f268 ("powerpc/perf: Fix oops when kthread execs user process")
    
    Reported-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    Reported-by: Young Xiao <92siuyang@gmail.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Will Deacon <will.deacon@arm.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Fixes: 4018994f3d87 ("perf: Add ability to attach user level registers dump to sample")
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a855817f56e159050571c8439b0864fbbe911a35
Author: Mark Rutland <mark.rutland@arm.com>
Date:   Mon Jul 15 14:39:23 2019 +0100

    arm64: crypto: remove accidentally backported files
    
    In the v4.9.y backport commit:
    
      5ac0682830b31c4fba72a208a3c1c4bbfcc9f7f8
    
      ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
    
    ... I accidentally added unrelated arm64/crypto files which were not
    part of the upstream commit:
    
      b092201e0020614127f495c092e0a12d26a2116e
    
    ... and are not used at all in the v4.9.y tree.
    
    This patch reverts the accidental addition. These files should not have
    been backported, and having them in the v4.9.y tree is at best
    confusing.
    
    Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Mark Rutland <mark.rutland@arm.com>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4bc014488921c1ba0a47d9d55772cbed0489ca20
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Thu Jul 11 20:52:18 2019 -0700

    nilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header
    
    commit c32cc30c0544f13982ee0185d55f4910319b1a79 upstream.
    
    cpu_to_le32/le32_to_cpu is defined in include/linux/byteorder/generic.h,
    which is not exported to user-space.
    
    UAPI headers must use the ones prefixed with double-underscore.
    
    Detected by compile-testing exported headers:
    
      include/linux/nilfs2_ondisk.h: In function `nilfs_checkpoint_set_snapshot':
      include/linux/nilfs2_ondisk.h:536:17: error: implicit declaration of function `cpu_to_le32' [-Werror=implicit-function-declaration]
        cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                       ^
      include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
       NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
       ^~~~~~~~~~~~~~~~~~~~
      include/linux/nilfs2_ondisk.h:536:29: error: implicit declaration of function `le32_to_cpu' [-Werror=implicit-function-declaration]
        cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                                   ^
      include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
       NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
       ^~~~~~~~~~~~~~~~~~~~
      include/linux/nilfs2_ondisk.h: In function `nilfs_segment_usage_set_clean':
      include/linux/nilfs2_ondisk.h:622:19: error: implicit declaration of function `cpu_to_le64' [-Werror=implicit-function-declaration]
        su->su_lastmod = cpu_to_le64(0);
                         ^~~~~~~~~~~
    
    Link: http://lkml.kernel.org/r/20190605053006.14332-1-yamada.masahiro@socionext.com
    Fixes: e63e88bc53ba ("nilfs2: move ioctl interface and disk layout to uapi separately")
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Joe Perches <joe@perches.com>
    Cc: <stable@vger.kernel.org>    [4.9+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66eab69c92351a269d13163393cce4295a7287bb
Author: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date:   Wed Apr 17 11:13:20 2019 +0300

    e1000e: start network tx queue only when link is up
    
    commit d17ba0f616a08f597d9348c372d89b8c0405ccf3 upstream.
    
    Driver does not want to keep packets in Tx queue when link is lost.
    But present code only reset NIC to flush them, but does not prevent
    queuing new packets. Moreover reset sequence itself could generate
    new packets via netconsole and NIC falls into endless reset loop.
    
    This patch wakes Tx queue only when NIC is ready to send packets.
    
    This is proper fix for problem addressed by commit 0f9e980bf5ee
    ("e1000e: fix cyclic resets at link up with active tx").
    
    Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Suggested-by: Alexander Duyck <alexander.duyck@gmail.com>
    Tested-by: Joseph Yasi <joe.yasi@gmail.com>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a6abcd179e303987ace685e98c6f69117ed16afd
Author: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date:   Wed Apr 17 11:13:16 2019 +0300

    Revert "e1000e: fix cyclic resets at link up with active tx"
    
    commit caff422ea81e144842bc44bab408d85ac449377b upstream.
    
    This reverts commit 0f9e980bf5ee1a97e2e401c846b2af989eb21c61.
    
    That change cased false-positive warning about hardware hang:
    
    e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
    IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    e1000e 0000:00:1f.6 eth0: Detected Hardware Unit Hang:
       TDH                  <0>
       TDT                  <1>
       next_to_use          <1>
       next_to_clean        <0>
    buffer_info[next_to_clean]:
       time_stamp           <fffba7a7>
       next_to_watch        <0>
       jiffies              <fffbb140>
       next_to_watch.status <0>
    MAC Status             <40080080>
    PHY Status             <7949>
    PHY 1000BASE-T Status  <0>
    PHY Extended Status    <3000>
    PCI Status             <10>
    e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
    
    Besides warning everything works fine.
    Original issue will be fixed property in following patch.
    
    Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Reported-by: Joseph Yasi <joe.yasi@gmail.com>
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=203175
    Tested-by: Joseph Yasi <joe.yasi@gmail.com>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 21b25375a86d5c32b27be4489051dcc0d22d140e
Author: Sean Young <sean@mess.org>
Date:   Fri Nov 16 16:09:39 2018 +0000

    MIPS: Remove superfluous check for __linux__
    
    commit 1287533d3d95d5ad8b02773733044500b1be06bc upstream.
    
    When building BPF code using "clang -target bpf -c", clang does not
    define __linux__.
    
    To build BPF IR decoders the include linux/lirc.h is needed which
    includes linux/types.h. Currently this workaround is needed:
    
    https://git.linuxtv.org/v4l-utils.git/commit/?id=dd3ff81f58c4e1e6f33765dc61ad33c48ae6bb07
    
    This check might otherwise be useful to stop users from using a non-linux
    compiler, but if you're doing that you are going to have a lot more
    trouble anyway.
    
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Paul Burton <paul.burton@mips.com>
    Patchwork: https://patchwork.linux-mips.org/patch/21149/
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: James Hogan <jhogan@kernel.org>
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Hauke Mehrtens <hauke@hauke-m.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6f56992a4e66b699f072459e3333946078f6cc83
Author: Vishnu DASA <vdasa@vmware.com>
Date:   Fri May 24 15:13:10 2019 +0000

    VMCI: Fix integer overflow in VMCI handle arrays
    
    commit 1c2eb5b2853c9f513690ba6b71072d8eb65da16a upstream.
    
    The VMCI handle array has an integer overflow in
    vmci_handle_arr_append_entry when it tries to expand the array. This can be
    triggered from a guest, since the doorbell link hypercall doesn't impose a
    limit on the number of doorbell handles that a VM can create in the
    hypervisor, and these handles are stored in a handle array.
    
    In this change, we introduce a mandatory max capacity for handle
    arrays/lists to avoid excessive memory usage.
    
    Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
    Reviewed-by: Adit Ranadive <aditr@vmware.com>
    Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eea15538d96700b70b07f5725c11a4a92fc2c4a8
Author: Christian Lamparter <chunkeey@gmail.com>
Date:   Sat Jun 8 16:49:47 2019 +0200

    carl9170: fix misuse of device driver API
    
    commit feb09b2933275a70917a869989ea2823e7356be8 upstream.
    
    This patch follows Alan Stern's recent patch:
    "p54: Fix race between disconnect and firmware loading"
    
    that overhauled carl9170 buggy firmware loading and driver
    unbinding procedures.
    
    Since the carl9170 code was adapted from p54 it uses the
    same functions and is likely to have the same problem, but
    it's just that the syzbot hasn't reproduce them (yet).
    
    a summary from the changes (copied from the p54 patch):
     * Call usb_driver_release_interface() rather than
       device_release_driver().
    
     * Lock udev (the interface's parent) before unbinding the
       driver instead of locking udev->parent.
    
     * During the firmware loading process, take a reference
       to the USB interface instead of the USB device.
    
     * Don't take an unnecessary reference to the device during
       probe (and then don't drop it during disconnect).
    
    and
    
     * Make sure to prevent use-after-free bugs by explicitly
       setting the driver context to NULL after signaling the
       completion.
    
    Cc: <stable@vger.kernel.org>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 594fb6bd2e0ee2bdadc5c181e191f0fede01db3f
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Jun 26 14:17:39 2019 +0100

    staging: comedi: amplc_pci230: fix null pointer deref on interrupt
    
    commit 7379e6baeddf580d01feca650ec1ad508b6ea8ee upstream.
    
    The interrupt handler `pci230_interrupt()` causes a null pointer
    dereference for a PCI260 card.  There is no analog output subdevice for
    a PCI260.  The `dev->write_subdev` subdevice pointer and therefore the
    `s_ao` subdevice pointer variable will be `NULL` for a PCI260.  The
    following call near the end of the interrupt handler results in the null
    pointer dereference for a PCI260:
    
            comedi_handle_events(dev, s_ao);
    
    Fix it by only calling the above function if `s_ao` is valid.
    
    Note that the other uses of `s_ao` in the calls
    `pci230_handle_ao_nofifo(dev, s_ao);` and `pci230_handle_ao_fifo(dev,
    s_ao);` will never be reached for a PCI260, so they are safe.
    
    Fixes: 39064f23284c ("staging: comedi: amplc_pci230: use comedi_handle_events()")
    Cc: <stable@vger.kernel.org> # v3.19+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2727adfb64a087a06f57d4b804c5f47fe81f5ec0
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Jun 26 14:18:04 2019 +0100

    staging: comedi: dt282x: fix a null pointer deref on interrupt
    
    commit b8336be66dec06bef518030a0df9847122053ec5 upstream.
    
    The interrupt handler `dt282x_interrupt()` causes a null pointer
    dereference for those supported boards that have no analog output
    support.  For these boards, `dev->write_subdev` will be `NULL` and
    therefore the `s_ao` subdevice pointer variable will be `NULL`.  In that
    case, the following call near the end of the interrupt handler results
    in a null pointer dereference:
    
            comedi_handle_events(dev, s_ao);
    
    Fix it by only calling the above function if `s_ao` is valid.
    
    (There are other uses of `s_ao` by the interrupt handler that may or may
    not be reached depending on values of hardware registers.  Trust that
    they are reliable for now.)
    
    Note:
    commit 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()")
    propagates an earlier error from
    commit f21c74fa4cfe ("staging: comedi: dt282x: use cfc_handle_events()").
    
    Fixes: 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()")
    Cc: <stable@vger.kernel.org> # v3.19+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ad8d7733bb15d145f5cf5789c8e53c94a0f6151
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Wed Jun 26 22:06:33 2019 +0900

    usb: renesas_usbhs: add a workaround for a race condition of workqueue
    
    commit b2357839c56ab7d06bcd4e866ebc2d0e2b7997f3 upstream.
    
    The old commit 6e4b74e4690d ("usb: renesas: fix scheduling in atomic
    context bug") fixed an atomic issue by using workqueue for the shdmac
    dmaengine driver. However, this has a potential race condition issue
    between the work pending and usbhsg_ep_free_request() in gadget mode.
    When usbhsg_ep_free_request() is called while pending the queue,
    since the work_struct will be freed and then the work handler is
    called, kernel panic happens on process_one_work().
    
    To fix the issue, if we could call cancel_work_sync() at somewhere
    before the free request, it could be easy. However,
    the usbhsg_ep_free_request() is called on atomic (e.g. f_ncm driver
    calls free request via gether_disconnect()).
    
    For now, almost all users are having "USB-DMAC" and the DMAengine
    driver can be used on atomic. So, this patch adds a workaround for
    a race condition to call the DMAengine APIs without the workqueue.
    
    This means we still have TODO on shdmac environment (SH7724), but
    since it doesn't have SMP, the race condition might not happen.
    
    Fixes: ab330cf3888d ("usb: renesas_usbhs: add support for USB-DMAC")
    Cc: <stable@vger.kernel.org> # v4.1+
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f1052d05ec5ae9cb1138d43b447c2937adae56d3
Author: Kiruthika Varadarajan <Kiruthika.Varadarajan@harman.com>
Date:   Tue Jun 18 08:39:06 2019 +0000

    usb: gadget: ether: Fix race between gether_disconnect and rx_submit
    
    commit d29fcf7078bc8be2b6366cbd4418265b53c94fac upstream.
    
    On spin lock release in rx_submit, gether_disconnect get a chance to
    run, it makes port_usb NULL, rx_submit access NULL port USB, hence null
    pointer crash.
    
    Fixed by releasing the lock in rx_submit after port_usb is used.
    
    Fixes: 2b3d942c4878 ("usb ethernet gadget: split out network core")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Kiruthika Varadarajan <Kiruthika.Varadarajan@harman.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit feca0ce34518f69447d0d13cd431d0eef647a794
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Mon May 20 10:44:21 2019 -0400

    p54usb: Fix race between disconnect and firmware loading
    
    commit 6e41e2257f1094acc37618bf6c856115374c6922 upstream.
    
    The syzbot fuzzer found a bug in the p54 USB wireless driver.  The
    issue involves a race between disconnect and the firmware-loader
    callback routine, and it has several aspects.
    
    One big problem is that when the firmware can't be loaded, the
    callback routine tries to unbind the driver from the USB _device_ (by
    calling device_release_driver) instead of from the USB _interface_ to
    which it is actually bound (by calling usb_driver_release_interface).
    
    The race involves access to the private data structure.  The driver's
    disconnect handler waits for a completion that is signalled by the
    firmware-loader callback routine.  As soon as the completion is
    signalled, you have to assume that the private data structure may have
    been deallocated by the disconnect handler -- even if the firmware was
    loaded without errors.  However, the callback routine does access the
    private data several times after that point.
    
    Another problem is that, in order to ensure that the USB device
    structure hasn't been freed when the callback routine runs, the driver
    takes a reference to it.  This isn't good enough any more, because now
    that the callback routine calls usb_driver_release_interface, it has
    to ensure that the interface structure hasn't been freed.
    
    Finally, the driver takes an unnecessary reference to the USB device
    structure in the probe function and drops the reference in the
    disconnect handler.  This extra reference doesn't accomplish anything,
    because the USB core already guarantees that a device structure won't
    be deallocated while a driver is still bound to any of its interfaces.
    
    To fix these problems, this patch makes the following changes:
    
            Call usb_driver_release_interface() rather than
            device_release_driver().
    
            Don't signal the completion until after the important
            information has been copied out of the private data structure,
            and don't refer to the private data at all thereafter.
    
            Lock udev (the interface's parent) before unbinding the driver
            instead of locking udev->parent.
    
            During the firmware loading process, take a reference to the
            USB interface instead of the USB device.
    
            Don't take an unnecessary reference to the device during probe
            (and then don't drop it during disconnect).
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Reported-and-tested-by: syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com
    CC: <stable@vger.kernel.org>
    Acked-by: Christian Lamparter <chunkeey@gmail.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 012611e87fedfaa2fed2c8941014e0f3173baf72
Author: Oliver Barta <o.barta89@gmail.com>
Date:   Wed Jun 19 10:16:39 2019 +0200

    Revert "serial: 8250: Don't service RX FIFO if interrupts are disabled"
    
    commit 3f2640ed7be838c3f05c0d2b0f7c7508e7431e48 upstream.
    
    This reverts commit 2e9fe539108320820016f78ca7704a7342788380.
    
    Reading LSR unconditionally but processing the error flags only if
    UART_IIR_RDI bit was set before in IIR may lead to a loss of transmission
    error information on UARTs where the transmission error flags are cleared
    by a read of LSR. Information are lost in case an error is detected right
    before the read of LSR while processing e.g. an UART_IIR_THRI interrupt.
    
    Signed-off-by: Oliver Barta <o.barta89@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Fixes: 2e9fe5391083 ("serial: 8250: Don't service RX FIFO if interrupts are disabled")
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 072d6445110e375b78995e3c78ac6800d3419053
Author: Jörgen Storvist <jorgen.storvist@gmail.com>
Date:   Wed Jun 19 00:30:19 2019 +0200

    USB: serial: option: add support for GosunCn ME3630 RNDIS mode
    
    commit aed2a26283528fb69c38e414f649411aa48fb391 upstream.
    
    Added USB IDs for GosunCn ME3630 cellular module in RNDIS mode.
    
    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=03 Dev#= 18 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=19d2 ProdID=0601 Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    S:  SerialNumber=b950269c
    C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#=0x0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
    I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
    I:  If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    
    Signed-off-by: Jörgen Storvist <jorgen.storvist@gmail.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f271b7529cd5c94d32e4c90c0f7c4dde268d4ff8
Author: Andreas Fritiofson <andreas.fritiofson@unjo.com>
Date:   Fri Jun 28 15:08:34 2019 +0200

    USB: serial: ftdi_sio: add ID for isodebug v1
    
    commit f8377eff548170e8ea8022c067a1fbdf9e1c46a8 upstream.
    
    This adds the vid:pid of the isodebug v1 isolated JTAG/SWD+UART. Only the
    second channel is available for use as a serial port.
    
    Signed-off-by: Andreas Fritiofson <andreas.fritiofson@unjo.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 052020f72aa103b9a4bff36c13eeeb387ad7cfc0
Author: Brian Norris <briannorris@chromium.org>
Date:   Fri Jun 14 17:13:20 2019 -0700

    mwifiex: Don't abort on small, spec-compliant vendor IEs
    
    commit 63d7ef36103d26f20325a921ecc96a3288560146 upstream.
    
    Per the 802.11 specification, vendor IEs are (at minimum) only required
    to contain an OUI. A type field is also included in ieee80211.h (struct
    ieee80211_vendor_ie) but doesn't appear in the specification. The
    remaining fields (subtype, version) are a convention used in WMM
    headers.
    
    Thus, we should not reject vendor-specific IEs that have only the
    minimum length (3 bytes) -- we should skip over them (since we only want
    to match longer IEs, that match either WMM or WPA formats). We can
    reject elements that don't have the minimum-required 3 byte OUI.
    
    While we're at it, move the non-standard subtype and version fields into
    the WMM structs, to avoid this confusion in the future about generic
    "vendor header" attributes.
    
    Fixes: 685c9b7750bf ("mwifiex: Abort at too short BSS descriptor element")
    Cc: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e722fb795fdfbda94edc62e750685592c36abd10
Author: Hongjie Fang <hongjiefang@asrmicro.com>
Date:   Wed May 22 10:02:53 2019 +0800

    fscrypt: don't set policy for a dead directory
    
    commit 5858bdad4d0d0fc18bf29f34c3ac836e0b59441f upstream.
    
    The directory may have been removed when entering
    fscrypt_ioctl_set_policy().  If so, the empty_dir() check will return
    error for ext4 file system.
    
    ext4_rmdir() sets i_size = 0, then ext4_empty_dir() reports an error
    because 'inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)'.  If
    the fs is mounted with errors=panic, it will trigger a panic issue.
    
    Add the check IS_DEADDIR() to fix this problem.
    
    Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support")
    Cc: <stable@vger.kernel.org> # v4.1+
    Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f70d411e2ecd1f8297e1fd7e91108ca220986784
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri May 31 15:18:41 2019 +0200

    mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies()
    
    commit 69ae4f6aac1578575126319d3f55550e7e440449 upstream.
    
    A few places in mwifiex_uap_parse_tail_ies() perform memcpy()
    unconditionally, which may lead to either buffer overflow or read over
    boundary.
    
    This patch addresses the issues by checking the read size and the
    destination size at each place more properly.  Along with the fixes,
    the patch cleans up the code slightly by introducing a temporary
    variable for the token size, and unifies the error path with the
    standard goto statement.
    
    Reported-by: huangwen <huangwen@venustech.com.cn>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 21a88663a65665b28d8e9d4e83bbf9af7a0ff89b
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed May 29 14:52:20 2019 +0200

    mwifiex: Abort at too short BSS descriptor element
    
    commit 685c9b7750bfacd6fc1db50d86579980593b7869 upstream.
    
    Currently mwifiex_update_bss_desc_with_ie() implicitly assumes that
    the source descriptor entries contain the enough size for each type
    and performs copying without checking the source size.  This may lead
    to read over boundary.
    
    Fix this by putting the source size check in appropriate places.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ad94dc664e66a4b94e238595276dfde1005cc61
Author: Dianzhang Chen <dianzhangchen0@gmail.com>
Date:   Wed Jun 26 12:50:30 2019 +0800

    x86/tls: Fix possible spectre-v1 in do_get_thread_area()
    
    commit 993773d11d45c90cb1c6481c2638c3d9f092ea5b upstream.
    
    The index to access the threads tls array is controlled by userspace
    via syscall: sys_ptrace(), hence leading to a potential exploitation
    of the Spectre variant 1 vulnerability.
    
    The index can be controlled from:
            ptrace -> arch_ptrace -> do_get_thread_area.
    
    Fix this by sanitizing the user supplied index before using it to access
    the p->thread.tls_array.
    
    Signed-off-by: Dianzhang Chen <dianzhangchen0@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/1561524630-3642-1-git-send-email-dianzhangchen0@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bbc8031356e96b5ded5557800927adeeabb1602d
Author: Dianzhang Chen <dianzhangchen0@gmail.com>
Date:   Tue Jun 25 23:30:17 2019 +0800

    x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg()
    
    commit 31a2fbb390fee4231281b939e1979e810f945415 upstream.
    
    The index to access the threads ptrace_bps is controlled by userspace via
    syscall: sys_ptrace(), hence leading to a potential exploitation of the
    Spectre variant 1 vulnerability.
    
    The index can be controlled from:
        ptrace -> arch_ptrace -> ptrace_get_debugreg.
    
    Fix this by sanitizing the user supplied index before using it access
    thread->ptrace_bps.
    
    Signed-off-by: Dianzhang Chen <dianzhangchen0@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/1561476617-3759-1-git-send-email-dianzhangchen0@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9be0a1a30e51c029a0a3ca553b9e501bd52a221e
Author: Steven J. Magnani <steve.magnani@digidescorp.com>
Date:   Sun Jun 30 21:39:35 2019 -0500

    udf: Fix incorrect final NOT_ALLOCATED (hole) extent length
    
    commit fa33cdbf3eceb0206a4f844fe91aeebcf6ff2b7a upstream.
    
    In some cases, using the 'truncate' command to extend a UDF file results
    in a mismatch between the length of the file's extents (specifically, due
    to incorrect length of the final NOT_ALLOCATED extent) and the information
    (file) length. The discrepancy can prevent other operating systems
    (i.e., Windows 10) from opening the file.
    
    Two particular errors have been observed when extending a file:
    
    1. The final extent is larger than it should be, having been rounded up
       to a multiple of the block size.
    
    B. The final extent is not shorter than it should be, due to not having
       been updated when the file's information length was increased.
    
    [JK: simplified udf_do_extend_final_block(), fixed up some types]
    
    Fixes: 2c948b3f86e5 ("udf: Avoid IO in udf_clear_inode")
    CC: stable@vger.kernel.org
    Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
    Link: https://lore.kernel.org/r/1561948775-5878-1-git-send-email-steve@digidescorp.com
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed574f702748dd5a5b4d8192e9dbf03344ab5734
Author: Lin Yi <teroincn@163.com>
Date:   Mon Jun 10 10:16:56 2019 +0800

    net :sunrpc :clnt :Fix xps refcount imbalance on the error path
    
    [ Upstream commit b96226148491505318228ac52624956bd98f9e0c ]
    
    rpc_clnt_add_xprt take a reference to struct rpc_xprt_switch, but forget
    to release it before return, may lead to a memory leak.
    
    Signed-off-by: Lin Yi <teroincn@163.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3b2f8a66ae6034e9f32d6baeae517ad3400161a3
Author: Xin Long <lucien.xin@gmail.com>
Date:   Mon Jun 17 21:34:14 2019 +0800

    ip6_tunnel: allow not to count pkts on tstats by passing dev as NULL
    
    [ Upstream commit 6f6a8622057c92408930c31698394fae1557b188 ]
    
    A similar fix to Patch "ip_tunnel: allow not to count pkts on tstats by
    setting skb's dev to NULL" is also needed by ip6_tunnel.
    
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4fd07ae0f7764138328a8ad5d974e6abc69aa010
Author: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
Date:   Thu Jun 13 16:25:40 2019 -0300

    bnx2x: Check if transceiver implements DDM before access
    
    [ Upstream commit cf18cecca911c0db96b868072665347efe6df46f ]
    
    Some transceivers may comply with SFF-8472 even though they do not
    implement the Digital Diagnostic Monitoring (DDM) interface described in
    the spec. The existence of such area is specified by the 6th bit of byte
    92, set to 1 if implemented.
    
    Currently, without checking this bit, bnx2x fails trying to read sfp
    module's EEPROM with the follow message:
    
    ethtool -m enP5p1s0f1
    Cannot get Module EEPROM data: Input/output error
    
    Because it fails to read the additional 256 bytes in which it is assumed
    to exist the DDM data.
    
    This issue was noticed using a Mellanox Passive DAC PN 01FT738. The EEPROM
    data was confirmed by Mellanox as correct and similar to other Passive
    DACs from other manufacturers.
    
    Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
    Acked-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4f7347010e1a3a7d6429ccb6ca3231728857fa02
Author: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Date:   Thu Jun 13 16:11:41 2019 +0200

    md: fix for divide error in status_resync
    
    [ Upstream commit 9642fa73d073527b0cbc337cc17a47d545d82cd2 ]
    
    Stopping external metadata arrays during resync/recovery causes
    retries, loop of interrupting and starting reconstruction, until it
    hit at good moment to stop completely. While these retries
    curr_mark_cnt can be small- especially on HDD drives, so subtraction
    result can be smaller than 0. However it is casted to uint without
    checking. As a result of it the status bar in /proc/mdstat while stopping
    is strange (it jumps between 0% and 99%).
    
    The real problem occurs here after commit 72deb455b5ec ("block: remove
    CONFIG_LBDAF"). Sector_div() macro has been changed, now the
    divisor is casted to uint32. For db = -8 the divisior(db/32-1) becomes 0.
    
    Check if db value can be really counted and replace these macro by
    div64_u64() inline.
    
    Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
    Signed-off-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e221ce0dc5785c01079886e5d4db63a56521d07d
Author: Yibo Zhao <yiboz@codeaurora.org>
Date:   Fri Jun 14 19:01:52 2019 +0800

    mac80211: only warn once on chanctx_conf being NULL
    
    [ Upstream commit 563572340173865a9a356e6bb02579e6998a876d ]
    
    In multiple SSID cases, it takes time to prepare every AP interface
    to be ready in initializing phase. If a sta already knows everything it
    needs to join one of the APs and sends authentication to the AP which
    is not fully prepared at this point of time, AP's channel context
    could be NULL. As a result, warning message occurs.
    
    Even worse, if the AP is under attack via tools such as MDK3 and massive
    authentication requests are received in a very short time, console will
    be hung due to kernel warning messages.
    
    WARN_ON_ONCE() could be a better way for indicating warning messages
    without duplicate messages to flood the console.
    
    Johannes: We still need to address the underlying problem, but we
              don't really have a good handle on it yet. Suppress the
              worst side-effects for now.
    
    Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
    Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
    [johannes: add note, change subject]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 23a9000f0799bf3f40bff826532109435ca371bc
Author: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date:   Fri Jun 7 16:33:50 2019 +0200

    ARM: davinci: da8xx: specify dma_coherent_mask for lcdc
    
    [ Upstream commit 68f2515bb31a664ba3e2bc1eb78dd9f529b10067 ]
    
    The lcdc device is missing the dma_coherent_mask definition causing the
    following warning on da850-evm:
    
    da8xx_lcdc da8xx_lcdc.0: found Sharp_LK043T1DG01 panel
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at kernel/dma/mapping.c:247 dma_alloc_attrs+0xc8/0x110
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 5.2.0-rc3-00077-g16d72dd4891f #18
    Hardware name: DaVinci DA850/OMAP-L138/AM18x EVM
    [<c000fce8>] (unwind_backtrace) from [<c000d900>] (show_stack+0x10/0x14)
    [<c000d900>] (show_stack) from [<c001a4f8>] (__warn+0xec/0x114)
    [<c001a4f8>] (__warn) from [<c001a634>] (warn_slowpath_null+0x3c/0x48)
    [<c001a634>] (warn_slowpath_null) from [<c0065860>] (dma_alloc_attrs+0xc8/0x110)
    [<c0065860>] (dma_alloc_attrs) from [<c02820f8>] (fb_probe+0x228/0x5a8)
    [<c02820f8>] (fb_probe) from [<c02d3e9c>] (platform_drv_probe+0x48/0x9c)
    [<c02d3e9c>] (platform_drv_probe) from [<c02d221c>] (really_probe+0x1d8/0x2d4)
    [<c02d221c>] (really_probe) from [<c02d2474>] (driver_probe_device+0x5c/0x168)
    [<c02d2474>] (driver_probe_device) from [<c02d2728>] (device_driver_attach+0x58/0x60)
    [<c02d2728>] (device_driver_attach) from [<c02d27b0>] (__driver_attach+0x80/0xbc)
    [<c02d27b0>] (__driver_attach) from [<c02d047c>] (bus_for_each_dev+0x64/0xb4)
    [<c02d047c>] (bus_for_each_dev) from [<c02d1590>] (bus_add_driver+0xe4/0x1d8)
    [<c02d1590>] (bus_add_driver) from [<c02d301c>] (driver_register+0x78/0x10c)
    [<c02d301c>] (driver_register) from [<c000a5c0>] (do_one_initcall+0x48/0x1bc)
    [<c000a5c0>] (do_one_initcall) from [<c05cae6c>] (kernel_init_freeable+0x10c/0x1d8)
    [<c05cae6c>] (kernel_init_freeable) from [<c048a000>] (kernel_init+0x8/0xf4)
    [<c048a000>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)
    Exception stack(0xc6837fb0 to 0xc6837ff8)
    7fa0:                                     00000000 00000000 00000000 00000000
    7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
    ---[ end trace 8a8073511be81dd2 ]---
    
    Add a 32-bit mask to the platform device's definition.
    
    Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    
    Signed-off-by: Sekhar Nori <nsekhar@ti.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a815a475ae6006d53ecd57a9b0d10b82e3bf1ca2
Author: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date:   Fri Jun 7 11:02:01 2019 +0200

    ARM: davinci: da850-evm: call regulator_has_full_constraints()
    
    [ Upstream commit 0c0c9b5753cd04601b17de09da1ed2885a3b42fe ]
    
    The BB expander at 0x21 i2c bus 1 fails to probe on da850-evm because
    the board doesn't set has_full_constraints to true in the regulator
    API.
    
    Call regulator_has_full_constraints() at the end of board registration
    just like we do in da850-lcdk and da830-evm.
    
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    Signed-off-by: Sekhar Nori <nsekhar@ti.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fb0ddae4cda490f73d76c4cc6afd6c946e7ab143
Author: Ido Schimmel <idosch@mellanox.com>
Date:   Tue Jun 11 10:19:46 2019 +0300

    mlxsw: spectrum: Disallow prio-tagged packets when PVID is removed
    
    [ Upstream commit 4b14cc313f076c37b646cee06a85f0db59cf216c ]
    
    When PVID is removed from a bridge port, the Linux bridge drops both
    untagged and prio-tagged packets. Align mlxsw with this behavior.
    
    Fixes: 148f472da5db ("mlxsw: reg: Add the Switch Port Acceptable Frame Types register")
    Acked-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: Ido Schimmel <idosch@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 866e8eb5ad1813113030a98e31714e707e03954b
Author: Dave Martin <Dave.Martin@arm.com>
Date:   Thu Jun 6 11:58:07 2019 +0100

    KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy
    
    [ Upstream commit 4729ec8c1e1145234aeeebad5d96d77f4ccbb00a ]
    
    kvm_device->destroy() seems to be supposed to free its kvm_device
    struct, but vgic_its_destroy() is not currently doing this,
    resulting in a memory leak, resulting in kmemleak reports such as
    the following:
    
    unreferenced object 0xffff800aeddfe280 (size 128):
      comm "qemu-system-aar", pid 13799, jiffies 4299827317 (age 1569.844s)
      [...]
      backtrace:
        [<00000000a08b80e2>] kmem_cache_alloc+0x178/0x208
        [<00000000dcad2bd3>] kvm_vm_ioctl+0x350/0xbc0
    
    Fix it.
    
    Cc: Andre Przywara <andre.przywara@arm.com>
    Fixes: 1085fdc68c60 ("KVM: arm64: vgic-its: Introduce new KVM ITS device")
    Signed-off-by: Dave Martin <Dave.Martin@arm.com>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a31d4c8b2ba6e33a70ff462189b92a5808ea6b49
Author: Anson Huang <anson.huang@nxp.com>
Date:   Tue Jun 11 17:50:44 2019 -0700

    Input: imx_keypad - make sure keyboard can always wake up system
    
    [ Upstream commit ce9a53eb3dbca89e7ad86673d94ab886e9bea704 ]
    
    There are several scenarios that keyboard can NOT wake up system
    from suspend, e.g., if a keyboard is depressed between system
    device suspend phase and device noirq suspend phase, the keyboard
    ISR will be called and both keyboard depress and release interrupts
    will be disabled, then keyboard will no longer be able to wake up
    system. Another scenario would be, if a keyboard is kept depressed,
    and then system goes into suspend, the expected behavior would be
    when keyboard is released, system will be waked up, but current
    implementation can NOT achieve that, because both depress and release
    interrupts are disabled in ISR, and the event check is still in
    progress.
    
    To fix these issues, need to make sure keyboard's depress or release
    interrupt is enabled after noirq device suspend phase, this patch
    moves the suspend/resume callback to noirq suspend/resume phase, and
    enable the corresponding interrupt according to current keyboard status.
    
    Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a4bd79096c85c73cfab20d104ab607488220333b
Author: Sean Nyekjaer <sean@geanix.com>
Date:   Tue May 7 11:34:36 2019 +0200

    can: mcp251x: add support for mcp25625
    
    [ Upstream commit 35b7fa4d07c43ad79b88e6462119e7140eae955c ]
    
    Fully compatible with mcp2515, the mcp25625 have integrated transceiver.
    
    This patch adds support for the mcp25625 to the existing mcp251x driver.
    
    Signed-off-by: Sean Nyekjaer <sean@geanix.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 38012853a52f127d65f30a209c4e2e0f4ed41904
Author: Sean Nyekjaer <sean@geanix.com>
Date:   Tue May 7 11:34:37 2019 +0200

    dt-bindings: can: mcp251x: add mcp25625 support
    
    [ Upstream commit 0df82dcd55832a99363ab7f9fab954fcacdac3ae ]
    
    Fully compatible with mcp2515, the mcp25625 have integrated transceiver.
    
    This patch add the mcp25625 to the device tree bindings documentation.
    
    Signed-off-by: Sean Nyekjaer <sean@geanix.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ac1cd6c960bf60799a72ac23644ff5fd95b4021f
Author: Guillaume Nault <gnault@redhat.com>
Date:   Thu Jun 6 18:04:00 2019 +0200

    netfilter: ipv6: nf_defrag: accept duplicate fragments again
    
    [ Upstream commit 8a3dca632538c550930ce8bafa8c906b130d35cf ]
    
    When fixing the skb leak introduced by the conversion to rbtree, I
    forgot about the special case of duplicate fragments. The condition
    under the 'insert_error' label isn't effective anymore as
    nf_ct_frg6_gather() doesn't override the returned value anymore. So
    duplicate fragments now get NF_DROP verdict.
    
    To accept duplicate fragments again, handle them specially as soon as
    inet_frag_queue_insert() reports them. Return -EINPROGRESS which will
    translate to NF_STOLEN verdict, like any accepted fragment. However,
    such packets don't carry any new information and aren't queued, so we
    just drop them immediately.
    
    Fixes: a0d56cb911ca ("netfilter: ipv6: nf_defrag: fix leakage of unqueued fragments")
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 87a3cb06055668cde432d6d0350ebfc3384b5077
Author: Guillaume Nault <gnault@redhat.com>
Date:   Sun Jun 2 15:13:47 2019 +0200

    netfilter: ipv6: nf_defrag: fix leakage of unqueued fragments
    
    [ Upstream commit a0d56cb911ca301de81735f1d73c2aab424654ba ]
    
    With commit 997dd9647164 ("net: IP6 defrag: use rbtrees in
    nf_conntrack_reasm.c"), nf_ct_frag6_reasm() is now called from
    nf_ct_frag6_queue(). With this change, nf_ct_frag6_queue() can fail
    after the skb has been added to the fragment queue and
    nf_ct_frag6_gather() was adapted to handle this case.
    
    But nf_ct_frag6_queue() can still fail before the fragment has been
    queued. nf_ct_frag6_gather() can't handle this case anymore, because it
    has no way to know if nf_ct_frag6_queue() queued the fragment before
    failing. If it didn't, the skb is lost as the error code is overwritten
    with -EINPROGRESS.
    
    Fix this by setting -EINPROGRESS directly in nf_ct_frag6_queue(), so
    that nf_ct_frag6_gather() can propagate the error as is.
    
    Fixes: 997dd9647164 ("net: IP6 defrag: use rbtrees in nf_conntrack_reasm.c")
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58ec3690a908494f7a7c3e8a302eb491bef9d979
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed May 29 14:52:19 2019 +0200

    mwifiex: Fix possible buffer overflows at parsing bss descriptor
    
    [ Upstream commit 13ec7f10b87f5fc04c4ccbd491c94c7980236a74 ]
    
    mwifiex_update_bss_desc_with_ie() calls memcpy() unconditionally in
    a couple places without checking the destination size.  Since the
    source is given from user-space, this may trigger a heap buffer
    overflow.
    
    Fix it by putting the length check before performing memcpy().
    
    This fix addresses CVE-2019-3846.
    
    Reported-by: huangwen <huangwen@venustech.com.cn>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2bf0723fbf03d38db7cbe1ad16d0a26f5929f216
Author: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date:   Tue May 28 16:36:16 2019 -0700

    mac80211: free peer keys before vif down in mesh
    
    [ Upstream commit 0112fa557c3bb3a002bc85760dc3761d737264d3 ]
    
    freeing peer keys after vif down is resulting in peer key uninstall
    to fail due to interface lookup failure. so fix that.
    
    Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 606b65ebed2df8b4940bb69b9c36b0e99186b238
Author: Thomas Pedersen <thomas@eero.com>
Date:   Fri May 24 21:16:24 2019 -0700

    mac80211: mesh: fix RCU warning
    
    [ Upstream commit 551842446ed695641a00782cd118cbb064a416a1 ]
    
    ifmsh->csa is an RCU-protected pointer. The writer context
    in ieee80211_mesh_finish_csa() is already mutually
    exclusive with wdev->sdata.mtx, but the RCU checker did
    not know this. Use rcu_dereference_protected() to avoid a
    warning.
    
    fixes the following warning:
    
    [   12.519089] =============================
    [   12.520042] WARNING: suspicious RCU usage
    [   12.520652] 5.1.0-rc7-wt+ #16 Tainted: G        W
    [   12.521409] -----------------------------
    [   12.521972] net/mac80211/mesh.c:1223 suspicious rcu_dereference_check() usage!
    [   12.522928] other info that might help us debug this:
    [   12.523984] rcu_scheduler_active = 2, debug_locks = 1
    [   12.524855] 5 locks held by kworker/u8:2/152:
    [   12.525438]  #0: 00000000057be08c ((wq_completion)phy0){+.+.}, at: process_one_work+0x1a2/0x620
    [   12.526607]  #1: 0000000059c6b07a ((work_completion)(&sdata->csa_finalize_work)){+.+.}, at: process_one_work+0x1a2/0x620
    [   12.528001]  #2: 00000000f184ba7d (&wdev->mtx){+.+.}, at: ieee80211_csa_finalize_work+0x2f/0x90
    [   12.529116]  #3: 00000000831a1f54 (&local->mtx){+.+.}, at: ieee80211_csa_finalize_work+0x47/0x90
    [   12.530233]  #4: 00000000fd06f988 (&local->chanctx_mtx){+.+.}, at: ieee80211_csa_finalize_work+0x51/0x90
    
    Signed-off-by: Thomas Pedersen <thomas@eero.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 04c3ad7b1a7ae3a66733ec93ce1a3272b3c3e5f2
Author: Melissa Wen <melissa.srw@gmail.com>
Date:   Sat May 18 22:04:56 2019 -0300

    staging:iio:ad7150: fix threshold mode config bit
    
    [ Upstream commit df4d737ee4d7205aaa6275158aeebff87fd14488 ]
    
    According to the AD7150 configuration register description, bit 7 assumes
    value 1 when the threshold mode is fixed and 0 when it is adaptive,
    however, the operation that identifies this mode was considering the
    opposite values.
    
    This patch renames the boolean variable to describe it correctly and
    properly replaces it in the places where it is used.
    
    Fixes: 531efd6aa0991 ("staging:iio:adc:ad7150: chan_spec conv + i2c_smbus commands + drop unused poweroff timeout control.")
    Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 95a21e78295beed805a037669bcb20489cf14109
Author: Chang-Hsien Tsai <luke.tw@gmail.com>
Date:   Sun May 19 09:05:44 2019 +0000

    samples, bpf: fix to change the buffer size for read()
    
    [ Upstream commit f7c2d64bac1be2ff32f8e4f500c6e5429c1003e0 ]
    
    If the trace for read is larger than 4096, the return
    value sz will be 4096. This results in off-by-one error
    on buf:
    
        static char buf[4096];
        ssize_t sz;
    
        sz = read(trace_fd, buf, sizeof(buf));
        if (sz > 0) {
            buf[sz] = 0;
            puts(buf);
        }
    
    Signed-off-by: Chang-Hsien Tsai <luke.tw@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f36d287a761cd19825ba3b581d797e30e6572909
Author: Aaron Ma <aaron.ma@canonical.com>
Date:   Mon May 20 22:09:10 2019 -0700

    Input: elantech - enable middle button support on 2 ThinkPads
    
    [ Upstream commit aa440de3058a3ef530851f9ef373fbb5f694dbc3 ]
    
    Adding 2 new touchpad PNPIDs to enable middle button support.
    
    Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0aefa74846043d7a7ff761ed0b65fd17ebe5e0b4
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Tue May 21 13:34:08 2019 +0000

    crypto: talitos - rename alternative AEAD algos.
    
    commit a1a42f84011fae6ff08441a91aefeb7febc984fc upstream.
    
    The talitos driver has two ways to perform AEAD depending on the
    HW capability. Some HW support both. It is needed to give them
    different names to distingish which one it is for instance when
    a test fails.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Fixes: 7405c8d7ff97 ("crypto: talitos - templates for AEAD using HMAC_SNOOP_NO_AFEU")
    Cc: stable@vger.kernel.org
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>