commit dc4059d21d87e87054714d51a5325984f91c04b3
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Apr 17 10:50:26 2020 +0200

    Linux 5.4.33

commit 484cc15ad00f6f80b3c1d9a1464d4cc921c54d2b
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Nov 11 15:03:58 2019 -0800

    scsi: lpfc: fix inlining of lpfc_sli4_cleanup_poll_list()
    
    [ Upstream commit d480e57809a043333a3b9e755c0bdd43e10a9f12 ]
    
    Compilation can fail due to having an inline function reference where the
    function body is not present.
    
    Fix by removing the inline tag.
    
    Fixes: 93a4d6f40198 ("scsi: lpfc: Add registration for CPU Offline/Online events")
    
    Link: https://lore.kernel.org/r/20191111230401.12958-4-jsmart2021@gmail.com
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8dead2c275e41b599289f26948b4dd0276c46fd3
Author: Julia Lawall <Julia.Lawall@inria.fr>
Date:   Sun Apr 5 17:03:48 2020 +0200

    ASoC: stm32: sai: Add missing cleanup
    
    [ Upstream commit 7506baeed8d05fc164254c64af14cfed2ac14446 ]
    
    The commit 0d6defc7e0e4 ("ASoC: stm32: sai: manage rebind issue")
    converts some function calls to their non-devm equivalents.  The
    appropriate cleanup code was added to the remove function, but not
    to the probe function.  Add a call to snd_dmaengine_pcm_unregister
    to compensate for the call to snd_dmaengine_pcm_register in case
    of subsequent failure.
    
    Fixes: commit 0d6defc7e0e4 ("ASoC: stm32: sai: manage rebind issue")
    Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
    
    Acked-by: Olivier Moysan <olivier.moysan@st.com>
    Link: https://lore.kernel.org/r/1586099028-5104-1-git-send-email-Julia.Lawall@inria.fr
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aed5ee6befcc2c79391ff67cb707ff145304fea6
Author: Gary Lin <glin@suse.com>
Date:   Thu Apr 9 15:04:33 2020 +0200

    efi/x86: Fix the deletion of variables in mixed mode
    
    [ Upstream commit a4b81ccfd4caba017d2b84720b6de4edd16911a0 ]
    
    efi_thunk_set_variable() treated the NULL "data" pointer as an invalid
    parameter, and this broke the deletion of variables in mixed mode.
    This commit fixes the check of data so that the userspace program can
    delete a variable in mixed mode.
    
    Fixes: 8319e9d5ad98ffcc ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode")
    Signed-off-by: Gary Lin <glin@suse.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20200408081606.1504-1-glin@suse.com
    Link: https://lore.kernel.org/r/20200409130434.6736-9-ardb@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0c839eee166a56da378e999575b2bdf2ea95aa73
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed Feb 26 16:51:58 2020 +0200

    mfd: dln2: Fix sanity checking for endpoints
    
    [ Upstream commit fb945c95a482200876993977008b67ea658bd938 ]
    
    While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
    tries to harden the sanity checks it made at the same time a regression,
    i.e.  mixed in and out endpoints. Obviously it should have been not tested on
    real hardware at that time, but unluckily it didn't happen.
    
    So, fix above mentioned typo and make device being enumerated again.
    
    While here, introduce an enumerator for magic values to prevent similar issue
    to happen in the future.
    
    Fixes: 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
    Cc: Oliver Neukum <oneukum@suse.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b70eb420e96df1ceab3ca146989783d04757777c
Author: Jann Horn <jannh@google.com>
Date:   Mon Mar 30 18:03:23 2020 +0200

    bpf: Fix tnum constraints for 32-bit comparisons
    
    [ Upstream commit 604dca5e3af1db98bd123b7bfc02b017af99e3a0 ]
    
    The BPF verifier tried to track values based on 32-bit comparisons by
    (ab)using the tnum state via 581738a681b6 ("bpf: Provide better register
    bounds after jmp32 instructions"). The idea is that after a check like
    this:
    
        if ((u32)r0 > 3)
          exit
    
    We can't meaningfully constrain the arithmetic-range-based tracking, but
    we can update the tnum state to (value=0,mask=0xffff'ffff'0000'0003).
    However, the implementation from 581738a681b6 didn't compute the tnum
    constraint based on the fixed operand, but instead derives it from the
    arithmetic-range-based tracking. This means that after the following
    sequence of operations:
    
        if (r0 >= 0x1'0000'0001)
          exit
        if ((u32)r0 > 7)
          exit
    
    The verifier assumed that the lower half of r0 is in the range (0, 0)
    and apply the tnum constraint (value=0,mask=0xffff'ffff'0000'0000) thus
    causing the overall tnum to be (value=0,mask=0x1'0000'0000), which was
    incorrect. Provide a fixed implementation.
    
    Fixes: 581738a681b6 ("bpf: Provide better register bounds after jmp32 instructions")
    Signed-off-by: Jann Horn <jannh@google.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20200330160324.15259-3-daniel@iogearbox.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 26711cc7e0641781e696c775fa84f7415ff49b4e
Author: Faiz Abbas <faiz_abbas@ti.com>
Date:   Thu Jan 16 16:21:50 2020 +0530

    mmc: sdhci: Refactor sdhci_set_timeout()
    
    [ Upstream commit 7d76ed77cfbd39468ae58d419f537d35ca892d83 ]
    
    Refactor sdhci_set_timeout() such that platform drivers can do some
    functionality in a set_timeout() callback and then call
    __sdhci_set_timeout() to complete the operation.
    
    Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20200116105154.7685-7-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 56a296657e4bab76b1eb192d6ea7204e55810361
Author: Faiz Abbas <faiz_abbas@ti.com>
Date:   Thu Jan 16 16:21:49 2020 +0530

    mmc: sdhci: Convert sdhci_set_timeout_irq() to non-static
    
    [ Upstream commit 7907ebe741a7f14ed12889ebe770438a4ff47613 ]
    
    Export sdhci_set_timeout_irq() so that it is accessible from platform drivers.
    
    Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20200116105154.7685-6-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c1f3e1d8d7e6a06184e3511fd19c41ef8db33447
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Fri Mar 6 15:09:40 2020 +0000

    powerpc/kasan: Fix kasan_remap_early_shadow_ro()
    
    [ Upstream commit af92bad615be75c6c0d1b1c5b48178360250a187 ]
    
    At the moment kasan_remap_early_shadow_ro() does nothing, because
    k_end is 0 and k_cur < 0 is always true.
    
    Change the test to k_cur != k_end, as done in
    kasan_init_shadow_page_tables()
    
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Fixes: cbd18991e24f ("powerpc/mm: Fix an Oops in kasan_mmu_init()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/4e7b56865e01569058914c991143f5961b5d4719.1583507333.git.christophe.leroy@c-s.fr
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36b0b1f63994de6528a73b86ad7d8d3e19b3f61a
Author: Imre Deak <imre.deak@intel.com>
Date:   Mon Mar 30 18:22:44 2020 +0300

    drm/i915/icl+: Don't enable DDI IO power on a TypeC port in TBT mode
    
    The DDI IO power well must not be enabled for a TypeC port in TBT mode,
    ensure this during driver loading/system resume.
    
    This gets rid of error messages like
    [drm] *ERROR* power well DDI E TC2 IO state mismatch (refcount 1/enabled 0)
    
    and avoids leaking the power ref when disabling the output.
    
    Cc: <stable@vger.kernel.org> # v5.4+
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200330152244.11316-1-imre.deak@intel.com
    (cherry picked from commit f77a2db27f26c3ccba0681f7e89fef083718f07f)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bdac1d76a310578b3ad081df2db97da59e241010
Author: Prike Liang <Prike.Liang@amd.com>
Date:   Tue Apr 7 20:21:26 2020 +0800

    drm/amdgpu: fix gfx hang during suspend with video playback (v2)
    
    [ Upstream commit 487eca11a321ef33bcf4ca5adb3c0c4954db1b58 ]
    
    The system will be hang up during S3 suspend because of SMU is pending
    for GC not respose the register CP_HQD_ACTIVE access request.This issue
    root cause of accessing the GC register under enter GFX CGGPG and can
    be fixed by disable GFX CGPG before perform suspend.
    
    v2: Use disable the GFX CGPG instead of RLC safe mode guard.
    
    Signed-off-by: Prike Liang <Prike.Liang@amd.com>
    Tested-by: Mengbing Wang <Mengbing.Wang@amd.com>
    Reviewed-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d1bbdf003c052be9bd504db2392745151bc23ed8
Author: Lyude Paul <lyude@redhat.com>
Date:   Wed Jan 22 14:43:20 2020 -0500

    drm/dp_mst: Fix clearing payload state on topology disable
    
    [ Upstream commit 8732fe46b20c951493bfc4dba0ad08efdf41de81 ]
    
    The issues caused by:
    
    commit 64e62bdf04ab ("drm/dp_mst: Remove VCPI while disabling topology
    mgr")
    
    Prompted me to take a closer look at how we clear the payload state in
    general when disabling the topology, and it turns out there's actually
    two subtle issues here.
    
    The first is that we're not grabbing &mgr.payload_lock when clearing the
    payloads in drm_dp_mst_topology_mgr_set_mst(). Seeing as the canonical
    lock order is &mgr.payload_lock -> &mgr.lock (because we always want
    &mgr.lock to be the inner-most lock so topology validation always
    works), this makes perfect sense. It also means that -technically- there
    could be racing between someone calling
    drm_dp_mst_topology_mgr_set_mst() to disable the topology, along with a
    modeset occurring that's modifying the payload state at the same time.
    
    The second is the more obvious issue that Wayne Lin discovered, that
    we're not clearing proposed_payloads when disabling the topology.
    
    I actually can't see any obvious places where the racing caused by the
    first issue would break something, and it could be that some of our
    higher-level locks already prevent this by happenstance, but better safe
    then sorry. So, let's make it so that drm_dp_mst_topology_mgr_set_mst()
    first grabs &mgr.payload_lock followed by &mgr.lock so that we never
    race when modifying the payload state. Then, we also clear
    proposed_payloads to fix the original issue of enabling a new topology
    with a dirty payload state. This doesn't clear any of the drm_dp_vcpi
    structures, but those are getting destroyed along with the ports anyway.
    
    Changes since v1:
    * Use sizeof(mgr->payloads[0])/sizeof(mgr->proposed_vcpis[0]) instead -
      vsyrjala
    
    Cc: Sean Paul <sean@poorly.run>
    Cc: Wayne Lin <Wayne.Lin@amd.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: stable@vger.kernel.org # v4.4+
    Signed-off-by: Lyude Paul <lyude@redhat.com>
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200122194321.14953-1-lyude@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7676e69c67e38172a147ba0889bf50961ab93f0b
Author: Sasha Levin <sashal@kernel.org>
Date:   Wed Apr 15 22:08:22 2020 -0400

    Revert "drm/dp_mst: Remove VCPI while disabling topology mgr"
    
    [ Upstream commit a86675968e2300fb567994459da3dbc4cd1b322a ]
    
    This reverts commit 64e62bdf04ab8529f45ed0a85122c703035dec3a.
    
    This commit ends up causing some lockdep splats due to trying to grab the
    payload lock while holding the mgr's lock:
    
    [   54.010099]
    [   54.011765] ======================================================
    [   54.018670] WARNING: possible circular locking dependency detected
    [   54.025577] 5.5.0-rc6-02274-g77381c23ee63 #47 Not tainted
    [   54.031610] ------------------------------------------------------
    [   54.038516] kworker/1:6/1040 is trying to acquire lock:
    [   54.044354] ffff888272af3228 (&mgr->payload_lock){+.+.}, at:
    drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.054957]
    [   54.054957] but task is already holding lock:
    [   54.061473] ffff888272af3060 (&mgr->lock){+.+.}, at:
    drm_dp_mst_topology_mgr_set_mst+0x3c/0x2e4
    [   54.071193]
    [   54.071193] which lock already depends on the new lock.
    [   54.071193]
    [   54.080334]
    [   54.080334] the existing dependency chain (in reverse order) is:
    [   54.088697]
    [   54.088697] -> #1 (&mgr->lock){+.+.}:
    [   54.094440]        __mutex_lock+0xc3/0x498
    [   54.099015]        drm_dp_mst_topology_get_port_validated+0x25/0x80
    [   54.106018]        drm_dp_update_payload_part1+0xa2/0x2e2
    [   54.112051]        intel_mst_pre_enable_dp+0x144/0x18f
    [   54.117791]        intel_encoders_pre_enable+0x63/0x70
    [   54.123532]        hsw_crtc_enable+0xa1/0x722
    [   54.128396]        intel_update_crtc+0x50/0x194
    [   54.133455]        skl_commit_modeset_enables+0x40c/0x540
    [   54.139485]        intel_atomic_commit_tail+0x5f7/0x130d
    [   54.145418]        intel_atomic_commit+0x2c8/0x2d8
    [   54.150770]        drm_atomic_helper_set_config+0x5a/0x70
    [   54.156801]        drm_mode_setcrtc+0x2ab/0x833
    [   54.161862]        drm_ioctl+0x2e5/0x424
    [   54.166242]        vfs_ioctl+0x21/0x2f
    [   54.170426]        do_vfs_ioctl+0x5fb/0x61e
    [   54.175096]        ksys_ioctl+0x55/0x75
    [   54.179377]        __x64_sys_ioctl+0x1a/0x1e
    [   54.184146]        do_syscall_64+0x5c/0x6d
    [   54.188721]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [   54.194946]
    [   54.194946] -> #0 (&mgr->payload_lock){+.+.}:
    [   54.201463]
    [   54.201463] other info that might help us debug this:
    [   54.201463]
    [   54.210410]  Possible unsafe locking scenario:
    [   54.210410]
    [   54.217025]        CPU0                    CPU1
    [   54.222082]        ----                    ----
    [   54.227138]   lock(&mgr->lock);
    [   54.230643]                                lock(&mgr->payload_lock);
    [   54.237742]                                lock(&mgr->lock);
    [   54.244062]   lock(&mgr->payload_lock);
    [   54.248346]
    [   54.248346]  *** DEADLOCK ***
    [   54.248346]
    [   54.254959] 7 locks held by kworker/1:6/1040:
    [   54.259822]  #0: ffff888275c4f528 ((wq_completion)events){+.+.},
    at: worker_thread+0x455/0x6e2
    [   54.269451]  #1: ffffc9000119beb0
    ((work_completion)(&(&dev_priv->hotplug.hotplug_work)->work)){+.+.},
    at: worker_thread+0x455/0x6e2
    [   54.282768]  #2: ffff888272a403f0 (&dev->mode_config.mutex){+.+.},
    at: i915_hotplug_work_func+0x4b/0x2be
    [   54.293368]  #3: ffffffff824fc6c0 (drm_connector_list_iter){.+.+},
    at: i915_hotplug_work_func+0x17e/0x2be
    [   54.304061]  #4: ffffc9000119bc58 (crtc_ww_class_acquire){+.+.},
    at: drm_helper_probe_detect_ctx+0x40/0xfd
    [   54.314855]  #5: ffff888272a40470 (crtc_ww_class_mutex){+.+.}, at:
    drm_modeset_lock+0x74/0xe2
    [   54.324385]  #6: ffff888272af3060 (&mgr->lock){+.+.}, at:
    drm_dp_mst_topology_mgr_set_mst+0x3c/0x2e4
    [   54.334597]
    [   54.334597] stack backtrace:
    [   54.339464] CPU: 1 PID: 1040 Comm: kworker/1:6 Not tainted
    5.5.0-rc6-02274-g77381c23ee63 #47
    [   54.348893] Hardware name: Google Fizz/Fizz, BIOS
    Google_Fizz.10139.39.0 01/04/2018
    [   54.357451] Workqueue: events i915_hotplug_work_func
    [   54.362995] Call Trace:
    [   54.365724]  dump_stack+0x71/0x9c
    [   54.369427]  check_noncircular+0x91/0xbc
    [   54.373809]  ? __lock_acquire+0xc9e/0xf66
    [   54.378286]  ? __lock_acquire+0xc9e/0xf66
    [   54.382763]  ? lock_acquire+0x175/0x1ac
    [   54.387048]  ? drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.393177]  ? __mutex_lock+0xc3/0x498
    [   54.397362]  ? drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.403492]  ? drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.409620]  ? drm_dp_dpcd_access+0xd9/0x101
    [   54.414390]  ? drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.420517]  ? drm_dp_mst_topology_mgr_set_mst+0x218/0x2e4
    [   54.426645]  ? intel_digital_port_connected+0x34d/0x35c
    [   54.432482]  ? intel_dp_detect+0x227/0x44e
    [   54.437056]  ? ww_mutex_lock+0x49/0x9a
    [   54.441242]  ? drm_helper_probe_detect_ctx+0x75/0xfd
    [   54.446789]  ? intel_encoder_hotplug+0x4b/0x97
    [   54.451752]  ? intel_ddi_hotplug+0x61/0x2e0
    [   54.456423]  ? mark_held_locks+0x53/0x68
    [   54.460803]  ? _raw_spin_unlock_irqrestore+0x3a/0x51
    [   54.466347]  ? lockdep_hardirqs_on+0x187/0x1a4
    [   54.471310]  ? drm_connector_list_iter_next+0x89/0x9a
    [   54.476953]  ? i915_hotplug_work_func+0x206/0x2be
    [   54.482208]  ? worker_thread+0x4d5/0x6e2
    [   54.486587]  ? worker_thread+0x455/0x6e2
    [   54.490966]  ? queue_work_on+0x64/0x64
    [   54.495151]  ? kthread+0x1e9/0x1f1
    [   54.498946]  ? queue_work_on+0x64/0x64
    [   54.503130]  ? kthread_unpark+0x5e/0x5e
    [   54.507413]  ? ret_from_fork+0x3a/0x50
    
    The proper fix for this is probably cleanup the VCPI allocations when we're
    enabling the topology, or on the first payload allocation. For now though,
    let's just revert.
    
    Signed-off-by: Lyude Paul <lyude@redhat.com>
    Fixes: 64e62bdf04ab ("drm/dp_mst: Remove VCPI while disabling topology mgr")
    Cc: Sean Paul <sean@poorly.run>
    Cc: Wayne Lin <Wayne.Lin@amd.com>
    Reviewed-by: Sean Paul <sean@poorly.run>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200117205149.97262-1-lyude@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ba74ab0c29fc6a04b9fbfffd1e66d1bff0afba53
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Jan 27 16:23:03 2020 -0800

    scsi: lpfc: Fix broken Credit Recovery after driver load
    
    [ Upstream commit 835214f5d5f516a38069bc077c879c7da00d6108 ]
    
    When driver is set to enable bb credit recovery, the switch displayed the
    setting as inactive.  If the link bounces, it switches to Active.
    
    During link up processing, the driver currently does a MBX_READ_SPARAM
    followed by a MBX_CONFIG_LINK. These mbox commands are queued to be
    executed, one at a time and the completion is processed by the worker
    thread.  Since the MBX_READ_SPARAM is done BEFORE the MBX_CONFIG_LINK, the
    BB_SC_N bit is never set the the returned values. BB Credit recovery status
    only gets set after the driver requests the feature in CONFIG_LINK, which
    is done after the link up. Thus the ordering of READ_SPARAM needs to follow
    the CONFIG_LINK.
    
    Fix by reordering so that READ_SPARAM is done after CONFIG_LINK.  Added a
    HBA_DEFER_FLOGI flag so that any FLOGI handling waits until after the
    READ_SPARAM is done so that the proper BB credit value is set in the FLOGI
    payload.
    
    Fixes: 6bfb16208298 ("scsi: lpfc: Fix configuration of BB credit recovery in service parameters")
    Cc: <stable@vger.kernel.org> # v5.4+
    Link: https://lore.kernel.org/r/20200128002312.16346-4-jsmart2021@gmail.com
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 33ebae4f3ba6d05f90364877ad47d895415cd1f6
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Nov 4 16:56:59 2019 -0800

    scsi: lpfc: Fix configuration of BB credit recovery in service parameters
    
    [ Upstream commit 6bfb1620829825c01e1dcdd63b6a7700352babd9 ]
    
    The driver today is reading service parameters from the firmware and then
    overwriting the firmware-provided values with values of its own.  There are
    some switch features that require preliminary FLOGI's that are
    switch-specific and done prior to the actual fabric FLOGI for traffic.  The
    fw will perform those FLOGIs and will revise the service parameters for the
    features configured. As the driver later overwrites those values with its
    own values, it misconfigures things like BBSCN use by doing so.
    
    Correct by eliminating the driver-overwrite of firmware values. The driver
    correctly re-reads the service parameters after each link up to obtain the
    latest values from firmware.
    
    Link: https://lore.kernel.org/r/20191105005708.7399-3-jsmart2021@gmail.com
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 037b0b5521a4683f0d970eb5c1cd5fc7a39b10cc
Author: James Smart <jsmart2021@gmail.com>
Date:   Wed Dec 18 15:58:02 2019 -0800

    scsi: lpfc: Fix Fabric hostname registration if system hostname changes
    
    [ Upstream commit e3ba04c9bad1d1c7f15df43da25e878045150777 ]
    
    There are reports of multiple ports on the same system displaying different
    hostnames in fabric FDMI displays.
    
    Currently, the driver registers the hostname at initialization and obtains
    the hostname via init_utsname()->nodename queried at the time the FC link
    comes up. Unfortunately, if the machine hostname is updated after
    initialization, such as via DHCP or admin command, the value registered
    initially will be incorrect.
    
    Fix by having the driver save the hostname that was registered with FDMI.
    The driver then runs a heartbeat action that will check the hostname.  If
    the name changes, reregister the FMDI data.
    
    The hostname is used in RSNN_NN, FDMI RPA and FDMI RHBA.
    
    Link: https://lore.kernel.org/r/20191218235808.31922-5-jsmart2021@gmail.com
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f48e7593523e164b3969a6942b4adac138915dcd
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Nov 4 16:57:05 2019 -0800

    scsi: lpfc: Add registration for CPU Offline/Online events
    
    [ Upstream commit 93a4d6f40198dffcca35d9a928c409f9290f1fe0 ]
    
    The recent affinitization didn't address cpu offlining/onlining.  If an
    interrupt vector is shared and the low order cpu owning the vector is
    offlined, as interrupts are managed, the vector is taken offline. This
    causes the other CPUs sharing the vector will hang as they can't get io
    completions.
    
    Correct by registering callbacks with the system for Offline/Online
    events. When a cpu is taken offline, its eq, which is tied to an interrupt
    vector is found. If the cpu is the "owner" of the vector and if the
    eq/vector is shared by other CPUs, the eq is placed into a polled mode.
    Additionally, code paths that perform io submission on the "sharing CPUs"
    will check the eq state and poll for completion after submission of new io
    to a wq that uses the eq.
    
    Similarly, when a cpu comes back online and owns an offlined vector, the eq
    is taken out of polled mode and rearmed to start driving interrupts for eq.
    
    Link: https://lore.kernel.org/r/20191105005708.7399-9-jsmart2021@gmail.com
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 33344a7661a1e4780f3513505e0b354c59cfa76b
Author: Nikos Tsironis <ntsironis@arrikto.com>
Date:   Fri Mar 27 16:01:10 2020 +0200

    dm clone: Add missing casts to prevent overflows and data corruption
    
    [ Upstream commit 9fc06ff56845cc5ccafec52f545fc2e08d22f849 ]
    
    Add missing casts when converting from regions to sectors.
    
    In case BITS_PER_LONG == 32, the lack of the appropriate casts can lead
    to overflows and miscalculation of the device sector.
    
    As a result, we could end up discarding and/or copying the wrong parts
    of the device, thus corrupting the device's data.
    
    Fixes: 7431b7835f55 ("dm: add clone target")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2d7eb7ee36a3600118edc328b9aef9444a89f401
Author: Nikos Tsironis <ntsironis@arrikto.com>
Date:   Fri Mar 27 16:01:08 2020 +0200

    dm clone: Fix handling of partial region discards
    
    [ Upstream commit 4b5142905d4ff58a4b93f7c8eaa7ba829c0a53c9 ]
    
    There is a bug in the way dm-clone handles discards, which can lead to
    discarding the wrong blocks or trying to discard blocks beyond the end
    of the device.
    
    This could lead to data corruption, if the destination device indeed
    discards the underlying blocks, i.e., if the discard operation results
    in the original contents of a block to be lost.
    
    The root of the problem is the code that calculates the range of regions
    covered by a discard request and decides which regions to discard.
    
    Since dm-clone handles the device in units of regions, we don't discard
    parts of a region, only whole regions.
    
    The range is calculated as:
    
        rs = dm_sector_div_up(bio->bi_iter.bi_sector, clone->region_size);
        re = bio_end_sector(bio) >> clone->region_shift;
    
    , where 'rs' is the first region to discard and (re - rs) is the number
    of regions to discard.
    
    The bug manifests when we try to discard part of a single region, i.e.,
    when we try to discard a block with size < region_size, and the discard
    request both starts at an offset with respect to the beginning of that
    region and ends before the end of the region.
    
    The root cause is the following comparison:
    
      if (rs == re)
        // skip discard and complete original bio immediately
    
    , which doesn't take into account that 'rs' might be greater than 're'.
    
    Thus, we then issue a discard request for the wrong blocks, instead of
    skipping the discard all together.
    
    Fix the check to also take into account the above case, so we don't end
    up discarding the wrong blocks.
    
    Also, add some range checks to dm_clone_set_region_hydrated() and
    dm_clone_cond_set_range(), which update dm-clone's region bitmap.
    
    Note that the aforementioned bug doesn't cause invalid memory accesses,
    because dm_clone_is_range_hydrated() returns True for this case, so the
    checks are just precautionary.
    
    Fixes: 7431b7835f55 ("dm: add clone target")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dcf2f00b0869bd7412481bc865e2f4d567fc55f8
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Oct 4 10:17:37 2019 -0400

    dm clone: replace spin_lock_irqsave with spin_lock_irq
    
    [ Upstream commit 6ca43ed8376a51afec790dd484a51804ade4352a ]
    
    If we are in a place where it is known that interrupts are enabled,
    functions spin_lock_irq/spin_unlock_irq should be used instead of
    spin_lock_irqsave/spin_unlock_irqrestore.
    
    spin_lock_irq and spin_unlock_irq are faster because they don't need to
    push and pop the flags register.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fddfa591da8e0829ab7ebde8f8efb9b87f01f14a
Author: Bob Liu <bob.liu@oracle.com>
Date:   Tue Mar 24 21:22:45 2020 +0800

    dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone()
    
    [ Upstream commit b8fdd090376a7a46d17db316638fe54b965c2fb0 ]
    
    zmd->nr_rnd_zones was increased twice by mistake. The other place it
    is increased in dmz_init_zone() is the only one needed:
    
    1131                 zmd->nr_useable_zones++;
    1132                 if (dmz_is_rnd(zone)) {
    1133                         zmd->nr_rnd_zones++;
                                            ^^^
    Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bob Liu <bob.liu@oracle.com>
    Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1ba26c2aedb4f3a3f84fb7c481a329cb56677243
Author: Mark Brown <broonie@kernel.org>
Date:   Tue Mar 31 20:44:59 2020 +0100

    arm64: Always force a branch protection mode when the compiler has one
    
    commit b8fdef311a0bd9223f10754f94fdcf1a594a3457 upstream.
    
    Compilers with branch protection support can be configured to enable it by
    default, it is likely that distributions will do this as part of deploying
    branch protection system wide. As well as the slight overhead from having
    some extra NOPs for unused branch protection features this can cause more
    serious problems when the kernel is providing pointer authentication to
    userspace but not built for pointer authentication itself. In that case our
    switching of keys for userspace can affect the kernel unexpectedly, causing
    pointer authentication instructions in the kernel to corrupt addresses.
    
    To ensure that we get consistent and reliable behaviour always explicitly
    initialise the branch protection mode, ensuring that the kernel is built
    the same way regardless of the compiler defaults.
    
    [This is a reworked version of b8fdef311a0bd9223f1075 ("arm64: Always
    force a branch protection mode when the compiler has one") for backport.
    Kernels prior to 74afda4016a7 ("arm64: compile the kernel with ptrauth
    return address signing") don't have any Makefile machinery for forcing
    on pointer auth but still have issues if the compiler defaults it on so
    need this reworked version. -- broonie]
    
    Fixes: 7503197562567 (arm64: add basic pointer authentication support)
    Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    [catalin.marinas@arm.com: remove Kconfig option in favour of Makefile check]
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ba7581be850be4f031d20796045e49b63b43010e
Author: Clement Courbet <courbet@google.com>
Date:   Mon Mar 30 10:03:56 2020 +0200

    powerpc: Make setjmp/longjmp signature standard
    
    commit c17eb4dca5a353a9dbbb8ad6934fe57af7165e91 upstream.
    
    Declaring setjmp()/longjmp() as taking longs makes the signature
    non-standard, and makes clang complain. In the past, this has been
    worked around by adding -ffreestanding to the compile flags.
    
    The implementation looks like it only ever propagates the value
    (in longjmp) or sets it to 1 (in setjmp), and we only call longjmp
    with integer parameters.
    
    This allows removing -ffreestanding from the compilation flags.
    
    Fixes: c9029ef9c957 ("powerpc: Avoid clang warnings around setjmp and longjmp")
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Clement Courbet <courbet@google.com>
    Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
    Tested-by: Nathan Chancellor <natechancellor@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200330080400.124803-1-courbet@google.com
    Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3457b2232eaf5d22289b4b6e477cb3f302aa91db
Author: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Date:   Fri Mar 27 05:52:43 2020 -0400

    scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug
    
    commit cc41f11a21a51d6869d71e525a7264c748d7c0d7 upstream.
    
    Generic protection fault type kernel panic is observed when user performs
    soft (ordered) HBA unplug operation while IOs are running on drives
    connected to HBA.
    
    When user performs ordered HBA removal operation, the kernel calls PCI
    device's .remove() call back function where driver is flushing out all the
    outstanding SCSI IO commands with DID_NO_CONNECT host byte and also unmaps
    sg buffers allocated for these IO commands.
    
    However, in the ordered HBA removal case (unlike of real HBA hot removal),
    HBA device is still alive and hence HBA hardware is performing the DMA
    operations to those buffers on the system memory which are already unmapped
    while flushing out the outstanding SCSI IO commands and this leads to
    kernel panic.
    
    Don't flush out the outstanding IOs from .remove() path in case of ordered
    removal since HBA will be still alive in this case and it can complete the
    outstanding IOs. Flush out the outstanding IOs only in case of 'physical
    HBA hot unplug' where there won't be any communication with the HBA.
    
    During shutdown also it is possible that HBA hardware can perform DMA
    operations on those outstanding IO buffers which are completed with
    DID_NO_CONNECT by the driver from .shutdown(). So same above fix is applied
    in shutdown path as well.
    
    It is safe to drop the outstanding commands when HBA is inaccessible such
    as when permanent PCI failure happens, when HBA is in non-operational
    state, or when someone does a real HBA hot unplug operation. Since driver
    knows that HBA is inaccessible during these cases, it is safe to drop the
    outstanding commands instead of waiting for SCSI error recovery to kick in
    and clear these outstanding commands.
    
    Link: https://lore.kernel.org/r/1585302763-23007-1-git-send-email-sreekanth.reddy@broadcom.com
    Fixes: c666d3be99c0 ("scsi: mpt3sas: wait for and flush running commands on shutdown/unload")
    Cc: stable@vger.kernel.org #v4.14.174+
    Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e294f8a5ad31e21b43c9ab2b80e71cc1fea916dc
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri Mar 20 14:21:16 2020 +1100

    powerpc/64: Prevent stack protection in early boot
    
    commit 7053f80d96967d8e72e9f2a724bbfc3906ce2b07 upstream.
    
    The previous commit reduced the amount of code that is run before we
    setup a paca. However there are still a few remaining functions that
    run with no paca, or worse, with an arbitrary value in r13 that will
    be used as a paca pointer.
    
    In particular the stack protector canary is stored in the paca, so if
    stack protector is activated for any of these functions we will read
    the stack canary from wherever r13 points. If r13 happens to point
    outside of memory we will get a machine check / checkstop.
    
    For example if we modify initialise_paca() to trigger stack
    protection, and then boot in the mambo simulator with r13 poisoned in
    skiboot before calling the kernel:
    
      DEBUG: 19952232: (19952232): INSTRUCTION: PC=0xC0000000191FC1E8: [0x3C4C006D]: addis   r2,r12,0x6D [fetch]
      DEBUG: 19952236: (19952236): INSTRUCTION: PC=0xC00000001807EAD8: [0x7D8802A6]: mflr    r12 [fetch]
      FATAL ERROR: 19952276: (19952276): Check Stop for 0:0: Machine Check with ME bit of MSR off
      DEBUG: 19952276: (19952276): INSTRUCTION: PC=0xC0000000191FCA7C: [0xE90D0CF8]: ld      r8,0xCF8(r13) [Instruction Failed]
      INFO: 19952276: (19952277): ** Execution stopped: Mambo Error, Machine Check Stop,  **
      systemsim % bt
      pc:                             0xC0000000191FCA7C      initialise_paca+0x54
      lr:                             0xC0000000191FC22C      early_setup+0x44
      stack:0x00000000198CBED0        0x0     +0x0
      stack:0x00000000198CBF00        0xC0000000191FC22C      early_setup+0x44
      stack:0x00000000198CBF90        0x1801C968      +0x1801C968
    
    So annotate the relevant functions to ensure stack protection is never
    enabled for them.
    
    Fixes: 06ec27aea9fc ("powerpc/64: add stack protector support")
    Cc: stable@vger.kernel.org # v4.20+
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200320032116.1024773-2-mpe@ellerman.id.au
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc8755dc01d17cd8cb623d4523e52774f6bdb8ac
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Tue Feb 18 19:38:27 2020 +0000

    powerpc/kprobes: Ignore traps that happened in real mode
    
    commit 21f8b2fa3ca5b01f7a2b51b89ce97a3705a15aa0 upstream.
    
    When a program check exception happens while MMU translation is
    disabled, following Oops happens in kprobe_handler() in the following
    code:
    
            } else if (*addr != BREAKPOINT_INSTRUCTION) {
    
      BUG: Unable to handle kernel data access on read at 0x0000e268
      Faulting instruction address: 0xc000ec34
      Oops: Kernel access of bad area, sig: 11 [#1]
      BE PAGE_SIZE=16K PREEMPT CMPC885
      Modules linked in:
      CPU: 0 PID: 429 Comm: cat Not tainted 5.6.0-rc1-s3k-dev-00824-g84195dc6c58a #3267
      NIP:  c000ec34 LR: c000ecd8 CTR: c019cab8
      REGS: ca4d3b58 TRAP: 0300   Not tainted  (5.6.0-rc1-s3k-dev-00824-g84195dc6c58a)
      MSR:  00001032 <ME,IR,DR,RI>  CR: 2a4d3c52  XER: 00000000
      DAR: 0000e268 DSISR: c0000000
      GPR00: c000b09c ca4d3c10 c66d0620 00000000 ca4d3c60 00000000 00009032 00000000
      GPR08: 00020000 00000000 c087de44 c000afe0 c66d0ad0 100d3dd6 fffffff3 00000000
      GPR16: 00000000 00000041 00000000 ca4d3d70 00000000 00000000 0000416d 00000000
      GPR24: 00000004 c53b6128 00000000 0000e268 00000000 c07c0000 c07bb6fc ca4d3c60
      NIP [c000ec34] kprobe_handler+0x128/0x290
      LR [c000ecd8] kprobe_handler+0x1cc/0x290
      Call Trace:
      [ca4d3c30] [c000b09c] program_check_exception+0xbc/0x6fc
      [ca4d3c50] [c000e43c] ret_from_except_full+0x0/0x4
      --- interrupt: 700 at 0xe268
      Instruction dump:
      913e0008 81220000 38600001 3929ffff 91220000 80010024 bb410008 7c0803a6
      38210020 4e800020 38600000 4e800020 <813b0000> 6d2a7fe0 2f8a0008 419e0154
      ---[ end trace 5b9152d4cdadd06d ]---
    
    kprobe is not prepared to handle events in real mode and functions
    running in real mode should have been blacklisted, so kprobe_handler()
    can safely bail out telling 'this trap is not mine' for any trap that
    happened while in real-mode.
    
    If the trap happened with MSR_IR or MSR_DR cleared, return 0
    immediately.
    
    Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
    Fixes: 6cc89bad60a6 ("powerpc/kprobes: Invoke handlers directly")
    Cc: stable@vger.kernel.org # v4.10+
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/424331e2006e7291a1bfe40e7f3fa58825f565e1.1582054578.git.christophe.leroy@c-s.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed6f6b2b39afa6ce2d73f9241808aed211e2b347
Author: Cédric Le Goater <clg@kaod.org>
Date:   Fri Mar 6 16:01:41 2020 +0100

    powerpc/xive: Fix xmon support on the PowerNV platform
    
    commit 97ef275077932c65b1b8ec5022abd737a9fbf3e0 upstream.
    
    The PowerNV platform has multiple IRQ chips and the xmon command
    dumping the state of the XIVE interrupt should only operate on the
    XIVE IRQ chip.
    
    Fixes: 5896163f7f91 ("powerpc/xmon: Improve output of XIVE interrupts")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Greg Kurz <groug@kaod.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200306150143.5551-3-clg@kaod.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1ab730b659463dd4f3d0cf1f9134285be0ec88f1
Author: Daniel Axtens <dja@axtens.net>
Date:   Fri Mar 20 14:21:15 2020 +1100

    powerpc/64: Setup a paca before parsing device tree etc.
    
    commit d4a8e98621543d5798421eed177978bf2b3cdd11 upstream.
    
    Currently we set up the paca after parsing the device tree for CPU
    features. Prior to that, r13 contains random data, which means there
    is random data in r13 while we're running the generic dt parsing code.
    
    This random data varies depending on whether we boot through a vmlinux
    or a zImage: for the vmlinux case it's usually around zero, but for
    zImages we see random values like 912a72603d420015.
    
    This is poor practice, and can also lead to difficult-to-debug
    crashes. For example, when kcov is enabled, the kcov instrumentation
    attempts to read preempt_count out of the current task, which goes via
    the paca. This then crashes in the zImage case.
    
    Similarly stack protector can cause crashes if r13 is bogus, by
    reading from the stack canary in the paca.
    
    To resolve this:
    
     - move the paca setup to before the CPU feature parsing.
    
     - because we no longer have access to CPU feature flags in paca
     setup, change the HV feature test in the paca setup path to consider
     the actual value of the MSR rather than the CPU feature.
    
    Translations get switched on once we leave early_setup, so I think
    we'd already catch any other cases where the paca or task aren't set
    up.
    
    Boot tested on a P9 guest and host.
    
    Fixes: fb0b0a73b223 ("powerpc: Enable kcov")
    Fixes: 06ec27aea9fc ("powerpc/64: add stack protector support")
    Cc: stable@vger.kernel.org # v4.20+
    Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
    Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Daniel Axtens <dja@axtens.net>
    [mpe: Reword comments & change log a bit to mention stack protector]
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200320032116.1024773-1-mpe@ellerman.id.au
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9240f83aa9c7736576a40f69c5aa7560bbd9c7ae
Author: Cédric Le Goater <clg@kaod.org>
Date:   Fri Mar 6 16:01:40 2020 +0100

    powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs
    
    commit b1a504a6500df50e83b701b7946b34fce27ad8a3 upstream.
    
    When a CPU is brought up, an IPI number is allocated and recorded
    under the XIVE CPU structure. Invalid IPI numbers are tracked with
    interrupt number 0x0.
    
    On the PowerNV platform, the interrupt number space starts at 0x10 and
    this works fine. However, on the sPAPR platform, it is possible to
    allocate the interrupt number 0x0 and this raises an issue when CPU 0
    is unplugged. The XIVE spapr driver tracks allocated interrupt numbers
    in a bitmask and it is not correctly updated when interrupt number 0x0
    is freed. It stays allocated and it is then impossible to reallocate.
    
    Fix by using the XIVE_BAD_IRQ value instead of zero on both platforms.
    
    Reported-by: David Gibson <david@gibson.dropbear.id.au>
    Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrupt controller")
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
    Tested-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200306150143.5551-2-clg@kaod.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bd0fa144737c6bc333c2d605bd615a8a4d58ca05
Author: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Date:   Fri Mar 13 15:18:42 2020 +0530

    powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries
    
    commit 36b78402d97a3b9aeab136feb9b00d8647ec2c20 upstream.
    
    H_PAGE_THP_HUGE is used to differentiate between a THP hugepage and
    hugetlb hugepage entries. The difference is WRT how we handle hash
    fault on these address. THP address enables MPSS in segments. We want
    to manage devmap hugepage entries similar to THP pt entries. Hence use
    H_PAGE_THP_HUGE for devmap huge PTE entries.
    
    With current code while handling hash PTE fault, we do set is_thp =
    true when finding devmap PTE huge PTE entries.
    
    Current code also does the below sequence we setting up huge devmap
    entries.
    
            entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));
            if (pfn_t_devmap(pfn))
                    entry = pmd_mkdevmap(entry);
    
    In that case we would find both H_PAGE_THP_HUGE and PAGE_DEVMAP set
    for huge devmap PTE entries. This results in false positive error like
    below.
    
      kernel BUG at /home/kvaneesh/src/linux/mm/memory.c:4321!
      Oops: Exception in kernel mode, sig: 5 [#1]
      LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
      Modules linked in:
      CPU: 56 PID: 67996 Comm: t_mmap_dio Not tainted 5.6.0-rc4-59640-g371c804dedbc #128
      ....
      NIP [c00000000044c9e4] __follow_pte_pmd+0x264/0x900
      LR [c0000000005d45f8] dax_writeback_one+0x1a8/0x740
      Call Trace:
        str_spec.74809+0x22ffb4/0x2d116c (unreliable)
        dax_writeback_one+0x1a8/0x740
        dax_writeback_mapping_range+0x26c/0x700
        ext4_dax_writepages+0x150/0x5a0
        do_writepages+0x68/0x180
        __filemap_fdatawrite_range+0x138/0x180
        file_write_and_wait_range+0xa4/0x110
        ext4_sync_file+0x370/0x6e0
        vfs_fsync_range+0x70/0xf0
        sys_msync+0x220/0x2e0
        system_call+0x5c/0x68
    
    This is because our pmd_trans_huge check doesn't exclude _PAGE_DEVMAP.
    
    To make this all consistent, update pmd_mkdevmap to set
    H_PAGE_THP_HUGE and pmd_trans_huge check now excludes _PAGE_DEVMAP
    correctly.
    
    Fixes: ebd31197931d ("powerpc/mm: Add devmap support for ppc64")
    Cc: stable@vger.kernel.org # v4.13+
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200313094842.351830-1-aneesh.kumar@linux.ibm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 81b9336ab20eda1e5a95be688085508a0e441d11
Author: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Date:   Thu Jan 23 11:19:25 2020 +0000

    powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
    
    commit aa4113340ae6c2811e046f08c2bc21011d20a072 upstream.
    
    In the current implementation, the call to loadcam_multi() is wrapped
    between switch_to_as1() and restore_to_as0() calls so, when it tries
    to create its own temporary AS=1 TLB1 entry, it ends up duplicating
    the existing one created by switch_to_as1(). Add a check to skip
    creating the temporary entry if already running in AS=1.
    
    Fixes: d9e1831a4202 ("powerpc/85xx: Load all early TLB entries at once")
    Cc: stable@vger.kernel.org # v4.4+
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
    Acked-by: Scott Wood <oss@buserror.net>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200123111914.2565-1-laurentiu.tudor@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 38aa7f32dfd8b1a0526597cb0cea81e4f93b33ea
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Tue Mar 31 22:47:19 2020 +1100

    powerpc/64/tm: Don't let userspace set regs->trap via sigreturn
    
    commit c7def7fbdeaa25feaa19caf4a27c5d10bd8789e4 upstream.
    
    In restore_tm_sigcontexts() we take the trap value directly from the
    user sigcontext with no checking:
    
            err |= __get_user(regs->trap, &sc->gp_regs[PT_TRAP]);
    
    This means we can be in the kernel with an arbitrary regs->trap value.
    
    Although that's not immediately problematic, there is a risk we could
    trigger one of the uses of CHECK_FULL_REGS():
    
            #define CHECK_FULL_REGS(regs)   BUG_ON(regs->trap & 1)
    
    It can also cause us to unnecessarily save non-volatile GPRs again in
    save_nvgprs(), which shouldn't be problematic but is still wrong.
    
    It's also possible it could trick the syscall restart machinery, which
    relies on regs->trap not being == 0xc00 (see 9a81c16b5275 ("powerpc:
    fix double syscall restarts")), though I haven't been able to make
    that happen.
    
    Finally it doesn't match the behaviour of the non-TM case, in
    restore_sigcontext() which zeroes regs->trap.
    
    So change restore_tm_sigcontexts() to zero regs->trap.
    
    This was discovered while testing Nick's upcoming rewrite of the
    syscall entry path. In that series the call to save_nvgprs() prior to
    signal handling (do_notify_resume()) is removed, which leaves the
    low-bit of regs->trap uncleared which can then trigger the FULL_REGS()
    WARNs in setup_tm_sigcontexts().
    
    Fixes: 2b0a576d15e0 ("powerpc: Add new transactional memory state to the signal context")
    Cc: stable@vger.kernel.org # v3.9+
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200401023836.3286664-1-mpe@ellerman.id.au
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0abc07d23c51a61ed2d042828818da49088691a4
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Apr 3 11:00:34 2020 +0200

    xen/blkfront: fix memory allocation flags in blkfront_setup_indirect()
    
    commit 3a169c0be75b59dd85d159493634870cdec6d3c4 upstream.
    
    Commit 1d5c76e664333 ("xen-blkfront: switch kcalloc to kvcalloc for
    large array allocation") didn't fix the issue it was meant to, as the
    flags for allocating the memory are GFP_NOIO, which will lead the
    memory allocation falling back to kmalloc().
    
    So instead of GFP_NOIO use GFP_KERNEL and do all the memory allocation
    in blkfront_setup_indirect() in a memalloc_noio_{save,restore} section.
    
    Fixes: 1d5c76e664333 ("xen-blkfront: switch kcalloc to kvcalloc for large array allocation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Link: https://lore.kernel.org/r/20200403090034.8753-1-jgross@suse.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5fdf01181cb8a7a86385002f875ff2d8ddab0eb9
Author: Wen Yang <wenyang@linux.alibaba.com>
Date:   Fri Apr 3 17:04:08 2020 +0800

    ipmi: fix hung processes in __get_guid()
    
    commit 32830a0534700f86366f371b150b17f0f0d140d7 upstream.
    
    The wait_event() function is used to detect command completion.
    When send_guid_cmd() returns an error, smi_send() has not been
    called to send data. Therefore, wait_event() should not be used
    on the error path, otherwise it will cause the following warning:
    
    [ 1361.588808] systemd-udevd   D    0  1501   1436 0x00000004
    [ 1361.588813]  ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40
    [ 1361.677952]  ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010
    [ 1361.767077]  00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000
    [ 1361.856199] Call Trace:
    [ 1361.885578]  [<ffffffff8173ca3b>] ? __schedule+0x23b/0x780
    [ 1361.951406]  [<ffffffff8173cfb6>] schedule+0x36/0x80
    [ 1362.010979]  [<ffffffffa071f178>] get_guid+0x118/0x150 [ipmi_msghandler]
    [ 1362.091281]  [<ffffffff810d5350>] ? prepare_to_wait_event+0x100/0x100
    [ 1362.168533]  [<ffffffffa071f755>] ipmi_register_smi+0x405/0x940 [ipmi_msghandler]
    [ 1362.258337]  [<ffffffffa0230ae9>] try_smi_init+0x529/0x950 [ipmi_si]
    [ 1362.334521]  [<ffffffffa022f350>] ? std_irq_setup+0xd0/0xd0 [ipmi_si]
    [ 1362.411701]  [<ffffffffa0232bd2>] init_ipmi_si+0x492/0x9e0 [ipmi_si]
    [ 1362.487917]  [<ffffffffa0232740>] ? ipmi_pci_probe+0x280/0x280 [ipmi_si]
    [ 1362.568219]  [<ffffffff810021a0>] do_one_initcall+0x50/0x180
    [ 1362.636109]  [<ffffffff812231b2>] ? kmem_cache_alloc_trace+0x142/0x190
    [ 1362.714330]  [<ffffffff811b2ae1>] do_init_module+0x5f/0x200
    [ 1362.781208]  [<ffffffff81123ca8>] load_module+0x1898/0x1de0
    [ 1362.848069]  [<ffffffff811202e0>] ? __symbol_put+0x60/0x60
    [ 1362.913886]  [<ffffffff8130696b>] ? security_kernel_post_read_file+0x6b/0x80
    [ 1362.998514]  [<ffffffff81124465>] SYSC_finit_module+0xe5/0x120
    [ 1363.068463]  [<ffffffff81124465>] ? SYSC_finit_module+0xe5/0x120
    [ 1363.140513]  [<ffffffff811244be>] SyS_finit_module+0xe/0x10
    [ 1363.207364]  [<ffffffff81003c04>] do_syscall_64+0x74/0x180
    
    Fixes: 50c812b2b951 ("[PATCH] ipmi: add full sysfs support")
    Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
    Cc: Corey Minyard <minyard@acm.org>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: openipmi-developer@lists.sourceforge.net
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org # 2.6.17-
    Message-Id: <20200403090408.58745-1-wenyang@linux.alibaba.com>
    Signed-off-by: Corey Minyard <cminyard@mvista.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d0b9bd4804a763bdef7469ea17cc833f666eb141
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Wed Mar 27 17:02:54 2019 +0800

    libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
    
    commit 8305f72f952cff21ce8109dc1ea4b321c8efc5af upstream.
    
    During system resume from suspend, this can be observed on ASM1062 PMP
    controller:
    
    ata10.01: SATA link down (SStatus 0 SControl 330)
    ata10.02: hard resetting link
    ata10.02: SATA link down (SStatus 0 SControl 330)
    ata10.00: configured for UDMA/133
    Kernel panic - not syncing: stack-protector: Kernel
     in: sata_pmp_eh_recover+0xa2b/0xa40
    
    CPU: 2 PID: 230 Comm: scsi_eh_9 Tainted: P OE
    #49-Ubuntu
    Hardware name: System manufacturer System Product
     1001 12/10/2017
    Call Trace:
    dump_stack+0x63/0x8b
    panic+0xe4/0x244
    ? sata_pmp_eh_recover+0xa2b/0xa40
    __stack_chk_fail+0x19/0x20
    sata_pmp_eh_recover+0xa2b/0xa40
    ? ahci_do_softreset+0x260/0x260 [libahci]
    ? ahci_do_hardreset+0x140/0x140 [libahci]
    ? ata_phys_link_offline+0x60/0x60
    ? ahci_stop_engine+0xc0/0xc0 [libahci]
    sata_pmp_error_handler+0x22/0x30
    ahci_error_handler+0x45/0x80 [libahci]
    ata_scsi_port_error_handler+0x29b/0x770
    ? ata_scsi_cmd_error_handler+0x101/0x140
    ata_scsi_error+0x95/0xd0
    ? scsi_try_target_reset+0x90/0x90
    scsi_error_handler+0xd0/0x5b0
    kthread+0x121/0x140
    ? scsi_eh_get_sense+0x200/0x200
    ? kthread_create_worker_on_cpu+0x70/0x70
    ret_from_fork+0x22/0x40
    Kernel Offset: 0xcc00000 from 0xffffffff81000000
    (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
    
    Since sata_pmp_eh_recover_pmp() doens't set rc when ATA_DFLAG_DETACH is
    set, sata_pmp_eh_recover() continues to run. During retry it triggers
    the stack protector.
    
    Set correct rc in sata_pmp_eh_recover_pmp() to let sata_pmp_eh_recover()
    jump to pmp_fail directly.
    
    BugLink: https://bugs.launchpad.net/bugs/1821434
    Cc: stable@vger.kernel.org
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec2c054e87a5dc0751b166e09bfcde2f45fd1ae6
Author: Simon Gander <simon@tuxera.com>
Date:   Fri Apr 10 14:32:16 2020 -0700

    hfsplus: fix crash and filesystem corruption when deleting files
    
    commit 25efb2ffdf991177e740b2f63e92b4ec7d310a92 upstream.
    
    When removing files containing extended attributes, the hfsplus driver may
    remove the wrong entries from the attributes b-tree, causing major
    filesystem damage and in some cases even kernel crashes.
    
    To remove a file, all its extended attributes have to be removed as well.
    The driver does this by looking up all keys in the attributes b-tree with
    the cnid of the file.  Each of these entries then gets deleted using the
    key used for searching, which doesn't contain the attribute's name when it
    should.  Since the key doesn't contain the name, the deletion routine will
    not find the correct entry and instead remove the one in front of it.  If
    parent nodes have to be modified, these become corrupt as well.  This
    causes invalid links and unsorted entries that not even macOS's fsck_hfs
    is able to fix.
    
    To fix this, modify the search key before an entry is deleted from the
    attributes b-tree by copying the found entry's key into the search key,
    therefore ensuring that the correct entry gets removed from the tree.
    
    Signed-off-by: Simon Gander <simon@tuxera.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
    Cc: <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/20200327155541.1521-1-simon@tuxera.com
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af80e6f70f72a0d8ffc85865b256571ab490e25e
Author: Oliver O'Halloran <oohall@gmail.com>
Date:   Thu Feb 6 17:26:21 2020 +1100

    cpufreq: powernv: Fix use-after-free
    
    commit d0a72efac89d1c35ac55197895201b7b94c5e6ef upstream.
    
    The cpufreq driver has a use-after-free that we can hit if:
    
    a) There's an OCC message pending when the notifier is registered, and
    b) The cpufreq driver fails to register with the core.
    
    When a) occurs the notifier schedules a workqueue item to handle the
    message. The backing work_struct is located on chips[].throttle and
    when b) happens we clean up by freeing the array. Once we get to
    the (now free) queued item and the kernel crashes.
    
    Fixes: c5e29ea7ac14 ("cpufreq: powernv: Fix bugs in powernv_cpufreq_{init/exit}")
    Cc: stable@vger.kernel.org # v4.6+
    Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
    Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200206062622.28235-1-oohall@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9cc4f52d34a2dcbf8b863c7060100edeb916a6df
Author: Eric Biggers <ebiggers@google.com>
Date:   Fri Apr 10 14:33:43 2020 -0700

    kmod: make request_module() return an error when autoloading is disabled
    
    commit d7d27cfc5cf0766a26a8f56868c5ad5434735126 upstream.
    
    Patch series "module autoloading fixes and cleanups", v5.
    
    This series fixes a bug where request_module() was reporting success to
    kernel code when module autoloading had been completely disabled via
    'echo > /proc/sys/kernel/modprobe'.
    
    It also addresses the issues raised on the original thread
    (https://lkml.kernel.org/lkml/20200310223731.126894-1-ebiggers@kernel.org/T/#u)
    bydocumenting the modprobe sysctl, adding a self-test for the empty path
    case, and downgrading a user-reachable WARN_ONCE().
    
    This patch (of 4):
    
    It's long been possible to disable kernel module autoloading completely
    (while still allowing manual module insertion) by setting
    /proc/sys/kernel/modprobe to the empty string.
    
    This can be preferable to setting it to a nonexistent file since it
    avoids the overhead of an attempted execve(), avoids potential
    deadlocks, and avoids the call to security_kernel_module_request() and
    thus on SELinux-based systems eliminates the need to write SELinux rules
    to dontaudit module_request.
    
    However, when module autoloading is disabled in this way,
    request_module() returns 0.  This is broken because callers expect 0 to
    mean that the module was successfully loaded.
    
    Apparently this was never noticed because this method of disabling
    module autoloading isn't used much, and also most callers don't use the
    return value of request_module() since it's always necessary to check
    whether the module registered its functionality or not anyway.
    
    But improperly returning 0 can indeed confuse a few callers, for example
    get_fs_type() in fs/filesystems.c where it causes a WARNING to be hit:
    
            if (!fs && (request_module("fs-%.*s", len, name) == 0)) {
                    fs = __get_fs_type(name, len);
                    WARN_ONCE(!fs, "request_module fs-%.*s succeeded, but still no fs?\n", len, name);
            }
    
    This is easily reproduced with:
    
            echo > /proc/sys/kernel/modprobe
            mount -t NONEXISTENT none /
    
    It causes:
    
            request_module fs-NONEXISTENT succeeded, but still no fs?
            WARNING: CPU: 1 PID: 1106 at fs/filesystems.c:275 get_fs_type+0xd6/0xf0
            [...]
    
    This should actually use pr_warn_once() rather than WARN_ONCE(), since
    it's also user-reachable if userspace immediately unloads the module.
    Regardless, request_module() should correctly return an error when it
    fails.  So let's make it return -ENOENT, which matches the error when
    the modprobe binary doesn't exist.
    
    I've also sent patches to document and test this case.
    
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Jessica Yu <jeyu@kernel.org>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Jeff Vander Stoep <jeffv@google.com>
    Cc: Ben Hutchings <benh@debian.org>
    Cc: Josh Triplett <josh@joshtriplett.org>
    Cc: <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/20200310223731.126894-1-ebiggers@kernel.org
    Link: http://lkml.kernel.org/r/20200312202552.241885-1-ebiggers@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf4fcd52742eba1c1ac6e1d1d123e335f691fa71
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Thu Feb 13 13:19:52 2020 -0300

    clk: ingenic/TCU: Fix round_rate returning error
    
    commit edcc42945dee85e9dec3737f3dbf59d917ae5418 upstream.
    
    When requesting a rate superior to the parent's rate, it would return
    -EINVAL instead of simply returning the parent's rate like it should.
    
    Fixes: 4f89e4b8f121 ("clk: ingenic: Add driver for the TCU clocks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Link: https://lkml.kernel.org/r/20200213161952.37460-2-paul@crapouillou.net
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9e8388fdf4de8ec0fb3093ba797de013cc5161c6
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Thu Feb 13 13:19:51 2020 -0300

    clk: ingenic/jz4770: Exit with error if CGU init failed
    
    commit c067b46d731a764fc46ecc466c2967088c97089e upstream.
    
    Exit jz4770_cgu_init() if the 'cgu' pointer we get is NULL, since the
    pointer is passed as argument to functions later on.
    
    Fixes: 7a01c19007ad ("clk: Add Ingenic jz4770 CGU driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Reported-by: kbuild test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Link: https://lkml.kernel.org/r/20200213161952.37460-1-paul@crapouillou.net
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7bcca67bdee8378153071038fe29c8542fa530b2
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Tue Mar 24 16:34:48 2020 +0900

    ftrace/kprobe: Show the maxactive number on kprobe_events
    
    commit 6a13a0d7b4d1171ef9b80ad69abc37e1daa941b3 upstream.
    
    Show maxactive parameter on kprobe_events.
    This allows user to save the current configuration and
    restore it without losing maxactive parameter.
    
    Link: http://lkml.kernel.org/r/4762764a-6df7-bc93-ed60-e336146dce1f@gmail.com
    Link: http://lkml.kernel.org/r/158503528846.22706.5549974121212526020.stgit@devnote2
    
    Cc: stable@vger.kernel.org
    Fixes: 696ced4fb1d76 ("tracing/kprobes: expose maxactive for kretprobe in kprobe_events")
    Reported-by: Taeung Song <treeze.taeung@gmail.com>
    Signed-off-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 7dad5beb8dfd9398e9f08ebff73fe23e85f45cb4
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Wed Apr 1 13:23:06 2020 -0700

    Input: i8042 - add Acer Aspire 5738z to nomux list
    
    commit ebc68cedec4aead47d8d11623d013cca9bf8e825 upstream.
    
    The Acer Aspire 5738z has a button to disable (and re-enable) the
    touchpad next to the touchpad.
    
    When this button is pressed a LED underneath indicates that the touchpad
    is disabled (and an event is send to userspace and GNOME shows its
    touchpad enabled / disable OSD thingie).
    
    So far so good, but after re-enabling the touchpad it no longer works.
    
    The laptop does not have an external ps2 port, so mux mode is not needed
    and disabling mux mode fixes the touchpad no longer working after toggling
    it off and back on again, so lets add this laptop model to the nomux list.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20200331123947.318908-1-hdegoede@redhat.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit efb9e9f723f587107477471b055ca1b9a22446ec
Author: Michael Mueller <mimu@linux.ibm.com>
Date:   Tue Mar 3 16:42:01 2020 +0100

    s390/diag: fix display of diagnose call statistics
    
    commit 6c7c851f1b666a8a455678a0b480b9162de86052 upstream.
    
    Show the full diag statistic table and not just parts of it.
    
    The issue surfaced in a KVM guest with a number of vcpus
    defined smaller than NR_DIAG_STAT.
    
    Fixes: 1ec2772e0c3c ("s390/diag: add a statistic for diagnose calls")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
    Reviewed-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 453fb8b20db471847037cfc04ea9a5a9181f70f4
Author: Sam Lunt <samueljlunt@gmail.com>
Date:   Fri Jan 31 12:11:23 2020 -0600

    perf tools: Support Python 3.8+ in Makefile
    
    commit b9c9ce4e598e012ca7c1813fae2f4d02395807de upstream.
    
    Python 3.8 changed the output of 'python-config --ldflags' to no longer
    include the '-lpythonX.Y' flag (this apparently fixed an issue loading
    modules with a statically linked Python executable).  The libpython
    feature check in linux/build/feature fails if the Python library is not
    included in FEATURE_CHECK_LDFLAGS-libpython variable.
    
    This adds a check in the Makefile to determine if PYTHON_CONFIG accepts
    the '--embed' flag and passes that flag alongside '--ldflags' if so.
    
    tools/perf is the only place the libpython feature check is used.
    
    Signed-off-by: Sam Lunt <samuel.j.lunt@gmail.com>
    Tested-by: He Zhe <zhe.he@windriver.com>
    Link: http://lore.kernel.org/lkml/c56be2e1-8111-9dfe-8298-f7d0f9ab7431@windriver.com
    Acked-by: Jiri Olsa <jolsa@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: trivial@kernel.org
    Cc: stable@kernel.org
    Link: http://lore.kernel.org/lkml/20200131181123.tmamivhq4b7uqasr@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit beb3ef51cfd84f70016076c99976e36f20ea477e
Author: Changwei Ge <chge@linux.alibaba.com>
Date:   Fri Apr 10 14:32:38 2020 -0700

    ocfs2: no need try to truncate file beyond i_size
    
    commit 783fda856e1034dee90a873f7654c418212d12d7 upstream.
    
    Linux fallocate(2) with FALLOC_FL_PUNCH_HOLE mode set, its offset can
    exceed the inode size.  Ocfs2 now doesn't allow that offset beyond inode
    size.  This restriction is not necessary and violates fallocate(2)
    semantics.
    
    If fallocate(2) offset is beyond inode size, just return success and do
    nothing further.
    
    Otherwise, ocfs2 will crash the kernel.
    
      kernel BUG at fs/ocfs2//alloc.c:7264!
       ocfs2_truncate_inline+0x20f/0x360 [ocfs2]
       ocfs2_remove_inode_range+0x23c/0xcb0 [ocfs2]
       __ocfs2_change_file_space+0x4a5/0x650 [ocfs2]
       ocfs2_fallocate+0x83/0xa0 [ocfs2]
       vfs_fallocate+0x148/0x230
       SyS_fallocate+0x48/0x80
       do_syscall_64+0x79/0x170
    
    Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/20200407082754.17565-1-chge@linux.alibaba.com
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47199f4b87eb32e17c89849f74393fc348af63da
Author: Eric Biggers <ebiggers@google.com>
Date:   Fri Apr 10 14:33:47 2020 -0700

    fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once()
    
    commit 26c5d78c976ca298e59a56f6101a97b618ba3539 upstream.
    
    After request_module(), nothing is stopping the module from being
    unloaded until someone takes a reference to it via try_get_module().
    
    The WARN_ONCE() in get_fs_type() is thus user-reachable, via userspace
    running 'rmmod' concurrently.
    
    Since WARN_ONCE() is for kernel bugs only, not for user-reachable
    situations, downgrade this warning to pr_warn_once().
    
    Keep it printed once only, since the intent of this warning is to detect
    a bug in modprobe at boot time.  Printing the warning more than once
    wouldn't really provide any useful extra information.
    
    Fixes: 41124db869b7 ("fs: warn in case userspace lied about modprobe return")
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Jessica Yu <jeyu@kernel.org>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Jeff Vander Stoep <jeffv@google.com>
    Cc: Jessica Yu <jeyu@kernel.org>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: NeilBrown <neilb@suse.com>
    Cc: <stable@vger.kernel.org>            [4.13+]
    Link: http://lkml.kernel.org/r/20200312202552.241885-3-ebiggers@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6772387e82019c59c5d499d53904789eadc7402e
Author: Qian Cai <cai@lca.pw>
Date:   Fri Feb 21 23:32:58 2020 -0500

    ext4: fix a data race at inode->i_blocks
    
    commit 28936b62e71e41600bab319f262ea9f9b1027629 upstream.
    
    inode->i_blocks could be accessed concurrently as noticed by KCSAN,
    
     BUG: KCSAN: data-race in ext4_do_update_inode [ext4] / inode_add_bytes
    
     write to 0xffff9a00d4b982d0 of 8 bytes by task 22100 on cpu 118:
      inode_add_bytes+0x65/0xf0
      __inode_add_bytes at fs/stat.c:689
      (inlined by) inode_add_bytes at fs/stat.c:702
      ext4_mb_new_blocks+0x418/0xca0 [ext4]
      ext4_ext_map_blocks+0x1a6b/0x27b0 [ext4]
      ext4_map_blocks+0x1a9/0x950 [ext4]
      _ext4_get_block+0xfc/0x270 [ext4]
      ext4_get_block_unwritten+0x33/0x50 [ext4]
      __block_write_begin_int+0x22e/0xae0
      __block_write_begin+0x39/0x50
      ext4_write_begin+0x388/0xb50 [ext4]
      ext4_da_write_begin+0x35f/0x8f0 [ext4]
      generic_perform_write+0x15d/0x290
      ext4_buffered_write_iter+0x11f/0x210 [ext4]
      ext4_file_write_iter+0xce/0x9e0 [ext4]
      new_sync_write+0x29c/0x3b0
      __vfs_write+0x92/0xa0
      vfs_write+0x103/0x260
      ksys_write+0x9d/0x130
      __x64_sys_write+0x4c/0x60
      do_syscall_64+0x91/0xb05
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
     read to 0xffff9a00d4b982d0 of 8 bytes by task 8 on cpu 65:
      ext4_do_update_inode+0x4a0/0xf60 [ext4]
      ext4_inode_blocks_set at fs/ext4/inode.c:4815
      ext4_mark_iloc_dirty+0xaf/0x160 [ext4]
      ext4_mark_inode_dirty+0x129/0x3e0 [ext4]
      ext4_convert_unwritten_extents+0x253/0x2d0 [ext4]
      ext4_convert_unwritten_io_end_vec+0xc5/0x150 [ext4]
      ext4_end_io_rsv_work+0x22c/0x350 [ext4]
      process_one_work+0x54f/0xb90
      worker_thread+0x80/0x5f0
      kthread+0x1cd/0x1f0
      ret_from_fork+0x27/0x50
    
     4 locks held by kworker/u256:0/8:
      #0: ffff9a025abc4328 ((wq_completion)ext4-rsv-conversion){+.+.}, at: process_one_work+0x443/0xb90
      #1: ffffab5a862dbe20 ((work_completion)(&ei->i_rsv_conversion_work)){+.+.}, at: process_one_work+0x443/0xb90
      #2: ffff9a025a9d0f58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
      #3: ffff9a00d4b985d8 (&(&ei->i_raw_lock)->rlock){+.+.}, at: ext4_do_update_inode+0xaa/0xf60 [ext4]
     irq event stamp: 3009267
     hardirqs last  enabled at (3009267): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
     hardirqs last disabled at (3009266): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
     softirqs last  enabled at (3009230): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
     softirqs last disabled at (3009223): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0
    
     Reported by Kernel Concurrency Sanitizer on:
     CPU: 65 PID: 8 Comm: kworker/u256:0 Tainted: G L 5.6.0-rc2-next-20200221+ #7
     Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019
     Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work [ext4]
    
    The plain read is outside of inode->i_lock critical section which
    results in a data race. Fix it by adding READ_ONCE() there.
    
    Link: https://lore.kernel.org/r/20200222043258.2279-1-cai@lca.pw
    Signed-off-by: Qian Cai <cai@lca.pw>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 699d2c4d667e9dc40e665075ff47dffdcb82ffd0
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Wed Apr 1 10:07:16 2020 -0400

    NFS: Fix a page leak in nfs_destroy_unlinked_subrequests()
    
    commit add42de31721fa29ed77a7ce388674d69f9d31a4 upstream.
    
    When we detach a subrequest from the list, we must also release the
    reference it holds to the parent.
    
    Fixes: 5b2b5187fa85 ("NFS: Fix nfs_page_group_destroy() and nfs_lock_and_join_requests() race cases")
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b64cbd05807b92a2296fba82e871014d38cef26
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sun Mar 29 19:55:05 2020 -0400

    NFS: Fix use-after-free issues in nfs_pageio_add_request()
    
    commit dc9dc2febb17f72e9878eb540ad3996f7984239a upstream.
    
    We need to ensure that we create the mirror requests before calling
    nfs_pageio_add_request_mirror() on the request we are adding.
    Otherwise, we can end up with a use-after-free if the call to
    nfs_pageio_add_request_mirror() triggers I/O.
    
    Fixes: c917cfaf9bbe ("NFS: Fix up NFS I/O subrequest creation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98a817eda5bc9dc2faefa05e5ad45a57e10a5da8
Author: J. Bruce Fields <bfields@redhat.com>
Date:   Thu Mar 19 11:30:38 2020 -0400

    nfsd: fsnotify on rmdir under nfsd/clients/
    
    commit 69afd267982e733a555fede4e85fe30329ed0588 upstream.
    
    Userspace should be able to monitor nfsd/clients/ to see when clients
    come and go, but we're failing to send fsnotify events.
    
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27993365c009e2e96ff55a648bf0b12c7744c92b
Author: Libor Pechacek <lpechacek@suse.cz>
Date:   Fri Jan 31 14:28:29 2020 +0100

    powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable
    
    commit a83836dbc53e96f13fec248ecc201d18e1e3111d upstream.
    
    In guests without hotplugagble memory drmem structure is only zero
    initialized. Trying to manipulate DLPAR parameters results in a crash.
    
      $ echo "memory add count 1" > /sys/kernel/dlpar
      Oops: Kernel access of bad area, sig: 11 [#1]
      LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
      ...
      NIP:  c0000000000ff294 LR: c0000000000ff248 CTR: 0000000000000000
      REGS: c0000000fb9d3880 TRAP: 0300   Tainted: G            E      (5.5.0-rc6-2-default)
      MSR:  8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28242428  XER: 20000000
      CFAR: c0000000009a6c10 DAR: 0000000000000010 DSISR: 40000000 IRQMASK: 0
      ...
      NIP dlpar_memory+0x6e4/0xd00
      LR  dlpar_memory+0x698/0xd00
      Call Trace:
        dlpar_memory+0x698/0xd00 (unreliable)
        handle_dlpar_errorlog+0xc0/0x190
        dlpar_store+0x198/0x4a0
        kobj_attr_store+0x30/0x50
        sysfs_kf_write+0x64/0x90
        kernfs_fop_write+0x1b0/0x290
        __vfs_write+0x3c/0x70
        vfs_write+0xd0/0x260
        ksys_write+0xdc/0x130
        system_call+0x5c/0x68
    
    Taking closer look at the code, I can see that for_each_drmem_lmb is a
    macro expanding into `for (lmb = &drmem_info->lmbs[0]; lmb <=
    &drmem_info->lmbs[drmem_info->n_lmbs - 1]; lmb++)`. When drmem_info->lmbs
    is NULL, the loop would iterate through the whole address range if it
    weren't stopped by the NULL pointer dereference on the next line.
    
    This patch aligns for_each_drmem_lmb and for_each_drmem_lmb_in_range
    macro behavior with the common C semantics, where the end marker does
    not belong to the scanned range, and alters get_lmb_range() semantics.
    As a side effect, the wraparound observed in the crash is prevented.
    
    Fixes: 6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
    Cc: stable@vger.kernel.org # v4.16+
    Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200131132829.10281-1-msuchanek@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4e4c6760fe03194640f6666153b103bf207352c3
Author: Aaron Liu <aaron.liu@amd.com>
Date:   Tue Apr 7 17:46:04 2020 +0800

    drm/amdgpu: unify fw_write_wait for new gfx9 asics
    
    commit 2960758cce2310774de60bbbd8d6841d436c54d9 upstream.
    
    Make the fw_write_wait default case true since presumably all new
    gfx9 asics will have updated firmware. That is using unique WAIT_REG_MEM
    packet with opration=1.
    
    Signed-off-by: Aaron Liu <aaron.liu@amd.com>
    Tested-by: Aaron Liu <aaron.liu@amd.com>
    Tested-by: Yuxian Dai <Yuxian.Dai@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Acked-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 45bc323b8102895e8350e5729bc94fec983f1270
Author: Yuxian Dai <Yuxian.Dai@amd.com>
Date:   Wed Apr 1 19:26:26 2020 +0800

    drm/amdgpu/powerplay: using the FCLK DPM table to set the MCLK
    
    commit 022ac4c9c55be35a2d1f71019a931324c51b0dab upstream.
    
    1.Using the FCLK DPM table to set the MCLK for DPM states consist of
    three entities:
     FCLK
     UCLK
     MEMCLK
    All these three clk change together, MEMCLK from FCLK, so use the fclk
    frequency.
    2.we should show the current working clock freqency from clock table metric
    
    Signed-off-by: Yuxian Dai <Yuxian.Dai@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Huang Rui <ray.huang@amd.com>
    Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe0ec6f90e4dcc52890afed29fa8b099c78db591
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Feb 2 17:16:31 2020 +0000

    drm: Remove PageReserved manipulation from drm_pci_alloc
    
    commit ea36ec8623f56791c6ff6738d0509b7920f85220 upstream.
    
    drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma
    facilities, and we have no special reason within the drm layer to behave
    differently. In particular, since
    
    commit de09d31dd38a50fdce106c15abd68432eebbd014
    Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Date:   Fri Jan 15 16:51:42 2016 -0800
    
        page-flags: define PG_reserved behavior on compound pages
    
        As far as I can see there's no users of PG_reserved on compound pages.
        Let's use PF_NO_COMPOUND here.
    
    it has been illegal to combine GFP_COMP with SetPageReserved, so lets
    stop doing both and leave the dma layer to its own devices.
    
    Reported-by: Taketo Kabe
    Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027
    Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages")
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: <stable@vger.kernel.org> # v4.5+
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b716a5f5ec65474365965e4db3d3c77c625d53d2
Author: Christian Gmeiner <christian.gmeiner@gmail.com>
Date:   Fri Feb 28 11:37:49 2020 +0100

    drm/etnaviv: rework perfmon query infrastructure
    
    commit ed1dd899baa32d47d9a93d98336472da50564346 upstream.
    
    Report the correct perfmon domains and signals depending
    on the supported feature flags.
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Fixes: 9e2c2e273012 ("drm/etnaviv: add infrastructure to query perf counter")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
    Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 463a2dddb4f926535ede508fba39386bc8b638c0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Apr 6 12:48:21 2020 +0100

    drm/i915/gem: Flush all the reloc_gpu batch
    
    commit 1aaea8476d9f014667d2cb24819f9bcaf3ebb7a4 upstream.
    
    __i915_gem_object_flush_map() takes a byte range, so feed it the written
    bytes and do not mistake the u32 index as bytes!
    
    Fixes: a679f58d0510 ("drm/i915: Flush pages on acquisition")
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Matthew Auld <matthew.william.auld@gmail.com>
    Cc: <stable@vger.kernel.org> # v5.2+
    Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200406114821.10949-1-chris@chris-wilson.co.uk
    (cherry picked from commit 30c88a47f1abd5744908d3681f54dcf823fe2a12)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cda1eda28f1dadd85002c7b1c9e7ac921bd8d589
Author: Eric Auger <eric.auger@redhat.com>
Date:   Tue Mar 24 09:26:30 2020 -0600

    vfio: platform: Switch to platform_get_irq_optional()
    
    commit 723fe298ad85ad1278bd2312469ad14738953cc6 upstream.
    
    Since commit 7723f4c5ecdb ("driver core: platform: Add an error
    message to platform_get_irq*()"), platform_get_irq() calls dev_err()
    on an error. As we enumerate all interrupts until platform_get_irq()
    fails, we now systematically get a message such as:
    "vfio-platform fff51000.ethernet: IRQ index 3 not found" which is
    a false positive.
    
    Let's use platform_get_irq_optional() instead.
    
    Signed-off-by: Eric Auger <eric.auger@redhat.com>
    Cc: stable@vger.kernel.org # v5.3+
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Tested-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b5eec37a3b8530e7e345c281db08fe21e49c7b80
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Fri Feb 28 00:00:09 2020 +0000

    selftests/powerpc: Add tlbie_test in .gitignore
    
    commit 47bf235f324c696395c30541fe4fcf99fcd24188 upstream.
    
    The commit identified below added tlbie_test but forgot to add it in
    .gitignore.
    
    Fixes: 93cad5f78995 ("selftests/powerpc: Add test case for tlbie vs mtpidr ordering issue")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/259f9c06ed4563c4fa4fa8ffa652347278d769e7.1582847784.git.christophe.leroy@c-s.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e1ec78f93042b620b5636ebb958c6914728332ff
Author: Christophe Leroy <christophe.leroy@c-s.fr>
Date:   Wed Apr 1 21:11:51 2020 -0700

    selftests/vm: fix map_hugetlb length used for testing read and write
    
    commit cabc30da10e677c67ab9a136b1478175734715c5 upstream.
    
    Commit fa7b9a805c79 ("tools/selftest/vm: allow choosing mem size and page
    size in map_hugetlb") added the possibility to change the size of memory
    mapped for the test, but left the read and write test using the default
    value.  This is unnoticed when mapping a length greater than the default
    one, but segfaults otherwise.
    
    Fix read_bytes() and write_bytes() by giving them the real length.
    
    Also fix the call to munmap().
    
    Fixes: fa7b9a805c79 ("tools/selftest/vm: allow choosing mem size and page size in map_hugetlb")
    Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Leonardo Bras <leonardo@linux.ibm.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/9a404a13c871c4bd0ba9ede68f69a1225180dd7e.1580978385.git.christophe.leroy@c-s.fr
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 336b96a6817064c77214e710bb177b2b7f5f417c
Author: Michal Hocko <mhocko@suse.com>
Date:   Wed Apr 1 21:10:25 2020 -0700

    selftests: vm: drop dependencies on page flags from mlock2 tests
    
    commit eea274d64e6ea8aff2224d33d0851133a84cc7b5 upstream.
    
    It was noticed that mlock2 tests are failing after 9c4e6b1a7027f ("mm,
    mlock, vmscan: no more skipping pagevecs") because the patch has changed
    the timing on when the page is added to the unevictable LRU list and thus
    gains the unevictable page flag.
    
    The test was just too dependent on the implementation details which were
    true at the time when it was introduced.  Page flags and the timing when
    they are set is something no userspace should ever depend on.  The test
    should be testing only for the user observable contract of the tested
    syscalls.  Those are defined pretty well for the mlock and there are other
    means for testing them.  In fact this is already done and testing for page
    flags can be safely dropped to achieve the aimed purpose.  Present bits
    can be checked by /proc/<pid>/smaps RSS field and the locking state by
    VmFlags although I would argue that Locked: field would be more
    appropriate.
    
    Drop all the page flag machinery and considerably simplify the test.  This
    should be more robust for future kernel changes while checking the
    promised contract is still valid.
    
    Fixes: 9c4e6b1a7027f ("mm, mlock, vmscan: no more skipping pagevecs")
    Reported-by: Rafael Aquini <aquini@redhat.com>
    Signed-off-by: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Acked-by: Rafael Aquini <aquini@redhat.com>
    Cc: Shakeel Butt <shakeelb@google.com>
    Cc: Eric B Munson <emunson@akamai.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: <stable@vger.kernel.org>
    Link: http://lkml.kernel.org/r/20200324154218.GS19542@dhcp22.suse.cz
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20a62e9073f3539afce9b2f73e6b992eb9a33212
Author: Fredrik Strupe <fredrik@strupe.net>
Date:   Wed Apr 8 13:29:41 2020 +0200

    arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
    
    commit fc2266011accd5aeb8ebc335c381991f20e26e33 upstream.
    
    For thumb instructions, call_undef_hook() in traps.c first reads a u16,
    and if the u16 indicates a T32 instruction (u16 >= 0xe800), a second
    u16 is read, which then makes up the the lower half-word of a T32
    instruction. For T16 instructions, the second u16 is not read,
    which makes the resulting u32 opcode always have the upper half set to
    0.
    
    However, having the upper half of instr_mask in the undef_hook set to 0
    masks out the upper half of all thumb instructions - both T16 and T32.
    This results in trapped T32 instructions with the lower half-word equal
    to the T16 encoding of setend (b650) being matched, even though the upper
    half-word is not 0000 and thus indicates a T32 opcode.
    
    An example of such a T32 instruction is eaa0b650, which should raise a
    SIGILL since T32 instructions with an eaa prefix are unallocated as per
    Arm ARM, but instead works as a SETEND because the second half-word is set
    to b650.
    
    This patch fixes the issue by extending instr_mask to include the
    upper u32 half, which will still match T16 instructions where the upper
    half is 0, but not T32 instructions.
    
    Fixes: 2d888f48e056 ("arm64: Emulate SETEND for AArch32 tasks")
    Cc: <stable@vger.kernel.org> # 4.0.x-
    Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d66a67f73101f9e5e876568591192568296cc7e
Author: Dave Gerlach <d-gerlach@ti.com>
Date:   Wed Mar 11 16:41:11 2020 +0200

    arm64: dts: ti: k3-am65: Add clocks to dwc3 nodes
    
    commit a81e5442d796ccfa2cc97d205a5477053264d978 upstream.
    
    The TI sci-clk driver can scan the DT for all clocks provided by system
    firmware and does this by checking the clocks property of all nodes, so
    we must add this to the dwc3 nodes so USB clocks are available.
    
    Without this USB does not work with latest system firmware i.e.
    [    1.714662] clk: couldn't get parent clock 0 for /interconnect@100000/dwc3@4020000
    
    Fixes: cc54a99464ccd ("arm64: dts: ti: k3-am6: add USB suppor")
    Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
    Signed-off-by: Roger Quadros <rogerq@ti.com>
    Cc: stable@kernel.org
    Signed-off-by: Tero Kristo <t-kristo@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d971b0059a27ce136cb2c6dadfd971b0ac39b5e
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Wed Mar 4 15:37:26 2020 +0100

    ARM: dts: exynos: Fix polarity of the LCD SPI bus on UniversalC210 board
    
    commit 32a1671ff8e84f0dfff3a50d4b2091d25e91f5e2 upstream.
    
    Recent changes in the SPI core and the SPI-GPIO driver revealed that the
    GPIO lines for the LD9040 LCD controller on the UniversalC210 board are
    defined incorrectly. Fix the polarity for those lines to match the old
    behavior and hardware requirements to fix LCD panel operation with
    recent kernels.
    
    Cc: <stable@vger.kernel.org> # 5.0.x
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
    Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e5b9c1027ee84e003b01ef5f44fdd596d0b2ec5a
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Jan 27 16:23:02 2020 -0800

    scsi: lpfc: Fix lpfc_io_buf resource leak in lpfc_get_scsi_buf_s4 error path
    
    commit 0ab384a49c548baf132ccef249f78d9c6c506380 upstream.
    
    If a call to lpfc_get_cmd_rsp_buf_per_hdwq returns NULL (memory allocation
    failure), a previously allocated lpfc_io_buf resource is leaked.
    
    Fix by releasing the lpfc_io_buf resource in the failure path.
    
    Fixes: d79c9e9d4b3d ("scsi: lpfc: Support dynamic unbounded SGL lists on G7 hardware.")
    Cc: <stable@vger.kernel.org> # v5.4+
    Link: https://lore.kernel.org/r/20200128002312.16346-3-jsmart2021@gmail.com
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 73a122c2636dc38ea370588dec1601e870bbc8d9
Author: Stanley Chu <stanley.chu@mediatek.com>
Date:   Wed Jan 29 18:52:50 2020 +0800

    scsi: ufs: fix Auto-Hibern8 error detection
    
    commit 5a244e0ea67b293abb1d26c825db2ddde5f2862f upstream.
    
    Auto-Hibern8 may be disabled by some vendors or sysfs in runtime even if
    Auto-Hibern8 capability is supported by host. If Auto-Hibern8 capability is
    supported by host but not actually enabled, Auto-Hibern8 error shall not
    happen.
    
    To fix this, provide a way to detect if Auto-Hibern8 is actually enabled
    first, and bypass Auto-Hibern8 disabling case in
    ufshcd_is_auto_hibern8_error().
    
    Fixes: 821744403913 ("scsi: ufs: Add error-handling of Auto-Hibernate")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200129105251.12466-4-stanley.chu@mediatek.com
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
    Reviewed-by: Can Guo <cang@codeaurora.org>
    Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ad68e6212adc254b6812c8bc28a37c566bc2635
Author: Steffen Maier <maier@linux.ibm.com>
Date:   Thu Mar 12 18:44:56 2020 +0100

    scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point
    
    commit 819732be9fea728623e1ed84eba28def7384ad1f upstream.
    
    v2.6.27 commit cc8c282963bd ("[SCSI] zfcp: Automatically attach remote
    ports") introduced zfcp automatic port scan.
    
    Before that, the user had to use the sysfs attribute "port_add" of an FCP
    device (adapter) to add and open remote (target) ports, even for the remote
    peer port in point-to-point topology. That code path did a proper port open
    recovery trigger taking the erp_lock.
    
    Since above commit, a new helper function zfcp_erp_open_ptp_port()
    performed an UNlocked port open recovery trigger. This can race with other
    parallel recovery triggers. In zfcp_erp_action_enqueue() this could corrupt
    e.g. adapter->erp_total_count or adapter->erp_ready_head.
    
    As already found for fabric topology in v4.17 commit fa89adba1941 ("scsi:
    zfcp: fix infinite iteration on ERP ready list"), there was an endless loop
    during tracing of rport (un)block.  A subsequent v4.18 commit 9e156c54ace3
    ("scsi: zfcp: assert that the ERP lock is held when tracing a recovery
    trigger") introduced a lockdep assertion for that case.
    
    As a side effect, that lockdep assertion now uncovered the unlocked code
    path for PtP. It is from within an adapter ERP action:
    
    zfcp_erp_strategy[1479]  intentionally DROPs erp lock around
                             zfcp_erp_strategy_do_action()
    zfcp_erp_strategy_do_action[1441]      NO erp lock
    zfcp_erp_adapter_strategy[876]         NO erp lock
    zfcp_erp_adapter_strategy_open[855]    NO erp lock
    zfcp_erp_adapter_strategy_open_fsf[806]NO erp lock
    zfcp_erp_adapter_strat_fsf_xconf[772]  erp lock only around
                                           zfcp_erp_action_to_running(),
                                           BUT *_not_* around
                                           zfcp_erp_enqueue_ptp_port()
    zfcp_erp_enqueue_ptp_port[728]         BUG: *_not_* taking erp lock
    _zfcp_erp_port_reopen[432]             assumes to be called with erp lock
    zfcp_erp_action_enqueue[314]           assumes to be called with erp lock
    zfcp_dbf_rec_trig[288]                 _checks_ to be called with erp lock:
            lockdep_assert_held(&adapter->erp_lock);
    
    It causes the following lockdep warning:
    
    WARNING: CPU: 2 PID: 775 at drivers/s390/scsi/zfcp_dbf.c:288
                                zfcp_dbf_rec_trig+0x16a/0x188
    no locks held by zfcperp0.0.17c0/775.
    
    Fix this by using the proper locked recovery trigger helper function.
    
    Link: https://lore.kernel.org/r/20200312174505.51294-2-maier@linux.ibm.com
    Fixes: cc8c282963bd ("[SCSI] zfcp: Automatically attach remote ports")
    Cc: <stable@vger.kernel.org> #v2.6.27+
    Reviewed-by: Jens Remus <jremus@linux.ibm.com>
    Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
    Signed-off-by: Steffen Maier <maier@linux.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8179a260313e9f324893652441753fb042a0e7e4
Author: Gilad Ben-Yossef <gilad@benyossef.com>
Date:   Sun Feb 2 18:19:14 2020 +0200

    crypto: ccree - dec auth tag size from cryptlen map
    
    commit 8962c6d2c2b8ca51b0f188109015b15fc5f4da44 upstream.
    
    Remove the auth tag size from cryptlen before mapping the destination
    in out-of-place AEAD decryption thus resolving a crash with
    extended testmgr tests.
    
    Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
    Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Cc: stable@vger.kernel.org # v4.19+
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9135cd1b0f644dac4c86728c930e0bb6ed4e6346
Author: Gilad Ben-Yossef <gilad@benyossef.com>
Date:   Wed Jan 29 16:37:55 2020 +0200

    crypto: ccree - only try to map auth tag if needed
    
    commit 504e84abec7a635b861afd8d7f92ecd13eaa2b09 upstream.
    
    Make sure to only add the size of the auth tag to the source mapping
    for encryption if it is an in-place operation. Failing to do this
    previously caused us to try and map auth size len bytes from a NULL
    mapping and crashing if both the cryptlen and assoclen are zero.
    
    Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
    Cc: stable@vger.kernel.org # v4.19+
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a867446427894749d4f88da8542bba4d3ff585d8
Author: Gilad Ben-Yossef <gilad@benyossef.com>
Date:   Wed Jan 29 16:37:54 2020 +0200

    crypto: ccree - protect against empty or NULL scatterlists
    
    commit ce0fc6db38decf0d2919bfe783de6d6b76e421a9 upstream.
    
    Deal gracefully with a NULL or empty scatterlist which can happen
    if both cryptlen and assoclen are zero and we're doing in-place
    AEAD encryption.
    
    This fixes a crash when this causes us to try and map a NULL page,
    at least with some platforms / DMA mapping configs.
    
    Cc: stable@vger.kernel.org # v4.19+
    Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f3f13f97944828b9a94dcddbc2d660df262f20e8
Author: Andrei Botila <andrei.botila@nxp.com>
Date:   Fri Feb 28 12:46:48 2020 +0200

    crypto: caam - update xts sector size for large input length
    
    commit 3f142b6a7b573bde6cff926f246da05652c61eb4 upstream.
    
    Since in the software implementation of XTS-AES there is
    no notion of sector every input length is processed the same way.
    CAAM implementation has the notion of sector which causes different
    results between the software implementation and the one in CAAM
    for input lengths bigger than 512 bytes.
    Increase sector size to maximum value on 16 bits.
    
    Fixes: c6415a6016bf ("crypto: caam - add support for acipher xts(aes)")
    Cc: <stable@vger.kernel.org> # v4.12+
    Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
    Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bc8413b626dde5d91fa4d6741a7da6727af38d27
Author: Horia Geantă <horia.geanta@nxp.com>
Date:   Fri Feb 28 08:51:23 2020 +0200

    crypto: caam/qi2 - fix chacha20 data size error
    
    commit 3a5a9e1ef37b030b836d92df8264f840988f4a38 upstream.
    
    HW generates a Data Size error for chacha20 requests that are not
    a multiple of 64B, since algorithm state (AS) does not have
    the FINAL bit set.
    
    Since updating req->iv (for chaining) is not required,
    modify skcipher descriptors to set the FINAL bit for chacha20.
    
    [Note that for skcipher decryption we know that ctx1_iv_off is 0,
    which allows for an optimization by not checking algorithm type,
    since append_dec_op1() sets FINAL bit for all algorithms except AES.]
    
    Also drop the descriptor operations that save the IV.
    However, in order to keep code logic simple, things like
    S/G tables generation etc. are not touched.
    
    Cc: <stable@vger.kernel.org> # v5.3+
    Fixes: 334d37c9e263 ("crypto: caam - update IV using HW support")
    Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
    Tested-by: Valentin Ciocoi Radulescu <valentin.ciocoi@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 07378b099139b0ad3fc1e74f549cdca92a0c1feb
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Thu Mar 12 17:29:11 2020 -0400

    xarray: Fix early termination of xas_for_each_marked
    
    commit 7e934cf5ace1dceeb804f7493fa28bb697ed3c52 upstream.
    
    xas_for_each_marked() is using entry == NULL as a termination condition
    of the iteration. When xas_for_each_marked() is used protected only by
    RCU, this can however race with xas_store(xas, NULL) in the following
    way:
    
    TASK1                                   TASK2
    page_cache_delete()                     find_get_pages_range_tag()
                                              xas_for_each_marked()
                                                xas_find_marked()
                                                  off = xas_find_chunk()
    
      xas_store(&xas, NULL)
        xas_init_marks(&xas);
        ...
        rcu_assign_pointer(*slot, NULL);
                                                  entry = xa_entry(off);
    
    And thus xas_for_each_marked() terminates prematurely possibly leading
    to missed entries in the iteration (translating to missing writeback of
    some pages or a similar problem).
    
    If we find a NULL entry that has been marked, skip it (unless we're trying
    to allocate an entry).
    
    Reported-by: Jan Kara <jack@suse.cz>
    CC: stable@vger.kernel.org
    Fixes: ef8e5717db01 ("page cache: Convert delete_batch to XArray")
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8f4c8e92bdac564b8c562460a271d3ff11317fe9
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Fri Jan 31 06:17:09 2020 -0500

    XArray: Fix xas_pause for large multi-index entries
    
    commit c36d451ad386b34f452fc3c8621ff14b9eaa31a6 upstream.
    
    Inspired by the recent Coverity report, I looked for other places where
    the offset wasn't being converted to an unsigned long before being
    shifted, and I found one in xas_pause() when the entry being paused is
    of order >32.
    
    Fixes: b803b42823d0 ("xarray: Add XArray iterators")
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a1ffc47f22a843b75f6d6b9a989abcc825939564
Author: Nikos Tsironis <ntsironis@arrikto.com>
Date:   Fri Mar 27 16:01:11 2020 +0200

    dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions()
    
    commit 81d5553d1288c2ec0390f02f84d71ca0f0f9f137 upstream.
    
    dm_clone_nr_of_hydrated_regions() returns the number of regions that
    have been hydrated so far. In order to do so it employs bitmap_weight().
    
    Until now, the return type of dm_clone_nr_of_hydrated_regions() was
    unsigned long.
    
    Because bitmap_weight() returns an int, in case BITS_PER_LONG == 64 and
    the return value of bitmap_weight() is 2^31 (the maximum allowed number
    of regions for a device), the result is sign extended from 32 bits to 64
    bits and an incorrect value is displayed, in the status output of
    dm-clone, as the number of hydrated regions.
    
    Fix this by having dm_clone_nr_of_hydrated_regions() return an unsigned
    int.
    
    Fixes: 7431b7835f55 ("dm: add clone target")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 996f8f1ba72a8b8b05e591fb96cbeb31a449476d
Author: Nikos Tsironis <ntsironis@arrikto.com>
Date:   Fri Mar 27 16:01:09 2020 +0200

    dm clone: Add overflow check for number of regions
    
    commit cd481c12269b4d276f1a52eda0ebd419079bfe3a upstream.
    
    Add overflow check for clone->nr_regions variable, which holds the
    number of regions of the target.
    
    The overflow can occur with sufficiently large devices, if BITS_PER_LONG
    == 32. E.g., if the region size is 8 sectors (4K), the overflow would
    occur for device sizes > 34359738360 sectors (~16TB).
    
    This could result in multiple device sectors wrongly mapping to the same
    region number, due to the truncation from 64 bits to 32 bits, which
    would lead to data corruption.
    
    Fixes: 7431b7835f55 ("dm: add clone target")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e703059348d8aa2cbcdbbaed284557e76edf460
Author: Shetty, Harshini X (EXT-Sony Mobile) <Harshini.X.Shetty@sony.com>
Date:   Tue Mar 17 09:15:45 2020 +0000

    dm verity fec: fix memory leak in verity_fec_dtr
    
    commit 75fa601934fda23d2f15bf44b09c2401942d8e15 upstream.
    
    Fix below kmemleak detected in verity_fec_ctr. output_pool is
    allocated for each dm-verity-fec device. But it is not freed when
    dm-table for the verity target is removed. Hence free the output
    mempool in destructor function verity_fec_dtr.
    
    unreferenced object 0xffffffffa574d000 (size 4096):
      comm "init", pid 1667, jiffies 4294894890 (age 307.168s)
      hex dump (first 32 bytes):
        8e 36 00 98 66 a8 0b 9b 00 00 00 00 00 00 00 00  .6..f...........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<0000000060e82407>] __kmalloc+0x2b4/0x340
        [<00000000dd99488f>] mempool_kmalloc+0x18/0x20
        [<000000002560172b>] mempool_init_node+0x98/0x118
        [<000000006c3574d2>] mempool_init+0x14/0x20
        [<0000000008cb266e>] verity_fec_ctr+0x388/0x3b0
        [<000000000887261b>] verity_ctr+0x87c/0x8d0
        [<000000002b1e1c62>] dm_table_add_target+0x174/0x348
        [<000000002ad89eda>] table_load+0xe4/0x328
        [<000000001f06f5e9>] dm_ctl_ioctl+0x3b4/0x5a0
        [<00000000bee5fbb7>] do_vfs_ioctl+0x5dc/0x928
        [<00000000b475b8f5>] __arm64_sys_ioctl+0x70/0x98
        [<000000005361e2e8>] el0_svc_common+0xa0/0x158
        [<000000001374818f>] el0_svc_handler+0x6c/0x88
        [<000000003364e9f4>] el0_svc+0x8/0xc
        [<000000009d84cec9>] 0xffffffffffffffff
    
    Fixes: a739ff3f543af ("dm verity: add support for forward error correction")
    Depends-on: 6f1c819c219f7 ("dm: convert to bioset_init()/mempool_init()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Harshini Shetty <harshini.x.shetty@sony.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 833309f3fb511b4e4873a0a39b8be7ac747d6d3d
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Sun Mar 22 20:42:21 2020 +0100

    dm integrity: fix a crash with unusually large tag size
    
    commit b93b6643e9b5a7f260b931e97f56ffa3fa65e26d upstream.
    
    If the user specifies tag size larger than HASH_MAX_DIGESTSIZE,
    there's a crash in integrity_metadata().
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bef0d2f5fdcbc39f2c5b321d35d2c8b2f1e99612
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Mar 27 07:22:36 2020 -0400

    dm writecache: add cond_resched to avoid CPU hangs
    
    commit 1edaa447d958bec24c6a79685a5790d98976fd16 upstream.
    
    Initializing a dm-writecache device can take a long time when the
    persistent memory device is large.  Add cond_resched() to a few loops
    to avoid warnings that the CPU is stuck.
    
    Cc: stable@vger.kernel.org # v4.18+
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5c84ab9c96d78dc124cf31d47cf35a8c97c740ed
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Apr 10 14:32:19 2020 -0700

    mm, memcg: do not high throttle allocators based on wraparound
    
    commit 9b8b17541f13809d06f6f873325305ddbb760e3e upstream.
    
    If a cgroup violates its memory.high constraints, we may end up unduly
    penalising it.  For example, for the following hierarchy:
    
      A:   max high, 20 usage
      A/B: 9 high, 10 usage
      A/C: max high, 10 usage
    
    We would end up doing the following calculation below when calculating
    high delay for A/B:
    
      A/B: 10 - 9 = 1...
      A:   20 - PAGE_COUNTER_MAX = 21, so set max_overage to 21.
    
    This gets worse with higher disparities in usage in the parent.
    
    I have no idea how this disappeared from the final version of the patch,
    but it is certainly Not Good(tm).  This wasn't obvious in testing because,
    for a simple cgroup hierarchy with only one child, the result is usually
    roughly the same.  It's only in more complex hierarchies that things go
    really awry (although still, the effects are limited to a maximum of 2
    seconds in schedule_timeout_killable at a maximum).
    
    [chris@chrisdown.name: changelog]
    Fixes: e26733e0d0ec ("mm, memcg: throttle allocators based on ancestral memory.high")
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Chris Down <chris@chrisdown.name>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: <stable@vger.kernel.org>    [5.4.x]
    Link: http://lkml.kernel.org/r/20200331152424.GA1019937@chrisdown.name
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 935e87b20c564b5b49e1afa2983f15d1e8c7ba3d
Author: Maxime Ripard <maxime@cerno.tech>
Date:   Mon Feb 10 10:55:59 2020 +0100

    arm64: dts: allwinner: h5: Fix PMU compatible
    
    commit 4ae7a3c3d7d31260f690d8d658f0365f3eca67a2 upstream.
    
    The commit c35a516a4618 ("arm64: dts: allwinner: H5: Add PMU node")
    introduced support for the PMU found on the Allwinner H5. However, the
    binding only allows for a single compatible, while the patch was adding
    two.
    
    Make sure we follow the binding.
    
    Fixes: c35a516a4618 ("arm64: dts: allwinner: H5: Add PMU node")
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1dbfae009525d6ec2b42e126e0897f45444d621f
Author: Scott Wood <swood@redhat.com>
Date:   Mon Feb 3 19:35:58 2020 -0500

    sched/core: Remove duplicate assignment in sched_tick_remote()
    
    commit 82e0516ce3a147365a5dd2a9bedd5ba43a18663d upstream.
    
    A redundant "curr = rq->curr" was added; remove it.
    
    Fixes: ebc0f83c78a2 ("timers/nohz: Update NOHZ load in remote tick")
    Signed-off-by: Scott Wood <swood@redhat.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/1580776558-12882-1-git-send-email-swood@redhat.com
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8b068046321faa93a3ee085d2115cd78b887558b
Author: Maxime Ripard <maxime@cerno.tech>
Date:   Mon Feb 10 10:56:00 2020 +0100

    arm64: dts: allwinner: h6: Fix PMU compatible
    
    commit 4c7eeb9af3e41ae7d840977119c58f3bbb3f4f59 upstream.
    
    The commit 7aa9b9eb7d6a ("arm64: dts: allwinner: H6: Add PMU mode")
    introduced support for the PMU found on the Allwinner H6. However, the
    binding only allows for a single compatible, while the patch was adding
    two.
    
    Make sure we follow the binding.
    
    Fixes: 7aa9b9eb7d6a ("arm64: dts: allwinner: H6: Add PMU mode")
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27dbb36338099f2847d5638a5b58920fd738b0c7
Author: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date:   Wed Apr 1 15:23:55 2020 -0600

    net: qualcomm: rmnet: Allow configuration updates to existing devices
    
    commit 2abb5792387eb188b12051337d5dcd2cba615cb0 upstream.
    
    This allows the changelink operation to succeed if the mux_id was
    specified as an argument. Note that the mux_id must match the
    existing mux_id of the rmnet device or should be an unused mux_id.
    
    Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux id is duplicated")
    Reported-and-tested-by: Alex Elder <elder@linaro.org>
    Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
    Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit add09c86cd3e41d47f8377681daa0823008551ee
Author: Anssi Hannula <anssi.hannula@bitwise.fi>
Date:   Wed Mar 25 12:31:54 2020 +0200

    tools: gpio: Fix out-of-tree build regression
    
    commit 82f04bfe2aff428b063eefd234679b2d693228ed upstream.
    
    Commit 0161a94e2d1c7 ("tools: gpio: Correctly add make dependencies for
    gpio_utils") added a make rule for gpio-utils-in.o but used $(output)
    instead of the correct $(OUTPUT) for the output directory, breaking
    out-of-tree build (O=xx) with the following error:
    
      No rule to make target 'out/tools/gpio/gpio-utils-in.o', needed by 'out/tools/gpio/lsgpio-in.o'.  Stop.
    
    Fix that.
    
    Fixes: 0161a94e2d1c ("tools: gpio: Correctly add make dependencies for gpio_utils")
    Cc: <stable@vger.kernel.org>
    Cc: Laura Abbott <labbott@redhat.com>
    Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
    Link: https://lore.kernel.org/r/20200325103154.32235-1-anssi.hannula@bitwise.fi
    Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a0f079ac13be84a82dd748fe350e25c146b9abde
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Mon Feb 18 12:56:44 2019 +0000

    powerpc/pseries: Drop pointless static qualifier in vpa_debugfs_init()
    
    commit 11dd34f3eae5a468013bb161a1dcf1fecd2ca321 upstream.
    
    There is no need to have the 'struct dentry *vpa_dir' variable static
    since new value always be assigned before use it.
    
    Fixes: c6c26fb55e8e ("powerpc/pseries: Export raw per-CPU VPA data via debugfs")
    Signed-off-by: YueHaibing <yuehaibing@huawei.com>
    Reviewed-by: Daniel Axtens <dja@axtens.net>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20190218125644.87448-1-yuehaibing@huawei.com
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e0ae9da3fb2fed45fdd437cea6c597044c02dc47
Author: Yangbo Lu <yangbo.lu@nxp.com>
Date:   Wed Jan 8 12:07:12 2020 +0800

    mmc: sdhci-of-esdhc: fix esdhc_reset() for different controller versions
    
    commit 2aa3d826adb578b26629a79b775a552cfe3fedf7 upstream.
    
    This patch is to fix operating in esdhc_reset() for different
    controller versions, and to add bus-width restoring after data
    reset for eSDHC (verdor version <= 2.2).
    
    Also add annotation for understanding.
    
    Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20200108040713.38888-1-yangbo.lu@nxp.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7661469ef56e15c2c32fa4b7be126a6b91e265a5
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Mar 20 11:23:41 2020 -0600

    io_uring: honor original task RLIMIT_FSIZE
    
    commit 4ed734b0d0913e566a9d871e15d24eb240f269f7 upstream.
    
    With the previous fixes for number of files open checking, I added some
    debug code to see if we had other spots where we're checking rlimit()
    against the async io-wq workers. The only one I found was file size
    checking, which we should also honor.
    
    During write and fallocate prep, store the max file size and override
    that for the current ask if we're in io-wq worker context.
    
    Cc: stable@vger.kernel.org # 5.1+
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a181a74610e634e117c796b802d68421b5124eb6
Author: Gao Xiang <xiang@kernel.org>
Date:   Wed Feb 26 16:10:06 2020 +0800

    erofs: correct the remaining shrink objects
    
    commit 9d5a09c6f3b5fb85af20e3a34827b5d27d152b34 upstream.
    
    The remaining count should not include successful
    shrink attempts.
    
    Fixes: e7e9a307be9d ("staging: erofs: introduce workstation for decompression")
    Cc: <stable@vger.kernel.org> # 4.19+
    Link: https://lore.kernel.org/r/20200226081008.86348-1-gaoxiang25@huawei.com
    Reviewed-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 433868b19ce00e52f862f1ed30375c402472d830
Author: Rosioru Dragos <dragos.rosioru@nxp.com>
Date:   Tue Feb 25 17:05:52 2020 +0200

    crypto: mxs-dcp - fix scatterlist linearization for hash
    
    commit fa03481b6e2e82355c46644147b614f18c7a8161 upstream.
    
    The incorrect traversal of the scatterlist, during the linearization phase
    lead to computing the hash value of the wrong input buffer.
    New implementation uses scatterwalk_map_and_copy()
    to address this issue.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 15b59e7c3733 ("crypto: mxs - Add Freescale MXS DCP driver")
    Signed-off-by: Rosioru Dragos <dragos.rosioru@nxp.com>
    Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 248414f50596b2d7cc2721c826c48fde2b6b2f5f
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Jan 20 17:38:04 2020 +0300

    crypto: rng - Fix a refcounting bug in crypto_rng_reset()
    
    commit eed74b3eba9eda36d155c11a12b2b4b50c67c1d8 upstream.
    
    We need to decrement this refcounter on these error paths.
    
    Fixes: f7d76e05d058 ("crypto: user - fix use_after_free of struct xxx_request")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Acked-by: Neil Horman <nhorman@tuxdriver.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b936b1872baeb72dd705f9c91803b9c805d1125
Author: Nikita Shubin <NShubin@topcon.com>
Date:   Fri Mar 6 10:24:53 2020 +0300

    remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
    
    commit 791c13b709dd51eb37330f2a5837434e90c87c27 upstream.
    
    Undefined rproc_ops .kick method in remoteproc driver will result in
    "Unable to handle kernel NULL pointer dereference" in rproc_virtio_notify,
    after firmware loading if:
    
     1) .kick method wasn't defined in driver
     2) resource_table exists in firmware and has "Virtio device entry" defined
    
    Let's refuse to register an rproc-induced virtio device if no kick method was
    defined for rproc.
    
    [   13.180049][  T415] 8<--- cut here ---
    [   13.190558][  T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [   13.212544][  T415] pgd = (ptrval)
    [   13.217052][  T415] [00000000] *pgd=00000000
    [   13.224692][  T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM
    [   13.231318][  T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc]
    [   13.241687][  T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6
    [   13.250561][  T415] Hardware name: Freescale i.MX7 Dual (Device Tree)
    [   13.257009][  T415] PC is at 0x0
    [   13.260249][  T415] LR is at rproc_virtio_notify+0x2c/0x54
    [   13.265738][  T415] pc : [<00000000>]    lr : [<8050f6b0>]    psr: 60010113
    [   13.272702][  T415] sp : b8d47c48  ip : 00000001  fp : bc04de00
    [   13.278625][  T415] r10: bc04c000  r9 : 00000cc0  r8 : b8d46000
    [   13.284548][  T415] r7 : 00000000  r6 : b898f200  r5 : 00000000  r4 : b8a29800
    [   13.291773][  T415] r3 : 00000000  r2 : 990a3ad4  r1 : 00000000  r0 : b8a29800
    [   13.299000][  T415] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
    [   13.306833][  T415] Control: 10c5387d  Table: b8b4806a  DAC: 00000051
    [   13.313278][  T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval))
    [   13.320591][  T415] Stack: (0xb8d47c48 to 0xb8d48000)
    [   13.325651][  T415] 7c40:                   b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18
    [   13.334531][  T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2
    [   13.343410][  T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4
    [   13.352290][  T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000
    [   13.361170][  T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210
    [   13.370049][  T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114
    [   13.378929][  T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634
    [   13.387809][  T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744
    [   13.396689][  T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4
    [   13.405569][  T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210
    [   13.414449][  T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4
    [   13.423328][  T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210
    [   13.432209][  T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20
    [   13.441088][  T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007
    [   13.449968][  T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0
    [   13.458848][  T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0
    [   13.467728][  T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8
    [   13.476608][  T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880
    [   13.485487][  T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0
    [   13.494367][  T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0
    [   13.503246][  T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c
    [   13.512125][  T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910
    [   13.521005][  T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c
    [   13.529884][  T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0
    [   13.538764][  T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000
    [   13.547644][  T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000
    [   13.556524][  T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004
    [   13.565403][  T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000
    [   13.574283][  T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000
    [   13.583162][  T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000
    [   13.592056][  T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34)
    [   13.601298][  T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus])
    [   13.611663][  T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4)
    [   13.622022][  T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450)
    [   13.630817][  T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac)
    [   13.639873][  T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8)
    [   13.649102][  T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164)
    [   13.658069][  T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c)
    [   13.666950][  T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768)
    [   13.675572][  T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc)
    [   13.684541][  T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8)
    [   13.694466][  T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200)
    [   13.703521][  T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0)
    [   13.711708][  T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8)
    [   13.719723][  T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214)
    [   13.728348][  T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc)
    [   13.736971][  T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c)
    [   13.744985][  T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4)
    [   13.752825][  T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54)
    [   13.761178][  T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0)
    [   13.766932][  T415] 7fa0:                   0000006c 008fbea0 00000001 008fbea0 00000006 00000000
    [   13.775811][  T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000
    [   13.784687][  T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206
    [   13.790442][  T415] Code: bad PC value
    [   13.839214][  T415] ---[ end trace 1fe21ecfc9f28852 ]---
    
    Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Nikita Shubin <NShubin@topcon.com>
    Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200306072452.24743-1-NShubin@topcon.com
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5b677eddc547e3bf7e64ccd02fba1ad373d820b9
Author: Sibi Sankar <sibis@codeaurora.org>
Date:   Thu Mar 5 01:17:29 2020 +0530

    remoteproc: qcom_q6v5_mss: Reload the mba region on coredump
    
    commit d96f2571dc84d128cacf1944f4ecc87834c779a6 upstream.
    
    On secure devices after a wdog/fatal interrupt, the mba region has to be
    refreshed in order to prevent the following errors during mba load.
    
    Err Logs:
    remoteproc remoteproc2: stopped remote processor 4080000.remoteproc
    qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232
    qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232
    ....
    qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232
    qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
    
    Fixes: 7dd8ade24dc2a ("remoteproc: qcom: q6v5-mss: Add custom dump function for modem")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
    Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Link: https://lore.kernel.org/r/20200304194729.27979-4-sibis@codeaurora.org
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 241f681d19e16527a697a9e6e2796b2e54f3855e
Author: Bjorn Andersson <bjorn.andersson@linaro.org>
Date:   Thu Mar 5 01:17:27 2020 +0530

    remoteproc: qcom_q6v5_mss: Don't reassign mpss region on shutdown
    
    commit 900fc60df22748dbc28e4970838e8f7b8f1013ce upstream.
    
    Trying to reclaim mpss memory while the mba is not running causes the
    system to crash on devices with security fuses blown, so leave it
    assigned to the remote on shutdown and recover it on a subsequent boot.
    
    Fixes: 6c5a9dc2481b ("remoteproc: qcom: Make secure world call for mem ownership switch")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
    Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Link: https://lore.kernel.org/r/20200304194729.27979-2-sibis@codeaurora.org
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87a9058d5552a99060a3ff343f35bb882f820488
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Thu Mar 19 10:11:32 2020 -0400

    btrfs: use nofs allocations for running delayed items
    
    commit 351cbf6e4410e7ece05e35d0a07320538f2418b4 upstream.
    
    Zygo reported the following lockdep splat while testing the balance
    patches
    
    ======================================================
    WARNING: possible circular locking dependency detected
    5.6.0-c6f0579d496a+ #53 Not tainted
    ------------------------------------------------------
    kswapd0/1133 is trying to acquire lock:
    ffff888092f622c0 (&delayed_node->mutex){+.+.}, at: __btrfs_release_delayed_node+0x7c/0x5b0
    
    but task is already holding lock:
    ffffffff8fc5f860 (fs_reclaim){+.+.}, at: __fs_reclaim_acquire+0x5/0x30
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #1 (fs_reclaim){+.+.}:
           fs_reclaim_acquire.part.91+0x29/0x30
           fs_reclaim_acquire+0x19/0x20
           kmem_cache_alloc_trace+0x32/0x740
           add_block_entry+0x45/0x260
           btrfs_ref_tree_mod+0x6e2/0x8b0
           btrfs_alloc_tree_block+0x789/0x880
           alloc_tree_block_no_bg_flush+0xc6/0xf0
           __btrfs_cow_block+0x270/0x940
           btrfs_cow_block+0x1ba/0x3a0
           btrfs_search_slot+0x999/0x1030
           btrfs_insert_empty_items+0x81/0xe0
           btrfs_insert_delayed_items+0x128/0x7d0
           __btrfs_run_delayed_items+0xf4/0x2a0
           btrfs_run_delayed_items+0x13/0x20
           btrfs_commit_transaction+0x5cc/0x1390
           insert_balance_item.isra.39+0x6b2/0x6e0
           btrfs_balance+0x72d/0x18d0
           btrfs_ioctl_balance+0x3de/0x4c0
           btrfs_ioctl+0x30ab/0x44a0
           ksys_ioctl+0xa1/0xe0
           __x64_sys_ioctl+0x43/0x50
           do_syscall_64+0x77/0x2c0
           entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    -> #0 (&delayed_node->mutex){+.+.}:
           __lock_acquire+0x197e/0x2550
           lock_acquire+0x103/0x220
           __mutex_lock+0x13d/0xce0
           mutex_lock_nested+0x1b/0x20
           __btrfs_release_delayed_node+0x7c/0x5b0
           btrfs_remove_delayed_node+0x49/0x50
           btrfs_evict_inode+0x6fc/0x900
           evict+0x19a/0x2c0
           dispose_list+0xa0/0xe0
           prune_icache_sb+0xbd/0xf0
           super_cache_scan+0x1b5/0x250
           do_shrink_slab+0x1f6/0x530
           shrink_slab+0x32e/0x410
           shrink_node+0x2a5/0xba0
           balance_pgdat+0x4bd/0x8a0
           kswapd+0x35a/0x800
           kthread+0x1e9/0x210
           ret_from_fork+0x3a/0x50
    
    other info that might help us debug this:
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(fs_reclaim);
                                   lock(&delayed_node->mutex);
                                   lock(fs_reclaim);
      lock(&delayed_node->mutex);
    
     *** DEADLOCK ***
    
    3 locks held by kswapd0/1133:
     #0: ffffffff8fc5f860 (fs_reclaim){+.+.}, at: __fs_reclaim_acquire+0x5/0x30
     #1: ffffffff8fc380d8 (shrinker_rwsem){++++}, at: shrink_slab+0x1e8/0x410
     #2: ffff8881e0e6c0e8 (&type->s_umount_key#42){++++}, at: trylock_super+0x1b/0x70
    
    stack backtrace:
    CPU: 2 PID: 1133 Comm: kswapd0 Not tainted 5.6.0-c6f0579d496a+ #53
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
    Call Trace:
     dump_stack+0xc1/0x11a
     print_circular_bug.isra.38.cold.57+0x145/0x14a
     check_noncircular+0x2a9/0x2f0
     ? print_circular_bug.isra.38+0x130/0x130
     ? stack_trace_consume_entry+0x90/0x90
     ? save_trace+0x3cc/0x420
     __lock_acquire+0x197e/0x2550
     ? btrfs_inode_clear_file_extent_range+0x9b/0xb0
     ? register_lock_class+0x960/0x960
     lock_acquire+0x103/0x220
     ? __btrfs_release_delayed_node+0x7c/0x5b0
     __mutex_lock+0x13d/0xce0
     ? __btrfs_release_delayed_node+0x7c/0x5b0
     ? __asan_loadN+0xf/0x20
     ? pvclock_clocksource_read+0xeb/0x190
     ? __btrfs_release_delayed_node+0x7c/0x5b0
     ? mutex_lock_io_nested+0xc20/0xc20
     ? __kasan_check_read+0x11/0x20
     ? check_chain_key+0x1e6/0x2e0
     mutex_lock_nested+0x1b/0x20
     ? mutex_lock_nested+0x1b/0x20
     __btrfs_release_delayed_node+0x7c/0x5b0
     btrfs_remove_delayed_node+0x49/0x50
     btrfs_evict_inode+0x6fc/0x900
     ? btrfs_setattr+0x840/0x840
     ? do_raw_spin_unlock+0xa8/0x140
     evict+0x19a/0x2c0
     dispose_list+0xa0/0xe0
     prune_icache_sb+0xbd/0xf0
     ? invalidate_inodes+0x310/0x310
     super_cache_scan+0x1b5/0x250
     do_shrink_slab+0x1f6/0x530
     shrink_slab+0x32e/0x410
     ? do_shrink_slab+0x530/0x530
     ? do_shrink_slab+0x530/0x530
     ? __kasan_check_read+0x11/0x20
     ? mem_cgroup_protected+0x13d/0x260
     shrink_node+0x2a5/0xba0
     balance_pgdat+0x4bd/0x8a0
     ? mem_cgroup_shrink_node+0x490/0x490
     ? _raw_spin_unlock_irq+0x27/0x40
     ? finish_task_switch+0xce/0x390
     ? rcu_read_lock_bh_held+0xb0/0xb0
     kswapd+0x35a/0x800
     ? _raw_spin_unlock_irqrestore+0x4c/0x60
     ? balance_pgdat+0x8a0/0x8a0
     ? finish_wait+0x110/0x110
     ? __kasan_check_read+0x11/0x20
     ? __kthread_parkme+0xc6/0xe0
     ? balance_pgdat+0x8a0/0x8a0
     kthread+0x1e9/0x210
     ? kthread_create_worker_on_cpu+0xc0/0xc0
     ret_from_fork+0x3a/0x50
    
    This is because we hold that delayed node's mutex while doing tree
    operations.  Fix this by just wrapping the searches in nofs.
    
    CC: stable@vger.kernel.org # 4.4+
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0425813c2279c6f91fa0c818fd9e70f1298200c2
Author: Robbie Ko <robbieko@synology.com>
Date:   Tue Mar 17 14:31:02 2020 +0800

    btrfs: fix missing semaphore unlock in btrfs_sync_file
    
    commit 6ff06729c22ec0b7498d900d79cc88cfb8aceaeb upstream.
    
    Ordered ops are started twice in sync file, once outside of inode mutex
    and once inside, taking the dio semaphore. There was one error path
    missing the semaphore unlock.
    
    Fixes: aab15e8ec2576 ("Btrfs: fix rare chances for data loss when doing a fast fsync")
    CC: stable@vger.kernel.org # 4.19+
    Signed-off-by: Robbie Ko <robbieko@synology.com>
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    [ add changelog ]
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 08e69ab983da576141bf20b27ce7728bc7eee4c5
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Wed Mar 4 11:18:25 2020 -0500

    btrfs: unset reloc control if we fail to recover
    
    commit fb2d83eefef4e1c717205bac71cb1941edf8ae11 upstream.
    
    If we fail to load an fs root, or fail to start a transaction we can
    bail without unsetting the reloc control, which leads to problems later
    when we free the reloc control but still have it attached to the file
    system.
    
    In the normal path we'll end up calling unset_reloc_control() twice, but
    all it does is set fs_info->reloc_control = NULL, and we can only have
    one balance at a time so it's not racey.
    
    CC: stable@vger.kernel.org # 5.4+
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 098d3da1ad3022254dba68fc08b3cb6f2437e87f
Author: Filipe Manana <fdmanana@suse.com>
Date:   Mon Mar 9 12:41:05 2020 +0000

    btrfs: fix missing file extent item for hole after ranged fsync
    
    commit 95418ed1d10774cd9a49af6f39e216c1256f1eeb upstream.
    
    When doing a fast fsync for a range that starts at an offset greater than
    zero, we can end up with a log that when replayed causes the respective
    inode miss a file extent item representing a hole if we are not using the
    NO_HOLES feature. This is because for fast fsyncs we don't log any extents
    that cover a range different from the one requested in the fsync.
    
    Example scenario to trigger it:
    
      $ mkfs.btrfs -O ^no-holes -f /dev/sdd
      $ mount /dev/sdd /mnt
    
      # Create a file with a single 256K and fsync it to clear to full sync
      # bit in the inode - we want the msync below to trigger a fast fsync.
      $ xfs_io -f -c "pwrite -S 0xab 0 256K" -c "fsync" /mnt/foo
    
      # Force a transaction commit and wipe out the log tree.
      $ sync
    
      # Dirty 768K of data, increasing the file size to 1Mb, and flush only
      # the range from 256K to 512K without updating the log tree
      # (sync_file_range() does not trigger fsync, it only starts writeback
      # and waits for it to finish).
    
      $ xfs_io -c "pwrite -S 0xcd 256K 768K" /mnt/foo
      $ xfs_io -c "sync_range -abw 256K 256K" /mnt/foo
    
      # Now dirty the range from 768K to 1M again and sync that range.
      $ xfs_io -c "mmap -w 768K 256K"        \
               -c "mwrite -S 0xef 768K 256K" \
               -c "msync -s 768K 256K"       \
               -c "munmap"                   \
               /mnt/foo
    
      <power fail>
    
      # Mount to replay the log.
      $ mount /dev/sdd /mnt
      $ umount /mnt
    
      $ btrfs check /dev/sdd
      Opening filesystem to check...
      Checking filesystem on /dev/sdd
      UUID: 482fb574-b288-478e-a190-a9c44a78fca6
      [1/7] checking root items
      [2/7] checking extents
      [3/7] checking free space cache
      [4/7] checking fs roots
      root 5 inode 257 errors 100, file extent discount
      Found file extent holes:
           start: 262144, len: 524288
      ERROR: errors found in fs roots
      found 720896 bytes used, error(s) found
      total csum bytes: 512
      total tree bytes: 131072
      total fs tree bytes: 32768
      total extent tree bytes: 16384
      btree space waste bytes: 123514
      file data blocks allocated: 589824
        referenced 589824
    
    Fix this issue by setting the range to full (0 to LLONG_MAX) when the
    NO_HOLES feature is not enabled. This results in extra work being done
    but it gives the guarantee we don't end up with missing holes after
    replaying the log.
    
    CC: stable@vger.kernel.org # 4.19+
    Reviewed-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b436fbff6fcad111c18360abba670e22c44b1bc3
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Wed Mar 4 11:18:23 2020 -0500

    btrfs: drop block from cache on error in relocation
    
    commit 8e19c9732ad1d127b5575a10f4fbcacf740500ff upstream.
    
    If we have an error while building the backref tree in relocation we'll
    process all the pending edges and then free the node.  However if we
    integrated some edges into the cache we'll lose our link to those edges
    by simply freeing this node, which means we'll leak memory and
    references to any roots that we've found.
    
    Instead we need to use remove_backref_node(), which walks through all of
    the edges that are still linked to this node and free's them up and
    drops any root references we may be holding.
    
    CC: stable@vger.kernel.org # 4.9+
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dd68ba0d735544d76ea79f0a7145085b385fb311
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Fri Feb 14 15:22:06 2020 -0500

    btrfs: set update the uuid generation as soon as possible
    
    commit 75ec1db8717a8f0a9d9c8d033e542fdaa7b73898 upstream.
    
    In my EIO stress testing I noticed I was getting forced to rescan the
    uuid tree pretty often, which was weird.  This is because my error
    injection stuff would sometimes inject an error after log replay but
    before we loaded the UUID tree.  If log replay committed the transaction
    it wouldn't have updated the uuid tree generation, but the tree was
    valid and didn't change, so there's no reason to not update the
    generation here.
    
    Fix this by setting the BTRFS_FS_UPDATE_UUID_TREE_GEN bit immediately
    after reading all the fs roots if the uuid tree generation matches the
    fs generation.  Then any transaction commits that happen during mount
    won't screw up our uuid tree state, forcing us to do needless uuid
    rescans.
    
    Fixes: 70f801754728 ("Btrfs: check UUID tree during mount if required")
    CC: stable@vger.kernel.org # 4.19+
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 441b83a84208ae44e2e0e2c12ccc4876e37e76ef
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Wed Mar 4 11:18:27 2020 -0500

    btrfs: reloc: clean dirty subvols if we fail to start a transaction
    
    commit 6217b0fadd4473a16fabc6aecd7527a9f71af534 upstream.
    
    If we do merge_reloc_roots() we could insert a few roots onto the dirty
    subvol roots list, where we hold a ref on them.  If we fail to start the
    transaction we need to run clean_dirty_subvols() in order to cleanup the
    refs.
    
    CC: stable@vger.kernel.org # 5.4+
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1bd44cada415acb42575dd88dd1d923772321914
Author: Filipe Manana <fdmanana@suse.com>
Date:   Fri Feb 28 13:04:36 2020 +0000

    Btrfs: fix crash during unmount due to race with delayed inode workers
    
    commit f0cc2cd70164efe8f75c5d99560f0f69969c72e4 upstream.
    
    During unmount we can have a job from the delayed inode items work queue
    still running, that can lead to at least two bad things:
    
    1) A crash, because the worker can try to create a transaction just
       after the fs roots were freed;
    
    2) A transaction leak, because the worker can create a transaction
       before the fs roots are freed and just after we committed the last
       transaction and after we stopped the transaction kthread.
    
    A stack trace example of the crash:
    
     [79011.691214] kernel BUG at lib/radix-tree.c:982!
     [79011.692056] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
     [79011.693180] CPU: 3 PID: 1394 Comm: kworker/u8:2 Tainted: G        W         5.6.0-rc2-btrfs-next-54 #2
     (...)
     [79011.696789] Workqueue: btrfs-delayed-meta btrfs_work_helper [btrfs]
     [79011.697904] RIP: 0010:radix_tree_tag_set+0xe7/0x170
     (...)
     [79011.702014] RSP: 0018:ffffb3c84a317ca0 EFLAGS: 00010293
     [79011.702949] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
     [79011.704202] RDX: ffffb3c84a317cb0 RSI: ffffb3c84a317ca8 RDI: ffff8db3931340a0
     [79011.705463] RBP: 0000000000000005 R08: 0000000000000005 R09: ffffffff974629d0
     [79011.706756] R10: ffffb3c84a317bc0 R11: 0000000000000001 R12: ffff8db393134000
     [79011.708010] R13: ffff8db3931340a0 R14: ffff8db393134068 R15: 0000000000000001
     [79011.709270] FS:  0000000000000000(0000) GS:ffff8db3b6a00000(0000) knlGS:0000000000000000
     [79011.710699] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     [79011.711710] CR2: 00007f22c2a0a000 CR3: 0000000232ad4005 CR4: 00000000003606e0
     [79011.712958] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     [79011.714205] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
     [79011.715448] Call Trace:
     [79011.715925]  record_root_in_trans+0x72/0xf0 [btrfs]
     [79011.716819]  btrfs_record_root_in_trans+0x4b/0x70 [btrfs]
     [79011.717925]  start_transaction+0xdd/0x5c0 [btrfs]
     [79011.718829]  btrfs_async_run_delayed_root+0x17e/0x2b0 [btrfs]
     [79011.719915]  btrfs_work_helper+0xaa/0x720 [btrfs]
     [79011.720773]  process_one_work+0x26d/0x6a0
     [79011.721497]  worker_thread+0x4f/0x3e0
     [79011.722153]  ? process_one_work+0x6a0/0x6a0
     [79011.722901]  kthread+0x103/0x140
     [79011.723481]  ? kthread_create_worker_on_cpu+0x70/0x70
     [79011.724379]  ret_from_fork+0x3a/0x50
     (...)
    
    The following diagram shows a sequence of steps that lead to the crash
    during ummount of the filesystem:
    
            CPU 1                                             CPU 2                                CPU 3
    
     btrfs_punch_hole()
       btrfs_btree_balance_dirty()
         btrfs_balance_delayed_items()
           --> sees
               fs_info->delayed_root->items
               with value 200, which is greater
               than
               BTRFS_DELAYED_BACKGROUND (128)
               and smaller than
               BTRFS_DELAYED_WRITEBACK (512)
           btrfs_wq_run_delayed_node()
             --> queues a job for
                 fs_info->delayed_workers to run
                 btrfs_async_run_delayed_root()
    
                                                                                                btrfs_async_run_delayed_root()
                                                                                                  --> job queued by CPU 1
    
                                                                                                  --> starts picking and running
                                                                                                      delayed nodes from the
                                                                                                      prepare_list list
    
                                                     close_ctree()
    
                                                       btrfs_delete_unused_bgs()
    
                                                       btrfs_commit_super()
    
                                                         btrfs_join_transaction()
                                                           --> gets transaction N
    
                                                         btrfs_commit_transaction(N)
                                                           --> set transaction state
                                                            to TRANTS_STATE_COMMIT_START
    
                                                                                                 btrfs_first_prepared_delayed_node()
                                                                                                   --> picks delayed node X through
                                                                                                       the prepared_list list
    
                                                           btrfs_run_delayed_items()
    
                                                             btrfs_first_delayed_node()
                                                               --> also picks delayed node X
                                                                   but through the node_list
                                                                   list
    
                                                             __btrfs_commit_inode_delayed_items()
                                                                --> runs all delayed items from
                                                                    this node and drops the
                                                                    node's item count to 0
                                                                    through call to
                                                                    btrfs_release_delayed_inode()
    
                                                             --> finishes running any remaining
                                                                 delayed nodes
    
                                                           --> finishes transaction commit
    
                                                       --> stops cleaner and transaction threads
    
                                                       btrfs_free_fs_roots()
                                                         --> frees all roots and removes them
                                                             from the radix tree
                                                             fs_info->fs_roots_radix
    
                                                                                                 btrfs_join_transaction()
                                                                                                   start_transaction()
                                                                                                     btrfs_record_root_in_trans()
                                                                                                       record_root_in_trans()
                                                                                                         radix_tree_tag_set()
                                                                                                           --> crashes because
                                                                                                               the root is not in
                                                                                                               the radix tree
                                                                                                               anymore
    
    If the worker is able to call btrfs_join_transaction() before the unmount
    task frees the fs roots, we end up leaking a transaction and all its
    resources, since after the call to btrfs_commit_super() and stopping the
    transaction kthread, we don't expect to have any transaction open anymore.
    
    When this situation happens the worker has a delayed node that has no
    more items to run, since the task calling btrfs_run_delayed_items(),
    which is doing a transaction commit, picks the same node and runs all
    its items first.
    
    We can not wait for the worker to complete when running delayed items
    through btrfs_run_delayed_items(), because we call that function in
    several phases of a transaction commit, and that could cause a deadlock
    because the worker calls btrfs_join_transaction() and the task doing the
    transaction commit may have already set the transaction state to
    TRANS_STATE_COMMIT_DOING.
    
    Also it's not possible to get into a situation where only some of the
    items of a delayed node are added to the fs/subvolume tree in the current
    transaction and the remaining ones in the next transaction, because when
    running the items of a delayed inode we lock its mutex, effectively
    waiting for the worker if the worker is running the items of the delayed
    node already.
    
    Since this can only cause issues when unmounting a filesystem, fix it in
    a simple way by waiting for any jobs on the delayed workers queue before
    calling btrfs_commit_supper() at close_ctree(). This works because at this
    point no one can call btrfs_btree_balance_dirty() or
    btrfs_balance_delayed_items(), and if we end up waiting for any worker to
    complete, btrfs_commit_super() will commit the transaction created by the
    worker.
    
    CC: stable@vger.kernel.org # 4.4+
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 941dabde6c1a56908696d6642229521a125dd77e
Author: Qu Wenruo <wqu@suse.com>
Date:   Wed Feb 12 14:12:44 2020 +0800

    btrfs: Don't submit any btree write bio if the fs has errors
    
    commit b3ff8f1d380e65dddd772542aa9bff6c86bf715a upstream.
    
    [BUG]
    There is a fuzzed image which could cause KASAN report at unmount time.
    
      BUG: KASAN: use-after-free in btrfs_queue_work+0x2c1/0x390
      Read of size 8 at addr ffff888067cf6848 by task umount/1922
    
      CPU: 0 PID: 1922 Comm: umount Tainted: G        W         5.0.21 #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
      Call Trace:
       dump_stack+0x5b/0x8b
       print_address_description+0x70/0x280
       kasan_report+0x13a/0x19b
       btrfs_queue_work+0x2c1/0x390
       btrfs_wq_submit_bio+0x1cd/0x240
       btree_submit_bio_hook+0x18c/0x2a0
       submit_one_bio+0x1be/0x320
       flush_write_bio.isra.41+0x2c/0x70
       btree_write_cache_pages+0x3bb/0x7f0
       do_writepages+0x5c/0x130
       __writeback_single_inode+0xa3/0x9a0
       writeback_single_inode+0x23d/0x390
       write_inode_now+0x1b5/0x280
       iput+0x2ef/0x600
       close_ctree+0x341/0x750
       generic_shutdown_super+0x126/0x370
       kill_anon_super+0x31/0x50
       btrfs_kill_super+0x36/0x2b0
       deactivate_locked_super+0x80/0xc0
       deactivate_super+0x13c/0x150
       cleanup_mnt+0x9a/0x130
       task_work_run+0x11a/0x1b0
       exit_to_usermode_loop+0x107/0x130
       do_syscall_64+0x1e5/0x280
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    [CAUSE]
    The fuzzed image has a completely screwd up extent tree:
    
      leaf 29421568 gen 8 total ptrs 6 free space 3587 owner EXTENT_TREE
      refs 2 lock (w:0 r:0 bw:0 br:0 sw:0 sr:0) lock_owner 0 current 5938
              item 0 key (12587008 168 4096) itemoff 3942 itemsize 53
                      extent refs 1 gen 9 flags 1
                      ref#0: extent data backref root 5 objectid 259 offset 0 count 1
              item 1 key (12591104 168 8192) itemoff 3889 itemsize 53
                      extent refs 1 gen 9 flags 1
                      ref#0: extent data backref root 5 objectid 271 offset 0 count 1
              item 2 key (12599296 168 4096) itemoff 3836 itemsize 53
                      extent refs 1 gen 9 flags 1
                      ref#0: extent data backref root 5 objectid 259 offset 4096 count 1
              item 3 key (29360128 169 0) itemoff 3803 itemsize 33
                      extent refs 1 gen 9 flags 2
                      ref#0: tree block backref root 5
              item 4 key (29368320 169 1) itemoff 3770 itemsize 33
                      extent refs 1 gen 9 flags 2
                      ref#0: tree block backref root 5
              item 5 key (29372416 169 0) itemoff 3737 itemsize 33
                      extent refs 1 gen 9 flags 2
                      ref#0: tree block backref root 5
    
    Note that leaf 29421568 doesn't have its backref in the extent tree.
    Thus extent allocator can re-allocate leaf 29421568 for other trees.
    
    In short, the bug is caused by:
    
    - Existing tree block gets allocated to log tree
      This got its generation bumped.
    
    - Log tree balance cleaned dirty bit of offending tree block
      It will not be written back to disk, thus no WRITTEN flag.
    
    - Original owner of the tree block gets COWed
      Since the tree block has higher transid, no WRITTEN flag, it's reused,
      and not traced by transaction::dirty_pages.
    
    - Transaction aborted
      Tree blocks get cleaned according to transaction::dirty_pages. But the
      offending tree block is not recorded at all.
    
    - Filesystem unmount
      All pages are assumed to be are clean, destroying all workqueue, then
      call iput(btree_inode).
      But offending tree block is still dirty, which triggers writeback, and
      causes use-after-free bug.
    
    The detailed sequence looks like this:
    
    - Initial status
      eb: 29421568, header=WRITTEN bflags_dirty=0, page_dirty=0, gen=8,
          not traced by any dirty extent_iot_tree.
    
    - New tree block is allocated
      Since there is no backref for 29421568, it's re-allocated as new tree
      block.
      Keep in mind that tree block 29421568 is still referred by extent
      tree.
    
    - Tree block 29421568 is filled for log tree
      eb: 29421568, header=0 bflags_dirty=1, page_dirty=1, gen=9 << (gen bumped)
          traced by btrfs_root::dirty_log_pages
    
    - Some log tree operations
      Since the fs is using node size 4096, the log tree can easily go a
      level higher.
    
    - Log tree needs balance
      Tree block 29421568 gets all its content pushed to right, thus now
      it is empty, and we don't need it.
      btrfs_clean_tree_block() from __push_leaf_right() get called.
    
      eb: 29421568, header=0 bflags_dirty=0, page_dirty=0, gen=9
          traced by btrfs_root::dirty_log_pages
    
    - Log tree write back
      btree_write_cache_pages() goes through dirty pages ranges, but since
      page of tree block 29421568 gets cleaned already, it's not written
      back to disk. Thus it doesn't have WRITTEN bit set.
      But ranges in dirty_log_pages are cleared.
    
      eb: 29421568, header=0 bflags_dirty=0, page_dirty=0, gen=9
          not traced by any dirty extent_iot_tree.
    
    - Extent tree update when committing transaction
      Since tree block 29421568 has transid equal to running trans, and has
      no WRITTEN bit, should_cow_block() will use it directly without adding
      it to btrfs_transaction::dirty_pages.
    
      eb: 29421568, header=0 bflags_dirty=1, page_dirty=1, gen=9
          not traced by any dirty extent_iot_tree.
    
      At this stage, we're doomed. We have a dirty eb not tracked by any
      extent io tree.
    
    - Transaction gets aborted due to corrupted extent tree
      Btrfs cleans up dirty pages according to transaction::dirty_pages and
      btrfs_root::dirty_log_pages.
      But since tree block 29421568 is not tracked by neither of them, it's
      still dirty.
    
      eb: 29421568, header=0 bflags_dirty=1, page_dirty=1, gen=9
          not traced by any dirty extent_iot_tree.
    
    - Filesystem unmount
      Since all cleanup is assumed to be done, all workqueus are destroyed.
      Then iput(btree_inode) is called, expecting no dirty pages.
      But tree 29421568 is still dirty, thus triggering writeback.
      Since all workqueues are already freed, we cause use-after-free.
    
    This shows us that, log tree blocks + bad extent tree can cause wild
    dirty pages.
    
    [FIX]
    To fix the problem, don't submit any btree write bio if the filesytem
    has any error.  This is the last safe net, just in case other cleanup
    haven't caught catch it.
    
    Link: https://github.com/bobfuzzer/CVE/tree/master/CVE-2019-19377
    CC: stable@vger.kernel.org # 5.4+
    Reviewed-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0297b7f9842ecfe0a55aed26a428d727db5372c4
Author: Frieder Schrempf <frieder.schrempf@kontron.de>
Date:   Tue Feb 18 10:05:35 2020 +0000

    mtd: spinand: Do not erase the block before writing a bad block marker
    
    commit b645ad39d56846618704e463b24bb994c9585c7f upstream.
    
    Currently when marking a block, we use spinand_erase_op() to erase
    the block before writing the marker to the OOB area. Doing so without
    waiting for the operation to finish can lead to the marking failing
    silently and no bad block marker being written to the flash.
    
    In fact we don't need to do an erase at all before writing the BBM.
    The ECC is disabled for raw accesses to the OOB data and we don't
    need to work around any issues with chips reporting ECC errors as it
    is known to be the case for raw NAND.
    
    Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-4-frieder.schrempf@kontron.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4da7c98c30812be2fa011725af144d79127ddb32
Author: Frieder Schrempf <frieder.schrempf@kontron.de>
Date:   Tue Feb 18 10:05:14 2020 +0000

    mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers
    
    commit 2148937501ee3d663e0010e519a553fea67ad103 upstream.
    
    For reading and writing the bad block markers, spinand->oobbuf is
    currently used as a buffer for the marker bytes. During the
    underlying read and write operations to actually get/set the content
    of the OOB area, the content of spinand->oobbuf is reused and changed
    by accessing it through spinand->oobbuf and/or spinand->databuf.
    
    This is a flaw in the original design of the SPI NAND core and at the
    latest from 13c15e07eedf ("mtd: spinand: Handle the case where
    PROGRAM LOAD does not reset the cache") on, it results in not having
    the bad block marker written at all, as the spinand->oobbuf is
    cleared to 0xff after setting the marker bytes to zero.
    
    To fix it, we now just store the two bytes for the marker on the
    stack and let the read/write operations copy it from/to the page
    buffer later.
    
    Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-2-frieder.schrempf@kontron.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c138ad0741fc8637db95a4ee47404805d9a48c97
Author: Yilu Lin <linyilu@huawei.com>
Date:   Wed Mar 18 11:59:19 2020 +0800

    CIFS: Fix bug which the return value by asynchronous read is error
    
    commit 97adda8b3ab703de8e4c8d27646ddd54fe22879c upstream.
    
    This patch is used to fix the bug in collect_uncached_read_data()
    that rc is automatically converted from a signed number to an
    unsigned number when the CIFS asynchronous read fails.
    It will cause ctx->rc is error.
    
    Example:
    Share a directory and create a file on the Windows OS.
    Mount the directory to the Linux OS using CIFS.
    On the CIFS client of the Linux OS, invoke the pread interface to
    deliver the read request.
    
    The size of the read length plus offset of the read request is greater
    than the maximum file size.
    
    In this case, the CIFS server on the Windows OS returns a failure
    message (for example, the return value of
    smb2.nt_status is STATUS_INVALID_PARAMETER).
    
    After receiving the response message, the CIFS client parses
    smb2.nt_status to STATUS_INVALID_PARAMETER
    and converts it to the Linux error code (rdata->result=-22).
    
    Then the CIFS client invokes the collect_uncached_read_data function to
    assign the value of rdata->result to rc, that is, rc=rdata->result=-22.
    
    The type of the ctx->total_len variable is unsigned integer,
    the type of the rc variable is integer, and the type of
    the ctx->rc variable is ssize_t.
    
    Therefore, during the ternary operation, the value of rc is
    automatically converted to an unsigned number. The final result is
    ctx->rc=4294967274. However, the expected result is ctx->rc=-22.
    
    Signed-off-by: Yilu Lin <linyilu@huawei.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    CC: Stable <stable@vger.kernel.org>
    Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9b35348318d13f28219d1a08019d36335cff1475
Author: Steve French <stfrench@microsoft.com>
Date:   Mon Feb 24 17:37:39 2020 -0600

    smb3: fix performance regression with setting mtime
    
    commit cf5371ae460eb8e484e4884747af270c86c3c469 upstream.
    
    There are cases when we don't want to send the SMB2 flush operation
    (e.g. when user specifies mount parm "nostrictsync") and it can be
    a very expensive operation on the server.  In most cases in order
    to set mtime, we simply need to flush (write) the dirtry pages from
    the client and send the writes to the server not also send a flush
    protocol operation to the server.
    
    Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
    CC: Stable <stable@vger.kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 40888c31aca3a46f266f1f121679f8e1982df085
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Wed Apr 1 10:13:48 2020 +0200

    KVM: VMX: fix crash cleanup when KVM wasn't used
    
    commit dbef2808af6c594922fe32833b30f55f35e9da6d upstream.
    
    If KVM wasn't used at all before we crash the cleanup procedure fails with
     BUG: unable to handle page fault for address: ffffffffffffffc8
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 23215067 P4D 23215067 PUD 23217067 PMD 0
     Oops: 0000 [#8] SMP PTI
     CPU: 0 PID: 3542 Comm: bash Kdump: loaded Tainted: G      D           5.6.0-rc2+ #823
     RIP: 0010:crash_vmclear_local_loaded_vmcss.cold+0x19/0x51 [kvm_intel]
    
    The root cause is that loaded_vmcss_on_cpu list is not yet initialized,
    we initialize it in hardware_enable() but this only happens when we start
    a VM.
    
    Previously, we used to have a bitmap with enabled CPUs and that was
    preventing [masking] the issue.
    
    Initialized loaded_vmcss_on_cpu list earlier, right before we assign
    crash_vmclear_loaded_vmcss pointer. blocked_vcpu_on_cpu list and
    blocked_vcpu_on_cpu_lock are moved altogether for consistency.
    
    Fixes: 31603d4fc2bb ("KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support")
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Message-Id: <20200401081348.1345307-1-vkuznets@redhat.com>
    Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93a2b736886248a8cf3a5c8129fabc266b8dc6dc
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Thu Mar 26 09:07:12 2020 -0700

    KVM: VMX: Add a trampoline to fix VMREAD error handling
    
    commit 842f4be95899df22b5843ba1a7c8cf37e831a6e8 upstream.
    
    Add a hand coded assembly trampoline to preserve volatile registers
    across vmread_error(), and to handle the calling convention differences
    between 64-bit and 32-bit due to asmlinkage on vmread_error().  Pass
    @field and @fault on the stack when invoking the trampoline to avoid
    clobbering volatile registers in the context of the inline assembly.
    
    Calling vmread_error() directly from inline assembly is partially broken
    on 64-bit, and completely broken on 32-bit.  On 64-bit, it will clobber
    %rdi and %rsi (used to pass @field and @fault) and any volatile regs
    written by vmread_error().  On 32-bit, asmlinkage means vmread_error()
    expects the parameters to be passed on the stack, not via regs.
    
    Opportunistically zero out the result in the trampoline to save a few
    bytes of code for every VMREAD.  A happy side effect of the trampoline
    is that the inline code footprint is reduced by three bytes on 64-bit
    due to PUSH/POP being more efficent (in terms of opcode bytes) than MOV.
    
    Fixes: 6e2020977e3e6 ("KVM: VMX: Add error handling to VMREAD helper")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Message-Id: <20200326160712.28803-1-sean.j.christopherson@intel.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 771b9374a529744c02c503b2a846c458a4aa5aa3
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Sun Jan 26 16:41:11 2020 -0800

    KVM: x86: Gracefully handle __vmalloc() failure during VM allocation
    
    commit d18b2f43b9147c8005ae0844fb445d8cc6a87e31 upstream.
    
    Check the result of __vmalloc() to avoid dereferencing a NULL pointer in
    the event that allocation failres.
    
    Fixes: d1e5b0e98ea27 ("kvm: Make VM ioctl do valloc for some archs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 455f37affe13980e319800d74e66719fa513c6d6
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Sat Mar 21 12:37:49 2020 -0700

    KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support
    
    commit 31603d4fc2bb4f0815245d496cb970b27b4f636a upstream.
    
    VMCLEAR all in-use VMCSes during a crash, even if kdump's NMI shootdown
    interrupted a KVM update of the percpu in-use VMCS list.
    
    Because NMIs are not blocked by disabling IRQs, it's possible that
    crash_vmclear_local_loaded_vmcss() could be called while the percpu list
    of VMCSes is being modified, e.g. in the middle of list_add() in
    vmx_vcpu_load_vmcs().  This potential corner case was called out in the
    original commit[*], but the analysis of its impact was wrong.
    
    Skipping the VMCLEARs is wrong because it all but guarantees that a
    loaded, and therefore cached, VMCS will live across kexec and corrupt
    memory in the new kernel.  Corruption will occur because the CPU's VMCS
    cache is non-coherent, i.e. not snooped, and so the writeback of VMCS
    memory on its eviction will overwrite random memory in the new kernel.
    The VMCS will live because the NMI shootdown also disables VMX, i.e. the
    in-progress VMCLEAR will #UD, and existing Intel CPUs do not flush the
    VMCS cache on VMXOFF.
    
    Furthermore, interrupting list_add() and list_del() is safe due to
    crash_vmclear_local_loaded_vmcss() using forward iteration.  list_add()
    ensures the new entry is not visible to forward iteration unless the
    entire add completes, via WRITE_ONCE(prev->next, new).  A bad "prev"
    pointer could be observed if the NMI shootdown interrupted list_del() or
    list_add(), but list_for_each_entry() does not consume ->prev.
    
    In addition to removing the temporary disabling of VMCLEAR, open code
    loaded_vmcs_init() in __loaded_vmcs_clear() and reorder VMCLEAR so that
    the VMCS is deleted from the list only after it's been VMCLEAR'd.
    Deleting the VMCS before VMCLEAR would allow a race where the NMI
    shootdown could arrive between list_del() and vmcs_clear() and thus
    neither flow would execute a successful VMCLEAR.  Alternatively, more
    code could be moved into loaded_vmcs_init(), but that gets rather silly
    as the only other user, alloc_loaded_vmcs(), doesn't need the smp_wmb()
    and would need to work around the list_del().
    
    Update the smp_*() comments related to the list manipulation, and
    opportunistically reword them to improve clarity.
    
    [*] https://patchwork.kernel.org/patch/1675731/#3720461
    
    Fixes: 8f536b7697a0 ("KVM: VMX: provide the vmclear function and a bitmap to support VMCLEAR in kdump")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Message-Id: <20200321193751.24985-2-sean.j.christopherson@intel.com>
    Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bcd1d7462aba5d47be6ee73de9c9b34952737610
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Tue Feb 18 13:07:15 2020 -0800

    KVM: x86: Allocate new rmap and large page tracking when moving memslot
    
    commit edd4fa37baa6ee8e44dc65523b27bd6fe44c94de upstream.
    
    Reallocate a rmap array and recalcuate large page compatibility when
    moving an existing memslot to correctly handle the alignment properties
    of the new memslot.  The number of rmap entries required at each level
    is dependent on the alignment of the memslot's base gfn with respect to
    that level, e.g. moving a large-page aligned memslot so that it becomes
    unaligned will increase the number of rmap entries needed at the now
    unaligned level.
    
    Not updating the rmap array is the most obvious bug, as KVM accesses
    garbage data beyond the end of the rmap.  KVM interprets the bad data as
    pointers, leading to non-canonical #GPs, unexpected #PFs, etc...
    
      general protection fault: 0000 [#1] SMP
      CPU: 0 PID: 1909 Comm: move_memory_reg Not tainted 5.4.0-rc7+ #139
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      RIP: 0010:rmap_get_first+0x37/0x50 [kvm]
      Code: <48> 8b 3b 48 85 ff 74 ec e8 6c f4 ff ff 85 c0 74 e3 48 89 d8 5b c3
      RSP: 0018:ffffc9000021bbc8 EFLAGS: 00010246
      RAX: ffff00617461642e RBX: ffff00617461642e RCX: 0000000000000012
      RDX: ffff88827400f568 RSI: ffffc9000021bbe0 RDI: ffff88827400f570
      RBP: 0010000000000000 R08: ffffc9000021bd00 R09: ffffc9000021bda8
      R10: ffffc9000021bc48 R11: 0000000000000000 R12: 0030000000000000
      R13: 0000000000000000 R14: ffff88827427d700 R15: ffffc9000021bce8
      FS:  00007f7eda014700(0000) GS:ffff888277a00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f7ed9216ff8 CR3: 0000000274391003 CR4: 0000000000162eb0
      Call Trace:
       kvm_mmu_slot_set_dirty+0xa1/0x150 [kvm]
       __kvm_set_memory_region.part.64+0x559/0x960 [kvm]
       kvm_set_memory_region+0x45/0x60 [kvm]
       kvm_vm_ioctl+0x30f/0x920 [kvm]
       do_vfs_ioctl+0xa1/0x620
       ksys_ioctl+0x66/0x70
       __x64_sys_ioctl+0x16/0x20
       do_syscall_64+0x4c/0x170
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7f7ed9911f47
      Code: <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 21 6f 2c 00 f7 d8 64 89 01 48
      RSP: 002b:00007ffc00937498 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 0000000001ab0010 RCX: 00007f7ed9911f47
      RDX: 0000000001ab1350 RSI: 000000004020ae46 RDI: 0000000000000004
      RBP: 000000000000000a R08: 0000000000000000 R09: 00007f7ed9214700
      R10: 00007f7ed92149d0 R11: 0000000000000246 R12: 00000000bffff000
      R13: 0000000000000003 R14: 00007f7ed9215000 R15: 0000000000000000
      Modules linked in: kvm_intel kvm irqbypass
      ---[ end trace 0c5f570b3358ca89 ]---
    
    The disallow_lpage tracking is more subtle.  Failure to update results
    in KVM creating large pages when it shouldn't, either due to stale data
    or again due to indexing beyond the end of the metadata arrays, which
    can lead to memory corruption and/or leaking data to guest/userspace.
    
    Note, the arrays for the old memslot are freed by the unconditional call
    to kvm_free_memslot() in __kvm_set_memory_region().
    
    Fixes: 05da45583de9b ("KVM: MMU: large page support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Reviewed-by: Peter Xu <peterx@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c7fb8c91c0f3d4bba4ce305bbec46f739f3aa06
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Apr 3 17:30:47 2020 +0200

    KVM: s390: vsie: Fix delivery of addressing exceptions
    
    commit 4d4cee96fb7a3cc53702a9be8299bf525be4ee98 upstream.
    
    Whenever we get an -EFAULT, we failed to read in guest 2 physical
    address space. Such addressing exceptions are reported via a program
    intercept to the nested hypervisor.
    
    We faked the intercept, we have to return to guest 2. Instead, right
    now we would be returning -EFAULT from the intercept handler, eventually
    crashing the VM.
    the correct thing to do is to return 1 as rc == 1 is the internal
    representation of "we have to go back into g2".
    
    Addressing exceptions can only happen if the g2->g3 page tables
    reference invalid g2 addresses (say, either a table or the final page is
    not accessible - so something that basically never happens in sane
    environments.
    
    Identified by manual code inspection.
    
    Fixes: a3508fbe9dc6 ("KVM: s390: vsie: initial support for nested virtualization")
    Cc: <stable@vger.kernel.org> # v4.8+
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Link: https://lore.kernel.org/r/20200403153050.20569-3-david@redhat.com
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
    [borntraeger@de.ibm.com: fix patch description]
    Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 654b70e84710302f0f979d28b349748883765387
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Apr 3 17:30:46 2020 +0200

    KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks
    
    commit a1d032a49522cb5368e5dfb945a85899b4c74f65 upstream.
    
    In case we have a region 1 the following calculation
    (31 + ((gmap->asce & _ASCE_TYPE_MASK) >> 2)*11)
    results in 64. As shifts beyond the size are undefined the compiler is
    free to use instructions like sllg. sllg will only use 6 bits of the
    shift value (here 64) resulting in no shift at all. That means that ALL
    addresses will be rejected.
    
    The can result in endless loops, e.g. when prefix cannot get mapped.
    
    Fixes: 4be130a08420 ("s390/mm: add shadow gmap support")
    Tested-by: Janosch Frank <frankja@linux.ibm.com>
    Reported-by: Janosch Frank <frankja@linux.ibm.com>
    Cc: <stable@vger.kernel.org> # v4.8+
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Link: https://lore.kernel.org/r/20200403153050.20569-2-david@redhat.com
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
    [borntraeger@de.ibm.com: fix patch description, remove WARN_ON_ONCE]
    Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c5bfcda87913a3a6041dff1f7a5208e820b8a09
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Mon Mar 2 22:27:35 2020 -0800

    KVM: nVMX: Properly handle userspace interrupt window request
    
    commit a1c77abb8d93381e25a8d2df3a917388244ba776 upstream.
    
    Return true for vmx_interrupt_allowed() if the vCPU is in L2 and L1 has
    external interrupt exiting enabled.  IRQs are never blocked in hardware
    if the CPU is in the guest (L2 from L1's perspective) when IRQs trigger
    VM-Exit.
    
    The new check percolates up to kvm_vcpu_ready_for_interrupt_injection()
    and thus vcpu_run(), and so KVM will exit to userspace if userspace has
    requested an interrupt window (to inject an IRQ into L1).
    
    Remove the @external_intr param from vmx_check_nested_events(), which is
    actually an indicator that userspace wants an interrupt window, e.g.
    it's named @req_int_win further up the stack.  Injecting a VM-Exit into
    L1 to try and bounce out to L0 userspace is all kinds of broken and is
    no longer necessary.
    
    Remove the hack in nested_vmx_vmexit() that attempted to workaround the
    breakage in vmx_check_nested_events() by only filling interrupt info if
    there's an actual interrupt pending.  The hack actually made things
    worse because it caused KVM to _never_ fill interrupt info when the
    LAPIC resides in userspace (kvm_cpu_has_interrupt() queries
    interrupt.injected, which is always cleared by prepare_vmcs12() before
    reaching the hack in nested_vmx_vmexit()).
    
    Fixes: 6550c4df7e50 ("KVM: nVMX: Fix interrupt window request with "Acknowledge interrupt on exit"")
    Cc: stable@vger.kernel.org
    Cc: Liran Alon <liran.alon@oracle.com>
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 99a890ed700921f01d16e00b7a03f4eb679ae3b6
Author: Kristian Klausen <kristian@klausen.dk>
Date:   Tue Mar 3 19:02:15 2020 +0100

    platform/x86: asus-wmi: Support laptops where the first battery is named BATT
    
    commit 6b3586d45bba14f6912f37488090c37a3710e7b4 upstream.
    
    The WMI method to set the charge threshold does not provide a
    way to specific a battery, so we assume it is the first/primary
    battery (by checking if the name is BAT0).
    On some newer ASUS laptops (Zenbook UM431DA) though, the
    primary/first battery isn't named BAT0 but BATT, so we need
    to support that case.
    
    Fixes: 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kristian Klausen <kristian@klausen.dk>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bd90b96e34863deb2a408cb09f26c4bbee3bef57
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue Feb 25 22:36:37 2020 +0100

    x86/entry/32: Add missing ASM_CLAC to general_protection entry
    
    commit 3d51507f29f2153a658df4a0674ec5b592b62085 upstream.
    
    All exception entry points must have ASM_CLAC right at the
    beginning. The general_protection entry is missing one.
    
    Fixes: e59d1b0a2419 ("x86-32, smap: Add STAC/CLAC instructions to 32-bit kernel entry")
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
    Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
    Reviewed-by: Andy Lutomirski <luto@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200225220216.219537887@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3dc06261a41f5de3a2e2481f8513639b28649c4d
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sun Feb 23 15:06:10 2020 +0100

    x86/tsc_msr: Make MSR derived TSC frequency more accurate
    
    commit fac01d11722c92a186b27ee26cd429a8066adfb5 upstream.
    
    The "Intel 64 and IA-32 Architectures Software Developer’s Manual Volume 4:
    Model-Specific Registers" has the following table for the values from
    freq_desc_byt:
    
       000B: 083.3 MHz
       001B: 100.0 MHz
       010B: 133.3 MHz
       011B: 116.7 MHz
       100B: 080.0 MHz
    
    Notice how for e.g the 83.3 MHz value there are 3 significant digits, which
    translates to an accuracy of a 1000 ppm, where as a typical crystal
    oscillator is 20 - 100 ppm, so the accuracy of the frequency format used in
    the Software Developer’s Manual is not really helpful.
    
    As far as we know Bay Trail SoCs use a 25 MHz crystal and Cherry Trail
    uses a 19.2 MHz crystal, the crystal is the source clock for a root PLL
    which outputs 1600 and 100 MHz. It is unclear if the root PLL outputs are
    used directly by the CPU clock PLL or if there is another PLL in between.
    
    This does not matter though, we can model the chain of PLLs as a single PLL
    with a quotient equal to the quotients of all PLLs in the chain multiplied.
    
    So we can create a simplified model of the CPU clock setup using a
    reference clock of 100 MHz plus a quotient which gets us as close to the
    frequency from the SDM as possible.
    
    For the 83.3 MHz example from above this would give 100 MHz * 5 / 6 = 83
    and 1/3 MHz, which matches exactly what has been measured on actual
    hardware.
    
    Use a simplified PLL model with a reference clock of 100 MHz for all Bay
    and Cherry Trail models.
    
    This has been tested on the following models:
    
                  CPU freq before:        CPU freq after:
    Intel N2840   2165.800 MHz            2166.667 MHz
    Intel Z3736   1332.800 MHz            1333.333 MHz
    Intel Z3775   1466.300 MHz            1466.667 MHz
    Intel Z8350   1440.000 MHz            1440.000 MHz
    Intel Z8750   1600.000 MHz            1600.000 MHz
    
    This fixes the time drifting by about 1 second per hour (20 - 30 seconds
    per day) on (some) devices which rely on the tsc_msr.c code to determine
    the TSC frequency.
    
    Reported-by: Vipul Kumar <vipulk0511@gmail.com>
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200223140610.59612-3-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 41a7f842e312d831ce4e9614ff676d65be0a9536
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sun Feb 23 15:06:09 2020 +0100

    x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices
    
    commit c8810e2ffc30c7e1577f9c057c4b85d984bbc35a upstream.
    
    According to the "Intel 64 and IA-32 Architectures Software Developer's
    Manual Volume 4: Model-Specific Registers" on Cherry Trail (Airmont)
    devices the 4 lowest bits of the MSR_FSB_FREQ mask indicate the bus freq
    unlike on e.g. Bay Trail where only the lowest 3 bits are used.
    
    This is also the reason why MAX_NUM_FREQS is defined as 9, since Cherry
    Trail SoCs have 9 possible frequencies, so the lo value from the MSR needs
    to be masked with 0x0f, not with 0x07 otherwise the 9th frequency will get
    interpreted as the 1st.
    
    Bump MAX_NUM_FREQS to 16 to avoid any possibility of addressing the array
    out of bounds and makes the mask part of the cpufreq struct so it can be
    set it per model.
    
    While at it also log an error when the index points to an uninitialized
    part of the freqs lookup-table.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200223140610.59612-2-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c63cf15d066961dae2292c70ab54c016e66898d
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sun Feb 23 15:06:08 2020 +0100

    x86/tsc_msr: Use named struct initializers
    
    commit 812c2d7506fde7cdf83cb2532810a65782b51741 upstream.
    
    Use named struct initializers for the freq_desc struct-s initialization
    and change the "u8 msr_plat" to a "bool use_msr_plat" to make its meaning
    more clear instead of relying on a comment to explain it.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200223140610.59612-1-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5f2d04139aa5ed04eab54b84e8a25bab87a2449c
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Mon Mar 30 19:01:04 2020 -0500

    signal: Extend exec_id to 64bits
    
    commit d1e7fd6462ca9fc76650fbe6ca800e35b24267da upstream.
    
    Replace the 32bit exec_id with a 64bit exec_id to make it impossible
    to wrap the exec_id counter.  With care an attacker can cause exec_id
    wrap and send arbitrary signals to a newly exec'd parent.  This
    bypasses the signal sending checks if the parent changes their
    credentials during exec.
    
    The severity of this problem can been seen that in my limited testing
    of a 32bit exec_id it can take as little as 19s to exec 65536 times.
    Which means that it can take as little as 14 days to wrap a 32bit
    exec_id.  Adam Zabrocki has succeeded wrapping the self_exe_id in 7
    days.  Even my slower timing is in the uptime of a typical server.
    Which means self_exec_id is simply a speed bump today, and if exec
    gets noticably faster self_exec_id won't even be a speed bump.
    
    Extending self_exec_id to 64bits introduces a problem on 32bit
    architectures where reading self_exec_id is no longer atomic and can
    take two read instructions.  Which means that is is possible to hit
    a window where the read value of exec_id does not match the written
    value.  So with very lucky timing after this change this still
    remains expoiltable.
    
    I have updated the update of exec_id on exec to use WRITE_ONCE
    and the read of exec_id in do_notify_parent to use READ_ONCE
    to make it clear that there is no locking between these two
    locations.
    
    Link: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl
    Fixes: 2.3.23pre2
    Cc: stable@vger.kernel.org
    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a993df8d6092cf9e6d2fa76325f6052cc8718d5
Author: Remi Pommarel <repk@triplefau.lt>
Date:   Sat Feb 29 17:13:47 2020 +0100

    ath9k: Handle txpower changes even when TPC is disabled
    
    commit 968ae2caad0782db5dbbabb560d3cdefd2945d38 upstream.
    
    When TPC is disabled IEEE80211_CONF_CHANGE_POWER event can be handled to
    reconfigure HW's maximum txpower.
    
    This fixes 0dBm txpower setting when user attaches to an interface for
    the first time with the following scenario:
    
    ieee80211_do_open()
        ath9k_add_interface()
            ath9k_set_txpower() /* Set TX power with not yet initialized
                                   sc->hw->conf.power_level */
    
        ieee80211_hw_config() /* Iniatilize sc->hw->conf.power_level and
                                 raise IEEE80211_CONF_CHANGE_POWER */
    
        ath9k_config() /* IEEE80211_CONF_CHANGE_POWER is ignored */
    
    This issue can be reproduced with the following:
    
      $ modprobe -r ath9k
      $ modprobe ath9k
      $ wpa_supplicant -i wlan0 -c /tmp/wpa.conf &
      $ iw dev /* Here TX power is either 0 or 3 depending on RF chain */
      $ killall wpa_supplicant
      $ iw dev /* TX power goes back to calibrated value and subsequent
                  calls will be fine */
    
    Fixes: 283dd11994cde ("ath9k: add per-vif TX power capability")
    Cc: stable@vger.kernel.org
    Signed-off-by: Remi Pommarel <repk@triplefau.lt>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d941b33bdc68af8397be817a85c64487c8834ba8
Author: Neeraj Upadhyay <neeraju@codeaurora.org>
Date:   Mon Mar 23 10:38:51 2020 +0530

    PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
    
    commit 87de6594dc45dbf6819f3e0ef92f9331c5a9444c upstream.
    
    Skip wakeup_source_sysfs_remove() to fix a NULL pinter dereference via
    ws->dev, if the wakeup source is unregistered before registering the
    wakeup class from device_add().
    
    Fixes: 2ca3d1ecb8c4 ("PM / wakeup: Register wakeup class kobj after device is added")
    Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
    [ rjw: Subject & changelog, white space ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4fcbc35fab573b731713134f40d4ad62b17a4962
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue Mar 10 11:40:23 2020 +0100

    PM / Domains: Allow no domain-idle-states DT property in genpd when parsing
    
    commit 56cb26891ea4180121265dc6b596015772c4a4b8 upstream.
    
    Commit 2c361684803e ("PM / Domains: Don't treat zero found compatible idle
    states as an error"), moved of_genpd_parse_idle_states() towards allowing
    none compatible idle state to be found for the device node, rather than
    returning an error code.
    
    However, it didn't consider that the "domain-idle-states" DT property may
    be missing as it's optional, which makes of_count_phandle_with_args() to
    return -ENOENT. Let's fix this to make the behaviour consistent.
    
    Fixes: 2c361684803e ("PM / Domains: Don't treat zero found compatible idle states as an error")
    Reported-by: Benjamin Gaignard <benjamin.gaignard@st.com>
    Cc: 4.20+ <stable@vger.kernel.org> # 4.20+
    Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5bd5307cd26440f04d6e1ae5080d7975d6d1392f
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date:   Tue Jan 22 14:18:42 2019 -0600

    MIPS: OCTEON: irq: Fix potential NULL pointer dereference
    
    commit 792a402c2840054533ef56279c212ef6da87d811 upstream.
    
    There is a potential NULL pointer dereference in case kzalloc()
    fails and returns NULL.
    
    Fix this by adding a NULL check on *cd*
    
    This bug was detected with the help of Coccinelle.
    
    Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes")
    Cc: stable@vger.kernel.org
    Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed374eee8ce649fa157f5fad7e46a9674accdc0d
Author: Huacai Chen <chenhc@lemote.com>
Date:   Wed Mar 25 11:44:54 2020 +0800

    MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3
    
    commit d191aaffe3687d1e73e644c185f5f0550ec242b5 upstream.
    
    LDDIR/LDPTE is Loongson-3's acceleration for Page Table Walking. If BD
    (Base Directory, the 4th page directory) is not enabled, then GDOffset
    is biased by BadVAddr[63:62]. So, if GDOffset (aka. BadVAddr[47:36] for
    Loongson-3) is big enough, "0b11(BadVAddr[63:62])|BadVAddr[47:36]|...."
    can far beyond pg_swapper_dir. This means the pg_swapper_dir may NOT be
    accessed by LDDIR correctly, so fix it by set PWDirExt in CP0_PWCtl.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Pei Huang <huangpei@loongson.cn>
    Signed-off-by: Huacai Chen <chenhc@lemote.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4acbbe98e06a1b64c211b5cd4857e78f924aff41
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Tue Feb 25 11:11:20 2020 +0300

    pstore: pstore_ftrace_seq_next should increase position index
    
    commit 6c871b7314dde9ab64f20de8f5aa3d01be4518e8 upstream.
    
    In Aug 2018 NeilBrown noticed
    commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
    "Some ->next functions do not increment *pos when they return NULL...
    Note that such ->next functions are buggy and should be fixed.
    A simple demonstration is
    
     dd if=/proc/swaps bs=1000 skip=1
    
    Choose any block size larger than the size of /proc/swaps. This will
    always show the whole last line of /proc/swaps"
    
    /proc/swaps output was fixed recently, however there are lot of other
    affected files, and one of them is related to pstore subsystem.
    
    If .next function does not change position index, following .show function
    will repeat output related to current position index.
    
    There are at least 2 related problems:
    - read after lseek beyond end of file, described above by NeilBrown
      "dd if=<AFFECTED_FILE> bs=1000 skip=1" will generate whole last list
    - read after lseek on in middle of last line will output expected rest of
      last line but then repeat whole last line once again.
    
    If .show() function generates multy-line output (like
    pstore_ftrace_seq_show() does ?) following bash script cycles endlessly
    
     $ q=;while read -r r;do echo "$((++q)) $r";done < AFFECTED_FILE
    
    Unfortunately I'm not familiar enough to pstore subsystem and was unable
    to find affected pstore-related file on my test node.
    
    If .next function does not change position index, following .show function
    will repeat output related to current position index.
    
    Cc: stable@vger.kernel.org
    Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Link: https://lore.kernel.org/r/4e49830d-4c88-0171-ee24-1ee540028dad@virtuozzo.com
    [kees: with robustness tweak from Joel Fernandes <joelaf@google.com>]
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 38119a6897662c2e1b4a0d6f407957d473a13234
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Apr 3 13:54:26 2020 -0600

    io_uring: remove bogus RLIMIT_NOFILE check in file registration
    
    commit c336e992cb1cb1db9ee608dfb30342ae781057ab upstream.
    
    We already checked this limit when the file was opened, and we keep it
    open in the file table. Hence when we added unit_inflight to the count
    we want to register, we're doubly accounting these files. This results
    in -EMFILE for file registration, if we're at half the limit.
    
    Cc: stable@vger.kernel.org # v5.1+
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6124e10dbc4ff68f3442f7dae845912d085f80fc
Author: Sungbo Eo <mans0n@gorani.run>
Date:   Sat Mar 21 22:38:42 2020 +0900

    irqchip/versatile-fpga: Apply clear-mask earlier
    
    commit 6a214a28132f19ace3d835a6d8f6422ec80ad200 upstream.
    
    Clear its own IRQs before the parent IRQ get enabled, so that the
    remaining IRQs do not accidentally interrupt the parent IRQ controller.
    
    This patch also fixes a reboot bug on OX820 SoC, where the remaining
    rps-timer IRQ raises a GIC interrupt that is left pending. After that,
    the rps-timer IRQ is cleared during driver initialization, and there's
    no IRQ left in rps-irq when local_irq_enable() is called, which evokes
    an error message "unexpected IRQ trap".
    
    Fixes: bdd272cbb97a ("irqchip: versatile FPGA: support cascaded interrupts from DT")
    Signed-off-by: Sungbo Eo <mans0n@gorani.run>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200321133842.2408823-1-mans0n@gorani.run
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f3700c4697b6397d4bfcf6ebecd2a5f3221231c
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Fri Mar 6 14:03:42 2020 +0100

    genirq/debugfs: Add missing sanity checks to interrupt injection
    
    commit a740a423c36932695b01a3e920f697bc55b05fec upstream.
    
    Interrupts cannot be injected when the interrupt is not activated and when
    a replay is already in progress.
    
    Fixes: 536e2e34bd00 ("genirq/debugfs: Triggering of interrupts from userspace")
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200306130623.500019114@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6ecc37daf64ebb8abe8a758921effb58616a3364
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Fri Mar 27 12:06:44 2020 +0100

    cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()
    
    commit e98eac6ff1b45e4e73f2e6031b37c256ccb5d36b upstream.
    
    A recent change to freeze_secondary_cpus() which added an early abort if a
    wakeup is pending missed the fact that the function is also invoked for
    shutdown, reboot and kexec via disable_nonboot_cpus().
    
    In case of disable_nonboot_cpus() the wakeup event needs to be ignored as
    the purpose is to terminate the currently running kernel.
    
    Add a 'suspend' argument which is only set when the freeze is in context of
    a suspend operation. If not set then an eventually pending wakeup event is
    ignored.
    
    Fixes: a66d955e910a ("cpu/hotplug: Abort disabling secondary CPUs if wakeup is pending")
    Reported-by: Boqun Feng <boqun.feng@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/874kuaxdiz.fsf@nanos.tec.linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4b67e5afc2a0cb67a2f508a35d9fd42eef0c99e4
Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Date:   Fri Feb 28 12:41:51 2020 +0800

    KEYS: reaching the keys quotas correctly
    
    commit 2e356101e72ab1361821b3af024d64877d9a798d upstream.
    
    Currently, when we add a new user key, the calltrace as below:
    
    add_key()
      key_create_or_update()
        key_alloc()
        __key_instantiate_and_link
          generic_key_instantiate
            key_payload_reserve
              ......
    
    Since commit a08bf91ce28e ("KEYS: allow reaching the keys quotas exactly"),
    we can reach max bytes/keys in key_alloc, but we forget to remove this
    limit when we reserver space for payload in key_payload_reserve. So we
    can only reach max keys but not max bytes when having delta between plen
    and type->def_datalen. Remove this limit when instantiating the key, so we
    can keep consistent with key_alloc.
    
    Also, fix the similar problem in keyctl_chown_key().
    
    Fixes: 0b77f5bfb45c ("keys: make the keyring quotas controllable through /proc/sys")
    Fixes: a08bf91ce28e ("KEYS: allow reaching the keys quotas exactly")
    Cc: stable@vger.kernel.org # 5.0.x
    Cc: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Reviewed-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f7384f90ecc7ae3b07f59678c2037787ec5122d0
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Tue Feb 25 09:26:22 2020 +0300

    tpm: tpm2_bios_measurements_next should increase position index
    
    commit f9bf8adb55cd5a357b247a16aafddf8c97b276e0 upstream.
    
    If .next function does not change position index,
    following .show function will repeat output related
    to current position index.
    
    For /sys/kernel/security/tpm0/binary_bios_measurements:
    1) read after lseek beyound end of file generates whole last line.
    2) read after lseek to middle of last line generates
    expected end of last line and unexpected whole last line once again.
    
    Cc: stable@vger.kernel.org # 4.19.x
    Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27544e1bdcc625e659834ef91951b38a0b223ee3
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Tue Feb 25 09:26:08 2020 +0300

    tpm: tpm1_bios_measurements_next should increase position index
    
    commit d7a47b96ed1102551eb7325f97937e276fb91045 upstream.
    
    If .next function does not change position index,
    following .show function will repeat output related
    to current position index.
    
    In case of /sys/kernel/security/tpm0/ascii_bios_measurements
    and binary_bios_measurements:
    1) read after lseek beyound end of file generates whole last line.
    2) read after lseek to middle of last line generates
    expected end of last line and unexpected whole last line once again.
    
    Cc: stable@vger.kernel.org # 4.19.x
    Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 96e05bb57b4077db6da2b7f336f7749d45c87e47
Author: Matthew Garrett <matthewgarrett@google.com>
Date:   Thu Jan 2 13:55:18 2020 -0800

    tpm: Don't make log failures fatal
    
    commit 805fa88e0780b7ce1cc9b649dd91a0a7164c6eb4 upstream.
    
    If a TPM is in disabled state, it's reasonable for it to have an empty
    log. Bailing out of probe in this case means that the PPI interface
    isn't available, so there's no way to then enable the TPM from the OS.
    In general it seems reasonable to ignore log errors - they shouldn't
    interfere with any other TPM functionality.
    
    Signed-off-by: Matthew Garrett <matthewgarrett@google.com>
    Cc: stable@vger.kernel.org # 4.19.x
    Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
    Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 524089fa70ef10ba972c77818a7d145610598162
Author: Vincent Guittot <vincent.guittot@linaro.org>
Date:   Fri Mar 6 14:52:57 2020 +0100

    sched/fair: Fix enqueue_task_fair warning
    
    commit fe61468b2cbc2b7ce5f8d3bf32ae5001d4c434e9 upstream.
    
    When a cfs rq is throttled, the latter and its child are removed from the
    leaf list but their nr_running is not changed which includes staying higher
    than 1. When a task is enqueued in this throttled branch, the cfs rqs must
    be added back in order to ensure correct ordering in the list but this can
    only happens if nr_running == 1.
    When cfs bandwidth is used, we call unconditionnaly list_add_leaf_cfs_rq()
    when enqueuing an entity to make sure that the complete branch will be
    added.
    
    Similarly unthrottle_cfs_rq() can stop adding cfs in the list when a parent
    is throttled. Iterate the remaining entity to ensure that the complete
    branch will be added in the list.
    
    Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Cc: stable@vger.kernel.org
    Cc: stable@vger.kernel.org #v5.1+
    Link: https://lkml.kernel.org/r/20200306135257.25044-1-vincent.guittot@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8b6f8619fc96df797644c6dfe2fb8654e4c472f5
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Mon Feb 24 15:23:36 2020 +0530

    PCI: endpoint: Fix for concurrent memory allocation in OB address region
    
    commit 04e046ca57ebed3943422dee10eec9e73aec081e upstream.
    
    pci-epc-mem uses a bitmap to manage the Endpoint outbound (OB) address
    region. This address region will be shared by multiple endpoint
    functions (in the case of multi function endpoint) and it has to be
    protected from concurrent access to avoid updating an inconsistent state.
    
    Use a mutex to protect bitmap updates to prevent the memory
    allocation API from returning incorrect addresses.
    
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 96843346b2018180638ac1af86742cfcff568f59
Author: Bjorn Andersson <bjorn.andersson@linaro.org>
Date:   Thu Dec 26 17:27:17 2019 -0800

    PCI: qcom: Fix the fixup of PCI_VENDOR_ID_QCOM
    
    commit 604f3956524a6a53c1e3dd27b4b685b664d181ec upstream.
    
    There exists non-bridge PCIe devices with PCI_VENDOR_ID_QCOM, so limit
    the fixup to only affect the relevant PCIe bridges.
    
    Fixes: 322f03436692 ("PCI: qcom: Use default config space read function")
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>
    Cc: stable@vger.kernel.org # v5.2+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 55b61a08bf86a61126ef35eb0e4c9daf9681087b
Author: Sean V Kelley <sean.v.kelley@linux.intel.com>
Date:   Thu Feb 20 11:29:29 2020 -0800

    PCI: Add boot interrupt quirk mechanism for Xeon chipsets
    
    commit b88bf6c3b6ff77948c153cac4e564642b0b90632 upstream.
    
    The following was observed by Kar Hin Ong with RT patchset:
    
      Backtrace:
      irq 19: nobody cared (try booting with the "irqpoll" option)
      CPU: 0 PID: 3329 Comm: irq/34-nipalk Tainted:4.14.87-rt49 #1
      Hardware name: National Instruments NI PXIe-8880/NI PXIe-8880,
               BIOS 2.1.5f1 01/09/2020
      Call Trace:
      <IRQ>
        ? dump_stack+0x46/0x5e
        ? __report_bad_irq+0x2e/0xb0
        ? note_interrupt+0x242/0x290
        ? nNIKAL100_memoryRead16+0x8/0x10 [nikal]
        ? handle_irq_event_percpu+0x55/0x70
        ? handle_irq_event+0x4f/0x80
        ? handle_fasteoi_irq+0x81/0x180
        ? handle_irq+0x1c/0x30
        ? do_IRQ+0x41/0xd0
        ? common_interrupt+0x84/0x84
      </IRQ>
      ...
      handlers:
      [<ffffffffb3297200>] irq_default_primary_handler threaded
      [<ffffffffb3669180>] usb_hcd_irq
      Disabling IRQ #19
    
    The problem being that this device is triggering boot interrupts
    due to threaded interrupt handling and masking of the IO-APIC. These
    boot interrupts are then forwarded on to the legacy PCH's PIRQ lines
    where there is no handler present for the device.
    
    Whenever a PCI device fires interrupt (INTx) to Pin 20 of IOAPIC 2
    (GSI 44), the kernel receives two interrupts:
    
       1. Interrupt from Pin 20 of IOAPIC 2  -> Expected
       2. Interrupt from Pin 19 of IOAPIC 1  -> UNEXPECTED
    
    Quirks for disabling boot interrupts (preferred) or rerouting the
    handler exist but do not address these Xeon chipsets' mechanism:
    https://lore.kernel.org/lkml/12131949181903-git-send-email-sassmann@suse.de/
    
    Add a new mechanism via PCI CFG for those chipsets supporting CIPINTRC
    register's dis_intx_rout2ich bit.
    
    Link: https://lore.kernel.org/r/20200220192930.64820-2-sean.v.kelley@linux.intel.com
    Reported-by: Kar Hin Ong <kar.hin.ong@ni.com>
    Tested-by: Kar Hin Ong <kar.hin.ong@ni.com>
    Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72d52a779e991f54767fa86d60ef7e3ab5b3e33b
Author: Yicong Yang <yangyicong@hisilicon.com>
Date:   Fri Mar 13 17:53:47 2020 +0800

    PCI/ASPM: Clear the correct bits when enabling L1 substates
    
    commit 58a3862a10a317a81097ab0c78aecebabb1704f5 upstream.
    
    In pcie_config_aspm_l1ss(), we cleared the wrong bits when enabling ASPM L1
    Substates.  Instead of the L1.x enable bits (PCI_L1SS_CTL1_L1SS_MASK, 0xf), we
    cleared the Link Activation Interrupt Enable bit (PCI_L1SS_CAP_L1_PM_SS,
    0x10).
    
    Clear the L1.x enable bits before writing the new L1.x configuration.
    
    [bhelgaas: changelog]
    Fixes: aeda9adebab8 ("PCI/ASPM: Configure L1 substate settings")
    Link: https://lore.kernel.org/r/1584093227-1292-1-git-send-email-yangyicong@hisilicon.com
    Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: stable@vger.kernel.org      # v4.11+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 463181e64f5fe0ea4bf97e9e8d081b524f84c168
Author: Lukas Wunner <lukas@wunner.de>
Date:   Wed Mar 18 12:33:12 2020 +0100

    PCI: pciehp: Fix indefinite wait on sysfs requests
    
    commit 3e487d2e4aa466decd226353755c9d423e8fbacc upstream.
    
    David Hoyer reports that powering pciehp slots up or down via sysfs may
    hang:  The call to wait_event() in pciehp_sysfs_enable_slot() and
    _disable_slot() does not return because ctrl->ist_running remains true.
    
    This flag, which was introduced by commit 157c1062fcd8 ("PCI: pciehp: Avoid
    returning prematurely from sysfs requests"), signifies that the IRQ thread
    pciehp_ist() is running.  It is set to true at the top of pciehp_ist() and
    reset to false at the end.  However there are two additional return
    statements in pciehp_ist() before which the commit neglected to reset the
    flag to false and wake up waiters for the flag.
    
    That omission opens up the following race when powering up the slot:
    
    * pciehp_ist() runs because a PCI_EXP_SLTSTA_PDC event was requested
      by pciehp_sysfs_enable_slot()
    
    * pciehp_ist() turns on slot power via the following call stack:
      pciehp_handle_presence_or_link_change() -> pciehp_enable_slot() ->
      __pciehp_enable_slot() -> board_added() -> pciehp_power_on_slot()
    
    * after slot power is turned on, the link comes up, resulting in a
      PCI_EXP_SLTSTA_DLLSC event
    
    * the IRQ handler pciehp_isr() stores the event in ctrl->pending_events
      and returns IRQ_WAKE_THREAD
    
    * the IRQ thread is already woken (it's bringing up the slot), but the
      genirq code remembers to re-run the IRQ thread after it has finished
      (such that it can deal with the new event) by setting IRQTF_RUNTHREAD
      via __handle_irq_event_percpu() -> __irq_wake_thread()
    
    * the IRQ thread removes PCI_EXP_SLTSTA_DLLSC from ctrl->pending_events
      via board_added() -> pciehp_check_link_status() in order to deal with
      presence and link flaps per commit 6c35a1ac3da6 ("PCI: pciehp:
      Tolerate initially unstable link")
    
    * after pciehp_ist() has successfully brought up the slot, it resets
      ctrl->ist_running to false and wakes up the sysfs requester
    
    * the genirq code re-runs pciehp_ist(), which sets ctrl->ist_running
      to true but then returns with IRQ_NONE because ctrl->pending_events
      is empty
    
    * pciehp_sysfs_enable_slot() is finally woken but notices that
      ctrl->ist_running is true, hence continues waiting
    
    The only way to get the hung task going again is to trigger a hotplug
    event which brings down the slot, e.g. by yanking out the card.
    
    The same race exists when powering down the slot because remove_board()
    likewise clears link or presence changes in ctrl->pending_events per commit
    3943af9d01e9 ("PCI: pciehp: Ignore Link State Changes after powering off a
    slot") and thereby may cause a re-run of pciehp_ist() which returns with
    IRQ_NONE without resetting ctrl->ist_running to false.
    
    Fix by adding a goto label before the teardown steps at the end of
    pciehp_ist() and jumping to that label from the two return statements which
    currently neglect to reset the ctrl->ist_running flag.
    
    Fixes: 157c1062fcd8 ("PCI: pciehp: Avoid returning prematurely from sysfs requests")
    Link: https://lore.kernel.org/r/cca1effa488065cb055120aa01b65719094bdcb5.1584530321.git.lukas@wunner.de
    Reported-by: David Hoyer <David.Hoyer@netapp.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Keith Busch <kbusch@kernel.org>
    Cc: stable@vger.kernel.org      # v4.19+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c755ca32c8cde47454f5054b6c7691350947a416
Author: Tom Lendacky <thomas.lendacky@amd.com>
Date:   Fri Feb 28 13:14:03 2020 +0100

    efi/x86: Add TPM related EFI tables to unencrypted mapping checks
    
    commit f10e80a19b07b58fc2adad7945f8313b01503bae upstream.
    
    When booting with SME active, EFI tables must be mapped unencrypted since
    they were built by UEFI in unencrypted memory. Update the list of tables
    to be checked during early_memremap() processing to account for the EFI
    TPM tables.
    
    This fixes a bug where an EFI TPM log table has been created by UEFI, but
    it lives in memory that has been marked as usable rather than reserved.
    
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: linux-efi@vger.kernel.org
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
    Cc: <stable@vger.kernel.org> # v5.4+
    Link: https://lore.kernel.org/r/4144cd813f113c20cdfa511cf59500a64e6015be.1582662842.git.thomas.lendacky@amd.com
    Link: https://lore.kernel.org/r/20200228121408.9075-2-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 91bed1f1fb97f7d1357e669176f1df9f7b59c7a0
Author: James Smart <jsmart2021@gmail.com>
Date:   Fri Apr 3 07:33:20 2020 -0700

    nvme-fc: Revert "add module to ops template to allow module references"
    
    commit 8c5c660529209a0e324c1c1a35ce3f83d67a2aa5 upstream.
    
    The original patch was to resolve the lldd being able to be unloaded
    while being used to talk to the boot device of the system. However, the
    end result of the original patch is that any driver unload while a nvme
    controller is live via the lldd is now being prohibited. Given the module
    reference, the module teardown routine can't be called, thus there's no
    way, other than manual actions to terminate the controllers.
    
    Fixes: 863fbae929c7 ("nvme_fc: add module to ops template to allow module references")
    Cc: <stable@vger.kernel.org> # v5.4+
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0eb4d8b985be17ce39038367f222081a3aae238a
Author: Sagi Grimberg <sagi@grimberg.me>
Date:   Tue Feb 25 16:42:27 2020 -0800

    nvmet-tcp: fix maxh2cdata icresp parameter
    
    commit 9cda34e37489244a8c8628617e24b2dbc8a8edad upstream.
    
    MAXH2CDATA is not zero based. Also no reason to limit ourselves to
    1M transfers as we can do more easily. Make this an arbitrary limit
    of 16M.
    
    Reported-by: Wenhua Liu <liuw@vmware.com>
    Cc: stable@vger.kernel.org # v5.0+
    Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b3c7227ad4c686023e42bc52222540b552bf3141
Author: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date:   Fri Apr 3 22:51:33 2020 +0200

    thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n
    
    commit 3f5b9959041e0db6dacbea80bb833bff5900999f upstream.
    
    When CONFIG_DEVFREQ_THERMAL is disabled all functions except
    of_devfreq_cooling_register_power() were already inlined. Also inline
    the last function to avoid compile errors when multiple drivers call
    of_devfreq_cooling_register_power() when CONFIG_DEVFREQ_THERMAL is not
    set. Compilation failed with the following message:
      multiple definition of `of_devfreq_cooling_register_power'
    (which then lists all usages of of_devfreq_cooling_register_power())
    
    Thomas Zimmermann reported this problem [0] on a kernel config with
    CONFIG_DRM_LIMA={m,y}, CONFIG_DRM_PANFROST={m,y} and
    CONFIG_DEVFREQ_THERMAL=n after both, the lima and panfrost drivers
    gained devfreq cooling support.
    
    [0] https://www.spinics.net/lists/dri-devel/msg252825.html
    
    Fixes: a76caf55e5b356 ("thermal: Add devfreq cooling")
    Cc: stable@vger.kernel.org
    Reported-by: Thomas Zimmermann <tzimmermann@suse.de>
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Link: https://lore.kernel.org/r/20200403205133.1101808-1-martin.blumenstingl@googlemail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e7251a88d387b7dd6a1e20031b19ba076094c007
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Mar 25 11:55:48 2020 +0100

    ACPI: PM: s2idle: Refine active GPEs check
    
    commit d5406284ff803a578ca503373624312770319054 upstream.
    
    The check for any active GPEs added by commit fdde0ff8590b ("ACPI:
    PM: s2idle: Prevent spurious SCIs from waking up the system") turns
    out to be insufficiently precise to prevent some systems from
    resuming prematurely due to a spurious EC wakeup, so refine it
    by first checking if any GPEs other than the EC GPE are active
    and skipping all of the SCIs coming from the EC that do not produce
    any genuine wakeup events after processing.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629
    Fixes: fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system")
    Reported-by: Ondřej Caletka <ondrej@caletka.cz>
    Tested-by: Ondřej Caletka <ondrej@caletka.cz>
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dd993e283bc37164379121812870bd348746dba2
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Mar 25 11:54:29 2020 +0100

    ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE
    
    commit 0ce792d660bda990c675eaf14ce09594a9b85cbf upstream.
    
    The check carried out by acpi_any_gpe_status_set() is not precise enough
    for the suspend-to-idle implementation in Linux and in some cases it is
    necessary make it skip one GPE (specifically, the EC GPE) from the check
    to prevent a race condition leading to a premature system resume from
    occurring.
    
    For this reason, redefine acpi_any_gpe_status_set() to take the number
    of a GPE to skip as an argument.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629
    Tested-by: Ondřej Caletka <ondrej@caletka.cz>
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1efd20ea57d44cf70b8e38723adca5d2205d9ca0
Author: Jan Engelhardt <jengelh@inai.de>
Date:   Thu Mar 5 13:24:25 2020 +0100

    acpi/x86: ignore unspecified bit positions in the ACPI global lock field
    
    commit ecb9c790999fd6c5af0f44783bd0217f0b89ec2b upstream.
    
    The value in "new" is constructed from "old" such that all bits defined
    as reserved by the ACPI spec[1] are left untouched. But if those bits
    do not happen to be all zero, "new < 3" will not evaluate to true.
    
    The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
    garbage inside the "FACS" ACPI table. The starting value is
    old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
    the reserved bits.
    
    [1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206553
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Jan Engelhardt <jengelh@inai.de>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 52e6985f2c916ff0bb84b0b642cac7b7e6b8efae
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Tue Mar 10 13:33:32 2020 +0100

    seccomp: Add missing compat_ioctl for notify
    
    commit 3db81afd99494a33f1c3839103f0429c8f30cb9d upstream.
    
    Executing the seccomp_bpf testsuite under a 64-bit kernel with 32-bit
    userland (both s390 and x86) doesn't work because there's no compat_ioctl
    handler defined. Add the handler.
    
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200310123332.42255-1-svens@linux.ibm.com
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15ae94fe22117b13da32babde12fe20e194304dc
Author: Benoit Parrot <bparrot@ti.com>
Date:   Fri Mar 6 14:08:39 2020 +0100

    media: ti-vpe: cal: fix a kernel oops when unloading module
    
    commit 80264809ea0a3fd2ee8251f31a9eb85d2c3fc77e upstream.
    
    After the switch to use v4l2_async_notifier_add_subdev() and
    v4l2_async_notifier_cleanup(), unloading the ti_cal module would cause a
    kernel oops.
    
    This was root cause to the fact that v4l2_async_notifier_cleanup() tries
    to kfree the asd pointer passed into v4l2_async_notifier_add_subdev().
    
    In our case the asd reference was from a statically allocated struct.
    So in effect v4l2_async_notifier_cleanup() was trying to free a pointer
    that was not kalloc.
    
    So here we switch to using a kzalloc struct instead of a static one.
    To achieve this we re-order some of the calls to prevent asd allocation
    from leaking.
    
    Fixes: d079f94c9046 ("media: platform: Switch to v4l2_async_notifier_add_subdev")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benoit Parrot <bparrot@ti.com>
    Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3a59d985ceb11523c80857925fa59d60123f3bfa
Author: Benoit Parrot <bparrot@ti.com>
Date:   Mon Mar 2 14:56:52 2020 +0100

    media: ti-vpe: cal: fix disable_irqs to only the intended target
    
    commit 1db56284b9da9056093681f28db48a09a243274b upstream.
    
    disable_irqs() was mistakenly disabling all interrupts when called.
    This cause all port stream to stop even if only stopping one of them.
    
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Benoit Parrot <bparrot@ti.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 46b0e2900ee2d0653e2abb527cc4d0a829e71e28
Author: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Date:   Mon Jan 27 15:30:06 2020 +0100

    media: hantro: Read be32 words starting at every fourth byte
    
    commit e34bca49e4953e5c2afc0425303199a5fd515f82 upstream.
    
    Since (luma/chroma)_qtable is an array of unsigned char, indexing it
    returns consecutive byte locations, but we are supposed to read the arrays
    in four-byte words. Consequently, we should be pointing
    get_unaligned_be32() at consecutive word locations instead.
    
    Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
    Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
    Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
    Cc: stable@vger.kernel.org
    Fixes: 00c30f42c7595f "media: rockchip vpu: remove some unused vars"
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7ac962c5b730fdf7bb00aaaf4d0787505bc0d799
Author: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Date:   Wed Mar 4 11:09:49 2020 +0100

    media: venus: firmware: Ignore secure call error on first resume
    
    commit 2632e7b618a7730969f9782593c29ca53553aa22 upstream.
    
    With the latest cleanup in qcom scm driver the secure monitor
    call for setting the remote processor state returns EINVAL when
    it is called for the first time and after another scm call
    auth_and_reset. The error returned from scm call could be ignored
    because the state transition is already done in auth_and_reset.
    
    Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be9956bac91a882e5a033a3fe0c51cd68488db45
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Apr 8 15:56:45 2020 +0200

    ALSA: hda/realtek - Add quirk for MSI GL63
    
    commit 1d3aa4a5516d2e4933fe3cca11d3349ef63bc547 upstream.
    
    MSI GL63 laptop requires the similar quirk like other MSI models,
    ALC1220_FIXUP_CLEVO_P950.  The board BIOS doesn't provide a PCI SSID
    for the device, hence we need to take the codec SSID (1462:1275)
    instead.
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207157
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200408135645.21896-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 09e7b678f3e0e56776fe0d2b8d5b9dc276efbbba
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu Apr 2 19:43:11 2020 +0200

    ALSA: hda/realtek - Add quirk for Lenovo Carbon X1 8th gen
    
    commit ca707b3f00b4f31a6e1eb37e8ae99f15f2bb1fe5 upstream.
    
    The audio setup on the Lenovo Carbon X1 8th gen is the same as that on
    the Lenovo Carbon X1 7th gen, as such it needs the same
    ALC285_FIXUP_THINKPAD_HEADSET_JACK quirk.
    
    This fixes volume control of the speaker not working among other things.
    
    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1820196
    Cc: stable@vger.kernel.org
    Suggested-by: Jaroslav Kysela <perex@perex.cz>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Link: https://lore.kernel.org/r/20200402174311.238614-1-hdegoede@redhat.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f5462668ad944940943ffc628640ca1384cc035e
Author: Thomas Hebb <tommyhebb@gmail.com>
Date:   Mon Mar 30 12:09:39 2020 -0400

    ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups
    
    commit f36938aa7440f46a0a365f1cfde5f5985af2bef3 upstream.
    
    patch_realtek.c has historically failed to properly configure the PC
    Beep Hidden Register for the ALC256 codec (among others). Depending on
    your kernel version, symptoms of this misconfiguration can range from
    chassis noise, picked up by a poorly-shielded PCBEEP trace, getting
    amplified and played on your internal speaker and/or headphones to loud
    feedback, which responds to the "Headphone Mic Boost" ALSA control,
    getting played through your headphones. For details of the problem, see
    the patch in this series titled "ALSA: hda/realtek - Set principled PC
    Beep configuration for ALC256", which fixes the configuration.
    
    These symptoms have been most noticed on the Dell XPS 13 9350 and 9360,
    popular laptops that use the ALC256. As a result, several model-specific
    fixups have been introduced to try and fix the problem, the most
    egregious of which locks the "Headphone Mic Boost" control as a hack to
    minimize noise from a feedback loop that shouldn't have been there in
    the first place.
    
    Now that the underlying issue has been fixed, remove all these fixups.
    Remaining fixups needed by the XPS 13 are all picked up by existing pin
    quirks.
    
    This change should, for the XPS 13 9350/9360
    
     - Significantly increase volume and audio quality on headphones
     - Eliminate headphone popping on suspend/resume
     - Allow "Headphone Mic Boost" to be set again, making the headphone
       jack fully usable as a microphone jack too.
    
    Fixes: 8c69729b4439 ("ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3")
    Fixes: 423cd785619a ("ALSA: hda - Fix headphone noise on Dell XPS 13 9360")
    Fixes: e4c9fd10eb21 ("ALSA: hda - Apply headphone noise quirk for another Dell XPS 13 variant")
    Fixes: 1099f48457d0 ("ALSA: hda/realtek: Reduce the Headphone static noise on XPS 9350/9360")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
    Link: https://lore.kernel.org/r/b649a00edfde150cf6eebbb4390e15e0c2deb39a.1585584498.git.tommyhebb@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a92931dea6b12b9e7dd43aedba4a980112d529f0
Author: Thomas Hebb <tommyhebb@gmail.com>
Date:   Mon Mar 30 12:09:38 2020 -0400

    ALSA: hda/realtek - Set principled PC Beep configuration for ALC256
    
    commit c44737449468a0bdc50e09ec75e530f208391561 upstream.
    
    The Realtek PC Beep Hidden Register[1] is currently set by
    patch_realtek.c in two different places:
    
    In alc_fill_eapd_coef(), it's set to the value 0x5757, corresponding to
    non-beep input on 1Ah and no 1Ah loopback to either headphones or
    speakers. (Although, curiously, the loopback amp is still enabled.) This
    write was added fairly recently by commit e3743f431143 ("ALSA:
    hda/realtek - Dell headphone has noise on unmute for ALC236") and is a
    safe default. However, it happens in the wrong place:
    alc_fill_eapd_coef() runs on module load and cold boot but not on S3
    resume, meaning the register loses its value after suspend.
    
    Conversely, in alc256_init(), the register is updated to unset bit 13
    (disable speaker loopback) and set bit 5 (set non-beep input on 1Ah).
    Although this write does run on S3 resume, it's not quite enough to fix
    up the register's default value of 0x3717. What's missing is a set of
    bit 14 to disable headphone loopback. Without that, we end up with a
    feedback loop where the headphone jack is being driven by amplified
    samples of itself[2].
    
    This change eliminates the update in alc256_init() and replaces it with
    the 0x5757 write from alc_fill_eapd_coef(). Kailang says that 0x5757 is
    supposed to be the codec's default value, so using it will make
    debugging easier for Realtek.
    
    Affects the ALC255, ALC256, ALC257, ALC235, and ALC236 codecs.
    
    [1] Newly documented in Documentation/sound/hd-audio/realtek-pc-beep.rst
    
    [2] Setting the "Headphone Mic Boost" control from userspace changes
    this feedback loop and has been a widely-shared workaround for headphone
    noise on laptops like the Dell XPS 13 9350. This commit eliminates the
    feedback loop and makes the workaround unnecessary.
    
    Fixes: e1e8c1fdce8b ("ALSA: hda/realtek - Dell headphone has noise on unmute for ALC236")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
    Link: https://lore.kernel.org/r/bf22b417d1f2474b12011c2a39ed6cf8b06d3bf5.1585584498.git.tommyhebb@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0f18192b6924bf2a7ed8ffe02568e351c71943e0
Author: Thomas Hebb <tommyhebb@gmail.com>
Date:   Mon Mar 30 12:09:37 2020 -0400

    ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256
    
    commit f128090491c3f5aacef91a863f8c52abf869c436 upstream.
    
    This codec (among others) has a hidden set of audio routes, apparently
    designed to allow PC Beep output without a mixer widget on the output
    path, which are controlled by an undocumented Realtek vendor register.
    The default configuration of these routes means that certain inputs
    aren't accessible, necessitating driver control of the register.
    However, Realtek has provided no documentation of the register, instead
    opting to fix issues by providing magic numbers, most of which have been
    at least somewhat erroneous. These magic numbers then get copied by
    others into model-specific fixups, leading to a fragmented and buggy set
    of configurations.
    
    To get out of this situation, I've reverse engineered the register by
    flipping bits and observing how the codec's behavior changes. This
    commit documents my findings. It does not change any code.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
    Link: https://lore.kernel.org/r/bd69dfdeaf40ff31c4b7b797c829bb320031739c.1585584498.git.tommyhebb@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3e7167475236a2b6943edd3a1c980f150b1bccb3
Author: Hui Wang <hui.wang@canonical.com>
Date:   Sun Mar 29 16:20:18 2020 +0800

    ALSA: hda/realtek - a fake key event is triggered by running shutup
    
    commit 476c02e0b4fd9071d158f6a1a1dfea1d36ee0ffd upstream.
    
    On the Lenovo X1C7 machines, after we plug the headset, the rt_resume()
    and rt_suspend() of the codec driver will be called periodically, the
    driver can't stay in the rt_suspend state even users doen't use the
    sound card.
    
    Through debugging, I found  when running rt_suspend(), it will call
    alc225_shutup(), in this function, it will change 3k pull down control
    by alc_update_coef_idx(codec, 0x4a, 0, 3 << 10), this will trigger a
    fake key event and that event will resume the codec, when codec
    suspend agin, it will trigger the fake key event one more time, this
    process will repeat.
    
    If disable the key event before changing the pull down control, it
    will not trigger fake key event. It also needs to restore the pull
    down control and re-enable the key event, otherwise the system can't
    get key event when codec is in rt_suspend state.
    
    Also move some functions ahead of alc225_shutup(), this can save the
    function declaration.
    
    Fixes: 76f7dec08fd6 (ALSA: hda/realtek - Add Headset Button supported for ThinkPad X1)
    Cc: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Hui Wang <hui.wang@canonical.com>
    Link: https://lore.kernel.org/r/20200329082018.20486-1-hui.wang@canonical.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit faea9495633366029e79ba0caa5c764ca305a648
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Fri Mar 27 12:46:25 2020 +0800

    ALSA: hda/realtek: Enable mute LED on an HP system
    
    commit f5a88b0accc24c4a9021247d7a3124f90aa4c586 upstream.
    
    The system in question uses ALC285, and it uses GPIO 0x04 to control its
    mute LED.
    
    The mic mute LED can be controlled by GPIO 0x01, however the system uses
    DMIC so we should use that to control mic mute LED.
    
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200327044626.29582-1-kai.heng.feng@canonical.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1dfcd70d1fcc128730a06ed09e6703f22500509c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Apr 3 09:25:15 2020 +0200

    ALSA: pcm: oss: Fix regression by buffer overflow fix
    
    commit ae769d3556644888c964635179ef192995f40793 upstream.
    
    The recent fix for the OOB access in PCM OSS plugins (commit
    f2ecf903ef06: "ALSA: pcm: oss: Avoid plugin buffer overflow") caused a
    regression on OSS applications.  The patch introduced the size check
    in client and slave size calculations to limit to each plugin's buffer
    size, but I overlooked that some code paths call those without
    allocating the buffer but just for estimation.
    
    This patch fixes the bug by skipping the size check for those code
    paths while keeping checking in the actual transfer calls.
    
    Fixes: f2ecf903ef06 ("ALSA: pcm: oss: Avoid plugin buffer overflow")
    Tested-and-reported-by: Jari Ruusu <jari.ruusu@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200403072515.25539-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3ab9c5540e37df2ac3cbbebd3541054df445716
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 7 10:44:02 2020 +0200

    ALSA: ice1724: Fix invalid access for enumerated ctl items
    
    commit c47914c00be346bc5b48c48de7b0da5c2d1a296c upstream.
    
    The access to Analog Capture Source control value implemented in
    prodigy_hifi.c is wrong, as caught by the recently introduced sanity
    check; it should be accessing value.enumerated.item[] instead of
    value.integer.value[].  This patch corrects the wrong access pattern.
    
    Fixes: 6b8d6e5518e2 ("[ALSA] ICE1724: Added support for Audiotrak Prodigy 7.1 HiFi & HD2, Hercules Fortissimo IV")
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207139
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200407084402.25589-3-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a9ba565b41f44afd8fb44148be493e1c40856bd
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 7 10:44:01 2020 +0200

    ALSA: hda: Fix potential access overflow in beep helper
    
    commit 0ad3f0b384d58f3bd1f4fb87d0af5b8f6866f41a upstream.
    
    The beep control helper function blindly stores the values in two
    stereo channels no matter whether the actual control is mono or
    stereo.  This is practically harmless, but it annoys the recently
    introduced sanity check, resulting in an error when the checker is
    enabled.
    
    This patch corrects the behavior to store only on the defined array
    member.
    
    Fixes: 0401e8548eac ("ALSA: hda - Move beep helper functions to hda_beep.c")
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207139
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200407084402.25589-2-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f4f0a1f017e0dd0327da754790f31493bd632526
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Apr 8 16:04:49 2020 +0200

    ALSA: hda: Add driver blacklist
    
    commit 3c6fd1f07ed03a04debbb9a9d782205f1ef5e2ab upstream.
    
    The recent AMD platform exposes an HD-audio bus but without any actual
    codecs, which is internally tied with a USB-audio device, supposedly.
    It results in "no codecs" error of HD-audio bus driver, and it's
    nothing but a waste of resources.
    
    This patch introduces a static blacklist table for skipping such a
    known bogus PCI SSID entry.  As of writing this patch, the known SSIDs
    are:
    * 1043:874f - ASUS ROG Zenith II / Strix
    * 1462:cb59 - MSI TRX40 Creator
    * 1462:cb60 - MSI TRX40
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206543
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200408140449.22319-2-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1ee0023c340ec126d107b3de33a2a4866aa199fe
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Apr 8 16:04:48 2020 +0200

    ALSA: usb-audio: Add mixer workaround for TRX40 and co
    
    commit 2a48218f8e23d47bd3e23cfdfb8aa9066f7dc3e6 upstream.
    
    Some recent boards (supposedly with a new AMD platform) contain the
    USB audio class 2 device that is often tied with HD-audio.  The device
    exposes an Input Gain Pad control (id=19, control=12) but this node
    doesn't behave correctly, returning an error for each inquiry of
    GET_MIN and GET_MAX that should have been mandatory.
    
    As a workaround, simply ignore this node by adding a usbmix_name_map
    table entry.  The currently known devices are:
    * 0414:a002 - Gigabyte TRX40 Aorus Pro WiFi
    * 0b05:1916 - ASUS ROG Zenith II
    * 0b05:1917 - ASUS ROG Strix
    * 0db0:0d64 - MSI TRX40 Creator
    * 0db0:543d - MSI TRX40
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206543
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20200408140449.22319-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78a92756fc2cab07ccffe8e9151cd6d7aa439f64
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Mon Feb 3 18:05:32 2020 -0800

    usb: gadget: composite: Inform controller driver of self-powered
    
    commit 5e5caf4fa8d3039140b4548b6ab23dd17fce9b2c upstream.
    
    Different configuration/condition may draw different power. Inform the
    controller driver of the change so it can respond properly (e.g.
    GET_STATUS request). This fixes an issue with setting MaxPower from
    configfs. The composite driver doesn't check this value when setting
    self-powered.
    
    Cc: stable@vger.kernel.org
    Fixes: 88af8bbe4ef7 ("usb: gadget: the start of the configfs interface")
    Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a385ebdaa4dc7e89aece0ab7824398b959505374
Author: Sriharsha Allenki <sallenki@codeaurora.org>
Date:   Thu Mar 26 17:26:20 2020 +0530

    usb: gadget: f_fs: Fix use after free issue as part of queue failure
    
    commit f63ec55ff904b2f2e126884fcad93175f16ab4bb upstream.
    
    In AIO case, the request is freed up if ep_queue fails.
    However, io_data->req still has the reference to this freed
    request. In the case of this failure if there is aio_cancel
    call on this io_data it will lead to an invalid dequeue
    operation and a potential use after free issue.
    Fix this by setting the io_data->req to NULL when the request
    is freed as part of queue failure.
    
    Fixes: 2e4c7553cd6f ("usb: gadget: f_fs: add aio support")
    Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
    CC: stable <stable@vger.kernel.org>
    Reviewed-by: Peter Chen <peter.chen@nxp.com>
    Link: https://lore.kernel.org/r/20200326115620.12571-1-sallenki@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9a8b1ba9d41f3e897969983bbf45dd08682bb6c2
Author: 이경택 <gt82.lee@samsung.com>
Date:   Wed Apr 1 18:05:24 2020 +0900

    ASoC: topology: use name_prefix for new kcontrol
    
    commit abca9e4a04fbe9c6df4d48ca7517e1611812af25 upstream.
    
    Current topology doesn't add prefix of component to new kcontrol.
    
    Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
    Link: https://lore.kernel.org/r/009b01d60804$ae25c2d0$0a714870$@samsung.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f467e054c03f44653646eae7b2d98816dfcb4326
Author: 이경택 <gt82.lee@samsung.com>
Date:   Wed Apr 1 10:04:21 2020 +0900

    ASoC: dpcm: allow start or stop during pause for backend
    
    commit 21fca8bdbb64df1297e8c65a746c4c9f4a689751 upstream.
    
    soc_compr_trigger_fe() allows start or stop after pause_push.
    In dpcm_be_dai_trigger(), however, only pause_release is allowed
    command after pause_push.
    So, start or stop after pause in compress offload is always
    returned as error if the compress offload is used with dpcm.
    To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed
    for start or stop command.
    
    Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
    Reviewed-by: Vinod Koul <vkoul@kernel.org>
    Link: https://lore.kernel.org/r/004d01d607c1$7a3d5250$6eb7f6f0$@samsung.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af0b76f9f632958bde53a9fa7daec979166ab479
Author: 이경택 <gt82.lee@samsung.com>
Date:   Tue Mar 31 16:55:16 2020 +0900

    ASoC: dapm: connect virtual mux with default value
    
    commit 3bbbb7728fc853d71dbce4073fef9f281fbfb4dd upstream.
    
    Since a virtual mixer has no backing registers
    to decide which path to connect,
    it will try to match with initial state.
    This is to ensure that the default mixer choice will be
    correctly powered up during initialization.
    Invert flag is used to select initial state of the virtual switch.
    Since actual hardware can't be disconnected by virtual switch,
    connected is better choice as initial state in many cases.
    
    Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
    Link: https://lore.kernel.org/r/01a301d60731$b724ea10$256ebe30$@samsung.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 803db8a078682c752727d4c70298ce1cd4678380
Author: 이경택 <gt82.lee@samsung.com>
Date:   Mon Mar 30 16:35:59 2020 +0900

    ASoC: fix regwmask
    
    commit 0ab070917afdc93670c2d0ea02ab6defb6246a7c upstream.
    
    If regwshift is 32 and the selected architecture compiles '<<' operator
    for signed int literal into rotating shift, '1<<regwshift' became 1 and
    it makes regwmask to 0x0.
    The literal is set to unsigned long to get intended regwmask.
    
    Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
    Link: https://lore.kernel.org/r/001001d60665$db7af3e0$9270dba0$@samsung.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit acec0e9a916aa1cefc8f0bd8c2c60dc3d28683c4
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Fri Mar 13 17:17:08 2020 -0400

    btrfs: track reloc roots based on their commit root bytenr
    
    [ Upstream commit ea287ab157c2816bf12aad4cece41372f9d146b4 ]
    
    We always search the commit root of the extent tree for looking up back
    references, however we track the reloc roots based on their current
    bytenr.
    
    This is wrong, if we commit the transaction between relocating tree
    blocks we could end up in this code in build_backref_tree
    
      if (key.objectid == key.offset) {
              /*
               * Only root blocks of reloc trees use backref
               * pointing to itself.
               */
              root = find_reloc_root(rc, cur->bytenr);
              ASSERT(root);
              cur->root = root;
              break;
      }
    
    find_reloc_root() is looking based on the bytenr we had in the commit
    root, but if we've COWed this reloc root we will not find that bytenr,
    and we will trip over the ASSERT(root).
    
    Fix this by using the commit_root->start bytenr for indexing the commit
    root.  Then we change the __update_reloc_root() caller to be used when
    we switch the commit root for the reloc root during commit.
    
    This fixes the panic I was seeing when we started throttling relocation
    for delayed refs.
    
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9632851a53263ad45df46349e104f40248949165
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Fri Mar 13 17:17:07 2020 -0400

    btrfs: restart relocate_tree_blocks properly
    
    [ Upstream commit 50dbbb71c79df89532ec41d118d59386e5a877e3 ]
    
    There are two bugs here, but fixing them independently would just result
    in pain if you happened to bisect between the two patches.
    
    First is how we handle the -EAGAIN from relocate_tree_block().  We don't
    set error, unless we happen to be the first node, which makes no sense,
    I have no idea what the code was trying to accomplish here.
    
    We in fact _do_ want err set here so that we know we need to restart in
    relocate_block_group().  Also we need finish_pending_nodes() to not
    actually call link_to_upper(), because we didn't actually relocate the
    block.
    
    And then if we do get -EAGAIN we do not want to set our backref cache
    last_trans to the one before ours.  This would force us to update our
    backref cache if we didn't cross transaction ids, which would mean we'd
    have some nodes updated to their new_bytenr, but still able to find
    their old bytenr because we're searching the same commit root as the
    last time we went through relocate_tree_blocks.
    
    Fixing these two things keeps us from panicing when we start breaking
    out of relocate_tree_blocks() either for delayed ref flushing or enospc.
    
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ddc25a38ab36a44a9b0d2b8776cbee4950ee16c9
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Wed Mar 4 11:18:30 2020 -0500

    btrfs: remove a BUG_ON() from merge_reloc_roots()
    
    [ Upstream commit 7b7b74315b24dc064bc1c683659061c3d48f8668 ]
    
    This was pretty subtle, we default to reloc roots having 0 root refs, so
    if we crash in the middle of the relocation they can just be deleted.
    If we successfully complete the relocation operations we'll set our root
    refs to 1 in prepare_to_merge() and then go on to merge_reloc_roots().
    
    At prepare_to_merge() time if any of the reloc roots have a 0 reference
    still, we will remove that reloc root from our reloc root rb tree, and
    then clean it up later.
    
    However this only happens if we successfully start a transaction.  If
    we've aborted previously we will skip this step completely, and only
    have reloc roots with a reference count of 0, but were never properly
    removed from the reloc control's rb tree.
    
    This isn't a problem per-se, our references are held by the list the
    reloc roots are on, and by the original root the reloc root belongs to.
    If we end up in this situation all the reloc roots will be added to the
    dirty_reloc_list, and then properly dropped at that point.  The reloc
    control will be free'd and the rb tree is no longer used.
    
    There were two options when fixing this, one was to remove the BUG_ON(),
    the other was to make prepare_to_merge() handle the case where we
    couldn't start a trans handle.
    
    IMO this is the cleaner solution.  I started with handling the error in
    prepare_to_merge(), but it turned out super ugly.  And in the end this
    BUG_ON() simply doesn't matter, the cleanup was happening properly, we
    were just panicing because this BUG_ON() only matters in the success
    case.  So I've opted to just remove it and add a comment where it was.
    
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 679885143c046ef6b0c019fe0afd2242142fe3dc
Author: Qu Wenruo <wqu@suse.com>
Date:   Fri Feb 7 13:38:20 2020 +0800

    btrfs: qgroup: ensure qgroup_rescan_running is only set when the worker is at least queued
    
    [ Upstream commit d61acbbf54c612ea9bf67eed609494cda0857b3a ]
    
    [BUG]
    There are some reports about btrfs wait forever to unmount itself, with
    the following call trace:
    
      INFO: task umount:4631 blocked for more than 491 seconds.
            Tainted: G               X  5.3.8-2-default #1
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      umount          D    0  4631   3337 0x00000000
      Call Trace:
      ([<00000000174adf7a>] __schedule+0x342/0x748)
       [<00000000174ae3ca>] schedule+0x4a/0xd8
       [<00000000174b1f08>] schedule_timeout+0x218/0x420
       [<00000000174af10c>] wait_for_common+0x104/0x1d8
       [<000003ff804d6994>] btrfs_qgroup_wait_for_completion+0x84/0xb0 [btrfs]
       [<000003ff8044a616>] close_ctree+0x4e/0x380 [btrfs]
       [<0000000016fa3136>] generic_shutdown_super+0x8e/0x158
       [<0000000016fa34d6>] kill_anon_super+0x26/0x40
       [<000003ff8041ba88>] btrfs_kill_super+0x28/0xc8 [btrfs]
       [<0000000016fa39f8>] deactivate_locked_super+0x68/0x98
       [<0000000016fcb198>] cleanup_mnt+0xc0/0x140
       [<0000000016d6a846>] task_work_run+0xc6/0x110
       [<0000000016d04f76>] do_notify_resume+0xae/0xb8
       [<00000000174b30ae>] system_call+0xe2/0x2c8
    
    [CAUSE]
    The problem happens when we have called qgroup_rescan_init(), but
    not queued the worker. It can be caused mostly by error handling.
    
            Qgroup ioctl thread             |       Unmount thread
    ----------------------------------------+-----------------------------------
                                            |
    btrfs_qgroup_rescan()                   |
    |- qgroup_rescan_init()                 |
    |  |- qgroup_rescan_running = true;     |
    |                                       |
    |- trans = btrfs_join_transaction()     |
    |  Some error happened                  |
    |                                       |
    |- btrfs_qgroup_rescan() returns error  |
       But qgroup_rescan_running == true;   |
                                            | close_ctree()
                                            | |- btrfs_qgroup_wait_for_completion()
                                            |    |- running == true;
                                            |    |- wait_for_completion();
    
    btrfs_qgroup_rescan_worker is never queued, thus no one is going to wake
    up close_ctree() and we get a deadlock.
    
    All involved qgroup_rescan_init() callers are:
    
    - btrfs_qgroup_rescan()
      The example above. It's possible to trigger the deadlock when error
      happened.
    
    - btrfs_quota_enable()
      Not possible. Just after qgroup_rescan_init() we queue the work.
    
    - btrfs_read_qgroup_config()
      It's possible to trigger the deadlock. It only init the work, the
      work queueing happens in btrfs_qgroup_rescan_resume().
      Thus if error happened in between, deadlock is possible.
    
    We shouldn't set fs_info->qgroup_rescan_running just in
    qgroup_rescan_init(), as at that stage we haven't yet queued qgroup
    rescan worker to run.
    
    [FIX]
    Set qgroup_rescan_running before queueing the work, so that we ensure
    the rescan work is queued when we wait for it.
    
    Fixes: 8d9eddad1946 ("Btrfs: fix qgroup rescan worker initialization")
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    [ Change subject and cause analyse, use a smaller fix ]
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b37de1b1e882fa3741d252333e5745eea444483b
Author: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Date:   Thu Mar 19 19:18:13 2020 +0800

    block, bfq: fix use-after-free in bfq_idle_slice_timer_body
    
    [ Upstream commit 2f95fa5c955d0a9987ffdc3a095e2f4e62c5f2a9 ]
    
    In bfq_idle_slice_timer func, bfqq = bfqd->in_service_queue is
    not in bfqd-lock critical section. The bfqq, which is not
    equal to NULL in bfq_idle_slice_timer, may be freed after passing
    to bfq_idle_slice_timer_body. So we will access the freed memory.
    
    In addition, considering the bfqq may be in race, we should
    firstly check whether bfqq is in service before doing something
    on it in bfq_idle_slice_timer_body func. If the bfqq in race is
    not in service, it means the bfqq has been expired through
    __bfq_bfqq_expire func, and wait_request flags has been cleared in
    __bfq_bfqd_reset_in_service func. So we do not need to re-clear the
    wait_request of bfqq which is not in service.
    
    KASAN log is given as follows:
    [13058.354613] ==================================================================
    [13058.354640] BUG: KASAN: use-after-free in bfq_idle_slice_timer+0xac/0x290
    [13058.354644] Read of size 8 at addr ffffa02cf3e63f78 by task fork13/19767
    [13058.354646]
    [13058.354655] CPU: 96 PID: 19767 Comm: fork13
    [13058.354661] Call trace:
    [13058.354667]  dump_backtrace+0x0/0x310
    [13058.354672]  show_stack+0x28/0x38
    [13058.354681]  dump_stack+0xd8/0x108
    [13058.354687]  print_address_description+0x68/0x2d0
    [13058.354690]  kasan_report+0x124/0x2e0
    [13058.354697]  __asan_load8+0x88/0xb0
    [13058.354702]  bfq_idle_slice_timer+0xac/0x290
    [13058.354707]  __hrtimer_run_queues+0x298/0x8b8
    [13058.354710]  hrtimer_interrupt+0x1b8/0x678
    [13058.354716]  arch_timer_handler_phys+0x4c/0x78
    [13058.354722]  handle_percpu_devid_irq+0xf0/0x558
    [13058.354731]  generic_handle_irq+0x50/0x70
    [13058.354735]  __handle_domain_irq+0x94/0x110
    [13058.354739]  gic_handle_irq+0x8c/0x1b0
    [13058.354742]  el1_irq+0xb8/0x140
    [13058.354748]  do_wp_page+0x260/0xe28
    [13058.354752]  __handle_mm_fault+0x8ec/0x9b0
    [13058.354756]  handle_mm_fault+0x280/0x460
    [13058.354762]  do_page_fault+0x3ec/0x890
    [13058.354765]  do_mem_abort+0xc0/0x1b0
    [13058.354768]  el0_da+0x24/0x28
    [13058.354770]
    [13058.354773] Allocated by task 19731:
    [13058.354780]  kasan_kmalloc+0xe0/0x190
    [13058.354784]  kasan_slab_alloc+0x14/0x20
    [13058.354788]  kmem_cache_alloc_node+0x130/0x440
    [13058.354793]  bfq_get_queue+0x138/0x858
    [13058.354797]  bfq_get_bfqq_handle_split+0xd4/0x328
    [13058.354801]  bfq_init_rq+0x1f4/0x1180
    [13058.354806]  bfq_insert_requests+0x264/0x1c98
    [13058.354811]  blk_mq_sched_insert_requests+0x1c4/0x488
    [13058.354818]  blk_mq_flush_plug_list+0x2d4/0x6e0
    [13058.354826]  blk_flush_plug_list+0x230/0x548
    [13058.354830]  blk_finish_plug+0x60/0x80
    [13058.354838]  read_pages+0xec/0x2c0
    [13058.354842]  __do_page_cache_readahead+0x374/0x438
    [13058.354846]  ondemand_readahead+0x24c/0x6b0
    [13058.354851]  page_cache_sync_readahead+0x17c/0x2f8
    [13058.354858]  generic_file_buffered_read+0x588/0xc58
    [13058.354862]  generic_file_read_iter+0x1b4/0x278
    [13058.354965]  ext4_file_read_iter+0xa8/0x1d8 [ext4]
    [13058.354972]  __vfs_read+0x238/0x320
    [13058.354976]  vfs_read+0xbc/0x1c0
    [13058.354980]  ksys_read+0xdc/0x1b8
    [13058.354984]  __arm64_sys_read+0x50/0x60
    [13058.354990]  el0_svc_common+0xb4/0x1d8
    [13058.354994]  el0_svc_handler+0x50/0xa8
    [13058.354998]  el0_svc+0x8/0xc
    [13058.354999]
    [13058.355001] Freed by task 19731:
    [13058.355007]  __kasan_slab_free+0x120/0x228
    [13058.355010]  kasan_slab_free+0x10/0x18
    [13058.355014]  kmem_cache_free+0x288/0x3f0
    [13058.355018]  bfq_put_queue+0x134/0x208
    [13058.355022]  bfq_exit_icq_bfqq+0x164/0x348
    [13058.355026]  bfq_exit_icq+0x28/0x40
    [13058.355030]  ioc_exit_icq+0xa0/0x150
    [13058.355035]  put_io_context_active+0x250/0x438
    [13058.355038]  exit_io_context+0xd0/0x138
    [13058.355045]  do_exit+0x734/0xc58
    [13058.355050]  do_group_exit+0x78/0x220
    [13058.355054]  __wake_up_parent+0x0/0x50
    [13058.355058]  el0_svc_common+0xb4/0x1d8
    [13058.355062]  el0_svc_handler+0x50/0xa8
    [13058.355066]  el0_svc+0x8/0xc
    [13058.355067]
    [13058.355071] The buggy address belongs to the object at ffffa02cf3e63e70#012 which belongs to the cache bfq_queue of size 464
    [13058.355075] The buggy address is located 264 bytes inside of#012 464-byte region [ffffa02cf3e63e70, ffffa02cf3e64040)
    [13058.355077] The buggy address belongs to the page:
    [13058.355083] page:ffff7e80b3cf9800 count:1 mapcount:0 mapping:ffff802db5c90780 index:0xffffa02cf3e606f0 compound_mapcount: 0
    [13058.366175] flags: 0x2ffffe0000008100(slab|head)
    [13058.370781] raw: 2ffffe0000008100 ffff7e80b53b1408 ffffa02d730c1c90 ffff802db5c90780
    [13058.370787] raw: ffffa02cf3e606f0 0000000000370023 00000001ffffffff 0000000000000000
    [13058.370789] page dumped because: kasan: bad access detected
    [13058.370791]
    [13058.370792] Memory state around the buggy address:
    [13058.370797]  ffffa02cf3e63e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fb fb
    [13058.370801]  ffffa02cf3e63e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [13058.370805] >ffffa02cf3e63f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [13058.370808]                                                                 ^
    [13058.370811]  ffffa02cf3e63f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [13058.370815]  ffffa02cf3e64000: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    [13058.370817] ==================================================================
    [13058.370820] Disabling lock debugging due to kernel taint
    
    Here, we directly pass the bfqd to bfq_idle_slice_timer_body func.
    --
    V2->V3: rewrite the comment as suggested by Paolo Valente
    V1->V2: add one comment, and add Fixes and Reported-by tag.
    
    Fixes: aee69d78d ("block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler")
    Acked-by: Paolo Valente <paolo.valente@linaro.org>
    Reported-by: Wang Wang <wangwang2@huawei.com>
    Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
    Signed-off-by: Feilong Lin <linfeilong@huawei.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bd9afea9bde7628adbcf66ae54ff650bde3e8993
Author: Boqun Feng <boqun.feng@gmail.com>
Date:   Thu Mar 12 23:12:55 2020 +0800

    locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps()
    
    [ Upstream commit 25016bd7f4caf5fc983bbab7403d08e64cba3004 ]
    
    Qian Cai reported a bug when PROVE_RCU_LIST=y, and read on /proc/lockdep
    triggered a warning:
    
      [ ] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
      ...
      [ ] Call Trace:
      [ ]  lock_is_held_type+0x5d/0x150
      [ ]  ? rcu_lockdep_current_cpu_online+0x64/0x80
      [ ]  rcu_read_lock_any_held+0xac/0x100
      [ ]  ? rcu_read_lock_held+0xc0/0xc0
      [ ]  ? __slab_free+0x421/0x540
      [ ]  ? kasan_kmalloc+0x9/0x10
      [ ]  ? __kmalloc_node+0x1d7/0x320
      [ ]  ? kvmalloc_node+0x6f/0x80
      [ ]  __bfs+0x28a/0x3c0
      [ ]  ? class_equal+0x30/0x30
      [ ]  lockdep_count_forward_deps+0x11a/0x1a0
    
    The warning got triggered because lockdep_count_forward_deps() call
    __bfs() without current->lockdep_recursion being set, as a result
    a lockdep internal function (__bfs()) is checked by lockdep, which is
    unexpected, and the inconsistency between the irq-off state and the
    state traced by lockdep caused the warning.
    
    Apart from this warning, lockdep internal functions like __bfs() should
    always be protected by current->lockdep_recursion to avoid potential
    deadlocks and data inconsistency, therefore add the
    current->lockdep_recursion on-and-off section to protect __bfs() in both
    lockdep_count_forward_deps() and lockdep_count_backward_deps()
    
    Reported-by: Qian Cai <cai@lca.pw>
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20200312151258.128036-1-boqun.feng@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b9da72cb7019ad706840b471b6334a2c82b6bc59
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Wed Mar 18 02:15:57 2020 +0200

    spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion
    
    [ Upstream commit 4f5ee75ea1718a09149460b3df993f389a67b56a ]
    
    Currently the driver puts the process in interruptible sleep waiting for
    the interrupt train to finish transfer to/from the tx_buf and rx_buf.
    
    But exiting the process with ctrl-c may make the kernel panic: the
    wait_event_interruptible call will return -ERESTARTSYS, which a proper
    driver implementation is perhaps supposed to handle, but nonetheless
    this one doesn't, and aborts the transfer altogether.
    
    Actually when the task is interrupted, there is still a high chance that
    the dspi_interrupt is still triggering. And if dspi_transfer_one_message
    returns execution all the way to the spi_device driver, that can free
    the spi_message and spi_transfer structures, leaving the interrupts to
    access a freed tx_buf and rx_buf.
    
    hexdump -C /dev/mtd0
    00000000  00 75 68 75 0a ff ff ff  ff ff ff ff ff ff ff ff
    |.uhu............|
    00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
    |................|
    *
    ^C[   38.495955] fsl-dspi 2120000.spi: Waiting for transfer to complete failed!
    [   38.503097] spi_master spi2: failed to transfer one message from queue
    [   38.509729] Unable to handle kernel paging request at virtual address ffff800095ab3377
    [   38.517676] Mem abort info:
    [   38.520474]   ESR = 0x96000045
    [   38.523533]   EC = 0x25: DABT (current EL), IL = 32 bits
    [   38.528861]   SET = 0, FnV = 0
    [   38.531921]   EA = 0, S1PTW = 0
    [   38.535067] Data abort info:
    [   38.537952]   ISV = 0, ISS = 0x00000045
    [   38.541797]   CM = 0, WnR = 1
    [   38.544771] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000082621000
    [   38.551494] [ffff800095ab3377] pgd=00000020fffff003, p4d=00000020fffff003, pud=0000000000000000
    [   38.560229] Internal error: Oops: 96000045 [#1] PREEMPT SMP
    [   38.565819] Modules linked in:
    [   38.568882] CPU: 0 PID: 2729 Comm: hexdump Not tainted 5.6.0-rc4-next-20200306-00052-gd8730cdc8a0b-dirty #193
    [   38.578834] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eval 2.0 carrier (DT)
    [   38.587129] pstate: 20000085 (nzCv daIf -PAN -UAO)
    [   38.591941] pc : ktime_get_real_ts64+0x3c/0x110
    [   38.596487] lr : spi_take_timestamp_pre+0x40/0x90
    [   38.601203] sp : ffff800010003d90
    [   38.604525] x29: ffff800010003d90 x28: ffff80001200e000
    [   38.609854] x27: ffff800011da9000 x26: ffff002079c40400
    [   38.615184] x25: ffff8000117fe018 x24: ffff800011daa1a0
    [   38.620513] x23: ffff800015ab3860 x22: ffff800095ab3377
    [   38.625841] x21: 000000000000146e x20: ffff8000120c3000
    [   38.631170] x19: ffff0020795f6e80 x18: ffff800011da9948
    [   38.636498] x17: 0000000000000000 x16: 0000000000000000
    [   38.641826] x15: ffff800095ab3377 x14: 0720072007200720
    [   38.647155] x13: 0720072007200765 x12: 0775076507750771
    [   38.652483] x11: 0720076d076f0772 x10: 0000000000000040
    [   38.657812] x9 : ffff8000108e2100 x8 : ffff800011dcabe8
    [   38.663139] x7 : 0000000000000000 x6 : ffff800015ab3a60
    [   38.668468] x5 : 0000000007200720 x4 : ffff800095ab3377
    [   38.673796] x3 : 0000000000000000 x2 : 0000000000000ab0
    [   38.679125] x1 : ffff800011daa000 x0 : 0000000000000026
    [   38.684454] Call trace:
    [   38.686905]  ktime_get_real_ts64+0x3c/0x110
    [   38.691100]  spi_take_timestamp_pre+0x40/0x90
    [   38.695470]  dspi_fifo_write+0x58/0x2c0
    [   38.699315]  dspi_interrupt+0xbc/0xd0
    [   38.702987]  __handle_irq_event_percpu+0x78/0x2c0
    [   38.707706]  handle_irq_event_percpu+0x3c/0x90
    [   38.712161]  handle_irq_event+0x4c/0xd0
    [   38.716008]  handle_fasteoi_irq+0xbc/0x170
    [   38.720115]  generic_handle_irq+0x2c/0x40
    [   38.724135]  __handle_domain_irq+0x68/0xc0
    [   38.728243]  gic_handle_irq+0xc8/0x160
    [   38.732000]  el1_irq+0xb8/0x180
    [   38.735149]  spi_nor_spimem_read_data+0xe0/0x140
    [   38.739779]  spi_nor_read+0xc4/0x120
    [   38.743364]  mtd_read_oob+0xa8/0xc0
    [   38.746860]  mtd_read+0x4c/0x80
    [   38.750007]  mtdchar_read+0x108/0x2a0
    [   38.753679]  __vfs_read+0x20/0x50
    [   38.757002]  vfs_read+0xa4/0x190
    [   38.760237]  ksys_read+0x6c/0xf0
    [   38.763471]  __arm64_sys_read+0x20/0x30
    [   38.767319]  el0_svc_common.constprop.3+0x90/0x160
    [   38.772125]  do_el0_svc+0x28/0x90
    [   38.775449]  el0_sync_handler+0x118/0x190
    [   38.779468]  el0_sync+0x140/0x180
    [   38.782793] Code: 91000294 1400000f d50339bf f9405e80 (f90002c0)
    [   38.788910] ---[ end trace 55da560db4d6bef7 ]---
    [   38.793540] Kernel panic - not syncing: Fatal exception in interrupt
    [   38.799914] SMP: stopping secondary CPUs
    [   38.803849] Kernel Offset: disabled
    [   38.807344] CPU features: 0x10002,20006008
    [   38.811451] Memory Limit: none
    [   38.814513] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
    
    So it is clear that the "interruptible" part isn't handled correctly.
    When the process receives a signal, one could either attempt a clean
    abort (which appears to be difficult with this hardware) or just keep
    restarting the sleep until the wait queue really completes. But checking
    in a loop for -ERESTARTSYS is a bit too complicated for this driver, so
    just make the sleep uninterruptible, to avoid all that nonsense.
    
    The wait queue was actually restructured as a completion, after polling
    other drivers for the most "popular" approach.
    
    Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform")
    Reported-by: Michael Walle <michael@walle.cc>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Tested-by: Michael Walle <michael@walle.cc>
    Link: https://lore.kernel.org/r/20200318001603.9650-7-olteanv@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 64a97384d4f48ec4571527eff03f3f3824b88450
Author: Junyong Sun <sunjy516@gmail.com>
Date:   Tue Mar 3 10:36:08 2020 +0800

    firmware: fix a double abort case with fw_load_sysfs_fallback
    
    [ Upstream commit bcfbd3523f3c6eea51a74d217a8ebc5463bcb7f4 ]
    
    fw_sysfs_wait_timeout may return err with -ENOENT
    at fw_load_sysfs_fallback and firmware is already
    in abort status, no need to abort again, so skip it.
    
    This issue is caused by concurrent situation like below:
    when thread 1# wait firmware loading, thread 2# may write
    -1 to abort loading and wakeup thread 1# before it timeout.
    so wait_for_completion_killable_timeout of thread 1# would
    return remaining time which is != 0 with fw_st->status
    FW_STATUS_ABORTED.And the results would be converted into
    err -ENOENT in __fw_state_wait_common and transfered to
    fw_load_sysfs_fallback in thread 1#.
    The -ENOENT means firmware status is already at ABORTED,
    so fw_load_sysfs_fallback no need to get mutex to abort again.
    -----------------------------
    thread 1#,wait for loading
    fw_load_sysfs_fallback
     ->fw_sysfs_wait_timeout
        ->__fw_state_wait_common
           ->wait_for_completion_killable_timeout
    
    in __fw_state_wait_common,
    ...
    93    ret = wait_for_completion_killable_timeout(&fw_st->completion, timeout);
    94    if (ret != 0 && fw_st->status == FW_STATUS_ABORTED)
    95       return -ENOENT;
    96    if (!ret)
    97       return -ETIMEDOUT;
    98
    99    return ret < 0 ? ret : 0;
    -----------------------------
    thread 2#, write -1 to abort loading
    firmware_loading_store
     ->fw_load_abort
       ->__fw_load_abort
         ->fw_state_aborted
           ->__fw_state_set
             ->complete_all
    
    in __fw_state_set,
    ...
    111    if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED)
    112       complete_all(&fw_st->completion);
    -------------------------------------------
    BTW,the double abort issue would not cause kernel panic or create an issue,
    but slow down it sometimes.The change is just a minor optimization.
    
    Signed-off-by: Junyong Sun <sunjunyong@xiaomi.com>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Link: https://lore.kernel.org/r/1583202968-28792-1-git-send-email-sunjunyong@xiaomi.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2d29a61a14faa8b75ac1098d7c3db90ac52160aa
Author: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Date:   Tue Feb 11 11:10:04 2020 +0100

    md: check arrays is suspended in mddev_detach before call quiesce operations
    
    [ Upstream commit 6b40bec3b13278d21fa6c1ae7a0bdf2e550eed5f ]
    
    Don't call quiesce(1) and quiesce(0) if array is already suspended,
    otherwise in level_store, the array is writable after mddev_detach
    in below part though the intention is to make array writable after
    resume.
    
            mddev_suspend(mddev);
            mddev_detach(mddev);
            ...
            mddev_resume(mddev);
    
    And it also causes calltrace as follows in [1].
    
    [48005.653834] WARNING: CPU: 1 PID: 45380 at kernel/kthread.c:510 kthread_park+0x77/0x90
    [...]
    [48005.653976] CPU: 1 PID: 45380 Comm: mdadm Tainted: G           OE     5.4.10-arch1-1 #1
    [48005.653979] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./J4105-ITX, BIOS P1.40 08/06/2018
    [48005.653984] RIP: 0010:kthread_park+0x77/0x90
    [48005.654015] Call Trace:
    [48005.654039]  r5l_quiesce+0x3c/0x70 [raid456]
    [48005.654052]  raid5_quiesce+0x228/0x2e0 [raid456]
    [48005.654073]  mddev_detach+0x30/0x70 [md_mod]
    [48005.654090]  level_store+0x202/0x670 [md_mod]
    [48005.654099]  ? security_capable+0x40/0x60
    [48005.654114]  md_attr_store+0x7b/0xc0 [md_mod]
    [48005.654123]  kernfs_fop_write+0xce/0x1b0
    [48005.654132]  vfs_write+0xb6/0x1a0
    [48005.654138]  ksys_write+0x67/0xe0
    [48005.654146]  do_syscall_64+0x4e/0x140
    [48005.654155]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [48005.654161] RIP: 0033:0x7fa0c8737497
    
    [1]: https://bugzilla.kernel.org/show_bug.cgi?id=206161
    
    Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
    Signed-off-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6420b2e5fa664450542f290df7b7848dc2e71309
Author: Marc Zyngier <maz@kernel.org>
Date:   Tue Mar 10 18:49:21 2020 +0000

    irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency
    
    [ Upstream commit 7809f7011c3bce650e502a98afeb05961470d865 ]
    
    On a very heavily loaded D05 with GICv4, I managed to trigger the
    following lockdep splat:
    
    [ 6022.598864] ======================================================
    [ 6022.605031] WARNING: possible circular locking dependency detected
    [ 6022.611200] 5.6.0-rc4-00026-geee7c7b0f498 #680 Tainted: G            E
    [ 6022.618061] ------------------------------------------------------
    [ 6022.624227] qemu-system-aar/7569 is trying to acquire lock:
    [ 6022.629789] ffff042f97606808 (&p->pi_lock){-.-.}, at: try_to_wake_up+0x54/0x7a0
    [ 6022.637102]
    [ 6022.637102] but task is already holding lock:
    [ 6022.642921] ffff002fae424cf0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x5c/0x98
    [ 6022.651350]
    [ 6022.651350] which lock already depends on the new lock.
    [ 6022.651350]
    [ 6022.659512]
    [ 6022.659512] the existing dependency chain (in reverse order) is:
    [ 6022.666980]
    [ 6022.666980] -> #2 (&irq_desc_lock_class){-.-.}:
    [ 6022.672983]        _raw_spin_lock_irqsave+0x50/0x78
    [ 6022.677848]        __irq_get_desc_lock+0x5c/0x98
    [ 6022.682453]        irq_set_vcpu_affinity+0x40/0xc0
    [ 6022.687236]        its_make_vpe_non_resident+0x6c/0xb8
    [ 6022.692364]        vgic_v4_put+0x54/0x70
    [ 6022.696273]        vgic_v3_put+0x20/0xd8
    [ 6022.700183]        kvm_vgic_put+0x30/0x48
    [ 6022.704182]        kvm_arch_vcpu_put+0x34/0x50
    [ 6022.708614]        kvm_sched_out+0x34/0x50
    [ 6022.712700]        __schedule+0x4bc/0x7f8
    [ 6022.716697]        schedule+0x50/0xd8
    [ 6022.720347]        kvm_arch_vcpu_ioctl_run+0x5f0/0x978
    [ 6022.725473]        kvm_vcpu_ioctl+0x3d4/0x8f8
    [ 6022.729820]        ksys_ioctl+0x90/0xd0
    [ 6022.733642]        __arm64_sys_ioctl+0x24/0x30
    [ 6022.738074]        el0_svc_common.constprop.3+0xa8/0x1e8
    [ 6022.743373]        do_el0_svc+0x28/0x88
    [ 6022.747198]        el0_svc+0x14/0x40
    [ 6022.750761]        el0_sync_handler+0x124/0x2b8
    [ 6022.755278]        el0_sync+0x140/0x180
    [ 6022.759100]
    [ 6022.759100] -> #1 (&rq->lock){-.-.}:
    [ 6022.764143]        _raw_spin_lock+0x38/0x50
    [ 6022.768314]        task_fork_fair+0x40/0x128
    [ 6022.772572]        sched_fork+0xe0/0x210
    [ 6022.776484]        copy_process+0x8c4/0x18d8
    [ 6022.780742]        _do_fork+0x88/0x6d8
    [ 6022.784478]        kernel_thread+0x64/0x88
    [ 6022.788563]        rest_init+0x30/0x270
    [ 6022.792390]        arch_call_rest_init+0x14/0x1c
    [ 6022.796995]        start_kernel+0x498/0x4c4
    [ 6022.801164]
    [ 6022.801164] -> #0 (&p->pi_lock){-.-.}:
    [ 6022.806382]        __lock_acquire+0xdd8/0x15c8
    [ 6022.810813]        lock_acquire+0xd0/0x218
    [ 6022.814896]        _raw_spin_lock_irqsave+0x50/0x78
    [ 6022.819761]        try_to_wake_up+0x54/0x7a0
    [ 6022.824018]        wake_up_process+0x1c/0x28
    [ 6022.828276]        wakeup_softirqd+0x38/0x40
    [ 6022.832533]        __tasklet_schedule_common+0xc4/0xf0
    [ 6022.837658]        __tasklet_schedule+0x24/0x30
    [ 6022.842176]        check_irq_resend+0xc8/0x158
    [ 6022.846609]        irq_startup+0x74/0x128
    [ 6022.850606]        __enable_irq+0x6c/0x78
    [ 6022.854602]        enable_irq+0x54/0xa0
    [ 6022.858431]        its_make_vpe_non_resident+0xa4/0xb8
    [ 6022.863557]        vgic_v4_put+0x54/0x70
    [ 6022.867469]        kvm_arch_vcpu_blocking+0x28/0x38
    [ 6022.872336]        kvm_vcpu_block+0x48/0x490
    [ 6022.876594]        kvm_handle_wfx+0x18c/0x310
    [ 6022.880938]        handle_exit+0x138/0x198
    [ 6022.885022]        kvm_arch_vcpu_ioctl_run+0x4d4/0x978
    [ 6022.890148]        kvm_vcpu_ioctl+0x3d4/0x8f8
    [ 6022.894494]        ksys_ioctl+0x90/0xd0
    [ 6022.898317]        __arm64_sys_ioctl+0x24/0x30
    [ 6022.902748]        el0_svc_common.constprop.3+0xa8/0x1e8
    [ 6022.908046]        do_el0_svc+0x28/0x88
    [ 6022.911871]        el0_svc+0x14/0x40
    [ 6022.915434]        el0_sync_handler+0x124/0x2b8
    [ 6022.919951]        el0_sync+0x140/0x180
    [ 6022.923773]
    [ 6022.923773] other info that might help us debug this:
    [ 6022.923773]
    [ 6022.931762] Chain exists of:
    [ 6022.931762]   &p->pi_lock --> &rq->lock --> &irq_desc_lock_class
    [ 6022.931762]
    [ 6022.942101]  Possible unsafe locking scenario:
    [ 6022.942101]
    [ 6022.948007]        CPU0                    CPU1
    [ 6022.952523]        ----                    ----
    [ 6022.957039]   lock(&irq_desc_lock_class);
    [ 6022.961036]                                lock(&rq->lock);
    [ 6022.966595]                                lock(&irq_desc_lock_class);
    [ 6022.973109]   lock(&p->pi_lock);
    [ 6022.976324]
    [ 6022.976324]  *** DEADLOCK ***
    
    This is happening because we have a pending doorbell that requires
    retrigger. As SW retriggering is done in a tasklet, we trigger the
    circular dependency above.
    
    The easy cop-out is to provide a retrigger callback that doesn't
    require acquiring any extra lock.
    
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20200310184921.23552-5-maz@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80e85ab88b3fa1042c186e72304c1a0235dabbd7
Author: Neil Armstrong <narmstrong@baylibre.com>
Date:   Fri Feb 21 10:15:31 2020 +0100

    usb: dwc3: core: add support for disabling SS instances in park mode
    
    [ Upstream commit 7ba6b09fda5e0cb741ee56f3264665e0edc64822 ]
    
    In certain circumstances, the XHCI SuperSpeed instance in park mode
    can fail to recover, thus on Amlogic G12A/G12B/SM1 SoCs when there is high
    load on the single XHCI SuperSpeed instance, the controller can crash like:
     xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
     xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
     xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead
     xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
     hub 2-1.1:1.0: hub_ext_port_status failed (err = -22)
     xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
     usb 2-1.1-port1: cannot reset (err = -22)
    
    Setting the PARKMODE_DISABLE_SS bit in the DWC3_USB3_GUCTL1 mitigates
    the issue. The bit is described as :
    "When this bit is set to '1' all SS bus instances in park mode are disabled"
    
    Synopsys explains:
    The GUCTL1.PARKMODE_DISABLE_SS is only available in
    dwc_usb3 controller running in host mode.
    This should not be set for other IPs.
    This can be disabled by default based on IP, but I recommend to have a
    property to enable this feature for devices that need this.
    
    CC: Dongjin Kim <tobetter@gmail.com>
    Cc: Jianxin Pan <jianxin.pan@amlogic.com>
    Cc: Thinh Nguyen <thinhn@synopsys.com>
    Cc: Jun Li <lijun.kernel@gmail.com>
    Reported-by: Tim <elatllat@gmail.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b6257832dd45799dfdda54cb32fa48907ee8ce58
Author: Dongchun Zhu <dongchun.zhu@mediatek.com>
Date:   Wed Mar 11 11:47:28 2020 +0100

    media: i2c: ov5695: Fix power on and off sequences
    
    [ Upstream commit f1a64f56663e9d03e509439016dcbddd0166b2da ]
    
    From the measured hardware signal, OV5695 reset pin goes high for a
    short period of time during boot-up. From the sensor specification, the
    reset pin is active low and the DT binding defines the pin as active
    low, which means that the values set by the driver are inverted and thus
    the value requested in probe ends up high.
    
    Fix it by changing probe to request the reset GPIO initialized to high,
    which makes the initial state of the physical signal low.
    
    In addition, DOVDD rising must occur before DVDD rising from spec., but
    regulator_bulk_enable() API enables all the regulators asynchronously.
    Use an explicit loops of regulator_enable() instead.
    
    For power off sequence, it is required that DVDD falls first. Given the
    bulk API does not give any guarantee about the order of regulators,
    change the driver to use regulator_disable() instead.
    
    The sensor also requires a delay between reset high and first I2C
    transaction, which was assumed to be 8192 XVCLK cycles, but 1ms is
    recommended by the vendor. Fix this as well.
    
    Signed-off-by: Dongchun Zhu <dongchun.zhu@mediatek.com>
    Signed-off-by: Tomasz Figa <tfiga@chromium.org>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 510b4e069508fdedd34a725b50317b2638f9ccbf
Author: Sahitya Tummala <stummala@codeaurora.org>
Date:   Wed Mar 11 16:07:50 2020 +0530

    block: Fix use-after-free issue accessing struct io_cq
    
    [ Upstream commit 30a2da7b7e225ef6c87a660419ea04d3cef3f6a7 ]
    
    There is a potential race between ioc_release_fn() and
    ioc_clear_queue() as shown below, due to which below kernel
    crash is observed. It also can result into use-after-free
    issue.
    
    context#1:                              context#2:
    ioc_release_fn()                        __ioc_clear_queue() gets the same icq
    ->spin_lock(&ioc->lock);                ->spin_lock(&ioc->lock);
    ->ioc_destroy_icq(icq);
      ->list_del_init(&icq->q_node);
      ->call_rcu(&icq->__rcu_head,
            icq_free_icq_rcu);
    ->spin_unlock(&ioc->lock);
                                            ->ioc_destroy_icq(icq);
                                              ->hlist_del_init(&icq->ioc_node);
                                              This results into below crash as this memory
                                              is now used by icq->__rcu_head in context#1.
                                              There is a chance that icq could be free'd
                                              as well.
    
    22150.386550:   <6> Unable to handle kernel write to read-only memory
    at virtual address ffffffaa8d31ca50
    ...
    Call trace:
    22150.607350:   <2>  ioc_destroy_icq+0x44/0x110
    22150.611202:   <2>  ioc_clear_queue+0xac/0x148
    22150.615056:   <2>  blk_cleanup_queue+0x11c/0x1a0
    22150.619174:   <2>  __scsi_remove_device+0xdc/0x128
    22150.623465:   <2>  scsi_forget_host+0x2c/0x78
    22150.627315:   <2>  scsi_remove_host+0x7c/0x2a0
    22150.631257:   <2>  usb_stor_disconnect+0x74/0xc8
    22150.635371:   <2>  usb_unbind_interface+0xc8/0x278
    22150.639665:   <2>  device_release_driver_internal+0x198/0x250
    22150.644897:   <2>  device_release_driver+0x24/0x30
    22150.649176:   <2>  bus_remove_device+0xec/0x140
    22150.653204:   <2>  device_del+0x270/0x460
    22150.656712:   <2>  usb_disable_device+0x120/0x390
    22150.660918:   <2>  usb_disconnect+0xf4/0x2e0
    22150.664684:   <2>  hub_event+0xd70/0x17e8
    22150.668197:   <2>  process_one_work+0x210/0x480
    22150.672222:   <2>  worker_thread+0x32c/0x4c8
    
    Fix this by adding a new ICQ_DESTROYED flag in ioc_destroy_icq() to
    indicate this icq is once marked as destroyed. Also, ensure
    __ioc_clear_queue() is accessing icq within rcu_read_lock/unlock so
    that icq doesn't get free'd up while it is still using it.
    
    Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
    Co-developed-by: Pradeep P V K <ppvk@codeaurora.org>
    Signed-off-by: Pradeep P V K <ppvk@codeaurora.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b9d5ced37ac79f1be63ea93d7f218594d2b73314
Author: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Date:   Fri Mar 6 18:47:20 2020 +0100

    genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy()
    
    [ Upstream commit 87f2d1c662fa1761359fdf558246f97e484d177a ]
    
    irq_domain_alloc_irqs_hierarchy() has 3 call sites in the compilation unit
    but only one of them checks for the pointer which is being dereferenced
    inside the called function. Move the check into the function. This allows
    for catching the error instead of the following crash:
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    PC is at 0x0
    LR is at gpiochip_hierarchy_irq_domain_alloc+0x11f/0x140
    ...
    [<c06c23ff>] (gpiochip_hierarchy_irq_domain_alloc)
    [<c0462a89>] (__irq_domain_alloc_irqs)
    [<c0462dad>] (irq_create_fwspec_mapping)
    [<c06c2251>] (gpiochip_to_irq)
    [<c06c1c9b>] (gpiod_to_irq)
    [<bf973073>] (gpio_irqs_init [gpio_irqs])
    [<bf974048>] (gpio_irqs_exit+0xecc/0xe84 [gpio_irqs])
    Code: bad PC value
    
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20200306174720.82604-1-alexander.sverdlin@nokia.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bceda1dd47165ecf0d45c06dee1a1e659361dabb
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Sun Mar 8 09:08:51 2020 +0100

    efi/x86: Ignore the memory attributes table on i386
    
    [ Upstream commit dd09fad9d2caad2325a39b766ce9e79cfc690184 ]
    
    Commit:
    
      3a6b6c6fb23667fa ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE initialization common across all architectures")
    
    moved the call to efi_memattr_init() from ARM specific to the generic
    EFI init code, in order to be able to apply the restricted permissions
    described in that table on x86 as well.
    
    We never enabled this feature fully on i386, and so mapping and
    reserving this table is pointless. However, due to the early call to
    memblock_reserve(), the memory bookkeeping gets confused to the point
    where it produces the splat below when we try to map the memory later
    on:
    
      ------------[ cut here ]------------
      ioremap on RAM at 0x3f251000 - 0x3fa1afff
      WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:166 __ioremap_caller ...
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.20.0 #48
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
      EIP: __ioremap_caller.constprop.0+0x249/0x260
      Code: 90 0f b7 05 4e 38 40 de 09 45 e0 e9 09 ff ff ff 90 8d 45 ec c6 05 ...
      EAX: 00000029 EBX: 00000000 ECX: de59c228 EDX: 00000001
      ESI: 3f250fff EDI: 00000000 EBP: de3edf20 ESP: de3edee0
      DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00200296
      CR0: 80050033 CR2: ffd17000 CR3: 1e58c000 CR4: 00040690
      Call Trace:
       ioremap_cache+0xd/0x10
       ? old_map_region+0x72/0x9d
       old_map_region+0x72/0x9d
       efi_map_region+0x8/0xa
       efi_enter_virtual_mode+0x260/0x43b
       start_kernel+0x329/0x3aa
       i386_start_kernel+0xa7/0xab
       startup_32_smp+0x164/0x168
      ---[ end trace e15ccf6b9f356833 ]---
    
    Let's work around this by disregarding the memory attributes table
    altogether on i386, which does not result in a loss of functionality
    or protection, given that we never consumed the contents.
    
    Fixes: 3a6b6c6fb23667fa ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE ... ")
    Tested-by: Arvind Sankar <nivedita@alum.mit.edu>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20200304165917.5893-1-ardb@kernel.org
    Link: https://lore.kernel.org/r/20200308080859.21568-21-ardb@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fc427b7a0266266f94badc325b0134997ed261b7
Author: Arvind Sankar <nivedita@alum.mit.edu>
Date:   Sun Mar 8 09:08:44 2020 +0100

    x86/boot: Use unsigned comparison for addresses
    
    [ Upstream commit 81a34892c2c7c809f9c4e22c5ac936ae673fb9a2 ]
    
    The load address is compared with LOAD_PHYSICAL_ADDR using a signed
    comparison currently (using jge instruction).
    
    When loading a 64-bit kernel using the new efi32_pe_entry() point added by:
    
      97aa276579b2 ("efi/x86: Add true mixed mode entry point into .compat section")
    
    using Qemu with -m 3072, the firmware actually loads us above 2Gb,
    resulting in a very early crash.
    
    Use the JAE instruction to perform a unsigned comparison instead, as physical
    addresses should be considered unsigned.
    
    Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20200301230436.2246909-6-nivedita@alum.mit.edu
    Link: https://lore.kernel.org/r/20200308080859.21568-14-ardb@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f6bb3ea812f03f373266fee117d4e4640febf5ef
Author: Peng Fan <peng.fan@nxp.com>
Date:   Tue Mar 3 10:14:49 2020 +0800

    cpufreq: imx6q: fix error handling
    
    [ Upstream commit 3646f50a3838c5949a89ecbdb868497cdc05b8fd ]
    
    When speed checking failed, direclty jumping to put_node label
    is not correct. Need jump to out_free_opp to avoid resources leak.
    
    Fixes: 2733fb0d0699 ("cpufreq: imx6q: read OCOTP through nvmem for imx6ul/imx6ull")
    Signed-off-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c5bcaacd06407b10d0983f33c2d744ecb1fcbdf1
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Wed Nov 13 14:08:45 2019 -0600

    gfs2: Don't demote a glock until its revokes are written
    
    [ Upstream commit df5db5f9ee112e76b5202fbc331f990a0fc316d6 ]
    
    Before this patch, run_queue would demote glocks based on whether
    there are any more holders. But if the glock has pending revokes that
    haven't been written to the media, giving up the glock might end in
    file system corruption if the revokes never get written due to
    io errors, node crashes and fences, etc. In that case, another node
    will replay the metadata blocks associated with the glock, but
    because the revoke was never written, it could replay that block
    even though the glock had since been granted to another node who
    might have made changes.
    
    This patch changes the logic in run_queue so that it never demotes
    a glock until its count of pending revokes reaches zero.
    
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 46bbc5526dd72a6b248412769482c164f817a01d
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Wed Nov 13 13:47:02 2019 -0600

    gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty
    
    [ Upstream commit 9ff78289356af640941bbb0dd3f46af2063f0046 ]
    
    Before this patch, if gfs2_ail_empty_gl saw there was nothing on
    the ail list, it would return and not flush the log. The problem
    is that there could still be a revoke for the rgrp sitting on the
    sd_log_le_revoke list that's been recently taken off the ail list.
    But that revoke still needs to be written, and the rgrp_go_inval
    still needs to call log_flush_wait to ensure the revokes are all
    properly written to the journal before we relinquish control of
    the glock to another node. If we give the glock to another node
    before we have this knowledge, the node might crash and its journal
    replayed, in which case the missing revoke would allow the journal
    replay to replay the rgrp over top of the rgrp we already gave to
    another node, thus overwriting its changes and corrupting the
    file system.
    
    This patch makes gfs2_ail_empty_gl still call gfs2_log_flush rather
    than returning.
    
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa547b9dc20f23d51c74adf9d39a9c28084c9ca9
Author: chenqiwu <chenqiwu@xiaomi.com>
Date:   Fri Feb 7 17:46:39 2020 +0800

    pstore/platform: fix potential mem leak if pstore_init_fs failed
    
    [ Upstream commit 8a57d6d4ddfa41c49014e20493152c41a38fcbf8 ]
    
    There is a potential mem leak when pstore_init_fs failed,
    since the pstore compression maybe unlikey to initialized
    successfully. We must clean up the allocation once this
    unlikey issue happens.
    
    Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
    Link: https://lore.kernel.org/r/1581068800-13817-1-git-send-email-qiwuchen55@gmail.com
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 347f091094ab36e26839cbbc2a4b50d6201db917
Author: John Garry <john.garry@huawei.com>
Date:   Fri Feb 28 19:33:35 2020 +0800

    libata: Remove extra scsi_host_put() in ata_scsi_add_hosts()
    
    [ Upstream commit 1d72f7aec3595249dbb83291ccac041a2d676c57 ]
    
    If the call to scsi_add_host_with_dma() in ata_scsi_add_hosts() fails,
    then we may get use-after-free KASAN warns:
    
    ==================================================================
    BUG: KASAN: use-after-free in kobject_put+0x24/0x180
    Read of size 1 at addr ffff0026b8c80364 by task swapper/0/1
    CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.6.0-rc3-00004-g5a71b206ea82-dirty #1765
    Hardware name: Huawei TaiShan 200 (Model 2280)/BC82AMDD, BIOS 2280-V2 CS V3.B160.01 02/24/2020
    Call trace:
    dump_backtrace+0x0/0x298
    show_stack+0x14/0x20
    dump_stack+0x118/0x190
    print_address_description.isra.9+0x6c/0x3b8
    __kasan_report+0x134/0x23c
    kasan_report+0xc/0x18
    __asan_load1+0x5c/0x68
    kobject_put+0x24/0x180
    put_device+0x10/0x20
    scsi_host_put+0x10/0x18
    ata_devres_release+0x74/0xb0
    release_nodes+0x2d0/0x470
    devres_release_all+0x50/0x78
    really_probe+0x2d4/0x560
    driver_probe_device+0x7c/0x148
    device_driver_attach+0x94/0xa0
    __driver_attach+0xa8/0x110
    bus_for_each_dev+0xe8/0x158
    driver_attach+0x30/0x40
    bus_add_driver+0x220/0x2e0
    driver_register+0xbc/0x1d0
    __pci_register_driver+0xbc/0xd0
    ahci_pci_driver_init+0x20/0x28
    do_one_initcall+0xf0/0x608
    kernel_init_freeable+0x31c/0x384
    kernel_init+0x10/0x118
    ret_from_fork+0x10/0x18
    
    Allocated by task 5:
    save_stack+0x28/0xc8
    __kasan_kmalloc.isra.8+0xbc/0xd8
    kasan_kmalloc+0xc/0x18
    __kmalloc+0x1a8/0x280
    scsi_host_alloc+0x44/0x678
    ata_scsi_add_hosts+0x74/0x268
    ata_host_register+0x228/0x488
    ahci_host_activate+0x1c4/0x2a8
    ahci_init_one+0xd18/0x1298
    local_pci_probe+0x74/0xf0
    work_for_cpu_fn+0x2c/0x48
    process_one_work+0x488/0xc08
    worker_thread+0x330/0x5d0
    kthread+0x1c8/0x1d0
    ret_from_fork+0x10/0x18
    
    Freed by task 5:
    save_stack+0x28/0xc8
    __kasan_slab_free+0x118/0x180
    kasan_slab_free+0x10/0x18
    slab_free_freelist_hook+0xa4/0x1a0
    kfree+0xd4/0x3a0
    scsi_host_dev_release+0x100/0x148
    device_release+0x7c/0xe0
    kobject_put+0xb0/0x180
    put_device+0x10/0x20
    scsi_host_put+0x10/0x18
    ata_scsi_add_hosts+0x210/0x268
    ata_host_register+0x228/0x488
    ahci_host_activate+0x1c4/0x2a8
    ahci_init_one+0xd18/0x1298
    local_pci_probe+0x74/0xf0
    work_for_cpu_fn+0x2c/0x48
    process_one_work+0x488/0xc08
    worker_thread+0x330/0x5d0
    kthread+0x1c8/0x1d0
    ret_from_fork+0x10/0x18
    
    There is also refcount issue, as well:
    WARNING: CPU: 1 PID: 1 at lib/refcount.c:28 refcount_warn_saturate+0xf8/0x170
    
    The issue is that we make an erroneous extra call to scsi_host_put()
    for that host:
    
    So in ahci_init_one()->ata_host_alloc_pinfo()->ata_host_alloc(), we setup
    a device release method - ata_devres_release() - which intends to release
    the SCSI hosts:
    
    static void ata_devres_release(struct device *gendev, void *res)
    {
            ...
            for (i = 0; i < host->n_ports; i++) {
                    struct ata_port *ap = host->ports[i];
    
                    if (!ap)
                            continue;
    
                    if (ap->scsi_host)
                            scsi_host_put(ap->scsi_host);
    
            }
            ...
    }
    
    However in the ata_scsi_add_hosts() error path, we also call
    scsi_host_put() for the SCSI hosts.
    
    Fix by removing the the scsi_host_put() calls in ata_scsi_add_hosts() and
    leave this to ata_devres_release().
    
    Fixes: f31871951b38 ("libata: separate out ata_host_alloc() and ata_host_register()")
    Signed-off-by: John Garry <john.garry@huawei.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 288761c9f0a2ec28dd269e4972163936bd739075
Author: Matt Ranostay <matt.ranostay@konsulko.com>
Date:   Tue Mar 24 02:07:41 2020 +0100

    media: i2c: video-i2c: fix build errors due to 'imply hwmon'
    
    [ Upstream commit 64d4fc9926f09861a35d8f0f7d81f056e6d5af7b ]
    
    Fix build fault when CONFIG_HWMON is a module, and CONFIG_VIDEO_I2C
    as builtin. This is due to 'imply hwmon' in the respective Kconfig.
    
    Issue build log:
    
    ld: drivers/media/i2c/video-i2c.o: in function `amg88xx_hwmon_init':
    video-i2c.c:(.text+0x2e1): undefined reference to `devm_hwmon_device_register_with_info
    
    Cc: rdunlap@infradead.org
    Fixes: acbea6798955 (media: video-i2c: add hwmon support for amg88xx)
    Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fb80a18584a4da355c36f5b86006cb9dcd02e297
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Sat Mar 21 10:45:18 2020 +0100

    block, bfq: move forward the getting of an extra ref in bfq_bfqq_move
    
    [ Upstream commit fd1bb3ae54a9a2e0c42709de861c69aa146b8955 ]
    
    Commit ecedd3d7e199 ("block, bfq: get extra ref to prevent a queue
    from being freed during a group move") gets an extra reference to a
    bfq_queue before possibly deactivating it (temporarily), in
    bfq_bfqq_move(). This prevents the bfq_queue from disappearing before
    being reactivated in its new group.
    
    Yet, the bfq_queue may also be expired (i.e., its service may be
    stopped) before the bfq_queue is deactivated. And also an expiration
    may lead to a premature freeing. This commit fixes this issue by
    simply moving forward the getting of the extra reference already
    introduced by commit ecedd3d7e199 ("block, bfq: get extra ref to
    prevent a queue from being freed during a group move").
    
    Reported-by: cki-project@redhat.com
    Tested-by: cki-project@redhat.com
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d1d846fb02a8e38625859e990377bafcb698ad1b
Author: Logan Gunthorpe <logang@deltatee.com>
Date:   Sat Mar 21 12:25:45 2020 +0100

    PCI/switchtec: Fix init_completion race condition with poll_wait()
    
    [ Upstream commit efbdc769601f4d50018bf7ca50fc9f7c67392ece ]
    
    The call to init_completion() in mrpc_queue_cmd() can theoretically
    race with the call to poll_wait() in switchtec_dev_poll().
    
      poll()                        write()
        switchtec_dev_poll()          switchtec_dev_write()
          poll_wait(&s->comp.wait);      mrpc_queue_cmd()
                                           init_completion(&s->comp)
                                             init_waitqueue_head(&s->comp.wait)
    
    To my knowledge, no one has hit this bug.
    
    Fix this by using reinit_completion() instead of init_completion() in
    mrpc_queue_cmd().
    
    Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")
    
    Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Link: https://lkml.kernel.org/r/20200313183608.2646-1-logang@deltatee.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 75434bcc659394df665f01ebe0119cb638b7984a
Author: Andy Lutomirski <luto@kernel.org>
Date:   Thu Mar 12 15:35:51 2020 -0700

    selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault
    
    [ Upstream commit 630b99ab60aa972052a4202a1ff96c7e45eb0054 ]
    
    If AT_SYSINFO is not present, don't try to call a NULL pointer.
    
    Reported-by: kbuild test robot <lkp@intel.com>
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lkml.kernel.org/r/faaf688265a7e1a5b944d6f8bc0f6368158306d3.1584052409.git.luto@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dd39eadc71d4a508dac311936b0c03824d98fd39
Author: Michael Wang <yun.wang@linux.alibaba.com>
Date:   Wed Mar 18 10:15:15 2020 +0800

    sched: Avoid scale real weight down to zero
    
    [ Upstream commit 26cf52229efc87e2effa9d788f9b33c40fb3358a ]
    
    During our testing, we found a case that shares no longer
    working correctly, the cgroup topology is like:
    
      /sys/fs/cgroup/cpu/A          (shares=102400)
      /sys/fs/cgroup/cpu/A/B        (shares=2)
      /sys/fs/cgroup/cpu/A/B/C      (shares=1024)
    
      /sys/fs/cgroup/cpu/D          (shares=1024)
      /sys/fs/cgroup/cpu/D/E        (shares=1024)
      /sys/fs/cgroup/cpu/D/E/F      (shares=1024)
    
    The same benchmark is running in group C & F, no other tasks are
    running, the benchmark is capable to consumed all the CPUs.
    
    We suppose the group C will win more CPU resources since it could
    enjoy all the shares of group A, but it's F who wins much more.
    
    The reason is because we have group B with shares as 2, since
    A->cfs_rq.load.weight == B->se.load.weight == B->shares/nr_cpus,
    so A->cfs_rq.load.weight become very small.
    
    And in calc_group_shares() we calculate shares as:
    
      load = max(scale_load_down(cfs_rq->load.weight), cfs_rq->avg.load_avg);
      shares = (tg_shares * load) / tg_weight;
    
    Since the 'cfs_rq->load.weight' is too small, the load become 0
    after scale down, although 'tg_shares' is 102400, shares of the se
    which stand for group A on root cfs_rq become 2.
    
    While the se of D on root cfs_rq is far more bigger than 2, so it
    wins the battle.
    
    Thus when scale_load_down() scale real weight down to 0, it's no
    longer telling the real story, the caller will have the wrong
    information and the calculation will be buggy.
    
    This patch add check in scale_load_down(), so the real weight will
    be >= MIN_SHARES after scale, after applied the group C wins as
    expected.
    
    Suggested-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
    Link: https://lkml.kernel.org/r/38e8e212-59a1-64b2-b247-b6d0b52d8dc1@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f7557078e16e6fd8c8c0523934b40b7aaa79869b
Author: Michael Tretter <m.tretter@pengutronix.de>
Date:   Mon Mar 16 16:26:23 2020 +0100

    media: allegro: fix type of gop_length in channel_create message
    
    [ Upstream commit 8277815349327b8e65226eb58ddb680f90c2c0c0 ]
    
    The gop_length field is actually only u16 and there are two more u8
    fields in the message:
    
    - the number of consecutive b-frames
    - frequency of golden frames
    
    Fix the message and thus fix the configuration of the GOP length.
    
    Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2902207377f8b725d34be7d0a85c446b339792c7
Author: Ahmed S. Darwish <a.darwish@linutronix.de>
Date:   Mon Mar 9 18:15:29 2020 +0000

    time/sched_clock: Expire timer in hardirq context
    
    [ Upstream commit 2c8bd58812ee3dbf0d78b566822f7eacd34bdd7b ]
    
    To minimize latency, PREEMPT_RT kernels expires hrtimers in preemptible
    softirq context by default. This can be overriden by marking the timer's
    expiry with HRTIMER_MODE_HARD.
    
    sched_clock_timer is missing this annotation: if its callback is preempted
    and the duration of the preemption exceeds the wrap around time of the
    underlying clocksource, sched clock will get out of sync.
    
    Mark the sched_clock_timer for expiry in hard interrupt context.
    
    Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20200309181529.26558-1-a.darwish@linutronix.de
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3f755f5233a2a046842f22bcce167dfea4ce1909
Author: Sungbo Eo <mans0n@gorani.run>
Date:   Thu Mar 19 11:34:48 2020 +0900

    irqchip/versatile-fpga: Handle chained IRQs properly
    
    [ Upstream commit 486562da598c59e9f835b551d7cf19507de2d681 ]
    
    Enclose the chained handler with chained_irq_{enter,exit}(), so that the
    muxed interrupts get properly acked.
    
    This patch also fixes a reboot bug on OX820 SoC, where the jiffies timer
    interrupt is never acked. The kernel waits a clock tick forever in
    calibrate_delay_converge(), which leads to a boot hang.
    
    Fixes: c41b16f8c9d9 ("ARM: integrator/versatile: consolidate FPGA IRQ handling code")
    Signed-off-by: Sungbo Eo <mans0n@gorani.run>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20200319023448.1479701-1-mans0n@gorani.run
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c8b81c33c5cb7591ab8c46243234ec0beaaab8c5
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Tue Feb 18 04:31:50 2020 +0000

    debugfs: Check module state before warning in {full/open}_proxy_open()
    
    [ Upstream commit 275678e7a9be6a0ea9c1bb493e48abf2f4a01be5 ]
    
    When the module is being removed, the module state is set to
    MODULE_STATE_GOING. At this point, try_module_get() fails.
    And when {full/open}_proxy_open() is being called,
    it calls try_module_get() to try to hold module reference count.
    If it fails, it warns about the possibility of debugfs file leak.
    
    If {full/open}_proxy_open() is called while the module is being removed,
    it fails to hold the module.
    So, It warns about debugfs file leak. But it is not the debugfs file
    leak case. So, this patch just adds module state checking routine
    in the {full/open}_proxy_open().
    
    Test commands:
        #SHELL1
        while :
        do
            modprobe netdevsim
            echo 1 > /sys/bus/netdevsim/new_device
            modprobe -rv netdevsim
        done
    
        #SHELL2
        while :
        do
            cat /sys/kernel/debug/netdevsim/netdevsim1/ports/0/ipsec
        done
    
    Splat looks like:
    [  298.766738][T14664] debugfs file owner did not clean up at exit: ipsec
    [  298.766766][T14664] WARNING: CPU: 2 PID: 14664 at fs/debugfs/file.c:312 full_proxy_open+0x10f/0x650
    [  298.768595][T14664] Modules linked in: netdevsim(-) openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 n][  298.771343][T14664] CPU: 2 PID: 14664 Comm: cat Tainted: G        W         5.5.0+ #1
    [  298.772373][T14664] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [  298.773545][T14664] RIP: 0010:full_proxy_open+0x10f/0x650
    [  298.774247][T14664] Code: 48 c1 ea 03 80 3c 02 00 0f 85 c1 04 00 00 49 8b 3c 24 e8 e4 b5 78 ff 84 c0 75 2d 4c 89 ee 48
    [  298.776782][T14664] RSP: 0018:ffff88805b7df9b8 EFLAGS: 00010282[  298.777583][T14664] RAX: dffffc0000000008 RBX: ffff8880511725c0 RCX: 0000000000000000
    [  298.778610][T14664] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffff8880540c5c14
    [  298.779637][T14664] RBP: 0000000000000000 R08: fffffbfff15235ad R09: 0000000000000000
    [  298.780664][T14664] R10: 0000000000000001 R11: 0000000000000000 R12: ffffffffc06b5000
    [  298.781702][T14664] R13: ffff88804c234a88 R14: ffff88804c22dd00 R15: ffffffff8a1b5660
    [  298.782722][T14664] FS:  00007fafa13a8540(0000) GS:ffff88806c800000(0000) knlGS:0000000000000000
    [  298.783845][T14664] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  298.784672][T14664] CR2: 00007fafa0e9cd10 CR3: 000000004b286005 CR4: 00000000000606e0
    [  298.785739][T14664] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [  298.786769][T14664] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [  298.787785][T14664] Call Trace:
    [  298.788237][T14664]  do_dentry_open+0x63c/0xf50
    [  298.788872][T14664]  ? open_proxy_open+0x270/0x270
    [  298.789524][T14664]  ? __x64_sys_fchdir+0x180/0x180
    [  298.790169][T14664]  ? inode_permission+0x65/0x390
    [  298.790832][T14664]  path_openat+0xc45/0x2680
    [  298.791425][T14664]  ? save_stack+0x69/0x80
    [  298.791988][T14664]  ? save_stack+0x19/0x80
    [  298.792544][T14664]  ? path_mountpoint+0x2e0/0x2e0
    [  298.793233][T14664]  ? check_chain_key+0x236/0x5d0
    [  298.793910][T14664]  ? sched_clock_cpu+0x18/0x170
    [  298.794527][T14664]  ? find_held_lock+0x39/0x1d0
    [  298.795153][T14664]  do_filp_open+0x16a/0x260
    [ ... ]
    
    Fixes: 9fd4dcece43a ("debugfs: prevent access to possibly dead file_operations at file open")
    Reported-by: kbuild test robot <lkp@intel.com>
    Signed-off-by: Taehee Yoo <ap420073@gmail.com>
    Link: https://lore.kernel.org/r/20200218043150.29447-1-ap420073@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fd66df97dce9b7ee7dfc78831e5ea7a1ad6e9291
Author: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date:   Fri Feb 28 17:51:48 2020 +0300

    block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
    
    [ Upstream commit e74d93e96d721c4297f2a900ad0191890d2fc2b0 ]
    
    Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
    size based on read-ahead setting") removes unneeded split of read requests.
    
    Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they set
    limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
    Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
    
    This patch updates io_pages after merging limits in disk_stack_limits().
    
    Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
    the same problem for device-mapper devices, this one fixes MD RAIDs.
    
    Fixes: 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Reviewed-by: Bob Liu <bob.liu@oracle.com>
    Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Signed-off-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e88ee287fd82763910ae466d000bfe5bae605d70
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Mar 4 12:45:27 2020 +0100

    dma-mapping: Fix dma_pgprot() for unencrypted coherent pages
    
    [ Upstream commit 17c4a2ae15a7aaefe84bdb271952678c5c9cd8e1 ]
    
    When dma_mmap_coherent() sets up a mapping to unencrypted coherent memory
    under SEV encryption and sometimes under SME encryption, it will actually
    set up an encrypted mapping rather than an unencrypted, causing devices
    that DMAs from that memory to read encrypted contents. Fix this.
    
    When force_dma_unencrypted() returns true, the linear kernel map of the
    coherent pages have had the encryption bit explicitly cleared and the
    page content is unencrypted. Make sure that any additional PTEs we set
    up to these pages also have the encryption bit cleared by having
    dma_pgprot() return a protection with the encryption bit cleared in this
    case.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Link: https://lkml.kernel.org/r/20200304114527.3636-3-thomas_os@shipmail.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa04e8d359d7cbeae94300f0cc3a43d28329cebe
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Mar 4 12:45:26 2020 +0100

    x86: Don't let pgprot_modify() change the page encryption bit
    
    [ Upstream commit 6db73f17c5f155dbcfd5e48e621c706270b84df0 ]
    
    When SEV or SME is enabled and active, vm_get_page_prot() typically
    returns with the encryption bit set. This means that users of
    pgprot_modify(, vm_get_page_prot()) (mprotect_fixup(), do_mmap()) end up
    with a value of vma->vm_pg_prot that is not consistent with the intended
    protection of the PTEs.
    
    This is also important for fault handlers that rely on the VMA
    vm_page_prot to set the page protection. Fix this by not allowing
    pgprot_modify() to change the encryption bit, similar to how it's done
    for PAT bits.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Link: https://lkml.kernel.org/r/20200304114527.3636-2-thomas_os@shipmail.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ce7a61a0d57d2dd613941d8aef82a5b54fb2e396
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Mar 6 00:15:24 2020 +0100

    ACPI: EC: Do not clear boot_ec_is_ecdt in acpi_ec_add()
    
    [ Upstream commit 65a691f5f8f0bb63d6a82eec7b0ffd193d8d8a5f ]
    
    The reason for clearing boot_ec_is_ecdt in acpi_ec_add() (if a
    PNP0C09 device object matching the ECDT boot EC had been found in
    the namespace) was to cause acpi_ec_ecdt_start() to return early,
    but since the latter does not look at boot_ec_is_ecdt any more,
    acpi_ec_add() need not clear it.
    
    Moreover, doing that may be confusing as it may cause "DSDT" to be
    printed instead of "ECDT" in the EC initialization completion
    message, so stop doing it.
    
    While at it, split the EC initialization completion message into
    two messages, one regarding the boot EC and another one printed
    regardless of whether or not the EC at hand is the boot one.
    
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 99e20a79d2150b1d17d1b20176fdc1f3ced22093
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Mar 12 16:45:09 2020 +0200

    xhci: bail out early if driver can't accress host in resume
    
    [ Upstream commit 72ae194704da212e2ec312ab182a96799d070755 ]
    
    Bail out early if the xHC host needs to be reset at resume
    but driver can't access xHC PCI registers.
    
    If xhci driver already fails to reset the controller then there
    is no point in attempting to free, re-initialize, re-allocate and
    re-start the host. If failure to access the host is detected later,
    failing the resume, xhci interrupts will be double freed
    when remove is called.
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20200312144517.1593-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 61ed3dcad80cf0f6e557f4b15073efced944ba4d
Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date:   Tue Mar 10 17:06:29 2020 +0100

    media: imx: imx7-media-csi: Fix video field handling
    
    [ Upstream commit f7b8488bd39ae8feced4dfbb41cf1431277b893f ]
    
    Commit 4791bd7d6adc ("media: imx: Try colorimetry at both sink and
    source pads") reworked the way that formats are set on the sink pad of
    the CSI subdevice, and accidentally removed video field handling.
    Restore it by defaulting to V4L2_FIELD_NONE if the field value isn't
    supported, with the only two supported value being V4L2_FIELD_NONE and
    V4L2_FIELD_INTERLACED.
    
    Fixes: 4791bd7d6adc ("media: imx: Try colorimetry at both sink and source pads")
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dd051f1af5942ec7f5eb4c10dbf47b402ed352f5
Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date:   Tue Mar 10 17:06:24 2020 +0100

    media: imx: imx7_mipi_csis: Power off the source when stopping streaming
    
    [ Upstream commit 770cbf89f90b0663499dbb3f03aa81b3322757ec ]
    
    The .s_stream() implementation incorrectly powers on the source when
    stopping the stream. Power it off instead.
    
    Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 502b83e73e35163547117448ce6a0f4eab6fc6a6
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Wed Feb 12 23:23:20 2020 +0300

    null_blk: fix spurious IO errors after failed past-wp access
    
    [ Upstream commit ff77042296d0a54535ddf74412c5ae92cb4ec76a ]
    
    Steps to reproduce:
    
            BLKRESETZONE zone 0
    
            // force EIO
            pwrite(fd, buf, 4096, 4096);
    
            [issue more IO including zone ioctls]
    
    It will start failing randomly including IO to unrelated zones because of
    ->error "reuse". Trigger can be partition detection as well if test is not
    run immediately which is even more entertaining.
    
    The fix is of course to clear ->error where necessary.
    
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 38c1299f8c5c0a1e8b1328b5e58dc1a19d567251
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Mon Mar 9 21:26:22 2020 -0700

    null_blk: Handle null_add_dev() failures properly
    
    [ Upstream commit 9b03b713082a31a5b90e0a893c72aa620e255c26 ]
    
    If null_add_dev() fails then null_del_dev() is called with a NULL argument.
    Make null_del_dev() handle this scenario correctly. This patch fixes the
    following KASAN complaint:
    
    null-ptr-deref in null_del_dev+0x28/0x280 [null_blk]
    Read of size 8 at addr 0000000000000000 by task find/1062
    
    Call Trace:
     dump_stack+0xa5/0xe6
     __kasan_report.cold+0x65/0x99
     kasan_report+0x16/0x20
     __asan_load8+0x58/0x90
     null_del_dev+0x28/0x280 [null_blk]
     nullb_group_drop_item+0x7e/0xa0 [null_blk]
     client_drop_item+0x53/0x80 [configfs]
     configfs_rmdir+0x395/0x4e0 [configfs]
     vfs_rmdir+0xb6/0x220
     do_rmdir+0x238/0x2c0
     __x64_sys_unlinkat+0x75/0x90
     do_syscall_64+0x6f/0x2f0
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Cc: Johannes Thumshirn <jth@kernel.org>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit becd9a90665741138c2aa031a7db2dc03e92ba71
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Mon Mar 9 21:26:21 2020 -0700

    null_blk: Fix the null_add_dev() error path
    
    [ Upstream commit 2004bfdef945fe55196db6b9cdf321fbc75bb0de ]
    
    If null_add_dev() fails, clear dev->nullb.
    
    This patch fixes the following KASAN complaint:
    
    BUG: KASAN: use-after-free in nullb_device_submit_queues_store+0xcf/0x160 [null_blk]
    Read of size 8 at addr ffff88803280fc30 by task check/8409
    
    Call Trace:
     dump_stack+0xa5/0xe6
     print_address_description.constprop.0+0x26/0x260
     __kasan_report.cold+0x7b/0x99
     kasan_report+0x16/0x20
     __asan_load8+0x58/0x90
     nullb_device_submit_queues_store+0xcf/0x160 [null_blk]
     configfs_write_file+0x1c4/0x250 [configfs]
     __vfs_write+0x4c/0x90
     vfs_write+0x145/0x2c0
     ksys_write+0xd7/0x180
     __x64_sys_write+0x47/0x50
     do_syscall_64+0x6f/0x2f0
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x7ff370926317
    Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
    RSP: 002b:00007fff2dd2da48 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007ff370926317
    RDX: 0000000000000002 RSI: 0000559437ef23f0 RDI: 0000000000000001
    RBP: 0000559437ef23f0 R08: 000000000000000a R09: 0000000000000001
    R10: 0000559436703471 R11: 0000000000000246 R12: 0000000000000002
    R13: 00007ff370a006a0 R14: 00007ff370a014a0 R15: 00007ff370a008a0
    
    Allocated by task 8409:
     save_stack+0x23/0x90
     __kasan_kmalloc.constprop.0+0xcf/0xe0
     kasan_kmalloc+0xd/0x10
     kmem_cache_alloc_node_trace+0x129/0x4c0
     null_add_dev+0x24a/0xe90 [null_blk]
     nullb_device_power_store+0x1b6/0x270 [null_blk]
     configfs_write_file+0x1c4/0x250 [configfs]
     __vfs_write+0x4c/0x90
     vfs_write+0x145/0x2c0
     ksys_write+0xd7/0x180
     __x64_sys_write+0x47/0x50
     do_syscall_64+0x6f/0x2f0
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Freed by task 8409:
     save_stack+0x23/0x90
     __kasan_slab_free+0x112/0x160
     kasan_slab_free+0x12/0x20
     kfree+0xdf/0x250
     null_add_dev+0xaf3/0xe90 [null_blk]
     nullb_device_power_store+0x1b6/0x270 [null_blk]
     configfs_write_file+0x1c4/0x250 [configfs]
     __vfs_write+0x4c/0x90
     vfs_write+0x145/0x2c0
     ksys_write+0xd7/0x180
     __x64_sys_write+0x47/0x50
     do_syscall_64+0x6f/0x2f0
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Fixes: 2984c8684f96 ("nullb: factor disk parameters")
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Cc: Johannes Thumshirn <jth@kernel.org>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f9ee512dd9131e2c6c7de0351ba8174d55d77af7
Author: James Morse <james.morse@arm.com>
Date:   Fri Feb 21 16:35:06 2020 +0000

    firmware: arm_sdei: fix double-lock on hibernate with shared events
    
    [ Upstream commit 6ded0b61cf638bf9f8efe60ab8ba23db60ea9763 ]
    
    SDEI has private events that must be registered on each CPU. When
    CPUs come and go they must re-register and re-enable their private
    events. Each event has flags to indicate whether this should happen
    to protect against an event being registered on a CPU coming online,
    while all the others are unregistering the event.
    
    These flags are protected by the sdei_list_lock spinlock, because
    the cpuhp callbacks can't take the mutex.
    
    Hibernate needs to unregister all events, but keep the in-memory
    re-register and re-enable as they are. sdei_unregister_shared()
    takes the spinlock to walk the list, then calls _sdei_event_unregister()
    on each shared event. _sdei_event_unregister() tries to take the
    same spinlock to update re-register and re-enable. This doesn't go
    so well.
    
    Push the re-register and re-enable updates out to their callers.
    sdei_unregister_shared() doesn't want these values updated, so
    doesn't need to do anything.
    
    This also fixes shared events getting lost over hibernate as this
    path made them look unregistered.
    
    Fixes: da351827240e ("firmware: arm_sdei: Add support for CPU and system power states")
    Reported-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
    Signed-off-by: James Morse <james.morse@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7bf2c31ba0bb23ec7c4646e77a8b63cf7b9d1701
Author: Stephan Gerhold <stephan@gerhold.net>
Date:   Mon Dec 9 20:16:52 2019 +0100

    media: venus: hfi_parser: Ignore HEVC encoding for V1
    
    [ Upstream commit c50cc6dc6c48300af63a6fbc71b647053c15fc80 ]
    
    Some older MSM8916 Venus firmware versions also seem to indicate
    support for encoding HEVC, even though they really can't.
    This will lead to errors later because hfi_session_init() fails
    in this case.
    
    HEVC is already ignored for "dec_codecs", so add the same for
    "enc_codecs" to make these old firmware versions work correctly.
    
    Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
    Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0d3d868b34af018f21d662d3a0ab179d94907ca8
Author: Ajay Singh <ajay.kathat@microchip.com>
Date:   Fri Feb 21 11:30:20 2020 +0000

    staging: wilc1000: avoid double unlocking of 'wilc->hif_cs' mutex
    
    [ Upstream commit 6c411581caef6e3b2c286871641018364c6db50a ]
    
    Possible double unlocking of 'wilc->hif_cs' mutex was identified by
    smatch [1]. Removed the extra call to release_bus() in
    wilc_wlan_handle_txq() which was missed in earlier commit fdc2ac1aafc6
    ("staging: wilc1000: support suspend/resume functionality").
    
    [1]. https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/NOEVW7C3GV74EWXJO3XX6VT2NKVB2HMT/
    
    Reported-by: kbuild test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
    Link: https://lore.kernel.org/r/20200221170120.15739-1-ajay.kathat@microchip.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d5bc44e6b0d4a4231b84003e44c67e5c7239aaff
Author: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Date:   Tue Feb 11 12:58:07 2020 +0100

    cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL
    
    [ Upstream commit 36eb7dc1bd42fe5f850329c893768ff89b696fba ]
    
    imx6ul_opp_check_speed_grading is called for both i.MX6UL and i.MX6ULL.
    Since the i.MX6ULL was introduced to a separate ocotp compatible node
    later, it is possible that the i.MX6ULL has also dtbs with
    "fsl,imx6ull-ocotp". On a system without nvmem-cell speed grade a
    missing check on this node causes a driver fail without considering
    the cpu speed grade.
    
    This patch prevents unwanted cpu overclocking on i.MX6ULL with compatible
    node "fsl,imx6ull-ocotp" in old dtbs without nvmem-cell speed grade.
    
    Fixes: 2733fb0d0699 ("cpufreq: imx6q: read OCOTP through nvmem for imx6ul/imx6ull")
    Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 33dbe5867c3970fa5243b2c7c57f38a4bba46291
Author: Mohammad Rasim <mohammad.rasim96@gmail.com>
Date:   Fri Jan 10 17:25:45 2020 +0100

    media: rc: add keymap for Videostrong KII Pro
    
    [ Upstream commit 30defecb98400575349a7d32f0526e1dc42ea83e ]
    
    This is an NEC remote control device shipped with the Videostrong KII Pro
    tv box as well as other devices from videostrong.
    
    Signed-off-by: Mohammad Rasim <mohammad.rasim96@gmail.com>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a5ef462303e0bcce246cd53705b48d341525d609
Author: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date:   Fri Mar 27 11:44:22 2020 +1300

    i2c: pca-platform: Use platform_irq_get_optional
    
    [ Upstream commit 14c1fe699cad9cb0acda4559c584f136d18fea50 ]
    
    The interrupt is not required so use platform_irq_get_optional() to
    avoid error messages like
    
      i2c-pca-platform 22080000.i2c: IRQ index 0 not found
    
    Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 54d09aab81aaadd2b51a7d377b4943c125512877
Author: Alain Volmat <avolmat@me.com>
Date:   Thu Mar 26 22:22:43 2020 +0100

    i2c: st: fix missing struct parameter description
    
    [ Upstream commit f491c6687332920e296d0209e366fe2ca7eab1c6 ]
    
    Fix a missing struct parameter description to allow
    warning free W=1 compilation.
    
    Signed-off-by: Alain Volmat <avolmat@me.com>
    Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 28f5b6ee1c2fb1895cbef9ca79dff509802568de
Author: Xu Wang <vulab@iscas.ac.cn>
Date:   Thu Mar 26 18:14:29 2020 +0800

    qlcnic: Fix bad kzalloc null test
    
    [ Upstream commit bcaeb886ade124331a6f3a5cef34a3f1484c0a03 ]
    
    In qlcnic_83xx_get_reset_instruction_template, the variable
    of null test is bad, so correct it.
    
    Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d7f6f2b0be09c2ea54909b3d5d663847d9345a38
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Thu Mar 26 15:09:43 2020 +0200

    cfg80211: Do not warn on same channel at the end of CSA
    
    [ Upstream commit 05dcb8bb258575a8dd3499d0d78bd2db633c2b23 ]
    
    When cfg80211_update_assoc_bss_entry() is called, there is a
    verification that the BSS channel actually changed. As some APs use
    CSA also for bandwidth changes, this would result with a kernel
    warning.
    
    Fix this by removing the WARN_ON().
    
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20200326150855.96316ada0e8d.I6710376b1b4257e5f4712fc7ab16e2b638d512aa@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 068168461e68b0090cbd04d7d5f82b27c7c5718f
Author: Yintian Tao <yttao@amd.com>
Date:   Mon Mar 23 19:19:37 2020 +0800

    drm/scheduler: fix rare NULL ptr race
    
    [ Upstream commit 77bb2f204f1f0a53a602a8fd15816d6826212077 ]
    
    There is one one corner case at dma_fence_signal_locked
    which will raise the NULL pointer problem just like below.
    ->dma_fence_signal
        ->dma_fence_signal_locked
            ->test_and_set_bit
    here trigger dma_fence_release happen due to the zero of fence refcount.
    
    ->dma_fence_put
        ->dma_fence_release
            ->drm_sched_fence_release_scheduled
                ->call_rcu
    here make the union fled “cb_list” at finished fence
    to NULL because struct rcu_head contains two pointer
    which is same as struct list_head cb_list
    
    Therefore, to hold the reference of finished fence at drm_sched_process_job
    to prevent the null pointer during finished fence dma_fence_signal
    
    [  732.912867] BUG: kernel NULL pointer dereference, address: 0000000000000008
    [  732.914815] #PF: supervisor write access in kernel mode
    [  732.915731] #PF: error_code(0x0002) - not-present page
    [  732.916621] PGD 0 P4D 0
    [  732.917072] Oops: 0002 [#1] SMP PTI
    [  732.917682] CPU: 7 PID: 0 Comm: swapper/7 Tainted: G           OE     5.4.0-rc7 #1
    [  732.918980] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
    [  732.920906] RIP: 0010:dma_fence_signal_locked+0x3e/0x100
    [  732.938569] Call Trace:
    [  732.939003]  <IRQ>
    [  732.939364]  dma_fence_signal+0x29/0x50
    [  732.940036]  drm_sched_fence_finished+0x12/0x20 [gpu_sched]
    [  732.940996]  drm_sched_process_job+0x34/0xa0 [gpu_sched]
    [  732.941910]  dma_fence_signal_locked+0x85/0x100
    [  732.942692]  dma_fence_signal+0x29/0x50
    [  732.943457]  amdgpu_fence_process+0x99/0x120 [amdgpu]
    [  732.944393]  sdma_v4_0_process_trap_irq+0x81/0xa0 [amdgpu]
    
    v2: hold the finished fence at drm_sched_process_job instead of
        amdgpu_fence_process
    v3: resume the blank line
    
    Signed-off-by: Yintian Tao <yttao@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f5429ec64f4f8583f068af04e2e00ad1b30a07f8
Author: Raju Rangoju <rajur@chelsio.com>
Date:   Tue Mar 24 17:10:00 2020 +0530

    cxgb4/ptp: pass the sign of offset delta in FW CMD
    
    [ Upstream commit 50e0d28d3808146cc19b0d5564ef4ba9e5bf3846 ]
    
    cxgb4_ptp_fineadjtime() doesn't pass the signedness of offset delta
    in FW_PTP_CMD. Fix it by passing correct sign.
    
    Signed-off-by: Raju Rangoju <rajur@chelsio.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d2037f68ae033a6732e7aea38dcf7ae3c7fcf58d
Author: Alan Maguire <alan.maguire@oracle.com>
Date:   Wed Mar 18 18:53:21 2020 +0000

    selftests/net: add definition for SOL_DCCP to fix compilation errors for old libc
    
    [ Upstream commit 83a9b6f639e9f6b632337f9776de17d51d969c77 ]
    
    Many systems build/test up-to-date kernels with older libcs, and
    an older glibc (2.17) lacks the definition of SOL_DCCP in
    /usr/include/bits/socket.h (it was added in the 4.6 timeframe).
    
    Adding the definition to the test program avoids a compilation
    failure that gets in the way of building tools/testing/selftests/net.
    The test itself will work once the definition is added; either
    skipping due to DCCP not being configured in the kernel under test
    or passing, so there are no other more up-to-date glibc dependencies
    here it seems beyond that missing definition.
    
    Fixes: 11fb60d1089f ("selftests: net: reuseport_addr_any: add DCCP")
    Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9a3f55fc0f46c0a3b54975ad573d2c9b8c7f244f
Author: Luo bin <luobin9@huawei.com>
Date:   Fri Mar 20 23:13:20 2020 +0000

    hinic: fix wrong value of MIN_SKB_LEN
    
    [ Upstream commit 7296695fc16dd1761dbba8b68a9181c71cef0633 ]
    
    the minimum value of skb len that hw supports is 32 rather than 17
    
    Signed-off-by: Luo bin <luobin9@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a8f9fe793001b316adc683551ba6d096fd3090d4
Author: Luo bin <luobin9@huawei.com>
Date:   Fri Mar 20 23:13:19 2020 +0000

    hinic: fix wrong para of wait_for_completion_timeout
    
    [ Upstream commit 0da7c322f116210ebfdda59c7da663a6fc5e9cc8 ]
    
    the second input parameter of wait_for_completion_timeout should
    be jiffies instead of millisecond
    
    Signed-off-by: Luo bin <luobin9@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 243ebc24e01c80f2c6adfa4b8cebf4f055c2af51
Author: Luo bin <luobin9@huawei.com>
Date:   Fri Mar 20 23:13:18 2020 +0000

    hinic: fix out-of-order excution in arm cpu
    
    [ Upstream commit 33f15da216a1f4566b4ec880942556ace30615df ]
    
    add read barrier in driver code to keep from reading other fileds
    in dma memory which is writable for hw until we have verified the
    memory is valid for driver
    
    Signed-off-by: Luo bin <luobin9@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5edd115ba09eb2e1c38589c2d45807e162f1449c
Author: Luo bin <luobin9@huawei.com>
Date:   Fri Mar 20 23:13:17 2020 +0000

    hinic: fix the bug of clearing event queue
    
    [ Upstream commit 614eaa943e9fc3fcdbd4aa0692ae84973d363333 ]
    
    should disable eq irq before freeing it, must clear event queue
    depth in hw before freeing relevant memory to avoid illegal
    memory access and update consumer idx to avoid invalid interrupt
    
    Signed-off-by: Luo bin <luobin9@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d63fac896335ed64ca086c849ddeb14090784899
Author: Luo bin <luobin9@huawei.com>
Date:   Fri Mar 20 23:13:16 2020 +0000

    hinic: fix a bug of waitting for IO stopped
    
    [ Upstream commit 96758117dc528e6d84bd23d205e8cf7f31eda029 ]
    
    it's unreliable for fw to check whether IO is stopped, so driver
    wait for enough time to ensure IO process is done in hw before
    freeing resources
    
    Signed-off-by: Luo bin <luobin9@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ad4ad8253f8978c87fe246337c0551d83274cbbf
Author: Zheng Wei <wei.zheng@vivo.com>
Date:   Mon Mar 16 22:23:47 2020 +0800

    net: vxge: fix wrong __VA_ARGS__ usage
    
    [ Upstream commit b317538c47943f9903860d83cc0060409e12d2ff ]
    
    printk in macro vxge_debug_ll uses __VA_ARGS__ without "##" prefix,
    it causes a build error when there is no variable
    arguments(e.g. only fmt is specified.).
    
    Signed-off-by: Zheng Wei <wei.zheng@vivo.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b9c96199856559b3464a045af287b2f835491eba
Author: Markus Fuchs <mklntf@gmail.com>
Date:   Fri Mar 6 17:38:48 2020 +0100

    net: stmmac: platform: Fix misleading interrupt error msg
    
    [ Upstream commit fc191af1bb0d069dc7e981076e8b80af21f1e61d ]
    
    Not every stmmac based platform makes use of the eth_wake_irq or eth_lpi
    interrupts. Use the platform_get_irq_byname_optional variant for these
    interrupts, so no error message is displayed, if they can't be found.
    Rather print an information to hint something might be wrong to assist
    debugging on platforms which use these interrupts.
    
    Signed-off-by: Markus Fuchs <mklntf@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f96f2c885eda81f28a0a51d2adf06ff3a0374d79
Author: David Howells <dhowells@redhat.com>
Date:   Fri Mar 13 09:22:09 2020 +0000

    rxrpc: Fix call interruptibility handling
    
    [ Upstream commit e138aa7d3271ac1b0690ae2c9b04d51468dce1d6 ]
    
    Fix the interruptibility of kernel-initiated client calls so that they're
    either only interruptible when they're waiting for a call slot to come
    available or they're not interruptible at all.  Either way, they're not
    interruptible during transmission.
    
    This should help prevent StoreData calls from being interrupted when
    writeback is in progress.  It doesn't, however, handle interruption during
    the receive phase.
    
    Userspace-initiated calls are still interruptable.  After the signal has
    been handled, sendmsg() will return the amount of data copied out of the
    buffer and userspace can perform another sendmsg() call to continue
    transmission.
    
    Fixes: bc5e3a546d55 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals")
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f8da7f4428613c27ff31c75e3bc58589fa432e3b
Author: David Howells <dhowells@redhat.com>
Date:   Fri Mar 13 09:05:38 2020 +0000

    rxrpc: Abstract out the calculation of whether there's Tx space
    
    [ Upstream commit 158fe6665389964a1de212818b4a5c52b7f7aff4 ]
    
    Abstract out the calculation of there being sufficient Tx buffer space.
    This is reproduced several times in the rxrpc sendmsg code.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 96860db5c09fd936bfd871f70bc4448c335e8444
Author: Grigore Popescu <grigore.popescu@nxp.com>
Date:   Tue Mar 10 14:07:19 2020 +0200

    soc: fsl: dpio: register dpio irq handlers after dpio create
    
    [ Upstream commit fe8fe7723a3a824790bda681b40efd767e2251a7 ]
    
    The dpio irqs must be registered when you can actually
    receive interrupts, ie when the dpios are created.
    Kernel goes through NULL pointer dereference errors
    followed by kernel panic [1] because the dpio irqs are
    enabled before the dpio is created.
    
    [1]
    Unable to handle kernel NULL pointer dereference at virtual address 0040
    fsl_mc_dpio dpio.14: probed
    fsl_mc_dpio dpio.13: Adding to iommu group 11
      ISV = 0, ISS = 0x00000004
    Unable to handle kernel NULL pointer dereference at virtual address 0040
    Mem abort info:
      ESR = 0x96000004
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
    Data abort info:
      ISV = 0, ISS = 0x00000004
      CM = 0, WnR = 0
    [0000000000000040] user address but active_mm is swapper
    Internal error: Oops: 96000004 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 2 PID: 151 Comm: kworker/2:1 Not tainted 5.6.0-rc4-next-20200304 #1
    Hardware name: NXP Layerscape LX2160ARDB (DT)
    Workqueue: events deferred_probe_work_func
    pstate: 00000085 (nzcv daIf -PAN -UAO)
    pc : dpaa2_io_irq+0x18/0xe0
    lr : dpio_irq_handler+0x1c/0x28
    sp : ffff800010013e20
    x29: ffff800010013e20 x28: ffff0026d9b4c140
    x27: ffffa1d38a142018 x26: ffff0026d2953400
    x25: ffffa1d38a142018 x24: ffffa1d38a7ba1d8
    x23: ffff800010013f24 x22: 0000000000000000
    x21: 0000000000000072 x20: ffff0026d2953400
    x19: ffff0026d2a68b80 x18: 0000000000000001
    x17: 000000002fb37f3d x16: 0000000035eafadd
    x15: ffff0026d9b4c5b8 x14: ffffffffffffffff
    x13: ff00000000000000 x12: 0000000000000038
    x11: 0101010101010101 x10: 0000000000000040
    x9 : ffffa1d388db11e4 x8 : ffffa1d38a7e40f0
    x7 : ffff0026da414f38 x6 : 0000000000000000
    x5 : ffff0026da414d80 x4 : ffff5e5353d0c000
    x3 : ffff800010013f60 x2 : ffffa1d388db11c8
    x1 : ffff0026d2a67c00 x0 : 0000000000000000
    Call trace:
     dpaa2_io_irq+0x18/0xe0
     dpio_irq_handler+0x1c/0x28
     __handle_irq_event_percpu+0x78/0x2c0
     handle_irq_event_percpu+0x38/0x90
     handle_irq_event+0x4c/0xd0
     handle_fasteoi_irq+0xbc/0x168
     generic_handle_irq+0x2c/0x40
     __handle_domain_irq+0x68/0xc0
     gic_handle_irq+0x64/0x150
     el1_irq+0xb8/0x180
     _raw_spin_unlock_irqrestore+0x14/0x48
     irq_set_affinity_hint+0x6c/0xa0
     dpaa2_dpio_probe+0x2a4/0x518
     fsl_mc_driver_probe+0x28/0x70
     really_probe+0xdc/0x320
     driver_probe_device+0x5c/0xf0
     __device_attach_driver+0x88/0xc0
     bus_for_each_drv+0x7c/0xc8
     __device_attach+0xe4/0x140
     device_initial_probe+0x18/0x20
     bus_probe_device+0x98/0xa0
     device_add+0x41c/0x758
     fsl_mc_device_add+0x184/0x530
     dprc_scan_objects+0x280/0x370
     dprc_probe+0x124/0x3b0
     fsl_mc_driver_probe+0x28/0x70
     really_probe+0xdc/0x320
     driver_probe_device+0x5c/0xf0
     __device_attach_driver+0x88/0xc0
     bus_for_each_drv+0x7c/0xc8
     __device_attach+0xe4/0x140
     device_initial_probe+0x18/0x20
     bus_probe_device+0x98/0xa0
     deferred_probe_work_func+0x74/0xa8
     process_one_work+0x1c8/0x470
     worker_thread+0x1f8/0x428
     kthread+0x124/0x128
     ret_from_fork+0x10/0x18
    Code: a9bc7bfd 910003fd a9025bf5 a90363f7 (f9402015)
    ---[ end trace 38298e1a29e7a570 ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    SMP: stopping secondary CPUs
    Mem abort info:
      ESR = 0x96000004
      CM = 0, WnR = 0
      EC = 0x25: DABT (current EL), IL = 32 bits
    [0000000000000040] user address but active_mm is swapper
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
    Data abort info:
      ISV = 0, ISS = 0x00000004
      CM = 0, WnR = 0
    [0000000000000040] user address but active_mm is swapper
    SMP: failed to stop secondary CPUs 0-2
    Kernel Offset: 0x21d378600000 from 0xffff800010000000
    PHYS_OFFSET: 0xffffe92180000000
    CPU features: 0x10002,21806008
    Memory Limit: none
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
    
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
    Signed-off-by: Grigore Popescu <grigore.popescu@nxp.com>
    Signed-off-by: Li Yang <leoyang.li@nxp.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10e15e1b929795edd268cb92278c7104983f3bb7
Author: Nick Reitemeyer <nick.reitemeyer@web.de>
Date:   Sat Feb 15 15:41:55 2020 -0800

    Input: tm2-touchkey - add support for Coreriver TC360 variant
    
    [ Upstream commit da3289044833769188c0da945d2cec90af35e87e ]
    
    The Coreriver TouchCore 360 is like the midas board touchkey, but it is
    using a fixed regulator.
    
    Signed-off-by: Nick Reitemeyer <nick.reitemeyer@web.de>
    Link: https://lore.kernel.org/r/20200121141525.3404-3-nick.reitemeyer@web.de
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ed1c4d2ca9da3a05bf286e37ce634017cbc75094
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Fri Mar 6 15:16:26 2020 +0200

    iwlwifi: mvm: Fix rate scale NSS configuration
    
    [ Upstream commit ce19801ba75a902ab515dda03b57738c708d0781 ]
    
    The TLC configuration did not take into consideration the station's
    SMPS configuration, and thus configured rates for 2 NSS even if
    static SMPS was reported by the station. Fix this.
    
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20200306151129.b4f940d13eca.Ieebfa889d08205a3a961ae0138fb5832e8a0f9c1@changeid
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fd29a0242f86b2d95ad666aa9f92a3d0f7bfdab6
Author: Yonghong Song <yhs@fb.com>
Date:   Wed Mar 4 11:11:04 2020 -0800

    bpf: Fix deadlock with rq_lock in bpf_send_signal()
    
    [ Upstream commit 1bc7896e9ef44fd77858b3ef0b8a6840be3a4494 ]
    
    When experimenting with bpf_send_signal() helper in our production
    environment (5.2 based), we experienced a deadlock in NMI mode:
       #5 [ffffc9002219f770] queued_spin_lock_slowpath at ffffffff8110be24
       #6 [ffffc9002219f770] _raw_spin_lock_irqsave at ffffffff81a43012
       #7 [ffffc9002219f780] try_to_wake_up at ffffffff810e7ecd
       #8 [ffffc9002219f7e0] signal_wake_up_state at ffffffff810c7b55
       #9 [ffffc9002219f7f0] __send_signal at ffffffff810c8602
      #10 [ffffc9002219f830] do_send_sig_info at ffffffff810ca31a
      #11 [ffffc9002219f868] bpf_send_signal at ffffffff8119d227
      #12 [ffffc9002219f988] bpf_overflow_handler at ffffffff811d4140
      #13 [ffffc9002219f9e0] __perf_event_overflow at ffffffff811d68cf
      #14 [ffffc9002219fa10] perf_swevent_overflow at ffffffff811d6a09
      #15 [ffffc9002219fa38] ___perf_sw_event at ffffffff811e0f47
      #16 [ffffc9002219fc30] __schedule at ffffffff81a3e04d
      #17 [ffffc9002219fc90] schedule at ffffffff81a3e219
      #18 [ffffc9002219fca0] futex_wait_queue_me at ffffffff8113d1b9
      #19 [ffffc9002219fcd8] futex_wait at ffffffff8113e529
      #20 [ffffc9002219fdf0] do_futex at ffffffff8113ffbc
      #21 [ffffc9002219fec0] __x64_sys_futex at ffffffff81140d1c
      #22 [ffffc9002219ff38] do_syscall_64 at ffffffff81002602
      #23 [ffffc9002219ff50] entry_SYSCALL_64_after_hwframe at ffffffff81c00068
    
    The above call stack is actually very similar to an issue
    reported by Commit eac9153f2b58 ("bpf/stackmap: Fix deadlock with
    rq_lock in bpf_get_stack()") by Song Liu. The only difference is
    bpf_send_signal() helper instead of bpf_get_stack() helper.
    
    The above deadlock is triggered with a perf_sw_event.
    Similar to Commit eac9153f2b58, the below almost identical reproducer
    used tracepoint point sched/sched_switch so the issue can be easily caught.
      /* stress_test.c */
      #include <stdio.h>
      #include <stdlib.h>
      #include <sys/mman.h>
      #include <pthread.h>
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
    
      #define THREAD_COUNT 1000
      char *filename;
      void *worker(void *p)
      {
            void *ptr;
            int fd;
            char *pptr;
    
            fd = open(filename, O_RDONLY);
            if (fd < 0)
                    return NULL;
            while (1) {
                    struct timespec ts = {0, 1000 + rand() % 2000};
    
                    ptr = mmap(NULL, 4096 * 64, PROT_READ, MAP_PRIVATE, fd, 0);
                    usleep(1);
                    if (ptr == MAP_FAILED) {
                            printf("failed to mmap\n");
                            break;
                    }
                    munmap(ptr, 4096 * 64);
                    usleep(1);
                    pptr = malloc(1);
                    usleep(1);
                    pptr[0] = 1;
                    usleep(1);
                    free(pptr);
                    usleep(1);
                    nanosleep(&ts, NULL);
            }
            close(fd);
            return NULL;
      }
    
      int main(int argc, char *argv[])
      {
            void *ptr;
            int i;
            pthread_t threads[THREAD_COUNT];
    
            if (argc < 2)
                    return 0;
    
            filename = argv[1];
    
            for (i = 0; i < THREAD_COUNT; i++) {
                    if (pthread_create(threads + i, NULL, worker, NULL)) {
                            fprintf(stderr, "Error creating thread\n");
                            return 0;
                    }
            }
    
            for (i = 0; i < THREAD_COUNT; i++)
                    pthread_join(threads[i], NULL);
            return 0;
      }
    and the following command:
      1. run `stress_test /bin/ls` in one windown
      2. hack bcc trace.py with the following change:
    #     --- a/tools/trace.py
    #     +++ b/tools/trace.py
         @@ -513,6 +513,7 @@ BPF_PERF_OUTPUT(%s);
                  __data.tgid = __tgid;
                  __data.pid = __pid;
                  bpf_get_current_comm(&__data.comm, sizeof(__data.comm));
         +        bpf_send_signal(10);
          %s
          %s
                  %s.perf_submit(%s, &__data, sizeof(__data));
      3. in a different window run
         ./trace.py -p $(pidof stress_test) t:sched:sched_switch
    
    The deadlock can be reproduced in our production system.
    
    Similar to Song's fix, the fix is to delay sending signal if
    irqs is disabled to avoid deadlocks involving with rq_lock.
    With this change, my above stress-test in our production system
    won't cause deadlock any more.
    
    I also implemented a scale-down version of reproducer in the
    selftest (a subsequent commit). With latest bpf-next,
    it complains for the following potential deadlock.
      [   32.832450] -> #1 (&p->pi_lock){-.-.}:
      [   32.833100]        _raw_spin_lock_irqsave+0x44/0x80
      [   32.833696]        task_rq_lock+0x2c/0xa0
      [   32.834182]        task_sched_runtime+0x59/0xd0
      [   32.834721]        thread_group_cputime+0x250/0x270
      [   32.835304]        thread_group_cputime_adjusted+0x2e/0x70
      [   32.835959]        do_task_stat+0x8a7/0xb80
      [   32.836461]        proc_single_show+0x51/0xb0
      ...
      [   32.839512] -> #0 (&(&sighand->siglock)->rlock){....}:
      [   32.840275]        __lock_acquire+0x1358/0x1a20
      [   32.840826]        lock_acquire+0xc7/0x1d0
      [   32.841309]        _raw_spin_lock_irqsave+0x44/0x80
      [   32.841916]        __lock_task_sighand+0x79/0x160
      [   32.842465]        do_send_sig_info+0x35/0x90
      [   32.842977]        bpf_send_signal+0xa/0x10
      [   32.843464]        bpf_prog_bc13ed9e4d3163e3_send_signal_tp_sched+0x465/0x1000
      [   32.844301]        trace_call_bpf+0x115/0x270
      [   32.844809]        perf_trace_run_bpf_submit+0x4a/0xc0
      [   32.845411]        perf_trace_sched_switch+0x10f/0x180
      [   32.846014]        __schedule+0x45d/0x880
      [   32.846483]        schedule+0x5f/0xd0
      ...
    
      [   32.853148] Chain exists of:
      [   32.853148]   &(&sighand->siglock)->rlock --> &p->pi_lock --> &rq->lock
      [   32.853148]
      [   32.854451]  Possible unsafe locking scenario:
      [   32.854451]
      [   32.855173]        CPU0                    CPU1
      [   32.855745]        ----                    ----
      [   32.856278]   lock(&rq->lock);
      [   32.856671]                                lock(&p->pi_lock);
      [   32.857332]                                lock(&rq->lock);
      [   32.857999]   lock(&(&sighand->siglock)->rlock);
    
      Deadlock happens on CPU0 when it tries to acquire &sighand->siglock
      but it has been held by CPU1 and CPU1 tries to grab &rq->lock
      and cannot get it.
    
      This is not exactly the callstack in our production environment,
      but sympotom is similar and both locks are using spin_lock_irqsave()
      to acquire the lock, and both involves rq_lock. The fix to delay
      sending signal when irq is disabled also fixed this issue.
    
    Signed-off-by: Yonghong Song <yhs@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Cc: Song Liu <songliubraving@fb.com>
    Link: https://lore.kernel.org/bpf/20200304191104.2796501-1-yhs@fb.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5c234312e805afba78b9923856851771c75dcb75
Author: Tony Lindgren <tony@atomide.com>
Date:   Tue Mar 3 13:18:36 2020 -0800

    ARM: dts: Fix dm814x Ethernet by changing to use rgmii-id mode
    
    [ Upstream commit b46b2b7ba6e104d265ab705914859ec0db7a98c5 ]
    
    Commit cd28d1d6e52e ("net: phy: at803x: Disable phy delay for RGMII mode")
    caused a regression for dm814x boards where NFSroot would no longer work.
    
    Let's fix the issue by configuring "rgmii-id" mode as internal delays are
    needed that is no longer the case with "rgmii" mode.
    
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d04ffa50f901fe942402b4e6ceadafac3fa85831
Author: Ondrej Jirman <megous@megous.com>
Date:   Fri Feb 21 21:27:26 2020 +0100

    bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads
    
    [ Upstream commit a43ab30dcd4a1abcdd0d2461bf1cf7c0817f6cd3 ]
    
    When doing a 16-bit read that returns data in the MSB byte, the
    RSB_DATA register will keep the MSB byte unchanged when doing
    the following 8-bit read. sunxi_rsb_read() will then return
    a result that contains high byte from 16-bit read mixed with
    the 8-bit result.
    
    The consequence is that after this happens the PMIC's regmap will
    look like this: (0x33 is the high byte from the 16-bit read)
    
    % cat /sys/kernel/debug/regmap/sunxi-rsb-3a3/registers
    00: 33
    01: 33
    02: 33
    03: 33
    04: 33
    05: 33
    06: 33
    07: 33
    08: 33
    09: 33
    0a: 33
    0b: 33
    0c: 33
    0d: 33
    0e: 33
    [snip]
    
    Fix this by masking the result of the read with the correct mask
    based on the size of the read. There are no 16-bit users in the
    mainline kernel, so this doesn't need to get into the stable tree.
    
    Signed-off-by: Ondrej Jirman <megous@megous.com>
    Acked-by: Chen-Yu Tsai <wens@csie.org>
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7092cc4590c0a5dc3e5a57c83c8fe6b03d52fbcc
Author: Ondrej Jirman <megous@megous.com>
Date:   Sat Feb 22 23:31:52 2020 +0100

    ARM: dts: sun8i-a83t-tbs-a711: HM5065 doesn't like such a high voltage
    
    [ Upstream commit a40550952c000667b20082d58077bc647da6c890 ]
    
    Lowering the voltage solves the quick image degradation over time
    (minutes), that was probably caused by overheating.
    
    Signed-off-by: Ondrej Jirman <megous@megous.com>
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Signed-off-by: Sasha Levin <sashal@kernel.org>