commit 04b092e4a01a3488e762897e2d29f85eda2c6a60
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 25 09:14:39 2022 +0200

    Linux 5.4.196
    
    Link: https://lore.kernel.org/r/20220523165802.500642349@linuxfoundation.org
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Khalid Masum<khalid.masum.92 at gmail.com>
    Tested-by: Hulk Robot <hulkrobot@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dba1941f5bc3de6b460685155b89ae1182824fc8
Author: David Howells <dhowells@redhat.com>
Date:   Sat May 21 08:18:28 2022 +0100

    afs: Fix afs_getattr() to refetch file status if callback break occurred
    
    [ Upstream commit 2aeb8c86d49967552394d5e723f87454cb53f501 ]
    
    If a callback break occurs (change notification), afs_getattr() needs to
    issue an FS.FetchStatus RPC operation to update the status of the file
    being examined by the stat-family of system calls.
    
    Fix afs_getattr() to do this if AFS_VNODE_CB_PROMISED has been cleared
    on a vnode by a callback break.  Skip this if AT_STATX_DONT_SYNC is set.
    
    This can be tested by appending to a file on one AFS client and then
    using "stat -L" to examine its length on a machine running kafs.  This
    can also be watched through tracing on the kafs machine.  The callback
    break is seen:
    
         kworker/1:1-46      [001] .....   978.910812: afs_cb_call: c=0000005f YFSCB.CallBack
         kworker/1:1-46      [001] ...1.   978.910829: afs_cb_break: 100058:23b4c:242d2c2 b=2 s=1 break-cb
         kworker/1:1-46      [001] .....   978.911062: afs_call_done:    c=0000005f ret=0 ab=0 [0000000082994ead]
    
    And then the stat command generated no traffic if unpatched, but with
    this change a call to fetch the status can be observed:
    
                stat-4471    [000] .....   986.744122: afs_make_fs_call: c=000000ab 100058:023b4c:242d2c2 YFS.FetchStatus
                stat-4471    [000] .....   986.745578: afs_call_done:    c=000000ab ret=0 ab=0 [0000000087fc8c84]
    
    Fixes: 08e0e7c82eea ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.")
    Reported-by: Markus Suvanto <markus.suvanto@gmail.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Tested-by: Markus Suvanto <markus.suvanto@gmail.com>
    Tested-by: kafs-testing+fedora34_64checkkafs-build-496@auristor.com
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216010
    Link: https://lore.kernel.org/r/165308359800.162686.14122417881564420962.stgit@warthog.procyon.org.uk/ # v1
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ef5374d532caa1dd7da22093110fc2aeae956a08
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Sat May 14 10:31:47 2022 +0800

    i2c: mt7621: fix missing clk_disable_unprepare() on error in mtk_i2c_probe()
    
    [ Upstream commit a2537c98a8a3b57002e54a262d180b9490bc7190 ]
    
    Fix the missing clk_disable_unprepare() before return
    from mtk_i2c_probe() in the error handling case.
    
    Fixes: d04913ec5f89 ("i2c: mt7621: Add MediaTek MT7621/7628/7688 I2C driver")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Stefan Roese <sr@denx.de>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10a221e2d3d8cf53be4e55c92257197688cfe54f
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Thu Jun 24 11:41:00 2021 +0200

    x86/xen: Mark cpu_bringup_and_idle() as dead_end_function
    
    commit 9af9dcf11bda3e2c0e24c1acaacb8685ad974e93 upstream.
    
    The asm_cpu_bringup_and_idle() function is required to push the return
    value on the stack in order to make ORC happy, but the only reason
    objtool doesn't complain is because of a happy accident.
    
    The thing is that asm_cpu_bringup_and_idle() doesn't return, so
    validate_branch() never terminates and falls through to the next
    function, which in the normal case is the hypercall_page. And that, as
    it happens, is 4095 NOPs and a RET.
    
    Make asm_cpu_bringup_and_idle() terminate on it's own, by making the
    function it calls as a dead-end. This way we no longer rely on what
    code happens to come after.
    
    Fixes: c3881eb58d56 ("x86/xen: Make the secondary CPU idle tasks reliable")
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Miroslav Benes <mbenes@suse.cz>
    Link: https://lore.kernel.org/r/20210624095147.693801717@infradead.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a12884ff43400e94b109bf4aa9fa5eed47ef5241
Author: Juergen Gross <jgross@suse.com>
Date:   Thu Apr 9 09:00:01 2020 +0200

    x86/xen: fix booting 32-bit pv guest
    
    commit d6f34f4c6b4a962eb7a86c923fea206f866a40be upstream.
    
    Commit 2f62f36e62daec ("x86/xen: Make the boot CPU idle task reliable")
    introduced a regression for booting 32 bit Xen PV guests: the address
    of the initial stack needs to be a virtual one.
    
    Fixes: 2f62f36e62daec ("x86/xen: Make the boot CPU idle task reliable")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Link: https://lore.kernel.org/r/20200409070001.16675-1-jgross@suse.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b2f140a9f980806f572d672e1780acea66b9a25c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Mon Mar 28 11:37:05 2022 -0700

    Reinstate some of "swiotlb: rework "fix info leak with DMA_FROM_DEVICE""
    
    commit 901c7280ca0d5e2b4a8929fbe0bfb007ac2a6544 upstream.
    
    Halil Pasic points out [1] that the full revert of that commit (revert
    in bddac7c1e02b), and that a partial revert that only reverts the
    problematic case, but still keeps some of the cleanups is probably
    better.  
    
    And that partial revert [2] had already been verified by Oleksandr
    Natalenko to also fix the issue, I had just missed that in the long
    discussion.
    
    So let's reinstate the cleanups from commit aa6f8dcbab47 ("swiotlb:
    rework "fix info leak with DMA_FROM_DEVICE""), and effectively only
    revert the part that caused problems.
    
    Link: https://lore.kernel.org/all/20220328013731.017ae3e3.pasic@linux.ibm.com/ [1]
    Link: https://lore.kernel.org/all/20220324055732.GB12078@lst.de/ [2]
    Link: https://lore.kernel.org/all/4386660.LvFx2qVVIh@natalenko.name/ [3]
    Suggested-by: Halil Pasic <pasic@linux.ibm.com>
    Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
    Cc: Christoph Hellwig" <hch@lst.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [OP: backport to 5.4: adjusted context]
    Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 060f38b1dfb499d0c02d14ea793a16f4e63c51b6
Author: Abel Vesa <abel.vesa@nxp.com>
Date:   Thu Jan 27 16:10:51 2022 +0200

    ARM: dts: imx7: Use audio_mclk_post_div instead audio_mclk_root_clk
    
    commit 4cb7df64c732b2b9918424095c11660c2a8c4a33 upstream.
    
    The audio_mclk_root_clk was added as a gate with the CCGR121 (0x4790),
    but according to the reference manual, there is no such gate. Moreover,
    the consumer driver of the mentioned clock might gate it and leave
    the ECSPI2 (the true owner of that gate) hanging. So lets use the
    audio_mclk_post_div, which is the parent.
    
    Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    [ps: backport to 5.4]
    Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b38cf3cb17dfde98ffe5913372d0d8eafede9e57
Author: Thiébaud Weksteen <tweek@google.com>
Date:   Mon May 2 10:49:52 2022 +1000

    firmware_loader: use kernel credentials when reading firmware
    
    commit 581dd69830341d299b0c097fc366097ab497d679 upstream.
    
    Device drivers may decide to not load firmware when probed to avoid
    slowing down the boot process should the firmware filesystem not be
    available yet. In this case, the firmware loading request may be done
    when a device file associated with the driver is first accessed. The
    credentials of the userspace process accessing the device file may be
    used to validate access to the firmware files requested by the driver.
    Ensure that the kernel assumes the responsibility of reading the
    firmware.
    
    This was observed on Android for a graphic driver loading their firmware
    when the device file (e.g. /dev/mali0) was first opened by userspace
    (i.e. surfaceflinger). The security context of surfaceflinger was used
    to validate the access to the firmware file (e.g.
    /vendor/firmware/mali.bin).
    
    Previously, Android configurations were not setting up the
    firmware_class.path command line argument and were relying on the
    userspace fallback mechanism. In this case, the security context of the
    userspace daemon (i.e. ueventd) was consistently used to read firmware
    files. More Android devices are now found to set firmware_class.path
    which gives the kernel the opportunity to read the firmware directly
    (via kernel_read_file_from_path_initns). In this scenario, the current
    process credentials were used, even if unrelated to the loading of the
    firmware file.
    
    Signed-off-by: Thiébaud Weksteen <tweek@google.com>
    Cc: <stable@vger.kernel.org> # 5.10
    Reviewed-by: Paul Moore <paul@paul-moore.com>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Link: https://lore.kernel.org/r/20220502004952.3970800-1-tweek@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e14e3856e94dd389f105de594974e1ade80a613a
Author: Tan Tee Min <tee.min.tan@linux.intel.com>
Date:   Fri Apr 29 19:58:07 2022 +0800

    net: stmmac: disable Split Header (SPH) for Intel platforms
    
    commit 47f753c1108e287edb3e27fad8a7511a9d55578e upstream.
    
    Based on DesignWare Ethernet QoS datasheet, we are seeing the limitation
    of Split Header (SPH) feature is not supported for Ipv4 fragmented packet.
    This SPH limitation will cause ping failure when the packets size exceed
    the MTU size. For example, the issue happens once the basic ping packet
    size is larger than the configured MTU size and the data is lost inside
    the fragmented packet, replaced by zeros/corrupted values, and leads to
    ping fail.
    
    So, disable the Split Header for Intel platforms.
    
    v2: Add fixes tag in commit message.
    
    Fixes: 67afd6d1cfdf("net: stmmac: Add Split Header support and enable it in XGMAC cores")
    Cc: <stable@vger.kernel.org> # 5.10.x
    Suggested-by: Ong, Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
    Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
    Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9ea8e6a8323e063c42536f3f8c83d3768cff5f4d
Author: Ming Lei <ming.lei@redhat.com>
Date:   Thu Jul 29 11:42:26 2021 +0800

    block: return ELEVATOR_DISCARD_MERGE if possible
    
    commit 866663b7b52d2da267b28e12eed89ee781b8fed1 upstream.
    
    When merging one bio to request, if they are discard IO and the queue
    supports multi-range discard, we need to return ELEVATOR_DISCARD_MERGE
    because both block core and related drivers(nvme, virtio-blk) doesn't
    handle mixed discard io merge(traditional IO merge together with
    discard merge) well.
    
    Fix the issue by returning ELEVATOR_DISCARD_MERGE in this situation,
    so both blk-mq and drivers just need to handle multi-range discard.
    
    Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name>
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
    Fixes: 2705dfb20947 ("block: fix discard request merge")
    Link: https://lore.kernel.org/r/20210729034226.1591070-1-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 36ac6caf742d9597a1ce3f2eeeb5de895fa75fd2
Author: Marek Vasut <marex@denx.de>
Date:   Wed May 18 14:28:32 2022 -0700

    Input: ili210x - fix reset timing
    
    commit e4920d42ce0e9c8aafb7f64b6d9d4ae02161e51e upstream.
    
    According to Ilitek "231x & ILI251x Programming Guide" Version: 2.30
    "2.1. Power Sequence", "T4 Chip Reset and discharge time" is minimum
    10ms and "T2 Chip initial time" is maximum 150ms. Adjust the reset
    timings such that T4 is 12ms and T2 is 160ms to fit those figures.
    
    This prevents sporadic touch controller start up failures when some
    systems with at least ILI251x controller boot, without this patch
    the systems sometimes fail to communicate with the touch controller.
    
    Fixes: 201f3c803544c ("Input: ili210x - add reset GPIO support")
    Signed-off-by: Marek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20220518204901.93534-1-marex@denx.de
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1c450bdf2e8cdc71094e10de36bedf34535428fb
Author: Grant Grundler <grundler@chromium.org>
Date:   Mon May 9 19:28:26 2022 -0700

    net: atlantic: verify hw_head_ lies within TX buffer ring
    
    [ Upstream commit 2120b7f4d128433ad8c5f503a9584deba0684901 ]
    
    Bounds check hw_head index provided by NIC to verify it lies
    within the TX buffer ring.
    
    Reported-by: Aashay Shringarpure <aashay@google.com>
    Reported-by: Yi Chou <yich@google.com>
    Reported-by: Shervin Oloumi <enlightened@google.com>
    Signed-off-by: Grant Grundler <grundler@chromium.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e5307704c4adb525185ef32d9fc626c7ac5c4631
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Tue May 10 11:13:16 2022 +0800

    net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
    
    [ Upstream commit 0807ce0b010418a191e0e4009803b2d74c3245d5 ]
    
    Switch to using pcim_enable_device() to avoid missing pci_disable_device().
    
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20220510031316.1780409-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 91d8d7edf19227f301628b20f895286baa994777
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Fri May 6 17:42:50 2022 +0800

    ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
    
    [ Upstream commit 51ca86b4c9c7c75f5630fa0dbe5f8f0bd98e3c3e ]
    
    Fix the missing pci_disable_device() before return
    from tulip_init_one() in the error handling case.
    
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20220506094250.3630615-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dd5de66f5c8a958ee53cd66ac7cad7421502e48d
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date:   Wed May 4 11:07:39 2022 +0200

    selftests: add ping test with ping_group_range tuned
    
    [ Upstream commit e71b7f1f44d3d88c677769c85ef0171caf9fc89f ]
    
    The 'ping' utility is able to manage two kind of sockets (raw or icmp),
    depending on the sysctl ping_group_range. By default, ping_group_range is
    set to '1 0', which forces ping to use an ip raw socket.
    
    Let's replay the ping tests by allowing 'ping' to use the ip icmp socket.
    After the previous patch, ipv4 tests results are the same with both kinds
    of socket. For ipv6, there are a lot a new failures (the previous patch
    fixes only two cases).
    
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9919585e5f418ed25531d5c0aba377496a434cf5
Author: Felix Fietkau <nbd@nbd.name>
Date:   Wed Apr 20 12:50:38 2022 +0200

    mac80211: fix rx reordering with non explicit / psmp ack policy
    
    [ Upstream commit 5e469ed9764d4722c59562da13120bd2dc6834c5 ]
    
    When the QoS ack policy was set to non explicit / psmp ack, frames are treated
    as not being part of a BA session, which causes extra latency on reordering.
    Fix this by only bypassing reordering for packets with no-ack policy
    
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://lore.kernel.org/r/20220420105038.36443-1-nbd@nbd.name
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 19e2cd737c166b9a57f9f0f687d16f36dde4046f
Author: Gleb Chesnokov <Chesnokov.G@raidix.com>
Date:   Fri Apr 15 12:42:29 2022 +0000

    scsi: qla2xxx: Fix missed DMA unmap for aborted commands
    
    [ Upstream commit 26f9ce53817a8fd84b69a73473a7de852a24c897 ]
    
    Aborting commands that have already been sent to the firmware can
    cause BUG in qlt_free_cmd(): BUG_ON(cmd->sg_mapped)
    
    For instance:
    
     - Command passes rdx_to_xfer state, maps sgl, sends to the firmware
    
     - Reset occurs, qla2xxx performs ISP error recovery, aborts the command
    
     - Target stack calls qlt_abort_cmd() and then qlt_free_cmd()
    
     - BUG_ON(cmd->sg_mapped) in qlt_free_cmd() occurs because sgl was not
       unmapped
    
    Thus, unmap sgl in qlt_abort_cmd() for commands with the aborted flag set.
    
    Link: https://lore.kernel.org/r/AS8PR10MB4952D545F84B6B1DFD39EC1E9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 74168c2207a5531a2b8a526c82b5c76bec9f5e95
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Fri May 20 10:11:58 2022 +0200

    perf bench numa: Address compiler error on s390
    
    [ Upstream commit f8ac1c478424a9a14669b8cef7389b1e14e5229d ]
    
    The compilation on s390 results in this error:
    
      # make DEBUG=y bench/numa.o
      ...
      bench/numa.c: In function ‘__bench_numa’:
      bench/numa.c:1749:81: error: ‘%d’ directive output may be truncated
                  writing between 1 and 11 bytes into a region of size between
                  10 and 20 [-Werror=format-truncation=]
      1749 |        snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
                                                                   ^~
      ...
      bench/numa.c:1749:64: note: directive argument in the range
                     [-2147483647, 2147483646]
      ...
      #
    
    The maximum length of the %d replacement is 11 characters because of the
    negative sign.  Therefore extend the array by two more characters.
    
    Output after:
    
      # make  DEBUG=y bench/numa.o > /dev/null 2>&1; ll bench/numa.o
      -rw-r--r-- 1 root root 418320 May 19 09:11 bench/numa.o
      #
    
    Fixes: 3aff8ba0a4c9c919 ("perf bench numa: Avoid possible truncation when using snprintf()")
    Suggested-by: Namhyung Kim <namhyung@gmail.com>
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220520081158.2990006-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d1915d9c9fa3b2690c1092fce1b78d5e63adc983
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Wed May 11 09:58:56 2022 +0200

    gpio: mvebu/pwm: Refuse requests with inverted polarity
    
    [ Upstream commit 3ecb10175b1f776f076553c24e2689e42953fef5 ]
    
    The driver doesn't take struct pwm_state::polarity into account when
    configuring the hardware, so refuse requests for inverted polarity.
    
    Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support")
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3fdd67e83c4221408dea5c3de330d1644f699732
Author: Haibo Chen <haibo.chen@nxp.com>
Date:   Wed May 11 10:15:04 2022 +0800

    gpio: gpio-vf610: do not touch other bits when set the target bit
    
    [ Upstream commit 9bf3ac466faa83d51a8fe9212131701e58fdef74 ]
    
    For gpio controller contain register PDDR, when set one target bit,
    current logic will clear all other bits, this is wrong. Use operator
    '|=' to fix it.
    
    Fixes: 659d8a62311f ("gpio: vf610: add imx7ulp support")
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1fe6dc5f5d19f0929431a775347dbcea5bf854f2
Author: Andrew Lunn <andrew@lunn.ch>
Date:   Wed May 18 02:58:40 2022 +0200

    net: bridge: Clear offload_fwd_mark when passing frame up bridge interface.
    
    [ Upstream commit fbb3abdf2223cd0dfc07de85fe5a43ba7f435bdf ]
    
    It is possible to stack bridges on top of each other. Consider the
    following which makes use of an Ethernet switch:
    
           br1
         /    \
        /      \
       /        \
     br0.11    wlan0
       |
       br0
     /  |  \
    p1  p2  p3
    
    br0 is offloaded to the switch. Above br0 is a vlan interface, for
    vlan 11. This vlan interface is then a slave of br1. br1 also has a
    wireless interface as a slave. This setup trunks wireless lan traffic
    over the copper network inside a VLAN.
    
    A frame received on p1 which is passed up to the bridge has the
    skb->offload_fwd_mark flag set to true, indicating that the switch has
    dealt with forwarding the frame out ports p2 and p3 as needed. This
    flag instructs the software bridge it does not need to pass the frame
    back down again. However, the flag is not getting reset when the frame
    is passed upwards. As a result br1 sees the flag, wrongly interprets
    it, and fails to forward the frame to wlan0.
    
    When passing a frame upwards, clear the flag. This is the Rx
    equivalent of br_switchdev_frame_unmark() in br_dev_xmit().
    
    Fixes: f1c2eddf4cb6 ("bridge: switchdev: Use an helper to clear forward mark")
    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Tested-by: Ido Schimmel <idosch@nvidia.com>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://lore.kernel.org/r/20220518005840.771575-1-andrew@lunn.ch
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 622be11fa3851891edfb4b63c40d5b137e88837f
Author: Kevin Mitchell <kevmitch@arista.com>
Date:   Tue May 17 11:01:05 2022 -0700

    igb: skip phy status check where unavailable
    
    [ Upstream commit 942d2ad5d2e0df758a645ddfadffde2795322728 ]
    
    igb_read_phy_reg() will silently return, leaving phy_data untouched, if
    hw->ops.read_reg isn't set. Depending on the uninitialized value of
    phy_data, this led to the phy status check either succeeding immediately
    or looping continuously for 2 seconds before emitting a noisy err-level
    timeout. This message went out to the console even though there was no
    actual problem.
    
    Instead, first check if there is read_reg function pointer. If not,
    proceed without trying to check the phy status register.
    
    Fixes: b72f3f72005d ("igb: When GbE link up, wait for Remote receiver status condition")
    Signed-off-by: Kevin Mitchell <kevmitch@arista.com>
    Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eb92a8ecce23b2a8b7d0387322abd3196fa794b5
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Wed Apr 20 09:46:17 2022 +0100

    ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2
    
    [ Upstream commit 3cfb3019979666bdf33a1010147363cf05e0f17b ]
    
    In Thumb2, 'b . + 4' produces a branch instruction that uses a narrow
    encoding, and so it does not jump to the following instruction as
    expected. So use W(b) instead.
    
    Fixes: 6c7cb60bff7a ("ARM: fix Thumb2 regression with Spectre BHB")
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 463a7b957db0d2c96871f446b0c94d39a9bee244
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Wed Apr 20 09:44:51 2022 +0100

    ARM: 9196/1: spectre-bhb: enable for Cortex-A15
    
    [ Upstream commit 0dc14aa94ccd8ba35eb17a0f9b123d1566efd39e ]
    
    The Spectre-BHB mitigations were inadvertently left disabled for
    Cortex-A15, due to the fact that cpu_v7_bugs_init() is not called in
    that case. So fix that.
    
    Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround")
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1b93631c77c9b18cf411eafa86e0f42934da84b4
Author: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Date:   Tue May 17 17:42:31 2022 +0800

    net: af_key: add check for pfkey_broadcast in function pfkey_process
    
    [ Upstream commit 4dc2a5a8f6754492180741facf2a8787f2c415d7 ]
    
    If skb_clone() returns null pointer, pfkey_broadcast() will
    return error.
    Therefore, it should be better to check the return value of
    pfkey_broadcast() and return error if fails.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c0be5fec786b5aab3f5db222b28a64d0946d6658
Author: Maxim Mikityanskiy <maximmi@nvidia.com>
Date:   Tue Apr 12 18:37:03 2022 +0300

    net/mlx5e: Properly block LRO when XDP is enabled
    
    [ Upstream commit cf6e34c8c22fba66bd21244b95ea47e235f68974 ]
    
    LRO is incompatible and mutually exclusive with XDP. However, the needed
    checks are only made when enabling XDP. If LRO is enabled when XDP is
    already active, the command will succeed, and XDP will be skipped in the
    data path, although still enabled.
    
    This commit fixes the bug by checking the XDP status in
    mlx5e_fix_features and disabling LRO if XDP is enabled.
    
    Fixes: 86994156c736 ("net/mlx5e: XDP fast RX drop bpf programs support")
    Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3277789f332ed34d46d35ee84992fd643f48aa4a
Author: Duoming Zhou <duoming@zju.edu.cn>
Date:   Tue May 17 09:25:30 2022 +0800

    NFC: nci: fix sleep in atomic context bugs caused by nci_skb_alloc
    
    [ Upstream commit 23dd4581350d4ffa23d58976ec46408f8f4c1e16 ]
    
    There are sleep in atomic context bugs when the request to secure
    element of st-nci is timeout. The root cause is that nci_skb_alloc
    with GFP_KERNEL parameter is called in st_nci_se_wt_timeout which is
    a timer handler. The call paths that could trigger bugs are shown below:
    
        (interrupt context 1)
    st_nci_se_wt_timeout
      nci_hci_send_event
        nci_hci_send_data
          nci_skb_alloc(..., GFP_KERNEL) //may sleep
    
       (interrupt context 2)
    st_nci_se_wt_timeout
      nci_hci_send_event
        nci_hci_send_data
          nci_send_data
            nci_queue_tx_data_frags
              nci_skb_alloc(..., GFP_KERNEL) //may sleep
    
    This patch changes allocation mode of nci_skb_alloc from GFP_KERNEL to
    GFP_ATOMIC in order to prevent atomic context sleeping. The GFP_ATOMIC
    flag makes memory allocation operation could be used in atomic context.
    
    Fixes: ed06aeefdac3 ("nfc: st-nci: Rename st21nfcb to st-nci")
    Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20220517012530.75714-1-duoming@zju.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b368e07fb44dd4a6dab2b89f7cdbf61931536bf4
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun May 15 20:07:02 2022 +0200

    net/qla3xxx: Fix a test in ql_reset_work()
    
    [ Upstream commit 5361448e45fac6fb96738df748229432a62d78b6 ]
    
    test_bit() tests if one bit is set or not.
    Here the logic seems to check of bit QL_RESET_PER_SCSI (i.e. 4) OR bit
    QL_RESET_START (i.e. 3) is set.
    
    In fact, it checks if bit 7 (4 | 3 = 7) is set, that is to say
    QL_ADAPTER_UP.
    
    This looks harmless, because this bit is likely be set, and when the
    ql_reset_work() delayed work is scheduled in ql3xxx_isr() (the only place
    that schedule this work), QL_RESET_START or QL_RESET_PER_SCSI is set.
    
    This has been spotted by smatch.
    
    Fixes: 5a4faa873782 ("[PATCH] qla3xxx NIC driver")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/r/80e73e33f390001d9c0140ffa9baddf6466a41a2.1652637337.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d672eee9e404805e1c2aeb8b16ba43c9cdffff46
Author: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Date:   Wed Apr 13 10:13:18 2022 +0300

    clk: at91: generated: consider range when calculating best rate
    
    [ Upstream commit d0031e6fbed955ff8d5f5bbc8fe7382482559cec ]
    
    clk_generated_best_diff() helps in finding the parent and the divisor to
    compute a rate closest to the required one. However, it doesn't take into
    account the request's range for the new rate. Make sure the new rate
    is within the required range.
    
    Fixes: 8a8f4bf0c480 ("clk: at91: clk-generated: create function to find best_diff")
    Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
    Link: https://lore.kernel.org/r/20220413071318.244912-1-codrin.ciubotariu@microchip.com
    Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8cb1a05fe38b90d02ff64e8de7a76f553ac6f21d
Author: Paul Greenwalt <paul.greenwalt@intel.com>
Date:   Thu Apr 28 14:11:42 2022 -0700

    ice: fix possible under reporting of ethtool Tx and Rx statistics
    
    [ Upstream commit 31b6298fd8e29effe9ed6b77351ac5969be56ce0 ]
    
    The hardware statistics counters are not cleared during resets so the
    drivers first access is to initialize the baseline and then subsequent
    reads are for reporting the counters. The statistics counters are read
    during the watchdog subtask when the interface is up. If the baseline
    is not initialized before the interface is up, then there can be a brief
    window in which some traffic can be transmitted/received before the
    initial baseline reading takes place.
    
    Directly initialize ethtool statistics in driver open so the baseline will
    be initialized when the interface is up, and any dropped packets
    incremented before the interface is up won't be reported.
    
    Fixes: 28dc1b86f8ea9 ("ice: ignore dropped packets during init")
    Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
    Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dc64e8874e87dc1c1c723a1c6da7efc3305c18da
Author: Zixuan Fu <r33s3n6@gmail.com>
Date:   Sat May 14 13:07:11 2022 +0800

    net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup()
    
    [ Upstream commit edf410cb74dc612fd47ef5be319c5a0bcd6e6ccd ]
    
    In vmxnet3_rq_create(), when dma_alloc_coherent() fails,
    vmxnet3_rq_destroy() is called. It sets rq->rx_ring[i].base to NULL. Then
    vmxnet3_rq_create() returns an error to its callers mxnet3_rq_create_all()
    -> vmxnet3_change_mtu(). Then vmxnet3_change_mtu() calls
    vmxnet3_force_close() -> dev_close() in error handling code. And the driver
    calls vmxnet3_close() -> vmxnet3_quiesce_dev() -> vmxnet3_rq_cleanup_all()
    -> vmxnet3_rq_cleanup(). In vmxnet3_rq_cleanup(),
    rq->rx_ring[ring_idx].base is accessed, but this variable is NULL, causing
    a NULL pointer dereference.
    
    To fix this possible bug, an if statement is added to check whether
    rq->rx_ring[0].base is NULL in vmxnet3_rq_cleanup() and exit early if so.
    
    The error log in our fault-injection testing is shown as follows:
    
    [   65.220135] BUG: kernel NULL pointer dereference, address: 0000000000000008
    ...
    [   65.222633] RIP: 0010:vmxnet3_rq_cleanup_all+0x396/0x4e0 [vmxnet3]
    ...
    [   65.227977] Call Trace:
    ...
    [   65.228262]  vmxnet3_quiesce_dev+0x80f/0x8a0 [vmxnet3]
    [   65.228580]  vmxnet3_close+0x2c4/0x3f0 [vmxnet3]
    [   65.228866]  __dev_close_many+0x288/0x350
    [   65.229607]  dev_close_many+0xa4/0x480
    [   65.231124]  dev_close+0x138/0x230
    [   65.231933]  vmxnet3_force_close+0x1f0/0x240 [vmxnet3]
    [   65.232248]  vmxnet3_change_mtu+0x75d/0x920 [vmxnet3]
    ...
    
    Fixes: d1a890fa37f27 ("net: VMware virtual Ethernet NIC driver: vmxnet3")
    Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
    Signed-off-by: Zixuan Fu <r33s3n6@gmail.com>
    Link: https://lore.kernel.org/r/20220514050711.2636709-1-r33s3n6@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 32f779e6fbbe0c0860a00777b7e3dee6b5ec0c1c
Author: Zixuan Fu <r33s3n6@gmail.com>
Date:   Sat May 14 13:06:56 2022 +0800

    net: vmxnet3: fix possible use-after-free bugs in vmxnet3_rq_alloc_rx_buf()
    
    [ Upstream commit 9e7fef9521e73ca8afd7da9e58c14654b02dfad8 ]
    
    In vmxnet3_rq_alloc_rx_buf(), when dma_map_single() fails, rbi->skb is
    freed immediately. Similarly, in another branch, when dma_map_page() fails,
    rbi->page is also freed. In the two cases, vmxnet3_rq_alloc_rx_buf()
    returns an error to its callers vmxnet3_rq_init() -> vmxnet3_rq_init_all()
    -> vmxnet3_activate_dev(). Then vmxnet3_activate_dev() calls
    vmxnet3_rq_cleanup_all() in error handling code, and rbi->skb or rbi->page
    are freed again in vmxnet3_rq_cleanup_all(), causing use-after-free bugs.
    
    To fix these possible bugs, rbi->skb and rbi->page should be cleared after
    they are freed.
    
    The error log in our fault-injection testing is shown as follows:
    
    [   14.319016] BUG: KASAN: use-after-free in consume_skb+0x2f/0x150
    ...
    [   14.321586] Call Trace:
    ...
    [   14.325357]  consume_skb+0x2f/0x150
    [   14.325671]  vmxnet3_rq_cleanup_all+0x33a/0x4e0 [vmxnet3]
    [   14.326150]  vmxnet3_activate_dev+0xb9d/0x2ca0 [vmxnet3]
    [   14.326616]  vmxnet3_open+0x387/0x470 [vmxnet3]
    ...
    [   14.361675] Allocated by task 351:
    ...
    [   14.362688]  __netdev_alloc_skb+0x1b3/0x6f0
    [   14.362960]  vmxnet3_rq_alloc_rx_buf+0x1b0/0x8d0 [vmxnet3]
    [   14.363317]  vmxnet3_activate_dev+0x3e3/0x2ca0 [vmxnet3]
    [   14.363661]  vmxnet3_open+0x387/0x470 [vmxnet3]
    ...
    [   14.367309]
    [   14.367412] Freed by task 351:
    ...
    [   14.368932]  __dev_kfree_skb_any+0xd2/0xe0
    [   14.369193]  vmxnet3_rq_alloc_rx_buf+0x71e/0x8d0 [vmxnet3]
    [   14.369544]  vmxnet3_activate_dev+0x3e3/0x2ca0 [vmxnet3]
    [   14.369883]  vmxnet3_open+0x387/0x470 [vmxnet3]
    [   14.370174]  __dev_open+0x28a/0x420
    [   14.370399]  __dev_change_flags+0x192/0x590
    [   14.370667]  dev_change_flags+0x7a/0x180
    [   14.370919]  do_setlink+0xb28/0x3570
    [   14.371150]  rtnl_newlink+0x1160/0x1740
    [   14.371399]  rtnetlink_rcv_msg+0x5bf/0xa50
    [   14.371661]  netlink_rcv_skb+0x1cd/0x3e0
    [   14.371913]  netlink_unicast+0x5dc/0x840
    [   14.372169]  netlink_sendmsg+0x856/0xc40
    [   14.372420]  ____sys_sendmsg+0x8a7/0x8d0
    [   14.372673]  __sys_sendmsg+0x1c2/0x270
    [   14.372914]  do_syscall_64+0x41/0x90
    [   14.373145]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    ...
    
    Fixes: 5738a09d58d5a ("vmxnet3: fix checks for dma mapping errors")
    Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
    Signed-off-by: Zixuan Fu <r33s3n6@gmail.com>
    Link: https://lore.kernel.org/r/20220514050656.2636588-1-r33s3n6@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1eb2d785815537e50f51784840ef5de76f0dea72
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri May 13 11:27:06 2022 +0200

    net/sched: act_pedit: sanitize shift argument before usage
    
    [ Upstream commit 4d42d54a7d6aa6d29221d3fd4f2ae9503e94f011 ]
    
    syzbot was able to trigger an Out-of-Bound on the pedit action:
    
    UBSAN: shift-out-of-bounds in net/sched/act_pedit.c:238:43
    shift exponent 1400735974 is too large for 32-bit type 'unsigned int'
    CPU: 0 PID: 3606 Comm: syz-executor151 Not tainted 5.18.0-rc5-syzkaller-00165-g810c2f0a3f86 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
     ubsan_epilogue+0xb/0x50 lib/ubsan.c:151
     __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x187 lib/ubsan.c:322
     tcf_pedit_init.cold+0x1a/0x1f net/sched/act_pedit.c:238
     tcf_action_init_1+0x414/0x690 net/sched/act_api.c:1367
     tcf_action_init+0x530/0x8d0 net/sched/act_api.c:1432
     tcf_action_add+0xf9/0x480 net/sched/act_api.c:1956
     tc_ctl_action+0x346/0x470 net/sched/act_api.c:2015
     rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5993
     netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
     netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
     netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
     netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1921
     sock_sendmsg_nosec net/socket.c:705 [inline]
     sock_sendmsg+0xcf/0x120 net/socket.c:725
     ____sys_sendmsg+0x6e2/0x800 net/socket.c:2413
     ___sys_sendmsg+0xf3/0x170 net/socket.c:2467
     __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    RIP: 0033:0x7fe36e9e1b59
    Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007ffef796fe88 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe36e9e1b59
    RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003
    RBP: 00007fe36e9a5d00 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe36e9a5d90
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
     </TASK>
    
    The 'shift' field is not validated, and any value above 31 will
    trigger out-of-bounds. The issue predates the git history, but
    syzbot was able to trigger it only after the commit mentioned in
    the fixes tag, and this change only applies on top of such commit.
    
    Address the issue bounding the 'shift' value to the maximum allowed
    by the relevant operator.
    
    Reported-and-tested-by: syzbot+8ed8fc4c57e9dcf23ca6@syzkaller.appspotmail.com
    Fixes: 8b796475fd78 ("net/sched: act_pedit: really ensure the skb is writable")
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 50f70ee30236d1b290378f3a15c58e537b66df7f
Author: Harini Katakam <harini.katakam@xilinx.com>
Date:   Thu May 12 22:49:00 2022 +0530

    net: macb: Increment rx bd head after allocating skb and buffer
    
    [ Upstream commit 9500acc631dbb8b73166e25700e656b11f6007b6 ]
    
    In gem_rx_refill rx_prepared_head is incremented at the beginning of
    the while loop preparing the skb and data buffers. If the skb or data
    buffer allocation fails, this BD will be unusable BDs until the head
    loops back to the same BD (and obviously buffer allocation succeeds).
    In the unlikely event that there's a string of allocation failures,
    there will be an equal number of unusable BDs and an inconsistent RX
    BD chain. Hence increment the head at the end of the while loop to be
    clean.
    
    Fixes: 4df95131ea80 ("net/macb: change RX path for GEM")
    Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
    Signed-off-by: Michal Simek <michal.simek@xilinx.com>
    Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
    Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Link: https://lore.kernel.org/r/20220512171900.32593-1-harini.katakam@xilinx.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a42ffe88332c52e8bf1d12b495070b480999e8d9
Author: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Date:   Tue Mar 29 10:39:32 2022 -0700

    ARM: dts: aspeed-g6: fix SPI1/SPI2 quad pin group
    
    [ Upstream commit 890362d41b244536ab63591f813393f5fdf59ed7 ]
    
    Fix incorrect function mappings in pinctrl_qspi1_default and
    pinctrl_qspi2_default since their function should be SPI1 and
    SPI2 respectively.
    
    Fixes: f510f04c8c83 ("ARM: dts: aspeed: Add AST2600 pinmux nodes")
    Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
    Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
    Link: https://lore.kernel.org/r/20220329173932.2588289-8-quic_jaehyoo@quicinc.com
    Signed-off-by: Joel Stanley <joel@jms.id.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6493ff94c0229b06d799a80bf9d59c447f321c00
Author: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Date:   Tue Mar 29 10:39:26 2022 -0700

    ARM: dts: aspeed-g6: remove FWQSPID group in pinctrl dtsi
    
    [ Upstream commit efddaa397cceefb61476e383c26fafd1f8ab6356 ]
    
    FWSPIDQ2 and FWSPIDQ3 are not part of FWSPI18 interface so remove
    FWQSPID group in pinctrl dtsi. These pins must be used with the
    FWSPI pins that are dedicated for boot SPI interface which provides
    same 3.3v logic level.
    
    Fixes: 2f6edb6bcb2f ("ARM: dts: aspeed: Fix AST2600 quad spi group")
    Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
    Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
    Link: https://lore.kernel.org/r/20220329173932.2588289-2-quic_jaehyoo@quicinc.com
    Signed-off-by: Joel Stanley <joel@jms.id.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fe2a9469eca05b8f5f74669b72357eca99881173
Author: Jérôme Pouiller <jerome.pouiller@silabs.com>
Date:   Tue May 17 09:27:08 2022 +0200

    dma-buf: fix use of DMA_BUF_SET_NAME_{A,B} in userspace
    
    commit 7c3e9fcad9c7d8bb5d69a576044fb16b1d2e8a01 upstream.
    
    The typedefs u32 and u64 are not available in userspace. Thus user get
    an error he try to use DMA_BUF_SET_NAME_A or DMA_BUF_SET_NAME_B:
    
        $ gcc -Wall   -c -MMD -c -o ioctls_list.o ioctls_list.c
        In file included from /usr/include/x86_64-linux-gnu/asm/ioctl.h:1,
                         from /usr/include/linux/ioctl.h:5,
                         from /usr/include/asm-generic/ioctls.h:5,
                         from ioctls_list.c:11:
        ioctls_list.c:463:29: error: ‘u32’ undeclared here (not in a function)
          463 |     { "DMA_BUF_SET_NAME_A", DMA_BUF_SET_NAME_A, -1, -1 }, // linux/dma-buf.h
              |                             ^~~~~~~~~~~~~~~~~~
        ioctls_list.c:464:29: error: ‘u64’ undeclared here (not in a function)
          464 |     { "DMA_BUF_SET_NAME_B", DMA_BUF_SET_NAME_B, -1, -1 }, // linux/dma-buf.h
              |                             ^~~~~~~~~~~~~~~~~~
    
    The issue was initially reported here[1].
    
    [1]: https://github.com/jerome-pouiller/ioctl/pull/14
    
    Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Fixes: a5bff92eaac4 ("dma-buf: Fix SET_NAME ioctl uapi")
    CC: stable@vger.kernel.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20220517072708.245265-1-Jerome.Pouiller@silabs.com
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8cf6c24ed4882269920b60121c650260e445c808
Author: Hangyu Hua <hbh25y@gmail.com>
Date:   Mon May 16 11:20:42 2022 +0800

    drm/dp/mst: fix a possible memory leak in fetch_monitor_name()
    
    commit 6e03b13cc7d9427c2c77feed1549191015615202 upstream.
    
    drm_dp_mst_get_edid call kmemdup to create mst_edid. So mst_edid need to be
    freed after use.
    
    Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
    Reviewed-by: Lyude Paul <lyude@redhat.com>
    Signed-off-by: Lyude Paul <lyude@redhat.com>
    Cc: stable@vger.kernel.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20220516032042.13166-1-hbh25y@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8be06f62b426801dba43ddf8893952a0e62ab6ae
Author: Ondrej Mosnacek <omosnace@redhat.com>
Date:   Tue May 3 13:50:10 2022 +0200

    crypto: qcom-rng - fix infinite loop on requests not multiple of WORD_SZ
    
    commit 16287397ec5c08aa58db6acf7dbc55470d78087d upstream.
    
    The commit referenced in the Fixes tag removed the 'break' from the else
    branch in qcom_rng_read(), causing an infinite loop whenever 'max' is
    not a multiple of WORD_SZ. This can be reproduced e.g. by running:
    
        kcapi-rng -b 67 >/dev/null
    
    There are many ways to fix this without adding back the 'break', but
    they all seem more awkward than simply adding it back, so do just that.
    
    Tested on a machine with Qualcomm Amberwing processor.
    
    Fixes: a680b1832ced ("crypto: qcom-rng - ensure buffer for generate is completely filled")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
    Reviewed-by: Brian Masney <bmasney@redhat.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f4a093215b8e28878319d35c463000105e8cf06b
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed May 11 14:51:22 2022 +0000

    KVM: x86/mmu: Update number of zapped pages even if page list is stable
    
    commit b28cb0cd2c5e80a8c0feb408a0e4b0dbb6d132c5 upstream.
    
    When zapping obsolete pages, update the running count of zapped pages
    regardless of whether or not the list has become unstable due to zapping
    a shadow page with its own child shadow pages.  If the VM is backed by
    mostly 4kb pages, KVM can zap an absurd number of SPTEs without bumping
    the batch count and thus without yielding.  In the worst case scenario,
    this can cause a soft lokcup.
    
     watchdog: BUG: soft lockup - CPU#12 stuck for 22s! [dirty_log_perf_:13020]
       RIP: 0010:workingset_activation+0x19/0x130
       mark_page_accessed+0x266/0x2e0
       kvm_set_pfn_accessed+0x31/0x40
       mmu_spte_clear_track_bits+0x136/0x1c0
       drop_spte+0x1a/0xc0
       mmu_page_zap_pte+0xef/0x120
       __kvm_mmu_prepare_zap_page+0x205/0x5e0
       kvm_mmu_zap_all_fast+0xd7/0x190
       kvm_mmu_invalidate_zap_pages_in_memslot+0xe/0x10
       kvm_page_track_flush_slot+0x5c/0x80
       kvm_arch_flush_shadow_memslot+0xe/0x10
       kvm_set_memslot+0x1a8/0x5d0
       __kvm_set_memory_region+0x337/0x590
       kvm_vm_ioctl+0xb08/0x1040
    
    Fixes: fbb158cb88b6 ("KVM: x86/mmu: Revert "Revert "KVM: MMU: zap pages in batch""")
    Reported-by: David Matlack <dmatlack@google.com>
    Reviewed-by: Ben Gardon <bgardon@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-Id: <20220511145122.3133334-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit de874518274901737a943c094d9b4adf232e3c2a
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Mar 31 19:38:51 2022 +0200

    PCI/PM: Avoid putting Elo i2 PCIe Ports in D3cold
    
    commit 92597f97a40bf661bebceb92e26ff87c76d562d4 upstream.
    
    If a Root Port on Elo i2 is put into D3cold and then back into D0, the
    downstream device becomes permanently inaccessible, so add a bridge D3 DMI
    quirk for that system.
    
    This was exposed by 14858dcc3b35 ("PCI: Use pci_update_current_state() in
    pci_enable_device_flags()"), but before that commit the Root Port in
    question had never been put into D3cold for real due to a mismatch between
    its power state retrieved from the PCI_PM_CTRL register (which was
    accessible even though the platform firmware indicated that the port was in
    D3cold) and the state of an ACPI power resource involved in its power
    management.
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215715
    Link: https://lore.kernel.org/r/11980172.O9o76ZdvQC@kreacher
    Reported-by: Stefan Gottwald <gottwald@igel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org      # v5.15+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3a12b2c413b20c17832ec51cb836a0b713b916ac
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Mon May 16 16:42:13 2022 +0800

    Fix double fget() in vhost_net_set_backend()
    
    commit fb4554c2232e44d595920f4d5c66cf8f7d13f9bc upstream.
    
    Descriptor table is a shared resource; two fget() on the same descriptor
    may return different struct file references.  get_tap_ptr_ring() is
    called after we'd found (and pinned) the socket we'll be using and it
    tries to find the private tun/tap data structures associated with it.
    Redoing the lookup by the same file descriptor we'd used to get the
    socket is racy - we need to same struct file.
    
    Thanks to Jason for spotting a braino in the original variant of patch -
    I'd missed the use of fd == -1 for disabling backend, and in that case
    we can end up with sock == NULL and sock != oldsock.
    
    Cc: stable@kernel.org
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dd0ea88b0a0f913f82500e988ef38158a9ad9885
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri May 20 20:38:06 2022 +0200

    perf: Fix sys_perf_event_open() race against self
    
    commit 3ac6487e584a1eb54071dbe1212e05b884136704 upstream.
    
    Norbert reported that it's possible to race sys_perf_event_open() such
    that the looser ends up in another context from the group leader,
    triggering many WARNs.
    
    The move_group case checks for races against itself, but the
    !move_group case doesn't, seemingly relying on the previous
    group_leader->ctx == ctx check. However, that check is racy due to not
    holding any locks at that time.
    
    Therefore, re-check the result after acquiring locks and bailing
    if they no longer match.
    
    Additionally, clarify the not_move_group case from the
    move_group-vs-move_group race.
    
    Fixes: f63a8daa5812 ("perf: Fix event->ctx locking")
    Reported-by: Norbert Slusarek <nslusarek@gmx.net>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    ALSA: wavefront: Proper check of get_user() error
    
    commit a34ae6c0660d3b96b0055f68ef74dc9478852245 upstream.
    
    The antient ISA wavefront driver reads its sample patch data (uploaded
    over an ioctl) via __get_user() with no good reason; likely just for
    some performance optimizations in the past.  Let's change this to the
    standard get_user() and the error check for handling the fault case
    properly.
    
    Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220510103626.16635-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2f8f6c393b11b5da059b1fc10a69fc2f2b6c446a
Author: Meena Shanmugam <meenashanmugam@google.com>
Date:   Wed May 18 18:40:11 2022 +0000

    SUNRPC: Ensure we flush any closed sockets before xs_xprt_free()
    
    From: Trond Myklebust <trond.myklebust@hammerspace.com>
    
    commit f00432063db1a0db484e85193eccc6845435b80e upstream.
    
    We must ensure that all sockets are closed before we call xprt_free()
    and release the reference to the net namespace. The problem is that
    calling fput() will defer closing the socket until delayed_fput() gets
    called.
    Let's fix the situation by allowing rpciod and the transport teardown
    code (which runs on the system wq) to call __fput_sync(), and directly
    close the socket.
    
    Reported-by: Felix Fu <foyjog@gmail.com>
    Acked-by: Al Viro <viro@zeniv.linux.org.uk>
    Fixes: a73881c96d73 ("SUNRPC: Fix an Oops in udp_poll()")
    Cc: stable@vger.kernel.org # 5.1.x: 3be232f11a3c: SUNRPC: Prevent immediate close+reconnect
    Cc: stable@vger.kernel.org # 5.1.x: 89f42494f92f: SUNRPC: Don't call connect() more than once on a TCP socket
    Cc: stable@vger.kernel.org # 5.1.x
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    [meenashanmugam: Fix merge conflict in xprt_connect]
    Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 975a0f14d5cd29fe4b33190b5afcfa9f244b769d
Author: Meena Shanmugam <meenashanmugam@google.com>
Date:   Wed May 18 18:40:10 2022 +0000

    SUNRPC: Don't call connect() more than once on a TCP socket
    
    From: Trond Myklebust <trond.myklebust@hammerspace.com>
    
    commit 89f42494f92f448747bd8a7ab1ae8b5d5520577d upstream.
    
    Avoid socket state races due to repeated calls to ->connect() using the
    same socket. If connect() returns 0 due to the connection having
    completed, but we are in fact in a closing state, then we may leave the
    XPRT_CONNECTING flag set on the transport.
    
    Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
    Fixes: 3be232f11a3c ("SUNRPC: Prevent immediate close+reconnect")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    [meenashanmugam: Fix merge conflict in xs_tcp_setup_socket]
    Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aa4d71edd60941bc05d2a0efe1e98a67c5dd59b7
Author: Meena Shanmugam <meenashanmugam@google.com>
Date:   Wed May 18 18:40:09 2022 +0000

    SUNRPC: Prevent immediate close+reconnect
    
    From: Trond Myklebust <trond.myklebust@hammerspace.com>
    
    commit 3be232f11a3cc9b0ef0795e39fa11bdb8e422a06 upstream.
    
    If we have already set up the socket and are waiting for it to connect,
    then don't immediately close and retry.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2d6f096476e66a60aad3004f5d8aefff0b5b59df
Author: Meena Shanmugam <meenashanmugam@google.com>
Date:   Wed May 18 18:40:08 2022 +0000

    SUNRPC: Clean up scheduling of autoclose
    
    From: Trond Myklebust <trond.myklebust@hammerspace.com>
    
    commit e26d9972720e2484f44cdd94ca4e31cc372ed2ed upstream.
    
    Consolidate duplicated code in xprt_force_disconnect() and
    xprt_conditional_disconnect().
    
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f3fe8d13ac899ce21df911017a7b13379de08a13
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue May 17 11:09:11 2022 -0700

    mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch()
    
    commit 533a6cfe08f96a7b5c65e06d20916d552c11b256 upstream
    
    All callers of __mmc_switch() should now be specifying a valid timeout for
    the CMD6 command. However, just to be sure, let's print a warning and
    default to use the generic_cmd6_time in case the provided timeout_ms
    argument is zero.
    
    In this context, let's also simplify some of the corresponding code and
    clarify some related comments.
    
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit def047ae1266c02cac2ca7b01a6c5bf31dc2aa13
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue May 17 11:09:10 2022 -0700

    mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD
    
    commit ad91619aa9d78ab1c6d4a969c3db68bc331ae76c upstream
    
    The INAND_CMD38_ARG_EXT_CSD is a vendor specific EXT_CSD register, which is
    used to prepare an erase/trim operation. However, it doesn't make sense to
    use a timeout of 10 minutes while updating the register, which becomes the
    case when the timeout_ms argument for mmc_switch() is set to zero.
    
    Instead, let's use the generic_cmd6_time, as that seems like a reasonable
    timeout to use for these cases.
    
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20200122142747.5690-3-ulf.hansson@linaro.org
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f10260f359925f010745c6b7d2c38f9d694b0803
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue May 17 11:09:09 2022 -0700

    mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC
    
    commit 24ed3bd01d6a844fd5e8a75f48d0a3d10ed71bf9 upstream
    
    The timeout values used while waiting for a CMD6 for BKOPS or a CACHE_FLUSH
    to complete, are not defined by the eMMC spec. However, a timeout of 10
    minutes as is currently being used, is just silly for both of these cases.
    Instead, let's specify more reasonable timeouts, 120s for BKOPS and 30s for
    CACHE_FLUSH.
    
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1e93f939927def64a6d091f9cd24681322b53b37
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Apr 1 11:28:21 2022 -0700

    nilfs2: fix lockdep warnings during disk space reclamation
    
    [ Upstream commit 6e211930f79aa45d422009a5f2e5467d2369ffe5 ]
    
    During disk space reclamation, nilfs2 still emits the following lockdep
    warning due to page/folio operations on shadowed page caches that nilfs2
    uses to get a snapshot of DAT file in memory:
    
      WARNING: CPU: 0 PID: 2643 at include/linux/backing-dev.h:272 __folio_mark_dirty+0x645/0x670
      ...
      RIP: 0010:__folio_mark_dirty+0x645/0x670
      ...
      Call Trace:
        filemap_dirty_folio+0x74/0xd0
        __set_page_dirty_nobuffers+0x85/0xb0
        nilfs_copy_dirty_pages+0x288/0x510 [nilfs2]
        nilfs_mdt_save_to_shadow_map+0x50/0xe0 [nilfs2]
        nilfs_clean_segments+0xee/0x5d0 [nilfs2]
        nilfs_ioctl_clean_segments.isra.19+0xb08/0xf40 [nilfs2]
        nilfs_ioctl+0xc52/0xfb0 [nilfs2]
        __x64_sys_ioctl+0x11d/0x170
    
    This fixes the remaining warning by using inode objects to hold those
    page caches.
    
    Link: https://lkml.kernel.org/r/1647867427-30498-3-git-send-email-konishi.ryusuke@gmail.com
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Hao Sun <sunhao.th@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 307d021b1a7f33048b624f7aaeaa75e3eae571f1
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Apr 1 11:28:18 2022 -0700

    nilfs2: fix lockdep warnings in page operations for btree nodes
    
    [ Upstream commit e897be17a441fa637cd166fc3de1445131e57692 ]
    
    Patch series "nilfs2 lockdep warning fixes".
    
    The first two are to resolve the lockdep warning issue, and the last one
    is the accompanying cleanup and low priority.
    
    Based on your comment, this series solves the issue by separating inode
    object as needed.  Since I was worried about the impact of the object
    composition changes, I tested the series carefully not to cause
    regressions especially for delicate functions such like disk space
    reclamation and snapshots.
    
    This patch (of 3):
    
    If CONFIG_LOCKDEP is enabled, nilfs2 hits lockdep warnings at
    inode_to_wb() during page/folio operations for btree nodes:
    
      WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 inode_to_wb include/linux/backing-dev.h:269 [inline]
      WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 folio_account_dirtied mm/page-writeback.c:2460 [inline]
      WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 __folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509
      Modules linked in:
      ...
      RIP: 0010:inode_to_wb include/linux/backing-dev.h:269 [inline]
      RIP: 0010:folio_account_dirtied mm/page-writeback.c:2460 [inline]
      RIP: 0010:__folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509
      ...
      Call Trace:
        __set_page_dirty include/linux/pagemap.h:834 [inline]
        mark_buffer_dirty+0x4e6/0x650 fs/buffer.c:1145
        nilfs_btree_propagate_p fs/nilfs2/btree.c:1889 [inline]
        nilfs_btree_propagate+0x4ae/0xea0 fs/nilfs2/btree.c:2085
        nilfs_bmap_propagate+0x73/0x170 fs/nilfs2/bmap.c:337
        nilfs_collect_dat_data+0x45/0xd0 fs/nilfs2/segment.c:625
        nilfs_segctor_apply_buffers+0x14a/0x470 fs/nilfs2/segment.c:1009
        nilfs_segctor_scan_file+0x47a/0x700 fs/nilfs2/segment.c:1048
        nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1224 [inline]
        nilfs_segctor_collect fs/nilfs2/segment.c:1494 [inline]
        nilfs_segctor_do_construct+0x14f3/0x6c60 fs/nilfs2/segment.c:2036
        nilfs_segctor_construct+0x7a7/0xb30 fs/nilfs2/segment.c:2372
        nilfs_segctor_thread_construct fs/nilfs2/segment.c:2480 [inline]
        nilfs_segctor_thread+0x3c3/0xf90 fs/nilfs2/segment.c:2563
        kthread+0x405/0x4f0 kernel/kthread.c:327
        ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
    
    This is because nilfs2 uses two page caches for each inode and
    inode->i_mapping never points to one of them, the btree node cache.
    
    This causes inode_to_wb(inode) to refer to a different page cache than
    the caller page/folio operations such like __folio_start_writeback(),
    __folio_end_writeback(), or __folio_mark_dirty() acquired the lock.
    
    This patch resolves the issue by allocating and using an additional
    inode to hold the page cache of btree nodes.  The inode is attached
    one-to-one to the traditional nilfs2 inode if it requires a block
    mapping with b-tree.  This setup change is in memory only and does not
    affect the disk format.
    
    Link: https://lkml.kernel.org/r/1647867427-30498-1-git-send-email-konishi.ryusuke@gmail.com
    Link: https://lkml.kernel.org/r/1647867427-30498-2-git-send-email-konishi.ryusuke@gmail.com
    Link: https://lore.kernel.org/r/YXrYvIo8YRnAOJCj@casper.infradead.org
    Link: https://lore.kernel.org/r/9a20b33d-b38f-b4a2-4742-c1eb5b8e4d6c@redhat.com
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+0d5b462a6f07447991b3@syzkaller.appspotmail.com
    Reported-by: syzbot+34ef28bb2aeb28724aa0@syzkaller.appspotmail.com
    Reported-by: Hao Sun <sunhao.th@gmail.com>
    Reported-by: David Hildenbrand <david@redhat.com>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77b71a4c876701ecc0ed0bd1285785009badf610
Author: linyujun <linyujun809@huawei.com>
Date:   Fri Apr 1 10:52:47 2022 +0100

    ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame()
    
    [ Upstream commit 9be4c88bb7924f68f88cfd47d925c2d046f51a73 ]
    
    The following KASAN warning is detected by QEMU.
    
    ==================================================================
    BUG: KASAN: stack-out-of-bounds in unwind_frame+0x508/0x870
    Read of size 4 at addr c36bba90 by task cat/163
    
    CPU: 1 PID: 163 Comm: cat Not tainted 5.10.0-rc1 #40
    Hardware name: ARM-Versatile Express
    [<c0113fac>] (unwind_backtrace) from [<c010e71c>] (show_stack+0x10/0x14)
    [<c010e71c>] (show_stack) from [<c0b805b4>] (dump_stack+0x98/0xb0)
    [<c0b805b4>] (dump_stack) from [<c0b7d658>] (print_address_description.constprop.0+0x58/0x4bc)
    [<c0b7d658>] (print_address_description.constprop.0) from [<c031435c>] (kasan_report+0x154/0x170)
    [<c031435c>] (kasan_report) from [<c0113c44>] (unwind_frame+0x508/0x870)
    [<c0113c44>] (unwind_frame) from [<c010e298>] (__save_stack_trace+0x110/0x134)
    [<c010e298>] (__save_stack_trace) from [<c01ce0d8>] (stack_trace_save+0x8c/0xb4)
    [<c01ce0d8>] (stack_trace_save) from [<c0313520>] (kasan_set_track+0x38/0x60)
    [<c0313520>] (kasan_set_track) from [<c0314cb8>] (kasan_set_free_info+0x20/0x2c)
    [<c0314cb8>] (kasan_set_free_info) from [<c0313474>] (__kasan_slab_free+0xec/0x120)
    [<c0313474>] (__kasan_slab_free) from [<c0311e20>] (kmem_cache_free+0x7c/0x334)
    [<c0311e20>] (kmem_cache_free) from [<c01c35dc>] (rcu_core+0x390/0xccc)
    [<c01c35dc>] (rcu_core) from [<c01013a8>] (__do_softirq+0x180/0x518)
    [<c01013a8>] (__do_softirq) from [<c0135214>] (irq_exit+0x9c/0xe0)
    [<c0135214>] (irq_exit) from [<c01a40e4>] (__handle_domain_irq+0xb0/0x110)
    [<c01a40e4>] (__handle_domain_irq) from [<c0691248>] (gic_handle_irq+0xa0/0xb8)
    [<c0691248>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/0x94)
    Exception stack(0xc36bb928 to 0xc36bb970)
    b920:                   c36bb9c0 00000000 c0126919 c0101228 c36bb9c0 b76d7730
    b940: c36b8000 c36bb9a0 c3335b00 c01ce0d8 00000003 c36bba3c c36bb940 c36bb978
    b960: c010e298 c011373c 60000013 ffffffff
    [<c0100b0c>] (__irq_svc) from [<c011373c>] (unwind_frame+0x0/0x870)
    [<c011373c>] (unwind_frame) from [<00000000>] (0x0)
    
    The buggy address belongs to the page:
    page:(ptrval) refcount:0 mapcount:0 mapping:00000000 index:0x0 pfn:0x636bb
    flags: 0x0()
    raw: 00000000 00000000 ef867764 00000000 00000000 00000000 ffffffff 00000000
    page dumped because: kasan: bad access detected
    
    addr c36bba90 is located in stack of task cat/163 at offset 48 in frame:
     stack_trace_save+0x0/0xb4
    
    this frame has 1 object:
     [32, 48) 'trace'
    
    Memory state around the buggy address:
     c36bb980: f1 f1 f1 f1 00 04 f2 f2 00 00 f3 f3 00 00 00 00
     c36bba00: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
    >c36bba80: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
                     ^
     c36bbb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     c36bbb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================
    
    There is a same issue on x86 and has been resolved by the commit f7d27c35ddff
    ("x86/mm, kasan: Silence KASAN warnings in get_wchan()").
    The solution could be applied to arm architecture too.
    
    Signed-off-by: Lin Yujun <linyujun809@huawei.com>
    Reported-by: He Ying <heying24@huawei.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 54f7358be14dcfdb3f4210e88585ea7c3f95cdac
Author: Tzung-Bi Shih <tzungbi@google.com>
Date:   Wed Feb 9 13:11:30 2022 +0800

    platform/chrome: cros_ec_debugfs: detach log reader wq from devm
    
    [ Upstream commit 0e8eb5e8acbad19ac2e1856b2fb2320184299b33 ]
    
    Debugfs console_log uses devm memory (e.g. debug_info in
    cros_ec_console_log_poll()).  However, lifecycles of device and debugfs
    are independent.  An use-after-free issue is observed if userland
    program operates the debugfs after the memory has been freed.
    
    The call trace:
     do_raw_spin_lock
     _raw_spin_lock_irqsave
     remove_wait_queue
     ep_unregister_pollwait
     ep_remove
     do_epoll_ctl
    
    A Python example to reproduce the issue:
    ... import select
    ... p = select.epoll()
    ... f = open('/sys/kernel/debug/cros_scp/console_log')
    ... p.register(f, select.POLLIN)
    ... p.poll(1)
    [(4, 1)]                    # 4=fd, 1=select.POLLIN
    
    [ shutdown cros_scp at the point ]
    
    ... p.poll(1)
    [(4, 16)]                   # 4=fd, 16=select.POLLHUP
    ... p.unregister(f)
    
    An use-after-free issue raises here.  It called epoll_ctl with
    EPOLL_CTL_DEL which in turn to use the workqueue in the devm (i.e.
    log_wq).
    
    Detaches log reader's workqueue from devm to make sure it is persistent
    even if the device has been removed.
    
    Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
    Reviewed-by: Guenter Roeck <groeck@google.com>
    Link: https://lore.kernel.org/r/20220209051130.386175-1-tzungbi@google.com
    Signed-off-by: Benson Leung <bleung@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 232128f6e60f37a98cd6566d6d9685f0d43d0b77
Author: Jakob Koschel <jakobkoschel@gmail.com>
Date:   Fri Apr 1 00:03:48 2022 +0200

    drbd: remove usage of list iterator variable after loop
    
    [ Upstream commit 901aeda62efa21f2eae937bccb71b49ae531be06 ]
    
    In preparation to limit the scope of a list iterator to the list
    traversal loop, use a dedicated pointer to iterate through the list [1].
    
    Since that variable should not be used past the loop iteration, a
    separate variable is used to 'remember the current location within the
    loop'.
    
    To either continue iterating from that position or skip the iteration
    (if the previous iteration was complete) list_prepare_entry() is used.
    
    Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
    Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
    Link: https://lore.kernel.org/r/20220331220349.885126-1-jakobkoschel@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 83abb076f473b6266ededbf420e92b8b81d2f110
Author: Xiaoke Wang <xkernel.wang@foxmail.com>
Date:   Fri Mar 25 19:49:41 2022 +0800

    MIPS: lantiq: check the return value of kzalloc()
    
    [ Upstream commit 34123208bbcc8c884a0489f543a23fe9eebb5514 ]
    
    kzalloc() is a memory allocation function which can return NULL when
    some internal memory errors happen. So it is better to check the
    return value of it to prevent potential wrong memory access or
    memory leak.
    
    Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e7947c031ffe9459d7025d8065939e30215c3219
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Tue Jan 11 16:57:50 2022 -0600

    rtc: mc146818-lib: Fix the AltCentury for AMD platforms
    
    [ Upstream commit 3ae8fd41573af4fb3a490c9ed947fc936ba87190 ]
    
    Setting the century forward has been failing on AMD platforms.
    There was a previous attempt at fixing this for family 0x17 as part of
    commit 7ad295d5196a ("rtc: Fix the AltCentury value on AMD/Hygon
    platform") but this was later reverted due to some problems reported
    that appeared to stem from an FW bug on a family 0x17 desktop system.
    
    The same comments mentioned in the previous commit continue to apply
    to the newer platforms as well.
    
    ```
    MC146818 driver use function mc146818_set_time() to set register
    RTC_FREQ_SELECT(RTC_REG_A)'s bit4-bit6 field which means divider stage
    reset value on Intel platform to 0x7.
    
    While AMD/Hygon RTC_REG_A(0Ah)'s bit4 is defined as DV0 [Reference]:
    DV0 = 0 selects Bank 0, DV0 = 1 selects Bank 1. Bit5-bit6 is defined
    as reserved.
    
    DV0 is set to 1, it will select Bank 1, which will disable AltCentury
    register(0x32) access. As UEFI pass acpi_gbl_FADT.century 0x32
    (AltCentury), the CMOS write will be failed on code:
    CMOS_WRITE(century, acpi_gbl_FADT.century).
    
    Correct RTC_REG_A bank select bit(DV0) to 0 on AMD/Hygon CPUs, it will
    enable AltCentury(0x32) register writing and finally setup century as
    expected.
    ```
    
    However in closer examination the change previously submitted was also
    modifying bits 5 & 6 which are declared reserved in the AMD documentation.
    So instead modify just the DV0 bank selection bit.
    
    Being cognizant that there was a failure reported before, split the code
    change out to a static function that can also be used for exclusions if
    any regressions such as Mikhail's pop up again.
    
    Cc: Jinke Fan <fanjinke@hygon.cn>
    Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Link: https://lore.kernel.org/all/CABXGCsMLob0DC25JS8wwAYydnDoHBSoMh2_YLPfqm3TTvDE-Zw@mail.gmail.com/
    Link: https://www.amd.com/system/files/TechDocs/51192_Bolton_FCH_RRG.pdf
    Signed-off-by: Raul E Rangel <rrangel@chromium.org>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/r/20220111225750.1699-1-mario.limonciello@amd.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7be785032c0504b92bbb0b1836caa5d11bce13df
Author: Anton Eidelman <anton.eidelman@gmail.com>
Date:   Thu Mar 24 13:05:11 2022 -0600

    nvme-multipath: fix hang when disk goes live over reconnect
    
    [ Upstream commit a4a6f3c8f61c3cfbda4998ad94596059ad7e4332 ]
    
    nvme_mpath_init_identify() invoked from nvme_init_identify() fetches a
    fresh ANA log from the ctrl.  This is essential to have an up to date
    path states for both existing namespaces and for those scan_work may
    discover once the ctrl is up.
    
    This happens in the following cases:
      1) A new ctrl is being connected.
      2) An existing ctrl is successfully reconnected.
      3) An existing ctrl is being reset.
    
    While in (1) ctrl->namespaces is empty, (2 & 3) may have namespaces, and
    nvme_read_ana_log() may call nvme_update_ns_ana_state().
    
    This result in a hang when the ANA state of an existing namespace changes
    and makes the disk live: nvme_mpath_set_live() issues IO to the namespace
    through the ctrl, which does NOT have IO queues yet.
    
    See sample hang below.
    
    Solution:
    - nvme_update_ns_ana_state() to call set_live only if ctrl is live
    - nvme_read_ana_log() call from nvme_mpath_init_identify()
      therefore only fetches and parses the ANA log;
      any erros in this process will fail the ctrl setup as appropriate;
    - a separate function nvme_mpath_update()
      is called in nvme_start_ctrl();
      this parses the ANA log without fetching it.
      At this point the ctrl is live,
      therefore, disks can be set live normally.
    
    Sample failure:
        nvme nvme0: starting error recovery
        nvme nvme0: Reconnecting in 10 seconds...
        block nvme0n6: no usable path - requeuing I/O
        INFO: task kworker/u8:3:312 blocked for more than 122 seconds.
              Tainted: G            E     5.14.5-1.el7.elrepo.x86_64 #1
        Workqueue: nvme-wq nvme_tcp_reconnect_ctrl_work [nvme_tcp]
        Call Trace:
         __schedule+0x2a2/0x7e0
         schedule+0x4e/0xb0
         io_schedule+0x16/0x40
         wait_on_page_bit_common+0x15c/0x3e0
         do_read_cache_page+0x1e0/0x410
         read_cache_page+0x12/0x20
         read_part_sector+0x46/0x100
         read_lba+0x121/0x240
         efi_partition+0x1d2/0x6a0
         bdev_disk_changed.part.0+0x1df/0x430
         bdev_disk_changed+0x18/0x20
         blkdev_get_whole+0x77/0xe0
         blkdev_get_by_dev+0xd2/0x3a0
         __device_add_disk+0x1ed/0x310
         device_add_disk+0x13/0x20
         nvme_mpath_set_live+0x138/0x1b0 [nvme_core]
         nvme_update_ns_ana_state+0x2b/0x30 [nvme_core]
         nvme_update_ana_state+0xca/0xe0 [nvme_core]
         nvme_parse_ana_log+0xac/0x170 [nvme_core]
         nvme_read_ana_log+0x7d/0xe0 [nvme_core]
         nvme_mpath_init_identify+0x105/0x150 [nvme_core]
         nvme_init_identify+0x2df/0x4d0 [nvme_core]
         nvme_init_ctrl_finish+0x8d/0x3b0 [nvme_core]
         nvme_tcp_setup_ctrl+0x337/0x390 [nvme_tcp]
         nvme_tcp_reconnect_ctrl_work+0x24/0x40 [nvme_tcp]
         process_one_work+0x1bd/0x360
         worker_thread+0x50/0x3d0
    
    Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ee0323cc8bbb7fde782f1aec722de8994832953b
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Sat Mar 26 00:05:00 2022 +0800

    ALSA: hda/realtek: Enable headset mic on Lenovo P360
    
    [ Upstream commit 5a8738571747c1e275a40b69a608657603867b7e ]
    
    Lenovo P360 is another platform equipped with ALC897, and it needs
    ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.
    
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Link: https://lore.kernel.org/r/20220325160501.705221-1-kai.heng.feng@canonical.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c0d86f2a3c031222f625d6264307a35bf09ea874
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Mar 22 12:48:10 2022 +0100

    crypto: x86/chacha20 - Avoid spurious jumps to other functions
    
    [ Upstream commit 4327d168515fd8b5b92fa1efdf1d219fb6514460 ]
    
    The chacha_Nblock_xor_avx512vl() functions all have their own,
    identical, .LdoneN label, however in one particular spot {2,4} jump to
    the 8 version instead of their own. Resulting in:
    
      arch/x86/crypto/chacha-x86_64.o: warning: objtool: chacha_2block_xor_avx512vl() falls through to next function chacha_8block_xor_avx512vl()
      arch/x86/crypto/chacha-x86_64.o: warning: objtool: chacha_4block_xor_avx512vl() falls through to next function chacha_8block_xor_avx512vl()
    
    Make each function consistently use its own done label.
    
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Martin Willi <martin@strongswan.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f0213894337afa0b5367ea11c6879c27ece556c7
Author: Zheng Yongjun <zhengyongjun3@huawei.com>
Date:   Thu Mar 17 13:16:13 2022 +0000

    crypto: stm32 - fix reference leak in stm32_crc_remove
    
    [ Upstream commit e9a36feecee0ee5845f2e0656f50f9942dd0bed3 ]
    
    pm_runtime_get_sync() will increment pm usage counter even it
    failed. Forgetting to call pm_runtime_put_noidle will result
    in reference leak in stm32_crc_remove, so we should fix it.
    
    Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8c015cd524424e79b31270bd3dbdac9612c6f7db
Author: Zheng Yongjun <zhengyongjun3@huawei.com>
Date:   Sun Mar 20 21:56:38 2022 -0700

    Input: stmfts - fix reference leak in stmfts_input_open
    
    [ Upstream commit 26623eea0da3476446909af96c980768df07bbd9 ]
    
    pm_runtime_get_sync() will increment pm usage counter even it
    failed. Forgetting to call pm_runtime_put_noidle will result
    in reference leak in stmfts_input_open, so we should fix it.
    
    Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
    Link: https://lore.kernel.org/r/20220317131604.53538-1-zhengyongjun3@huawei.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bb83a744bc671804016e23861a892e9db2aee73f
Author: Jeff LaBundy <jeff@labundy.com>
Date:   Sun Mar 20 21:55:27 2022 -0700

    Input: add bounds checking to input_set_capability()
    
    [ Upstream commit 409353cbe9fe48f6bc196114c442b1cff05a39bc ]
    
    Update input_set_capability() to prevent kernel panic in case the
    event code exceeds the bitmap for the given event type.
    
    Suggested-by: Tomasz Moń <tomasz.mon@camlingroup.com>
    Signed-off-by: Jeff LaBundy <jeff@labundy.com>
    Reviewed-by: Tomasz Moń <tomasz.mon@camlingroup.com>
    Link: https://lore.kernel.org/r/20220320032537.545250-1-jeff@labundy.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4fd3966956465c05dc6ab2594197bc84653a36b2
Author: David Gow <davidgow@google.com>
Date:   Thu Feb 10 11:43:53 2022 +0800

    um: Cleanup syscall_handler_t definition/cast, fix warning
    
    [ Upstream commit f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9 ]
    
    The syscall_handler_t type for x86_64 was defined as 'long (*)(void)',
    but always cast to 'long (*)(long, long, long, long, long, long)' before
    use. This now triggers a warning (see below).
    
    Define syscall_handler_t as the latter instead, and remove the cast.
    This simplifies the code, and fixes the warning.
    
    Warning:
    In file included from ../arch/um/include/asm/processor-generic.h:13
                     from ../arch/x86/um/asm/processor.h:41
                     from ../include/linux/rcupdate.h:30
                     from ../include/linux/rculist.h:11
                     from ../include/linux/pid.h:5
                     from ../include/linux/sched.h:14
                     from ../include/linux/ptrace.h:6
                     from ../arch/um/kernel/skas/syscall.c:7:
    ../arch/um/kernel/skas/syscall.c: In function ‘handle_syscall’:
    ../arch/x86/um/shared/sysdep/syscalls_64.h:18:11: warning: cast between incompatible function types from ‘long int (*)(void)’ to ‘long int (*)(long int,  long int,  long int,  long int,  long int,  long int)’ [
    -Wcast-function-type]
       18 |         (((long (*)(long, long, long, long, long, long)) \
          |           ^
    ../arch/x86/um/asm/ptrace.h:36:62: note: in definition of macro ‘PT_REGS_SET_SYSCALL_RETURN’
       36 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) (PT_REGS_AX(r) = (res))
          |                                                              ^~~
    ../arch/um/kernel/skas/syscall.c:46:33: note: in expansion of macro ‘EXECUTE_SYSCALL’
       46 |                                 EXECUTE_SYSCALL(syscall, regs));
          |                                 ^~~~~~~~~~~~~~~
    
    Signed-off-by: David Gow <davidgow@google.com>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0c319b9988357135adaecf17bdfbf385dd31c992
Author: Vincent Whitchurch <vincent.whitchurch@axis.com>
Date:   Fri Dec 10 17:09:51 2021 +0100

    rtc: fix use-after-free on device removal
    
    [ Upstream commit c8fa17d9f08a448184f03d352145099b5beb618e ]
    
    If the irqwork is still scheduled or running while the RTC device is
    removed, a use-after-free occurs in rtc_timer_do_work().  Cleanup the
    timerqueue and ensure the work is stopped to fix this.
    
     BUG: KASAN: use-after-free in mutex_lock+0x94/0x110
     Write of size 8 at addr ffffff801d846338 by task kworker/3:1/41
    
     Workqueue: events rtc_timer_do_work
     Call trace:
      mutex_lock+0x94/0x110
      rtc_timer_do_work+0xec/0x630
      process_one_work+0x5fc/0x1344
      ...
    
     Allocated by task 551:
      kmem_cache_alloc_trace+0x384/0x6e0
      devm_rtc_allocate_device+0xf0/0x574
      devm_rtc_device_register+0x2c/0x12c
      ...
    
     Freed by task 572:
      kfree+0x114/0x4d0
      rtc_device_release+0x64/0x80
      device_release+0x8c/0x1f4
      kobject_put+0x1c4/0x4b0
      put_device+0x20/0x30
      devm_rtc_release_device+0x1c/0x30
      devm_action_release+0x54/0x90
      release_nodes+0x124/0x310
      devres_release_group+0x170/0x240
      i2c_device_remove+0xd8/0x314
      ...
    
     Last potentially related work creation:
      insert_work+0x5c/0x330
      queue_work_on+0xcc/0x154
      rtc_set_time+0x188/0x5bc
      rtc_dev_ioctl+0x2ac/0xbd0
      ...
    
    Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/r/20211210160951.7718-1-vincent.whitchurch@axis.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 05df3bdbc259fb673716f3df6e307d761637d1a2
Author: Miroslav Benes <mbenes@suse.cz>
Date:   Thu Mar 26 10:26:03 2020 +0100

    x86/xen: Make the secondary CPU idle tasks reliable
    
    commit c3881eb58d56116c79ac4ee4f40fd15ead124c4b upstream.
    
    The unwinder reports the secondary CPU idle tasks' stack on XEN PV as
    unreliable, which affects at least live patching.
    cpu_initialize_context() sets up the context of the CPU through
    VCPUOP_initialise hypercall. After it is woken up, the idle task starts
    in cpu_bringup_and_idle() function and its stack starts at the offset
    right below pt_regs. The unwinder correctly detects the end of stack
    there but it is confused by NULL return address in the last frame.
    
    Introduce a wrapper in assembly, which just calls
    cpu_bringup_and_idle(). The return address is thus pushed on the stack
    and the wrapper contains the annotation hint for the unwinder regarding
    the stack state.
    
    Signed-off-by: Miroslav Benes <mbenes@suse.cz>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Markus Boehme <markubo@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d3817cb4ebe57754fa4f4bda87c13e6a2e000d9
Author: Miroslav Benes <mbenes@suse.cz>
Date:   Thu Mar 26 10:26:02 2020 +0100

    x86/xen: Make the boot CPU idle task reliable
    
    commit 2f62f36e62daec43aa7b9633ef7f18e042a80bed upstream.
    
    The unwinder reports the boot CPU idle task's stack on XEN PV as
    unreliable, which affects at least live patching. There are two reasons
    for this. First, the task does not follow the x86 convention that its
    stack starts at the offset right below saved pt_regs. It allows the
    unwinder to easily detect the end of the stack and verify it. Second,
    startup_xen() function does not store the return address before jumping
    to xen_start_kernel() which confuses the unwinder.
    
    Amend both issues by moving the starting point of initial stack in
    startup_xen() and storing the return address before the jump, which is
    exactly what call instruction does.
    
    Signed-off-by: Miroslav Benes <mbenes@suse.cz>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Markus Boehme <markubo@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67e2b62461b5d02a1e63103e8a02c0bca75e26c7
Author: Willy Tarreau <w@1wt.eu>
Date:   Sun May 8 11:37:07 2022 +0200

    floppy: use a statically allocated error counter
    
    commit f71f01394f742fc4558b3f9f4c7ef4c4cf3b07c8 upstream.
    
    Interrupt handler bad_flp_intr() may cause a UAF on the recently freed
    request just to increment the error count.  There's no point keeping
    that one in the request anyway, and since the interrupt handler uses a
    static pointer to the error which cannot be kept in sync with the
    pending request, better make it use a static error counter that's reset
    for each new request.  This reset now happens when entering
    redo_fd_request() for a new request via set_next_request().
    
    One initial concern about a single error counter was that errors on one
    floppy drive could be reported on another one, but this problem is not
    real given that the driver uses a single drive at a time, as that
    PC-compatible controllers also have this limitation by using shared
    signals.  As such the error count is always for the "current" drive.
    
    Reported-by: Minh Yuan <yuanmingbuaa@gmail.com>
    Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
    Tested-by: Denis Efremov <efremov@linux.com>
    Signed-off-by: Willy Tarreau <w@1wt.eu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Denis Efremov <efremov@linux.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>