commit 7ec6d8ae728e2f3b91a4cfac5e664ca32eb213da
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Apr 20 09:36:28 2022 +0200

    Linux 5.17.4
    
    Link: https://lore.kernel.org/r/20220418121203.462784814@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Rudi Heitbaum <rudi@heitbaum.com>
    Tested-by: Zan Aziz <zanaziz313@gmail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Fenil Jain<fkjainco@gmail.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Jiri Slaby <jirislaby@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b74c1d1782d5517f08dab36f3ee9a6dd6e1941c2
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Apr 18 06:41:20 2022 -0600

    io_uring: fix poll error reporting
    
    commit 7179c3ce3dbff646c55f7cd664a895f462f049e5 upstream.
    
    We should not return an error code in req->result in
    io_poll_check_events(), because it may get mangled and returned as
    success. Just return the error code directly, the callers will fail the
    request or proceed accordingly.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 540e5ce8b3bc5548d5a342d0f4a57779715545c0
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Apr 18 06:40:30 2022 -0600

    io_uring: fix poll file assign deadlock
    
    commit cce64ef01308b677a687d90927fc2b2e0e1cba67 upstream.
    
    We pass "unlocked" into io_assign_file() in io_poll_check_events(),
    which can lead to double locking.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/2476d4ae46554324b599ee4055447b105f20a75a.1649862516.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a8189db2d5d251c4e0234390034fad87d1cecebc
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Apr 13 16:10:33 2022 +0100

    io_uring: use right issue_flags for splice/tee
    
    commit e941976659f1f6834077a1596bf53e6bdb10e90b upstream.
    
    Pass right issue_flags into into io_file_get_fixed() instead of
    IO_URING_F_UNLOCKED. It's probably not a problem at the moment but let's
    do it safer.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/7d242daa9df5d776907686977cd29fbceb4a2d8d.1649862516.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76ff66bb3b22f202c226ddbb0a811f8fb8aab2fa
Author: Duoming Zhou <duoming@zju.edu.cn>
Date:   Mon Mar 28 21:00:15 2022 +0800

    ax25: Fix UAF bugs in ax25 timers
    
    commit 82e31755e55fbcea6a9dfaae5fe4860ade17cbc0 upstream.
    
    There are race conditions that may lead to UAF bugs in
    ax25_heartbeat_expiry(), ax25_t1timer_expiry(), ax25_t2timer_expiry(),
    ax25_t3timer_expiry() and ax25_idletimer_expiry(), when we call
    ax25_release() to deallocate ax25_dev.
    
    One of the UAF bugs caused by ax25_release() is shown below:
    
          (Thread 1)                    |      (Thread 2)
    ax25_dev_device_up() //(1)          |
    ...                                 | ax25_kill_by_device()
    ax25_bind()          //(2)          |
    ax25_connect()                      | ...
     ax25_std_establish_data_link()     |
      ax25_start_t1timer()              | ax25_dev_device_down() //(3)
       mod_timer(&ax25->t1timer,..)     |
                                        | ax25_release()
       (wait a time)                    |  ...
                                        |  ax25_dev_put(ax25_dev) //(4)FREE
       ax25_t1timer_expiry()            |
        ax25->ax25_dev->values[..] //USE|  ...
         ...                            |
    
    We increase the refcount of ax25_dev in position (1) and (2), and
    decrease the refcount of ax25_dev in position (3) and (4).
    The ax25_dev will be freed in position (4) and be used in
    ax25_t1timer_expiry().
    
    The fail log is shown below:
    ==============================================================
    
    [  106.116942] BUG: KASAN: use-after-free in ax25_t1timer_expiry+0x1c/0x60
    [  106.116942] Read of size 8 at addr ffff88800bda9028 by task swapper/0/0
    [  106.116942] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.0-06123-g0905eec574
    [  106.116942] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-14
    [  106.116942] Call Trace:
    ...
    [  106.116942]  ax25_t1timer_expiry+0x1c/0x60
    [  106.116942]  call_timer_fn+0x122/0x3d0
    [  106.116942]  __run_timers.part.0+0x3f6/0x520
    [  106.116942]  run_timer_softirq+0x4f/0xb0
    [  106.116942]  __do_softirq+0x1c2/0x651
    ...
    
    This patch adds del_timer_sync() in ax25_release(), which could ensure
    that all timers stop before we deallocate ax25_dev.
    
    Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72f90d4f9e41430e0fbe7e4477b389aa0d697137
Author: Steven Price <steven.price@arm.com>
Date:   Mon Apr 11 16:22:32 2022 +0100

    cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state
    
    commit b7ba6d8dc3569e49800ef0136799f26f43e237e8 upstream.
    
    Currently the setting of the 'cpu' member of struct cpuhp_cpu_state in
    cpuhp_create() is too late as it is used earlier in _cpu_up().
    
    If kzalloc_node() in __smpboot_create_thread() fails then the rollback will
    be done with st->cpu==0 causing CPU0 to be erroneously set to be dying,
    causing the scheduler to get mightily confused and throw its toys out of
    the pram.
    
    However the cpu number is actually available directly, so simply remove
    the 'cpu' member and avoid the problem in the first place.
    
    Fixes: 2ea46c6fc945 ("cpumask/hotplug: Fix cpu_dying() state tracking")
    Signed-off-by: Steven Price <steven.price@arm.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220411152233.474129-2-steven.price@arm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7959ca85ce4cb06f45688500813ca5f5a595e40e
Author: Matt Roper <matthew.d.roper@intel.com>
Date:   Thu Apr 7 09:18:39 2022 -0700

    drm/i915: Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL
    
    commit 1acb34e7dd7720a1fff00cbd4d000ec3219dc9d6 upstream.
    
    The intent of the version check in the mmap ioctl was to maintain
    support for existing platforms (i.e., ADL/RPL and earlier), but drop
    support on all future igpu platforms.  As we've seen on the dgpu side,
    the hardware teams are using a more fine-grained numbering system for IP
    version numbers these days, so it's possible the version number
    associated with our next igpu could be some form of "12.xx" rather than
    13 or higher.  Comparing against the full ver.release number will ensure
    the intent of the check is maintained no matter what numbering the
    hardware teams settle on.
    
    Fixes: d3f3baa3562a ("drm/i915: Reinstate the mmap ioctl for some platforms")
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: Lucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220407161839.1073443-1-matthew.d.roper@intel.com
    (cherry picked from commit 8e7e5c077cd57ee9a36d58c65f07257dc49a88d5)
    Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c92d432a4fa6bbdd7e16732125e62af5838431ea
Author: Marco Elver <elver@google.com>
Date:   Thu Apr 14 19:13:40 2022 -0700

    mm, kfence: support kmem_dump_obj() for KFENCE objects
    
    commit 2dfe63e61cc31ee59ce951672b0850b5229cd5b0 upstream.
    
    Calling kmem_obj_info() via kmem_dump_obj() on KFENCE objects has been
    producing garbage data due to the object not actually being maintained
    by SLAB or SLUB.
    
    Fix this by implementing __kfence_obj_info() that copies relevant
    information to struct kmem_obj_info when the object was allocated by
    KFENCE; this is called by a common kmem_obj_info(), which also calls the
    slab/slub/slob specific variant now called __kmem_obj_info().
    
    For completeness, kmem_dump_obj() now displays if the object was
    allocated by KFENCE.
    
    Link: https://lore.kernel.org/all/20220323090520.GG16885@xsang-OptiPlex-9020/
    Link: https://lkml.kernel.org/r/20220406131558.3558585-1-elver@google.com
    Fixes: b89fb5ef0ce6 ("mm, kfence: insert KFENCE hooks for SLUB")
    Fixes: d3fb45f370d9 ("mm, kfence: insert KFENCE hooks for SLAB")
    Signed-off-by: Marco Elver <elver@google.com>
    Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
    Reported-by: kernel test robot <oliver.sang@intel.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>      [slab]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 136a9b376630798969ea7167dc4166d53c8ffe00
Author: Chao Gao <chao.gao@intel.com>
Date:   Wed Apr 13 08:32:22 2022 +0200

    dma-direct: avoid redundant memory sync for swiotlb
    
    commit 9e02977bfad006af328add9434c8bffa40e053bb upstream.
    
    When we looked into FIO performance with swiotlb enabled in VM, we found
    swiotlb_bounce() is always called one more time than expected for each DMA
    read request.
    
    It turns out that the bounce buffer is copied to original DMA buffer twice
    after the completion of a DMA request (one is done by in
    dma_direct_sync_single_for_cpu(), the other by swiotlb_tbl_unmap_single()).
    But the content in bounce buffer actually doesn't change between the two
    rounds of copy. So, one round of copy is redundant.
    
    Pass DMA_ATTR_SKIP_CPU_SYNC flag to swiotlb_tbl_unmap_single() to
    skip the memory copy in it.
    
    This fix increases FIO 64KB sequential read throughput in a guest with
    swiotlb=force by 5.6%.
    
    Fixes: 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
    Reported-by: Wang Zhaoyang1 <zhaoyang1.wang@intel.com>
    Reported-by: Gao Liang <liang.gao@intel.com>
    Signed-off-by: Chao Gao <chao.gao@intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit efb2fcee74317bbb9a49ae3bc359d008df6c9a50
Author: Anna-Maria Behnsen <anna-maria@linutronix.de>
Date:   Tue Apr 5 21:17:32 2022 +0200

    timers: Fix warning condition in __run_timers()
    
    commit c54bc0fc84214b203f7a0ebfd1bd308ce2abe920 upstream.
    
    When the timer base is empty, base::next_expiry is set to base::clk +
    NEXT_TIMER_MAX_DELTA and base::next_expiry_recalc is false. When no timer
    is queued until jiffies reaches base::next_expiry value, the warning for
    not finding any expired timer and base::next_expiry_recalc is false in
    __run_timers() triggers.
    
    To prevent triggering the warning in this valid scenario
    base::timers_pending needs to be added to the warning condition.
    
    Fixes: 31cd0e119d50 ("timers: Recalculate next timer interrupt only when necessary")
    Reported-by: Johannes Berg <johannes@sipsolutions.net>
    Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
    Link: https://lore.kernel.org/r/20220405191732.7438-3-anna-maria@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5d6f156473cbb40e48fbb470a97fbc6ecb34ed04
Author: Dongjin Yang <dj76.yang@samsung.com>
Date:   Mon Apr 4 11:28:57 2022 +0900

    dt-bindings: net: snps: remove duplicate name
    
    commit ce8b3ad1071b764e963d9b08ac34ffddddf12da6 upstream.
    
    snps,dwmac has duplicated name for loongson,ls2k-dwmac and
    loongson,ls7a-dwmac.
    
    Signed-off-by: Dongjin Yang <dj76.yang@samsung.com>
    Fixes: 68277749a013 ("dt-bindings: dwmac: Add bindings for new Loongson SoC and bridge chip")
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20220404022857epcms1p6e6af1a6a86569f339e50c318abde7d3c@epcms1p6
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a5f36e13b534411b435dbdd5ed91fe08ca4d4cad
Author: Martin Povišer <povik+lin@cutebit.org>
Date:   Tue Mar 29 20:38:17 2022 +0200

    i2c: pasemi: Wait for write xfers to finish
    
    commit bd8963e602c77adc76dbbbfc3417c3cf14fed76b upstream.
    
    Wait for completion of write transfers before returning from the driver.
    At first sight it may seem advantageous to leave write transfers queued
    for the controller to carry out on its own time, but there's a couple of
    issues with it:
    
     * Driver doesn't check for FIFO space.
    
     * The queued writes can complete while the driver is in its I2C read
       transfer path which means it will get confused by the raising of
       XEN (the 'transaction ended' signal). This can cause a spurious
       ENODATA error due to premature reading of the MRXFIFO register.
    
    Adding the wait fixes some unreliability issues with the driver. There's
    some efficiency cost to it (especially with pasemi_smb_waitready doing
    its polling), but that will be alleviated once the driver receives
    interrupt support.
    
    Fixes: beb58aa39e6e ("i2c: PA Semi SMBus driver")
    Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
    Reviewed-by: Sven Peter <sven@svenpeter.dev>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e129fc9e62b36b1bd0724eb5acb54d48923f7d5c
Author: Sherry Sun <sherry.sun@nxp.com>
Date:   Mon Mar 21 15:51:30 2022 +0800

    dt-bindings: memory: snps,ddrc-3.80a compatible also need interrupts
    
    commit 4f9f45d0eb0e7d449bc9294459df79b9c66edfac upstream.
    
    For the snps,ddrc-3.80a compatible, the interrupts property is also
    required, also order the compatibles by name (s goes before x).
    
    Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
    Fixes: a9e6b3819b36 ("dt-bindings: memory: Add entry for version 3.80a")
    Link: https://lore.kernel.org/r/20220321075131.17811-2-sherry.sun@nxp.com
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 177e7aceef185afd88932c16d0039aacbe9b7cb7
Author: Nadav Amit <namit@vmware.com>
Date:   Sat Mar 19 00:20:15 2022 -0700

    smp: Fix offline cpu check in flush_smp_call_function_queue()
    
    commit 9e949a3886356fe9112c6f6f34a6e23d1d35407f upstream.
    
    The check in flush_smp_call_function_queue() for callbacks that are sent
    to offline CPUs currently checks whether the queue is empty.
    
    However, flush_smp_call_function_queue() has just deleted all the
    callbacks from the queue and moved all the entries into a local list.
    This checks would only be positive if some callbacks were added in the
    short time after llist_del_all() was called. This does not seem to be
    the intention of this check.
    
    Change the check to look at the local list to which the entries were
    moved instead of the queue from which all the callbacks were just
    removed.
    
    Fixes: 8d056c48e4862 ("CPU hotplug, smp: flush any pending IPI callbacks before CPU offline")
    Signed-off-by: Nadav Amit <namit@vmware.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220319072015.1495036-1-namit@vmware.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c00812880533e58bd2cd01eb26419e6e40efc53
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Tue Apr 12 12:44:26 2022 +0300

    Revert "net: dsa: setup master before ports"
    
    commit 762c2998c9625f642f0d23da7d3f7e4f90665fdf upstream.
    
    This reverts commit 11fd667dac315ea3f2469961f6d2869271a46cae.
    
    dsa_slave_change_mtu() updates the MTU of the DSA master and of the
    associated CPU port, but only if it detects a change to the master MTU.
    
    The blamed commit in the Fixes: tag below addressed a regression where
    dsa_slave_change_mtu() would return early and not do anything due to
    ds->ops->port_change_mtu() not being implemented.
    
    However, that commit also had the effect that the master MTU got set up
    to the correct value by dsa_master_setup(), but the associated CPU port's
    MTU did not get updated. This causes breakage for drivers that rely on
    the ->port_change_mtu() DSA call to account for the tagging overhead on
    the CPU port, and don't set up the initial MTU during the setup phase.
    
    Things actually worked before because they were in a fragile equilibrium
    where dsa_slave_change_mtu() was called before dsa_master_setup() was.
    So dsa_slave_change_mtu() could actually detect a change and update the
    CPU port MTU too.
    
    Restore the code to the way things used to work by reverting the reorder
    of dsa_tree_setup_master() and dsa_tree_setup_ports(). That change did
    not have a concrete motivation going for it anyway, it just looked
    better.
    
    Fixes: 066dfc429040 ("Revert "net: dsa: stop updating master MTU from master.c"")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c74d77a2d07744147d734138acd6ce9dba715e5d
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Mon Apr 11 21:07:51 2022 +0300

    i2c: dev: check return value when calling dev_set_name()
    
    commit 993eb48fa199b5f476df8204e652eff63dd19361 upstream.
    
    If dev_set_name() fails, the dev_name() is null, check the return
    value of dev_set_name() to avoid the null-ptr-deref.
    
    Fixes: 1413ef638aba ("i2c: dev: Fix the race between the release of i2c_dev and cdev")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4d485cf9b609709e45d5113e6e2b1b01254b2fe9
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Sun Apr 3 14:38:22 2022 -0400

    dm integrity: fix memory corruption when tag_size is less than digest size
    
    commit 08c1af8f1c13bbf210f1760132f4df24d0ed46d6 upstream.
    
    It is possible to set up dm-integrity in such a way that the
    "tag_size" parameter is less than the actual digest size. In this
    situation, a part of the digest beyond tag_size is ignored.
    
    In this case, dm-integrity would write beyond the end of the
    ic->recalc_tags array and corrupt memory. The corruption happened in
    integrity_recalc->integrity_sector_checksum->crypto_shash_final.
    
    Fix this corruption by increasing the tags array so that it has enough
    padding at the end to accomodate the loop in integrity_recalc() being
    able to write a full digest size for the last member of the tags
    array.
    
    Cc: stable@vger.kernel.org # v4.19+
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0f12166872da46c6b57ba2f1314bbf310b3bf017
Author: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Date:   Sun Jan 30 16:25:02 2022 +0100

    ep93xx: clock: Fix UAF in ep93xx_clk_register_gate()
    
    commit 3b68b08885217abd9c57ff9b3bb3eb173eee02a9 upstream.
    
    arch/arm/mach-ep93xx/clock.c:154:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
    arch/arm/mach-ep93xx/clock.c:151:2: note: Taking true branch
    if (IS_ERR(clk))
    ^
    arch/arm/mach-ep93xx/clock.c:152:3: note: Memory is released
    kfree(psc);
    ^~~~~~~~~~
    arch/arm/mach-ep93xx/clock.c:154:2: note: Use of memory after it is freed
    return &psc->hw;
    ^ ~~~~~~~~
    
    Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK")
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/B5YCO2NJEXINCYE26Y255LCVMO55BGWW/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c5628533a3ece64235d04fe11ec44d2be99e423d
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Thu Dec 23 15:21:41 2021 -0700

    ARM: davinci: da850-evm: Avoid NULL pointer dereference
    
    commit 83a1cde5c74bfb44b49cb2a940d044bb2380f4ea upstream.
    
    With newer versions of GCC, there is a panic in da850_evm_config_emac()
    when booting multi_v5_defconfig in QEMU under the palmetto-bmc machine:
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000020
    pgd = (ptrval)
    [00000020] *pgd=00000000
    Internal error: Oops: 5 [#1] PREEMPT ARM
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.0 #1
    Hardware name: Generic DT based system
    PC is at da850_evm_config_emac+0x1c/0x120
    LR is at do_one_initcall+0x50/0x1e0
    
    The emac_pdata pointer in soc_info is NULL because davinci_soc_info only
    gets populated on davinci machines but da850_evm_config_emac() is called
    on all machines via device_initcall().
    
    Move the rmii_en assignment below the machine check so that it is only
    dereferenced when running on a supported SoC.
    
    Fixes: bae105879f2f ("davinci: DA850/OMAP-L138 EVM: implement autodetect of RMII PHY")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Reviewed-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/YcS4xVWs6bQlQSPC@archlinux-ax161/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6e3bc67529302d764a26212b20c5b5cfca3e3d37
Author: Paul Gortmaker <paul.gortmaker@windriver.com>
Date:   Mon Dec 6 09:59:50 2021 -0500

    tick/nohz: Use WARN_ON_ONCE() to prevent console saturation
    
    commit 40e97e42961f8c6cc7bd5fe67cc18417e02d78f1 upstream.
    
    While running some testing on code that happened to allow the variable
    tick_nohz_full_running to get set but with no "possible" NOHZ cores to
    back up that setting, this warning triggered:
    
            if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
                    WARN_ON(tick_nohz_full_running);
    
    The console was overwhemled with an endless stream of one WARN per tick
    per core and there was no way to even see what was going on w/o using a
    serial console to capture it and then trace it back to this.
    
    Change it to WARN_ON_ONCE().
    
    Fixes: 08ae95f4fd3b ("nohz_full: Allow the boot CPU to be nohz_full")
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20211206145950.10927-3-paul.gortmaker@windriver.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bcc6ac85e8803da7045c09cf9406627bbd011a86
Author: Rei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Date:   Thu Mar 31 09:33:09 2022 +0900

    genirq/affinity: Consider that CPUs on nodes can be unbalanced
    
    commit 08d835dff916bfe8f45acc7b92c7af6c4081c8a7 upstream.
    
    If CPUs on a node are offline at boot time, the number of nodes is
    different when building affinity masks for present cpus and when building
    affinity masks for possible cpus. This causes the following problem:
    
    In the case that the number of vectors is less than the number of nodes
    there are cases where bits of masks for present cpus are overwritten when
    building masks for possible cpus.
    
    Fix this by excluding CPUs, which are not part of the current build mask
    (present/possible).
    
    [ tglx: Massaged changelog and added comment ]
    
    Fixes: b82592199032 ("genirq/affinity: Spread IRQs to all available NUMA nodes")
    Signed-off-by: Rei Yamamoto <yamamoto.rei@jp.fujitsu.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Ming Lei <ming.lei@redhat.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20220331003309.10891-1-yamamoto.rei@jp.fujitsu.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ee32a744166c7258feb113eac9037b69de42e1e4
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Mar 10 14:02:09 2022 -0800

    x86/tsx: Disable TSX development mode at boot
    
    commit 400331f8ffa3bec5c561417e5eec6848464e9160 upstream.
    
    A microcode update on some Intel processors causes all TSX transactions
    to always abort by default[*]. Microcode also added functionality to
    re-enable TSX for development purposes. With this microcode loaded, if
    tsx=on was passed on the cmdline, and TSX development mode was already
    enabled before the kernel boot, it may make the system vulnerable to TSX
    Asynchronous Abort (TAA).
    
    To be on safer side, unconditionally disable TSX development mode during
    boot. If a viable use case appears, this can be revisited later.
    
      [*]: Intel TSX Disable Update for Selected Processors, doc ID: 643557
    
      [ bp: Drop unstable web link, massage heavily. ]
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Suggested-by: Borislav Petkov <bp@alien8.de>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/347bd844da3a333a9793c6687d4e4eb3b2419a3e.1646943780.git.pawan.kumar.gupta@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 769786023b35ddc18749149181ab613ea8b624b0
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Mar 10 14:00:59 2022 -0800

    x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits
    
    commit 258f3b8c3210b03386e4ad92b4bd8652b5c1beb3 upstream.
    
    tsx_clear_cpuid() uses MSR_TSX_FORCE_ABORT to clear CPUID.RTM and
    CPUID.HLE. Not all CPUs support MSR_TSX_FORCE_ABORT, alternatively use
    MSR_IA32_TSX_CTRL when supported.
    
      [ bp: Document how and why TSX gets disabled. ]
    
    Fixes: 293649307ef9 ("x86/tsx: Clear CPUID bits when TSX always force aborts")
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/5b323e77e251a9c8bcdda498c5cc0095be1e1d3c.1646943780.git.pawan.kumar.gupta@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 85904b3b29920aa0d259a03ac67a1d8bfbf43ff5
Author: Tomasz Moń <desowin@gmail.com>
Date:   Wed Apr 6 21:49:21 2022 +0200

    drm/amdgpu: Enable gfxoff quirk on MacBook Pro
    
    commit 4593c1b6d159f1e5c35c07a7f125e79e5a864302 upstream.
    
    Enabling gfxoff quirk results in perfectly usable graphical user
    interface on MacBook Pro (15-inch, 2019) with Radeon Pro Vega 20 4 GB.
    
    Without the quirk, X server is completely unusable as every few seconds
    there is gpu reset due to ring gfx timeout.
    
    Signed-off-by: Tomasz Moń <desowin@gmail.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 5123f91c809e3bf27899036d7f2e11dd23d13436
Author: Melissa Wen <mwen@igalia.com>
Date:   Tue Mar 29 19:18:35 2022 -0100

    drm/amd/display: don't ignore alpha property on pre-multiplied mode
    
    commit e4f1541caf60fcbe5a59e9d25805c0b5865e546a upstream.
    
    "Pre-multiplied" is the default pixel blend mode for KMS/DRM, as
    documented in supported_modes of drm_plane_create_blend_mode_property():
    https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_blend.c
    
    In this mode, both 'pixel alpha' and 'plane alpha' participate in the
    calculation, as described by the pixel blend mode formula in KMS/DRM
    documentation:
    
    out.rgb = plane_alpha * fg.rgb +
              (1 - (plane_alpha * fg.alpha)) * bg.rgb
    
    Considering the blend config mechanisms we have in the driver so far,
    the alpha mode that better fits this blend mode is the
    _PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN, where the value for global_gain
    is the plane alpha (global_alpha).
    
    With this change, alpha property stops to be ignored. It also addresses
    Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1734
    
    v2:
     * keep the 8-bit value for global_alpha_value (Nicholas)
     * correct the logical ordering for combined global gain (Nicholas)
     * apply to dcn10 too (Nicholas)
    
    Signed-off-by: Melissa Wen <mwen@igalia.com>
    Tested-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Tested-by: Simon Ser <contact@emersion.fr>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e69fb3de87a8923e5931a272a38fa3cceb01da44
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date:   Fri Apr 8 16:03:42 2022 +0200

    ipv6: fix panic when forwarding a pkt with no in6 dev
    
    commit e3fa461d8b0e185b7da8a101fe94dfe6dd500ac0 upstream.
    
    kongweibin reported a kernel panic in ip6_forward() when input interface
    has no in6 dev associated.
    
    The following tc commands were used to reproduce this panic:
    tc qdisc del dev vxlan100 root
    tc qdisc add dev vxlan100 root netem corrupt 5%
    
    CC: stable@vger.kernel.org
    Fixes: ccd27f05ae7b ("ipv6: fix 'disable_policy' for fwd packets")
    Reported-by: kongweibin <kongweibin2@huawei.com>
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8ca676f342fe1167be06b27871413676e5680fcd
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Apr 11 11:42:03 2022 +0200

    nl80211: correctly check NL80211_ATTR_REG_ALPHA2 size
    
    commit 6624bb34b4eb19f715db9908cca00122748765d7 upstream.
    
    We need this to be at least two bytes, so we can access
    alpha2[0] and alpha2[1]. It may be three in case some
    userspace used NUL-termination since it was NLA_STRING
    (and we also push it out with NUL-termination).
    
    Cc: stable@vger.kernel.org
    Reported-by: Lee Jones <lee.jones@linaro.org>
    Link: https://lore.kernel.org/r/20220411114201.fd4a31f06541.Ie7ff4be2cf348d8cc28ed0d626fc54becf7ea799@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 97345c90235b1bb7661e7a428d9dcb96b1d7f5d4
Author: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Date:   Sat Apr 9 03:26:55 2022 +0200

    ALSA: pcm: Test for "silence" field in struct "pcm_format_data"
    
    commit 2f7a26abb8241a0208c68d22815aa247c5ddacab upstream.
    
    Syzbot reports "KASAN: null-ptr-deref Write in
    snd_pcm_format_set_silence".[1]
    
    It is due to missing validation of the "silence" field of struct
    "pcm_format_data" in "pcm_formats" array.
    
    Add a test for valid "pat" and, if it is not so, return -EINVAL.
    
    [1] https://lore.kernel.org/lkml/000000000000d188ef05dc2c7279@google.com/
    
    Reported-and-tested-by: syzbot+205eb15961852c2c5974@syzkaller.appspotmail.com
    Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220409012655.9399-1-fmdefrancesco@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a98e5df27f580e9f2bbd24207a83be3cff366be7
Author: Tao Jin <tao-j@outlook.com>
Date:   Sat Apr 9 18:44:24 2022 -0400

    ALSA: hda/realtek: add quirk for Lenovo Thinkpad X12 speakers
    
    commit 264fb03497ec1c7841bba872571bcd11beed57a7 upstream.
    
    For this specific device on Lenovo Thinkpad X12 tablet, the verbs were
    dumped by qemu running a guest OS that init this codec properly.
    After studying the dump, it turns out that
    the same quirk used by the other Lenovo devices can be reused.
    
    The patch was tested working against the mainline kernel.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Tao Jin <tao-j@outlook.com>
    Link: https://lore.kernel.org/r/CO6PR03MB6241CD73310B37858FE64C85E1E89@CO6PR03MB6241.namprd03.prod.outlook.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ad0a1c07b9353d61da744698ebc3b981e7698cfa
Author: Tim Crawford <tcrawford@system76.com>
Date:   Tue Apr 5 12:20:29 2022 -0600

    ALSA: hda/realtek: Add quirk for Clevo PD50PNT
    
    commit 9eb6f5c388060d8cef3c8b616cc31b765e022359 upstream.
    
    Fixes speaker output and headset detection on Clevo PD50PNT.
    
    Signed-off-by: Tim Crawford <tcrawford@system76.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220405182029.27431-1-tcrawford@system76.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 46f6cb3cae7786c6120e48fa62567f304d833f85
Author: Naohiro Aota <naohiro.aota@wdc.com>
Date:   Tue Mar 29 15:55:58 2022 +0900

    btrfs: mark resumed async balance as writing
    
    commit a690e5f2db4d1dca742ce734aaff9f3112d63764 upstream.
    
    When btrfs balance is interrupted with umount, the background balance
    resumes on the next mount. There is a potential deadlock with FS freezing
    here like as described in commit 26559780b953 ("btrfs: zoned: mark
    relocation as writing"). Mark the process as sb_writing to avoid it.
    
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    CC: stable@vger.kernel.org # 4.9+
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.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 0850b7bdcea69d330a4a9b9b290af073ff32c63c
Author: Jia-Ju Bai <baijiaju1990@gmail.com>
Date:   Thu Mar 24 06:44:54 2022 -0700

    btrfs: fix root ref counts in error handling in btrfs_get_root_ref
    
    commit 168a2f776b9762f4021421008512dd7ab7474df1 upstream.
    
    In btrfs_get_root_ref(), when btrfs_insert_fs_root() fails,
    btrfs_put_root() can happen for two reasons:
    
    - the root already exists in the tree, in that case it returns the
      reference obtained in btrfs_lookup_fs_root()
    
    - another error so the cleanup is done in the fail label
    
    Calling btrfs_put_root() unconditionally would lead to double decrement
    of the root reference possibly freeing it in the second case.
    
    Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
    Fixes: bc44d7c4b2b1 ("btrfs: push btrfs_grab_fs_root into btrfs_get_fs_root")
    CC: stable@vger.kernel.org # 5.10+
    Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.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 00b3ed098dc1d581a040155ae5d4b7a4eb565852
Author: Naohiro Aota <naohiro.aota@wdc.com>
Date:   Tue Mar 22 18:11:34 2022 +0900

    btrfs: zoned: activate block group only for extent allocation
    
    commit 760e69c4c2e2f475a812bdd414b62758215ce9cb upstream.
    
    In btrfs_make_block_group(), we activate the allocated block group,
    expecting that the block group is soon used for allocation. However, the
    chunk allocation from flush_space() context broke the assumption. There
    can be a large time gap between the chunk allocation time and the extent
    allocation time from the chunk.
    
    Activating the empty block groups pre-allocated from flush_space()
    context can exhaust the active zone counter of a device. Once we use all
    the active zone counts for empty pre-allocated block groups, we cannot
    activate new block group for the other things: metadata, tree-log, or
    data relocation block group.  That failure results in a fake -ENOSPC.
    
    This patch introduces CHUNK_ALLOC_FORCE_FOR_EXTENT to distinguish the
    chunk allocation from find_free_extent(). Now, the new block group is
    activated only in that context.
    
    Fixes: eb66a010d518 ("btrfs: zoned: activate new block group")
    CC: stable@vger.kernel.org # 5.16+
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67feb584016151452f1916a4d48dc41e058d62f3
Author: Toke Høiland-Jørgensen <toke@redhat.com>
Date:   Mon Apr 4 22:48:00 2022 +0200

    ath9k: Fix usage of driver-private space in tx_info
    
    commit 5a6b06f5927c940fa44026695779c30b7536474c upstream.
    
    The ieee80211_tx_info_clear_status() helper also clears the rate counts and
    the driver-private part of struct ieee80211_tx_info, so using it breaks
    quite a few other things. So back out of using it, and instead define a
    ath-internal helper that only clears the area between the
    status_driver_data and the rates info. Combined with moving the
    ath_frame_info struct to status_driver_data, this avoids clearing anything
    we shouldn't be, and so we can keep the existing code for handling the rate
    information.
    
    While fixing this I also noticed that the setting of
    tx_info->status.rates[tx_rateindex].count on hardware underrun errors was
    always immediately overridden by the normal setting of the same fields, so
    rearrange the code so that the underrun detection actually takes effect.
    
    The new helper could be generalised to a 'memset_between()' helper, but
    leave it as a driver-internal helper for now since this needs to go to
    stable.
    
    Cc: stable@vger.kernel.org
    Reported-by: Peter Seiderer <ps.report@gmx.net>
    Fixes: 037250f0a45c ("ath9k: Properly clear TX status area before reporting to mac80211")
    Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Reviewed-by: Peter Seiderer <ps.report@gmx.net>
    Tested-by: Peter Seiderer <ps.report@gmx.net>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20220404204800.2681133-1-toke@toke.dk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d859378d3014a9fcf31f11f9519dacf1ebf8580b
Author: Toke Høiland-Jørgensen <toke@toke.dk>
Date:   Wed Mar 30 18:44:09 2022 +0200

    ath9k: Properly clear TX status area before reporting to mac80211
    
    commit 037250f0a45cf9ecf5b52d4b9ff8eadeb609c800 upstream.
    
    The ath9k driver was not properly clearing the status area in the
    ieee80211_tx_info struct before reporting TX status to mac80211. Instead,
    it was manually filling in fields, which meant that fields introduced later
    were left as-is.
    
    Conveniently, mac80211 actually provides a helper to zero out the status
    area, so use that to make sure we zero everything.
    
    The last commit touching the driver function writing the status information
    seems to have actually been fixing an issue that was also caused by the
    area being uninitialised; but it only added clearing of a single field
    instead of the whole struct. That is now redundant, though, so revert that
    commit and use it as a convenient Fixes tag.
    
    Fixes: cc591d77aba1 ("ath9k: Make sure to zero status.tx_time before reporting TX status")
    Reported-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20220330164409.16645-1-toke@toke.dk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e9759635e9135b3997376c94d8bd708a59d5b781
Author: Bartosz Golaszewski <brgl@bgdev.pl>
Date:   Wed Apr 13 16:01:32 2022 +0200

    gpio: sim: fix setting and getting multiple lines
    
    commit 3836c73e6a2585561af928c6641d74528a8bdfa4 upstream.
    
    We need to take mask into account in the set/get_multiple() callbacks.
    Use bitmap_replace() instead of bitmap_copy().
    
    Fixes: cb8c474e79be ("gpio: sim: new testing module")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8687e78e4523fa80a6b0c45f2ffaec332eb44617
Author: Ronnie Sahlberg <lsahlber@redhat.com>
Date:   Wed Apr 13 10:02:17 2022 +1000

    cifs: verify that tcon is valid before dereference in cifs_kill_sb
    
    commit 8b6c58458ee3206dde345fce327a4cb83e69caf9 upstream.
    
    On umount, cifs_sb->tlink_tree might contain entries that do not represent
    a valid tcon.
    Check the tcon for error before we dereference it.
    
    Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Reported-by: Xiaoli Feng <xifeng@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4b0202961a303537cd74554feeafd4d4b45451c5
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Wed Apr 6 00:28:15 2022 +0200

    gcc-plugins: latent_entropy: use /dev/urandom
    
    commit c40160f2998c897231f8454bf797558d30a20375 upstream.
    
    While the latent entropy plugin mostly doesn't derive entropy from
    get_random_const() for measuring the call graph, when __latent_entropy is
    applied to a constant, then it's initialized statically to output from
    get_random_const(). In that case, this data is derived from a 64-bit
    seed, which means a buffer of 512 bits doesn't really have that amount
    of compile-time entropy.
    
    This patch fixes that shortcoming by just buffering chunks of
    /dev/urandom output and doling it out as requested.
    
    At the same time, it's important that we don't break the use of
    -frandom-seed, for people who want the runtime benefits of the latent
    entropy plugin, while still having compile-time determinism. In that
    case, we detect whether gcc's set_random_seed() has been called by
    making a call to get_random_seed(noinit=true) in the plugin init
    function, which is called after set_random_seed() is called but before
    anything that calls get_random_seed(noinit=false), and seeing if it's
    zero or not. If it's not zero, we're in deterministic mode, and so we
    just generate numbers with a basic xorshift prng.
    
    Note that we don't detect if -frandom-seed is being used using the
    documented local_tick variable, because it's assigned via:
       local_tick = (unsigned) tv.tv_sec * 1000 + tv.tv_usec / 1000;
    which may well overflow and become -1 on its own, and so isn't
    reliable: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105171
    
    [kees: The 256 byte rnd_buf size was chosen based on average (250),
     median (64), and std deviation (575) bytes of used entropy for a
     defconfig x86_64 build]
    
    Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin")
    Cc: stable@vger.kernel.org
    Cc: PaX Team <pageexec@freemail.hu>
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20220405222815.21155-1-Jason@zx2c4.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66b9b707ea4dcafca92b6261c6924652914e3b73
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Mar 3 19:06:32 2022 +0100

    memory: renesas-rpc-if: fix platform-device leak in error path
    
    commit b452dbf24d7d9a990d70118462925f6ee287d135 upstream.
    
    Make sure to free the flash platform device in the event that
    registration fails during probe.
    
    Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
    Cc: stable@vger.kernel.org      # 5.8
    Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20220303180632.3194-1-johan@kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11fab500f86403b2ebf6795feeade6e10302e448
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Fri Apr 1 17:08:21 2022 -0400

    SUNRPC: Fix NFSD's request deferral on RDMA transports
    
    commit 773f91b2cf3f52df0d7508fdbf60f37567cdaee4 upstream.
    
    Trond Myklebust reports an NFSD crash in svc_rdma_sendto(). Further
    investigation shows that the crash occurred while NFSD was handling
    a deferred request.
    
    This patch addresses two inter-related issues that prevent request
    deferral from working correctly for RPC/RDMA requests:
    
    1. Prevent the crash by ensuring that the original
       svc_rqst::rq_xprt_ctxt value is available when the request is
       revisited. Otherwise svc_rdma_sendto() does not have a Receive
       context available with which to construct its reply.
    
    2. Possibly since before commit 71641d99ce03 ("svcrdma: Properly
       compute .len and .buflen for received RPC Calls"),
       svc_rdma_recvfrom() did not include the transport header in the
       returned xdr_buf. There should have been no need for svc_defer()
       and friends to save and restore that header, as of that commit.
       This issue is addressed in a backport-friendly way by simply
       having svc_rdma_recvfrom() set rq_xprt_hlen to zero
       unconditionally, just as svc_tcp_recvfrom() does. This enables
       svc_deferred_recv() to correctly reconstruct an RPC message
       received via RPC/RDMA.
    
    Reported-by: Trond Myklebust <trondmy@hammerspace.com>
    Link: https://lore.kernel.org/linux-nfs/82662b7190f26fb304eb0ab1bb04279072439d4e.camel@hammerspace.com/
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6f27e02111e1bad86617678b3a0cd145eeb29f51
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Mar 31 22:13:59 2022 +0000

    KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded
    
    commit 1d0e84806047f38027d7572adb4702ef7c09b317 upstream.
    
    Resolve nx_huge_pages to true/false when kvm.ko is loaded, leaving it as
    -1 is technically undefined behavior when its value is read out by
    param_get_bool(), as boolean values are supposed to be '0' or '1'.
    
    Alternatively, KVM could define a custom getter for the param, but the
    auto value doesn't depend on the vendor module in any way, and printing
    "auto" would be unnecessarily unfriendly to the user.
    
    In addition to fixing the undefined behavior, resolving the auto value
    also fixes the scenario where the auto value resolves to N and no vendor
    module is loaded.  Previously, -1 would result in Y being printed even
    though KVM would ultimately disable the mitigation.
    
    Rename the existing MMU module init/exit helpers to clarify that they're
    invoked with respect to the vendor module, and add comments to document
    why KVM has two separate "module init" flows.
    
      =========================================================================
      UBSAN: invalid-load in kernel/params.c:320:33
      load of value 255 is not a valid value for type '_Bool'
      CPU: 6 PID: 892 Comm: tail Not tainted 5.17.0-rc3+ #799
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      Call Trace:
       <TASK>
       dump_stack_lvl+0x34/0x44
       ubsan_epilogue+0x5/0x40
       __ubsan_handle_load_invalid_value.cold+0x43/0x48
       param_get_bool.cold+0xf/0x14
       param_attr_show+0x55/0x80
       module_attr_show+0x1c/0x30
       sysfs_kf_seq_show+0x93/0xc0
       seq_read_iter+0x11c/0x450
       new_sync_read+0x11b/0x1a0
       vfs_read+0xf0/0x190
       ksys_read+0x5f/0xe0
       do_syscall_64+0x3b/0xc0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
       </TASK>
      =========================================================================
    
    Fixes: b8e8c8303ff2 ("kvm: mmu: ITLB_MULTIHIT mitigation")
    Cc: stable@vger.kernel.org
    Reported-by: Bruno Goncalves <bgoncalv@redhat.com>
    Reported-by: Jan Stancek <jstancek@redhat.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-Id: <20220331221359.3912754-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ff362d9f4aa921da6af16a98eeb195c178b0158
Author: Andrew Morton <akpm@linux-foundation.org>
Date:   Thu Apr 14 19:13:58 2022 -0700

    revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE"
    
    commit aeb7923733d100b86c6bc68e7ae32913b0cec9d8 upstream.
    
    Despite Mike's attempted fix (925346c129da117122), regressions reports
    continue:
    
      https://lore.kernel.org/lkml/cb5b81bd-9882-e5dc-cd22-54bdbaaefbbc@leemhuis.info/
      https://bugzilla.kernel.org/show_bug.cgi?id=215720
      https://lkml.kernel.org/r/b685f3d0-da34-531d-1aa9-479accd3e21b@leemhuis.info
    
    So revert this patch.
    
    Fixes: 9630f0d60fec ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE")
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Chris Kennelly <ckennelly@google.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Fangrui Song <maskray@google.com>
    Cc: H.J. Lu <hjl.tools@gmail.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Sandeep Patil <sspatil@google.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Thorsten Leemhuis <regressions@leemhuis.info>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a562be7b516d9c23c975d55464506eec3c96704b
Author: Andrew Morton <akpm@linux-foundation.org>
Date:   Thu Apr 14 19:13:55 2022 -0700

    revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders"
    
    commit 354e923df042a11d1ab8ca06b3ebfab3a018a4ec upstream.
    
    Commit 925346c129da11 ("fs/binfmt_elf: fix PT_LOAD p_align values for
    loaders") was an attempt to fix regressions due to 9630f0d60fec5f
    ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE").
    
    But regressionss continue to be reported:
    
      https://lore.kernel.org/lkml/cb5b81bd-9882-e5dc-cd22-54bdbaaefbbc@leemhuis.info/
      https://bugzilla.kernel.org/show_bug.cgi?id=215720
      https://lkml.kernel.org/r/b685f3d0-da34-531d-1aa9-479accd3e21b@leemhuis.info
    
    This patch reverts the fix, so the original can also be reverted.
    
    Fixes: 925346c129da11 ("fs/binfmt_elf: fix PT_LOAD p_align values for loaders")
    Cc: H.J. Lu <hjl.tools@gmail.com>
    Cc: Chris Kennelly <ckennelly@google.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Sandeep Patil <sspatil@google.com>
    Cc: Fangrui Song <maskray@google.com>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thorsten Leemhuis <regressions@leemhuis.info>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dff230c87421a1f3623a765ffa63a38282852225
Author: Mike Kravetz <mike.kravetz@oracle.com>
Date:   Thu Apr 14 19:13:52 2022 -0700

    hugetlb: do not demote poisoned hugetlb pages
    
    commit 5a317412ef884763fdf7aa17f9f3636959d11d8f upstream.
    
    It is possible for poisoned hugetlb pages to reside on the free lists.
    The huge page allocation routines which dequeue entries from the free
    lists make a point of avoiding poisoned pages.  There is no such check
    and avoidance in the demote code path.
    
    If a hugetlb page on the is on a free list, poison will only be set in
    the head page rather then the page with the actual error.  If such a
    page is demoted, then the poison flag may follow the wrong page.  A page
    without error could have poison set, and a page with poison could not
    have the flag set.
    
    Check for poison before attempting to demote a hugetlb page.  Also,
    return -EBUSY to the caller if only poisoned pages are on the free list.
    
    Link: https://lkml.kernel.org/r/20220307215707.50916-1-mike.kravetz@oracle.com
    Fixes: 8531fc6f52f5 ("hugetlb: add hugetlb demote page support")
    Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d2e07c04c7f7d83c75c56da3e2f970c5653ade0
Author: Patrick Wang <patrick.wang.shcn@gmail.com>
Date:   Thu Apr 14 19:14:04 2022 -0700

    mm: kmemleak: take a full lowmem check in kmemleak_*_phys()
    
    commit 23c2d497de21f25898fbea70aeb292ab8acc8c94 upstream.
    
    The kmemleak_*_phys() apis do not check the address for lowmem's min
    boundary, while the caller may pass an address below lowmem, which will
    trigger an oops:
    
      # echo scan > /sys/kernel/debug/kmemleak
      Unable to handle kernel paging request at virtual address ff5fffffffe00000
      Oops [#1]
      Modules linked in:
      CPU: 2 PID: 134 Comm: bash Not tainted 5.18.0-rc1-next-20220407 #33
      Hardware name: riscv-virtio,qemu (DT)
      epc : scan_block+0x74/0x15c
       ra : scan_block+0x72/0x15c
      epc : ffffffff801e5806 ra : ffffffff801e5804 sp : ff200000104abc30
       gp : ffffffff815cd4e8 tp : ff60000004cfa340 t0 : 0000000000000200
       t1 : 00aaaaaac23954cc t2 : 00000000000003ff s0 : ff200000104abc90
       s1 : ffffffff81b0ff28 a0 : 0000000000000000 a1 : ff5fffffffe01000
       a2 : ffffffff81b0ff28 a3 : 0000000000000002 a4 : 0000000000000001
       a5 : 0000000000000000 a6 : ff200000104abd7c a7 : 0000000000000005
       s2 : ff5fffffffe00ff9 s3 : ffffffff815cd998 s4 : ffffffff815d0e90
       s5 : ffffffff81b0ff28 s6 : 0000000000000020 s7 : ffffffff815d0eb0
       s8 : ffffffffffffffff s9 : ff5fffffffe00000 s10: ff5fffffffe01000
       s11: 0000000000000022 t3 : 00ffffffaa17db4c t4 : 000000000000000f
       t5 : 0000000000000001 t6 : 0000000000000000
      status: 0000000000000100 badaddr: ff5fffffffe00000 cause: 000000000000000d
        scan_gray_list+0x12e/0x1a6
        kmemleak_scan+0x2aa/0x57e
        kmemleak_write+0x32a/0x40c
        full_proxy_write+0x56/0x82
        vfs_write+0xa6/0x2a6
        ksys_write+0x6c/0xe2
        sys_write+0x22/0x2a
        ret_from_syscall+0x0/0x2
    
    The callers may not quite know the actual address they pass(e.g. from
    devicetree).  So the kmemleak_*_phys() apis should guarantee the address
    they finally use is in lowmem range, so check the address for lowmem's
    min boundary.
    
    Link: https://lkml.kernel.org/r/20220413122925.33856-1-patrick.wang.shcn@gmail.com
    Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afac4b88699a06c8b9369f9d759a1ec3c254b788
Author: Minchan Kim <minchan@kernel.org>
Date:   Thu Apr 14 19:13:46 2022 -0700

    mm: fix unexpected zeroed page mapping with zram swap
    
    commit e914d8f00391520ecc4495dd0ca0124538ab7119 upstream.
    
    Two processes under CLONE_VM cloning, user process can be corrupted by
    seeing zeroed page unexpectedly.
    
          CPU A                        CPU B
    
      do_swap_page                do_swap_page
      SWP_SYNCHRONOUS_IO path     SWP_SYNCHRONOUS_IO path
      swap_readpage valid data
        swap_slot_free_notify
          delete zram entry
                                  swap_readpage zeroed(invalid) data
                                  pte_lock
                                  map the *zero data* to userspace
                                  pte_unlock
      pte_lock
      if (!pte_same)
        goto out_nomap;
      pte_unlock
      return and next refault will
      read zeroed data
    
    The swap_slot_free_notify is bogus for CLONE_VM case since it doesn't
    increase the refcount of swap slot at copy_mm so it couldn't catch up
    whether it's safe or not to discard data from backing device.  In the
    case, only the lock it could rely on to synchronize swap slot freeing is
    page table lock.  Thus, this patch gets rid of the swap_slot_free_notify
    function.  With this patch, CPU A will see correct data.
    
          CPU A                        CPU B
    
      do_swap_page                do_swap_page
      SWP_SYNCHRONOUS_IO path     SWP_SYNCHRONOUS_IO path
                                  swap_readpage original data
                                  pte_lock
                                  map the original data
                                  swap_free
                                    swap_range_free
                                      bd_disk->fops->swap_slot_free_notify
      swap_readpage read zeroed data
                                  pte_unlock
      pte_lock
      if (!pte_same)
        goto out_nomap;
      pte_unlock
      return
      on next refault will see mapped data by CPU B
    
    The concern of the patch would increase memory consumption since it
    could keep wasted memory with compressed form in zram as well as
    uncompressed form in address space.  However, most of cases of zram uses
    no readahead and do_swap_page is followed by swap_free so it will free
    the compressed form from in zram quickly.
    
    Link: https://lkml.kernel.org/r/YjTVVxIAsnKAXjTd@google.com
    Fixes: 0bcac06f27d7 ("mm, swap: skip swapcache for swapin of synchronous device")
    Reported-by: Ivan Babrou <ivan@cloudflare.com>
    Tested-by: Ivan Babrou <ivan@cloudflare.com>
    Signed-off-by: Minchan Kim <minchan@kernel.org>
    Cc: Nitin Gupta <ngupta@vflare.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: <stable@vger.kernel.org>    [4.14+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 41df4d481297e0fc6afc47f4ac73455a2b9471bc
Author: Juergen Gross <jgross@suse.com>
Date:   Thu Apr 14 19:13:43 2022 -0700

    mm, page_alloc: fix build_zonerefs_node()
    
    commit e553f62f10d93551eb883eca227ac54d1a4fad84 upstream.
    
    Since commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from
    zones with pages managed by the buddy allocator") only zones with free
    memory are included in a built zonelist.  This is problematic when e.g.
    all memory of a zone has been ballooned out when zonelists are being
    rebuilt.
    
    The decision whether to rebuild the zonelists when onlining new memory
    is done based on populated_zone() returning 0 for the zone the memory
    will be added to.  The new zone is added to the zonelists only, if it
    has free memory pages (managed_zone() returns a non-zero value) after
    the memory has been onlined.  This implies, that onlining memory will
    always free the added pages to the allocator immediately, but this is
    not true in all cases: when e.g. running as a Xen guest the onlined new
    memory will be added only to the ballooned memory list, it will be freed
    only when the guest is being ballooned up afterwards.
    
    Another problem with using managed_zone() for the decision whether a
    zone is being added to the zonelists is, that a zone with all memory
    used will in fact be removed from all zonelists in case the zonelists
    happen to be rebuilt.
    
    Use populated_zone() when building a zonelist as it has been done before
    that commit.
    
    There was a report that QubesOS (based on Xen) is hitting this problem.
    Xen has switched to use the zone device functionality in kernel 5.9 and
    QubesOS wants to use memory hotplugging for guests in order to be able
    to start a guest with minimal memory and expand it as needed.  This was
    the report leading to the patch.
    
    Link: https://lkml.kernel.org/r/20220407120637.9035-1-jgross@suse.com
    Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d3b877daf805fed29be8f61aa3d0ea37df82c7b
Author: Axel Rasmussen <axelrasmussen@google.com>
Date:   Thu Apr 14 19:13:31 2022 -0700

    mm/secretmem: fix panic when growing a memfd_secret
    
    commit f9b141f93659e09a52e28791ccbaf69c273b8e92 upstream.
    
    When one tries to grow an existing memfd_secret with ftruncate, one gets
    a panic [1].  For example, doing the following reliably induces the
    panic:
    
        fd = memfd_secret();
    
        ftruncate(fd, 10);
        ptr = mmap(NULL, 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
        strcpy(ptr, "123456789");
    
        munmap(ptr, 10);
        ftruncate(fd, 20);
    
    The basic reason for this is, when we grow with ftruncate, we call down
    into simple_setattr, and then truncate_inode_pages_range, and eventually
    we try to zero part of the memory.  The normal truncation code does this
    via the direct map (i.e., it calls page_address() and hands that to
    memset()).
    
    For memfd_secret though, we specifically don't map our pages via the
    direct map (i.e.  we call set_direct_map_invalid_noflush() on every
    fault).  So the address returned by page_address() isn't useful, and
    when we try to memset() with it we panic.
    
    This patch avoids the panic by implementing a custom setattr for
    memfd_secret, which detects resizes specifically (setting the size for
    the first time works just fine, since there are no existing pages to try
    to zero), and rejects them with EINVAL.
    
    One could argue growing should be supported, but I think that will
    require a significantly more lengthy change.  So, I propose a minimal
    fix for the benefit of stable kernels, and then perhaps to extend
    memfd_secret to support growing in a separate patch.
    
    [1]:
    
      BUG: unable to handle page fault for address: ffffa0a889277028
      #PF: supervisor write access in kernel mode
      #PF: error_code(0x0002) - not-present page
      PGD afa01067 P4D afa01067 PUD 83f909067 PMD 83f8bf067 PTE 800ffffef6d88060
      Oops: 0002 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
      CPU: 0 PID: 281 Comm: repro Not tainted 5.17.0-dbg-DEV #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:memset_erms+0x9/0x10
      Code: c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 <f3> aa 4c 89 c8 c3 90 49 89 fa 40 0f b6 ce 48 b8 01 01 01 01 01 01
      RSP: 0018:ffffb932c09afbf0 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffffda63c4249dc0 RCX: 0000000000000fd8
      RDX: 0000000000000fd8 RSI: 0000000000000000 RDI: ffffa0a889277028
      RBP: ffffb932c09afc00 R08: 0000000000001000 R09: ffffa0a889277028
      R10: 0000000000020023 R11: 0000000000000000 R12: ffffda63c4249dc0
      R13: ffffa0a890d70d98 R14: 0000000000000028 R15: 0000000000000fd8
      FS:  00007f7294899580(0000) GS:ffffa0af9bc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffa0a889277028 CR3: 0000000107ef6006 CR4: 0000000000370ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       ? zero_user_segments+0x82/0x190
       truncate_inode_partial_folio+0xd4/0x2a0
       truncate_inode_pages_range+0x380/0x830
       truncate_setsize+0x63/0x80
       simple_setattr+0x37/0x60
       notify_change+0x3d8/0x4d0
       do_sys_ftruncate+0x162/0x1d0
       __x64_sys_ftruncate+0x1c/0x20
       do_syscall_64+0x44/0xa0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      Modules linked in: xhci_pci xhci_hcd virtio_net net_failover failover virtio_blk virtio_balloon uhci_hcd ohci_pci ohci_hcd evdev ehci_pci ehci_hcd 9pnet_virtio 9p netfs 9pnet
      CR2: ffffa0a889277028
    
    [lkp@intel.com: secretmem_iops can be static]
      Signed-off-by: kernel test robot <lkp@intel.com>
    [axelrasmussen@google.com: return EINVAL]
    
    Link: https://lkml.kernel.org/r/20220324210909.1843814-1-axelrasmussen@google.com
    Link: https://lkml.kernel.org/r/20220412193023.279320-1-axelrasmussen@google.com
    Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Cc: kernel test robot <lkp@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98d05f6a811bfbc28a0b6c132eb6059a00e53ef4
Author: Borislav Petkov <bp@suse.de>
Date:   Tue Apr 5 17:15:15 2022 +0200

    perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
    
    [ Upstream commit d02b4dd84e1a90f7f1444d027c0289bf355b0d5a ]
    
    Fix:
    
      In file included from <command-line>:0:0:
      In function ‘ddr_perf_counter_enable’,
          inlined from ‘ddr_perf_irq_handler’ at drivers/perf/fsl_imx8_ddr_perf.c:651:2:
      ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_729’ \
            declared with attribute error: FIELD_PREP: mask is not constant
        _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
    ...
    
    See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
    details as to why it triggers with older gccs only.
    
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: Frank Li <Frank.li@nxp.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Shawn Guo <shawnguo@kernel.org>
    Cc: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
    Cc: Fabio Estevam <festevam@gmail.com>
    Cc: NXP Linux Team <linux-imx@nxp.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Acked-by: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20220405151517.29753-10-bp@alien8.de
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 910582d20da31a3321e15f6ff8b0b9583ce0e45e
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Apr 7 14:05:05 2022 +0100

    io_uring: use nospec annotation for more indexes
    
    [ Upstream commit 4cdd158be9d09223737df83136a1fb65269d809a ]
    
    There are still several places that using pre array_index_nospec()
    indexes, fix them up.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b01ef5ee83f72ed35ad525912370b729f5d145f4.1649336342.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8568514a7abd90b7090dbecf2ac335a5c5877b90
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Apr 7 14:05:04 2022 +0100

    io_uring: zero tag on rsrc removal
    
    [ Upstream commit 8f0a24801bb44aa58496945aabb904c729176772 ]
    
    Automatically default rsrc tag in io_queue_rsrc_removal(), it's safer
    than leaving it there and relying on the rest of the code to behave and
    not use it.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/1cf262a50df17478ea25b22494dcc19f3a80301f.1649336342.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 440c44c3d6d58db7bb1ae36760b77672d6dde891
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon Mar 28 13:13:41 2022 +0200

    x86,bpf: Avoid IBT objtool warning
    
    [ Upstream commit be8a096521ca1a252bf078b347f96ce94582612e ]
    
    Clang can inline emit_indirect_jump() and then folds constants, which
    results in:
    
      | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x6a4: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40
      | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x67d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40
      | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x386: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20
      | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x35d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20
    
    Suppress the optimization such that it must emit a code reference to
    the __x86_indirect_thunk_array[] base.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lkml.kernel.org/r/20220405075531.GB30877@worktop.programming.kicks-ass.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b39fdc7a0d87f7f5d287dce1ae297a329775a1a3
Author: Duoming Zhou <duoming@zju.edu.cn>
Date:   Tue Apr 5 21:22:06 2022 +0800

    drivers: net: slip: fix NPD bug in sl_tx_timeout()
    
    [ Upstream commit ec4eb8a86ade4d22633e1da2a7d85a846b7d1798 ]
    
    When a slip driver is detaching, the slip_close() will act to
    cleanup necessary resources and sl->tty is set to NULL in
    slip_close(). Meanwhile, the packet we transmit is blocked,
    sl_tx_timeout() will be called. Although slip_close() and
    sl_tx_timeout() use sl->lock to synchronize, we don`t judge
    whether sl->tty equals to NULL in sl_tx_timeout() and the
    null pointer dereference bug will happen.
    
       (Thread 1)                 |      (Thread 2)
                                  | slip_close()
                                  |   spin_lock_bh(&sl->lock)
                                  |   ...
    ...                           |   sl->tty = NULL //(1)
    sl_tx_timeout()               |   spin_unlock_bh(&sl->lock)
      spin_lock(&sl->lock);       |
      ...                         |   ...
      tty_chars_in_buffer(sl->tty)|
        if (tty->ops->..) //(2)   |
        ...                       |   synchronize_rcu()
    
    We set NULL to sl->tty in position (1) and dereference sl->tty
    in position (2).
    
    This patch adds check in sl_tx_timeout(). If sl->tty equals to
    NULL, sl_tx_timeout() will goto out.
    
    Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
    Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20220405132206.55291-1-duoming@zju.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d50177b0f5970a4e24100c87a51d27bd345b708b
Author: Chandrakanth patil <chandrakanth.patil@broadcom.com>
Date:   Thu Mar 24 02:47:11 2022 -0700

    scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan
    
    [ Upstream commit 56495f295d8e021f77d065b890fc0100e3f9f6d8 ]
    
    The megaraid_sas driver supports single LUN for RAID devices. That is LUN
    0. All other LUNs are unsupported. When a device scan on a logical target
    with invalid LUN number is invoked through sysfs, that target ends up
    getting removed.
    
    Add LUN ID validation in the slave destroy function to avoid the target
    deletion.
    
    Link: https://lore.kernel.org/r/20220324094711.48833-1-chandrakanth.patil@broadcom.com
    Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1fa24edcfda68e2258a6dc7046e848fe029dee5e
Author: Alexey Galakhov <agalakhov@gmail.com>
Date:   Wed Mar 9 22:25:35 2022 +0100

    scsi: mvsas: Add PCI ID of RocketRaid 2640
    
    [ Upstream commit 5f2bce1e222028dc1c15f130109a17aa654ae6e8 ]
    
    The HighPoint RocketRaid 2640 is a low-cost SAS controller based on Marvell
    chip. The chip in question was already supported by the kernel, just the
    PCI ID of this particular board was missing.
    
    Link: https://lore.kernel.org/r/20220309212535.402987-1-agalakhov@gmail.com
    Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5bd34f8ed670212704af6fe4a2f2579004e929de
Author: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Date:   Tue Apr 5 17:36:37 2022 +0530

    scsi: mpt3sas: Fail reset operation if config request timed out
    
    [ Upstream commit f61eb1216c959f93ffabd3b8781fa5b2b22f8907 ]
    
    As part of controller reset operation the driver issues a config request
    command. If this command gets times out, then fail the controller reset
    operation instead of retrying it.
    
    Link: https://lore.kernel.org/r/20220405120637.20528-1-sreekanth.reddy@broadcom.com
    Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f8f4dbc1395f356d639b179f7d7a0facdd689ab5
Author: Christoph Böhmwalder <christoph@boehmwalder.at>
Date:   Wed Apr 6 21:04:45 2022 +0200

    drbd: set QUEUE_FLAG_STABLE_WRITES
    
    [ Upstream commit 286901941fd18a52b2138fddbbf589ad3639eb00 ]
    
    We want our pages not to change while they are being written.
    
    Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2983416458b2e09f7246e8e55df78ccf5968693b
Author: Roman Li <Roman.Li@amd.com>
Date:   Thu Mar 17 19:55:05 2022 -0400

    drm/amd/display: Fix allocate_mst_payload assert on resume
    
    [ Upstream commit f4346fb3edf7720db3f7f5e1cab1f667cd024280 ]
    
    [Why]
    On resume we do link detection for all non-MST connectors.
    MST is handled separately. However the condition for telling
    if connector is on mst branch is not enough for mst hub case.
    Link detection for mst branch link leads to mst topology reset.
    That causes assert in dc_link_allocate_mst_payload()
    
    [How]
    Use link type as indicator for mst link.
    
    Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Roman Li <Roman.Li@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9ab9ae0330583153ef795ceb24f524eaefe76b56
Author: Martin Leung <Martin.Leung@amd.com>
Date:   Fri Mar 18 11:12:36 2022 -0400

    drm/amd/display: Revert FEC check in validation
    
    [ Upstream commit b2075fce104b88b789c15ef1ed2b91dc94198e26 ]
    
    why and how:
    causes failure on install on certain machines
    
    Reviewed-by: George Shen <George.Shen@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Martin Leung <Martin.Leung@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0c89008a246804e5d124023804e5866990a17949
Author: Roman Li <Roman.Li@amd.com>
Date:   Tue Mar 15 16:31:14 2022 -0400

    drm/amd/display: Enable power gating before init_pipes
    
    [ Upstream commit 58e16c752e9540b28a873c44c3bee83e022007c1 ]
    
    [Why]
    In init_hw() we call init_pipes() before enabling power gating.
    init_pipes() tries to power gate dsc but it may fail because
    required force-ons are not released yet.
    As a result with dsc config the following errors observed on resume:
    "REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control"
    "REG_WAIT timeout 1us * 1000 tries - dcn20_dpp_pg_control"
    "REG_WAIT timeout 1us * 1000 tries - dcn20_hubp_pg_control"
    
    [How]
    Move enable_power_gating_plane() before init_pipes() in init_hw()
    
    Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
    Reviewed-by: Eric Yang <Eric.Yang2@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Roman Li <Roman.Li@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eee25b1d04a9eb376b88f09222a368f6e9cf1667
Author: Chris Park <Chris.Park@amd.com>
Date:   Tue Mar 15 12:21:43 2022 -0400

    drm/amd/display: Correct Slice reset calculation
    
    [ Upstream commit 862a876c3a6372f2fa9d0c6510f1976ac94fc857 ]
    
    [Why]
    Once DSC slice cannot fit pixel clock, we incorrectly
    reset min slices to 0 and allow max slice to operate,
    even when max slice itself cannot fit the pixel clock
    properly.
    
    [How]
    Change the sequence such that we correctly determine
    DSC is not possible when both min slices and max
    slices cannot fit pixel clock per slice.
    
    Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Chris Park <Chris.Park@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f3d8b6f4bc6160ab279573c4567ef7e9dd513c10
Author: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Date:   Thu Mar 31 13:08:19 2022 +0200

    spi: cadence-quadspi: fix protocol setup for non-1-1-X operations
    
    [ Upstream commit 97e4827d775faa9a32b5e1a97959c69dd77d17a3 ]
    
    cqspi_set_protocol() only set the data width, but ignored the command
    and address width (except for 8-8-8 DTR ops), leading to corruption of
    all transfers using 1-X-X or X-X-X ops. Fix by setting the other two
    widths as well.
    
    While we're at it, simplify the code a bit by replacing the
    CQSPI_INST_TYPE_* constants with ilog2().
    
    Tested on a TI AM64x with a Macronix MX25U51245G QSPI flash with 1-4-4
    read and write operations.
    
    Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
    Link: https://lore.kernel.org/r/20220331110819.133392-1-matthias.schiffer@ew.tq-group.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8b16a3f61115a0c9c9e1a225636175bfda772038
Author: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Date:   Wed Apr 6 11:55:56 2022 +0800

    myri10ge: fix an incorrect free for skb in myri10ge_sw_tso
    
    [ Upstream commit b423e54ba965b4469b48e46fd16941f1e1701697 ]
    
    All remaining skbs should be released when myri10ge_xmit fails to
    transmit a packet. Fix it within another skb_list_walk_safe.
    
    Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36311fe98f55dea9200c69e2dd6d6ddb8fc94080
Author: Marcin Kozlowski <marcinguy@gmail.com>
Date:   Wed Apr 6 10:05:37 2022 +0200

    net: usb: aqc111: Fix out-of-bounds accesses in RX fixup
    
    [ Upstream commit afb8e246527536848b9b4025b40e613edf776a9d ]
    
    aqc111_rx_fixup() contains several out-of-bounds accesses that can be
    triggered by a malicious (or defective) USB device, in particular:
    
     - The metadata array (desc_offset..desc_offset+2*pkt_count) can be out of bounds,
       causing OOB reads and (on big-endian systems) OOB endianness flips.
     - A packet can overlap the metadata array, causing a later OOB
       endianness flip to corrupt data used by a cloned SKB that has already
       been handed off into the network stack.
     - A packet SKB can be constructed whose tail is far beyond its end,
       causing out-of-bounds heap data to be considered part of the SKB's
       data.
    
    Found doing variant analysis. Tested it with another driver (ax88179_178a), since
    I don't have a aqc111 device to test it, but the code looks very similar.
    
    Signed-off-by: Marcin Kozlowski <marcinguy@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eb35da973c2c92f2d0de10b595f1690895fe33f3
Author: Boqun Feng <boqun.feng@gmail.com>
Date:   Fri Mar 25 10:32:12 2022 +0800

    Drivers: hv: balloon: Disable balloon and hot-add accordingly
    
    [ Upstream commit be5802795cf8d0b881745fa9ba7790293b382280 ]
    
    Currently there are known potential issues for balloon and hot-add on
    ARM64:
    
    *       Unballoon requests from Hyper-V should only unballoon ranges
            that are guest page size aligned, otherwise guests cannot handle
            because it's impossible to partially free a page. This is a
            problem when guest page size > 4096 bytes.
    
    *       Memory hot-add requests from Hyper-V should provide the NUMA
            node id of the added ranges or ARM64 should have a functional
            memory_add_physaddr_to_nid(), otherwise the node id is missing
            for add_memory().
    
    These issues require discussions on design and implementation. In the
    meanwhile, post_status() is working and essential to guest monitoring.
    Therefore instead of disabling the entire hv_balloon driver, the
    ballooning (when page size > 4096 bytes) and hot-add are disabled
    accordingly for now. Once the issues are fixed, they can be re-enable in
    these cases.
    
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Reviewed-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/20220325023212.1570049-3-boqun.feng@gmail.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7c7df0190d2300781b467befa99d95d69cf0641b
Author: Andy Chiu <andy.chiu@sifive.com>
Date:   Tue Apr 5 17:19:26 2022 +0800

    net: axienet: setup mdio unconditionally
    
    [ Upstream commit d1c4f93e3f0a023024a6f022a61528c06cf1daa9 ]
    
    The call to axienet_mdio_setup should not depend on whether "phy-node"
    pressents on the DT. Besides, since `lp->phy_node` is used if PHY is in
    SGMII or 100Base-X modes, move it into the if statement. And the next patch
    will remove `lp->phy_node` from driver's private structure and do an
    of_node_put on it right away after use since it is not used elsewhere.
    
    Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
    Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
    Reviewed-by: Robert Hancock <robert.hancock@calian.com>
    Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 28191f4bea3bb72942dbc5b6f828ebdcd2cbc537
Author: Steve Capper <steve.capper@arm.com>
Date:   Wed Mar 30 12:25:43 2022 +0100

    tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry
    
    [ Upstream commit 697a1d44af8ba0477ee729e632f4ade37999249a ]
    
    tlb_remove_huge_tlb_entry only considers PMD_SIZE and PUD_SIZE when
    updating the mmu_gather structure.
    
    Unfortunately on arm64 there are two additional huge page sizes that
    need to be covered: CONT_PTE_SIZE and CONT_PMD_SIZE. Where an end-user
    attempts to employ contiguous huge pages, a VM_BUG_ON can be experienced
    due to the fact that the tlb structure hasn't been correctly updated by
    the relevant tlb_flush_p.._range() call from tlb_remove_huge_tlb_entry.
    
    This patch adds inequality logic to the generic implementation of
    tlb_remove_huge_tlb_entry s.t. CONT_PTE_SIZE and CONT_PMD_SIZE are
    effectively covered on arm64. Also, as well as ptes, pmds and puds;
    p4ds are now considered too.
    
    Reported-by: David Hildenbrand <david@redhat.com>
    Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/linux-mm/811c5c8e-b3a2-85d2-049c-717f17c3a03a@redhat.com/
    Signed-off-by: Steve Capper <steve.capper@arm.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20220330112543.863-1-steve.capper@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1f1b58ebad6bb16c99ff46a54aa963d32e306c60
Author: Joey Gouly <joey.gouly@arm.com>
Date:   Tue Apr 5 11:47:33 2022 +0100

    arm64: alternatives: mark patch_alternative() as `noinstr`
    
    [ Upstream commit a2c0b0fbe01419f8f5d1c0b9c581631f34ffce8b ]
    
    The alternatives code must be `noinstr` such that it does not patch itself,
    as the cache invalidation is only performed after all the alternatives have
    been applied.
    
    Mark patch_alternative() as `noinstr`. Mark branch_insn_requires_update()
    and get_alt_insn() with `__always_inline` since they are both only called
    through patch_alternative().
    
    Booting a kernel in QEMU TCG with KCSAN=y and ARM64_USE_LSE_ATOMICS=y caused
    a boot hang:
    [    0.241121] CPU: All CPU(s) started at EL2
    
    The alternatives code was patching the atomics in __tsan_read4() from LL/SC
    atomics to LSE atomics.
    
    The following fragment is using LL/SC atomics in the .text section:
      | <__tsan_unaligned_read4+304>:     ldxr    x6, [x2]
      | <__tsan_unaligned_read4+308>:     add     x6, x6, x5
      | <__tsan_unaligned_read4+312>:     stxr    w7, x6, [x2]
      | <__tsan_unaligned_read4+316>:     cbnz    w7, <__tsan_unaligned_read4+304>
    
    This LL/SC atomic sequence was to be replaced with LSE atomics. However since
    the alternatives code was instrumentable, __tsan_read4() was being called after
    only the first instruction was replaced, which led to the following code in memory:
      | <__tsan_unaligned_read4+304>:     ldadd   x5, x6, [x2]
      | <__tsan_unaligned_read4+308>:     add     x6, x6, x5
      | <__tsan_unaligned_read4+312>:     stxr    w7, x6, [x2]
      | <__tsan_unaligned_read4+316>:     cbnz    w7, <__tsan_unaligned_read4+304>
    
    This caused an infinite loop as the `stxr` instruction never completed successfully,
    so `w7` was always 0.
    
    Signed-off-by: Joey Gouly <joey.gouly@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20220405104733.11476-1-joey.gouly@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1a28e70f3bcab83b311a6e7f9680b23c7f408127
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Mon Mar 14 11:27:35 2022 +0100

    static_call: Properly initialise DEFINE_STATIC_CALL_RET0()
    
    [ Upstream commit 5517d500829c683a358a8de04ecb2e28af629ae5 ]
    
    When a static call is updated with __static_call_return0() as target,
    arch_static_call_transform() set it to use an optimised set of
    instructions which are meant to lay in the same cacheline.
    
    But when initialising a static call with DEFINE_STATIC_CALL_RET0(),
    we get a branch to the real __static_call_return0() function instead
    of getting the optimised setup:
    
            c00d8120 <__SCT__perf_snapshot_branch_stack>:
            c00d8120:       4b ff ff f4     b       c00d8114 <__static_call_return0>
            c00d8124:       3d 80 c0 0e     lis     r12,-16370
            c00d8128:       81 8c 81 3c     lwz     r12,-32452(r12)
            c00d812c:       7d 89 03 a6     mtctr   r12
            c00d8130:       4e 80 04 20     bctr
            c00d8134:       38 60 00 00     li      r3,0
            c00d8138:       4e 80 00 20     blr
            c00d813c:       00 00 00 00     .long 0x0
    
    Add ARCH_DEFINE_STATIC_CALL_RET0_TRAMP() defined by each architecture
    to setup the optimised configuration, and rework
    DEFINE_STATIC_CALL_RET0() to call it:
    
            c00d8120 <__SCT__perf_snapshot_branch_stack>:
            c00d8120:       48 00 00 14     b       c00d8134 <__SCT__perf_snapshot_branch_stack+0x14>
            c00d8124:       3d 80 c0 0e     lis     r12,-16370
            c00d8128:       81 8c 81 3c     lwz     r12,-32452(r12)
            c00d812c:       7d 89 03 a6     mtctr   r12
            c00d8130:       4e 80 04 20     bctr
            c00d8134:       38 60 00 00     li      r3,0
            c00d8138:       4e 80 00 20     blr
            c00d813c:       00 00 00 00     .long 0x0
    
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Link: https://lore.kernel.org/r/1e0a61a88f52a460f62a58ffc2a5f847d1f7d9d8.1647253456.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c822a102ab5916a6b51b80ea4edb93dbb57d800b
Author: Jonathan Bakker <xc-racer2@live.ca>
Date:   Sun Mar 27 18:01:54 2022 -0700

    regulator: wm8994: Add an off-on delay for WM8994 variant
    
    [ Upstream commit 92d96b603738ec4f35cde7198c303ae264dd47cb ]
    
    As per Table 130 of the wm8994 datasheet at [1], there is an off-on
    delay for LDO1 and LDO2.  In the wm8958 datasheet [2], I could not
    find any reference to it.  I could not find a wm1811 datasheet to
    double-check there, but as no one has complained presumably it works
    without it.
    
    This solves the issue on Samsung Aries boards with a wm8994 where
    register writes fail when the device is powered off and back-on
    quickly.
    
    [1] https://statics.cirrus.com/pubs/proDatasheet/WM8994_Rev4.6.pdf
    [2] https://statics.cirrus.com/pubs/proDatasheet/WM8958_v3.5.pdf
    
    Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
    Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/CY4PR04MB056771CFB80DC447C30D5A31CB1D9@CY4PR04MB0567.namprd04.prod.outlook.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1ad64a6f7415b685f6fda19c0d1d2f0ffa4f162b
Author: Leo Ruan <tingquan.ruan@cn.bosch.com>
Date:   Mon Feb 7 16:14:11 2022 +0100

    gpu: ipu-v3: Fix dev_dbg frequency output
    
    [ Upstream commit 070a88fd4a03f921b73a2059e97d55faaa447dab ]
    
    This commit corrects the printing of the IPU clock error percentage if
    it is between -0.1% to -0.9%. For example, if the pixel clock requested
    is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%.
    But the fixed point math had a flaw and calculated error of 0.2%.
    
    Before:
      Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz
      IPU clock can give 27000000 with divider 10, error 0.2%
      Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
    
    After:
      Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz
      IPU clock can give 27000000 with divider 10, error -0.8%
      Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
    
    Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
    Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
    Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
    Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
    Link: https://lore.kernel.org/r/20220207151411.5009-1-mark.jonas@de.bosch.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 780f1e72f3b900c82bc23a3d6b1445bc86b2a1a8
Author: Christian Lamparter <chunkeey@gmail.com>
Date:   Sat Mar 19 21:11:03 2022 +0100

    ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs
    
    [ Upstream commit 5399752299396a3c9df6617f4b3c907d7aa4ded8 ]
    
    Samsung' 840 EVO with the latest firmware (EXT0DB6Q) locks up with
    the a message: "READ LOG DMA EXT failed, trying PIO" during boot.
    
    Initially this was discovered because it caused a crash
    with the sata_dwc_460ex controller on a WD MyBook Live DUO.
    
    The reporter "Tice Rex" which has the unique opportunity that he
    has two Samsung 840 EVO SSD! One with the older firmware "EXT0BB0Q"
    which booted fine and didn't expose "READ LOG DMA EXT". But the
    newer/latest firmware "EXT0DB6Q" caused the headaches.
    
    BugLink: https://github.com/openwrt/openwrt/issues/9505
    Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
    Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c24811a386ad385f1aa8d2282ae945a0f812f719
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Thu Mar 31 22:42:44 2022 -0700

    net: micrel: fix KS8851_MLL Kconfig
    
    [ Upstream commit c3efcedd272aa6dd5929e20cf902a52ddaa1197a ]
    
    KS8851_MLL selects MICREL_PHY, which depends on PTP_1588_CLOCK_OPTIONAL,
    so make KS8851_MLL also depend on PTP_1588_CLOCK_OPTIONAL since
    'select' does not follow any dependency chains.
    
    Fixes kconfig warning and build errors:
    
    WARNING: unmet direct dependencies detected for MICREL_PHY
      Depends on [m]: NETDEVICES [=y] && PHYLIB [=y] && PTP_1588_CLOCK_OPTIONAL [=m]
      Selected by [y]:
      - KS8851_MLL [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_MICREL [=y] && HAS_IOMEM [=y]
    
    ld: drivers/net/phy/micrel.o: in function `lan8814_ts_info':
    micrel.c:(.text+0xb35): undefined reference to `ptp_clock_index'
    ld: drivers/net/phy/micrel.o: in function `lan8814_probe':
    micrel.c:(.text+0x2586): undefined reference to `ptp_clock_register'
    
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 866cba0495a8beee1373fabe37b09a8e0983fd8b
Author: Tyrel Datwyler <tyreld@linux.ibm.com>
Date:   Tue Mar 22 12:44:43 2022 -0700

    scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024
    
    [ Upstream commit 0bade8e53279157c7cc9dd95d573b7e82223d78a ]
    
    The adapter request_limit is hardcoded to be INITIAL_SRP_LIMIT which is
    currently an arbitrary value of 800. Increase this value to 1024 which
    better matches the characteristics of the typical IBMi Initiator that
    supports 32 LUNs and a queue depth of 32.
    
    This change also has the secondary benefit of being a power of two as
    required by the kfifo API. Since, Commit ab9bb6318b09 ("Partially revert
    "kfifo: fix kfifo_alloc() and kfifo_init()"") the size of IU pool for each
    target has been rounded down to 512 when attempting to kfifo_init() those
    pools with the current request_limit size of 800.
    
    Link: https://lore.kernel.org/r/20220322194443.678433-1-tyreld@linux.ibm.com
    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cec04e5a1834a5dafc3d7668702e11e6267abf3a
Author: James Smart <jsmart2021@gmail.com>
Date:   Wed Mar 16 20:27:36 2022 -0700

    scsi: lpfc: Fix queue failures when recovering from PCI parity error
    
    [ Upstream commit df0101197c4d9596682901631f3ee193ed354873 ]
    
    When recovering from a pci-parity error the driver is failing to re-create
    queues, causing recovery to fail. Looking deeper, it was found that the
    interrupt vector count allocated on the recovery was fewer than the vectors
    originally allocated. This disparity resulted in CPU map entries with stale
    information. When the driver tries to re-create the queues, it attempts to
    use the stale information which indicates an eq/interrupt vector that was
    no longer created.
    
    Fix by clearng the cpup map array before enabling and requesting the IRQs
    in the lpfc_sli_reset_slot_s4 routine().
    
    Link: https://lore.kernel.org/r/20220317032737.45308-4-jsmart2021@gmail.com
    Co-developed-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: Justin Tee <justin.tee@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 d0b040c2297c13bd2b00a84556dd6104771dc171
Author: James Smart <jsmart2021@gmail.com>
Date:   Wed Mar 16 20:27:35 2022 -0700

    scsi: lpfc: Fix unload hang after back to back PCI EEH faults
    
    [ Upstream commit a4691038b4071ff0d9ae486d8822a2c0d41d5796 ]
    
    When injecting EEH errors the port is getting hung up waiting on the node
    list to empty, message number 0233. The driver is stuck at this point and
    also can't unload. The driver makes transport remoteport delete calls which
    try to abort I/O's, but the EEH daemon has already called the driver to
    detach and the detachment has set the global FC_UNLOADING flag.  There are
    several code paths that will avoid I/O cleanup if the FC_UNLOADING flag is
    set, resulting in transports waiting for I/O while the driver is waiting on
    transports to clean up.
    
    Additionally, during study of the list, a locking issue was found in
    lpfc_sli_abort_iocb_ring that could corrupt the list.
    
    A special case was added to the lpfc_cleanup() routine to call
    lpfc_sli_flush_rings() if the driver is FC_UNLOADING and if the pci-slot
    is offline (e.g. EEH).
    
    The SLI4 part of lpfc_sli_abort_iocb_ring() is changed to use the
    ring_lock.  Also added code to cancel the I/Os if the pci-slot is offline
    and added checks and returns for the FC_UNLOADING and HBA_IOQ_FLUSH flags
    to prevent trying to send an I/O that we cannot handle.
    
    Link: https://lore.kernel.org/r/20220317032737.45308-3-jsmart2021@gmail.com
    Co-developed-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: Justin Tee <justin.tee@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 66cd3f99e7ca2e98edbab030877650bf689e363b
Author: James Smart <jsmart2021@gmail.com>
Date:   Wed Mar 16 20:27:34 2022 -0700

    scsi: lpfc: Improve PCI EEH Error and Recovery Handling
    
    [ Upstream commit 35ed9613d83f3c1f011877d591fd7d36f2666106 ]
    
    Following EEH errors, the driver can crash or hang when deleting the
    localport or when attempting to unload.
    
    The EEH handlers in the driver did not notify the NVMe-FC transport before
    tearing the driver down. This was delayed until the resume steps. This
    worked for SCSI because lpfc_block_scsi() would notify the
    scsi_fc_transport that the target was not available but it would not clean
    up all the references to the ndlp.
    
    The SLI3 prep for dev reset handler did the lpfc_offline_prep() and
    lpfc_offline() calls to get the port stopped before restarting. The SLI4
    version of the prep for dev reset just destroyed the queues and did not
    stop NVMe from continuing.  Also because the port was not really stopped
    the localport destroy would hang because the transport was still waiting
    for I/O. Additionally, a devloss tmo can fire and post events to a stopped
    worker thread creating another hang condition.
    
    lpfc_sli4_prep_dev_for_reset() is modified to call lpfc_offline_prep() and
    lpfc_offline() rather than just lpfc_scsi_dev_block() to ensure both SCSI
    and NVMe transports are notified to block I/O to the driver.
    
    Logic is added to devloss handler and worker thread to clean up ndlp
    references and quiesce appropriately.
    
    Link: https://lore.kernel.org/r/20220317032737.45308-2-jsmart2021@gmail.com
    Co-developed-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: Justin Tee <justin.tee@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 a9564d84ed9f6ee71017d062d0d2182154294a4b
Author: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Date:   Fri Mar 11 21:22:05 2022 +0800

    scsi: target: tcmu: Fix possible page UAF
    
    [ Upstream commit a6968f7a367f128d120447360734344d5a3d5336 ]
    
    tcmu_try_get_data_page() looks up pages under cmdr_lock, but it does not
    take refcount properly and just returns page pointer. When
    tcmu_try_get_data_page() returns, the returned page may have been freed by
    tcmu_blocks_release().
    
    We need to get_page() under cmdr_lock to avoid concurrent
    tcmu_blocks_release().
    
    Link: https://lore.kernel.org/r/20220311132206.24515-1-xiaoguang.wang@linux.alibaba.com
    Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
    Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c189745bb00993795928d461ff1b787587bd5d27
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Sun Mar 27 08:25:10 2022 -0700

    Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer
    
    [ Upstream commit b6cae15b5710c8097aad26a2e5e752c323ee5348 ]
    
    When reading a packet from a host-to-guest ring buffer, there is no
    memory barrier between reading the write index (to see if there is
    a packet to read) and reading the contents of the packet. The Hyper-V
    host uses store-release when updating the write index to ensure that
    writes of the packet data are completed first. On the guest side,
    the processor can reorder and read the packet data before the write
    index, and sometimes get stale packet data. Getting such stale packet
    data has been observed in a reproducible case in a VM on ARM64.
    
    Fix this by using virt_load_acquire() to read the write index,
    ensuring that reads of the packet data cannot be reordered
    before it. Preventing such reordering is logically correct, and
    with this change, getting stale data can no longer be reproduced.
    
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Reviewed-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
    Link: https://lore.kernel.org/r/1648394710-33480-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 350694650dbac47e9e095bb7733a594e575de9b8
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Thu Mar 24 09:14:52 2022 -0700

    PCI: hv: Propagate coherence from VMbus device to PCI device
    
    [ Upstream commit 8d21732475c637c7efcdb91dc927a4c594e97898 ]
    
    PCI pass-thru devices in a Hyper-V VM are represented as a VMBus
    device and as a PCI device.  The coherence of the VMbus device is
    set based on the VMbus node in ACPI, but the PCI device has no
    ACPI node and defaults to not hardware coherent.  This results
    in extra software coherence management overhead on ARM64 when
    devices are hardware coherent.
    
    Fix this by setting up the PCI host bus so that normal
    PCI mechanisms will propagate the coherence of the VMbus
    device to the PCI device. There's no effect on x86/x64 where
    devices are always hardware coherent.
    
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Acked-by: Boqun Feng <boqun.feng@gmail.com>
    Acked-by: Robin Murphy <robin.murphy@arm.com>
    Link: https://lore.kernel.org/r/1648138492-2191-3-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 220e8f53155120e4c7adf04685e12d161d9e6611
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Thu Mar 24 09:14:51 2022 -0700

    Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device
    
    [ Upstream commit 37200078ed6aa2ac3c88a01a64996133dccfdd34 ]
    
    VMbus synthetic devices are not represented in the ACPI DSDT -- only
    the top level VMbus device is represented. As a result, on ARM64
    coherence information in the _CCA method is not specified for
    synthetic devices, so they default to not hardware coherent.
    Drivers for some of these synthetic devices have been recently
    updated to use the standard DMA APIs, and they are incurring extra
    overhead of unneeded software coherence management.
    
    Fix this by propagating coherence information from the VMbus node
    in ACPI to the individual synthetic devices. There's no effect on
    x86/x64 where devices are always hardware coherent.
    
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Acked-by: Robin Murphy <robin.murphy@arm.com>
    Link: https://lore.kernel.org/r/1648138492-2191-2-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6230bc50d6d21cae4c084766623d0a6d17958721
Author: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Date:   Tue Mar 1 15:11:35 2022 +0100

    Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in isolated guests
    
    [ Upstream commit 9f8b577f7b43b2170628d6c537252785dcc2dcea ]
    
    hv_panic_page might contain guest-sensitive information, do not dump it
    over to Hyper-V by default in isolated guests.
    
    While at it, update some comments in hyperv_{panic,die}_event().
    
    Reported-by: Dexuan Cui <decui@microsoft.com>
    Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
    Reviewed-by: Dexuan Cui <decui@microsoft.com>
    Link: https://lore.kernel.org/r/20220301141135.2232-1-parri.andrea@gmail.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0a692c625e373fef692ffbc7fc41f8a025f01cb7
Author: QintaoShen <unSimple1993@163.com>
Date:   Thu Mar 24 16:26:23 2022 +0800

    drm/amdkfd: Check for potential null return of kmalloc_array()
    
    [ Upstream commit ebbb7bb9e80305820dc2328a371c1b35679f2667 ]
    
    As the kmalloc_array() may return null, the 'event_waiters[i].wait' would lead to null-pointer dereference.
    Therefore, it is better to check the return value of kmalloc_array() to avoid this confusion.
    
    Signed-off-by: QintaoShen <unSimple1993@163.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c6f7f5f67fc5c907ce244b0016ff8d7028557575
Author: Tianci Yin <tianci.yin@amd.com>
Date:   Wed Mar 23 23:54:58 2022 +0800

    drm/amdgpu/vcn: improve vcn dpg stop procedure
    
    [ Upstream commit 6ea239adc2a712eb318f04f5c29b018ba65ea38a ]
    
    Prior to disabling dpg, VCN need unpausing dpg mode, or VCN will hang in
    S3 resuming.
    
    Reviewed-by: James Zhu <James.Zhu@amd.com>
    Signed-off-by: Tianci Yin <tianci.yin@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d5575ebe64ed49adb1da27c22fc5869c70684713
Author: Tushar Patel <tushar.patel@amd.com>
Date:   Thu Mar 17 15:31:22 2022 -0400

    drm/amdkfd: Fix Incorrect VMIDs passed to HWS
    
    [ Upstream commit b7dfbd2e601f3fee545bc158feceba4f340fe7cf ]
    
    Compute-only GPUs have more than 8 VMIDs allocated to KFD. Fix
    this by passing correct number of VMIDs to HWS
    
    v2: squash in warning fix (Alex)
    
    Signed-off-by: Tushar Patel <tushar.patel@amd.com>
    Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9ba8783f0d7830cd54ed7e11d0a8f5a614bb0005
Author: Leo (Hanghong) Ma <hanghong.ma@amd.com>
Date:   Fri Mar 11 11:35:29 2022 -0500

    drm/amd/display: Update VTEM Infopacket definition
    
    [ Upstream commit c9fbf6435162ed5fb7201d1d4adf6585c6a8c327 ]
    
    [Why & How]
    The latest HDMI SPEC has updated the VTEM packet structure,
    so change the VTEM Infopacket defined in the driver side to align
    with the SPEC.
    
    Reviewed-by: Chris Park <Chris.Park@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Leo (Hanghong) Ma <hanghong.ma@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 41e3a307d9c6dc5f0f4388af443dde6bf21eab02
Author: Chiawen Huang <chiawen.huang@amd.com>
Date:   Thu Mar 10 00:07:59 2022 +0800

    drm/amd/display: FEC check in timing validation
    
    [ Upstream commit 7d56a154e22ffb3613fdebf83ec34d5225a22993 ]
    
    [Why]
    disable/enable leads FEC mismatch between hw/sw FEC state.
    
    [How]
    check FEC status to fastboot on/off.
    
    Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Chiawen Huang <chiawen.huang@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5da410090d0e8893672ec8d9163d6a53f7b4a783
Author: Charlene Liu <Charlene.Liu@amd.com>
Date:   Mon Mar 7 18:31:29 2022 -0500

    drm/amd/display: fix audio format not updated after edid updated
    
    [ Upstream commit 5e8a71cf13bc9184fee915b2220be71b4c6cac74 ]
    
    [why]
    for the case edid change only changed audio format.
    driver still need to update stream.
    
    Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
    Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bb0991adba50890240710e46cd2550913e2713b1
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Wed Mar 9 18:02:11 2022 -0500

    drm/amdgpu/gmc: use PCI BARs for APUs in passthrough
    
    [ Upstream commit b818a5d374542ccec73dcfe578a081574029820e ]
    
    If the GPU is passed through to a guest VM, use the PCI
    BAR for CPU FB access rather than the physical address of
    carve out.  The physical address is not valid in a guest.
    
    v2: Fix HDP handing as suggested by Michel
    
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 32632f09007f9e5bb8eb55d95f6bd5e9169413d5
Author: Guchun Chen <guchun.chen@amd.com>
Date:   Tue Mar 15 14:59:28 2022 +0800

    drm/amdgpu: conduct a proper cleanup of PDB bo
    
    [ Upstream commit 2d505453f38e18d42ba7d5428aaa17aaa7752c65 ]
    
    Use amdgpu_bo_free_kernel instead of amdgpu_bo_unref to
    perform a proper cleanup of PDB bo.
    
    v2: update subject to be more accurate
    
    Signed-off-by: Guchun Chen <guchun.chen@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 72dd3f553e4ab296774b79a3cb124289d552a6c5
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Wed Mar 23 11:30:36 2022 -0400

    btrfs: do not warn for free space inode in cow_file_range
    
    [ Upstream commit a7d16d9a07bbcb7dcd5214a1bea75c808830bc0d ]
    
    This is a long time leftover from when I originally added the free space
    inode, the point was to catch cases where we weren't honoring the NOCOW
    flag.  However there exists a race with relocation, if we allocate our
    free space inode in a block group that is about to be relocated, we
    could trigger the COW path before the relocation has the opportunity to
    find the extents and delete the free space cache.  In production where
    we have auto-relocation enabled we're seeing this WARN_ON_ONCE() around
    5k times in a 2 week period, so not super common but enough that it's at
    the top of our metrics.
    
    We're properly handling the error here, and with us phasing out v1 space
    cache anyway just drop the WARN_ON_ONCE.
    
    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: Sasha Levin <sashal@kernel.org>

commit 2251d3fed2c664f7ac994ef046912267812fe028
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Mar 14 10:55:32 2022 -0700

    btrfs: fix fallocate to use file_modified to update permissions consistently
    
    [ Upstream commit 05fd9564e9faf0f23b4676385e27d9405cef6637 ]
    
    Since the initial introduction of (posix) fallocate back at the turn of
    the century, it has been possible to use this syscall to change the
    user-visible contents of files.  This can happen by extending the file
    size during a preallocation, or through any of the newer modes (punch,
    zero range).  Because the call can be used to change file contents, we
    should treat it like we do any other modification to a file -- update
    the mtime, and drop set[ug]id privileges/capabilities.
    
    The VFS function file_modified() does all this for us if pass it a
    locked inode, so let's make fallocate drop permissions correctly.
    
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5a899b364ea76f8e49b25c95bdfbeb489b0a29d4
Author: Aurabindo Pillai <aurabindo.pillai@amd.com>
Date:   Tue Mar 15 14:53:24 2022 -0400

    drm/amd: Add USBC connector ID
    
    [ Upstream commit c5c948aa894a831f96fccd025e47186b1ee41615 ]
    
    [Why&How] Add a dedicated AMDGPU specific ID for use with
    newer ASICs that support USB-C output
    
    Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 271582665393f53dba1556f5e21e627773754c0d
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Thu Mar 3 15:33:10 2022 +1000

    KVM: PPC: Book3S HV P9: Fix "lost kick" race
    
    [ Upstream commit c7fa848ff01dad9ed3146a6b1a7d3622131bcedd ]
    
    When new work is created that requires attention from the hypervisor
    (e.g., to inject an interrupt into the guest), fast_vcpu_kick is used to
    pull the target vcpu out of the guest if it may have been running.
    
    Therefore the work creation side looks like this:
    
      vcpu->arch.doorbell_request = 1;
      kvmppc_fast_vcpu_kick_hv(vcpu) {
        smp_mb();
        cpu = vcpu->cpu;
        if (cpu != -1)
            send_ipi(cpu);
      }
    
    And the guest entry side *should* look like this:
    
      vcpu->cpu = smp_processor_id();
      smp_mb();
      if (vcpu->arch.doorbell_request) {
        // do something (abort entry or inject doorbell etc)
      }
    
    But currently the store and load are flipped, so it is possible for the
    entry to see no doorbell pending, and the doorbell creation misses the
    store to set cpu, resulting lost work (or at least delayed until the
    next guest exit).
    
    Fix this by reordering the entry operations and adding a smp_mb
    between them. The P8 path appears to have a similar race which is
    commented but not addressed yet.
    
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20220303053315.1056880-2-npiggin@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 262960775e0d2cdf97a3e33993e95e13175df4bb
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Apr 14 20:23:40 2022 -0600

    io_uring: abort file assignment prior to assigning creds
    
    [ Upstream commit 701521403cfb228536b3947035c8a6eca40d8e58 ]
    
    We need to either restore creds properly if we fail on the file
    assignment, or just do the file assignment first instead. Let's do
    the latter as it's simpler, should make no difference here for
    file assignment.
    
    Link: https://lore.kernel.org/lkml/000000000000a7edb305dca75a50@google.com/
    Reported-by: syzbot+60c52ca98513a8760a91@syzkaller.appspotmail.com
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 407d09a22f3f685fd634aa5d05840c64b23bfebc
Author: Ming Lei <ming.lei@redhat.com>
Date:   Wed Apr 13 16:48:36 2022 +0800

    block: null_blk: end timed out poll request
    
    [ Upstream commit 3e3876d322aef82416ecc496a4d4a587e0fdf7a3 ]
    
    When poll request is timed out, it is removed from the poll list,
    but not completed, so the request is leaked, and never get chance
    to complete.
    
    Fix the issue by ending it in timeout handler.
    
    Fixes: 0a593fbbc245 ("null_blk: poll queue support")
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20220413084836.1571995-1-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5c232a86fef605a0a7cda23cc8c2f6b46102241c
Author: Ming Lei <ming.lei@redhat.com>
Date:   Thu Apr 14 16:44:43 2022 +0800

    block: fix offset/size check in bio_trim()
    
    [ Upstream commit 8535c0185d14ea41f0efd6a357961b05daf6687e ]
    
    Unit of bio->bi_iter.bi_size is bytes, but unit of offset/size
    is sector.
    
    Fix the above issue in checking offset/size in bio_trim().
    
    Fixes: e83502ca5f1e ("block: fix argument type of bio_trim()")
    Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20220414084443.1736850-1-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7f8a7698cd0508090f0a8c7cd23b8a9cfe715c06
Author: Jeremy Linton <jeremy.linton@arm.com>
Date:   Tue Apr 12 16:04:20 2022 -0500

    net: bcmgenet: Revert "Use stronger register read/writes to assure ordering"
    
    [ Upstream commit 2df3fc4a84e917a422935cc5bae18f43f9955d31 ]
    
    It turns out after digging deeper into this bug, that it was being
    triggered by GCC12 failing to call the bcmgenet_enable_dma()
    routine. Given that a gcc12 fix has been merged [1] and the genet
    driver now works properly when built with gcc12, this commit should
    be reverted.
    
    [1]
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105160
    https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=aabb9a261ef060cf24fd626713f1d7d9df81aa57
    
    Fixes: 8d3ea3d402db ("net: bcmgenet: Use stronger register read/writes to assure ordering")
    Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Link: https://lore.kernel.org/r/20220412210420.1129430-1-jeremy.linton@arm.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e6224d9bcf3dca22a267e7c8e9ea9d42c06e74a5
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Tue Apr 12 20:22:09 2022 +0300

    net: dsa: felix: fix tagging protocol changes with multiple CPU ports
    
    [ Upstream commit 00fa91bc9cc2a9d340f963af5e457610ad4b2f9c ]
    
    When the device tree has 2 CPU ports defined, a single one is active
    (has any dp->cpu_dp pointers point to it). Yet the second one is still a
    CPU port, and DSA still calls ->change_tag_protocol on it.
    
    On the NXP LS1028A, the CPU ports are ports 4 and 5. Port 4 is the
    active CPU port and port 5 is inactive.
    
    After the following commands:
    
     # Initial setting
     cat /sys/class/net/eno2/dsa/tagging
     ocelot
     echo ocelot-8021q > /sys/class/net/eno2/dsa/tagging
     echo ocelot > /sys/class/net/eno2/dsa/tagging
    
    traffic is now broken, because the driver has moved the NPI port from
    port 4 to port 5, unbeknown to DSA.
    
    The problem can be avoided by detecting that the second CPU port is
    unused, and not doing anything for it. Further rework will be needed
    when proper support for multiple CPU ports is added.
    
    Treat this as a bug and prepare current kernels to work in single-CPU
    mode with multiple-CPU DT blobs.
    
    Fixes: adb3dccf090b ("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://lore.kernel.org/r/20220412172209.2531865-1-vladimir.oltean@nxp.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a69dab90fb8c0cd9dd7e8e44fa5e6793830f2a26
Author: Antoine Tenart <atenart@kernel.org>
Date:   Tue Apr 12 15:58:52 2022 +0200

    tun: annotate access to queue->trans_start
    
    [ Upstream commit 968a1a5d6541cd24e37dadc1926eab9c10aeb09b ]
    
    Commit 5337824f4dc4 ("net: annotate accesses to queue->trans_start")
    introduced a new helper, txq_trans_cond_update, to update
    queue->trans_start using WRITE_ONCE. One snippet in drivers/net/tun.c
    was missed, as it was introduced roughly at the same time.
    
    Fixes: 5337824f4dc4 ("net: annotate accesses to queue->trans_start")
    Cc: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Antoine Tenart <atenart@kernel.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20220412135852.466386-1-atenart@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b4f53fe23e759ebf72f51a1428f909430afd4d08
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date:   Wed Apr 13 10:10:36 2022 -0300

    vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used
    
    [ Upstream commit 1ef3342a934e235aca72b4bcc0d6854d80a65077 ]
    
    get_pf_vdev() tries to check if a PF is a VFIO PF by looking at the driver:
    
           if (pci_dev_driver(physfn) != pci_dev_driver(vdev->pdev)) {
    
    However now that we have multiple VF and PF drivers this is no longer
    reliable.
    
    This means that security tests realted to vf_token can be skipped by
    mixing and matching different VFIO PCI drivers.
    
    Instead of trying to use the driver core to find the PF devices maintain a
    linked list of all PF vfio_pci_core_device's that we have called
    pci_enable_sriov() on.
    
    When registering a VF just search the list to see if the PF is present and
    record the match permanently in the struct. PCI core locking prevents a PF
    from passing pci_disable_sriov() while VF drivers are attached so the VFIO
    owned PF becomes a static property of the VF.
    
    In common cases where vfio does not own the PF the global list remains
    empty and the VF's pointer is statically NULL.
    
    This also fixes a lockdep splat from recursive locking of the
    vfio_group::device_lock between vfio_device_get_from_name() and
    vfio_device_get_from_dev(). If the VF and PF share the same group this
    would deadlock.
    
    Fixes: ff53edf6d6ab ("vfio/pci: Split the pci_driver code out of vfio_pci_core.c")
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/0-v3-876570980634+f2e8-vfio_vf_token_jgg@nvidia.com
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36977bec1ee807cb6513c867ded7c819c36cbae2
Author: Khazhismel Kumykov <khazhy@google.com>
Date:   Mon Apr 11 15:03:35 2022 -0700

    dm mpath: only use ktime_get_ns() in historical selector
    
    [ Upstream commit ce40426fdc3c92acdba6b5ca74bc7277ffaa6a3d ]
    
    Mixing sched_clock() and ktime_get_ns() usage will give bad results.
    
    Switch hst_select_path() from using sched_clock() to ktime_get_ns().
    Also rename path_service_time()'s 'sched_now' variable to 'now'.
    
    Fixes: 2613eab11996 ("dm mpath: add Historical Service Time Path Selector")
    Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 515e7ba11ef043d6febe69389949c8ef5f25e9d0
Author: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Date:   Wed Apr 13 04:42:51 2022 -0700

    cifs: potential buffer overflow in handling symlinks
    
    [ Upstream commit 64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304 ]
    
    Smatch printed a warning:
            arch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:
            __memcpy() 'dctx->buf' too small (16 vs u32max)
    
    It's caused because Smatch marks 'link_len' as untrusted since it comes
    from sscanf(). Add a check to ensure that 'link_len' is not larger than
    the size of the 'link_str' buffer.
    
    Fixes: c69c1b6eaea1 ("cifs: implement CIFSParseMFSymlink()")
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit edd4600120641e1714e30112e69a548cfb68e067
Author: Lin Ma <linma@zju.edu.cn>
Date:   Wed Apr 13 00:04:30 2022 +0800

    nfc: nci: add flush_workqueue to prevent uaf
    
    [ Upstream commit ef27324e2cb7bb24542d6cb2571740eefe6b00dc ]
    
    Our detector found a concurrent use-after-free bug when detaching an
    NCI device. The main reason for this bug is the unexpected scheduling
    between the used delayed mechanism (timer and workqueue).
    
    The race can be demonstrated below:
    
    Thread-1                           Thread-2
                                     | nci_dev_up()
                                     |   nci_open_device()
                                     |     __nci_request(nci_reset_req)
                                     |       nci_send_cmd
                                     |         queue_work(cmd_work)
    nci_unregister_device()          |
      nci_close_device()             | ...
        del_timer_sync(cmd_timer)[1] |
    ...                              | Worker
    nci_free_device()                | nci_cmd_work()
      kfree(ndev)[3]                 |   mod_timer(cmd_timer)[2]
    
    In short, the cleanup routine thought that the cmd_timer has already
    been detached by [1] but the mod_timer can re-attach the timer [2], even
    it is already released [3], resulting in UAF.
    
    This UAF is easy to trigger, crash trace by POC is like below
    
    [   66.703713] ==================================================================
    [   66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490
    [   66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:1/33
    [   66.703974]
    [   66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5
    [   66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work
    [   66.703974] Call Trace:
    [   66.703974]  <TASK>
    [   66.703974]  dump_stack_lvl+0x57/0x7d
    [   66.703974]  print_report.cold+0x5e/0x5db
    [   66.703974]  ? enqueue_timer+0x448/0x490
    [   66.703974]  kasan_report+0xbe/0x1c0
    [   66.703974]  ? enqueue_timer+0x448/0x490
    [   66.703974]  enqueue_timer+0x448/0x490
    [   66.703974]  __mod_timer+0x5e6/0xb80
    [   66.703974]  ? mark_held_locks+0x9e/0xe0
    [   66.703974]  ? try_to_del_timer_sync+0xf0/0xf0
    [   66.703974]  ? lockdep_hardirqs_on_prepare+0x17b/0x410
    [   66.703974]  ? queue_work_on+0x61/0x80
    [   66.703974]  ? lockdep_hardirqs_on+0xbf/0x130
    [   66.703974]  process_one_work+0x8bb/0x1510
    [   66.703974]  ? lockdep_hardirqs_on_prepare+0x410/0x410
    [   66.703974]  ? pwq_dec_nr_in_flight+0x230/0x230
    [   66.703974]  ? rwlock_bug.part.0+0x90/0x90
    [   66.703974]  ? _raw_spin_lock_irq+0x41/0x50
    [   66.703974]  worker_thread+0x575/0x1190
    [   66.703974]  ? process_one_work+0x1510/0x1510
    [   66.703974]  kthread+0x2a0/0x340
    [   66.703974]  ? kthread_complete_and_exit+0x20/0x20
    [   66.703974]  ret_from_fork+0x22/0x30
    [   66.703974]  </TASK>
    [   66.703974]
    [   66.703974] Allocated by task 267:
    [   66.703974]  kasan_save_stack+0x1e/0x40
    [   66.703974]  __kasan_kmalloc+0x81/0xa0
    [   66.703974]  nci_allocate_device+0xd3/0x390
    [   66.703974]  nfcmrvl_nci_register_dev+0x183/0x2c0
    [   66.703974]  nfcmrvl_nci_uart_open+0xf2/0x1dd
    [   66.703974]  nci_uart_tty_ioctl+0x2c3/0x4a0
    [   66.703974]  tty_ioctl+0x764/0x1310
    [   66.703974]  __x64_sys_ioctl+0x122/0x190
    [   66.703974]  do_syscall_64+0x3b/0x90
    [   66.703974]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    [   66.703974]
    [   66.703974] Freed by task 406:
    [   66.703974]  kasan_save_stack+0x1e/0x40
    [   66.703974]  kasan_set_track+0x21/0x30
    [   66.703974]  kasan_set_free_info+0x20/0x30
    [   66.703974]  __kasan_slab_free+0x108/0x170
    [   66.703974]  kfree+0xb0/0x330
    [   66.703974]  nfcmrvl_nci_unregister_dev+0x90/0xd0
    [   66.703974]  nci_uart_tty_close+0xdf/0x180
    [   66.703974]  tty_ldisc_kill+0x73/0x110
    [   66.703974]  tty_ldisc_hangup+0x281/0x5b0
    [   66.703974]  __tty_hangup.part.0+0x431/0x890
    [   66.703974]  tty_release+0x3a8/0xc80
    [   66.703974]  __fput+0x1f0/0x8c0
    [   66.703974]  task_work_run+0xc9/0x170
    [   66.703974]  exit_to_user_mode_prepare+0x194/0x1a0
    [   66.703974]  syscall_exit_to_user_mode+0x19/0x50
    [   66.703974]  do_syscall_64+0x48/0x90
    [   66.703974]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    To fix the UAF, this patch adds flush_workqueue() to ensure the
    nci_cmd_work is finished before the following del_timer_sync.
    This combination will promise the timer is actually detached.
    
    Fixes: 6a2968aaf50c ("NFC: basic NCI protocol implementation")
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c53789ee03514eeda73a92baf06f01c28b3b5208
Author: Dylan Hung <dylan_hung@aspeedtech.com>
Date:   Tue Apr 12 19:48:59 2022 +0800

    net: ftgmac100: access hardware register after clock ready
    
    [ Upstream commit 3d2504524531990b32a0629cc984db44f399d161 ]
    
    AST2600 MAC register 0x58 is writable only when the MAC clock is
    enabled.  Usually, the MAC clock is enabled by the bootloader so
    register 0x58 is set normally when the bootloader is involved.  To make
    ast2600 ftgmac100 work without the bootloader, postpone the register
    write until the clock is ready.
    
    Fixes: 137d23cea1c0 ("net: ftgmac100: Fix Aspeed ast2600 TX hang issue")
    Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f382df5ff36bc9fa10e0f898f3051d0702085304
Author: Martin Willi <martin@strongswan.org>
Date:   Tue Apr 12 11:34:57 2022 +0200

    macvlan: Fix leaking skb in source mode with nodst option
    
    [ Upstream commit e16b859872b87650bb55b12cca5a5fcdc49c1442 ]
    
    The MACVLAN receive handler clones skbs to all matching source MACVLAN
    interfaces, before it passes the packet along to match on destination
    based MACVLANs.
    
    When using the MACVLAN nodst mode, passing the packet to destination based
    MACVLANs is omitted and the handler returns with RX_HANDLER_CONSUMED.
    However, the passed skb is not freed, leaking for any packet processed
    with the nodst option.
    
    Properly free the skb when consuming packets to fix that leak.
    
    Fixes: 427f0c8c194b ("macvlan: Add nodst option to macvlan type source")
    Signed-off-by: Martin Willi <martin@strongswan.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit efd739903315ca91441d6db3593a4cef3270be7e
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Mon Apr 11 09:17:58 2022 +0300

    perf tools: Fix misleading add event PMU debug message
    
    [ Upstream commit f034fc50d3c7d9385c20d505ab4cf56b8fd18ac7 ]
    
    Fix incorrect debug message:
    
       Attempting to add event pmu 'intel_pt' with '' that may result in
       non-fatal errors
    
    which always appears with perf record -vv and intel_pt e.g.
    
        perf record -vv -e intel_pt//u uname
    
    The message is incorrect because there will never be non-fatal errors.
    
    Suppress the message if the PMU is 'selectable' i.e. meant to be
    selected directly as an event.
    
    Fixes: 4ac22b484d4c79e8 ("perf parse-events: Make add PMU verbose output clearer")
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Link: http://lore.kernel.org/lkml/20220411061758.2458417-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 97335e47d876cfbcdff34a74e1cae334e24829a6
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 15:07:40 2022 +0200

    ALSA: usb-audio: Limit max buffer and period sizes per time
    
    [ Upstream commit 24d0c9f0e7de95fe3e3e0067cbea1cd5d413244b ]
    
    In the previous fix, we increased the max buffer bytes from 1MB to 4MB
    so that we can use bigger buffers for the modern HiFi devices with
    higher rates, more channels and wider formats.  OTOH, extending this
    has a concern that too big buffer is allowed for the lower rates, less
    channels and narrower formats; when an application tries to allocate
    as big buffer as possible, it'll lead to unexpectedly too huge size.
    
    Also, we had a problem about the inconsistent max buffer and period
    bytes for the implicit feedback mode when both streams have different
    channels.  This was fixed by the (relatively complex) patch to reduce
    the max buffer and period bytes accordingly.
    
    This is an alternative fix for those, a patch to kill two birds with
    one stone (*): instead of increasing the max buffer bytes blindly and
    applying the reduction per channels, we simply use the hw constraints
    for the buffer and period "time".  Meanwhile the max buffer and period
    bytes are set unlimited instead.
    
    Since the inconsistency of buffer (and period) bytes comes from the
    difference of the channels in the tied streams, as long as we care
    only about the buffer (and period) time, it doesn't matter; the buffer
    time is same for different channels, although we still allow higher
    buffer size.  Similarly, this will allow more buffer bytes for HiFi
    devices while it also keeps the reasonable size for the legacy
    devices, too.
    
    As of this patch, the max period and buffer time are set to 1 and 2
    seconds, which should be large enough for all possible use cases.
    
    (*) No animals were harmed in the making of this patch.
    
    Fixes: 98c27add5d96 ("ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb")
    Fixes: fee2ec8cceb3 ("ALSA: usb-audio: Increase max buffer size")
    Link: https://lore.kernel.org/r/20220412130740.18933-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8fdbdf330c5fb716c7b36915f7bf5671724f3ff5
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Apr 7 23:27:40 2022 +0200

    ALSA: usb-audio: Increase max buffer size
    
    [ Upstream commit fee2ec8cceb33b8886bc5894fb07e0b2e34148af ]
    
    The current limit of max buffer size 1MB seems too small for modern
    devices with lots of channels and high sample rates.
    Let's make bigger, 4MB.
    
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Link: https://lore.kernel.org/r/20220407212740.17920-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e7f3113d6080d65cf00aeceb55058ad6d29d943a
Author: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Date:   Fri Apr 8 12:54:31 2022 +0530

    testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
    
    [ Upstream commit ce64763c63854b4079f2e036638aa881a1fb3fbc ]
    
    The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate
    CPU set. This cpu set is used further in pthread_attr_setaffinity_np
    and by pthread_create in the code. But in current code, allocated
    cpu set is not freed.
    
    Fix this issue by adding CPU_FREE in the "shutdown" function which
    is called in most of the error/exit path for the cleanup. There are
    few error paths which exit without using shutdown. Add a common goto
    error path with CPU_FREE for these cases.
    
    Fixes: 7820b0715b6f ("tools/selftests: add mq_perf_tests")
    Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 437e583a4be8c64868e22626eeaf37ae4b712108
Author: Dylan Yudaken <dylany@fb.com>
Date:   Tue Apr 12 09:30:42 2022 -0700

    io_uring: verify pad field is 0 in io_get_ext_arg
    
    [ Upstream commit d2347b9695dafe5c388a5f9aeb70e27a7a4d29cf ]
    
    Ensure that only 0 is passed for pad here.
    
    Fixes: c73ebb685fb6 ("io_uring: add timeout support for io_uring_enter()")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220412163042.2788062-5-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5227f57150ee5d9d1a2a55b83e18640d109e5076
Author: Dylan Yudaken <dylany@fb.com>
Date:   Tue Apr 12 09:30:40 2022 -0700

    io_uring: verify that resv2 is 0 in io_uring_rsrc_update2
    
    [ Upstream commit d8a3ba9c143bf89c032deced8a686ffa53b46098 ]
    
    Verify that the user does not pass in anything but 0 for this field.
    
    Fixes: 992da01aa932 ("io_uring: change registration/upd/rsrc tagging ABI")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220412163042.2788062-3-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1a6b924948c89619226d9112775ea6417c7c958b
Author: Dylan Yudaken <dylany@fb.com>
Date:   Tue Apr 12 09:30:39 2022 -0700

    io_uring: move io_uring_rsrc_update2 validation
    
    [ Upstream commit 565c5e616e8061b40a2e1d786c418a7ac3503a8d ]
    
    Move validation to be more consistently straight after
    copy_from_user. This is already done in io_register_rsrc_update and so
    this removes that redundant check.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220412163042.2788062-2-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 365d2f019664859bc82686b290c212ff12d7e215
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:35 2022 +0200

    ALSA: mtpav: Don't call card private_free at probe error path
    
    [ Upstream commit 4fb27190879b82e48ce89a56e9d6c04437dbc065 ]
    
    The card destructor of nm256 driver does merely stopping the running
    timer, and it's superfluous for the probe error handling.  Moreover,
    calling this via the previous devres change would lead to another
    problem due to the reverse call order.
    
    This patch moves the setup of the private_free callback after the card
    registration, so that it can be used only after fully set up.
    
    Fixes: aa92050f10f0 ("ALSA: mtpav: Allocate resources with device-managed APIs")
    Link: https://lore.kernel.org/r/20220412102636.16000-39-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a75f5be104d90c1be7336bb64a23b01d3d73b850
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:00 2022 +0200

    ALSA: ad1889: Fix the missing snd_card_free() call at probe error
    
    [ Upstream commit a8e84a5da18e6d786540aa4ceb6f969d5f1a441d ]
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 567f58754109 ("ALSA: ad1889: Allocate resources with device-managed APIs")
    Link: https://lore.kernel.org/r/20220412102636.16000-4-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f9ba1b8f90f4f6e711a9f68fb71a8f4681582e6a
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Apr 12 15:24:43 2022 +0100

    io_uring: fix assign file locking issue
    
    [ Upstream commit 0f8da75b51ac863b9435368bd50691718cc454b0 ]
    
    io-wq work cancellation path can't take uring_lock as how it's done on
    file assignment, we have to handle IO_WQ_WORK_CANCEL first, this fixes
    encountered hangs.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/0d9b9f37841645518503f6a207e509d14a286aba.1649773463.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 014d5784a8b5f73d522724df3373a20332518849
Author: Antoine Tenart <atenart@kernel.org>
Date:   Tue Apr 12 10:14:59 2022 +0200

    netfilter: nf_tables: nft_parse_register can return a negative value
    
    [ Upstream commit 6c6f9f31ecd47dce1d0dafca4bec8805f9bc97cd ]
    
    Since commit 6e1acfa387b9 ("netfilter: nf_tables: validate registers
    coming from userspace.") nft_parse_register can return a negative value,
    but the function prototype is still returning an unsigned int.
    
    Fixes: 6e1acfa387b9 ("netfilter: nf_tables: validate registers coming from userspace.")
    Signed-off-by: Antoine Tenart <atenart@kernel.org>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9990f717d8344f8f9e1ea690f3b71661d289a724
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Sat Apr 9 20:41:43 2022 +0200

    net: lan966x: Stop processing the MAC entry is port is wrong.
    
    [ Upstream commit 269219321eb7d7645a3122cf40a420c5dc655eb9 ]
    
    Currently when getting a new MAC is learn, the HW generates an
    interrupt. So then the SW will check the new entry and checks if it
    arrived on a correct port. If it didn't just generate a warning.
    But this could still crash the system. Therefore stop processing that
    entry when an issue is seen.
    
    Fixes: 5ccd66e01cbef8 ("net: lan966x: add support for interrupts from analyzer")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 069ed376c995978b11964275a920a61b49970298
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Sat Apr 9 20:41:42 2022 +0200

    net: lan966x: Fix when a port's upper is changed.
    
    [ Upstream commit d7a947d289dc205fc717c004dcebe33b15305afd ]
    
    On lan966x it is not allowed to have foreign interfaces under a bridge
    which already contains lan966x ports. So when a port leaves the bridge
    it would call switchdev_bridge_port_unoffload which eventually will
    notify the other ports that bridge left the vlan group but that is not
    true because the bridge is still part of the vlan group.
    
    Therefore when a port leaves the bridge, stop generating replays because
    already the HW cleared after itself and the other ports don't need to do
    anything else.
    
    Fixes: cf2f60897e921e ("net: lan966x: Add support to offload the forwarding.")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b4b52179ce84d3de859284f778ec3e33fae8ddec
Author: Petr Malat <oss@malat.biz>
Date:   Sat Apr 9 08:36:11 2022 +0200

    sctp: Initialize daddr on peeled off socket
    
    [ Upstream commit 8467dda0c26583547731e7f3ea73fc3856bae3bf ]
    
    Function sctp_do_peeloff() wrongly initializes daddr of the original
    socket instead of the peeled off socket, which makes getpeername()
    return zeroes instead of the primary address. Initialize the new socket
    instead.
    
    Fixes: d570ee490fb1 ("[SCTP]: Correctly set daddr for IPv6 sockets during peeloff")
    Signed-off-by: Petr Malat <oss@malat.biz>
    Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Link: https://lore.kernel.org/r/20220409063611.673193-1-oss@malat.biz
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3ab77510af3f00f9acb1d45801618565b49171ab
Author: Mike Christie <michael.christie@oracle.com>
Date:   Thu Apr 7 19:13:10 2022 -0500

    scsi: iscsi: Fix unbound endpoint error handling
    
    [ Upstream commit 03690d81974535f228e892a14f0d2d44404fe555 ]
    
    If a driver raises a connection error before the connection is bound, we
    can leave a cleanup_work queued that can later run and disconnect/stop a
    connection that is logged in. The problem is that drivers can call
    iscsi_conn_error_event for endpoints that are connected but not yet bound
    when something like the network port they are using is brought down.
    iscsi_cleanup_conn_work_fn will check for this and exit early, but if the
    cleanup_work is stuck behind other works, it might not get run until after
    userspace has done ep_disconnect. Because the endpoint is not yet bound
    there was no way for ep_disconnect to flush the work.
    
    The bug of leaving stop_conns queued was added in:
    
    Commit 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")
    
    and:
    
    Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
    kernel space")
    
    was supposed to fix it, but left this case.
    
    This patch moves the conn state check to before we even queue the work so
    we can avoid queueing.
    
    Link: https://lore.kernel.org/r/20220408001314.5014-7-michael.christie@oracle.com
    Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space")
    Tested-by: Manish Rangankar <mrangankar@marvell.com>
    Reviewed-by: Lee Duncan <lduncan@@suse.com>
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 209d492035c983a1554779d2f769e4a97c30ba2d
Author: Mike Christie <michael.christie@oracle.com>
Date:   Thu Apr 7 19:13:09 2022 -0500

    scsi: iscsi: Fix conn cleanup and stop race during iscsid restart
    
    [ Upstream commit 7c6e99c18167ed89729bf167ccb4a7e3ab3115ba ]
    
    If iscsid is doing a stop_conn at the same time the kernel is starting
    error recovery we can hit a race that allows the cleanup work to run on a
    valid connection. In the race, iscsi_if_stop_conn sees the cleanup bit set,
    but it calls flush_work on the clean_work before iscsi_conn_error_event has
    queued it. The flush then returns before the queueing and so the
    cleanup_work can run later and disconnect/stop a conn while it's in a
    connected state.
    
    The patch:
    
    Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
    kernel space")
    
    added the late stop_conn call bug originally, and the patch:
    
    Commit 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")
    
    attempted to fix it but only fixed the normal EH case and left the above
    race for the iscsid restart case. For the normal EH case we don't hit the
    race because we only signal userspace to start recovery after we have done
    the queueing, so the flush will always catch the queued work or see it
    completed.
    
    For iscsid restart cases like boot, we can hit the race because iscsid will
    call down to the kernel before the kernel has signaled any error, so both
    code paths can be running at the same time. This adds a lock around the
    setting of the cleanup bit and queueing so they happen together.
    
    Link: https://lore.kernel.org/r/20220408001314.5014-6-michael.christie@oracle.com
    Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space")
    Tested-by: Manish Rangankar <mrangankar@marvell.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c5302cab5c79f24f75038454d8bfce0200c3e89c
Author: Mike Christie <michael.christie@oracle.com>
Date:   Thu Apr 7 19:13:08 2022 -0500

    scsi: iscsi: Fix endpoint reuse regression
    
    [ Upstream commit 0aadafb5c34403a7cced1a8d61877048dc059f70 ]
    
    This patch fixes a bug where when using iSCSI offload we can free an
    endpoint while userspace still thinks it's active. That then causes the
    endpoint ID to be reused for a new connection's endpoint while userspace
    still thinks the ID is for the original connection. Userspace will then end
    up disconnecting a running connection's endpoint or trying to bind to
    another connection's endpoint.
    
    This bug is a regression added in:
    
    Commit 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")
    
    where we added a in kernel ep_disconnect call to fix a bug in:
    
    Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in
    kernel space")
    
    where we would call stop_conn without having done ep_disconnect. This early
    ep_disconnect call will then free the endpoint and it's ID while userspace
    still thinks the ID is valid.
    
    Fix the early release of the ID by having the in kernel recovery code keep
    a reference to the endpoint until userspace has called into the kernel to
    finish cleaning up the endpoint/connection. It requires the previous commit
    "scsi: iscsi: Release endpoint ID when its freed" which moved the freeing
    of the ID until when the endpoint is released.
    
    Link: https://lore.kernel.org/r/20220408001314.5014-5-michael.christie@oracle.com
    Fixes: 23d6fefbb3f6 ("scsi: iscsi: Fix in-kernel conn failure handling")
    Tested-by: Manish Rangankar <mrangankar@marvell.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c265ff1885a395a353c6bc53770450744b2b9731
Author: Mike Christie <michael.christie@oracle.com>
Date:   Thu Apr 7 19:13:06 2022 -0500

    scsi: iscsi: Fix offload conn cleanup when iscsid restarts
    
    [ Upstream commit cbd2283aaf47fef4ded4b29124b1ef3beb515f3a ]
    
    When userspace restarts during boot or upgrades it won't know about the
    offload driver's endpoint and connection mappings. iscsid will start by
    cleaning up the old session by doing a stop_conn call. Later, if we are
    able to create a new connection, we clean up the old endpoint during the
    binding stage. The problem is that if we do stop_conn before doing the
    ep_disconnect call offload, drivers can still be executing I/O. We then
    might free tasks from the under the card/driver.
    
    This moves the ep_disconnect call to before we do the stop_conn call for
    this case. It will then work and look like a normal recovery/cleanup
    procedure from the driver's point of view.
    
    Link: https://lore.kernel.org/r/20220408001314.5014-3-michael.christie@oracle.com
    Tested-by: Manish Rangankar <mrangankar@marvell.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36b2a79026936c07a03155e75828162babe8b96e
Author: Mike Christie <michael.christie@oracle.com>
Date:   Thu Apr 7 19:13:05 2022 -0500

    scsi: iscsi: Move iscsi_ep_disconnect()
    
    [ Upstream commit c34f95e98d8fb750eefd4f3fe58b4f8b5e89253b ]
    
    This patch moves iscsi_ep_disconnect() so it can be called earlier in the
    next patch.
    
    Link: https://lore.kernel.org/r/20220408001314.5014-2-michael.christie@oracle.com
    Tested-by: Manish Rangankar <mrangankar@marvell.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1eb86d6c57c27dadf99ae1c7addc4b160cc86589
Author: Ajish Koshy <Ajish.Koshy@microchip.com>
Date:   Mon Apr 11 12:16:03 2022 +0530

    scsi: pm80xx: Enable upper inbound, outbound queues
    
    [ Upstream commit bcd8a45223470e00b5f254018174d64a75db4bbe ]
    
    Executing driver on servers with more than 32 CPUs were faced with command
    timeouts. This is because we were not geting completions for commands
    submitted on IQ32 - IQ63.
    
    Set E64Q bit to enable upper inbound and outbound queues 32 to 63 in the
    MPI main configuration table.
    
    Added 500ms delay after successful MPI initialization as mentioned in
    controller datasheet.
    
    Link: https://lore.kernel.org/r/20220411064603.668448-3-Ajish.Koshy@microchip.com
    Fixes: 05c6c029a44d ("scsi: pm80xx: Increase number of supported queues")
    Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Acked-by: Jack Wang <jinpu.wang@ionos.com>
    Signed-off-by: Ajish Koshy <Ajish.Koshy@microchip.com>
    Signed-off-by: Viswas G <Viswas.G@microchip.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e48d1b45d6600c272a5f48059474647605744f97
Author: Ajish Koshy <Ajish.Koshy@microchip.com>
Date:   Mon Apr 11 12:16:02 2022 +0530

    scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63
    
    [ Upstream commit 294080eacf92a0781e6d43663448a55001ec8c64 ]
    
    When upper inbound and outbound queues 32-63 are enabled, we see upper
    vectors 32-63 in interrupt service routine. We need corresponding registers
    to handle masking and unmasking of these upper interrupts.
    
    To achieve this, we use registers MSGU_ODMR_U(0x34) to mask and
    MSGU_ODMR_CLR_U(0x3C) to unmask the interrupts. In these registers bit 0-31
    represents interrupt vectors 32-63.
    
    Link: https://lore.kernel.org/r/20220411064603.668448-2-Ajish.Koshy@microchip.com
    Fixes: 05c6c029a44d ("scsi: pm80xx: Increase number of supported queues")
    Reviewed-by: John Garry <john.garry@huawei.com>
    Acked-by: Jack Wang <jinpu.wang@ionos.com>
    Signed-off-by: Ajish Koshy <Ajish.Koshy@microchip.com>
    Signed-off-by: Viswas G <Viswas.G@microchip.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 22025513ced3d599ee8b24169141c95cf2467a4a
Author: Karsten Graul <kgraul@linux.ibm.com>
Date:   Fri Apr 8 17:10:34 2022 +0200

    net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()
    
    [ Upstream commit d22f4f977236f97e01255a80bca2ea93a8094fc8 ]
    
    dev_name() was called with dev.parent as argument but without to
    NULL-check it before.
    Solve this by checking the pointer before the call to dev_name().
    
    Fixes: af5f60c7e3d5 ("net/smc: allow PCI IDs as ib device names in the pnet table")
    Reported-by: syzbot+03e3e228510223dabd34@syzkaller.appspotmail.com
    Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a2027dcf197fc6c6dc745a3f197e13185fa9b5c1
Author: Karsten Graul <kgraul@linux.ibm.com>
Date:   Fri Apr 8 17:10:33 2022 +0200

    net/smc: use memcpy instead of snprintf to avoid out of bounds read
    
    [ Upstream commit b1871fd48efc567650dbdc974e5a2342a03fe0d2 ]
    
    Using snprintf() to convert not null-terminated strings to null
    terminated strings may cause out of bounds read in the source string.
    Therefore use memcpy() and terminate the target string with a null
    afterwards.
    
    Fixes: fa0866625543 ("net/smc: add support for user defined EIDs")
    Fixes: 3c572145c24e ("net/smc: add generic netlink support for system EID")
    Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 833759b3aadbbe9137cf026236037c979a183756
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sun Apr 10 19:05:09 2022 -0600

    io_uring: stop using io_wq_work as an fd placeholder
    
    [ Upstream commit 82733d168cbd3fe9dab603f05894316b99008924 ]
    
    There are two reasons why this isn't the best idea:
    
    - It's an odd area to grab a bit of storage space, hence it's an odd area
      to grab storage from.
    - It puts the 3rd io_kiocb cacheline into the hot path, where normal hot
      path just needs the first two.
    
    Use 'cflags' for joint fd/cflags storage. We only need fd until we
    successfully issue, and we only need cflags once a request is done and is
    completed.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cc4826f7b496cb0c66bed423778bf4fa3a80dcfd
Author: Kuogee Hsieh <quic_khsieh@quicinc.com>
Date:   Fri Apr 8 14:04:54 2022 -0700

    drm/msm/dp: add fail safe mode outside of event_mutex context
    
    [ Upstream commit 8b2c181e3dcf7562445af6702ee94aaedcbe13c8 ]
    
    There is possible circular locking dependency detected on event_mutex
    (see below logs). This is due to set fail safe mode is done at
    dp_panel_read_sink_caps() within event_mutex scope. To break this
    possible circular locking, this patch move setting fail safe mode
    out of event_mutex scope.
    
    [   23.958078] ======================================================
    [   23.964430] WARNING: possible circular locking dependency detected
    [   23.970777] 5.17.0-rc2-lockdep-00088-g05241de1f69e #148 Not tainted
    [   23.977219] ------------------------------------------------------
    [   23.983570] DrmThread/1574 is trying to acquire lock:
    [   23.988763] ffffff808423aab0 (&dp->event_mutex){+.+.}-{3:3}, at: msm_dp_displ                                                                             ay_enable+0x58/0x164
    [   23.997895]
    [   23.997895] but task is already holding lock:
    [   24.003895] ffffff808420b280 (&kms->commit_lock[i]/1){+.+.}-{3:3}, at: lock_c                                                                             rtcs+0x80/0x8c
    [   24.012495]
    [   24.012495] which lock already depends on the new lock.
    [   24.012495]
    [   24.020886]
    [   24.020886] the existing dependency chain (in reverse order) is:
    [   24.028570]
    [   24.028570] -> #5 (&kms->commit_lock[i]/1){+.+.}-{3:3}:
    [   24.035472]        __mutex_lock+0xc8/0x384
    [   24.039695]        mutex_lock_nested+0x54/0x74
    [   24.044272]        lock_crtcs+0x80/0x8c
    [   24.048222]        msm_atomic_commit_tail+0x1e8/0x3d0
    [   24.053413]        commit_tail+0x7c/0xfc
    [   24.057452]        drm_atomic_helper_commit+0x158/0x15c
    [   24.062826]        drm_atomic_commit+0x60/0x74
    [   24.067403]        drm_mode_atomic_ioctl+0x6b0/0x908
    [   24.072508]        drm_ioctl_kernel+0xe8/0x168
    [   24.077086]        drm_ioctl+0x320/0x370
    [   24.081123]        drm_compat_ioctl+0x40/0xdc
    [   24.085602]        __arm64_compat_sys_ioctl+0xe0/0x150
    [   24.090895]        invoke_syscall+0x80/0x114
    [   24.095294]        el0_svc_common.constprop.3+0xc4/0xf8
    [   24.100668]        do_el0_svc_compat+0x2c/0x54
    [   24.105242]        el0_svc_compat+0x4c/0xe4
    [   24.109548]        el0t_32_sync_handler+0xc4/0xf4
    [   24.114381]        el0t_32_sync+0x178
    [   24.118688]
    [   24.118688] -> #4 (&kms->commit_lock[i]){+.+.}-{3:3}:
    [   24.125408]        __mutex_lock+0xc8/0x384
    [   24.129628]        mutex_lock_nested+0x54/0x74
    [   24.134204]        lock_crtcs+0x80/0x8c
    [   24.138155]        msm_atomic_commit_tail+0x1e8/0x3d0
    [   24.143345]        commit_tail+0x7c/0xfc
    [   24.147382]        drm_atomic_helper_commit+0x158/0x15c
    [   24.152755]        drm_atomic_commit+0x60/0x74
    [   24.157323]        drm_atomic_helper_set_config+0x68/0x90
    [   24.162869]        drm_mode_setcrtc+0x394/0x648
    [   24.167535]        drm_ioctl_kernel+0xe8/0x168
    [   24.172102]        drm_ioctl+0x320/0x370
    [   24.176135]        drm_compat_ioctl+0x40/0xdc
    [   24.180621]        __arm64_compat_sys_ioctl+0xe0/0x150
    [   24.185904]        invoke_syscall+0x80/0x114
    [   24.190302]        el0_svc_common.constprop.3+0xc4/0xf8
    [   24.195673]        do_el0_svc_compat+0x2c/0x54
    [   24.200241]        el0_svc_compat+0x4c/0xe4
    [   24.204544]        el0t_32_sync_handler+0xc4/0xf4
    [   24.209378]        el0t_32_sync+0x174/0x178
    [   24.213680] -> #3 (crtc_ww_class_mutex){+.+.}-{3:3}:
    [   24.220308]        __ww_mutex_lock.constprop.20+0xe8/0x878
    [   24.225951]        ww_mutex_lock+0x60/0xd0
    [   24.230166]        modeset_lock+0x190/0x19c
    [   24.234467]        drm_modeset_lock+0x34/0x54
    [   24.238953]        drmm_mode_config_init+0x550/0x764
    [   24.244065]        msm_drm_bind+0x170/0x59c
    [   24.248374]        try_to_bring_up_master+0x244/0x294
    [   24.253572]        __component_add+0xf4/0x14c
    [   24.258057]        component_add+0x2c/0x38
    [   24.262273]        dsi_dev_attach+0x2c/0x38
    [   24.266575]        dsi_host_attach+0xc4/0x120
    [   24.271060]        mipi_dsi_attach+0x34/0x48
    [   24.275456]        devm_mipi_dsi_attach+0x28/0x68
    [   24.280298]        ti_sn_bridge_probe+0x2b4/0x2dc
    [   24.285137]        auxiliary_bus_probe+0x78/0x90
    [   24.289893]        really_probe+0x1e4/0x3d8
    [   24.294194]        __driver_probe_device+0x14c/0x164
    [   24.299298]        driver_probe_device+0x54/0xf8
    [   24.304043]        __device_attach_driver+0xb4/0x118
    [   24.309145]        bus_for_each_drv+0xb0/0xd4
    [   24.313628]        __device_attach+0xcc/0x158
    [   24.318112]        device_initial_probe+0x24/0x30
    [   24.322954]        bus_probe_device+0x38/0x9c
    [   24.327439]        deferred_probe_work_func+0xd4/0xf0
    [   24.332628]        process_one_work+0x2f0/0x498
    [   24.337289]        process_scheduled_works+0x44/0x48
    [   24.342391]        worker_thread+0x1e4/0x26c
    [   24.346788]        kthread+0xe4/0xf4
    [   24.350470]        ret_from_fork+0x10/0x20
    [   24.354683]
    [   24.354683]
    [   24.354683] -> #2 (crtc_ww_class_acquire){+.+.}-{0:0}:
    [   24.361489]        drm_modeset_acquire_init+0xe4/0x138
    [   24.366777]        drm_helper_probe_detect_ctx+0x44/0x114
    [   24.372327]        check_connector_changed+0xbc/0x198
    [   24.377517]        drm_helper_hpd_irq_event+0xcc/0x11c
    [   24.382804]        dsi_hpd_worker+0x24/0x30
    [   24.387104]        process_one_work+0x2f0/0x498
    [   24.391762]        worker_thread+0x1d0/0x26c
    [   24.396158]        kthread+0xe4/0xf4
    [   24.399840]        ret_from_fork+0x10/0x20
    [   24.404053]
    [   24.404053] -> #1 (&dev->mode_config.mutex){+.+.}-{3:3}:
    [   24.411032]        __mutex_lock+0xc8/0x384
    [   24.415247]        mutex_lock_nested+0x54/0x74
    [   24.419819]        dp_panel_read_sink_caps+0x23c/0x26c
    [   24.425108]        dp_display_process_hpd_high+0x34/0xd4
    [   24.430570]        dp_display_usbpd_configure_cb+0x30/0x3c
    [   24.436205]        hpd_event_thread+0x2ac/0x550
    [   24.440864]        kthread+0xe4/0xf4
    [   24.444544]        ret_from_fork+0x10/0x20
    [   24.448757]
    [   24.448757] -> #0 (&dp->event_mutex){+.+.}-{3:3}:
    [   24.455116]        __lock_acquire+0xe2c/0x10d8
    [   24.459690]        lock_acquire+0x1ac/0x2d0
    [   24.463988]        __mutex_lock+0xc8/0x384
    [   24.468201]        mutex_lock_nested+0x54/0x74
    [   24.472773]        msm_dp_display_enable+0x58/0x164
    [   24.477789]        dp_bridge_enable+0x24/0x30
    [   24.482273]        drm_atomic_bridge_chain_enable+0x78/0x9c
    [   24.488006]        drm_atomic_helper_commit_modeset_enables+0x1bc/0x244
    [   24.494801]        msm_atomic_commit_tail+0x248/0x3d0
    [   24.499992]        commit_tail+0x7c/0xfc
    [   24.504031]        drm_atomic_helper_commit+0x158/0x15c
    [   24.509404]        drm_atomic_commit+0x60/0x74
    [   24.513976]        drm_mode_atomic_ioctl+0x6b0/0x908
    [   24.519079]        drm_ioctl_kernel+0xe8/0x168
    [   24.523650]        drm_ioctl+0x320/0x370
    [   24.527689]        drm_compat_ioctl+0x40/0xdc
    [   24.532175]        __arm64_compat_sys_ioctl+0xe0/0x150
    [   24.537463]        invoke_syscall+0x80/0x114
    [   24.541861]        el0_svc_common.constprop.3+0xc4/0xf8
    [   24.547235]        do_el0_svc_compat+0x2c/0x54
    [   24.551806]        el0_svc_compat+0x4c/0xe4
    [   24.556106]        el0t_32_sync_handler+0xc4/0xf4
    [   24.560948]        el0t_32_sync+0x174/0x178
    
    Changes in v2:
    -- add circular lockiing trace
    
    Fixes: d4aca422539c ("drm/msm/dp:  always add fail-safe mode into connector mode list")
    Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/481396/
    Link: https://lore.kernel.org/r/1649451894-554-1-git-send-email-quic_khsieh@quicinc.com
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 35e490f90f8f1fbd1660438ce634e7ed18c1e0fa
Author: Stephen Boyd <swboyd@chromium.org>
Date:   Thu Mar 17 17:07:31 2022 -0700

    drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init()
    
    [ Upstream commit 47b7de6b88b962ef339a2427a023d2a23d161654 ]
    
    The member 'msm_dsi->connector' isn't assigned until
    msm_dsi_manager_connector_init() returns (see msm_dsi_modeset_init() and
    how it assigns the return value). Therefore this pointer is going to be
    NULL here. Let's use 'connector' which is what was intended.
    
    Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Cc: Sean Paul <seanpaul@chromium.org>
    Fixes: 6d5e78406991 ("drm/msm/dsi: Move dsi panel init into modeset init path")
    Signed-off-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/478693/
    Link: https://lore.kernel.org/r/20220318000731.2823718-1-swboyd@chromium.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8bd18b498ae42f7ee7efab3a012c6b04f1bd6452
Author: Rob Clark <robdclark@chromium.org>
Date:   Thu Apr 7 13:28:33 2022 -0700

    drm/msm: Fix range size vs end confusion
    
    [ Upstream commit 537fef808be5ea56f6fc06932162550819a3b3c3 ]
    
    The fourth param is size, rather than range_end.
    
    Note that we could increase the address space size if we had a way to
    prevent buffers from spanning a 4G split, mostly just to avoid fw bugs
    with 64b math.
    
    Fixes: 84c31ee16f90 ("drm/msm/a6xx: Add support for per-instance pagetables")
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Link: https://lore.kernel.org/r/20220407202836.1211268-1-robdclark@gmail.com
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 321e9a2cf7430f1146ee62fd4bab72666743e10d
Author: Florian Westphal <fw@strlen.de>
Date:   Sat Apr 9 13:20:19 2022 +0200

    netfilter: nft_socket: make cgroup match work in input too
    
    [ Upstream commit 05ae2fba821c4d122ab4ba3e52144e21586c4010 ]
    
    cgroupv2 helper function ignores the already-looked up sk
    and uses skb->sk instead.
    
    Just pass sk from the calling function instead; this will
    make cgroup matching work for udp and tcp in input even when
    edemux did not set skb->sk already.
    
    Fixes: e0bb96db96f8 ("netfilter: nft_socket: add support for cgroupsv2")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Tested-by: Topi Miettinen <toiwoton@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 23bc76fe3bdba23728b94049e2310924240b9bae
Author: Ben Greear <greearb@candelatech.com>
Date:   Wed Apr 6 10:56:59 2022 -0700

    mac80211: fix ht_capa printout in debugfs
    
    [ Upstream commit fb4bccd863ccccd36ad000601856609e259a1859 ]
    
    Don't use sizeof(pointer) when calculating scnprintf offset.
    
    Fixes: 01f84f0ed3b4 ("mac80211: reduce stack usage in debugfs")
    Signed-off-by: Ben Greear <greearb@candelatech.com>
    Link: https://lore.kernel.org/r/20220406175659.20611-1-greearb@candelatech.com
    [correct the Fixes tag]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e33bc93861e6bc4ca0db7915fd4295fb430c76fb
Author: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Date:   Mon Apr 11 14:37:51 2022 +0530

    cfg80211: hold bss_lock while updating nontrans_list
    
    [ Upstream commit a5199b5626cd6913cf8776a835bc63d40e0686ad ]
    
    Synchronize additions to nontrans_list of transmitting BSS with
    bss_lock to avoid races. Also when cfg80211_add_nontrans_list() fails
    __cfg80211_unlink_bss() needs bss_lock to be held (has lockdep assert
    on bss_lock). So protect the whole block with bss_lock to avoid
    races and warnings. Found during code review.
    
    Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
    Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
    Link: https://lore.kernel.org/r/1649668071-9370-1-git-send-email-quic_ramess@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bed9b537f1009fcc7e01d801535a38e8980b48bc
Author: Benedikt Spranger <b.spranger@linutronix.de>
Date:   Fri Apr 8 11:47:45 2022 +0200

    net/sched: taprio: Check if socket flags are valid
    
    [ Upstream commit e8a64bbaaad1f6548cec5508297bc6d45e8ab69e ]
    
    A user may set the SO_TXTIME socket option to ensure a packet is send
    at a given time. The taprio scheduler has to confirm, that it is allowed
    to send a packet at that given time, by a check against the packet time
    schedule. The scheduler drop the packet, if the gates are closed at the
    given send time.
    
    The check, if SO_TXTIME is set, may fail since sk_flags are part of an
    union and the union is used otherwise. This happen, if a socket is not
    a full socket, like a request socket for example.
    
    Add a check to verify, if the union is used for sk_flags.
    
    Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
    Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
    Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
    Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6c020f05253df04c3480b586fe188a3582740049
Author: Dinh Nguyen <dinguyen@kernel.org>
Date:   Thu Apr 7 08:25:21 2022 -0500

    net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link
    
    [ Upstream commit a6aaa00324240967272b451bfa772547bd576ee6 ]
    
    When using a fixed-link, the altr_tse_pcs driver crashes
    due to null-pointer dereference as no phy_device is provided to
    tse_pcs_fix_mac_speed function. Fix this by adding a check for
    phy_dev before calling the tse_pcs_fix_mac_speed() function.
    
    Also clean up the tse_pcs_fix_mac_speed function a bit. There is
    no need to check for splitter_base and sgmii_adapter_base
    because the driver will fail if these 2 variables are not
    derived from the device tree.
    
    Fixes: fb3bbdb85989 ("net: ethernet: Add TSE PCS support to dwmac-socfpga")
    Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fb3e75a8e61c857806306d10ba87db7e98f8cd71
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sun Apr 10 15:13:24 2022 -0600

    io_uring: flag the fact that linked file assignment is sane
    
    [ Upstream commit c4212f3eb89fd5654f0a6ed2ee1d13fcb86cb664 ]
    
    Give applications a way to tell if the kernel supports sane linked files,
    as in files being assigned at the right time to be able to reliably
    do <open file direct into slot X><read file from slot X> while using
    IOSQE_IO_LINK to order them.
    
    Not really a bug fix, but flag it as such so that it gets pulled in with
    backports of the deferred file assignment.
    
    Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 98808ab492ce5852d66e599c7912dd3081e65b94
Author: Heiko Stuebner <heiko@sntech.de>
Date:   Sat Apr 9 09:16:00 2022 +0530

    RISC-V: KVM: include missing hwcap.h into vcpu_fp
    
    [ Upstream commit 4054eee9290248bf66c5eacb58879c9aaad37f71 ]
    
    vcpu_fp uses the riscv_isa_extension mechanism which gets
    defined in hwcap.h but doesn't include that head file.
    
    While it seems to work in most cases, in certain conditions
    this can lead to build failures like
    
    ../arch/riscv/kvm/vcpu_fp.c: In function ‘kvm_riscv_vcpu_fp_reset’:
    ../arch/riscv/kvm/vcpu_fp.c:22:13: error: implicit declaration of function ‘riscv_isa_extension_available’ [-Werror=implicit-function-declaration]
       22 |         if (riscv_isa_extension_available(&isa, f) ||
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../arch/riscv/kvm/vcpu_fp.c:22:49: error: ‘f’ undeclared (first use in this function)
       22 |         if (riscv_isa_extension_available(&isa, f) ||
    
    Fix this by simply including the necessary header.
    
    Fixes: 0a86512dc113 ("RISC-V: KVM: Factor-out FP virtualization into separate
    sources")
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fb80e2399d64ea70ad50ee93d8ec31cdd068ea85
Author: Anup Patel <apatel@ventanamicro.com>
Date:   Sat Apr 9 09:15:51 2022 +0530

    KVM: selftests: riscv: Fix alignment of the guest_hang() function
    
    [ Upstream commit ebdef0de2dbc40e697adaa6b3408130f7a7b8351 ]
    
    The guest_hang() function is used as the default exception handler
    for various KVM selftests applications by setting it's address in
    the vstvec CSR. The vstvec CSR requires exception handler base address
    to be at least 4-byte aligned so this patch fixes alignment of the
    guest_hang() function.
    
    Fixes: 3e06cdf10520 ("KVM: selftests: Add initial support for RISC-V
    64-bit")
    Signed-off-by: Anup Patel <apatel@ventanamicro.com>
    Tested-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 590fe86a80c5a21bf7cd1dbfbce52d8e1343717e
Author: Anup Patel <apatel@ventanamicro.com>
Date:   Sat Apr 9 09:15:44 2022 +0530

    KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table
    
    [ Upstream commit fac3725364397f9a40a101f089b86ea655a58d06 ]
    
    Supporting hardware updates of PTE A and D bits is optional for any
    RISC-V implementation so current software strategy is to always set
    these bits in both G-stage (hypervisor) and VS-stage (guest kernel).
    
    If PTE A and D bits are not set by software (hypervisor or guest)
    then RISC-V implementations not supporting hardware updates of these
    bits will cause traps even for perfectly valid PTEs.
    
    Based on above explanation, the VS-stage page table created by various
    KVM selftest applications is not correct because PTE A and D bits are
    not set. This patch fixes VS-stage page table programming of PTE A and
    D bits for KVM selftests.
    
    Fixes: 3e06cdf10520 ("KVM: selftests: Add initial support for RISC-V
    64-bit")
    Signed-off-by: Anup Patel <apatel@ventanamicro.com>
    Tested-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f884cdfdb7f9dcc0873ac21c50f62303170825de
Author: Michael Walle <michael@walle.cc>
Date:   Fri Apr 8 12:15:21 2022 +0200

    net: dsa: felix: suppress -EPROBE_DEFER errors
    
    [ Upstream commit e6934e4048c91502efcb21da92b7ae37cd8fa741 ]
    
    The DSA master might not have been probed yet in which case the probe of
    the felix switch fails with -EPROBE_DEFER:
    [    4.435305] mscc_felix 0000:00:00.5: Failed to register DSA switch: -517
    
    It is not an error. Use dev_err_probe() to demote this particular error
    to a debug message.
    
    Fixes: 56051948773e ("net: dsa: ocelot: add driver for Felix switch family")
    Signed-off-by: Michael Walle <michael@walle.cc>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://lore.kernel.org/r/20220408101521.281886-1-michael@walle.cc
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 09a5df1b88c8f126c8ff9938edf160edd4e92f42
Author: Dave Wysochanski <dwysocha@redhat.com>
Date:   Tue Apr 5 09:46:49 2022 -0400

    cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr
    
    [ Upstream commit 7b2f6c306601240635c72caa61f682e74d4591b2 ]
    
    Use the actual length of volume coherency data when setting the
    xattr to avoid the following KASAN report.
    
     BUG: KASAN: slab-out-of-bounds in cachefiles_set_volume_xattr+0xa0/0x350 [cachefiles]
     Write of size 4 at addr ffff888101e02af4 by task kworker/6:0/1347
    
     CPU: 6 PID: 1347 Comm: kworker/6:0 Kdump: loaded Not tainted 5.18.0-rc1-nfs-fscache-netfs+ #13
     Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-4.fc34 04/01/2014
     Workqueue: events fscache_create_volume_work [fscache]
     Call Trace:
      <TASK>
      dump_stack_lvl+0x45/0x5a
      print_report.cold+0x5e/0x5db
      ? __lock_text_start+0x8/0x8
      ? cachefiles_set_volume_xattr+0xa0/0x350 [cachefiles]
      kasan_report+0xab/0x120
      ? cachefiles_set_volume_xattr+0xa0/0x350 [cachefiles]
      kasan_check_range+0xf5/0x1d0
      memcpy+0x39/0x60
      cachefiles_set_volume_xattr+0xa0/0x350 [cachefiles]
      cachefiles_acquire_volume+0x2be/0x500 [cachefiles]
      ? __cachefiles_free_volume+0x90/0x90 [cachefiles]
      fscache_create_volume_work+0x68/0x160 [fscache]
      process_one_work+0x3b7/0x6a0
      worker_thread+0x2c4/0x650
      ? process_one_work+0x6a0/0x6a0
      kthread+0x16c/0x1a0
      ? kthread_complete_and_exit+0x20/0x20
      ret_from_fork+0x22/0x30
      </TASK>
    
     Allocated by task 1347:
      kasan_save_stack+0x1e/0x40
      __kasan_kmalloc+0x81/0xa0
      cachefiles_set_volume_xattr+0x76/0x350 [cachefiles]
      cachefiles_acquire_volume+0x2be/0x500 [cachefiles]
      fscache_create_volume_work+0x68/0x160 [fscache]
      process_one_work+0x3b7/0x6a0
      worker_thread+0x2c4/0x650
      kthread+0x16c/0x1a0
      ret_from_fork+0x22/0x30
    
     The buggy address belongs to the object at ffff888101e02af0
     which belongs to the cache kmalloc-8 of size 8
     The buggy address is located 4 bytes inside of
     8-byte region [ffff888101e02af0, ffff888101e02af8)
    
     The buggy address belongs to the physical page:
     page:00000000a2292d70 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101e02
     flags: 0x17ffffc0000200(slab|node=0|zone=2|lastcpupid=0x1fffff)
     raw: 0017ffffc0000200 0000000000000000 dead000000000001 ffff888100042280
     raw: 0000000000000000 0000000080660066 00000001ffffffff 0000000000000000
     page dumped because: kasan: bad access detected
    
     Memory state around the buggy address:
     ffff888101e02980: fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc
     ffff888101e02a00: 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc 00
     >ffff888101e02a80: fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc 04 fc
                                                                ^
     ffff888101e02b00: fc fc fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc
     ffff888101e02b80: fc fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc
     ==================================================================
    
    Fixes: 413a4a6b0b55 "cachefiles: Fix volume coherency attribute"
    Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: linux-cachefs@redhat.com
    Link: https://lore.kernel.org/r/20220405134649.6579-1-dwysocha@redhat.com/ # v1
    Link: https://lore.kernel.org/r/20220405142810.8208-1-dwysocha@redhat.com/ # Incorrect v2
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b2055abafd3d4ee0376fb3eed5cae866316995a1
Author: Jeffle Xu <jefflexu@linux.alibaba.com>
Date:   Wed Mar 30 17:47:59 2022 +0800

    cachefiles: unmark inode in use in error path
    
    [ Upstream commit ea5dc046127e857a7873ae55fd57c866e9e86fb2 ]
    
    Unmark inode in use if error encountered. If the in-use flag leakage
    occurs in cachefiles_open_file(), Cachefiles will complain "Inode
    already in use" when later another cookie with the same index key is
    looked up.
    
    If the in-use flag leakage occurs in cachefiles_create_tmpfile(), though
    the "Inode already in use" warning won't be triggered, fix the leakage
    anyway.
    
    Reported-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Fixes: 1f08c925e7a3 ("cachefiles: Implement backing file wrangling")
    Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: linux-cachefs@redhat.com
    Link: https://listman.redhat.com/archives/linux-cachefs/2022-March/006615.html # v1
    Link: https://listman.redhat.com/archives/linux-cachefs/2022-March/006618.html # v2
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 25583da7fb8a672433afc1ee698f6ce8224765db
Author: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date:   Thu Apr 7 11:29:23 2022 -0300

    net/sched: fix initialization order when updating chain 0 head
    
    [ Upstream commit e65812fd22eba32f11abe28cb377cbd64cfb1ba0 ]
    
    Currently, when inserting a new filter that needs to sit at the head
    of chain 0, it will first update the heads pointer on all devices using
    the (shared) block, and only then complete the initialization of the new
    element so that it has a "next" element.
    
    This can lead to a situation that the chain 0 head is propagated to
    another CPU before the "next" initialization is done. When this race
    condition is triggered, packets being matched on that CPU will simply
    miss all other filters, and will flow through the stack as if there were
    no other filters installed. If the system is using OVS + TC, such
    packets will get handled by vswitchd via upcall, which results in much
    higher latency and reordering. For other applications it may result in
    packet drops.
    
    This is reproducible with a tc only setup, but it varies from system to
    system. It could be reproduced with a shared block amongst 10 veth
    tunnels, and an ingress filter mirroring packets to another veth.
    That's because using the last added veth tunnel to the shared block to
    do the actual traffic, it makes the race window bigger and easier to
    trigger.
    
    The fix is rather simple, to just initialize the next pointer of the new
    filter instance (tp) before propagating the head change.
    
    The fixes tag is pointing to the original code though this issue should
    only be observed when using it unlocked.
    
    Fixes: 2190d1d0944f ("net: sched: introduce helpers to work with filter chains")
    Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
    Reviewed-by: Davide Caratti <dcaratti@redhat.com>
    Link: https://lore.kernel.org/r/b97d5f4eaffeeb9d058155bcab63347527261abf.1649341369.git.marcelo.leitner@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5d4b2cf4fc330937c6d8a6022c9e34f802f9efa5
Author: Xin Long <lucien.xin@gmail.com>
Date:   Thu Apr 7 09:24:22 2022 -0400

    sctp: use the correct skb for security_sctp_assoc_request
    
    [ Upstream commit e2d88f9ce678cd33763826ae2f0412f181251314 ]
    
    Yi Chen reported an unexpected sctp connection abort, and it occurred when
    COOKIE_ECHO is bundled with DATA Fragment by SCTP HW GSO. As the IP header
    is included in chunk->head_skb instead of chunk->skb, it failed to check
    IP header version in security_sctp_assoc_request().
    
    According to Ondrej, SELinux only looks at IP header (address and IPsec
    options) and XFRM state data, and these are all included in head_skb for
    SCTP HW GSO packets. So fix it by using head_skb when calling
    security_sctp_assoc_request() in processing COOKIE_ECHO.
    
    v1->v2:
      - As Ondrej noticed, chunk->head_skb should also be used for
        security_sctp_assoc_established() in sctp_sf_do_5_1E_ca().
    
    Fixes: e215dab1c490 ("security: call security_sctp_assoc_request in sctp_sf_do_5_1D_ce")
    Reported-by: Yi Chen <yiche@redhat.com>
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
    Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Link: https://lore.kernel.org/r/71becb489e51284edf0c11fc15246f4ed4cef5b6.1649337862.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0309ab69e6fdddd6e2da1a607254376f87873f5f
Author: Vadim Pasternak <vadimp@nvidia.com>
Date:   Thu Apr 7 10:07:03 2022 +0300

    mlxsw: i2c: Fix initialization error flow
    
    [ Upstream commit d452088cdfd5a4ad9d96d847d2273fe958d6339b ]
    
    Add mutex_destroy() call in driver initialization error flow.
    
    Fixes: 6882b0aee180f ("mlxsw: Introduce support for I2C bus")
    Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://lore.kernel.org/r/20220407070703.2421076-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 01ab2d123e03736f73fe344301f9f1a52cab1889
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Thu Apr 7 19:55:38 2022 +0300

    net: mdio: don't defer probe forever if PHY IRQ provider is missing
    
    [ Upstream commit 74befa447e6839cdd90ed541159ec783726946f9 ]
    
    When a driver for an interrupt controller is missing, of_irq_get()
    returns -EPROBE_DEFER ad infinitum, causing
    fwnode_mdiobus_phy_device_register(), and ultimately, the entire
    of_mdiobus_register() call, to fail. In turn, any phy_connect() call
    towards a PHY on this MDIO bus will also fail.
    
    This is not what is expected to happen, because the PHY library falls
    back to poll mode when of_irq_get() returns a hard error code, and the
    MDIO bus, PHY and attached Ethernet controller work fine, albeit
    suboptimally, when the PHY library polls for link status. However,
    -EPROBE_DEFER has special handling given the assumption that at some
    point probe deferral will stop, and the driver for the supplier will
    kick in and create the IRQ domain.
    
    Reasons for which the interrupt controller may be missing:
    
    - It is not yet written. This may happen if a more recent DT blob (with
      an interrupt-parent for the PHY) is used to boot an old kernel where
      the driver didn't exist, and that kernel worked with the
      vintage-correct DT blob using poll mode.
    
    - It is compiled out. Behavior is the same as above.
    
    - It is compiled as a module. The kernel will wait for a number of
      seconds specified in the "deferred_probe_timeout" boot parameter for
      user space to load the required module. The current default is 0,
      which times out at the end of initcalls. It is possible that this
      might cause regressions unless users adjust this boot parameter.
    
    The proposed solution is to use the driver_deferred_probe_check_state()
    helper function provided by the driver core, which gives up after some
    -EPROBE_DEFER attempts, taking "deferred_probe_timeout" into consideration.
    The return code is changed from -EPROBE_DEFER into -ENODEV or
    -ETIMEDOUT, depending on whether the kernel is compiled with support for
    modules or not.
    
    Fixes: 66bdede495c7 ("of_mdio: Fix broken PHY IRQ in case of probe deferral")
    Suggested-by: Robin Murphy <robin.murphy@arm.com>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Link: https://lore.kernel.org/r/20220407165538.4084809-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9b2406124cb717c9da7ada1a51e28d2e5b339b6f
Author: Mateusz Palczewski <mateusz.palczewski@intel.com>
Date:   Thu Mar 24 14:19:15 2022 +0100

    Revert "iavf: Fix deadlock occurrence during resetting VF interface"
    
    [ Upstream commit 7d59706dbef8de83b3662026766507bc494223d7 ]
    
    This change caused a regression with resetting while changing network
    namespaces. By clearing the IFF_UP flag, the kernel now thinks it has
    fully closed the device.
    
    This reverts commit 0cc318d2e8408bc0ffb4662a0c3e5e57005ac6ff.
    
    Fixes: 0cc318d2e840 ("iavf: Fix deadlock occurrence during resetting VF interface")
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d08d2fb6d99d82da1c63aba5c0d1c6f237e150f3
Author: Alexander Lobakin <alexandr.lobakin@intel.com>
Date:   Mon Apr 4 18:15:09 2022 +0200

    ice: arfs: fix use-after-free when freeing @rx_cpu_rmap
    
    [ Upstream commit d7442f512b71fc63a99c8a801422dde4fbbf9f93 ]
    
    The CI testing bots triggered the following splat:
    
    [  718.203054] BUG: KASAN: use-after-free in free_irq_cpu_rmap+0x53/0x80
    [  718.206349] Read of size 4 at addr ffff8881bd127e00 by task sh/20834
    [  718.212852] CPU: 28 PID: 20834 Comm: sh Kdump: loaded Tainted: G S      W IOE     5.17.0-rc8_nextqueue-devqueue-02643-g23f3121aca93 #1
    [  718.219695] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0012.070720200218 07/07/2020
    [  718.223418] Call Trace:
    [  718.227139]
    [  718.230783]  dump_stack_lvl+0x33/0x42
    [  718.234431]  print_address_description.constprop.9+0x21/0x170
    [  718.238177]  ? free_irq_cpu_rmap+0x53/0x80
    [  718.241885]  ? free_irq_cpu_rmap+0x53/0x80
    [  718.245539]  kasan_report.cold.18+0x7f/0x11b
    [  718.249197]  ? free_irq_cpu_rmap+0x53/0x80
    [  718.252852]  free_irq_cpu_rmap+0x53/0x80
    [  718.256471]  ice_free_cpu_rx_rmap.part.11+0x37/0x50 [ice]
    [  718.260174]  ice_remove_arfs+0x5f/0x70 [ice]
    [  718.263810]  ice_rebuild_arfs+0x3b/0x70 [ice]
    [  718.267419]  ice_rebuild+0x39c/0xb60 [ice]
    [  718.270974]  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
    [  718.274472]  ? ice_init_phy_user_cfg+0x360/0x360 [ice]
    [  718.278033]  ? delay_tsc+0x4a/0xb0
    [  718.281513]  ? preempt_count_sub+0x14/0xc0
    [  718.284984]  ? delay_tsc+0x8f/0xb0
    [  718.288463]  ice_do_reset+0x92/0xf0 [ice]
    [  718.292014]  ice_pci_err_resume+0x91/0xf0 [ice]
    [  718.295561]  pci_reset_function+0x53/0x80
    <...>
    [  718.393035] Allocated by task 690:
    [  718.433497] Freed by task 20834:
    [  718.495688] Last potentially related work creation:
    [  718.568966] The buggy address belongs to the object at ffff8881bd127e00
                    which belongs to the cache kmalloc-96 of size 96
    [  718.574085] The buggy address is located 0 bytes inside of
                    96-byte region [ffff8881bd127e00, ffff8881bd127e60)
    [  718.579265] The buggy address belongs to the page:
    [  718.598905] Memory state around the buggy address:
    [  718.601809]  ffff8881bd127d00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
    [  718.604796]  ffff8881bd127d80: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
    [  718.607794] >ffff8881bd127e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
    [  718.610811]                    ^
    [  718.613819]  ffff8881bd127e80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
    [  718.617107]  ffff8881bd127f00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
    
    This is due to that free_irq_cpu_rmap() is always being called
    *after* (devm_)free_irq() and thus it tries to work with IRQ descs
    already freed. For example, on device reset the driver frees the
    rmap right before allocating a new one (the splat above).
    Make rmap creation and freeing function symmetrical with
    {request,free}_irq() calls i.e. do that on ifup/ifdown instead
    of device probe/remove/resume. These operations can be performed
    independently from the actual device aRFS configuration.
    Also, make sure ice_vsi_free_irq() clears IRQ affinity notifiers
    only when aRFS is disabled -- otherwise, CPU rmap sets and clears
    its own and they must not be touched manually.
    
    Fixes: 28bf26724fdb0 ("ice: Implement aRFS")
    Co-developed-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
    Tested-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 27b6d0cf568178c4a02e90ab5f2728d3b6509a88
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Fri Apr 1 06:25:17 2022 +0000

    cifs: release cached dentries only if mount is complete
    
    [ Upstream commit d788e51636462e61c6883f7d96b07b06bc291650 ]
    
    During cifs_kill_sb, we first dput all the dentries that we have cached.
    However this function can also get called for mount failures.
    So dput the cached dentries only if the filesystem mount is complete.
    i.e. cifs_sb->root is populated.
    
    Fixes: 5e9c89d43fa6 ("cifs: Grab a reference for the dentry of the cached directory during the lifetime of the cache")
    Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
    Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 610bb184d4e7b6a91f742ecddcc1169bf6b39b42
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Mar 19 16:21:09 2022 -0700

    gpiolib: acpi: use correct format characters
    
    [ Upstream commit 213d266ebfb1621aab79cfe63388facc520a1381 ]
    
    When compiling with -Wformat, clang emits the following warning:
    
      gpiolib-acpi.c:393:4: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]
                            pin);
                            ^~~
    
    So warning that '%hhX' is paired with an 'int' is all just completely
    mindless and wrong. Sadly, I can see a different bogus warning reason
    why people would want to use '%02hhX'.
    
    Again, the *sane* thing from a human perspective is to use '%02X. But
    if the compiler doesn't do any range analysis at all, it could decide
    that "Oh, that print format could need up to 8 bytes of space in the
    result". Using '%02hhX' would cut that down to two.
    
    And since we use
    
            char ev_name[5];
    
    and currently use "_%c%02hhX" as the format string, even a compiler
    that doesn't notice that "pin <= 255" test that guards this all will
    go "OK, that's at most 4 bytes and the final NUL termination, so it's
    fine".
    
    While a compiler - like gcc - that only sees that the original source
    of the 'pin' value is a 'unsigned short' array, and then doesn't take
    the "pin <= 255" into account, will warn like this:
    
      gpiolib-acpi.c: In function 'acpi_gpiochip_request_interrupt':
      gpiolib-acpi.c:206:24: warning: '%02X' directive writing between 2 and 4 bytes into a region of size 3 [-Wformat-overflow=]
           sprintf(ev_name, "_%c%02X",
                                ^~~~
      gpiolib-acpi.c:206:20: note: directive argument in the range [0, 65535]
    
    because gcc isn't being very good at that argument range analysis either.
    
    In other words, the original use of 'hhx' was bogus to begin with, and
    due to *another* compiler warning being bad, and we had that bad code
    being written back in 2016 to work around _that_ compiler warning
    (commit e40a3ae1f794: "gpio: acpi: work around false-positive
    -Wstring-overflow warning").
    
    Sadly, two different bad compiler warnings together does not make for
    one good one.
    
    It just makes for even more pain.
    
    End result: I think the simplest and cleanest option is simply the
    proposed change which undoes that '%hhX' change for gcc, and replaces
    it with just using a slightly bigger stack allocation. It's not like
    a 5-byte allocation is in any way likely to have saved any actual stack,
    since all the other variables in that function are 'int' or bigger.
    
    False-positive compiler warnings really do make people write worse
    code, and that's a problem. But on a scale of bad code, I feel that
    extending the buffer trivially is better than adding a pointless cast
    that literally makes no sense.
    
    At least in this case the end result isn't unreadable or buggy. We've
    had several cases of bad compiler warnings that caused changes that
    were actually horrendously wrong.
    
    Fixes: e40a3ae1f794 ("gpio: acpi: work around false-positive -Wstring-overflow warning")
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 46bc359fec0c6d87b70d7a008bcd9a5e30dd6f27
Author: Guillaume Nault <gnault@redhat.com>
Date:   Wed Apr 6 16:18:54 2022 +0200

    veth: Ensure eth header is in skb's linear part
    
    [ Upstream commit 726e2c5929de841fdcef4e2bf995680688ae1b87 ]
    
    After feeding a decapsulated packet to a veth device with act_mirred,
    skb_headlen() may be 0. But veth_xmit() calls __dev_forward_skb(),
    which expects at least ETH_HLEN byte of linear data (as
    __dev_forward_skb2() calls eth_type_trans(), which pulls ETH_HLEN bytes
    unconditionally).
    
    Use pskb_may_pull() to ensure veth_xmit() respects this constraint.
    
    kernel BUG at include/linux/skbuff.h:2328!
    RIP: 0010:eth_type_trans+0xcf/0x140
    Call Trace:
     <IRQ>
     __dev_forward_skb2+0xe3/0x160
     veth_xmit+0x6e/0x250 [veth]
     dev_hard_start_xmit+0xc7/0x200
     __dev_queue_xmit+0x47f/0x520
     ? skb_ensure_writable+0x85/0xa0
     ? skb_mpls_pop+0x98/0x1c0
     tcf_mirred_act+0x442/0x47e [act_mirred]
     tcf_action_exec+0x86/0x140
     fl_classify+0x1d8/0x1e0 [cls_flower]
     ? dma_pte_clear_level+0x129/0x1a0
     ? dma_pte_clear_level+0x129/0x1a0
     ? prb_fill_curr_block+0x2f/0xc0
     ? skb_copy_bits+0x11a/0x220
     __tcf_classify+0x58/0x110
     tcf_classify_ingress+0x6b/0x140
     __netif_receive_skb_core.constprop.0+0x47d/0xfd0
     ? __iommu_dma_unmap_swiotlb+0x44/0x90
     __netif_receive_skb_one_core+0x3d/0xa0
     netif_receive_skb+0x116/0x170
     be_process_rx+0x22f/0x330 [be2net]
     be_poll+0x13c/0x370 [be2net]
     __napi_poll+0x2a/0x170
     net_rx_action+0x22f/0x2f0
     __do_softirq+0xca/0x2a8
     __irq_exit_rcu+0xc1/0xe0
     common_interrupt+0x83/0xa0
    
    Fixes: e314dbdc1c0d ("[NET]: Virtual ethernet device driver.")
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 52a34db0116bc74d5533f6b3b4460ef08dcf0c28
Author: Vlad Buslov <vladbu@nvidia.com>
Date:   Wed Apr 6 14:22:41 2022 +0300

    net/sched: flower: fix parsing of ethertype following VLAN header
    
    [ Upstream commit 2105f700b53c24aa48b65c15652acc386044d26a ]
    
    A tc flower filter matching TCA_FLOWER_KEY_VLAN_ETH_TYPE is expected to
    match the L2 ethertype following the first VLAN header, as confirmed by
    linked discussion with the maintainer. However, such rule also matches
    packets that have additional second VLAN header, even though filter has
    both eth_type and vlan_ethtype set to "ipv4". Looking at the code this
    seems to be mostly an artifact of the way flower uses flow dissector.
    First, even though looking at the uAPI eth_type and vlan_ethtype appear
    like a distinct fields, in flower they are all mapped to the same
    key->basic.n_proto. Second, flow dissector skips following VLAN header as
    no keys for FLOW_DISSECTOR_KEY_CVLAN are set and eventually assigns the
    value of n_proto to last parsed header. With these, such filters ignore any
    headers present between first VLAN header and first "non magic"
    header (ipv4 in this case) that doesn't result
    FLOW_DISSECT_RET_PROTO_AGAIN.
    
    Fix the issue by extending flow dissector VLAN key structure with new
    'vlan_eth_type' field that matches first ethertype following previously
    parsed VLAN header. Modify flower classifier to set the new
    flow_dissector_key_vlan->vlan_eth_type with value obtained from
    TCA_FLOWER_KEY_VLAN_ETH_TYPE/TCA_FLOWER_KEY_CVLAN_ETH_TYPE uAPIs.
    
    Link: https://lore.kernel.org/all/Yjhgi48BpTGh6dig@nanopsycho/
    Fixes: 9399ae9a6cb2 ("net_sched: flower: Add vlan support")
    Fixes: d64efd0926ba ("net/sched: flower: Add supprt for matching on QinQ vlan headers")
    Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c2456f470eea3bd06574d988bf6089e7c3f4c5cc
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Wed Apr 6 13:51:32 2022 -0400

    SUNRPC: Fix the svc_deferred_event trace class
    
    [ Upstream commit 4d5004451ab2218eab94a30e1841462c9316ba19 ]
    
    Fix a NULL deref crash that occurs when an svc_rqst is deferred
    while the sunrpc tracing subsystem is enabled. svc_revisit() sets
    dr->xprt to NULL, so it can't be relied upon in the tracepoint to
    provide the remote's address.
    
    Unfortunately we can't revert the "svc_deferred_class" hunk in
    commit ece200ddd54b ("sunrpc: Save remote presentation address in
    svc_xprt for trace events") because there is now a specific check
    of event format specifiers for unsafe dereferences. The warning
    that check emits is:
    
      event svc_defer_recv has unsafe dereference of argument 1
    
    A "%pISpc" format specifier with a "struct sockaddr *" is indeed
    flagged by this check.
    
    Instead, take the brute-force approach used by the svcrdma_qp_error
    tracepoint. Convert the dr::addr field into a presentation address
    in the TP_fast_assign() arm of the trace event, and store that as
    a string. This fix can be backported to -stable kernels.
    
    In the meantime, commit c6ced22997ad ("tracing: Update print fmt
    check to handle new __get_sockaddr() macro") is now in v5.18, so
    this wonky fix can be replaced with __sockaddr() and friends
    properly during the v5.19 merge window.
    
    Fixes: ece200ddd54b ("sunrpc: Save remote presentation address in svc_xprt for trace events")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 976e8fd228929dc953c1cafa7ddd68093b189f99
Author: Reiji Watanabe <reijiw@google.com>
Date:   Mon Mar 28 20:19:23 2022 -0700

    KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs
    
    [ Upstream commit 26bf74bd9f6ff0f1545b4f0c92a37c232d076014 ]
    
    KVM allows userspace to configure either all EL1 32bit or 64bit vCPUs
    for a guest.  At vCPU reset, vcpu_allowed_register_width() checks
    if the vcpu's register width is consistent with all other vCPUs'.
    Since the checking is done even against vCPUs that are not initialized
    (KVM_ARM_VCPU_INIT has not been done) yet, the uninitialized vCPUs
    are erroneously treated as 64bit vCPU, which causes the function to
    incorrectly detect a mixed-width VM.
    
    Introduce KVM_ARCH_FLAG_EL1_32BIT and KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED
    bits for kvm->arch.flags.  A value of the EL1_32BIT bit indicates that
    the guest needs to be configured with all 32bit or 64bit vCPUs, and
    a value of the REG_WIDTH_CONFIGURED bit indicates if a value of the
    EL1_32BIT bit is valid (already set up). Values in those bits are set at
    the first KVM_ARM_VCPU_INIT for the guest based on KVM_ARM_VCPU_EL1_32BIT
    configuration for the vCPU.
    
    Check vcpu's register width against those new bits at the vcpu's
    KVM_ARM_VCPU_INIT (instead of against other vCPUs' register width).
    
    Fixes: 66e94d5cafd4 ("KVM: arm64: Prevent mixed-width VM creation")
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    Reviewed-by: Oliver Upton <oupton@google.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220329031924.619453-2-reijiw@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2f321b588f9830ddf9926bbf8ab58e0095634925
Author: Marc Zyngier <maz@kernel.org>
Date:   Fri Mar 11 17:39:47 2022 +0000

    KVM: arm64: Generalise VM features into a set of flags
    
    [ Upstream commit 06394531b425794dc56f3d525b7994d25b8072f7 ]
    
    We currently deal with a set of booleans for VM features,
    while they could be better represented as set of flags
    contained in an unsigned long, similarily to what we are
    doing on the CPU side.
    
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    [Oliver: Flag-ify the 'ran_once' boolean]
    Signed-off-by: Oliver Upton <oupton@google.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220311174001.605719-2-oupton@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e3bb7397be2d7763d6ee2e4b98452ed94abf83eb
Author: Kyle Copperfield <kmcopper@danwin1210.me>
Date:   Sat Nov 20 13:23:02 2021 +0100

    media: rockchip/rga: do proper error checking in probe
    
    [ Upstream commit 6150f276073a1480030242a7e006a89e161d6cd6 ]
    
    The latest fix for probe error handling contained a typo that causes
    probing to fail with the following message:
    
      rockchip-rga: probe of ff680000.rga failed with error -12
    
    This patch fixes the typo.
    
    Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
    Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
    Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>
    Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@oracle.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 fb8224e8c1efa36280e88bb83198760e187218ba
Author: Cristian Marussi <cristian.marussi@arm.com>
Date:   Fri Mar 18 09:28:13 2022 +0000

    firmware: arm_scmi: Fix sorting of retrieved clock rates
    
    [ Upstream commit 23274739a5b6166f74d8d9cb5243d7bf6b46aab9 ]
    
    During SCMI Clock protocol initialization, after having retrieved from the
    SCMI platform all the available discrete rates for a specific clock, the
    clock rates array is sorted, unfortunately using a pointer to its end as
    a base instead of its start, so that sorting does not work.
    
    Fix invocation of sort() passing as base a pointer to the start of the
    retrieved clock rates array.
    
    Link: https://lore.kernel.org/r/20220318092813.49283-1-cristian.marussi@arm.com
    Fixes: dccec73de91d ("firmware: arm_scmi: Keep the discrete clock rates sorted")
    Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b2f0dea90b97dbda16fbd836f022a41974c15491
Author: Anilkumar Kolli <quic_akolli@quicinc.com>
Date:   Thu Mar 31 10:07:57 2022 +0530

    Revert "ath11k: mesh: add support for 256 bitmap in blockack frames in 11ax"
    
    [ Upstream commit 10cb21f4ff3f9cb36d1e1c39bf80426f02f4986a ]
    
    This reverts commit 743b9065fe6348a5f8f5ce04869ce2d701e5e1bc.
    
    The original commit breaks the 256 bitmap in blockack frames in AP
    mode. After reverting the commit the feature works again in both AP and
    mesh modes
    
    Tested-on: IPQ8074 hw2.0 PCI WLAN.HK.2.6.0.1-00786-QCAHKSWPL_SILICONZ-1
    
    Fixes: 743b9065fe63 ("ath11k: mesh: add support for 256 bitmap in blockack frames in 11ax")
    Signed-off-by: Anilkumar Kolli <quic_akolli@quicinc.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/1648701477-16367-1-git-send-email-quic_akolli@quicinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 26a819f03d29fb94a99e34a2dae8990b3f80dd84
Author: Miaoqian Lin <linmq006@gmail.com>
Date:   Wed Mar 9 11:01:43 2022 +0000

    memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
    
    [ Upstream commit 6f296a9665ba5ac68937bf11f96214eb9de81baa ]
    
    The device_node pointer is returned by of_parse_phandle() with refcount
    incremented. We should use of_node_put() on it when done.
    
    Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Link: https://lore.kernel.org/r/20220309110144.22412-1-linmq006@gmail.com
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10bfc4747f1d06e501a830526a239c4265584166
Author: Cristian Marussi <cristian.marussi@arm.com>
Date:   Thu Feb 24 15:24:04 2022 +0000

    firmware: arm_scmi: Remove clear channel call on the TX channel
    
    [ Upstream commit 98f0d68f94ea21541e0050cc64fa108ade779839 ]
    
    On SCMI transports whose channels are based on a shared resource the TX
    channel area has to be acquired by the agent before placing the desired
    command into the channel and it will be then relinquished by the platform
    once the related reply has been made available into the channel.
    On an RX channel the logic is reversed with the platform acquiring the
    channel area and the agent reliquishing it once done by calling the
    scmi_clear_channel() helper.
    
    As a consequence, even in case of error, the agent must never try to clear
    a TX channel from its side: restrict the existing clear channel call on the
    the reply path only to delayed responses since they are indeed coming from
    the RX channel.
    
    Link: https://lore.kernel.org/r/20220224152404.12877-1-cristian.marussi@arm.com
    Fixes: e9b21c96181c ("firmware: arm_scmi: Make .clear_channel optional")
    Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 50a65a53dd90cc6d72271a620378263b0fb21e04
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Thu Mar 31 09:54:01 2022 -0400

    nfsd: Fix a write performance regression
    
    [ Upstream commit 6b8a94332ee4f7d9a8ae0cbac7609f79c212f06c ]
    
    The call to filemap_flush() in nfsd_file_put() is there to ensure that
    we clear out any writes belonging to a NFSv3 client relatively quickly
    and avoid situations where the file can't be evicted by the garbage
    collector. It also ensures that we detect write errors quickly.
    
    The problem is this causes a regression in performance for some
    workloads.
    
    So try to improve matters by deferring writeback until we're ready to
    close the file, and need to detect errors so that we can force the
    client to resend.
    
    Tested-by: Jan Kara <jack@suse.cz>
    Fixes: b6669305d35a ("nfsd: Reduce the number of calls to nfsd_file_gc()")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Link: https://lore.kernel.org/all/20220330103457.r4xrhy2d6nhtouzk@quack3.lan
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 669a87e08afd2470ed6918be86a6c9518fc0adbe
Author: Rob Clark <robdclark@chromium.org>
Date:   Thu Mar 17 11:45:49 2022 -0700

    drm/msm: Add missing put_task_struct() in debugfs path
    
    [ Upstream commit ac3e4f42d5ec459f701743debd9c1ad2f2247402 ]
    
    Fixes: 25faf2f2e065 ("drm/msm: Show process names in gem_describe")
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Link: https://lore.kernel.org/r/20220317184550.227991-1-robdclark@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cf410fb1e06d643bc5c4afa0c096e6461a1d73b0
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:36 2022 +0200

    ALSA: nm256: Don't call card private_free at probe error path
    
    commit f20ae5074dfb38f23b0c07c62bdf8e7254a0acf8 upstream.
    
    The card destructor of nm256 driver does merely stopping the running
    streams, and it's superfluous for the probe error handling.  Moreover,
    calling this via the previous devres change would lead to another
    problem due to the reverse call order.
    
    This patch moves the setup of the private_free callback after the card
    registration, so that it can be used only after fully set up.
    
    Fixes: c19935f04784 ("ALSA: nm256: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-40-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2b8794849a5199aff9cdfaa84c0b303321f06d69
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Apr 13 07:48:08 2022 +0200

    ALSA: memalloc: Add fallback SG-buffer allocations for x86
    
    commit 925ca893b4a65177394581737b95d03fea2660f2 upstream.
    
    The recent change for memory allocator replaced the SG-buffer handling
    helper for x86 with the standard non-contiguous page handler.  This
    works for most cases, but there is a corner case I obviously
    overlooked, namely, the fallback of non-contiguous handler without
    IOMMU.  When the system runs without IOMMU, the core handler tries to
    use the continuous pages with a single SGL entry.  It works nicely for
    most cases, but when the system memory gets fragmented, the large
    allocation may fail frequently.
    
    Ideally the non-contig handler could deal with the proper SG pages,
    it's cumbersome to extend for now.  As a workaround, here we add new
    types for (minimalistic) SG allocations, instead, so that the
    allocator falls back to those types automatically when the allocation
    with the standard API failed.
    
    BTW, one better (but pretty minor) improvement from the previous
    SG-buffer code is that this provides the proper mmap support without
    the PCM's page fault handling.
    
    Fixes: 2c95b92ecd92 ("ALSA: memalloc: Unify x86 SG-buffer handling (take#3)")
    BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2272
    BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1198248
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220413054808.7547-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f55c11973f17bd7ea1937ff1819a4bbf830aaf82
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Apr 7 23:16:57 2022 +0200

    ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb
    
    commit 98c27add5d96485db731a92dac31567b0486cae8 upstream.
    
    In the implicit feedback mode, some parameters are tied between both
    playback and capture streams.  One of the tied parameters is the
    period size, and this can be a problem if the device has different
    number of channels to both streams.  Assume that an application opens
    a playback stream that has an implicit feedback from a capture stream,
    and it allocates up to the max period and buffer size as much as
    possible.  When the capture device supports only more channels than
    the playback, the minimum period and buffer sizes become larger than
    the sizes the playback stream took.  That is, the minimum size will be
    over the max size the driver limits, and PCM core sees as if no
    available configuration is found, returning -EINVAL mercilessly.
    
    For avoiding this problem, we have to look through the counter part of
    audioformat list for each sync ep, and checks the channels.  If more
    channels are found there, we reduce the max period and buffer sizes
    accordingly.
    
    You may wonder that the patch adds only the evaluation of channels
    between streams, and what about other parameters?  Both the format and
    the rate are tied in the implicit fb mode, hence they are always
    identical.
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215792
    Fixes: 5a6c3e11c9c9 ("ALSA: usb-audio: Add hw constraint for implicit fb sync")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220407211657.15087-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f5db7513674be407e84c933b9673b8c6c42f6a56
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:22 2022 +0200

    ALSA: via82xx: Fix the missing snd_card_free() call at probe error
    
    commit 27a0963f9cea5be3c68281f07fe82cdf712ef333 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: afaf99751d0c ("ALSA: via82xx: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-26-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e379d5001a7bc0fd3b17b6ba70e66c231408552
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:21 2022 +0200

    ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error
    
    commit b087a381d7386ec95803222d0d9b1ac499550713 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 2ca6cbde6ad7 ("ALSA: sonicvibes: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-25-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea22def1755043f0cab3df8b420f9e62ed6ccae3
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:25:59 2022 +0200

    ALSA: sc6000: Fix the missing snd_card_free() call at probe error
    
    commit d72458071150b802940204950d0d462ea3c913b1 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 111601ff76e9 ("ALSA: sc6000: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-3-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f9ca7c57b2b0a234334bd0eefa368881dd45faf5
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:20 2022 +0200

    ALSA: rme96: Fix the missing snd_card_free() call at probe error
    
    commit 93b884f8d82f08c7af542703a724cc23cd2d5bfc upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: df06df7cc997 ("ALSA: rme96: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-24-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f3ba6dbe5de42c517d70de34a009af9bcbdc5093
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:34 2022 +0200

    ALSA: rme9652: Fix the missing snd_card_free() call at probe error
    
    commit b2aa4f80693b7841e5ac4eadbd2d8cec56b10a51 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: b1002b2d41c5 ("ALSA: rme9652: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-38-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5d5dd6b5fc88e1a7cb9633b889b303665a47e2f4
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:19 2022 +0200

    ALSA: rme32: Fix the missing snd_card_free() call at probe error
    
    commit 55d2d046b23b9bcb907f6b3e38e52113d55085eb upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 102e6156ded2 ("ALSA: rme32: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-23-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4287f97b619f1c50b85e3f6862a309064318e4c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:18 2022 +0200

    ALSA: riptide: Fix the missing snd_card_free() call at probe error
    
    commit 348f08de55b149e41a05111d1a713c4484e5a426 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 546c201a891e ("ALSA: riptide: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-22-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23c8e4063bce7c09a3ccdbe4b3100930fc3ebd09
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:31 2022 +0200

    ALSA: oxygen: Fix the missing snd_card_free() call at probe error
    
    commit 6ebc16e206aa82ddb0450c907865c55bcb7c0f43 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 596ae97ab0ce ("ALSA: oxygen: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-35-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a7220fada8e645b93c48daf22e4c46eba0a3f2b9
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:17 2022 +0200

    ALSA: maestro3: Fix the missing snd_card_free() call at probe error
    
    commit ae86bf5c2a8d81418eadf1c31dd9253b609e3093 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 5c0939253c3c ("ALSA: maestro3: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-21-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 562e3677d82f1e6ca905eba1c14cf68adc83b55f
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:30 2022 +0200

    ALSA: lx6464es: Fix the missing snd_card_free() call at probe error
    
    commit 60797a21dd8360a99ba797f8ca587087c07bb54c upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: 6f16c19b115e ("ALSA: lx6464es: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-34-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f37ae81084e31d4a9f1fb7698ce61036526311da
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:26 2022 +0200

    ALSA: lola: Fix the missing snd_card_free() call at probe error
    
    commit d04e84b9817c652002f0ee9b42059d41493e9118 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 098fe3d6e775 ("ALSA: lola: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-30-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 94645355d4d721c1d2aa97d3be36624c442ebf7a
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:16 2022 +0200

    ALSA: korg1212: Fix the missing snd_card_free() call at probe error
    
    commit c01b723a56ce18ae66ff18c5803942badc15fbcd upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-20-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 03ca40898988cf13772968de5372e8fe6554e74d
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:23 2022 +0200

    ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error
    
    commit 5e154dfb4f9995096aa6d342df75040ae802c17e upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 854577ac2aea ("ALSA: x86: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-27-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1676a2369261c5c8812c9da694e0349d0c22ce3e
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:15 2022 +0200

    ALSA: intel8x0: Fix the missing snd_card_free() call at probe error
    
    commit 71b21f5f8970a87f034138454ebeff0608d24875 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 7835e0901e24 ("ALSA: intel8x0: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-19-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 13228561f07a3614da650a872e7250c8c7beaa88
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:14 2022 +0200

    ALSA: ice1724: Fix the missing snd_card_free() call at probe error
    
    commit 4a850a0079ce601c0c4016f4edb7d618e811ed7d upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 314f6dbb1f33 ("ALSA: ice1724: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-18-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bfd47ecf65fcc7fba85a1b51b3676c91e66cbc7a
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:33 2022 +0200

    ALSA: hdspm: Fix the missing snd_card_free() call at probe error
    
    commit eab521aebcdeb1c801009503e3a7f8989e3c6b36 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: 0195ca5fd1f4 ("ALSA: hdspm: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-37-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9460dee4b0f09bceef46541f0d35ec025d70ccd4
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:32 2022 +0200

    ALSA: hdsp: Fix the missing snd_card_free() call at probe error
    
    commit e2263f0bf7443a200a5c1c418baefd92f1674600 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: d136b8e54f92 ("ALSA: hdsp: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-36-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e8ed59d02ec31256e5eee0b8896cdabedbd574cb
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:25:58 2022 +0200

    ALSA: galaxy: Fix the missing snd_card_free() call at probe error
    
    commit 10b1881a97be240126891cb384bd3bc1869f52d8 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 35a245ec0619 ("ALSA: galaxy: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-2-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a3983fff3ad39188fe854b14ba5154b65d928534
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:13 2022 +0200

    ALSA: fm801: Fix the missing snd_card_free() call at probe error
    
    commit 7f611274a3d1657a67b3fa8cd0cec1dee00e02b4 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 47c413395376 ("ALSA: fm801: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-17-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d8befe75846025fa88ca88eac8c5ee905dd0c5f6
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:12 2022 +0200

    ALSA: es1968: Fix the missing snd_card_free() call at probe error
    
    commit de9a01bc95a9e5e36d0659521bb04579053d8566 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: a7b4cbfdc701 ("ALSA: es1968: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-16-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 798ea435de5ce28eda55284560420cac3348217c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:11 2022 +0200

    ALSA: es1938: Fix the missing snd_card_free() call at probe error
    
    commit bc22628591e5913e67edb3c2a89b97849e30a8f8 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 08e9d3ab4cc1 ("ALSA: es1938: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-15-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d616df9f5340ff6c931e0b8234477e49b0cae30
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:10 2022 +0200

    ALSA: ens137x: Fix the missing snd_card_free() call at probe error
    
    commit c2dc46932d117a1505f589ad1db3095aa6789058 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 10ed6eaf9d72 ("ALSA: ens137x: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-14-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ece002d6810d1d971238deb72d2c92328566c9e8
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:09 2022 +0200

    ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error
    
    commit f37019b6bfe2e13cc536af0e6a42ed62005392ae upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 2b377c6b6012 ("ALSA: emu10k1x: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-13-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 394fb7149a1699a1e2f84c53253bd5db617a5aa5
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 11:31:41 2022 +0200

    ALSA: echoaudio: Fix the missing snd_card_free() call at probe error
    
    commit 313c7e57035125cb7533b53ddd0bc7aa562b433c upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 9c211bf392bb ("ALSA: echoaudio: Allocate resources with device-managed APIs")
    Reported-and-tested-by: Zheyu Ma <zheyuma97@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/CAMhUBjm2AdyEZ_-EgexdNDN7SvY4f89=4=FwAL+c0Mg0O+X50A@mail.gmail.com
    Link: https://lore.kernel.org/r/20220412093141.8008-3-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47379f6216d70815b3620c6b1404b34cd85efc32
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:08 2022 +0200

    ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error
    
    commit 2a56314798e0227cf51e3d1d184a419dc07bc173 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    Fixes: 5eba4c646dfe ("ALSA: cs5535audio: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-12-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 70213059098d6fa0f8a7a28bfe748bf81d61a1b3
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:07 2022 +0200

    ALSA: cs4281: Fix the missing snd_card_free() call at probe error
    
    commit 9bf5ed9a4e623583f15202d99f4521bc39050f61 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 99041fea70d0 ("ALSA: cs4281: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-11-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d678e43d53e28a937bbf248e5811f50653d5e25c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:29 2022 +0200

    ALSA: cmipci: Fix the missing snd_card_free() call at probe error
    
    commit a59396b1c11823c69c31621198c04def17f3a869 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: 87e082ad84a7 ("ALSA: cmipci: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-33-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1858c5a7b05fdf6e719b93f8325bef68a91a069
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:06 2022 +0200

    ALSA: ca0106: Fix the missing snd_card_free() call at probe error
    
    commit c79442cc5a38e46597bc647128c8f1de62d80020 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 1656fa6ea258 ("ALSA: ca0106: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-10-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 764d52675f270da85f6449bc00aba448ead71aae
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:25 2022 +0200

    ALSA: bt87x: Fix the missing snd_card_free() call at probe error
    
    commit f0438155273f057fec9818bc9d1b782ba35cf6a1 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 9e80ed64a006 ("ALSA: bt87x: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-29-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5b6f1683e81125b8050da7725b8a8c2d880cc343
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:05 2022 +0200

    ALSA: azt3328: Fix the missing snd_card_free() call at probe error
    
    commit 49fe36e1c02cb06f66689c888e4e767c31cd259d upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 8c5823ef31e1 ("ALSA: azt3328: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-9-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53f87b1715d8a7618f34b26bc6acb1cedbd51f79
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:28 2022 +0200

    ALSA: aw2: Fix the missing snd_card_free() call at probe error
    
    commit bf4067e8a19eae67c45659a956c361d59251ba57 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: 33631012cd06 ("ALSA: aw2: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-32-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ca5b8e20b4268fce80effcaf3f7e05c69e94e2a3
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:04 2022 +0200

    ALSA: au88x0: Fix the missing snd_card_free() call at probe error
    
    commit b093de145bc8769c6e9207947afad9efe102f4f6 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: e44b5b440609 ("ALSA: au88x0: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-8-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c329e71109533293ea7419df6f70cb087ec0806
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:03 2022 +0200

    ALSA: atiixp: Fix the missing snd_card_free() call at probe error
    
    commit 48e8adde8d1c586c799dab123fc1ebc8b8db620f upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 86bde74dbf09 ("ALSA: atiixp: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-7-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cb35de9143b45e255ad031f9908e581eed324be8
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:02 2022 +0200

    ALSA: als4000: Fix the missing snd_card_free() call at probe error
    
    commit d616a0246da88d811f9f4c3aa83003c05efd3af0 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 0e175f665960 ("ALSA: als4000: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-6-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit adc2b39a4caa6186861dcd39795dd0b8b08a5038
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:27 2022 +0200

    ALSA: als300: Fix the missing snd_card_free() call at probe error
    
    commit ab8bce9da6102c575c473c053672547589bc4c59 upstream.
    
    The previous cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() manually on the error
    from the probe callback.
    
    Fixes: 21a9314cf93b ("ALSA: als300: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-31-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a0742044e74223f6598505d353e36fa2e23600a
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:01 2022 +0200

    ALSA: ali5451: Fix the missing snd_card_free() call at probe error
    
    commit 19401a9441236cfbbbeb1bef4ef4c8668db45dfc upstream.
    
    The recent cleanup with devres may lead to the incorrect release
    orders at the probe error handling due to the devres's nature.  Until
    we register the card, snd_card_free() has to be called at first for
    releasing the stuff properly when the driver tries to manage and
    release the stuff via card->private_free().
    
    This patch fixes it by calling snd_card_free() on the error from the
    probe callback using a new helper function.
    
    Fixes: 1f0819979248 ("ALSA: ali5451: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-5-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b1beb1d712b1f56e2df368a17e8680c3ad1ec09
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 12:26:24 2022 +0200

    ALSA: sis7019: Fix the missing error handling
    
    commit 2236a3243ff8291e97c70097dd11a0fdb8904380 upstream.
    
    The previous cleanup with devres forgot to replace the snd_card_free()
    call with the devm version.  Moreover, it still needs the manual call
    of snd_card_free() at the probe error path, otherwise the reverse
    order of the releases may happen.  This patch addresses those issues.
    
    Fixes: 499ddc16394c ("ALSA: sis7019: Allocate resources with device-managed APIs")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412102636.16000-28-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d0f475336f7d3d3b5a155a427e02021f695ef4ff
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 12 11:31:40 2022 +0200

    ALSA: core: Add snd_card_free_on_error() helper
    
    commit fee2b871d8d6389c9b4bdf9346a99ccc1c98c9b8 upstream.
    
    This is a small helper function to handle the error path more easily
    when an error happens during the probe for the device with the
    device-managed card.  Since devres releases in the reverser order of
    the creations, usually snd_card_free() gets called at the last in the
    probe error path unless it already reached snd_card_register() calls.
    Due to this nature, when a driver expects the resource releases in
    card->private_free, this might be called too lately.
    
    As a workaround, one should call the probe like:
    
     static int __some_probe(...) { // do real probe.... }
    
     static int some_probe(...)
     {
            return snd_card_free_on_error(dev, __some_probe(dev, ...));
     }
    
    so that the snd_card_free() is called explicitly at the beginning of
    the error path from the probe.
    
    This function will be used in the upcoming fixes to address the
    regressions by devres usages.
    
    Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220412093141.8008-2-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1cb572a8477f022b5baabd0a7e701e47e9e5b040
Author: Naohiro Aota <naohiro.aota@wdc.com>
Date:   Tue Mar 22 18:11:33 2022 +0900

    btrfs: return allocated block group from do_chunk_alloc()
    
    commit 820c363bd526ec8e133e4b84e6ad1fda12023b4b upstream.
    
    Return the allocated block group from do_chunk_alloc(). This is a
    preparation patch for the next patch.
    
    CC: stable@vger.kernel.org # 5.16+
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db50c6d351ac2ffa19cdc0586e3d61dcf2443ef2
Author: Dennis Zhou <dennis@kernel.org>
Date:   Thu Mar 31 14:58:28 2022 -0700

    btrfs: fix btrfs_submit_compressed_write cgroup attribution
    
    commit acee08aaf6d158d03668dc82b0a0eef41100531b upstream.
    
    This restores the logic from commit 46bcff2bfc5e ("btrfs: fix compressed
    write bio blkcg attribution") which added cgroup attribution to btrfs
    writeback. It also adds back the REQ_CGROUP_PUNT flag for these ios.
    
    Fixes: 91507240482e ("btrfs: determine stripe boundary at bio allocation time in btrfs_submit_compressed_write")
    CC: stable@vger.kernel.org # 5.16+
    Signed-off-by: Dennis Zhou <dennis@kernel.org>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a04d37ddfe4be431b9e52e8504490376ab0a39a4
Author: Naohiro Aota <naohiro.aota@wdc.com>
Date:   Mon Mar 28 21:32:05 2022 +0900

    btrfs: release correct delalloc amount in direct IO write path
    
    commit 6d82ad13c4110e73c7b0392f00534a1502a1b520 upstream.
    
    Running generic/406 causes the following WARNING in btrfs_destroy_inode()
    which tells there are outstanding extents left.
    
    In btrfs_get_blocks_direct_write(), we reserve a temporary outstanding
    extents with btrfs_delalloc_reserve_metadata() (or indirectly from
    btrfs_delalloc_reserve_space(()). We then release the outstanding extents
    with btrfs_delalloc_release_extents(). However, the "len" can be modified
    in the COW case, which releases fewer outstanding extents than expected.
    
    Fix it by calling btrfs_delalloc_release_extents() for the original length.
    
    To reproduce the warning, the filesystem should be 1 GiB.  It's
    triggering a short-write, due to not being able to allocate a large
    extent and instead allocating a smaller one.
    
      WARNING: CPU: 0 PID: 757 at fs/btrfs/inode.c:8848 btrfs_destroy_inode+0x1e6/0x210 [btrfs]
      Modules linked in: btrfs blake2b_generic xor lzo_compress
      lzo_decompress raid6_pq zstd zstd_decompress zstd_compress xxhash zram
      zsmalloc
      CPU: 0 PID: 757 Comm: umount Not tainted 5.17.0-rc8+ #101
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS d55cb5a 04/01/2014
      RIP: 0010:btrfs_destroy_inode+0x1e6/0x210 [btrfs]
      RSP: 0018:ffffc9000327bda8 EFLAGS: 00010206
      RAX: 0000000000000000 RBX: ffff888100548b78 RCX: 0000000000000000
      RDX: 0000000000026900 RSI: 0000000000000000 RDI: ffff888100548b78
      RBP: ffff888100548940 R08: 0000000000000000 R09: ffff88810b48aba8
      R10: 0000000000000001 R11: ffff8881004eb240 R12: ffff88810b48a800
      R13: ffff88810b48ec08 R14: ffff88810b48ed00 R15: ffff888100490c68
      FS:  00007f8549ea0b80(0000) GS:ffff888237c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f854a09e733 CR3: 000000010a2e9003 CR4: 0000000000370eb0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       destroy_inode+0x33/0x70
       dispose_list+0x43/0x60
       evict_inodes+0x161/0x1b0
       generic_shutdown_super+0x2d/0x110
       kill_anon_super+0xf/0x20
       btrfs_kill_super+0xd/0x20 [btrfs]
       deactivate_locked_super+0x27/0x90
       cleanup_mnt+0x12c/0x180
       task_work_run+0x54/0x80
       exit_to_user_mode_prepare+0x152/0x160
       syscall_exit_to_user_mode+0x12/0x30
       do_syscall_64+0x42/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f854a000fb7
    
    Fixes: f0bfa76a11e9 ("btrfs: fix ENOSPC failure when attempting direct IO write into NOCOW range")
    CC: stable@vger.kernel.org # 5.17
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 001828fb3084379f3c3e228b905223c50bc237f9
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Thu Apr 7 20:12:28 2022 +0800

    drm/amdgpu: Ensure HDA function is suspended before ASIC reset
    
    commit 887f75cfd0da44c19dda93b2ff9e70ca8792cdc1 upstream.
    
    DP/HDMI audio on AMD PRO VII stops working after S3:
    [  149.450391] amdgpu 0000:63:00.0: amdgpu: MODE1 reset
    [  149.450395] amdgpu 0000:63:00.0: amdgpu: GPU mode1 reset
    [  149.450494] amdgpu 0000:63:00.0: amdgpu: GPU psp mode1 reset
    [  149.983693] snd_hda_intel 0000:63:00.1: refused to change power state from D0 to D3hot
    [  150.003439] amdgpu 0000:63:00.0: refused to change power state from D0 to D3hot
    ...
    [  155.432975] snd_hda_intel 0000:63:00.1: CORB reset timeout#2, CORBRP = 65535
    
    The offending commit is daf8de0874ab5b ("drm/amdgpu: always reset the asic in
    suspend (v2)"). Commit 34452ac3038a7 ("drm/amdgpu: don't use BACO for
    reset in S3 ") doesn't help, so the issue is something different.
    
    Assuming that to make HDA resume to D0 fully realized, it needs to be
    successfully put to D3 first. And this guesswork proves working, by
    moving amdgpu_asic_reset() to noirq callback, so it's called after HDA
    function is in D3.
    
    Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)")
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.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 dd67e30866a06261b6135fe9f95aff2f548a0660
Author: Tadeusz Struk <tadeusz.struk@linaro.org>
Date:   Tue Mar 29 10:12:52 2022 -0700

    uapi/linux/stddef.h: Add include guards
    
    commit 55037ed7bdc62151a726f5685f88afa6a82959b1 upstream.
    
    Add include guard wrapper define to uapi/linux/stddef.h to prevent macro
    redefinition errors when stddef.h is included more than once. This was not
    needed before since the only contents already used a redefinition test.
    
    Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
    Link: https://lore.kernel.org/r/20220329171252.57279-1-tadeusz.struk@linaro.org
    Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8c0dbed07b388e7d97cecc184099caf80067a7bc
Author: Piotr Chmura <chmooreck@gmail.com>
Date:   Thu Mar 31 17:55:50 2022 +0200

    media: si2157: unknown chip version Si2147-A30 ROM 0x50
    
    commit 3ae87d2f25c0e998da2721ce332e2b80d3d53c39 upstream.
    
    Fix firmware file names assignment in si2157 tuner, allow for running
    devices without firmware files needed.
    
    modprobe gives error: unknown chip version Si2147-A30 ROM 0x50
    Device initialization is interrupted.
    
    Caused by:
    1. table si2157_tuners has swapped fields rom_id and required vs struct
       si2157_tuner_info.
    2. both firmware file names can be null for devices with
       required == false - device uses build-in firmware in this case
    
    Tested on this device:
            m07ca:1871 AVerMedia Technologies, Inc. TD310 DVB-T/T2/C dongle
    
    [mchehab: fix mangled patch]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=215726
    Link: https://lore.kernel.org/lkml/5f660108-8812-383c-83e4-29ee0558d623@leemhuis.info/
    Link: https://lore.kernel.org/linux-media/c4bcaff8-fbad-969e-ad47-e2c487ac02a1@gmail.com
    Fixes: 1c35ba3bf972 ("media: si2157: use a different namespace for firmware")
    Cc: stable@vger.kernel.org # 5.17.x
    Signed-off-by: Piotr Chmura <chmooreck@gmail.com>
    Tested-by: Robert Schlabbach <robert_s@gmx.net>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11256dcff0a18d33723e67bedd9cb70fb645cd78
Author: Anup Patel <apatel@ventanamicro.com>
Date:   Sat Apr 9 09:15:33 2022 +0530

    RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put()
    
    commit 8c3ce496bd612bd21679e445f75fcabb6be997b2 upstream.
    
    We might have RISC-V systems (such as QEMU) where VMID is not part
    of the TLB entry tag so these systems will have to flush all TLB
    entries upon any change in hgatp.VMID.
    
    Currently, we zero-out hgatp CSR in kvm_arch_vcpu_put() and we
    re-program hgatp CSR in kvm_arch_vcpu_load(). For above described
    systems, this will flush all TLB entries whenever VCPU exits to
    user-space hence reducing performance.
    
    This patch fixes above described performance issue by not clearing
    hgatp CSR in kvm_arch_vcpu_put().
    
    Fixes: 34bde9d8b9e6 ("RISC-V: KVM: Implement VCPU world-switch")
    Cc: stable@vger.kernel.org
    Signed-off-by: Anup Patel <apatel@ventanamicro.com>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eed7e80f54ad0cfe37acb50796b0c0672f2336c6
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Thu Mar 24 08:36:45 2022 -0700

    btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups()
    
    commit 6d4a6b515c39f1f8763093e0f828959b2fbc2f45 upstream.
    
    Clang's version of -Wunused-but-set-variable recently gained support for
    unary operations, which reveals two unused variables:
    
      fs/btrfs/block-group.c:2949:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
              int num_started = 0;
                  ^
      fs/btrfs/block-group.c:3116:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
              int num_started = 0;
                  ^
      2 errors generated.
    
    These variables appear to be unused from their introduction, so just
    remove them to silence the warnings.
    
    Fixes: c9dc4c657850 ("Btrfs: two stage dirty block group writeout")
    Fixes: 1bbc621ef284 ("Btrfs: allow block group cache writeout outside critical section in commit")
    CC: stable@vger.kernel.org # 5.4+
    Link: https://github.com/ClangBuiltLinux/linux/issues/1614
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 39610e8ab4e75c02efe39ee3feec5ea3e2fb2ec6
Author: Filipe Manana <fdmanana@suse.com>
Date:   Thu Feb 3 15:36:44 2022 +0000

    btrfs: remove no longer used counter when reading data page
    
    commit ad3fc7946b1829213bbdbb2b9ad0d124b31ae4a7 upstream.
    
    After commit 92082d40976ed0 ("btrfs: integrate page status update for
    data read path into begin/end_page_read"), the 'nr' counter at
    btrfs_do_readpage() is no longer used, we increment it but we never
    read from it. So just remove it.
    
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc8200dc4089b7d0bdb66a11d5290d9686c53faf
Author: Alvin Å ipraga <alsi@bang-olufsen.dk>
Date:   Wed Mar 23 13:42:25 2022 +0100

    net: dsa: realtek: make interface drivers depend on OF
    
    commit 109d899452ba17996eccec7ae8249fb1f8900a16 upstream.
    
    The kernel test robot reported build warnings with a randconfig that
    built realtek-{smi,mdio} without CONFIG_OF set. Since both interface
    drivers are using OF and will not probe without, add the corresponding
    dependency to Kconfig.
    
    Link: https://lore.kernel.org/all/202203231233.Xx73Y40o-lkp@intel.com/
    Link: https://lore.kernel.org/all/202203231439.ycl0jg50-lkp@intel.com/
    Fixes: aac94001067d ("net: dsa: realtek: add new mdio interface for drivers")
    Fixes: 765c39a4fafe ("net: dsa: realtek: convert subdrivers into modules")
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Acked-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20220323124225.91763-1-alvin@pqrs.dk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [alsi: backport to 5.16: remove mdio part]
    Cc: stable@vger.kernel.org # v5.16+
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac3e87eebf428819c343175ec446c86c46f5a30d
Author: Alvin Å ipraga <alsi@bang-olufsen.dk>
Date:   Mon Feb 21 19:46:31 2022 +0100

    net: dsa: realtek: rtl8365mb: serialize indirect PHY register access
    
    commit 2796728460b822d549841e0341752b263dc265c4 upstream.
    
    Realtek switches in the rtl8365mb family can access the PHY registers of
    the internal PHYs via the switch registers. This method is called
    indirect access. At a high level, the indirect PHY register access
    method involves reading and writing some special switch registers in a
    particular sequence. This works for both SMI and MDIO connected
    switches.
    
    Currently the rtl8365mb driver does not take any care to serialize the
    aforementioned access to the switch registers. In particular, it is
    permitted for other driver code to access other switch registers while
    the indirect PHY register access is ongoing. Locking is only done at the
    regmap level. This, however, is a bug: concurrent register access, even
    to unrelated switch registers, risks corrupting the PHY register value
    read back via the indirect access method described above.
    
    Arınç reported that the switch sometimes returns nonsense data when
    reading the PHY registers. In particular, a value of 0 causes the
    kernel's PHY subsystem to think that the link is down, but since most
    reads return correct data, the link then flip-flops between up and down
    over a period of time.
    
    The aforementioned bug can be readily observed by:
    
     1. Enabling ftrace events for regmap and mdio
     2. Polling BSMR PHY register for a connected port;
        it should always read the same (e.g. 0x79ed)
     3. Wait for step 2 to give a different value
    
    Example command for step 2:
    
        while true; do phytool read swp2/2/0x01; done
    
    On my i.MX8MM, the above steps will yield a bogus value for the BSMR PHY
    register within a matter of seconds. The interleaved register access it
    then evident in the trace log:
    
     kworker/3:4-70      [003] .......  1927.139849: regmap_reg_write: ethernet-switch reg=1004 val=bd
         phytool-16816   [002] .......  1927.139979: regmap_reg_read: ethernet-switch reg=1f01 val=0
     kworker/3:4-70      [003] .......  1927.140381: regmap_reg_read: ethernet-switch reg=1005 val=0
         phytool-16816   [002] .......  1927.140468: regmap_reg_read: ethernet-switch reg=1d15 val=a69
     kworker/3:4-70      [003] .......  1927.140864: regmap_reg_read: ethernet-switch reg=1003 val=0
         phytool-16816   [002] .......  1927.140955: regmap_reg_write: ethernet-switch reg=1f02 val=2041
     kworker/3:4-70      [003] .......  1927.141390: regmap_reg_read: ethernet-switch reg=1002 val=0
         phytool-16816   [002] .......  1927.141479: regmap_reg_write: ethernet-switch reg=1f00 val=1
     kworker/3:4-70      [003] .......  1927.142311: regmap_reg_write: ethernet-switch reg=1004 val=be
         phytool-16816   [002] .......  1927.142410: regmap_reg_read: ethernet-switch reg=1f01 val=0
     kworker/3:4-70      [003] .......  1927.142534: regmap_reg_read: ethernet-switch reg=1005 val=0
         phytool-16816   [002] .......  1927.142618: regmap_reg_read: ethernet-switch reg=1f04 val=0
         phytool-16816   [002] .......  1927.142641: mdio_access: SMI-0 read  phy:0x02 reg:0x01 val:0x0000 <- ?!
     kworker/3:4-70      [003] .......  1927.143037: regmap_reg_read: ethernet-switch reg=1001 val=0
     kworker/3:4-70      [003] .......  1927.143133: regmap_reg_read: ethernet-switch reg=1000 val=2d89
     kworker/3:4-70      [003] .......  1927.143213: regmap_reg_write: ethernet-switch reg=1004 val=be
     kworker/3:4-70      [003] .......  1927.143291: regmap_reg_read: ethernet-switch reg=1005 val=0
     kworker/3:4-70      [003] .......  1927.143368: regmap_reg_read: ethernet-switch reg=1003 val=0
     kworker/3:4-70      [003] .......  1927.143443: regmap_reg_read: ethernet-switch reg=1002 val=6
    
    The kworker here is polling MIB counters for stats, as evidenced by the
    register 0x1004 that we are writing to (RTL8365MB_MIB_ADDRESS_REG). This
    polling is performed every 3 seconds, but is just one example of such
    unsynchronized access. In Arınç's case, the driver was not using the
    switch IRQ, so the PHY subsystem was itself doing polling analogous to
    phytool in the above example.
    
    A test module was created [see second Link] to simulate such spurious
    switch register accesses while performing indirect PHY register reads
    and writes. Realtek was also consulted to confirm whether this is a
    known issue or not. The conclusion of these lines of inquiry is as
    follows:
    
    1. Reading of PHY registers via indirect access will be aborted if,
       after executing the read operation (via a write to the
       INDIRECT_ACCESS_CTRL_REG), any register is accessed, other than
       INDIRECT_ACCESS_STATUS_REG.
    
    2. The PHY register indirect read is only complete when
       INDIRECT_ACCESS_STATUS_REG reads zero.
    
    3. The INDIRECT_ACCESS_DATA_REG, which is read to get the result of the
       PHY read, will contain the result of the last successful read
       operation. If there was spurious register access and the indirect
       read was aborted, then this register is not guaranteed to hold
       anything meaningful and the PHY read will silently fail.
    
    4. PHY writes do not appear to be affected by this mechanism.
    
    5. Other similar access routines, such as for MIB counters, although
       similar to the PHY indirect access method, are actually table access.
       Table access is not affected by spurious reads or writes of other
       registers. However, concurrent table access is not allowed. Currently
       this is protected via mib_lock, so there is nothing to fix.
    
    The above statements are corroborated both via the test module and
    through consultation with Realtek. In particular, Realtek states that
    this is simply a property of the hardware design and is not a hardware
    bug.
    
    To fix this problem, one must guard against regmap access while the
    PHY indirect register read is executing. Fix this by using the newly
    introduced "nolock" regmap in all PHY-related functions, and by aquiring
    the regmap mutex at the top level of the PHY register access callbacks.
    Although no issue has been observed with PHY register _writes_, this
    change also serializes the indirect access method there. This is done
    purely as a matter of convenience and for reasons of symmetry.
    
    Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
    Link: https://lore.kernel.org/netdev/CAJq09z5FCgG-+jVT7uxh1a-0CiiFsoKoHYsAWJtiKwv7LXKofQ@mail.gmail.com/
    Link: https://lore.kernel.org/netdev/871qzwjmtv.fsf@bang-olufsen.dk/
    Reported-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Reported-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [alsi: backport to 5.16: s/priv/smi/g]
    Cc: stable@vger.kernel.org # v5.16+
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f607096e60429fc8fa56e89f8ddccc3b2894b400
Author: Alvin Å ipraga <alsi@bang-olufsen.dk>
Date:   Mon Feb 21 19:46:30 2022 +0100

    net: dsa: realtek: allow subdrivers to externally lock regmap
    
    commit 907e772f6f6debb610ea28298ab57b31019a4edb upstream.
    
    Currently there is no way for Realtek DSA subdrivers to serialize
    consecutive regmap accesses. In preparation for a bugfix relating to
    indirect PHY register access - which involves a series of regmap
    reads and writes - add a facility for subdrivers to serialize their
    regmap access.
    
    Specifically, a mutex is added to the driver private data structure and
    the standard regmap is initialized with custom lock/unlock ops which use
    this mutex. Then, a "nolock" variant of the regmap is added, which is
    functionally equivalent to the existing regmap except that regmap
    locking is disabled. Functions that wish to serialize a sequence of
    regmap accesses may then lock the newly introduced driver-owned mutex
    before using the nolock regmap.
    
    Doing things this way means that subdriver code that doesn't care about
    serialized register access - i.e. the vast majority of code - needn't
    worry about synchronizing register access with an external lock: it can
    just continue to use the original regmap.
    
    Another advantage of this design is that, while regmaps with locking
    disabled do not expose a debugfs interface for obvious reasons, there
    still exists the original regmap which does expose this interface. This
    interface remains safe to use even combined with driver codepaths that
    use the nolock regmap, because said codepaths will use the same mutex
    to synchronize access.
    
    With respect to disadvantages, it can be argued that having
    near-duplicate regmaps is confusing. However, the naming is rather
    explicit, and examples will abound.
    
    Finally, while we are at it, rename realtek_smi_mdio_regmap_config to
    realtek_smi_regmap_config. This makes it consistent with the naming
    realtek_mdio_regmap_config in realtek-mdio.c.
    
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [alsi: backport to 5.16: s/priv/smi/g and remove realtek-mdio changes]
    Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7fb0cd571e86fea3f4335f367886cbf5ad6572d0
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Fri Feb 25 13:06:46 2022 -0600

    ACPI: processor idle: Check for architectural support for LPI
    
    commit eb087f305919ee8169ad65665610313e74260463 upstream.
    
    When `osc_pc_lpi_support_confirmed` is set through `_OSC` and `_LPI` is
    populated then the cpuidle driver assumes that LPI is fully functional.
    
    However currently the kernel only provides architectural support for LPI
    on ARM.  This leads to high power consumption on X86 platforms that
    otherwise try to enable LPI.
    
    So probe whether or not LPI support is implemented before enabling LPI in
    the kernel.  This is done by overloading `acpi_processor_ffh_lpi_probe` to
    check whether it returns `-EOPNOTSUPP`. It also means that all future
    implementations of `acpi_processor_ffh_lpi_probe` will need to follow
    these semantics as well.
    
    Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 55420636b6924122c27dc097b9b98beae572b9b9
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Fri Feb 25 13:06:45 2022 -0600

    cpuidle: PSCI: Move the `has_lpi` check to the beginning of the function
    
    commit 01f6c7338ce267959975da65d86ba34f44d54220 upstream.
    
    Currently the first thing checked is whether the PCSI cpu_suspend function
    has been initialized.
    
    Another change will be overloading `acpi_processor_ffh_lpi_probe` and
    calling it sooner.  So make the `has_lpi` check the first thing checked
    to prepare for that change.
    
    Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8af706006e9dbb48e12dfc16472ad1c96b2afa63
Author: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Date:   Fri Mar 18 11:10:34 2022 -0400

    drm/amd/display: Fix p-state allow debug index on dcn31
    
    commit 3107e1a7ae088ee94323fe9ab05dbefd65b3077f upstream.
    
    [Why]
    It changed since dcn30 but the hubbub31 constructor hasn't been
    modified to reflect this.
    
    [How]
    Update the value in the constructor to 0x6 so we're checking the right
    bits for p-state allow.
    
    It worked before by accident, but can falsely assert 0 depending on HW
    state transitions. The most frequent of which appears to be when
    all pipes turn off during IGT tests.
    
    Cc: Harry Wentland <harry.wentland@amd.com>
    
    Fixes: e7031d8258f1b4 ("drm/amd/display: Add pstate verification and recovery for DCN31")
    Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Reviewed-by: Eric Yang <Eric.Yang2@amd.com>
    Acked-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9018c894e4c325063b114d755ddf82f47bf0afda
Author: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Date:   Fri Dec 17 09:55:54 2021 -0500

    drm/amd/display: Add pstate verification and recovery for DCN31
    
    commit e7031d8258f1b4d6d50e5e5b5d92ba16f66eb8b4 upstream.
    
    [Why]
    To debug when p-state is being blocked and avoid PMFW hangs when
    it does occur.
    
    [How]
    Re-use the DCN10 hardware sequencer by adding a new interface for
    verifying p-state high on the hubbub. The interface is mostly the
    same as the DCN10 interface, but the bit definitions have changed for
    the debug bus.
    
    Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Reviewed-by: Eric Yang <Eric.Yang2@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>