commit 1321ab403b38366a4cfb283145bb2c005becb1e5
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Aug 11 12:08:27 2023 +0200

    Linux 6.1.45
    
    Link: https://lore.kernel.org/r/20230809103636.615294317@linuxfoundation.org
    Tested-by: Miguel Ojeda <ojeda@kernel.org> # Rust
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2615bb47be4f53be92c81a6a8aa286c92ef04d9
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Sat Aug 5 00:06:43 2023 +0200

    x86/CPU/AMD: Do not leak quotient data after a division by 0
    
    commit 77245f1c3c6495521f6a3af082696ee2f8ce3921 upstream.
    
    Under certain circumstances, an integer division by 0 which faults, can
    leave stale quotient data from a previous division operation on Zen1
    microarchitectures.
    
    Do a dummy division 0/1 before returning from the #DE exception handler
    in order to avoid any leaks of potentially sensitive data.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 673cdde74fd13fff0acc4c6c41f5f949434156a5
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Aug 9 11:13:22 2023 +0200

    Revert "drm/i915: Disable DC states for all commits"
    
    This reverts commit 0fc6fea41c7122aa5f2088117f50144b507e13d7 which is
    commit a2b6e99d8a623544f3bdccd28ee35b9c1b00daa5 upstream.
    
    It is reported to cause regression issues, so it should be reverted from
    the 6.1.y tree for now.
    
    Reported-by: Thorsten Leemhuis <regressions@leemhuis.info>
    Link: https://lore.kernel.org/r/f0870e8f-0c66-57fd-f95d-18d014a11939@leemhuis.info
    Link: https://gitlab.freedesktop.org/drm/intel/-/issues/8419
    Cc: Manasi Navare <navaremanasi@google.com>
    Cc: Drew Davenport <ddavenport@chromium.org>
    Cc: Jouni Högander <jouni.hogander@intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af7215182417c892e09bcb6829377ce5c69f127f
Author: Lijo Lazar <lijo.lazar@amd.com>
Date:   Tue Aug 8 12:50:55 2023 -0500

    drm/amdgpu: Use apt name for FW reserved region
    
    commit db3b5cb64a9ca301d14ed027e470834316720e42 upstream
    
    Use the generic term fw_reserved_memory for FW reserve region. This
    region may also hold discovery TMR in addition to other reserve
    regions. This region size could be larger than discovery tmr size, hence
    don't change the discovery tmr size based on this.
    
    Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
    Reviewed-by: Le Ma <le.ma@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [ This change fixes reading IP discovery from debugfs.
      It needed to be hand modified because:
      * GC 9.4.3 support isn't introduced in older kernels until
        228ce176434b ("drm/amdgpu: Handle VRAM dependencies on GFXIP9.4.3")
      * It also changed because of 58ab2c08d708 (drm/amdgpu: use VRAM|GTT
        for a bunch of kernel allocations) not being present.
      Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2748 ]
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d0a34c42f0d50c06ca21761d625a823e245118e
Author: Luben Tuikov <luben.tuikov@amd.com>
Date:   Tue Aug 8 12:50:54 2023 -0500

    drm/amdgpu: Remove unnecessary domain argument
    
    commit 3273f11675ef11959d25a56df3279f712bcd41b7 upstream
    
    Remove the "domain" argument to amdgpu_bo_create_kernel_at() since this
    function takes an "offset" argument which is the offset off of VRAM, and as
    such allocation always takes place in VRAM. Thus, the "domain" argument is
    unnecessary.
    
    Cc: Alex Deucher <Alexander.Deucher@amd.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: AMD Graphics <amd-gfx@lists.freedesktop.org>
    Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 526defeec474ea8002b8312b9c88f96fa1f85a48
Author: Tong Liu01 <Tong.Liu01@amd.com>
Date:   Tue Aug 8 12:50:53 2023 -0500

    drm/amdgpu: add vram reservation based on vram_usagebyfirmware_v2_2
    
    commit 4864f2ee9ee2acf4a1009b58fbc62f17fa086d4e upstream
    
    Move TMR region from top of FB to 2MB for FFBM, so we need to
    reserve TMR region firstly to make sure TMR can be allocated at 2MB
    
    Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 99255a2b68495d9ada122b6f2e262d967f9ceb61
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Aug 3 19:33:21 2023 +0100

    arm64/ptrace: Don't enable SVE when setting streaming SVE
    
    commit 045aecdfcb2e060db142d83a0f4082380c465d2c upstream.
    
    Systems which implement SME without also implementing SVE are
    architecturally valid but were not initially supported by the kernel,
    unfortunately we missed one issue in the ptrace code.
    
    The SVE register setting code is shared between SVE and streaming mode
    SVE. When we set full SVE register state we currently enable TIF_SVE
    unconditionally, in the case where streaming SVE is being configured on a
    system that supports vanilla SVE this is not an issue since we always
    initialise enough state for both vector lengths but on a system which only
    support SME it will result in us attempting to restore the SVE vector
    length after having set streaming SVE registers.
    
    Fix this by making the enabling of SVE conditional on setting SVE vector
    state. If we set streaming SVE state and SVE was not already enabled this
    will result in a SVE access trap on next use of normal SVE, this will cause
    us to flush our register state but this is fine since the only way to
    trigger a SVE access trap would be to exit streaming mode which will cause
    the in register state to be flushed anyway.
    
    Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-ssve-no-sve-v1-1-49df214bfb3e@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    [Fix up backport -- broonie]
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c2fdf827f8fc6a571e1b7cc38a61041f0321adf5
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Thu Jul 13 21:59:37 2023 +0900

    exfat: check if filename entries exceeds max filename length
    
    [ Upstream commit d42334578eba1390859012ebb91e1e556d51db49 ]
    
    exfat_extract_uni_name copies characters from a given file name entry into
    the 'uniname' variable. This variable is actually defined on the stack of
    the exfat_readdir() function. According to the definition of
    the 'exfat_uni_name' type, the file name should be limited 255 characters
    (+ null teminator space), but the exfat_get_uniname_from_ext_entry()
    function can write more characters because there is no check if filename
    entries exceeds max filename length. This patch add the check not to copy
    filename characters when exceeding max filename length.
    
    Cc: stable@vger.kernel.org
    Cc: Yuezhang Mo <Yuezhang.Mo@sony.com>
    Reported-by: Maxim Suhanov <dfirblog@gmail.com>
    Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e2fb24ce37caeaecff08af4e9967c8462624312b
Author: Chao Yu <chao@kernel.org>
Date:   Tue May 23 11:58:22 2023 +0800

    f2fs: don't reset unchangable mount option in f2fs_remount()
    
    [ Upstream commit 458c15dfbce62c35fefd9ca637b20a051309c9f1 ]
    
    syzbot reports a bug as below:
    
    general protection fault, probably for non-canonical address 0xdffffc0000000009: 0000 [#1] PREEMPT SMP KASAN
    RIP: 0010:__lock_acquire+0x69/0x2000 kernel/locking/lockdep.c:4942
    Call Trace:
     lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691
     __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline]
     _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300
     __drop_extent_tree+0x3ac/0x660 fs/f2fs/extent_cache.c:1100
     f2fs_drop_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1116
     f2fs_insert_range+0x2d5/0x3c0 fs/f2fs/file.c:1664
     f2fs_fallocate+0x4e4/0x6d0 fs/f2fs/file.c:1838
     vfs_fallocate+0x54b/0x6b0 fs/open.c:324
     ksys_fallocate fs/open.c:347 [inline]
     __do_sys_fallocate fs/open.c:355 [inline]
     __se_sys_fallocate fs/open.c:353 [inline]
     __x64_sys_fallocate+0xbd/0x100 fs/open.c:353
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    The root cause is race condition as below:
    - since it tries to remount rw filesystem, so that do_remount won't
    call sb_prepare_remount_readonly to block fallocate, there may be race
    condition in between remount and fallocate.
    - in f2fs_remount(), default_options() will reset mount option to default
    one, and then update it based on result of parse_options(), so there is
    a hole which race condition can happen.
    
    Thread A                        Thread B
    - f2fs_fill_super
     - parse_options
      - clear_opt(READ_EXTENT_CACHE)
    
    - f2fs_remount
     - default_options
      - set_opt(READ_EXTENT_CACHE)
                                    - f2fs_fallocate
                                     - f2fs_insert_range
                                      - f2fs_drop_extent_tree
                                       - __drop_extent_tree
                                        - __may_extent_tree
                                         - test_opt(READ_EXTENT_CACHE) return true
                                        - write_lock(&et->lock) access NULL pointer
     - parse_options
      - clear_opt(READ_EXTENT_CACHE)
    
    Cc: <stable@vger.kernel.org>
    Reported-by: syzbot+d015b6c2fbb5c383bf08@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-f2fs-devel/20230522124203.3838360-1-chao@kernel.org
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6ba0594a81f91d6fd8ca9bd4ad23aa1618635a0f
Author: Yangtao Li <frank.li@vivo.com>
Date:   Thu Nov 10 17:15:01 2022 +0800

    f2fs: fix to set flush_merge opt and show noflush_merge
    
    [ Upstream commit 967eaad1fed5f6335ea97a47d45214744dc57925 ]
    
    Some minor modifications to flush_merge and related parameters:
    
      1.The FLUSH_MERGE opt is set by default only in non-ro mode.
      2.When ro and merge are set at the same time, an error is reported.
      3.Display noflush_merge mount opt.
    
    Suggested-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Yangtao Li <frank.li@vivo.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Stable-dep-of: 458c15dfbce6 ("f2fs: don't reset unchangable mount option in f2fs_remount()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e355972affb67aa2e9b6daa6d77008a6b88abcdf
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Jul 21 15:33:52 2023 -0700

    selftests/rseq: Play nice with binaries statically linked against glibc 2.35+
    
    [ Upstream commit 3bcbc20942db5d738221cca31a928efc09827069 ]
    
    To allow running rseq and KVM's rseq selftests as statically linked
    binaries, initialize the various "trampoline" pointers to point directly
    at the expect glibc symbols, and skip the dlysm() lookups if the rseq
    size is non-zero, i.e. the binary is statically linked *and* the libc
    registered its own rseq.
    
    Define weak versions of the symbols so as not to break linking against
    libc versions that don't support rseq in any capacity.
    
    The KVM selftests in particular are often statically linked so that they
    can be run on targets with very limited runtime environments, i.e. test
    machines.
    
    Fixes: 233e667e1ae3 ("selftests/rseq: Uplift rseq selftests for compatibility with glibc-2.35")
    Cc: Aaron Lewis <aaronlewis@google.com>
    Cc: kvm@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-Id: <20230721223352.2333911-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 56562676102e135e7aebada26c2aea146a5b5ad0
Author: Peichen Huang <PeiChen.Huang@amd.com>
Date:   Mon Mar 20 09:34:23 2023 +0800

    drm/amd/display: skip CLEAR_PAYLOAD_ID_TABLE if device mst_en is 0
    
    commit a1c9a1e27022d13c70a14c4faeab6ce293ad043b upstream.
    
    [Why]
    Some dock and mst monitor don't like to receive CLEAR_PAYLOAD_ID_TABLE
    when mst_en is set to 0. It doesn't make sense to do so in source
    side, either.
    
    [How]
    Don't send CLEAR_PAYLOAD_ID_TABLE if mst_en is 0
    
    Reviewed-by: George Shen <George.Shen@amd.com>
    Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
    Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [ 6.1.y doesn't have the file rename from
      54618888d1ea7 ("drm/amd/display: break down dc_link.c") ]
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 63eeb50fa11009cc4c82919b040c361c4ea0f14e
Author: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Date:   Thu Feb 16 09:49:22 2023 -0700

    drm/amd/display: Ensure that planes are in the same order
    
    commit bb46a6a9bab134b9d15043ea8fa9d6c276e938b8 upstream.
    
    The function dc_update_planes_and_stream handles multiple cases where DC
    needs to remove and add planes in the commit tail phase. After Linux
    started to use this function, some of the IGT kms_plane started to fail;
    one good example to illustrate why the new sequence regressed IGT is the
    subtest plane-position-hole which has the following diagram as a
    template:
    
     +--------------------+        +-----------------------+
     | +-----+            |        | +-----+               |
     | |     |            |        | | +-----+             |
     | |  +--+            | ==>    | | |   | |             |
     | |__|               |        | +-|---+ |             |
     |                    |        |   +-----+             |
     |                    |        |                       |
     +--------------------+        +-----------------------+
       (a) Final image                (b) Composed image
    
    IGT expects image (a) as the final result of two plane compositions as
    described in figure (b). After the migration to the new sequence, the
    last plane order is changed, and DC generates the following image:
    
    +---------------------+
    | +-----+             |
    | |     |             |
    | |     |             |
    | +-----+             |
    |                     |
    +---------------------+
    
    Notice that the generated image by DC is different because the small
    square that should be composed on top of the primary plane is below the
    primary plane. For this reason, the CRC will mismatch with the expected
    value. Since the function dc_add_all_planes_for_stream re-append all the
    new planes back to the dc_validation_set, this commit ensures that the
    original sequence is maintained. After this change, all CI tests in all
    ASICs start to pass again.
    
    Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
    Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
    Suggested-by: Melissa Wen <mwen@igalia.com>
    Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 740d4cae248ab532b5e6894a8eb94d117d6aa37a
Author: Alexander Stein <alexander.stein@ew.tq-group.com>
Date:   Mon May 15 09:21:37 2023 +0200

    drm/imx/ipuv3: Fix front porch adjustment upon hactive aligning
    
    [ Upstream commit ee31742bf17636da1304af77b2cb1c29b5dda642 ]
    
    When hactive is not aligned to 8 pixels, it is aligned accordingly and
    hfront porch needs to be reduced the same amount. Unfortunately the front
    porch is set to the difference rather than reducing it. There are some
    Samsung TVs which can't cope with a front porch of instead of 70.
    
    Fixes: 94dfec48fca7 ("drm/imx: Add 8 pixel alignment fix")
    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
    Link: https://lore.kernel.org/r/20230515072137.116211-1-alexander.stein@ew.tq-group.com
    [p.zabel@pengutronix.de: Fixed subject]
    Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230515072137.116211-1-alexander.stein@ew.tq-group.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a492b8281c3673895a77d9d66d1d5411b50f0072
Author: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Date:   Mon Jul 24 23:43:20 2023 +0530

    powerpc/mm/altmap: Fix altmap boundary check
    
    [ Upstream commit 6722b25712054c0f903b839b8f5088438dd04df3 ]
    
    altmap->free includes the entire free space from which altmap blocks
    can be allocated. So when checking whether the kernel is doing altmap
    block free, compute the boundary correctly, otherwise memory hotunplug
    can fail.
    
    Fixes: 9ef34630a461 ("powerpc/mm: Fallback to RAM if the altmap is unusable")
    Signed-off-by: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20230724181320.471386-1-aneesh.kumar@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f4b700c71802c81e6f9dce362ee7a0312c8377ba
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Wed Jul 19 23:55:01 2023 +0200

    mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()
    
    [ Upstream commit c6abce60338aa2080973cd95be0aedad528bb41f ]
    
    'op-cs' is copied in 'fun->mchip_number' which is used to access the
    'mchip_offsets' and the 'rnb_gpio' arrays.
    These arrays have NAND_MAX_CHIPS elements, so the index must be below this
    limit.
    
    Fix the sanity check in order to avoid the NAND_MAX_CHIPS value. This
    would lead to out-of-bound accesses.
    
    Fixes: 54309d657767 ("mtd: rawnand: fsl_upm: Implement exec_op()")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/cd01cba1c7eda58bdabaae174c78c067325803d2.1689803636.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b71c00256da4e1d2f7f9bed31038a152bc40dbf9
Author: Johan Jonker <jbx6244@gmail.com>
Date:   Fri Jul 14 17:21:21 2023 +0200

    mtd: rawnand: rockchip: Align hwecc vs. raw page helper layouts
    
    [ Upstream commit ea690ad78dd611e3906df5b948a516000b05c1cb ]
    
    Currently, read/write_page_hwecc() and read/write_page_raw() are not
    aligned: there is a mismatch in the OOB bytes which are not
    read/written at the same offset in both cases (raw vs. hwecc).
    
    This is a real problem when relying on the presence of the Page
    Addresses (PA) when using the NAND chip as a boot device, as the
    BootROM expects additional data in the OOB area at specific locations.
    
    Rockchip boot blocks are written per 4 x 512 byte sectors per page.
    Each page with boot blocks must have a page address (PA) pointer in OOB
    to the next page. Pages are written in a pattern depending on the NAND chip ID.
    
    Generate boot block page address and pattern for hwecc in user space
    and copy PA data to/from the already reserved last 4 bytes before ECC
    in the chip->oob_poi data layout.
    
    Align the different helpers. This change breaks existing jffs2 users.
    
    Fixes: 058e0e847d54 ("mtd: rawnand: rockchip: NFC driver for RK3308, RK2928 and others")
    Signed-off-by: Johan Jonker <jbx6244@gmail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/5e782c08-862b-51ae-47ff-3299940928ca@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5a8a35b71bd34570983505bcdc16c9456e8970d0
Author: Johan Jonker <jbx6244@gmail.com>
Date:   Fri Jul 14 17:21:01 2023 +0200

    mtd: rawnand: rockchip: fix oobfree offset and description
    
    [ Upstream commit d0ca3b92b7a6f42841ea9da8492aaf649db79780 ]
    
    Rockchip boot blocks are written per 4 x 512 byte sectors per page.
    Each page with boot blocks must have a page address (PA) pointer in OOB
    to the next page.
    
    The currently advertised free OOB area starts at offset 6, like
    if 4 PA bytes were located right after the BBM. This is wrong as the
    PA bytes are located right before the ECC bytes.
    
    Fix the layout by allowing access to all bytes between the BBM and the
    PA bytes instead of reserving 4 bytes right after the BBM.
    
    This change breaks existing jffs2 users.
    
    Fixes: 058e0e847d54 ("mtd: rawnand: rockchip: NFC driver for RK3308, RK2928 and others")
    Signed-off-by: Johan Jonker <jbx6244@gmail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/d202f12d-188c-20e8-f2c2-9cc874ad4d22@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6c591fce484ebef302b510b71cd3269f1ca31346
Author: Roger Quadros <rogerq@kernel.org>
Date:   Sun Jun 25 00:10:21 2023 +0530

    mtd: rawnand: omap_elm: Fix incorrect type in assignment
    
    [ Upstream commit d8403b9eeee66d5dd81ecb9445800b108c267ce3 ]
    
    Once the ECC word endianness is converted to BE32, we force cast it
    to u32 so we can use elm_write_reg() which in turn uses writel().
    
    Fixes below sparse warnings:
    
       drivers/mtd/nand/raw/omap_elm.c:180:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:180:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:185:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:185:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:190:37: sparse:     expected unsigned int [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:190:37: sparse:     got restricted __be32 [usertype]
    >> drivers/mtd/nand/raw/omap_elm.c:200:40: sparse: sparse: restricted __be32 degrades to integer
       drivers/mtd/nand/raw/omap_elm.c:206:39: sparse: sparse: restricted __be32 degrades to integer
       drivers/mtd/nand/raw/omap_elm.c:210:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:210:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:213:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:213:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:216:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:216:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:219:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:219:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:222:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:222:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:225:37: sparse:     expected unsigned int [assigned] [usertype] val
       drivers/mtd/nand/raw/omap_elm.c:225:37: sparse:     got restricted __be32 [usertype]
       drivers/mtd/nand/raw/omap_elm.c:228:39: sparse: sparse: restricted __be32 degrades to integer
    
    Fixes: bf22433575ef ("mtd: devices: elm: Add support for ELM error correction")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202306212211.WDXokuWh-lkp@intel.com/
    Signed-off-by: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230624184021.7740-1-rogerq@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88b1958fb57dd99406fd9f4ba4c2daf5e01168b8
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Fri May 19 15:21:16 2023 +0100

    io_uring: annotate offset timeout races
    
    commit 5498bf28d8f2bd63a46ad40f4427518615fb793f upstream.
    
    It's racy to read ->cached_cq_tail without taking proper measures
    (usually grabbing ->completion_lock) as timeout requests with CQE
    offsets do, however they have never had a good semantics for from
    when they start counting. Annotate racy reads with data_race().
    
    Reported-by: syzbot+cb265db2f3f3468ef436@syzkaller.appspotmail.com
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/4de3685e185832a92a572df2be2c735d2e21a83d.1684506056.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a78a8bcdc26de5ef3a0ee27c9c6c512e54a6051c
Author: Chao Yu <chao@kernel.org>
Date:   Thu Jun 29 19:11:44 2023 +0800

    f2fs: fix to do sanity check on direct node in truncate_dnode()
    
    commit a6ec83786ab9f13f25fb18166dee908845713a95 upstream.
    
    syzbot reports below bug:
    
    BUG: KASAN: slab-use-after-free in f2fs_truncate_data_blocks_range+0x122a/0x14c0 fs/f2fs/file.c:574
    Read of size 4 at addr ffff88802a25c000 by task syz-executor148/5000
    
    CPU: 1 PID: 5000 Comm: syz-executor148 Not tainted 6.4.0-rc7-syzkaller-00041-ge660abd551f1 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
     print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
     print_report mm/kasan/report.c:462 [inline]
     kasan_report+0x11c/0x130 mm/kasan/report.c:572
     f2fs_truncate_data_blocks_range+0x122a/0x14c0 fs/f2fs/file.c:574
     truncate_dnode+0x229/0x2e0 fs/f2fs/node.c:944
     f2fs_truncate_inode_blocks+0x64b/0xde0 fs/f2fs/node.c:1154
     f2fs_do_truncate_blocks+0x4ac/0xf30 fs/f2fs/file.c:721
     f2fs_truncate_blocks+0x7b/0x300 fs/f2fs/file.c:749
     f2fs_truncate.part.0+0x4a5/0x630 fs/f2fs/file.c:799
     f2fs_truncate include/linux/fs.h:825 [inline]
     f2fs_setattr+0x1738/0x2090 fs/f2fs/file.c:1006
     notify_change+0xb2c/0x1180 fs/attr.c:483
     do_truncate+0x143/0x200 fs/open.c:66
     handle_truncate fs/namei.c:3295 [inline]
     do_open fs/namei.c:3640 [inline]
     path_openat+0x2083/0x2750 fs/namei.c:3791
     do_filp_open+0x1ba/0x410 fs/namei.c:3818
     do_sys_openat2+0x16d/0x4c0 fs/open.c:1356
     do_sys_open fs/open.c:1372 [inline]
     __do_sys_creat fs/open.c:1448 [inline]
     __se_sys_creat fs/open.c:1442 [inline]
     __x64_sys_creat+0xcd/0x120 fs/open.c:1442
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    The root cause is, inodeA references inodeB via inodeB's ino, once inodeA
    is truncated, it calls truncate_dnode() to truncate data blocks in inodeB's
    node page, it traverse mapping data from node->i.i_addr[0] to
    node->i.i_addr[ADDRS_PER_BLOCK() - 1], result in out-of-boundary access.
    
    This patch fixes to add sanity check on dnode page in truncate_dnode(),
    so that, it can help to avoid triggering such issue, and once it encounters
    such issue, it will record newly introduced ERROR_INVALID_NODE_REFERENCE
    error into superblock, later fsck can detect such issue and try repairing.
    
    Also, it removes f2fs_truncate_data_blocks() for cleanup due to the
    function has only one caller, and uses f2fs_truncate_data_blocks_range()
    instead.
    
    Reported-and-tested-by: syzbot+12cb4425b22169b52036@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-f2fs-devel/000000000000f3038a05fef867f8@google.com
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23e72231f8281505883514b23709076e234d4f27
Author: Filipe Manana <fdmanana@suse.com>
Date:   Fri Jun 30 16:03:44 2023 +0100

    btrfs: remove BUG_ON()'s in add_new_free_space()
    
    commit d8ccbd21918fd7fa6ce3226cffc22c444228e8ad upstream.
    
    At add_new_free_space() we have these BUG_ON()'s that are there to deal
    with any failure to add free space to the in memory free space cache.
    Such failures are mostly -ENOMEM that should be very rare. However there's
    no need to have these BUG_ON()'s, we can just return any error to the
    caller and all callers and their upper call chain are already dealing with
    errors.
    
    So just make add_new_free_space() return any errors, while removing the
    BUG_ON()'s, and returning the total amount of added free space to an
    optional u64 pointer argument.
    
    Reported-by: syzbot+3ba856e07b7127889d8c@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/linux-btrfs/000000000000e9cb8305ff4e8327@google.com/
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 56c0d76a97222f4a91912d43814c7129010f4725
Author: Jan Kara <jack@suse.cz>
Date:   Tue Jun 13 12:25:52 2023 +0200

    ext2: Drop fragment support
    
    commit 404615d7f1dcd4cca200e9a7a9df3a1dcae1dd62 upstream.
    
    Ext2 has fields in superblock reserved for subblock allocation support.
    However that never landed. Drop the many years dead code.
    
    Reported-by: syzbot+af5e10f73dbff48f70af@syzkaller.appspotmail.com
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 295ef44a2abaf97d7a594b1d4c60d4be3738191f
Author: Jan Kara <jack@suse.cz>
Date:   Thu Jun 15 13:38:48 2023 +0200

    fs: Protect reconfiguration of sb read-write from racing writes
    
    commit c541dce86c537714b6761a79a969c1623dfa222b upstream.
    
    The reconfigure / remount code takes a lot of effort to protect
    filesystem's reconfiguration code from racing writes on remounting
    read-only. However during remounting read-only filesystem to read-write
    mode userspace writes can start immediately once we clear SB_RDONLY
    flag. This is inconvenient for example for ext4 because we need to do
    some writes to the filesystem (such as preparation of quota files)
    before we can take userspace writes so we are clearing SB_RDONLY flag
    before we are fully ready to accept userpace writes and syzbot has found
    a way to exploit this [1]. Also as far as I'm reading the code
    the filesystem remount code was protected from racing writes in the
    legacy mount path by the mount's MNT_READONLY flag so this is relatively
    new problem. It is actually fairly easy to protect remount read-write
    from racing writes using sb->s_readonly_remount flag so let's just do
    that instead of having to workaround these races in the filesystem code.
    
    [1] https://lore.kernel.org/all/00000000000006a0df05f6667499@google.com/T/
    
    Signed-off-by: Jan Kara <jack@suse.cz>
    Message-Id: <20230615113848.8439-1-jack@suse.cz>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1bebbd9b8037a9cc75984317cb495dec4824c399
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Wed Jul 12 10:15:10 2023 -0400

    net: usbnet: Fix WARNING in usbnet_start_xmit/usb_submit_urb
    
    commit 5e1627cb43ddf1b24b92eb26f8d958a3f5676ccb upstream.
    
    The syzbot fuzzer identified a problem in the usbnet driver:
    
    usb 1-1: BOGUS urb xfer, pipe 3 != type 1
    WARNING: CPU: 0 PID: 754 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Modules linked in:
    CPU: 0 PID: 754 Comm: kworker/0:2 Not tainted 6.4.0-rc7-syzkaller-00014-g692b7dc87ca6 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
    Workqueue: mld mld_ifc_work
    RIP: 0010:usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Code: 7c 24 18 e8 2c b4 5b fb 48 8b 7c 24 18 e8 42 07 f0 fe 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 a0 c9 fc 8a e8 5a 6f 23 fb <0f> 0b e9 58 f8 ff ff e8 fe b3 5b fb 48 81 c5 c0 05 00 00 e9 84 f7
    RSP: 0018:ffffc9000463f568 EFLAGS: 00010086
    RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
    RDX: ffff88801eb28000 RSI: ffffffff814c03b7 RDI: 0000000000000001
    RBP: ffff8881443b7190 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000003
    R13: ffff88802a77cb18 R14: 0000000000000003 R15: ffff888018262500
    FS:  0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000556a99c15a18 CR3: 0000000028c71000 CR4: 0000000000350ef0
    Call Trace:
     <TASK>
     usbnet_start_xmit+0xfe5/0x2190 drivers/net/usb/usbnet.c:1453
     __netdev_start_xmit include/linux/netdevice.h:4918 [inline]
     netdev_start_xmit include/linux/netdevice.h:4932 [inline]
     xmit_one net/core/dev.c:3578 [inline]
     dev_hard_start_xmit+0x187/0x700 net/core/dev.c:3594
    ...
    
    This bug is caused by the fact that usbnet trusts the bulk endpoint
    addresses its probe routine receives in the driver_info structure, and
    it does not check to see that these endpoints actually exist and have
    the expected type and directions.
    
    The fix is simply to add such a check.
    
    Reported-and-tested-by: syzbot+63ee658b9a100ffadbe2@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-usb/000000000000a56e9105d0cec021@google.com/
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    CC: Oliver Neukum <oneukum@suse.com>
    Link: https://lore.kernel.org/r/ea152b6d-44df-4f8a-95c6-4db51143dcc1@rowland.harvard.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 203d58930d4ac3287fe8a3c7e7be8b86a4dc20de
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Wed Jun 7 19:19:02 2023 +0900

    debugobjects: Recheck debug_objects_enabled before reporting
    
    commit 8b64d420fe2450f82848178506d3e3a0bd195539 upstream.
    
    syzbot is reporting false a positive ODEBUG message immediately after
    ODEBUG was disabled due to OOM.
    
      [ 1062.309646][T22911] ODEBUG: Out of memory. ODEBUG disabled
      [ 1062.886755][ T5171] ------------[ cut here ]------------
      [ 1062.892770][ T5171] ODEBUG: assert_init not available (active state 0) object: ffffc900056afb20 object type: timer_list hint: process_timeout+0x0/0x40
    
      CPU 0 [ T5171]                CPU 1 [T22911]
      --------------                --------------
      debug_object_assert_init() {
        if (!debug_objects_enabled)
          return;
        db = get_bucket(addr);
                                    lookup_object_or_alloc() {
                                      debug_objects_enabled = 0;
                                      return NULL;
                                    }
                                    debug_objects_oom() {
                                      pr_warn("Out of memory. ODEBUG disabled\n");
                                      // all buckets get emptied here, and
                                    }
        lookup_object_or_alloc(addr, db, descr, false, true) {
          // this bucket is already empty.
          return ERR_PTR(-ENOENT);
        }
        // Emits false positive warning.
        debug_print_object(&o, "assert_init");
      }
    
    Recheck debug_object_enabled in debug_print_object() to avoid that.
    
    Reported-by: syzbot <syzbot+7937ba6a50bdd00fffdf@syzkaller.appspotmail.com>
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/492fe2ae-5141-d548-ebd5-62f5fe2e57f7@I-love.SAKURA.ne.jp
    Closes: https://syzkaller.appspot.com/bug?extid=7937ba6a50bdd00fffdf
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 29fac18499332211b2615ade356e2bd8b3269f98
Author: Sungwoo Kim <iam@sung-woo.kim>
Date:   Wed May 31 01:39:56 2023 -0400

    Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb
    
    commit 1728137b33c00d5a2b5110ed7aafb42e7c32e4a1 upstream.
    
    l2cap_sock_release(sk) frees sk. However, sk's children are still alive
    and point to the already free'd sk's address.
    To fix this, l2cap_sock_release(sk) also cleans sk's children.
    
    ==================================================================
    BUG: KASAN: use-after-free in l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650
    Read of size 8 at addr ffff888104617aa8 by task kworker/u3:0/276
    
    CPU: 0 PID: 276 Comm: kworker/u3:0 Not tainted 6.2.0-00001-gef397bd4d5fb-dirty #59
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
    Workqueue: hci2 hci_rx_work
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x72/0x95 lib/dump_stack.c:106
     print_address_description mm/kasan/report.c:306 [inline]
     print_report+0x175/0x478 mm/kasan/report.c:417
     kasan_report+0xb1/0x130 mm/kasan/report.c:517
     l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650
     l2cap_chan_ready+0x10e/0x1e0 net/bluetooth/l2cap_core.c:1386
     l2cap_config_req+0x753/0x9f0 net/bluetooth/l2cap_core.c:4480
     l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:5739 [inline]
     l2cap_sig_channel net/bluetooth/l2cap_core.c:6509 [inline]
     l2cap_recv_frame+0xe2e/0x43c0 net/bluetooth/l2cap_core.c:7788
     l2cap_recv_acldata+0x6ed/0x7e0 net/bluetooth/l2cap_core.c:8506
     hci_acldata_packet net/bluetooth/hci_core.c:3813 [inline]
     hci_rx_work+0x66e/0xbc0 net/bluetooth/hci_core.c:4048
     process_one_work+0x4ea/0x8e0 kernel/workqueue.c:2289
     worker_thread+0x364/0x8e0 kernel/workqueue.c:2436
     kthread+0x1b9/0x200 kernel/kthread.c:376
     ret_from_fork+0x2c/0x50 arch/x86/entry/entry_64.S:308
     </TASK>
    
    Allocated by task 288:
     kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
     kasan_set_track+0x25/0x30 mm/kasan/common.c:52
     ____kasan_kmalloc mm/kasan/common.c:374 [inline]
     __kasan_kmalloc+0x82/0x90 mm/kasan/common.c:383
     kasan_kmalloc include/linux/kasan.h:211 [inline]
     __do_kmalloc_node mm/slab_common.c:968 [inline]
     __kmalloc+0x5a/0x140 mm/slab_common.c:981
     kmalloc include/linux/slab.h:584 [inline]
     sk_prot_alloc+0x113/0x1f0 net/core/sock.c:2040
     sk_alloc+0x36/0x3c0 net/core/sock.c:2093
     l2cap_sock_alloc.constprop.0+0x39/0x1c0 net/bluetooth/l2cap_sock.c:1852
     l2cap_sock_create+0x10d/0x220 net/bluetooth/l2cap_sock.c:1898
     bt_sock_create+0x183/0x290 net/bluetooth/af_bluetooth.c:132
     __sock_create+0x226/0x380 net/socket.c:1518
     sock_create net/socket.c:1569 [inline]
     __sys_socket_create net/socket.c:1606 [inline]
     __sys_socket_create net/socket.c:1591 [inline]
     __sys_socket+0x112/0x200 net/socket.c:1639
     __do_sys_socket net/socket.c:1652 [inline]
     __se_sys_socket net/socket.c:1650 [inline]
     __x64_sys_socket+0x40/0x50 net/socket.c:1650
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    Freed by task 288:
     kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
     kasan_set_track+0x25/0x30 mm/kasan/common.c:52
     kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:523
     ____kasan_slab_free mm/kasan/common.c:236 [inline]
     ____kasan_slab_free mm/kasan/common.c:200 [inline]
     __kasan_slab_free+0x10a/0x190 mm/kasan/common.c:244
     kasan_slab_free include/linux/kasan.h:177 [inline]
     slab_free_hook mm/slub.c:1781 [inline]
     slab_free_freelist_hook mm/slub.c:1807 [inline]
     slab_free mm/slub.c:3787 [inline]
     __kmem_cache_free+0x88/0x1f0 mm/slub.c:3800
     sk_prot_free net/core/sock.c:2076 [inline]
     __sk_destruct+0x347/0x430 net/core/sock.c:2168
     sk_destruct+0x9c/0xb0 net/core/sock.c:2183
     __sk_free+0x82/0x220 net/core/sock.c:2194
     sk_free+0x7c/0xa0 net/core/sock.c:2205
     sock_put include/net/sock.h:1991 [inline]
     l2cap_sock_kill+0x256/0x2b0 net/bluetooth/l2cap_sock.c:1257
     l2cap_sock_release+0x1a7/0x220 net/bluetooth/l2cap_sock.c:1428
     __sock_release+0x80/0x150 net/socket.c:650
     sock_close+0x19/0x30 net/socket.c:1368
     __fput+0x17a/0x5c0 fs/file_table.c:320
     task_work_run+0x132/0x1c0 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
     exit_to_user_mode_prepare+0x113/0x120 kernel/entry/common.c:203
     __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
     syscall_exit_to_user_mode+0x21/0x50 kernel/entry/common.c:296
     do_syscall_64+0x4c/0x90 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    The buggy address belongs to the object at ffff888104617800
     which belongs to the cache kmalloc-1k of size 1024
    The buggy address is located 680 bytes inside of
     1024-byte region [ffff888104617800, ffff888104617c00)
    
    The buggy address belongs to the physical page:
    page:00000000dbca6a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888104614000 pfn:0x104614
    head:00000000dbca6a80 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
    flags: 0x200000000010200(slab|head|node=0|zone=2)
    raw: 0200000000010200 ffff888100041dc0 ffffea0004212c10 ffffea0004234b10
    raw: ffff888104614000 0000000000080002 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
     ffff888104617980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888104617a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff888104617a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                      ^
     ffff888104617b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888104617b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================
    
    Ack: This bug is found by FuzzBT with a modified Syzkaller. Other
    contributors are Ruoyu Wu and Hui Peng.
    Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1416eebaad80bdc85ad9f97f27242011b031e2a9
Author: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
Date:   Tue May 30 18:31:41 2023 -0700

    fs/sysv: Null check to prevent null-ptr-deref bug
    
    commit ea2b62f305893992156a798f665847e0663c9f41 upstream.
    
    sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on
    that leads to the null-ptr-deref bug.
    
    Reported-by: syzbot+aad58150cbc64ba41bdc@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=aad58150cbc64ba41bdc
    Signed-off-by: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
    Message-Id: <20230531013141.19487-1-princekumarmaurya06@gmail.com>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ccc6de4d4f3466fb70f17aea4e41b43742b6a979
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Tue Mar 28 20:05:16 2023 +0900

    fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_load_attr_list()
    
    commit ea303f72d70ce2f0b0aa94ab127085289768c5a6 upstream.
    
    syzbot is reporting too large allocation at ntfs_load_attr_list(), for
    a crafted filesystem can have huge data_size.
    
    Reported-by: syzbot <syzbot+89dbb3a789a5b9711793@syzkaller.appspotmail.com>
    Link: https://syzkaller.appspot.com/bug?extid=89dbb3a789a5b9711793
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 33d9490b27e5d8da4444aefd714a4f50189db978
Author: Roman Gushchin <roman.gushchin@linux.dev>
Date:   Tue May 2 09:08:38 2023 -0700

    mm: kmem: fix a NULL pointer dereference in obj_stock_flush_required()
    
    commit 3b8abb3239530c423c0b97e42af7f7e856e1ee96 upstream.
    
    KCSAN found an issue in obj_stock_flush_required():
    stock->cached_objcg can be reset between the check and dereference:
    
    ==================================================================
    BUG: KCSAN: data-race in drain_all_stock / drain_obj_stock
    
    write to 0xffff888237c2a2f8 of 8 bytes by task 19625 on cpu 0:
     drain_obj_stock+0x408/0x4e0 mm/memcontrol.c:3306
     refill_obj_stock+0x9c/0x1e0 mm/memcontrol.c:3340
     obj_cgroup_uncharge+0xe/0x10 mm/memcontrol.c:3408
     memcg_slab_free_hook mm/slab.h:587 [inline]
     __cache_free mm/slab.c:3373 [inline]
     __do_kmem_cache_free mm/slab.c:3577 [inline]
     kmem_cache_free+0x105/0x280 mm/slab.c:3602
     __d_free fs/dcache.c:298 [inline]
     dentry_free fs/dcache.c:375 [inline]
     __dentry_kill+0x422/0x4a0 fs/dcache.c:621
     dentry_kill+0x8d/0x1e0
     dput+0x118/0x1f0 fs/dcache.c:913
     __fput+0x3bf/0x570 fs/file_table.c:329
     ____fput+0x15/0x20 fs/file_table.c:349
     task_work_run+0x123/0x160 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop+0xcf/0xe0 kernel/entry/common.c:171
     exit_to_user_mode_prepare+0x6a/0xa0 kernel/entry/common.c:203
     __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
     syscall_exit_to_user_mode+0x26/0x140 kernel/entry/common.c:296
     do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    read to 0xffff888237c2a2f8 of 8 bytes by task 19632 on cpu 1:
     obj_stock_flush_required mm/memcontrol.c:3319 [inline]
     drain_all_stock+0x174/0x2a0 mm/memcontrol.c:2361
     try_charge_memcg+0x6d0/0xd10 mm/memcontrol.c:2703
     try_charge mm/memcontrol.c:2837 [inline]
     mem_cgroup_charge_skmem+0x51/0x140 mm/memcontrol.c:7290
     sock_reserve_memory+0xb1/0x390 net/core/sock.c:1025
     sk_setsockopt+0x800/0x1e70 net/core/sock.c:1525
     udp_lib_setsockopt+0x99/0x6c0 net/ipv4/udp.c:2692
     udp_setsockopt+0x73/0xa0 net/ipv4/udp.c:2817
     sock_common_setsockopt+0x61/0x70 net/core/sock.c:3668
     __sys_setsockopt+0x1c3/0x230 net/socket.c:2271
     __do_sys_setsockopt net/socket.c:2282 [inline]
     __se_sys_setsockopt net/socket.c:2279 [inline]
     __x64_sys_setsockopt+0x66/0x80 net/socket.c:2279
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    value changed: 0xffff8881382d52c0 -> 0xffff888138893740
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 PID: 19632 Comm: syz-executor.0 Not tainted 6.3.0-rc2-syzkaller-00387-g534293368afa #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
    
    Fix it by using READ_ONCE()/WRITE_ONCE() for all accesses to
    stock->cached_objcg.
    
    Link: https://lkml.kernel.org/r/20230502160839.361544-1-roman.gushchin@linux.dev
    Fixes: bf4f059954dc ("mm: memcg/slab: obj_cgroup API")
    Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
    Reported-by: syzbot+774c29891415ab0fd29d@syzkaller.appspotmail.com
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
      Link: https://lore.kernel.org/linux-mm/CACT4Y+ZfucZhM60YPphWiCLJr6+SGFhT+jjm8k1P-a_8Kkxsjg@mail.gmail.com/T/#t
    Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
    Acked-by: Shakeel Butt <shakeelb@google.com>
    Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4968484ac8efb7b958c938b321c1f4be536babd3
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Aug 3 11:35:53 2023 -0700

    file: reinstate f_pos locking optimization for regular files
    
    commit 797964253d358cf8d705614dda394dbe30120223 upstream.
    
    In commit 20ea1e7d13c1 ("file: always lock position for
    FMODE_ATOMIC_POS") we ended up always taking the file pos lock, because
    pidfd_getfd() could get a reference to the file even when it didn't have
    an elevated file count due to threading of other sharing cases.
    
    But Mateusz Guzik reports that the extra locking is actually measurable,
    so let's re-introduce the optimization, and only force the locking for
    directory traversal.
    
    Directories need the lock for correctness reasons, while regular files
    only need it for "POSIX semantics".  Since pidfd_getfd() is about
    debuggers etc special things that are _way_ outside of POSIX, we can
    relax the rules for that case.
    
    Reported-by: Mateusz Guzik <mjguzik@gmail.com>
    Cc: Christian Brauner <brauner@kernel.org>
    Link: https://lore.kernel.org/linux-fsdevel/20230803095311.ijpvhx3fyrbkasul@f/
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7a1178a3671b40746830d355836b72e47ceb2490
Author: Hou Tao <houtao1@huawei.com>
Date:   Sat Jul 29 17:51:06 2023 +0800

    bpf, cpumap: Make sure kthread is running before map update returns
    
    commit 640a604585aa30f93e39b17d4d6ba69fcb1e66c9 upstream.
    
    The following warning was reported when running stress-mode enabled
    xdp_redirect_cpu with some RT threads:
    
      ------------[ cut here ]------------
      WARNING: CPU: 4 PID: 65 at kernel/bpf/cpumap.c:135
      CPU: 4 PID: 65 Comm: kworker/4:1 Not tainted 6.5.0-rc2+ #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
      Workqueue: events cpu_map_kthread_stop
      RIP: 0010:put_cpu_map_entry+0xda/0x220
      ......
      Call Trace:
       <TASK>
       ? show_regs+0x65/0x70
       ? __warn+0xa5/0x240
       ......
       ? put_cpu_map_entry+0xda/0x220
       cpu_map_kthread_stop+0x41/0x60
       process_one_work+0x6b0/0xb80
       worker_thread+0x96/0x720
       kthread+0x1a5/0x1f0
       ret_from_fork+0x3a/0x70
       ret_from_fork_asm+0x1b/0x30
       </TASK>
    
    The root cause is the same as commit 436901649731 ("bpf: cpumap: Fix memory
    leak in cpu_map_update_elem"). The kthread is stopped prematurely by
    kthread_stop() in cpu_map_kthread_stop(), and kthread() doesn't call
    cpu_map_kthread_run() at all but XDP program has already queued some
    frames or skbs into ptr_ring. So when __cpu_map_ring_cleanup() checks
    the ptr_ring, it will find it was not emptied and report a warning.
    
    An alternative fix is to use __cpu_map_ring_cleanup() to drop these
    pending frames or skbs when kthread_stop() returns -EINTR, but it may
    confuse the user, because these frames or skbs have been handled
    correctly by XDP program. So instead of dropping these frames or skbs,
    just make sure the per-cpu kthread is running before
    __cpu_map_entry_alloc() returns.
    
    After apply the fix, the error handle for kthread_stop() will be
    unnecessary because it will always return 0, so just remove it.
    
    Fixes: 6710e1126934 ("bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP")
    Signed-off-by: Hou Tao <houtao1@huawei.com>
    Reviewed-by: Pu Lehui <pulehui@huawei.com>
    Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
    Link: https://lore.kernel.org/r/20230729095107.1722450-2-houtao@huaweicloud.com
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a211e9118d5c8f0f2ae8ca16e47f79cd9492a43
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Tue Jul 11 17:08:12 2023 +0200

    clk: imx93: Propagate correct error in imx93_clocks_probe()
    
    commit a29b2fccf5f2689a9637be85ff1f51c834c6fb33 upstream.
    
    smatch reports:
    
        drivers/clk/imx/clk-imx93.c:294 imx93_clocks_probe() error: uninitialized symbol 'base'.
    
    Indeed, in case of an error, the wrong (yet uninitialized) variable is
    converted to an error code and returned.
    Fix this by propagating the error code in the correct variable.
    
    Fixes: e02ba11b45764705 ("clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe")
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Closes: https://lore.kernel.org/all/9c2acd81-3ad8-485d-819e-9e4201277831@kadam.mountain
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/all/202306161533.4YDmL22b-lkp@intel.com/
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://lore.kernel.org/r/20230711150812.3562221-1-geert+renesas@glider.be
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 37f6073f7db329c9db4357f82e565958fb64ea16
Author: Andi Shyti <andi.shyti@linux.intel.com>
Date:   Tue Jul 25 02:19:44 2023 +0200

    drm/i915/gt: Cleanup aux invalidation registers
    
    commit d14560ac1b595aa2e792365e91fea6aeaee66c2b upstream.
    
    Fix the 'NV' definition postfix that is supposed to be INV.
    
    Take the chance to also order properly the registers based on
    their address and call the GEN12_GFX_CCS_AUX_INV address as
    GEN12_CCS_AUX_INV like all the other similar registers.
    
    Remove also VD1, VD3 and VE1 registers that don't exist and add
    BCS0 and CCS0.
    
    Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
    Cc: <stable@vger.kernel.org> # v5.8+
    Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
    Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230725001950.1014671-2-andi.shyti@linux.intel.com
    (cherry picked from commit 2f0b927d3ca3440445975ebde27f3df1c3ed6f76)
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4db8b39418a685179263b7ad895a3182d72be358
Author: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Date:   Thu Jul 20 11:35:44 2023 +0200

    drm/i915: Fix premature release of request's reusable memory
    
    commit a337b64f0d5717248a0c894e2618e658e6a9de9f upstream.
    
    Infinite waits for completion of GPU activity have been observed in CI,
    mostly inside __i915_active_wait(), triggered by igt@gem_barrier_race or
    igt@perf@stress-open-close.  Root cause analysis, based of ftrace dumps
    generated with a lot of extra trace_printk() calls added to the code,
    revealed loops of request dependencies being accidentally built,
    preventing the requests from being processed, each waiting for completion
    of another one's activity.
    
    After we substitute a new request for a last active one tracked on a
    timeline, we set up a dependency of our new request to wait on completion
    of current activity of that previous one.  While doing that, we must take
    care of keeping the old request still in memory until we use its
    attributes for setting up that await dependency, or we can happen to set
    up the await dependency on an unrelated request that already reuses the
    memory previously allocated to the old one, already released.  Combined
    with perf adding consecutive kernel context remote requests to different
    user context timelines, unresolvable loops of await dependencies can be
    built, leading do infinite waits.
    
    We obtain a pointer to the previous request to wait upon when we
    substitute it with a pointer to our new request in an active tracker,
    e.g. in intel_timeline.last_request.  In some processing paths we protect
    that old request from being freed before we use it by getting a reference
    to it under RCU protection, but in others, e.g.  __i915_request_commit()
    -> __i915_request_add_to_timeline() -> __i915_request_ensure_ordering(),
    we don't.  But anyway, since the requests' memory is SLAB_FAILSAFE_BY_RCU,
    that RCU protection is not sufficient against reuse of memory.
    
    We could protect i915_request's memory from being prematurely reused by
    calling its release function via call_rcu() and using rcu_read_lock()
    consequently, as proposed in v1.  However, that approach leads to
    significant (up to 10 times) increase of SLAB utilization by i915_request
    SLAB cache.  Another potential approach is to take a reference to the
    previous active fence.
    
    When updating an active fence tracker, we first lock the new fence,
    substitute a pointer of the current active fence with the new one, then we
    lock the substituted fence.  With this approach, there is a time window
    after the substitution and before the lock when the request can be
    concurrently released by an interrupt handler and its memory reused, then
    we may happen to lock and return a new, unrelated request.
    
    Always get a reference to the current active fence first, before
    replacing it with a new one.  Having it protected from premature release
    and reuse, lock it and then replace with the new one but only if not
    yet signalled via a potential concurrent interrupt nor replaced with
    another one by a potential concurrent thread, otherwise retry, starting
    from getting a reference to the new current one.  Adjust users to not
    get a reference to the previous active fence themselves and always put the
    reference got by __i915_active_fence_set() when no longer needed.
    
    v3: Fix lockdep splat reports and other issues caused by incorrect use of
        try_cmpxchg() (use (cmpxchg() != prev) instead)
    v2: Protect request's memory by getting a reference to it in favor of
        delegating its release to call_rcu() (Chris)
    
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8211
    Fixes: df9f85d8582e ("drm/i915: Serialise i915_active_fence_set() with itself")
    Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
    Cc: <stable@vger.kernel.org> # v5.6+
    Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
    Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230720093543.832147-2-janusz.krzysztofik@linux.intel.com
    (cherry picked from commit 946e047a3d88d46d15b5c5af0414098e12b243f7)
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1fdd16d89c01336d9a942b5f03673c17d401da87
Author: Guchun Chen <guchun.chen@amd.com>
Date:   Mon Jul 24 10:42:29 2023 +0800

    drm/ttm: check null pointer before accessing when swapping
    
    commit 2dedcf414bb01b8d966eb445db1d181d92304fb2 upstream.
    
    Add a check to avoid null pointer dereference as below:
    
    [   90.002283] general protection fault, probably for non-canonical
    address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
    [   90.002292] KASAN: null-ptr-deref in range
    [0x0000000000000000-0x0000000000000007]
    [   90.002346]  ? exc_general_protection+0x159/0x240
    [   90.002352]  ? asm_exc_general_protection+0x26/0x30
    [   90.002357]  ? ttm_bo_evict_swapout_allowable+0x322/0x5e0 [ttm]
    [   90.002365]  ? ttm_bo_evict_swapout_allowable+0x42e/0x5e0 [ttm]
    [   90.002373]  ttm_bo_swapout+0x134/0x7f0 [ttm]
    [   90.002383]  ? __pfx_ttm_bo_swapout+0x10/0x10 [ttm]
    [   90.002391]  ? lock_acquire+0x44d/0x4f0
    [   90.002398]  ? ttm_device_swapout+0xa5/0x260 [ttm]
    [   90.002412]  ? lock_acquired+0x355/0xa00
    [   90.002416]  ? do_raw_spin_trylock+0xb6/0x190
    [   90.002421]  ? __pfx_lock_acquired+0x10/0x10
    [   90.002426]  ? ttm_global_swapout+0x25/0x210 [ttm]
    [   90.002442]  ttm_device_swapout+0x198/0x260 [ttm]
    [   90.002456]  ? __pfx_ttm_device_swapout+0x10/0x10 [ttm]
    [   90.002472]  ttm_global_swapout+0x75/0x210 [ttm]
    [   90.002486]  ttm_tt_populate+0x187/0x3f0 [ttm]
    [   90.002501]  ttm_bo_handle_move_mem+0x437/0x590 [ttm]
    [   90.002517]  ttm_bo_validate+0x275/0x430 [ttm]
    [   90.002530]  ? __pfx_ttm_bo_validate+0x10/0x10 [ttm]
    [   90.002544]  ? kasan_save_stack+0x33/0x60
    [   90.002550]  ? kasan_set_track+0x25/0x30
    [   90.002554]  ? __kasan_kmalloc+0x8f/0xa0
    [   90.002558]  ? amdgpu_gtt_mgr_new+0x81/0x420 [amdgpu]
    [   90.003023]  ? ttm_resource_alloc+0xf6/0x220 [ttm]
    [   90.003038]  amdgpu_bo_pin_restricted+0x2dd/0x8b0 [amdgpu]
    [   90.003210]  ? __x64_sys_ioctl+0x131/0x1a0
    [   90.003210]  ? do_syscall_64+0x60/0x90
    
    Fixes: a2848d08742c ("drm/ttm: never consider pinned BOs for eviction&swap")
    Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Signed-off-by: Guchun Chen <guchun.chen@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Cc: stable@vger.kernel.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20230724024229.1118444-1-guchun.chen@amd.com
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4f03b0471ee007b4b26ee7bbbfa7cc289c63da98
Author: Aleksa Sarai <cyphar@cyphar.com>
Date:   Sun Aug 6 02:11:58 2023 +1000

    open: make RESOLVE_CACHED correctly test for O_TMPFILE
    
    commit a0fc452a5d7fed986205539259df1d60546f536c upstream.
    
    O_TMPFILE is actually __O_TMPFILE|O_DIRECTORY. This means that the old
    fast-path check for RESOLVE_CACHED would reject all users passing
    O_DIRECTORY with -EAGAIN, when in fact the intended test was to check
    for __O_TMPFILE.
    
    Cc: stable@vger.kernel.org # v5.12+
    Fixes: 99668f618062 ("fs: expose LOOKUP_CACHED through openat2() RESOLVE_CACHED")
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    Message-Id: <20230806-resolve_cached-o_tmpfile-v1-1-7ba16308465e@cyphar.com>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61f96da37dd4fb166c7d9bdf76016b8340e5f85f
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Aug 3 19:33:22 2023 +0100

    arm64/fpsimd: Sync FPSIMD state with SVE for SME only systems
    
    commit 507ea5dd92d23fcf10e4d1a68a443c86a49753ed upstream.
    
    Currently we guard FPSIMD/SVE state conversions with a check for the system
    supporting SVE but SME only systems may need to sync streaming mode SVE
    state so add a check for SME support too.  These functions are only used
    by the ptrace code.
    
    Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-ssve-no-sve-v1-2-49df214bfb3e@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 654c1dd350c746244e4dd4fe1fde577a2dc93d96
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Aug 3 00:46:39 2023 +0100

    arm64/fpsimd: Clear SME state in the target task when setting the VL
    
    commit c9bb40b7f786662e33d71afe236442b0b61f0446 upstream.
    
    When setting SME vector lengths we clear TIF_SME to reenable SME traps,
    doing a reallocation of the backing storage on next use. We do this using
    clear_thread_flag() which operates on the current thread, meaning that when
    setting the vector length via ptrace we may both not force traps for the
    target task and force a spurious flush of any SME state that the tracing
    task may have.
    
    Clear the flag in the target task.
    
    Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
    Reported-by: David Spickett <David.Spickett@arm.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-tif-sme-v1-1-88312fd6fbfd@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bae353469a282d4a0ac27f07a0ba5137ad1a049d
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Aug 3 19:33:23 2023 +0100

    arm64/fpsimd: Sync and zero pad FPSIMD state for streaming SVE
    
    commit 69af56ae56a48a2522aad906c4461c6c7c092737 upstream.
    
    We have a function sve_sync_from_fpsimd_zeropad() which is used by the
    ptrace code to update the SVE state when the user writes to the the
    FPSIMD register set.  Currently this checks that the task has SVE
    enabled but this will miss updates for tasks which have streaming SVE
    enabled if SVE has not been enabled for the thread, also do the
    conversion if the task has streaming SVE enabled.
    
    Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-ssve-no-sve-v1-3-49df214bfb3e@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b8ea2a46913bc420b140a009aca02abc85f34242
Author: Naveen N Rao <naveen@kernel.org>
Date:   Wed Jun 21 10:43:49 2023 +0530

    powerpc/ftrace: Create a dummy stackframe to fix stack unwind
    
    commit 41a506ef71eb38d94fe133f565c87c3e06ccc072 upstream.
    
    With ppc64 -mprofile-kernel and ppc32 -pg, profiling instructions to
    call into ftrace are emitted right at function entry. The instruction
    sequence used is minimal to reduce overhead. Crucially, a stackframe is
    not created for the function being traced. This breaks stack unwinding
    since the function being traced does not have a stackframe for itself.
    As such, it never shows up in the backtrace:
    
    /sys/kernel/debug/tracing # echo 1 > /proc/sys/kernel/stack_tracer_enabled
    /sys/kernel/debug/tracing # cat stack_trace
            Depth    Size   Location    (17 entries)
            -----    ----   --------
      0)     4144      32   ftrace_call+0x4/0x44
      1)     4112     432   get_page_from_freelist+0x26c/0x1ad0
      2)     3680     496   __alloc_pages+0x290/0x1280
      3)     3184     336   __folio_alloc+0x34/0x90
      4)     2848     176   vma_alloc_folio+0xd8/0x540
      5)     2672     272   __handle_mm_fault+0x700/0x1cc0
      6)     2400     208   handle_mm_fault+0xf0/0x3f0
      7)     2192      80   ___do_page_fault+0x3e4/0xbe0
      8)     2112     160   do_page_fault+0x30/0xc0
      9)     1952     256   data_access_common_virt+0x210/0x220
     10)     1696     400   0xc00000000f16b100
     11)     1296     384   load_elf_binary+0x804/0x1b80
     12)      912     208   bprm_execve+0x2d8/0x7e0
     13)      704      64   do_execveat_common+0x1d0/0x2f0
     14)      640     160   sys_execve+0x54/0x70
     15)      480      64   system_call_exception+0x138/0x350
     16)      416     416   system_call_common+0x160/0x2c4
    
    Fix this by having ftrace create a dummy stackframe for the function
    being traced. With this, backtraces now capture the function being
    traced:
    
    /sys/kernel/debug/tracing # cat stack_trace
            Depth    Size   Location    (17 entries)
            -----    ----   --------
      0)     3888      32   _raw_spin_trylock+0x8/0x70
      1)     3856     576   get_page_from_freelist+0x26c/0x1ad0
      2)     3280      64   __alloc_pages+0x290/0x1280
      3)     3216     336   __folio_alloc+0x34/0x90
      4)     2880     176   vma_alloc_folio+0xd8/0x540
      5)     2704     416   __handle_mm_fault+0x700/0x1cc0
      6)     2288      96   handle_mm_fault+0xf0/0x3f0
      7)     2192      48   ___do_page_fault+0x3e4/0xbe0
      8)     2144     192   do_page_fault+0x30/0xc0
      9)     1952     608   data_access_common_virt+0x210/0x220
     10)     1344      16   0xc0000000334bbb50
     11)     1328     416   load_elf_binary+0x804/0x1b80
     12)      912      64   bprm_execve+0x2d8/0x7e0
     13)      848     176   do_execveat_common+0x1d0/0x2f0
     14)      672     192   sys_execve+0x54/0x70
     15)      480      64   system_call_exception+0x138/0x350
     16)      416     416   system_call_common+0x160/0x2c4
    
    This results in two additional stores in the ftrace entry code, but
    produces reliable backtraces.
    
    Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
    Cc: stable@vger.kernel.org
    Signed-off-by: Naveen N Rao <naveen@kernel.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20230621051349.759567-1-naveen@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 36dd8ca330b76585640ed32255a3c99f901e1502
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Jul 25 10:42:06 2023 +0200

    bpf: Disable preemption in bpf_event_output
    
    commit d62cc390c2e99ae267ffe4b8d7e2e08b6c758c32 upstream.
    
    We received report [1] of kernel crash, which is caused by
    using nesting protection without disabled preemption.
    
    The bpf_event_output can be called by programs executed by
    bpf_prog_run_array_cg function that disabled migration but
    keeps preemption enabled.
    
    This can cause task to be preempted by another one inside the
    nesting protection and lead eventually to two tasks using same
    perf_sample_data buffer and cause crashes like:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000001
      #PF: supervisor instruction fetch in kernel mode
      #PF: error_code(0x0010) - not-present page
      ...
      ? perf_output_sample+0x12a/0x9a0
      ? finish_task_switch.isra.0+0x81/0x280
      ? perf_event_output+0x66/0xa0
      ? bpf_event_output+0x13a/0x190
      ? bpf_event_output_data+0x22/0x40
      ? bpf_prog_dfc84bbde731b257_cil_sock4_connect+0x40a/0xacb
      ? xa_load+0x87/0xe0
      ? __cgroup_bpf_run_filter_sock_addr+0xc1/0x1a0
      ? release_sock+0x3e/0x90
      ? sk_setsockopt+0x1a1/0x12f0
      ? udp_pre_connect+0x36/0x50
      ? inet_dgram_connect+0x93/0xa0
      ? __sys_connect+0xb4/0xe0
      ? udp_setsockopt+0x27/0x40
      ? __pfx_udp_push_pending_frames+0x10/0x10
      ? __sys_setsockopt+0xdf/0x1a0
      ? __x64_sys_connect+0xf/0x20
      ? do_syscall_64+0x3a/0x90
      ? entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    Fixing this by disabling preemption in bpf_event_output.
    
    [1] https://github.com/cilium/cilium/issues/26756
    Cc: stable@vger.kernel.org
    Reported-by: Oleg "livelace" Popov <o.popov@livelace.ru>
    Closes: https://github.com/cilium/cilium/issues/26756
    Fixes: 2a916f2f546c ("bpf: Use migrate_disable/enable in array macros and cgroup/lirc code.")
    Acked-by: Hou Tao <houtao1@huawei.com>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20230725084206.580930-3-jolsa@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec062367fa0ce5609b45babbde9360f2f8c460b5
Author: Ilya Dryomov <idryomov@gmail.com>
Date:   Tue Aug 1 19:14:24 2023 +0200

    rbd: prevent busy loop when requesting exclusive lock
    
    commit 9d01e07fd1bfb4daae156ab528aa196f5ac2b2bc upstream.
    
    Due to rbd_try_acquire_lock() effectively swallowing all but
    EBLOCKLISTED error from rbd_try_lock() ("request lock anyway") and
    rbd_request_lock() returning ETIMEDOUT error not only for an actual
    notify timeout but also when the lock owner doesn't respond, a busy
    loop inside of rbd_acquire_lock() between rbd_try_acquire_lock() and
    rbd_request_lock() is possible.
    
    Requesting the lock on EBUSY error (returned by get_lock_owner_info()
    if an incompatible lock or invalid lock owner is detected) makes very
    little sense.  The same goes for ETIMEDOUT error (might pop up pretty
    much anywhere if osd_request_timeout option is set) and many others.
    
    Just fail I/O requests on rbd_dev->acquiring_list immediately on any
    error from rbd_try_lock().
    
    Cc: stable@vger.kernel.org # 588159009d5b: rbd: retrieve and check lock owner twice before blocklisting
    Cc: stable@vger.kernel.org
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98cccbd0a19a161971bc7f7feb10577adc62c400
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Fri Jul 21 21:51:16 2023 -0700

    x86/hyperv: Disable IBT when hypercall page lacks ENDBR instruction
    
    commit d5ace2a776442d80674eff9ed42e737f7dd95056 upstream.
    
    On hardware that supports Indirect Branch Tracking (IBT), Hyper-V VMs
    with ConfigVersion 9.3 or later support IBT in the guest. However,
    current versions of Hyper-V have a bug in that there's not an ENDBR64
    instruction at the beginning of the hypercall page. Since hypercalls are
    made with an indirect call to the hypercall page, all hypercall attempts
    fail with an exception and Linux panics.
    
    A Hyper-V fix is in progress to add ENDBR64. But guard against the Linux
    panic by clearing X86_FEATURE_IBT if the hypercall page doesn't start
    with ENDBR. The VM will boot and run without IBT.
    
    If future Linux 32-bit kernels were to support IBT, additional hypercall
    page hackery would be needed to make IBT work for such kernels in a
    Hyper-V VM.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/1690001476-98594-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0526119bf59e6729b57535eb52dab28b7fbfe00e
Author: Paul Fertser <fercerpav@gmail.com>
Date:   Mon Jun 5 10:34:07 2023 +0300

    wifi: mt76: mt7615: do not advertise 5 GHz on first phy of MT7615D (DBDC)
    
    commit 421033deb91521aa6a9255e495cb106741a52275 upstream.
    
    On DBDC devices the first (internal) phy is only capable of using
    2.4 GHz band, and the 5 GHz band is exposed via a separate phy object,
    so avoid the false advertising.
    
    Reported-by: Rani Hod <rani.hod@gmail.com>
    Closes: https://github.com/openwrt/openwrt/pull/12361
    Fixes: 7660a1bd0c22 ("mt76: mt7615: register ext_phy if DBDC is detected")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Fertser <fercerpav@gmail.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Acked-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20230605073408.8699-1-fercerpav@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 767800fc402deac438c5aed9c82f0e71a70c86fd
Author: Laszlo Ersek <lersek@redhat.com>
Date:   Mon Jul 31 18:42:37 2023 +0200

    net: tap_open(): set sk_uid from current_fsuid()
    
    commit 5c9241f3ceab3257abe2923a59950db0dc8bb737 upstream.
    
    Commit 66b2c338adce initializes the "sk_uid" field in the protocol socket
    (struct sock) from the "/dev/tapX" device node's owner UID. Per original
    commit 86741ec25462 ("net: core: Add a UID field to struct sock.",
    2016-11-04), that's wrong: the idea is to cache the UID of the userspace
    process that creates the socket. Commit 86741ec25462 mentions socket() and
    accept(); with "tap", the action that creates the socket is
    open("/dev/tapX").
    
    Therefore the device node's owner UID is irrelevant. In most cases,
    "/dev/tapX" will be owned by root, so in practice, commit 66b2c338adce has
    no observable effect:
    
    - before, "sk_uid" would be zero, due to undefined behavior
      (CVE-2023-1076),
    
    - after, "sk_uid" would be zero, due to "/dev/tapX" being owned by root.
    
    What matters is the (fs)UID of the process performing the open(), so cache
    that in "sk_uid".
    
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Lorenzo Colitti <lorenzo@google.com>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Cc: Pietro Borrello <borrello@diag.uniroma1.it>
    Cc: netdev@vger.kernel.org
    Cc: stable@vger.kernel.org
    Fixes: 66b2c338adce ("tap: tap_open(): correctly initialize socket uid")
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2173435
    Signed-off-by: Laszlo Ersek <lersek@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b6846d7c408b33e4701f4f5ca28932e2a08e0a2e
Author: Laszlo Ersek <lersek@redhat.com>
Date:   Mon Jul 31 18:42:36 2023 +0200

    net: tun_chr_open(): set sk_uid from current_fsuid()
    
    commit 9bc3047374d5bec163e83e743709e23753376f0c upstream.
    
    Commit a096ccca6e50 initializes the "sk_uid" field in the protocol socket
    (struct sock) from the "/dev/net/tun" device node's owner UID. Per
    original commit 86741ec25462 ("net: core: Add a UID field to struct
    sock.", 2016-11-04), that's wrong: the idea is to cache the UID of the
    userspace process that creates the socket. Commit 86741ec25462 mentions
    socket() and accept(); with "tun", the action that creates the socket is
    open("/dev/net/tun").
    
    Therefore the device node's owner UID is irrelevant. In most cases,
    "/dev/net/tun" will be owned by root, so in practice, commit a096ccca6e50
    has no observable effect:
    
    - before, "sk_uid" would be zero, due to undefined behavior
      (CVE-2023-1076),
    
    - after, "sk_uid" would be zero, due to "/dev/net/tun" being owned by root.
    
    What matters is the (fs)UID of the process performing the open(), so cache
    that in "sk_uid".
    
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Lorenzo Colitti <lorenzo@google.com>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Cc: Pietro Borrello <borrello@diag.uniroma1.it>
    Cc: netdev@vger.kernel.org
    Cc: stable@vger.kernel.org
    Fixes: a096ccca6e50 ("tun: tun_chr_open(): correctly initialize socket uid")
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2173435
    Signed-off-by: Laszlo Ersek <lersek@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 367fdf369dc79539648db226a942846304c11ed5
Author: Dinh Nguyen <dinguyen@kernel.org>
Date:   Tue Jul 11 15:44:30 2023 -0500

    arm64: dts: stratix10: fix incorrect I2C property for SCL signal
    
    commit db66795f61354c373ecdadbdae1ed253a96c47cb upstream.
    
    The correct dts property for the SCL falling time is
    "i2c-scl-falling-time-ns".
    
    Fixes: c8da1d15b8a4 ("arm64: dts: stratix10: i2c clock running out of spec")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3654ed5daf492463c3faa434c7000d45c2da2ace
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Jul 25 10:42:05 2023 +0200

    bpf: Disable preemption in bpf_perf_event_output
    
    commit f2c67a3e60d1071b65848efaa8c3b66c363dd025 upstream.
    
    The nesting protection in bpf_perf_event_output relies on disabled
    preemption, which is guaranteed for kprobes and tracepoints.
    
    However bpf_perf_event_output can be also called from uprobes context
    through bpf_prog_run_array_sleepable function which disables migration,
    but keeps preemption enabled.
    
    This can cause task to be preempted by another one inside the nesting
    protection and lead eventually to two tasks using same perf_sample_data
    buffer and cause crashes like:
    
      kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
      BUG: unable to handle page fault for address: ffffffff82be3eea
      ...
      Call Trace:
       ? __die+0x1f/0x70
       ? page_fault_oops+0x176/0x4d0
       ? exc_page_fault+0x132/0x230
       ? asm_exc_page_fault+0x22/0x30
       ? perf_output_sample+0x12b/0x910
       ? perf_event_output+0xd0/0x1d0
       ? bpf_perf_event_output+0x162/0x1d0
       ? bpf_prog_c6271286d9a4c938_krava1+0x76/0x87
       ? __uprobe_perf_func+0x12b/0x540
       ? uprobe_dispatcher+0x2c4/0x430
       ? uprobe_notify_resume+0x2da/0xce0
       ? atomic_notifier_call_chain+0x7b/0x110
       ? exit_to_user_mode_prepare+0x13e/0x290
       ? irqentry_exit_to_user_mode+0x5/0x30
       ? asm_exc_int3+0x35/0x40
    
    Fixing this by disabling preemption in bpf_perf_event_output.
    
    Cc: stable@vger.kernel.org
    Fixes: 8c7dcb84e3b7 ("bpf: implement sleepable uprobes by chaining gps")
    Acked-by: Hou Tao <houtao1@huawei.com>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20230725084206.580930-2-jolsa@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 680f4d8aec1bdc5d2cec2891b162aab20e2bb977
Author: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Date:   Wed Jul 5 09:52:10 2023 +0300

    mtd: rawnand: meson: fix OOB available bytes for ECC
    
    commit 7e6b04f9238eab0f684fafd158c1f32ea65b9eaa upstream.
    
    It is incorrect to calculate number of OOB bytes for ECC engine using
    some "already known" ECC step size (1024 bytes here). Number of such
    bytes for ECC engine must be whole OOB except 2 bytes for bad block
    marker, while proper ECC step size and strength will be selected by
    ECC logic.
    
    Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230705065211.293500-1-AVKrasnov@sberdevices.ru
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67327cadba59d5c78c1a8a979270d175a147e548
Author: Olivier Maignial <olivier.maignial@hotmail.fr>
Date:   Fri Jun 23 17:33:36 2023 +0200

    mtd: spinand: toshiba: Fix ecc_get_status
    
    commit 8544cda94dae6be3f1359539079c68bb731428b1 upstream.
    
    Reading ECC status is failing.
    
    tx58cxgxsxraix_ecc_get_status() is using on-stack buffer
    for SPINAND_GET_FEATURE_OP() output. It is not suitable
    for DMA needs of spi-mem.
    
    Fix this by using the spi-mem operations dedicated buffer
    spinand->scratchbuf.
    
    See
    spinand->scratchbuf:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mtd/spinand.h?h=v6.3#n418
    spi_mem_check_op():
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-mem.c?h=v6.3#n199
    
    Fixes: 10949af1681d ("mtd: spinand: Add initial support for Toshiba TC58CVG2S0H")
    Cc: stable@vger.kernel.org
    Signed-off-by: Olivier Maignial <olivier.maignial@hotmail.fr>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/DB4P250MB1032553D05FBE36DEE0D311EFE23A@DB4P250MB1032.EURP250.PROD.OUTLOOK.COM
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 724ce05212d02947d5b0575dc306743ba50a1304
Author: Sungjong Seo <sj1557.seo@samsung.com>
Date:   Fri Jul 14 17:43:54 2023 +0900

    exfat: release s_lock before calling dir_emit()
    
    commit ff84772fd45d486e4fc78c82e2f70ce5333543e6 upstream.
    
    There is a potential deadlock reported by syzbot as below:
    
    ======================================================
    WARNING: possible circular locking dependency detected
    6.4.0-next-20230707-syzkaller #0 Not tainted
    ------------------------------------------------------
    syz-executor330/5073 is trying to acquire lock:
    ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable include/linux/mmap_lock.h:151 [inline]
    ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5293 [inline]
    ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x369/0x510 mm/memory.c:5344
    but task is already holding lock:
    ffff888019f760e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x117/0xb50 fs/exfat/dir.c:232
    
    which lock already depends on the new lock.
    
    Chain exists of:
      &mm->mmap_lock --> mapping.invalidate_lock#3 --> &sbi->s_lock
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(&sbi->s_lock);
                                   lock(mapping.invalidate_lock#3);
                                   lock(&sbi->s_lock);
      rlock(&mm->mmap_lock);
    
    Let's try to avoid above potential deadlock condition by moving dir_emit*()
    out of sbi->s_lock coverage.
    
    Fixes: ca06197382bd ("exfat: add directory operations")
    Cc: stable@vger.kernel.org #v5.7+
    Reported-by: syzbot+1741a5d9b79989c10bdc@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/lkml/00000000000078ee7e060066270b@google.com/T/#u
    Tested-by: syzbot+1741a5d9b79989c10bdc@syzkaller.appspotmail.com
    Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1427a7e96fb90d0896f74f5bcd21feb03cc7c3d0
Author: gaoming <gaoming20@hihonor.com>
Date:   Wed Jul 5 15:15:15 2023 +0800

    exfat: use kvmalloc_array/kvfree instead of kmalloc_array/kfree
    
    commit daf60d6cca26e50d65dac374db92e58de745ad26 upstream.
    
    The call stack shown below is a scenario in the Linux 4.19 kernel.
    Allocating memory failed where exfat fs use kmalloc_array due to
    system memory fragmentation, while the u-disk was inserted without
    recognition.
    Devices such as u-disk using the exfat file system are pluggable and
    may be insert into the system at any time.
    However, long-term running systems cannot guarantee the continuity of
    physical memory. Therefore, it's necessary to address this issue.
    
    Binder:2632_6: page allocation failure: order:4,
     mode:0x6040c0(GFP_KERNEL|__GFP_COMP), nodemask=(null)
    Call trace:
    [242178.097582]  dump_backtrace+0x0/0x4
    [242178.097589]  dump_stack+0xf4/0x134
    [242178.097598]  warn_alloc+0xd8/0x144
    [242178.097603]  __alloc_pages_nodemask+0x1364/0x1384
    [242178.097608]  kmalloc_order+0x2c/0x510
    [242178.097612]  kmalloc_order_trace+0x40/0x16c
    [242178.097618]  __kmalloc+0x360/0x408
    [242178.097624]  load_alloc_bitmap+0x160/0x284
    [242178.097628]  exfat_fill_super+0xa3c/0xe7c
    [242178.097635]  mount_bdev+0x2e8/0x3a0
    [242178.097638]  exfat_fs_mount+0x40/0x50
    [242178.097643]  mount_fs+0x138/0x2e8
    [242178.097649]  vfs_kern_mount+0x90/0x270
    [242178.097655]  do_mount+0x798/0x173c
    [242178.097659]  ksys_mount+0x114/0x1ac
    [242178.097665]  __arm64_sys_mount+0x24/0x34
    [242178.097671]  el0_svc_common+0xb8/0x1b8
    [242178.097676]  el0_svc_handler+0x74/0x90
    [242178.097681]  el0_svc+0x8/0x340
    
    By analyzing the exfat code,we found that continuous physical memory
    is not required here,so kvmalloc_array is used can solve this problem.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: gaoming <gaoming20@hihonor.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bc41119995e41ca19a06ea464a2d2cab875ac2ad
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Wed Jul 19 08:16:52 2023 +0200

    firmware: arm_scmi: Drop OF node reference in the transport channel setup
    
    commit da042eb4f061a0b54aedadcaa15391490c48e1ad upstream.
    
    The OF node reference obtained from of_parse_phandle() should be dropped
    if node is not compatible with arm,scmi-shmem.
    
    Fixes: 507cd4d2c5eb ("firmware: arm_scmi: Add compatibility checks for shmem node")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
    Link: https://lore.kernel.org/r/20230719061652.8850-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a062da58ed97d1f16a564619726e77ba528c5191
Author: Xiubo Li <xiubli@redhat.com>
Date:   Tue Jul 25 12:03:59 2023 +0800

    ceph: defer stopping mdsc delayed_work
    
    commit e7e607bd00481745550389a29ecabe33e13d67cf upstream.
    
    Flushing the dirty buffer may take a long time if the cluster is
    overloaded or if there is network issue. So we should ping the
    MDSs periodically to keep alive, else the MDS will blocklist
    the kclient.
    
    Cc: stable@vger.kernel.org
    Link: https://tracker.ceph.com/issues/61843
    Signed-off-by: Xiubo Li <xiubli@redhat.com>
    Reviewed-by: Milind Changire <mchangir@redhat.com>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ad82aac732c22e043307933e13fe112682bfff0c
Author: Ross Maynard <bids.7405@bigpond.com>
Date:   Mon Jul 31 15:42:04 2023 +1000

    USB: zaurus: Add ID for A-300/B-500/C-700
    
    commit b99225b4fe297d07400f9e2332ecd7347b224f8d upstream.
    
    The SL-A300, B500/5600, and C700 devices no longer auto-load because of
    "usbnet: Remove over-broad module alias from zaurus."
    This patch adds IDs for those 3 devices.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217632
    Fixes: 16adf5d07987 ("usbnet: Remove over-broad module alias from zaurus.")
    Signed-off-by: Ross Maynard <bids.7405@bigpond.com>
    Cc: stable@vger.kernel.org
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/69b5423b-2013-9fc9-9569-58e707d9bafb@bigpond.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be52667ba24344199990e011cb7819640266799e
Author: Ilya Dryomov <idryomov@gmail.com>
Date:   Tue Aug 1 19:14:24 2023 +0200

    libceph: fix potential hang in ceph_osdc_notify()
    
    commit e6e2843230799230fc5deb8279728a7218b0d63c upstream.
    
    If the cluster becomes unavailable, ceph_osdc_notify() may hang even
    with osd_request_timeout option set because linger_notify_finish_wait()
    waits for MWatchNotify NOTIFY_COMPLETE message with no associated OSD
    request in flight -- it's completely asynchronous.
    
    Introduce an additional timeout, derived from the specified notify
    timeout.  While at it, switch both waits to killable which is more
    correct.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
    Reviewed-by: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f62faadc791e1d5c06822859cb6b59428727e245
Author: Michael Kelley <mikelley@microsoft.com>
Date:   Thu Jul 20 14:05:02 2023 -0700

    scsi: storvsc: Limit max_sectors for virtual Fibre Channel devices
    
    commit 010c1e1c5741365dbbf44a5a5bb9f30192875c4c upstream.
    
    The Hyper-V host is queried to get the max transfer size that it supports,
    and this value is used to set max_sectors for the synthetic SCSI
    controller.  However, this max transfer size may be too large for virtual
    Fibre Channel devices, which are limited to 512 Kbytes.  If a larger
    transfer size is used with a vFC device, Hyper-V always returns an error,
    and storvsc logs a message like this where the SRB status and SCSI status
    are both zero:
    
    hv_storvsc <GUID>: tag#197 cmd 0x8a status: scsi 0x0 srb 0x0 hv 0xc0000001
    
    Add logic to limit the max transfer size to 512 Kbytes for vFC devices.
    
    Fixes: 1d3e0980782f ("scsi: storvsc: Correct reporting of Hyper-V I/O size limits")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Kelley <mikelley@microsoft.com>
    Link: https://lore.kernel.org/r/1689887102-32806-1-git-send-email-mikelley@microsoft.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 645603ab5fa8b8765219016877a3bd797c00b384
Author: Steffen Maier <maier@linux.ibm.com>
Date:   Mon Jul 24 16:51:56 2023 +0200

    scsi: zfcp: Defer fc_rport blocking until after ADISC response
    
    commit e65851989001c0c9ba9177564b13b38201c0854c upstream.
    
    Storage devices are free to send RSCNs, e.g. for internal state changes. If
    this happens on all connected paths, zfcp risks temporarily losing all
    paths at the same time. This has strong requirements on multipath
    configuration such as "no_path_retry queue".
    
    Avoid such situations by deferring fc_rport blocking until after the ADISC
    response, when any actual state change of the remote port became clear.
    The already existing port recovery triggers explicitly block the fc_rport.
    The triggers are: on ADISC reject or timeout (typical cable pull case), and
    on ADISC indicating that the remote port has changed its WWPN or
    the port is meanwhile no longer open.
    
    As a side effect, this also removes a confusing direct function call to
    another work item function zfcp_scsi_rport_work() instead of scheduling
    that other work item. It was probably done that way to have the rport block
    side effect immediate and synchronous to the caller.
    
    Fixes: a2fa0aede07c ("[SCSI] zfcp: Block FC transport rports early on errors")
    Cc: stable@vger.kernel.org #v2.6.30+
    Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
    Reviewed-by: Fedor Loshakov <loshakov@linux.ibm.com>
    Signed-off-by: Steffen Maier <maier@linux.ibm.com>
    Link: https://lore.kernel.org/r/20230724145156.3920244-1-maier@linux.ibm.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f0618c305b41f1a4df1635c399fe264e8ad676a1
Author: Boqun Feng <boqun.feng@gmail.com>
Date:   Sat Jul 29 18:29:02 2023 -0700

    rust: allocator: Prevent mis-aligned allocation
    
    commit b3d8aa84bbfe9b58ccc5332cacf8ea17200af310 upstream.
    
    Currently the rust allocator simply passes the size of the type Layout
    to krealloc(), and in theory the alignment requirement from the type
    Layout may be larger than the guarantee provided by SLAB, which means
    the allocated object is mis-aligned.
    
    Fix this by adjusting the allocation size to the nearest power of two,
    which SLAB always guarantees a size-aligned allocation. And because Rust
    guarantees that the original size must be a multiple of alignment and
    the alignment must be a power of two, then the alignment requirement is
    satisfied.
    
    Suggested-by: Vlastimil Babka <vbabka@suse.cz>
    Co-developed-by: "Andreas Hindborg (Samsung)" <nmi@metaspace.dk>
    Signed-off-by: "Andreas Hindborg (Samsung)" <nmi@metaspace.dk>
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Cc: stable@vger.kernel.org # v6.1+
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Fixes: 247b365dc8dc ("rust: add `kernel` crate")
    Link: https://github.com/Rust-for-Linux/linux/issues/974
    Link: https://lore.kernel.org/r/20230730012905.643822-2-boqun.feng@gmail.com
    [ Applied rewording of comment as discussed in the mailing list. ]
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cd4bdf8f98ef88ac9c2df2269c925c857e3af222
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:15:00 2023 +0000

    tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen
    
    [ Upstream commit ddf251fa2bc1d3699eec0bae6ed0bc373b8fda79 ]
    
    Whenever tcpm_new() reclaims an old entry, tcpm_suck_dst()
    would overwrite data that could be read from tcp_fastopen_cache_get()
    or tcp_metrics_fill_info().
    
    We need to acquire fastopen_seqlock to maintain consistency.
    
    For newly allocated objects, tcpm_new() can switch to kzalloc()
    to avoid an extra fastopen_seqlock acquisition.
    
    Fixes: 1fe4c481ba63 ("net-tcp: Fast Open client - cookie cache")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Yuchung Cheng <ycheng@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-7-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e53917e7efea95b8a10c5d3696e37e4a1e7d47fd
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:59 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_net
    
    [ Upstream commit d5d986ce42c71a7562d32c4e21e026b0f87befec ]
    
    tm->tcpm_net can be read or written locklessly.
    
    Instead of changing write_pnet() and read_pnet() and potentially
    hurt performance, add the needed READ_ONCE()/WRITE_ONCE()
    in tm_net() and tcpm_new().
    
    Fixes: 849e8a0ca8d5 ("tcp_metrics: Add a field tcpm_net and verify it matches on lookup")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-6-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6dea95d8caff9512fbd91bcf0375c046c98c165b
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:58 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_vals[]
    
    [ Upstream commit 8c4d04f6b443869d25e59822f7cec88d647028a9 ]
    
    tm->tcpm_vals[] values can be read or written locklessly.
    
    Add needed READ_ONCE()/WRITE_ONCE() to document this,
    and force use of tcp_metric_get() and tcp_metric_set()
    
    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fee608e802718649185be76c4478012154a5fe33
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:57 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_lock
    
    [ Upstream commit 285ce119a3c6c4502585936650143e54c8692788 ]
    
    tm->tcpm_lock can be read or written locklessly.
    
    Add needed READ_ONCE()/WRITE_ONCE() to document this.
    
    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-4-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a77a0f7526c2761b300826b86da92878cfafb98
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:56 2023 +0000

    tcp_metrics: annotate data-races around tm->tcpm_stamp
    
    [ Upstream commit 949ad62a5d5311d36fce2e14fe5fed3f936da51c ]
    
    tm->tcpm_stamp can be read or written locklessly.
    
    Add needed READ_ONCE()/WRITE_ONCE() to document this.
    
    Also constify tcpm_check_stamp() dst argument.
    
    Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-3-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 71f891a25405001e96e80ef6434aae75075a9363
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 2 13:14:55 2023 +0000

    tcp_metrics: fix addr_same() helper
    
    [ Upstream commit e6638094d7af6c7b9dcca05ad009e79e31b4f670 ]
    
    Because v4 and v6 families use separate inetpeer trees (respectively
    net->ipv4.peers and net->ipv6.peers), inetpeer_addr_cmp(a, b) assumes
    a & b share the same family.
    
    tcp_metrics use a common hash table, where entries can have different
    families.
    
    We must therefore make sure to not call inetpeer_addr_cmp()
    if the families do not match.
    
    Fixes: d39d14ffa24c ("net: Add helper function to compare inetpeer addresses")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230802131500.1478140-2-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit afac854f8221aabcbb7fa13b3fbd9e64097658ae
Author: Jonas Gorski <jonas.gorski@bisdn.de>
Date:   Wed Aug 2 11:23:56 2023 +0200

    prestera: fix fallback to previous version on same major version
    
    [ Upstream commit b755c25fbcd568821a3bb0e0d5c2daa5fcb00bba ]
    
    When both supported and previous version have the same major version,
    and the firmwares are missing, the driver ends in a loop requesting the
    same (previous) version over and over again:
    
        [   76.327413] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
        [   76.339802] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.352162] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.364502] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.376848] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.389183] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.401522] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.413860] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        [   76.426199] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.0.img firmware, fall-back to previous 4.0 version
        ...
    
    Fix this by inverting the check to that we aren't yet at the previous
    version, and also check the minor version.
    
    This also catches the case where both versions are the same, as it was
    after commit bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0
    support").
    
    With this fix applied:
    
        [   88.499622] Prestera DX 0000:01:00.0: missing latest mrvl/prestera/mvsw_prestera_fw-v4.1.img firmware, fall-back to previous 4.0 version
        [   88.511995] Prestera DX 0000:01:00.0: failed to request previous firmware: mrvl/prestera/mvsw_prestera_fw-v4.0.img
        [   88.522403] Prestera DX: probe of 0000:01:00.0 failed with error -2
    
    Fixes: 47f26018a414 ("net: marvell: prestera: try to load previous fw version")
    Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
    Acked-by: Elad Nachman <enachman@marvell.com>
    Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
    Acked-by: Taras Chornyi <taras.chornyi@plvision.eu>
    Link: https://lore.kernel.org/r/20230802092357.163944-1-jonas.gorski@bisdn.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 72b3aea3450ecd45d42d8adc44d9874e7d5f32f3
Author: Jianbo Liu <jianbol@nvidia.com>
Date:   Mon Jul 31 14:58:41 2023 +0300

    net/mlx5: fs_core: Skip the FTs in the same FS_TYPE_PRIO_CHAINS fs_prio
    
    [ Upstream commit c635ca45a7a2023904a1f851e99319af7b87017d ]
    
    In the cited commit, new type of FS_TYPE_PRIO_CHAINS fs_prio was added
    to support multiple parallel namespaces for multi-chains. And we skip
    all the flow tables under the fs_node of this type unconditionally,
    when searching for the next or previous flow table to connect for a
    new table.
    
    As this search function is also used for find new root table when the
    old one is being deleted, it will skip the entire FS_TYPE_PRIO_CHAINS
    fs_node next to the old root. However, new root table should be chosen
    from it if there is any table in it. Fix it by skipping only the flow
    tables in the same FS_TYPE_PRIO_CHAINS fs_node when finding the
    closest FT for a fs_node.
    
    Besides, complete the connecting from FTs of previous priority of prio
    because there should be multiple prevs after this fs_prio type is
    introduced. And also the next FT should be chosen from the first flow
    table next to the prio in the same FS_TYPE_PRIO_CHAINS fs_prio, if
    this prio is the first child.
    
    Fixes: 328edb499f99 ("net/mlx5: Split FDB fast path prio to multiple namespaces")
    Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
    Reviewed-by: Paul Blakey <paulb@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Link: https://lore.kernel.org/r/7a95754df479e722038996c97c97b062b372591f.1690803944.git.leonro@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1ca50e5de43aa1df6253105790971392a68b111c
Author: Jianbo Liu <jianbol@nvidia.com>
Date:   Mon Jul 31 14:58:40 2023 +0300

    net/mlx5: fs_core: Make find_closest_ft more generic
    
    [ Upstream commit 618d28a535a0582617465d14e05f3881736a2962 ]
    
    As find_closest_ft_recursive is called to find the closest FT, the
    first parameter of find_closest_ft can be changed from fs_prio to
    fs_node. Thus this function is extended to find the closest FT for the
    nodes of any type, not only prios, but also the sub namespaces.
    
    Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Link: https://lore.kernel.org/r/d3962c2b443ec8dde7a740dc742a1f052d5e256c.1690803944.git.leonro@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: c635ca45a7a2 ("net/mlx5: fs_core: Skip the FTs in the same FS_TYPE_PRIO_CHAINS fs_prio")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7b8717658dff8b471cbfc124bf9b5ca4229579ed
Author: Benjamin Poirier <bpoirier@nvidia.com>
Date:   Mon Jul 31 16:02:08 2023 -0400

    vxlan: Fix nexthop hash size
    
    [ Upstream commit 0756384fb1bd38adb2ebcfd1307422f433a1d772 ]
    
    The nexthop code expects a 31 bit hash, such as what is returned by
    fib_multipath_hash() and rt6_multipath_hash(). Passing the 32 bit hash
    returned by skb_get_hash() can lead to problems related to the fact that
    'int hash' is a negative number when the MSB is set.
    
    In the case of hash threshold nexthop groups, nexthop_select_path_hthr()
    will disproportionately select the first nexthop group entry. In the case
    of resilient nexthop groups, nexthop_select_path_res() may do an out of
    bounds access in nh_buckets[], for example:
        hash = -912054133
        num_nh_buckets = 2
        bucket_index = 65535
    
    which leads to the following panic:
    
    BUG: unable to handle page fault for address: ffffc900025910c8
    PGD 100000067 P4D 100000067 PUD 10026b067 PMD 0
    Oops: 0002 [#1] PREEMPT SMP KASAN NOPTI
    CPU: 4 PID: 856 Comm: kworker/4:3 Not tainted 6.5.0-rc2+ #34
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
    Workqueue: ipv6_addrconf addrconf_dad_work
    RIP: 0010:nexthop_select_path+0x197/0xbf0
    Code: c1 e4 05 be 08 00 00 00 4c 8b 35 a4 14 7e 01 4e 8d 6c 25 00 4a 8d 7c 25 08 48 01 dd e8 c2 25 15 ff 49 8d 7d 08 e8 39 13 15 ff <4d> 89 75 08 48 89 ef e8 7d 12 15 ff 48 8b 5d 00 e8 14 55 2f 00 85
    RSP: 0018:ffff88810c36f260 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 00000000002000c0 RCX: ffffffffaf02dd77
    RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffffc900025910c8
    RBP: ffffc900025910c0 R08: 0000000000000001 R09: fffff520004b2219
    R10: ffffc900025910cf R11: 31392d2068736168 R12: 00000000002000c0
    R13: ffffc900025910c0 R14: 00000000fffef608 R15: ffff88811840e900
    FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffc900025910c8 CR3: 0000000129d00000 CR4: 0000000000750ee0
    PKRU: 55555554
    Call Trace:
     <TASK>
     ? __die+0x23/0x70
     ? page_fault_oops+0x1ee/0x5c0
     ? __pfx_is_prefetch.constprop.0+0x10/0x10
     ? __pfx_page_fault_oops+0x10/0x10
     ? search_bpf_extables+0xfe/0x1c0
     ? fixup_exception+0x3b/0x470
     ? exc_page_fault+0xf6/0x110
     ? asm_exc_page_fault+0x26/0x30
     ? nexthop_select_path+0x197/0xbf0
     ? nexthop_select_path+0x197/0xbf0
     ? lock_is_held_type+0xe7/0x140
     vxlan_xmit+0x5b2/0x2340
     ? __lock_acquire+0x92b/0x3370
     ? __pfx_vxlan_xmit+0x10/0x10
     ? __pfx___lock_acquire+0x10/0x10
     ? __pfx_register_lock_class+0x10/0x10
     ? skb_network_protocol+0xce/0x2d0
     ? dev_hard_start_xmit+0xca/0x350
     ? __pfx_vxlan_xmit+0x10/0x10
     dev_hard_start_xmit+0xca/0x350
     __dev_queue_xmit+0x513/0x1e20
     ? __pfx___dev_queue_xmit+0x10/0x10
     ? __pfx_lock_release+0x10/0x10
     ? mark_held_locks+0x44/0x90
     ? skb_push+0x4c/0x80
     ? eth_header+0x81/0xe0
     ? __pfx_eth_header+0x10/0x10
     ? neigh_resolve_output+0x215/0x310
     ? ip6_finish_output2+0x2ba/0xc90
     ip6_finish_output2+0x2ba/0xc90
     ? lock_release+0x236/0x3e0
     ? ip6_mtu+0xbb/0x240
     ? __pfx_ip6_finish_output2+0x10/0x10
     ? find_held_lock+0x83/0xa0
     ? lock_is_held_type+0xe7/0x140
     ip6_finish_output+0x1ee/0x780
     ip6_output+0x138/0x460
     ? __pfx_ip6_output+0x10/0x10
     ? __pfx___lock_acquire+0x10/0x10
     ? __pfx_ip6_finish_output+0x10/0x10
     NF_HOOK.constprop.0+0xc0/0x420
     ? __pfx_NF_HOOK.constprop.0+0x10/0x10
     ? ndisc_send_skb+0x2c0/0x960
     ? __pfx_lock_release+0x10/0x10
     ? __local_bh_enable_ip+0x93/0x110
     ? lock_is_held_type+0xe7/0x140
     ndisc_send_skb+0x4be/0x960
     ? __pfx_ndisc_send_skb+0x10/0x10
     ? mark_held_locks+0x65/0x90
     ? find_held_lock+0x83/0xa0
     ndisc_send_ns+0xb0/0x110
     ? __pfx_ndisc_send_ns+0x10/0x10
     addrconf_dad_work+0x631/0x8e0
     ? lock_acquire+0x180/0x3f0
     ? __pfx_addrconf_dad_work+0x10/0x10
     ? mark_held_locks+0x24/0x90
     process_one_work+0x582/0x9c0
     ? __pfx_process_one_work+0x10/0x10
     ? __pfx_do_raw_spin_lock+0x10/0x10
     ? mark_held_locks+0x24/0x90
     worker_thread+0x93/0x630
     ? __kthread_parkme+0xdc/0x100
     ? __pfx_worker_thread+0x10/0x10
     kthread+0x1a5/0x1e0
     ? __pfx_kthread+0x10/0x10
     ret_from_fork+0x34/0x60
     ? __pfx_kthread+0x10/0x10
     ret_from_fork_asm+0x1b/0x30
    RIP: 0000:0x0
    Code: Unable to access opcode bytes at 0xffffffffffffffd6.
    RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
    RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
     </TASK>
    Modules linked in:
    CR2: ffffc900025910c8
    ---[ end trace 0000000000000000 ]---
    RIP: 0010:nexthop_select_path+0x197/0xbf0
    Code: c1 e4 05 be 08 00 00 00 4c 8b 35 a4 14 7e 01 4e 8d 6c 25 00 4a 8d 7c 25 08 48 01 dd e8 c2 25 15 ff 49 8d 7d 08 e8 39 13 15 ff <4d> 89 75 08 48 89 ef e8 7d 12 15 ff 48 8b 5d 00 e8 14 55 2f 00 85
    RSP: 0018:ffff88810c36f260 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 00000000002000c0 RCX: ffffffffaf02dd77
    RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffffc900025910c8
    RBP: ffffc900025910c0 R08: 0000000000000001 R09: fffff520004b2219
    R10: ffffc900025910cf R11: 31392d2068736168 R12: 00000000002000c0
    R13: ffffc900025910c0 R14: 00000000fffef608 R15: ffff88811840e900
    FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffffffffffd6 CR3: 0000000129d00000 CR4: 0000000000750ee0
    PKRU: 55555554
    Kernel panic - not syncing: Fatal exception in interrupt
    Kernel Offset: 0x2ca00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
    
    Fix this problem by ensuring the MSB of hash is 0 using a right shift - the
    same approach used in fib_multipath_hash() and rt6_multipath_hash().
    
    Fixes: 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries")
    Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 691a09eecad97e745b9aa0e3918db46d020bdacb
Author: Yue Haibing <yuehaibing@huawei.com>
Date:   Tue Aug 1 14:43:18 2023 +0800

    ip6mr: Fix skb_under_panic in ip6mr_cache_report()
    
    [ Upstream commit 30e0191b16e8a58e4620fa3e2839ddc7b9d4281c ]
    
    skbuff: skb_under_panic: text:ffffffff88771f69 len:56 put:-4
     head:ffff88805f86a800 data:ffff887f5f86a850 tail:0x88 end:0x2c0 dev:pim6reg
     ------------[ cut here ]------------
     kernel BUG at net/core/skbuff.c:192!
     invalid opcode: 0000 [#1] PREEMPT SMP KASAN
     CPU: 2 PID: 22968 Comm: kworker/2:11 Not tainted 6.5.0-rc3-00044-g0a8db05b571a #236
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
     Workqueue: ipv6_addrconf addrconf_dad_work
     RIP: 0010:skb_panic+0x152/0x1d0
     Call Trace:
      <TASK>
      skb_push+0xc4/0xe0
      ip6mr_cache_report+0xd69/0x19b0
      reg_vif_xmit+0x406/0x690
      dev_hard_start_xmit+0x17e/0x6e0
      __dev_queue_xmit+0x2d6a/0x3d20
      vlan_dev_hard_start_xmit+0x3ab/0x5c0
      dev_hard_start_xmit+0x17e/0x6e0
      __dev_queue_xmit+0x2d6a/0x3d20
      neigh_connected_output+0x3ed/0x570
      ip6_finish_output2+0x5b5/0x1950
      ip6_finish_output+0x693/0x11c0
      ip6_output+0x24b/0x880
      NF_HOOK.constprop.0+0xfd/0x530
      ndisc_send_skb+0x9db/0x1400
      ndisc_send_rs+0x12a/0x6c0
      addrconf_dad_completed+0x3c9/0xea0
      addrconf_dad_work+0x849/0x1420
      process_one_work+0xa22/0x16e0
      worker_thread+0x679/0x10c0
      ret_from_fork+0x28/0x60
      ret_from_fork_asm+0x11/0x20
    
    When setup a vlan device on dev pim6reg, DAD ns packet may sent on reg_vif_xmit().
    reg_vif_xmit()
        ip6mr_cache_report()
            skb_push(skb, -skb_network_offset(pkt));//skb_network_offset(pkt) is 4
    And skb_push declared as:
            void *skb_push(struct sk_buff *skb, unsigned int len);
                    skb->data -= len;
                    //0xffff88805f86a84c - 0xfffffffc = 0xffff887f5f86a850
    skb->data is set to 0xffff887f5f86a850, which is invalid mem addr, lead to skb_push() fails.
    
    Fixes: 14fb64e1f449 ("[IPV6] MROUTE: Support PIM-SM (SSM).")
    Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 86818409f989fee29c38528ed8fb085655603356
Author: Alexandra Winter <wintera@linux.ibm.com>
Date:   Tue Aug 1 10:00:16 2023 +0200

    s390/qeth: Don't call dev_close/dev_open (DOWN/UP)
    
    [ Upstream commit 1cfef80d4c2b2c599189f36f36320b205d9447d9 ]
    
    dev_close() and dev_open() are issued to change the interface state to DOWN
    or UP (dev->flags IFF_UP). When the netdev is set DOWN it loses e.g its
    Ipv6 addresses and routes. We don't want this in cases of device recovery
    (triggered by hardware or software) or when the qeth device is set
    offline.
    
    Setting a qeth device offline or online and device recovery actions call
    netif_device_detach() and/or netif_device_attach(). That will reset or
    set the LOWER_UP indication i.e. change the dev->state Bit
    __LINK_STATE_PRESENT. That is enough to e.g. cause bond failovers, and
    still preserves the interface settings that are handled by the network
    stack.
    
    Don't call dev_open() nor dev_close() from the qeth device driver. Let the
    network stack handle this.
    
    Fixes: d4560150cb47 ("s390/qeth: call dev_close() during recovery")
    Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
    Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ecff20e193207b44fdbfe64d7de89890f0a7fe6c
Author: Lin Ma <linma@zju.edu.cn>
Date:   Tue Aug 1 09:32:48 2023 +0800

    net: dcb: choose correct policy to parse DCB_ATTR_BCN
    
    [ Upstream commit 31d49ba033095f6e8158c60f69714a500922e0c3 ]
    
    The dcbnl_bcn_setcfg uses erroneous policy to parse tb[DCB_ATTR_BCN],
    which is introduced in commit 859ee3c43812 ("DCB: Add support for DCB
    BCN"). Please see the comment in below code
    
    static int dcbnl_bcn_setcfg(...)
    {
      ...
      ret = nla_parse_nested_deprecated(..., dcbnl_pfc_up_nest, .. )
      // !!! dcbnl_pfc_up_nest for attributes
      //  DCB_PFC_UP_ATTR_0 to DCB_PFC_UP_ATTR_ALL in enum dcbnl_pfc_up_attrs
      ...
      for (i = DCB_BCN_ATTR_RP_0; i <= DCB_BCN_ATTR_RP_7; i++) {
      // !!! DCB_BCN_ATTR_RP_0 to DCB_BCN_ATTR_RP_7 in enum dcbnl_bcn_attrs
        ...
        value_byte = nla_get_u8(data[i]);
        ...
      }
      ...
      for (i = DCB_BCN_ATTR_BCNA_0; i <= DCB_BCN_ATTR_RI; i++) {
      // !!! DCB_BCN_ATTR_BCNA_0 to DCB_BCN_ATTR_RI in enum dcbnl_bcn_attrs
      ...
        value_int = nla_get_u32(data[i]);
      ...
      }
      ...
    }
    
    That is, the nla_parse_nested_deprecated uses dcbnl_pfc_up_nest
    attributes to parse nlattr defined in dcbnl_pfc_up_attrs. But the
    following access code fetch each nlattr as dcbnl_bcn_attrs attributes.
    By looking up the associated nla_policy for dcbnl_bcn_attrs. We can find
    the beginning part of these two policies are "same".
    
    static const struct nla_policy dcbnl_pfc_up_nest[...] = {
            [DCB_PFC_UP_ATTR_0]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_1]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_2]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_3]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_4]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_5]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_6]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_7]   = {.type = NLA_U8},
            [DCB_PFC_UP_ATTR_ALL] = {.type = NLA_FLAG},
    };
    
    static const struct nla_policy dcbnl_bcn_nest[...] = {
            [DCB_BCN_ATTR_RP_0]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_1]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_2]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_3]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_4]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_5]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_6]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_7]         = {.type = NLA_U8},
            [DCB_BCN_ATTR_RP_ALL]       = {.type = NLA_FLAG},
            // from here is somewhat different
            [DCB_BCN_ATTR_BCNA_0]       = {.type = NLA_U32},
            ...
            [DCB_BCN_ATTR_ALL]          = {.type = NLA_FLAG},
    };
    
    Therefore, the current code is buggy and this
    nla_parse_nested_deprecated could overflow the dcbnl_pfc_up_nest and use
    the adjacent nla_policy to parse attributes from DCB_BCN_ATTR_BCNA_0.
    
    Hence use the correct policy dcbnl_bcn_nest to parse the nested
    tb[DCB_ATTR_BCN] TLV.
    
    Fixes: 859ee3c43812 ("DCB: Add support for DCB BCN")
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20230801013248.87240-1-linma@zju.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 421e02bda0570eeb11636544fe97ec3097d1bb92
Author: Michael Chan <michael.chan@broadcom.com>
Date:   Mon Jul 31 07:20:43 2023 -0700

    bnxt_en: Fix max_mtu setting for multi-buf XDP
    
    [ Upstream commit 08450ea98ae98d5a35145b675b76db616046ea11 ]
    
    The existing code does not allow the MTU to be set to the maximum even
    after an XDP program supporting multiple buffers is attached.  Fix it
    to set the netdev->max_mtu to the maximum value if the attached XDP
    program supports mutiple buffers, regardless of the current MTU value.
    
    Also use a local variable dev instead of repeatedly using bp->dev.
    
    Fixes: 1dc4c557bfed ("bnxt: adding bnxt_xdp_build_skb to build skb from multibuffer xdp_buff")
    Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
    Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
    Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://lore.kernel.org/r/20230731142043.58855-3-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e9f11bfc03fb0d3c86f91b8ae945bb10f7e19c16
Author: Somnath Kotur <somnath.kotur@broadcom.com>
Date:   Mon Jul 31 07:20:42 2023 -0700

    bnxt_en: Fix page pool logic for page size >= 64K
    
    [ Upstream commit f6974b4c2d8e1062b5a52228ee47293c15b4ee1e ]
    
    The RXBD length field on all bnxt chips is 16-bit and so we cannot
    support a full page when the native page size is 64K or greater.
    The non-XDP (non page pool) code path has logic to handle this but
    the XDP page pool code path does not handle this.  Add the missing
    logic to use page_pool_dev_alloc_frag() to allocate 32K chunks if
    the page size is 64K or greater.
    
    Fixes: 9f4b28301ce6 ("bnxt: XDP multibuffer enablement")
    Link: https://lore.kernel.org/netdev/20230728231829.235716-2-michael.chan@broadcom.com/
    Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
    Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://lore.kernel.org/r/20230731142043.58855-2-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 64763dd851faaabb2b28a07878ea59e46734cd73
Author: Mark Brown <broonie@kernel.org>
Date:   Mon Jul 31 11:48:32 2023 +0100

    net: netsec: Ignore 'phy-mode' on SynQuacer in DT mode
    
    [ Upstream commit f3bb7759a924713bc54d15f6d0d70733b5935fad ]
    
    As documented in acd7aaf51b20 ("netsec: ignore 'phy-mode' device
    property on ACPI systems") the SocioNext SynQuacer platform ships with
    firmware defining the PHY mode as RGMII even though the physical
    configuration of the PHY is for TX and RX delays.  Since bbc4d71d63549bc
    ("net: phy: realtek: fix rtl8211e rx/tx delay config") this has caused
    misconfiguration of the PHY, rendering the network unusable.
    
    This was worked around for ACPI by ignoring the phy-mode property but
    the system is also used with DT.  For DT instead if we're running on a
    SynQuacer force a working PHY mode, as well as the standard EDK2
    firmware with DT there are also some of these systems that use u-boot
    and might not initialise the PHY if not netbooting.  Newer firmware
    imagaes for at least EDK2 are available from Linaro so print a warning
    when doing this.
    
    Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20230731-synquacer-net-v3-1-944be5f06428@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8afe27770dea9c4af991253c48db4a4dcc35f1a4
Author: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date:   Mon Jul 31 17:05:35 2023 +0800

    net: korina: handle clk prepare error in korina_probe()
    
    [ Upstream commit 0b6291ad1940c403734312d0e453e8dac9148f69 ]
    
    in korina_probe(), the return value of clk_prepare_enable()
    should be checked since it might fail. we can use
    devm_clk_get_optional_enabled() instead of devm_clk_get_optional()
    and clk_prepare_enable() to automatically handle the error.
    
    Fixes: e4cd854ec487 ("net: korina: Get mdio input clock via common clock framework")
    Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
    Link: https://lore.kernel.org/r/20230731090535.21416-1-ruc_gongyuanjun@163.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58660666b46488152ec03dbde8a6e3e12b785fc9
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Mon Jul 31 10:42:32 2023 +0300

    net: ll_temac: fix error checking of irq_of_parse_and_map()
    
    [ Upstream commit ef45e8400f5bb66b03cc949f76c80e2a118447de ]
    
    Most kernel functions return negative error codes but some irq functions
    return zero on error.  In this code irq_of_parse_and_map(), returns zero
    and platform_get_irq() returns negative error codes.  We need to handle
    both cases appropriately.
    
    Fixes: 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Acked-by: Esben Haabendal <esben@geanix.com>
    Reviewed-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Harini Katakam <harini.katakam@amd.com>
    Link: https://lore.kernel.org/r/3d0aef75-06e0-45a5-a2a6-2cc4738d4143@moroto.mountain
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 834422b06c8b932184eb8127f1afd7a7957b764c
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Fri Jul 28 08:44:11 2023 +0200

    bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire
    
    [ Upstream commit 13d2618b48f15966d1adfe1ff6a1985f5eef40ba ]
    
    Disabling preemption in sock_map_sk_acquire conflicts with GFP_ATOMIC
    allocation later in sk_psock_init_link on PREEMPT_RT kernels, since
    GFP_ATOMIC might sleep on RT (see bpf: Make BPF and PREEMPT_RT co-exist
    patchset notes for details).
    
    This causes calling bpf_map_update_elem on BPF_MAP_TYPE_SOCKMAP maps to
    BUG (sleeping function called from invalid context) on RT kernels.
    
    preempt_disable was introduced together with lock_sk and rcu_read_lock
    in commit 99ba2b5aba24e ("bpf: sockhash, disallow bpf_tcp_close and update
    in parallel"), probably to match disabled migration of BPF programs, and
    is no longer necessary.
    
    Remove preempt_disable to fix BUG in sock_map_update_common on RT.
    
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/all/20200224140131.461979697@linutronix.de/
    Fixes: 99ba2b5aba24 ("bpf: sockhash, disallow bpf_tcp_close and update in parallel")
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Link: https://lore.kernel.org/r/20230728064411.305576-1-tglozar@redhat.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d4d3b53a4c66004e8e864fea744b3a2b86a73b62
Author: valis <sec@valis.email>
Date:   Sat Jul 29 08:32:02 2023 -0400

    net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free
    
    [ Upstream commit b80b829e9e2c1b3f7aae34855e04d8f6ecaf13c8 ]
    
    When route4_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.
    
    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.
    
    Fix this by no longer copying the tcf_result struct from the old filter.
    
    Fixes: 1109c00547fc ("net: sched: RCU cls_route")
    Reported-by: valis <sec@valis.email>
    Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
    Signed-off-by: valis <sec@valis.email>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: M A Ramdhan <ramdhan@starlabs.sg>
    Link: https://lore.kernel.org/r/20230729123202.72406-4-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7f691439b29be0aae68f83ad5eecfddc11007724
Author: valis <sec@valis.email>
Date:   Sat Jul 29 08:32:01 2023 -0400

    net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free
    
    [ Upstream commit 76e42ae831991c828cffa8c37736ebfb831ad5ec ]
    
    When fw_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.
    
    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.
    
    Fix this by no longer copying the tcf_result struct from the old filter.
    
    Fixes: e35a8ee5993b ("net: sched: fw use RCU")
    Reported-by: valis <sec@valis.email>
    Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
    Signed-off-by: valis <sec@valis.email>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: M A Ramdhan <ramdhan@starlabs.sg>
    Link: https://lore.kernel.org/r/20230729123202.72406-3-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aab2d095ce4dd8d01ca484c0cc641fb497bf74db
Author: valis <sec@valis.email>
Date:   Sat Jul 29 08:32:00 2023 -0400

    net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free
    
    [ Upstream commit 3044b16e7c6fe5d24b1cdbcf1bd0a9d92d1ebd81 ]
    
    When u32_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.
    
    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.
    
    Fix this by no longer copying the tcf_result struct from the old filter.
    
    Fixes: de5df63228fc ("net: sched: cls_u32 changes to knode must appear atomic to readers")
    Reported-by: valis <sec@valis.email>
    Reported-by: M A Ramdhan <ramdhan@starlabs.sg>
    Signed-off-by: valis <sec@valis.email>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: M A Ramdhan <ramdhan@starlabs.sg>
    Link: https://lore.kernel.org/r/20230729123202.72406-2-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cbd000451885801e9bbfd9cf7a7946806a85cb5e
Author: Hou Tao <houtao1@huawei.com>
Date:   Sat Jul 29 17:51:07 2023 +0800

    bpf, cpumap: Handle skb as well when clean up ptr_ring
    
    [ Upstream commit 7c62b75cd1a792e14b037fa4f61f9b18914e7de1 ]
    
    The following warning was reported when running xdp_redirect_cpu with
    both skb-mode and stress-mode enabled:
    
      ------------[ cut here ]------------
      Incorrect XDP memory type (-2128176192) usage
      WARNING: CPU: 7 PID: 1442 at net/core/xdp.c:405
      Modules linked in:
      CPU: 7 PID: 1442 Comm: kworker/7:0 Tainted: G  6.5.0-rc2+ #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
      Workqueue: events __cpu_map_entry_free
      RIP: 0010:__xdp_return+0x1e4/0x4a0
      ......
      Call Trace:
       <TASK>
       ? show_regs+0x65/0x70
       ? __warn+0xa5/0x240
       ? __xdp_return+0x1e4/0x4a0
       ......
       xdp_return_frame+0x4d/0x150
       __cpu_map_entry_free+0xf9/0x230
       process_one_work+0x6b0/0xb80
       worker_thread+0x96/0x720
       kthread+0x1a5/0x1f0
       ret_from_fork+0x3a/0x70
       ret_from_fork_asm+0x1b/0x30
       </TASK>
    
    The reason for the warning is twofold. One is due to the kthread
    cpu_map_kthread_run() is stopped prematurely. Another one is
    __cpu_map_ring_cleanup() doesn't handle skb mode and treats skbs in
    ptr_ring as XDP frames.
    
    Prematurely-stopped kthread will be fixed by the preceding patch and
    ptr_ring will be empty when __cpu_map_ring_cleanup() is called. But
    as the comments in __cpu_map_ring_cleanup() said, handling and freeing
    skbs in ptr_ring as well to "catch any broken behaviour gracefully".
    
    Fixes: 11941f8a8536 ("bpf: cpumap: Implement generic cpumap")
    Signed-off-by: Hou Tao <houtao1@huawei.com>
    Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
    Link: https://lore.kernel.org/r/20230729095107.1722450-3-houtao@huaweicloud.com
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4461b2cae3262279f254b3cd0f02d4323b1acc01
Author: Rafal Rogalski <rafalx.rogalski@intel.com>
Date:   Fri Jul 28 10:12:43 2023 -0700

    ice: Fix RDMA VSI removal during queue rebuild
    
    [ Upstream commit 4b31fd4d77ffa430d0b74ba1885ea0a41594f202 ]
    
    During qdisc create/delete, it is necessary to rebuild the queue
    of VSIs. An error occurred because the VSIs created by RDMA were
    still active.
    
    Added check if RDMA is active. If yes, it disallows qdisc changes
    and writes a message in the system logs.
    
    Fixes: 348048e724a0 ("ice: Implement iidc operations")
    Signed-off-by: Rafal Rogalski <rafalx.rogalski@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Signed-off-by: Kamil Maziarz <kamil.maziarz@intel.com>
    Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Link: https://lore.kernel.org/r/20230728171243.2446101-1-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0b45af982a4df0b14fb8669ee2a871cfdfa6a39c
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Fri Jul 28 17:07:05 2023 -0700

    net/sched: taprio: Limit TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME to INT_MAX.
    
    [ Upstream commit e739718444f7bf2fa3d70d101761ad83056ca628 ]
    
    syzkaller found zero division error [0] in div_s64_rem() called from
    get_cycle_time_elapsed(), where sched->cycle_time is the divisor.
    
    We have tests in parse_taprio_schedule() so that cycle_time will never
    be 0, and actually cycle_time is not 0 in get_cycle_time_elapsed().
    
    The problem is that the types of divisor are different; cycle_time is
    s64, but the argument of div_s64_rem() is s32.
    
    syzkaller fed this input and 0x100000000 is cast to s32 to be 0.
    
      @TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME={0xc, 0x8, 0x100000000}
    
    We use s64 for cycle_time to cast it to ktime_t, so let's keep it and
    set max for cycle_time.
    
    While at it, we prevent overflow in setup_txtime() and add another
    test in parse_taprio_schedule() to check if cycle_time overflows.
    
    Also, we add a new tdc test case for this issue.
    
    [0]:
    divide error: 0000 [#1] PREEMPT SMP KASAN NOPTI
    CPU: 1 PID: 103 Comm: kworker/1:3 Not tainted 6.5.0-rc1-00330-g60cc1f7d0605 #3
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    Workqueue: ipv6_addrconf addrconf_dad_work
    RIP: 0010:div_s64_rem include/linux/math64.h:42 [inline]
    RIP: 0010:get_cycle_time_elapsed net/sched/sch_taprio.c:223 [inline]
    RIP: 0010:find_entry_to_transmit+0x252/0x7e0 net/sched/sch_taprio.c:344
    Code: 3c 02 00 0f 85 5e 05 00 00 48 8b 4c 24 08 4d 8b bd 40 01 00 00 48 8b 7c 24 48 48 89 c8 4c 29 f8 48 63 f7 48 99 48 89 74 24 70 <48> f7 fe 48 29 d1 48 8d 04 0f 49 89 cc 48 89 44 24 20 49 8d 85 10
    RSP: 0018:ffffc90000acf260 EFLAGS: 00010206
    RAX: 177450e0347560cf RBX: 0000000000000000 RCX: 177450e0347560cf
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000100000000
    RBP: 0000000000000056 R08: 0000000000000000 R09: ffffed10020a0934
    R10: ffff8880105049a7 R11: ffff88806cf3a520 R12: ffff888010504800
    R13: ffff88800c00d800 R14: ffff8880105049a0 R15: 0000000000000000
    FS:  0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f0edf84f0e8 CR3: 000000000d73c002 CR4: 0000000000770ee0
    PKRU: 55555554
    Call Trace:
     <TASK>
     get_packet_txtime net/sched/sch_taprio.c:508 [inline]
     taprio_enqueue_one+0x900/0xff0 net/sched/sch_taprio.c:577
     taprio_enqueue+0x378/0xae0 net/sched/sch_taprio.c:658
     dev_qdisc_enqueue+0x46/0x170 net/core/dev.c:3732
     __dev_xmit_skb net/core/dev.c:3821 [inline]
     __dev_queue_xmit+0x1b2f/0x3000 net/core/dev.c:4169
     dev_queue_xmit include/linux/netdevice.h:3088 [inline]
     neigh_resolve_output net/core/neighbour.c:1552 [inline]
     neigh_resolve_output+0x4a7/0x780 net/core/neighbour.c:1532
     neigh_output include/net/neighbour.h:544 [inline]
     ip6_finish_output2+0x924/0x17d0 net/ipv6/ip6_output.c:135
     __ip6_finish_output+0x620/0xaa0 net/ipv6/ip6_output.c:196
     ip6_finish_output net/ipv6/ip6_output.c:207 [inline]
     NF_HOOK_COND include/linux/netfilter.h:292 [inline]
     ip6_output+0x206/0x410 net/ipv6/ip6_output.c:228
     dst_output include/net/dst.h:458 [inline]
     NF_HOOK.constprop.0+0xea/0x260 include/linux/netfilter.h:303
     ndisc_send_skb+0x872/0xe80 net/ipv6/ndisc.c:508
     ndisc_send_ns+0xb5/0x130 net/ipv6/ndisc.c:666
     addrconf_dad_work+0xc14/0x13f0 net/ipv6/addrconf.c:4175
     process_one_work+0x92c/0x13a0 kernel/workqueue.c:2597
     worker_thread+0x60f/0x1240 kernel/workqueue.c:2748
     kthread+0x2fe/0x3f0 kernel/kthread.c:389
     ret_from_fork+0x2c/0x50 arch/x86/entry/entry_64.S:308
     </TASK>
    Modules linked in:
    
    Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Co-developed-by: Eric Dumazet <edumazet@google.com>
    Co-developed-by: Pedro Tammela <pctammela@mojatatu.com>
    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 12d4ba18142434949977f7de9225847fd7147876
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:18 2023 +0000

    net: annotate data-races around sk->sk_priority
    
    [ Upstream commit 8bf43be799d4b242ea552a14db10456446be843e ]
    
    sk_getsockopt() runs locklessly. This means sk->sk_priority
    can be read while other threads are changing its value.
    
    Other reads also happen without socket lock being held.
    
    Add missing annotations where needed.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6326c83ee27ef9141ebfe730b7459534d2417870
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:17 2023 +0000

    net: add missing data-race annotation for sk_ll_usec
    
    [ Upstream commit e5f0d2dd3c2faa671711dac6d3ff3cef307bcfe3 ]
    
    In a prior commit I forgot that sk_getsockopt() reads
    sk->sk_ll_usec without holding a lock.
    
    Fixes: 0dbffbb5335a ("net: annotate data race around sk_ll_usec")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dd7a1ff07c6c741e6d56e65316f57835ed750eca
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:16 2023 +0000

    net: add missing data-race annotations around sk->sk_peek_off
    
    [ Upstream commit 11695c6e966b0ec7ed1d16777d294cef865a5c91 ]
    
    sk_getsockopt() runs locklessly, thus we need to annotate the read
    of sk->sk_peek_off.
    
    While we are at it, add corresponding annotations to sk_set_peek_off()
    and unix_set_peek_off().
    
    Fixes: b9bb53f3836f ("sock: convert sk_peek_offset functions to WRITE_ONCE")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b53468041d20177c8b8808d1891c0145718ceadf
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:15 2023 +0000

    net: annotate data-races around sk->sk_mark
    
    [ Upstream commit 3c5b4d69c358a9275a8de98f87caf6eda644b086 ]
    
    sk->sk_mark is often read while another thread could change the value.
    
    Fixes: 4a19ec5800fc ("[NET]: Introducing socket mark socket option.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c7bb6860645f83134842e27a2fd1c1449edc5d80
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:14 2023 +0000

    net: add missing READ_ONCE(sk->sk_rcvbuf) annotation
    
    [ Upstream commit b4b553253091cafe9ec38994acf42795e073bef5 ]
    
    In a prior commit, I forgot to change sk_getsockopt()
    when reading sk->sk_rcvbuf locklessly.
    
    Fixes: ebb3b78db7bf ("tcp: annotate sk->sk_rcvbuf lockless reads")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 10c832159622dafa50029cb2e89781bd547cb1e8
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:13 2023 +0000

    net: add missing READ_ONCE(sk->sk_sndbuf) annotation
    
    [ Upstream commit 74bc084327c643499474ba75df485607da37dd6e ]
    
    In a prior commit, I forgot to change sk_getsockopt()
    when reading sk->sk_sndbuf locklessly.
    
    Fixes: e292f05e0df7 ("tcp: annotate sk->sk_sndbuf lockless reads")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0a40103c9191ed3555d5a656b8df16341f8f43fe
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:11 2023 +0000

    net: add missing READ_ONCE(sk->sk_rcvlowat) annotation
    
    [ Upstream commit e6d12bdb435d23ff6c1890c852d85408a2f496ee ]
    
    In a prior commit, I forgot to change sk_getsockopt()
    when reading sk->sk_rcvlowat locklessly.
    
    Fixes: eac66402d1c3 ("net: annotate sk->sk_rcvlowat lockless reads")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit be43c8f1c9164adc14dbcaf06bb5ab921d82586a
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:10 2023 +0000

    net: annotate data-races around sk->sk_max_pacing_rate
    
    [ Upstream commit ea7f45ef77b39e72244d282e47f6cb1ef4135cd2 ]
    
    sk_getsockopt() runs locklessly. This means sk->sk_max_pacing_rate
    can be read while other threads are changing its value.
    
    Fixes: 62748f32d501 ("net: introduce SO_MAX_PACING_RATE")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0317c8322d9ac86a2bf251f94efc7fe96643e0fb
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:09 2023 +0000

    net: annotate data-race around sk->sk_txrehash
    
    [ Upstream commit c76a0328899bbe226f8adeb88b8da9e4167bd316 ]
    
    sk_getsockopt() runs locklessly. This means sk->sk_txrehash
    can be read while other threads are changing its value.
    
    Other locations were handled in commit cb6cd2cec799
    ("tcp: Change SYN ACK retransmit behaviour to account for rehash")
    
    Fixes: 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Akhmat Karakotov <hmukos@yandex-team.ru>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 60d92bc9c0940a8492a025b54224b6f063932736
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Jul 28 15:03:08 2023 +0000

    net: annotate data-races around sk->sk_reserved_mem
    
    [ Upstream commit fe11fdcb4207907d80cda2e73777465d68131e66 ]
    
    sk_getsockopt() runs locklessly. This means sk->sk_reserved_mem
    can be read while other threads are changing its value.
    
    Add missing annotations where they are needed.
    
    Fixes: 2bb2f5fb21b0 ("net: add new socket option SO_RESERVE_MEM")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Wei Wang <weiwan@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9da9ea9b132cbb9a5c4ff3d00214bd7064ca1a9a
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Thu Jul 27 18:26:09 2023 +0300

    qed: Fix scheduling in a tasklet while getting stats
    
    [ Upstream commit e346e231b42bcae6822a6326acfb7b741e9e6026 ]
    
    Here we've got to a situation when tasklet called usleep_range() in PTT
    acquire logic, thus welcome to the "scheduling while atomic" BUG().
    
      BUG: scheduling while atomic: swapper/24/0/0x00000100
    
       [<ffffffffb41c6199>] schedule+0x29/0x70
       [<ffffffffb41c5512>] schedule_hrtimeout_range_clock+0xb2/0x150
       [<ffffffffb41c55c3>] schedule_hrtimeout_range+0x13/0x20
       [<ffffffffb41c3bcf>] usleep_range+0x4f/0x70
       [<ffffffffc08d3e58>] qed_ptt_acquire+0x38/0x100 [qed]
       [<ffffffffc08eac48>] _qed_get_vport_stats+0x458/0x580 [qed]
       [<ffffffffc08ead8c>] qed_get_vport_stats+0x1c/0xd0 [qed]
       [<ffffffffc08dffd3>] qed_get_protocol_stats+0x93/0x100 [qed]
                            qed_mcp_send_protocol_stats
                case MFW_DRV_MSG_GET_LAN_STATS:
                case MFW_DRV_MSG_GET_FCOE_STATS:
                case MFW_DRV_MSG_GET_ISCSI_STATS:
                case MFW_DRV_MSG_GET_RDMA_STATS:
       [<ffffffffc08e36d8>] qed_mcp_handle_events+0x2d8/0x890 [qed]
                            qed_int_assertion
                            qed_int_attentions
       [<ffffffffc08d9490>] qed_int_sp_dpc+0xa50/0xdc0 [qed]
       [<ffffffffb3aa7623>] tasklet_action+0x83/0x140
       [<ffffffffb41d9125>] __do_softirq+0x125/0x2bb
       [<ffffffffb41d560c>] call_softirq+0x1c/0x30
       [<ffffffffb3a30645>] do_softirq+0x65/0xa0
       [<ffffffffb3aa78d5>] irq_exit+0x105/0x110
       [<ffffffffb41d8996>] do_IRQ+0x56/0xf0
    
    Fix this by making caller to provide the context whether it could be in
    atomic context flow or not when getting stats from QED driver.
    QED driver based on the context provided decide to schedule out or not
    when acquiring the PTT BAR window.
    
    We faced the BUG_ON() while getting vport stats, but according to the
    code same issue could happen for fcoe and iscsi statistics as well, so
    fixing them too.
    
    Fixes: 6c75424612a7 ("qed: Add support for NCSI statistics.")
    Fixes: 1e128c81290a ("qed: Add support for hardware offloaded FCoE.")
    Fixes: 2f2b2614e893 ("qed: Provide iSCSI statistics to management")
    Cc: Sudarsana Kalluru <skalluru@marvell.com>
    Cc: David Miller <davem@davemloft.net>
    Cc: Manish Chopra <manishc@marvell.com>
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3c42307abe97c5006f2875d38a896bb448080286
Author: Chengfeng Ye <dg573847474@gmail.com>
Date:   Thu Jul 27 08:56:19 2023 +0000

    mISDN: hfcpci: Fix potential deadlock on &hc->lock
    
    [ Upstream commit 56c6be35fcbed54279df0a2c9e60480a61841d6f ]
    
    As &hc->lock is acquired by both timer _hfcpci_softirq() and hardirq
    hfcpci_int(), the timer should disable irq before lock acquisition
    otherwise deadlock could happen if the timmer is preemtped by the hadr irq.
    
    Possible deadlock scenario:
    hfcpci_softirq() (timer)
        -> _hfcpci_softirq()
        -> spin_lock(&hc->lock);
            <irq interruption>
            -> hfcpci_int()
            -> spin_lock(&hc->lock); (deadlock here)
    
    This flaw was found by an experimental static analysis tool I am developing
    for irq-related deadlock.
    
    The tentative patch fixes the potential deadlock by spin_lock_irq()
    in timer.
    
    Fixes: b36b654a7e82 ("mISDN: Create /sys/class/mISDN")
    Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
    Link: https://lore.kernel.org/r/20230727085619.7419-1-dg573847474@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d652c080b67caf227adfcf77c03cbaf7d0820cbc
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Wed Jul 26 09:51:51 2023 -0400

    net: sched: cls_u32: Fix match key mis-addressing
    
    [ Upstream commit e68409db995380d1badacba41ff24996bd396171 ]
    
    A match entry is uniquely identified with an "address" or "path" in the
    form of: hashtable ID(12b):bucketid(8b):nodeid(12b).
    
    When creating table match entries all of hash table id, bucket id and
    node (match entry id) are needed to be either specified by the user or
    reasonable in-kernel defaults are used. The in-kernel default for a table id is
    0x800(omnipresent root table); for bucketid it is 0x0. Prior to this fix there
    was none for a nodeid i.e. the code assumed that the user passed the correct
    nodeid and if the user passes a nodeid of 0 (as Mingi Cho did) then that is what
    was used. But nodeid of 0 is reserved for identifying the table. This is not
    a problem until we dump. The dump code notices that the nodeid is zero and
    assumes it is referencing a table and therefore references table struct
    tc_u_hnode instead of what was created i.e match entry struct tc_u_knode.
    
    Ming does an equivalent of:
    tc filter add dev dummy0 parent 10: prio 1 handle 0x1000 \
    protocol ip u32 match ip src 10.0.0.1/32 classid 10:1 action ok
    
    Essentially specifying a table id 0, bucketid 1 and nodeid of zero
    Tableid 0 is remapped to the default of 0x800.
    Bucketid 1 is ignored and defaults to 0x00.
    Nodeid was assumed to be what Ming passed - 0x000
    
    dumping before fix shows:
    ~$ tc filter ls dev dummy0 parent 10:
    filter protocol ip pref 1 u32 chain 0
    filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1
    filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor -30591
    
    Note that the last line reports a table instead of a match entry
    (you can tell this because it says "ht divisor...").
    As a result of reporting the wrong data type (misinterpretting of struct
    tc_u_knode as being struct tc_u_hnode) the divisor is reported with value
    of -30591. Ming identified this as part of the heap address
    (physmap_base is 0xffff8880 (-30591 - 1)).
    
    The fix is to ensure that when table entry matches are added and no
    nodeid is specified (i.e nodeid == 0) then we get the next available
    nodeid from the table's pool.
    
    After the fix, this is what the dump shows:
    $ tc filter ls dev dummy0 parent 10:
    filter protocol ip pref 1 u32 chain 0
    filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1
    filter protocol ip pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:1 not_in_hw
      match 0a000001/ffffffff at 12
            action order 1: gact action pass
             random type none pass val 0
             index 1 ref 1 bind 1
    
    Reported-by: Mingi Cho <mgcho.minic@gmail.com>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://lore.kernel.org/r/20230726135151.416917-1-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 22709d85373ffc6278c8961dfe43180e66355ecb
Author: Georg Müller <georgmueller@gmx.net>
Date:   Fri Jul 28 17:18:12 2023 +0200

    perf test uprobe_from_different_cu: Skip if there is no gcc
    
    [ Upstream commit 98ce8e4a9dcfb448b30a2d7a16190f4a00382377 ]
    
    Without gcc, the test will fail.
    
    On cleanup, ignore probe removal errors. Otherwise, in case of an error
    adding the probe, the temporary directory is not removed.
    
    Fixes: 56cbeacf14353057 ("perf probe: Add test for regression introduced by switch to die_get_decl_file()")
    Signed-off-by: Georg Müller <georgmueller@gmx.net>
    Acked-by: Ian Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Georg Müller <georgmueller@gmx.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20230728151812.454806-2-georgmueller@gmx.net
    Link: https://lore.kernel.org/r/CAP-5=fUP6UuLgRty3t2=fQsQi3k4hDMz415vWdp1x88QMvZ8ug@mail.gmail.com/
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5ef5b6e9c17be8711d50017626d2897b1c06953a
Author: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date:   Thu Jul 27 01:05:06 2023 +0800

    net: dsa: fix value check in bcm_sf2_sw_probe()
    
    [ Upstream commit dadc5b86cc9459581f37fe755b431adc399ea393 ]
    
    in bcm_sf2_sw_probe(), check the return value of clk_prepare_enable()
    and return the error code if clk_prepare_enable() returns an
    unexpected value.
    
    Fixes: e9ec5c3bd238 ("net: dsa: bcm_sf2: request and handle clocks")
    Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Link: https://lore.kernel.org/r/20230726170506.16547-1-ruc_gongyuanjun@163.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8dfac8071d58447e5cace4c4c6fe493ce2f615f6
Author: Lin Ma <linma@zju.edu.cn>
Date:   Wed Jul 26 15:53:14 2023 +0800

    rtnetlink: let rtnl_bridge_setlink checks IFLA_BRIDGE_MODE length
    
    [ Upstream commit d73ef2d69c0dba5f5a1cb9600045c873bab1fb7f ]
    
    There are totally 9 ndo_bridge_setlink handlers in the current kernel,
    which are 1) bnxt_bridge_setlink, 2) be_ndo_bridge_setlink 3)
    i40e_ndo_bridge_setlink 4) ice_bridge_setlink 5)
    ixgbe_ndo_bridge_setlink 6) mlx5e_bridge_setlink 7)
    nfp_net_bridge_setlink 8) qeth_l2_bridge_setlink 9) br_setlink.
    
    By investigating the code, we find that 1-7 parse and use nlattr
    IFLA_BRIDGE_MODE but 3 and 4 forget to do the nla_len check. This can
    lead to an out-of-attribute read and allow a malformed nlattr (e.g.,
    length 0) to be viewed as a 2 byte integer.
    
    To avoid such issues, also for other ndo_bridge_setlink handlers in the
    future. This patch adds the nla_len check in rtnl_bridge_setlink and
    does an early error return if length mismatches. To make it works, the
    break is removed from the parsing for IFLA_BRIDGE_FLAGS to make sure
    this nla_for_each_nested iterates every attribute.
    
    Fixes: b1edc14a3fbf ("ice: Implement ice_bridge_getlink and ice_bridge_setlink")
    Fixes: 51616018dd1b ("i40e: Add support for getlink, setlink ndo ops")
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
    Link: https://lore.kernel.org/r/20230726075314.1059224-1-linma@zju.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 24772cc31f0074fb8dbb9f3f2733784dc8bd6673
Author: Lin Ma <linma@zju.edu.cn>
Date:   Tue Jul 25 10:33:30 2023 +0800

    bpf: Add length check for SK_DIAG_BPF_STORAGE_REQ_MAP_FD parsing
    
    [ Upstream commit bcc29b7f5af6797702c2306a7aacb831fc5ce9cb ]
    
    The nla_for_each_nested parsing in function bpf_sk_storage_diag_alloc
    does not check the length of the nested attribute. This can lead to an
    out-of-attribute read and allow a malformed nlattr (e.g., length 0) to
    be viewed as a 4 byte integer.
    
    This patch adds an additional check when the nlattr is getting counted.
    This makes sure the latter nla_get_u32 can access the attributes with
    the correct length.
    
    Fixes: 1ed4d92458a9 ("bpf: INET_DIAG support in bpf_sk_storage")
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230725023330.422856-1-linma@zju.edu.cn
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d628ba98eb1637acce44001e04c718d8dbb1f7ce
Author: Jianbo Liu <jianbol@nvidia.com>
Date:   Mon Jul 3 08:28:16 2023 +0000

    net/mlx5e: Move representor neigh cleanup to profile cleanup_tx
    
    [ Upstream commit d03b6e6f31820b84f7449cca022047f36c42bc3f ]
    
    For IP tunnel encapsulation in ECMP (Equal-Cost Multipath) mode, as
    the flow is duplicated to the peer eswitch, the related neighbour
    information on the peer uplink representor is created as well.
    
    In the cited commit, eswitch devcom unpair is moved to uplink unload
    API, specifically the profile->cleanup_tx. If there is a encap rule
    offloaded in ECMP mode, when one eswitch does unpair (because of
    unloading the driver, for instance), and the peer rule from the peer
    eswitch is going to be deleted, the use-after-free error is triggered
    while accessing neigh info, as it is already cleaned up in uplink's
    profile->disable, which is before its profile->cleanup_tx.
    
    To fix this issue, move the neigh cleanup to profile's cleanup_tx
    callback, and after mlx5e_cleanup_uplink_rep_tx is called. The neigh
    init is moved to init_tx for symmeter.
    
    [ 2453.376299] BUG: KASAN: slab-use-after-free in mlx5e_rep_neigh_entry_release+0x109/0x3a0 [mlx5_core]
    [ 2453.379125] Read of size 4 at addr ffff888127af9008 by task modprobe/2496
    
    [ 2453.381542] CPU: 7 PID: 2496 Comm: modprobe Tainted: G    B              6.4.0-rc7+ #15
    [ 2453.383386] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    [ 2453.384335] Call Trace:
    [ 2453.384625]  <TASK>
    [ 2453.384891]  dump_stack_lvl+0x33/0x50
    [ 2453.385285]  print_report+0xc2/0x610
    [ 2453.385667]  ? __virt_addr_valid+0xb1/0x130
    [ 2453.386091]  ? mlx5e_rep_neigh_entry_release+0x109/0x3a0 [mlx5_core]
    [ 2453.386757]  kasan_report+0xae/0xe0
    [ 2453.387123]  ? mlx5e_rep_neigh_entry_release+0x109/0x3a0 [mlx5_core]
    [ 2453.387798]  mlx5e_rep_neigh_entry_release+0x109/0x3a0 [mlx5_core]
    [ 2453.388465]  mlx5e_rep_encap_entry_detach+0xa6/0xe0 [mlx5_core]
    [ 2453.389111]  mlx5e_encap_dealloc+0xa7/0x100 [mlx5_core]
    [ 2453.389706]  mlx5e_tc_tun_encap_dests_unset+0x61/0xb0 [mlx5_core]
    [ 2453.390361]  mlx5_free_flow_attr_actions+0x11e/0x340 [mlx5_core]
    [ 2453.391015]  ? complete_all+0x43/0xd0
    [ 2453.391398]  ? free_flow_post_acts+0x38/0x120 [mlx5_core]
    [ 2453.392004]  mlx5e_tc_del_fdb_flow+0x4ae/0x690 [mlx5_core]
    [ 2453.392618]  mlx5e_tc_del_fdb_peers_flow+0x308/0x370 [mlx5_core]
    [ 2453.393276]  mlx5e_tc_clean_fdb_peer_flows+0xf5/0x140 [mlx5_core]
    [ 2453.393925]  mlx5_esw_offloads_unpair+0x86/0x540 [mlx5_core]
    [ 2453.394546]  ? mlx5_esw_offloads_set_ns_peer.isra.0+0x180/0x180 [mlx5_core]
    [ 2453.395268]  ? down_write+0xaa/0x100
    [ 2453.395652]  mlx5_esw_offloads_devcom_event+0x203/0x530 [mlx5_core]
    [ 2453.396317]  mlx5_devcom_send_event+0xbb/0x190 [mlx5_core]
    [ 2453.396917]  mlx5_esw_offloads_devcom_cleanup+0xb0/0xd0 [mlx5_core]
    [ 2453.397582]  mlx5e_tc_esw_cleanup+0x42/0x120 [mlx5_core]
    [ 2453.398182]  mlx5e_rep_tc_cleanup+0x15/0x30 [mlx5_core]
    [ 2453.398768]  mlx5e_cleanup_rep_tx+0x6c/0x80 [mlx5_core]
    [ 2453.399367]  mlx5e_detach_netdev+0xee/0x120 [mlx5_core]
    [ 2453.399957]  mlx5e_netdev_change_profile+0x84/0x170 [mlx5_core]
    [ 2453.400598]  mlx5e_vport_rep_unload+0xe0/0xf0 [mlx5_core]
    [ 2453.403781]  mlx5_eswitch_unregister_vport_reps+0x15e/0x190 [mlx5_core]
    [ 2453.404479]  ? mlx5_eswitch_register_vport_reps+0x200/0x200 [mlx5_core]
    [ 2453.405170]  ? up_write+0x39/0x60
    [ 2453.405529]  ? kernfs_remove_by_name_ns+0xb7/0xe0
    [ 2453.405985]  auxiliary_bus_remove+0x2e/0x40
    [ 2453.406405]  device_release_driver_internal+0x243/0x2d0
    [ 2453.406900]  ? kobject_put+0x42/0x2d0
    [ 2453.407284]  bus_remove_device+0x128/0x1d0
    [ 2453.407687]  device_del+0x240/0x550
    [ 2453.408053]  ? waiting_for_supplier_show+0xe0/0xe0
    [ 2453.408511]  ? kobject_put+0xfa/0x2d0
    [ 2453.408889]  ? __kmem_cache_free+0x14d/0x280
    [ 2453.409310]  mlx5_rescan_drivers_locked.part.0+0xcd/0x2b0 [mlx5_core]
    [ 2453.409973]  mlx5_unregister_device+0x40/0x50 [mlx5_core]
    [ 2453.410561]  mlx5_uninit_one+0x3d/0x110 [mlx5_core]
    [ 2453.411111]  remove_one+0x89/0x130 [mlx5_core]
    [ 2453.411628]  pci_device_remove+0x59/0xf0
    [ 2453.412026]  device_release_driver_internal+0x243/0x2d0
    [ 2453.412511]  ? parse_option_str+0x14/0x90
    [ 2453.412915]  driver_detach+0x7b/0xf0
    [ 2453.413289]  bus_remove_driver+0xb5/0x160
    [ 2453.413685]  pci_unregister_driver+0x3f/0xf0
    [ 2453.414104]  mlx5_cleanup+0xc/0x20 [mlx5_core]
    
    Fixes: 2be5bd42a5bb ("net/mlx5: Handle pairing of E-switch via uplink un/load APIs")
    Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 94a0eb9c12be737d91bd84bf7f395f197d076628
Author: Amir Tzin <amirtz@nvidia.com>
Date:   Tue May 30 20:11:14 2023 +0300

    net/mlx5e: Fix crash moving to switchdev mode when ntuple offload is set
    
    [ Upstream commit 3ec43c1b082a8804472430e1253544d75f4b540e ]
    
    Moving to switchdev mode with ntuple offload on causes the kernel to
    crash since fs->arfs is freed during nic profile cleanup flow.
    
    Ntuple offload is not supported in switchdev mode and it is already
    unset by mlx5 fix feature ndo in switchdev mode. Verify fs->arfs is
    valid before disabling it.
    
    trace:
    [] RIP: 0010:_raw_spin_lock_bh+0x17/0x30
    [] arfs_del_rules+0x44/0x1a0 [mlx5_core]
    [] mlx5e_arfs_disable+0xe/0x20 [mlx5_core]
    [] mlx5e_handle_feature+0x3d/0xb0 [mlx5_core]
    [] ? __rtnl_unlock+0x25/0x50
    [] mlx5e_set_features+0xfe/0x160 [mlx5_core]
    [] __netdev_update_features+0x278/0xa50
    [] ? netdev_run_todo+0x5e/0x2a0
    [] netdev_update_features+0x22/0x70
    [] ? _cond_resched+0x15/0x30
    [] mlx5e_attach_netdev+0x12a/0x1e0 [mlx5_core]
    [] mlx5e_netdev_attach_profile+0xa1/0xc0 [mlx5_core]
    [] mlx5e_netdev_change_profile+0x77/0xe0 [mlx5_core]
    [] mlx5e_vport_rep_load+0x1ed/0x290 [mlx5_core]
    [] mlx5_esw_offloads_rep_load+0x88/0xd0 [mlx5_core]
    [] esw_offloads_load_rep.part.38+0x31/0x50 [mlx5_core]
    [] esw_offloads_enable+0x6c5/0x710 [mlx5_core]
    [] mlx5_eswitch_enable_locked+0x1bb/0x290 [mlx5_core]
    [] mlx5_devlink_eswitch_mode_set+0x14f/0x320 [mlx5_core]
    [] devlink_nl_cmd_eswitch_set_doit+0x94/0x120
    [] genl_family_rcv_msg_doit.isra.17+0x113/0x150
    [] genl_family_rcv_msg+0xb7/0x170
    [] ? devlink_nl_cmd_port_split_doit+0x100/0x100
    [] genl_rcv_msg+0x47/0xa0
    [] ? genl_family_rcv_msg+0x170/0x170
    [] netlink_rcv_skb+0x4c/0x130
    [] genl_rcv+0x24/0x40
    [] netlink_unicast+0x19a/0x230
    [] netlink_sendmsg+0x204/0x3d0
    [] sock_sendmsg+0x50/0x60
    
    Fixes: 90b22b9bcd24 ("net/mlx5e: Disable Rx ntuple offload for uplink representor")
    Signed-off-by: Amir Tzin <amirtz@nvidia.com>
    Reviewed-by: Aya Levin <ayal@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a7b5f001004c2fe0d2e3ea8d21d498e38a61d9eb
Author: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date:   Tue Jul 25 14:56:55 2023 +0800

    net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer()
    
    [ Upstream commit e5bcb7564d3bd0c88613c76963c5349be9c511c5 ]
    
    mlx5e_ipsec_remove_trailer() should return an error code if function
    pskb_trim() returns an unexpected value.
    
    Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
    Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0582a3caaa3e2f7b80bcb113ad3c910eac15a63e
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Sat Jul 8 15:13:07 2023 +0800

    net/mlx5: fix potential memory leak in mlx5e_init_rep_rx
    
    [ Upstream commit c6cf0b6097bf1bf1b2a89b521e9ecd26b581a93a ]
    
    The memory pointed to by the priv->rx_res pointer is not freed in the error
    path of mlx5e_init_rep_rx, which can lead to a memory leak. Fix by freeing
    the memory in the error path, thereby making the error path identical to
    mlx5e_cleanup_rep_rx().
    
    Fixes: af8bbf730068 ("net/mlx5e: Convert mlx5e_flow_steering member of mlx5e_priv to pointer")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.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 3169c3854397f3070a63b1b772db16dcb8cba7b4
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Jul 5 20:15:27 2023 +0800

    net/mlx5: DR, fix memory leak in mlx5dr_cmd_create_reformat_ctx
    
    [ Upstream commit 5dd77585dd9d0e03dd1bceb95f0269a7eaf6b936 ]
    
    when mlx5_cmd_exec failed in mlx5dr_cmd_create_reformat_ctx, the memory
    pointed by 'in' is not released, which will cause memory leak. Move memory
    release after mlx5_cmd_exec.
    
    Fixes: 1d9186476e12 ("net/mlx5: DR, Add direct rule command utilities")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c818fff3b6cb1a8d5216e4974c4b5f2d11ebf005
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Tue Jul 4 15:06:40 2023 +0800

    net/mlx5e: fix double free in macsec_fs_tx_create_crypto_table_groups
    
    [ Upstream commit aeb660171b0663847fa04806a96302ac6112ad26 ]
    
    In function macsec_fs_tx_create_crypto_table_groups(), when the ft->g
    memory is successfully allocated but the 'in' memory fails to be
    allocated, the memory pointed to by ft->g is released once. And in function
    macsec_fs_tx_create(), macsec_fs_tx_destroy() is called to release the
    memory pointed to by ft->g again. This will cause double free problem.
    
    Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7a6fad03f54c3fd007a075fa58b75789ff12f227
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Sun Jul 23 23:10:43 2023 +0300

    wifi: cfg80211: Fix return value in scan logic
    
    [ Upstream commit fd7f08d92fcd7cc3eca0dd6c853f722a4c6176df ]
    
    The reporter noticed a warning when running iwlwifi:
    
    WARNING: CPU: 8 PID: 659 at mm/page_alloc.c:4453 __alloc_pages+0x329/0x340
    
    As cfg80211_parse_colocated_ap() is not expected to return a negative
    value return 0 and not a negative value if cfg80211_calc_short_ssid()
    fails.
    
    Fixes: c8cb5b854b40f ("nl80211/cfg80211: support 6 GHz scanning")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217675
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20230723201043.3007430-1-ilan.peer@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 05e0952ddb75abef20cdb585060584f8d8f0bc4a
Author: Gao Xiang <xiang@kernel.org>
Date:   Wed Jul 19 14:54:59 2023 +0800

    erofs: fix wrong primary bvec selection on deduplicated extents
    
    [ Upstream commit 94c43de73521d8ed7ebcfc6191d9dace1cbf7caa ]
    
    When handling deduplicated compressed data, there can be multiple
    decompressed extents pointing to the same compressed data in one shot.
    
    In such cases, the bvecs which belong to the longest extent will be
    selected as the primary bvecs for real decompressors to decode and the
    other duplicated bvecs will be directly copied from the primary bvecs.
    
    Previously, only relative offsets of the longest extent were checked to
    decompress the primary bvecs.  On rare occasions, it can be incorrect
    if there are several extents with the same start relative offset.
    As a result, some short bvecs could be selected for decompression and
    then cause data corruption.
    
    For example, as Shijie Sun reported off-list, considering the following
    extents of a file:
     117:   903345..  915250 |   11905 :     385024..    389120 |    4096
    ...
     119:   919729..  930323 |   10594 :     385024..    389120 |    4096
    ...
     124:   968881..  980786 |   11905 :     385024..    389120 |    4096
    
    The start relative offset is the same: 2225, but extent 119 (919729..
    930323) is shorter than the others.
    
    Let's restrict the bvec length in addition to the start offset if bvecs
    are not full.
    
    Reported-by: Shijie Sun <sunshijie@xiaomi.com>
    Fixes: 5c2a64252c5d ("erofs: introduce partial-referenced pclusters")
    Tested-by Shijie Sun <sunshijie@xiaomi.com>
    Reviewed-by: Yue Hu <huyue2@coolpad.com>
    Reviewed-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20230719065459.60083-1-hsiangkao@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a759972d254901fa8066676caef6e4cc3a48d52e
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Thu Jul 27 20:29:39 2023 +0200

    KVM: s390: fix sthyi error handling
    
    [ Upstream commit 0c02cc576eac161601927b41634f80bfd55bfa9e ]
    
    Commit 9fb6c9b3fea1 ("s390/sthyi: add cache to store hypervisor info")
    added cache handling for store hypervisor info. This also changed the
    possible return code for sthyi_fill().
    
    Instead of only returning a condition code like the sthyi instruction would
    do, it can now also return a negative error value (-ENOMEM). handle_styhi()
    was not changed accordingly. In case of an error, the negative error value
    would incorrectly injected into the guest PSW.
    
    Add proper error handling to prevent this, and update the comment which
    describes the possible return values of sthyi_fill().
    
    Fixes: 9fb6c9b3fea1 ("s390/sthyi: add cache to store hypervisor info")
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Link: https://lore.kernel.org/r/20230727182939.2050744-1-hca@linux.ibm.com
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f168188174b3ec24f54b1d79811ebeb1c00d3df0
Author: ndesaulniers@google.com <ndesaulniers@google.com>
Date:   Tue Aug 1 15:22:17 2023 -0700

    word-at-a-time: use the same return type for has_zero regardless of endianness
    
    [ Upstream commit 79e8328e5acbe691bbde029a52c89d70dcbc22f3 ]
    
    Compiling big-endian targets with Clang produces the diagnostic:
    
      fs/namei.c:2173:13: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
            } while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants)));
                      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                   ||
      fs/namei.c:2173:13: note: cast one or both operands to int to silence this warning
    
    It appears that when has_zero was introduced, two definitions were
    produced with different signatures (in particular different return
    types).
    
    Looking at the usage in hash_name() in fs/namei.c, I suspect that
    has_zero() is meant to be invoked twice per while loop iteration; using
    logical-or would not update `bdata` when `a` did not have zeros.  So I
    think it's preferred to always return an unsigned long rather than a
    bool than update the while loop in hash_name() to use a logical-or
    rather than bitwise-or.
    
    [ Also changed powerpc version to do the same  - Linus ]
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1832
    Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
    Fixes: 36126f8f2ed8 ("word-at-a-time: make the interfaces truly generic")
    Debugged-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
    Acked-by: Heiko Carstens <hca@linux.ibm.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5b53b2b44f0cf5e77bc6e4ac22685ba23eafe94a
Author: Cristian Marussi <cristian.marussi@arm.com>
Date:   Wed Jul 19 18:35:33 2023 +0100

    firmware: arm_scmi: Fix chan_free cleanup on SMC
    
    [ Upstream commit d1ff11d7ad8704f8d615f6446041c221b2d2ec4d ]
    
    SCMI transport based on SMC can optionally use an additional IRQ to
    signal message completion. The associated interrupt handler is currently
    allocated using devres but on shutdown the core SCMI stack will call
    .chan_free() well before any managed cleanup is invoked by devres.
    As a consequence, the arrival of a late reply to an in-flight pending
    transaction could still trigger the interrupt handler well after the
    SCMI core has cleaned up the channels, with unpleasant results.
    
    Inhibit further message processing on the IRQ path by explicitly freeing
    the IRQ inside .chan_free() callback itself.
    
    Fixes: dd820ee21d5e ("firmware: arm_scmi: Augment SMC/HVC to allow optional interrupt")
    Reported-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
    Link: https://lore.kernel.org/r/20230719173533.2739319-1-cristian.marussi@arm.com
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6289d5486d36d6294a16eaeae1d31045dda14eee
Author: Yury Norov <yury.norov@gmail.com>
Date:   Mon Jul 17 12:17:03 2023 -0700

    lib/bitmap: workaround const_eval test build failure
    
    [ Upstream commit 2356d198d2b4ddec24efea98271cb3be230bc787 ]
    
    When building with Clang, and when KASAN and GCOV_PROFILE_ALL are both
    enabled, the test fails to build [1]:
    
    >> lib/test_bitmap.c:920:2: error: call to '__compiletime_assert_239' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res)
               BUILD_BUG_ON(!__builtin_constant_p(res));
               ^
       include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
               BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
               ^
       include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
       #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                           ^
       include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert'
               _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
               ^
       include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert'
               __compiletime_assert(condition, msg, prefix, suffix)
               ^
       include/linux/compiler_types.h:333:4: note: expanded from macro '__compiletime_assert'
                               prefix ## suffix();                             \
                               ^
       <scratch space>:185:1: note: expanded from here
       __compiletime_assert_239
    
    Originally it was attributed to s390, which now looks seemingly wrong. The
    issue is not related to bitmap code itself, but it breaks build for a given
    configuration.
    
    Disabling the const_eval test under that config may potentially hide other
    bugs. Instead, workaround it by disabling GCOV for the test_bitmap unless
    the compiler will get fixed.
    
    [1] https://github.com/ClangBuiltLinux/linux/issues/1874
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202307171254.yFcH97ej-lkp@intel.com/
    Fixes: dc34d5036692 ("lib: test_bitmap: add compile-time optimization/evaluations assertions")
    Co-developed-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Yury Norov <yury.norov@gmail.com>
    Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0ca5de8309f9942cf59190732a37fd251cc60ad1
Author: Punit Agrawal <punit.agrawal@bytedance.com>
Date:   Mon Jul 17 18:17:02 2023 +0100

    firmware: smccc: Fix use of uninitialised results structure
    
    [ Upstream commit d05799d7b4a39fa71c65aa277128ac7c843ffcdc ]
    
    Commit 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum
    T241-FABRIC-4") moved the initialisation of the SoC version to
    arm_smccc_version_init() but forgot to update the results structure
    and it's usage.
    
    Fix the use of the uninitialised results structure and update the
    error strings.
    
    Fixes: 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4")
    Signed-off-by: Punit Agrawal <punit.agrawal@bytedance.com>
    Cc: Sudeep Holla <sudeep.holla@arm.com>
    Cc: Marc Zyngier <maz@kernel.org>
    Cc: Vikram Sethi <vsethi@nvidia.com>
    Cc: Shanker Donthineni <sdonthineni@nvidia.com>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20230717171702.424253-1-punit.agrawal@bytedance.com
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7b0582dddd7eaa005ed895049db400da5dd54dda
Author: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Date:   Fri Jul 7 11:42:00 2023 +0200

    arm64: dts: freescale: Fix VPU G2 clock
    
    [ Upstream commit b27bfc5103c72f84859bd32731b6a09eafdeda05 ]
    
    Set VPU G2 clock to 300MHz like described in documentation.
    This fixes pixels error occurring with large resolution ( >= 2560x1600)
    HEVC test stream when using the postprocessor to produce NV12.
    
    Fixes: 4ac7e4a81272 ("arm64: dts: imx8mq: Enable both G1 and G2 VPU's with vpu-blk-ctrl")
    Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5841d3d0c3525e699c2eb60cce0bfa3eb03eccc0
Author: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Date:   Tue Jul 4 09:48:00 2023 -0400

    arm64: dts: imx8mn-var-som: add missing pull-up for onboard PHY reset pinmux
    
    [ Upstream commit 253be5b53c2792fb4384f8005b05421e6f040ee3 ]
    
    For SOMs with an onboard PHY, the RESET_N pull-up resistor is
    currently deactivated in the pinmux configuration. When the pinmux
    code selects the GPIO function for this pin, with a default direction
    of input, this prevents the RESET_N pin from being taken to the proper
    3.3V level (deasserted), and this results in the PHY being not
    detected since it is held in reset.
    
    Taken from RESET_N pin description in ADIN13000 datasheet:
        This pin requires a 1K pull-up resistor to AVDD_3P3.
    
    Activate the pull-up resistor to fix the issue.
    
    Fixes: ade0176dd8a0 ("arm64: dts: imx8mn-var-som: Add Variscite VAR-SOM-MX8MN System on Module")
    Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
    Reviewed-by: Fabio Estevam <festevam@gmail.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a24f67b71ad265e4008ae88f09e5bc039afb49df
Author: Yashwanth Varakala <y.varakala@phytec.de>
Date:   Fri Jun 16 11:50:09 2023 +0200

    arm64: dts: phycore-imx8mm: Correction in gpio-line-names
    
    [ Upstream commit 1ef0aa137a96c5f0564f2db0c556a4f0f60ce8f5 ]
    
    Remove unused nINT_ETHPHY entry from gpio-line-names in gpio1 nodes of
    phyCORE-i.MX8MM and phyBOARD-Polis-i.MX8MM devicetrees.
    
    Fixes: ae6847f26ac9 ("arm64: dts: freescale: Add phyBOARD-Polis-i.MX8MM support")
    Signed-off-by: Yashwanth Varakala <y.varakala@phytec.de>
    Signed-off-by: Cem Tenruh <c.tenruh@phytec.de>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 753a927c58412a8510ff5933c948d259df9058c3
Author: Yashwanth Varakala <y.varakala@phytec.de>
Date:   Fri Jun 16 11:50:07 2023 +0200

    arm64: dts: phycore-imx8mm: Label typo-fix of VPU
    
    [ Upstream commit cddeefc1663294fb74b31ff5029a83c0e819ff3a ]
    
    Corrected the label of the VPU regulator node (buck 3)
    from reg_vdd_gpu to reg_vdd_vpu.
    
    Fixes: ae6847f26ac9 ("arm64: dts: freescale: Add phyBOARD-Polis-i.MX8MM support")
    Signed-off-by: Yashwanth Varakala <y.varakala@phytec.de>
    Signed-off-by: Cem Tenruh <c.tenruh@phytec.de>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 608ac7ea5f057dca02df0f6fec70cdadf4aa47b3
Author: Tim Harvey <tharvey@gateworks.com>
Date:   Tue Jun 6 08:40:30 2023 -0700

    arm64: dts: imx8mm-venice-gw7904: disable disp_blk_ctrl
    
    [ Upstream commit f7a0b57524cf811ac06257a5099f1b7c19ee7310 ]
    
    The GW7904 does not connect the VDD_MIPI power rails thus MIPI is
    disabled. However we must also disable disp_blk_ctrl as it uses the
    pgc_mipi power domain and without it being disabled imx8m-blk-ctrl will
    fail to probe:
    imx8m-blk-ctrl 32e28000.blk-ctrl: error -ETIMEDOUT: failed to attach
    power domain "mipi-dsi"
    imx8m-blk-ctrl: probe of 32e28000.blk-ctrl failed with error -110
    
    Fixes: b999bdaf0597 ("arm64: dts: imx: Add i.mx8mm Gateworks gw7904 dts support")
    Signed-off-by: Tim Harvey <tharvey@gateworks.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d060bbb2fed8afa3509614a6057f0792a5c71d0a
Author: Tim Harvey <tharvey@gateworks.com>
Date:   Tue Jun 6 08:39:45 2023 -0700

    arm64: dts: imx8mm-venice-gw7903: disable disp_blk_ctrl
    
    [ Upstream commit 3e7d3c5e13b05dda9db92d98803a626378e75438 ]
    
    The GW7903 does not connect the VDD_MIPI power rails thus MIPI is
    disabled. However we must also disable disp_blk_ctrl as it uses the
    pgc_mipi power domain and without it being disabled imx8m-blk-ctrl will
    fail to probe:
    imx8m-blk-ctrl 32e28000.blk-ctrl: error -ETIMEDOUT: failed to attach power domain "mipi-dsi"
    imx8m-blk-ctrl: probe of 32e28000.blk-ctrl failed with error -110
    
    Fixes: a72ba91e5bc7 ("arm64: dts: imx: Add i.mx8mm Gateworks gw7903 dts support")
    Signed-off-by: Tim Harvey <tharvey@gateworks.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8ddb3183c439bec96c6fb244b4449486405d6c3b
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Wed Aug 2 17:21:00 2023 +0000

    iommu/arm-smmu-v3: Document nesting-related errata
    
    commit 0bfbfc526c70606bf0fad302e4821087cbecfaf4 upstream
    
    Both MMU-600 and MMU-700 have similar errata around TLB invalidation
    while both stages of translation are active, which will need some
    consideration once nesting support is implemented. For now, though,
    it's very easy to make our implicit lack of nesting support explicit
    for those cases, so they're less likely to be missed in future.
    
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/696da78d32bb4491f898f11b0bb4d850a8aa7c6a.1683731256.git.robin.murphy@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 42d04acf1d9b78c07f9a29d6093b638ccf21c175
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Wed Aug 2 17:20:59 2023 +0000

    iommu/arm-smmu-v3: Add explicit feature for nesting
    
    commit 1d9777b9f3d55b4b6faf186ba4f1d6fb560c0523 upstream
    
    In certain cases we may want to refuse to allow nested translation even
    when both stages are implemented, so let's add an explicit feature for
    nesting support which we can control in its own right. For now this
    merely serves as documentation, but it means a nice convenient check
    will be ready and waiting for the future nesting code.
    
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/136c3f4a3a84cc14a5a1978ace57dfd3ed67b688.1683731256.git.robin.murphy@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 57ae3671ece5380ab0e7b948c508797a77632a1e
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Wed Aug 2 17:20:58 2023 +0000

    iommu/arm-smmu-v3: Document MMU-700 erratum 2812531
    
    commit 309a15cb16bb075da1c99d46fb457db6a1a2669e upstream
    
    To work around MMU-700 erratum 2812531 we need to ensure that certain
    sequences of commands cannot be issued without an intervening sync. In
    practice this falls out of our current command-batching machinery
    anyway - each batch only contains a single type of invalidation command,
    and ends with a sync. The only exception is when a batch is sufficiently
    large to need issuing across multiple command queue slots, wherein the
    earlier slots will not contain a sync and thus may in theory interleave
    with another batch being issued in parallel to create an affected
    sequence across the slot boundary.
    
    Since MMU-700 supports range invalidate commands and thus we will prefer
    to use them (which also happens to avoid conditions for other errata),
    I'm not entirely sure it's even possible for a single high-level
    invalidate call to generate a batch of more than 63 commands, but for
    the sake of robustness and documentation, wire up an option to enforce
    that a sync is always inserted for every slot issued.
    
    The other aspect is that the relative order of DVM commands cannot be
    controlled, so DVM cannot be used. Again that is already the status quo,
    but since we have at least defined ARM_SMMU_FEAT_BTM, we can explicitly
    disable it for documentation purposes even if it's not wired up anywhere
    yet.
    
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/330221cdfd0003cd51b6c04e7ff3566741ad8374.1683731256.git.robin.murphy@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3399bd014e9f2faedb66c8660b7f81ef20aa44f
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Wed Aug 2 17:20:57 2023 +0000

    iommu/arm-smmu-v3: Work around MMU-600 erratum 1076982
    
    commit f322e8af35c7f23a8c08b595c38d6c855b2d836f upstream
    
    MMU-600 versions prior to r1p0 fail to correctly generate a WFE wakeup
    event when the command queue transitions fom full to non-full. We can
    easily work around this by simply hiding the SEV capability such that we
    fall back to polling for space in the queue - since MMU-600 implements
    MSIs we wouldn't expect to need SEV for sync completion either, so this
    should have little to no impact.
    
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
    Tested-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/08adbe3d01024d8382a478325f73b56851f76e49.1683731256.git.robin.murphy@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 50c24f0c940728792c8bdf65c1eaf6b91b3b0dcd
Author: Alex Elder <elder@linaro.org>
Date:   Mon Jul 24 17:40:55 2023 -0500

    net: ipa: only reset hashed tables when supported
    
    commit e11ec2b868af2b351c6c1e2e50eb711cc5423a10 upstream.
    
    Last year, the code that manages GSI channel transactions switched
    from using spinlock-protected linked lists to using indexes into the
    ring buffer used for a channel.  Recently, Google reported seeing
    transaction reference count underflows occasionally during shutdown.
    
    Doug Anderson found a way to reproduce the issue reliably, and
    bisected the issue to the commit that eliminated the linked lists
    and the lock.  The root cause was ultimately determined to be
    related to unused transactions being committed as part of the modem
    shutdown cleanup activity.  Unused transactions are not normally
    expected (except in error cases).
    
    The modem uses some ranges of IPA-resident memory, and whenever it
    shuts down we zero those ranges.  In ipa_filter_reset_table() a
    transaction is allocated to zero modem filter table entries.  If
    hashing is not supported, hashed table memory should not be zeroed.
    But currently nothing prevents that, and the result is an unused
    transaction.  Something similar occurs when we zero routing table
    entries for the modem.
    
    By preventing any attempt to clear hashed tables when hashing is not
    supported, the reference count underflow is avoided in this case.
    
    Note that there likely remains an issue with properly freeing unused
    transactions (if they occur due to errors).  This patch addresses
    only the underflows that Google originally reported.
    
    Cc: <stable@vger.kernel.org> # 6.1.x
    Fixes: d338ae28d8a8 ("net: ipa: kill all other transaction lists")
    Tested-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Alex Elder <elder@linaro.org>
    Link: https://lore.kernel.org/r/20230724224055.1688854-1-elder@linaro.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93f5b881125e6514c9bcd225fd86703da533136b
Author: Shay Drory <shayd@nvidia.com>
Date:   Thu Apr 13 22:15:31 2023 +0300

    net/mlx5: Free irqs only on shutdown callback
    
    commit 9c2d08010963a61a171e8cb2852d3ce015b60cb4 upstream.
    
    Whenever a shutdown is invoked, free irqs only and keep mlx5_irq
    synthetic wrapper intact in order to avoid use-after-free on
    system shutdown.
    
    for example:
    ==================================================================
    BUG: KASAN: use-after-free in _find_first_bit+0x66/0x80
    Read of size 8 at addr ffff88823fc0d318 by task kworker/u192:0/13608
    
    CPU: 25 PID: 13608 Comm: kworker/u192:0 Tainted: G    B   W  O  6.1.21-cloudflare-kasan-2023.3.21 #1
    Hardware name: GIGABYTE R162-R2-GEN0/MZ12-HD2-CD, BIOS R14 05/03/2021
    Workqueue: mlx5e mlx5e_tx_timeout_work [mlx5_core]
    Call Trace:
      <TASK>
      dump_stack_lvl+0x34/0x48
      print_report+0x170/0x473
      ? _find_first_bit+0x66/0x80
      kasan_report+0xad/0x130
      ? _find_first_bit+0x66/0x80
      _find_first_bit+0x66/0x80
      mlx5e_open_channels+0x3c5/0x3a10 [mlx5_core]
      ? console_unlock+0x2fa/0x430
      ? _raw_spin_lock_irqsave+0x8d/0xf0
      ? _raw_spin_unlock_irqrestore+0x42/0x80
      ? preempt_count_add+0x7d/0x150
      ? __wake_up_klogd.part.0+0x7d/0xc0
      ? vprintk_emit+0xfe/0x2c0
      ? mlx5e_trigger_napi_sched+0x40/0x40 [mlx5_core]
      ? dev_attr_show.cold+0x35/0x35
      ? devlink_health_do_dump.part.0+0x174/0x340
      ? devlink_health_report+0x504/0x810
      ? mlx5e_reporter_tx_timeout+0x29d/0x3a0 [mlx5_core]
      ? mlx5e_tx_timeout_work+0x17c/0x230 [mlx5_core]
      ? process_one_work+0x680/0x1050
      mlx5e_safe_switch_params+0x156/0x220 [mlx5_core]
      ? mlx5e_switch_priv_channels+0x310/0x310 [mlx5_core]
      ? mlx5_eq_poll_irq_disabled+0xb6/0x100 [mlx5_core]
      mlx5e_tx_reporter_timeout_recover+0x123/0x240 [mlx5_core]
      ? __mutex_unlock_slowpath.constprop.0+0x2b0/0x2b0
      devlink_health_reporter_recover+0xa6/0x1f0
      devlink_health_report+0x2f7/0x810
      ? vsnprintf+0x854/0x15e0
      mlx5e_reporter_tx_timeout+0x29d/0x3a0 [mlx5_core]
      ? mlx5e_reporter_tx_err_cqe+0x1a0/0x1a0 [mlx5_core]
      ? mlx5e_tx_reporter_timeout_dump+0x50/0x50 [mlx5_core]
      ? mlx5e_tx_reporter_dump_sq+0x260/0x260 [mlx5_core]
      ? newidle_balance+0x9b7/0xe30
      ? psi_group_change+0x6a7/0xb80
      ? mutex_lock+0x96/0xf0
      ? __mutex_lock_slowpath+0x10/0x10
      mlx5e_tx_timeout_work+0x17c/0x230 [mlx5_core]
      process_one_work+0x680/0x1050
      worker_thread+0x5a0/0xeb0
      ? process_one_work+0x1050/0x1050
      kthread+0x2a2/0x340
      ? kthread_complete_and_exit+0x20/0x20
      ret_from_fork+0x22/0x30
      </TASK>
    
    Freed by task 1:
      kasan_save_stack+0x23/0x50
      kasan_set_track+0x21/0x30
      kasan_save_free_info+0x2a/0x40
      ____kasan_slab_free+0x169/0x1d0
      slab_free_freelist_hook+0xd2/0x190
      __kmem_cache_free+0x1a1/0x2f0
      irq_pool_free+0x138/0x200 [mlx5_core]
      mlx5_irq_table_destroy+0xf6/0x170 [mlx5_core]
      mlx5_core_eq_free_irqs+0x74/0xf0 [mlx5_core]
      shutdown+0x194/0x1aa [mlx5_core]
      pci_device_shutdown+0x75/0x120
      device_shutdown+0x35c/0x620
      kernel_restart+0x60/0xa0
      __do_sys_reboot+0x1cb/0x2c0
      do_syscall_64+0x3b/0x90
      entry_SYSCALL_64_after_hwframe+0x4b/0xb5
    
    The buggy address belongs to the object at ffff88823fc0d300
      which belongs to the cache kmalloc-192 of size 192
    The buggy address is located 24 bytes inside of
      192-byte region [ffff88823fc0d300, ffff88823fc0d3c0)
    
    The buggy address belongs to the physical page:
    page:0000000010139587 refcount:1 mapcount:0 mapping:0000000000000000
    index:0x0 pfn:0x23fc0c
    head:0000000010139587 order:1 compound_mapcount:0 compound_pincount:0
    flags: 0x2ffff800010200(slab|head|node=0|zone=2|lastcpupid=0x1ffff)
    raw: 002ffff800010200 0000000000000000 dead000000000122 ffff88810004ca00
    raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
      ffff88823fc0d200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      ffff88823fc0d280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
     >ffff88823fc0d300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                 ^
      ffff88823fc0d380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
      ffff88823fc0d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================
    general protection fault, probably for non-canonical address
    0xdffffc005c40d7ac: 0000 [#1] PREEMPT SMP KASAN NOPTI
    KASAN: probably user-memory-access in range [0x00000002e206bd60-0x00000002e206bd67]
    CPU: 25 PID: 13608 Comm: kworker/u192:0 Tainted: G    B   W  O  6.1.21-cloudflare-kasan-2023.3.21 #1
    Hardware name: GIGABYTE R162-R2-GEN0/MZ12-HD2-CD, BIOS R14 05/03/2021
    Workqueue: mlx5e mlx5e_tx_timeout_work [mlx5_core]
    RIP: 0010:__alloc_pages+0x141/0x5c0
    Call Trace:
      <TASK>
      ? sysvec_apic_timer_interrupt+0xa0/0xc0
      ? asm_sysvec_apic_timer_interrupt+0x16/0x20
      ? __alloc_pages_slowpath.constprop.0+0x1ec0/0x1ec0
      ? _raw_spin_unlock_irqrestore+0x3d/0x80
      __kmalloc_large_node+0x80/0x120
      ? kvmalloc_node+0x4e/0x170
      __kmalloc_node+0xd4/0x150
      kvmalloc_node+0x4e/0x170
      mlx5e_open_channels+0x631/0x3a10 [mlx5_core]
      ? console_unlock+0x2fa/0x430
      ? _raw_spin_lock_irqsave+0x8d/0xf0
      ? _raw_spin_unlock_irqrestore+0x42/0x80
      ? preempt_count_add+0x7d/0x150
      ? __wake_up_klogd.part.0+0x7d/0xc0
      ? vprintk_emit+0xfe/0x2c0
      ? mlx5e_trigger_napi_sched+0x40/0x40 [mlx5_core]
      ? dev_attr_show.cold+0x35/0x35
      ? devlink_health_do_dump.part.0+0x174/0x340
      ? devlink_health_report+0x504/0x810
      ? mlx5e_reporter_tx_timeout+0x29d/0x3a0 [mlx5_core]
      ? mlx5e_tx_timeout_work+0x17c/0x230 [mlx5_core]
      ? process_one_work+0x680/0x1050
      mlx5e_safe_switch_params+0x156/0x220 [mlx5_core]
      ? mlx5e_switch_priv_channels+0x310/0x310 [mlx5_core]
      ? mlx5_eq_poll_irq_disabled+0xb6/0x100 [mlx5_core]
      mlx5e_tx_reporter_timeout_recover+0x123/0x240 [mlx5_core]
      ? __mutex_unlock_slowpath.constprop.0+0x2b0/0x2b0
      devlink_health_reporter_recover+0xa6/0x1f0
      devlink_health_report+0x2f7/0x810
      ? vsnprintf+0x854/0x15e0
      mlx5e_reporter_tx_timeout+0x29d/0x3a0 [mlx5_core]
      ? mlx5e_reporter_tx_err_cqe+0x1a0/0x1a0 [mlx5_core]
      ? mlx5e_tx_reporter_timeout_dump+0x50/0x50 [mlx5_core]
      ? mlx5e_tx_reporter_dump_sq+0x260/0x260 [mlx5_core]
      ? newidle_balance+0x9b7/0xe30
      ? psi_group_change+0x6a7/0xb80
      ? mutex_lock+0x96/0xf0
      ? __mutex_lock_slowpath+0x10/0x10
      mlx5e_tx_timeout_work+0x17c/0x230 [mlx5_core]
      process_one_work+0x680/0x1050
      worker_thread+0x5a0/0xeb0
      ? process_one_work+0x1050/0x1050
      kthread+0x2a2/0x340
      ? kthread_complete_and_exit+0x20/0x20
      ret_from_fork+0x22/0x30
      </TASK>
    ---[ end trace 0000000000000000  ]---
    RIP: 0010:__alloc_pages+0x141/0x5c0
    Code: e0 39 a3 96 89 e9 b8 22 01 32 01 83 e1 0f 48 89 fa 01 c9 48 c1 ea
    03 d3 f8 83 e0 03 89 44 24 6c 48 b8 00 00 00 00 00 fc ff df <80> 3c 02
    00 0f 85 fc 03 00 00 89 e8 4a 8b 14 f5 e0 39 a3 96 4c 89
    RSP: 0018:ffff888251f0f438 EFLAGS: 00010202
    RAX: dffffc0000000000 RBX: 1ffff1104a3e1e8b RCX: 0000000000000000
    RDX: 000000005c40d7ac RSI: 0000000000000003 RDI: 00000002e206bd60
    RBP: 0000000000052dc0 R08: ffff8882b0044218 R09: ffff8882b0045e8a
    R10: fffffbfff300fefc R11: ffff888167af4000 R12: 0000000000000003
    R13: 0000000000000000 R14: 00000000696c7070 R15: ffff8882373f4380
    FS:  0000000000000000(0000) GS:ffff88bf2be80000(0000)
    knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005641d031eee8 CR3: 0000002e7ca14000 CR4: 0000000000350ee0
    Kernel panic - not syncing: Fatal exception
    Kernel Offset: 0x11000000 from 0xffffffff81000000 (relocation range:
    0xffffffff80000000-0xffffffffbfffffff)
    ---[ end Kernel panic - not syncing: Fatal exception  ]---]
    
    Reported-by: Frederick Lawler <fred@cloudflare.com>
    Link: https://lore.kernel.org/netdev/be5b9271-7507-19c5-ded1-fa78f1980e69@cloudflare.com
    Signed-off-by: Shay Drory <shayd@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    [hardik: Refer to the irqn member of the mlx5_irq struct, instead of
     the msi_map, since we don't have upstream v6.4 commit 235a25fe28de
     ("net/mlx5: Modify struct mlx5_irq to use struct msi_map")].
    [hardik: Refer to the pf_pool member of the mlx5_irq_table struct,
     instead of pcif_pool, since we don't have upstream v6.4 commit
     8bebfd767909 ("net/mlx5: Improve naming of pci function vectors")].
    Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15c22cd1de50f9489f9f1fd9cd5ec6eaccedc918
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Nov 16 22:40:17 2022 +0100

    perf: Fix function pointer case
    
    commit 1af6239d1d3e61d33fd2f0ba53d3d1a67cc50574 upstream.
    
    With the advent of CFI it is no longer acceptible to cast function
    pointers.
    
    The robot complains thusly:
    
      kernel-events-core.c:warning:cast-from-int-(-)(struct-perf_cpu_pmu_context-)-to-remote_function_f-(aka-int-(-)(void-)-)-converts-to-incompatible-function-type
    
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c7920f992840779383cbff15a2e860515eec7644
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue Aug 1 08:42:37 2023 -0600

    io_uring: gate iowait schedule on having pending requests
    
    Commit 7b72d661f1f2f950ab8c12de7e2bc48bdac8ed69 upstream.
    
    A previous commit made all cqring waits marked as iowait, as a way to
    improve performance for short schedules with pending IO. However, for
    use cases that have a special reaper thread that does nothing but
    wait on events on the ring, this causes a cosmetic issue where we
    know have one core marked as being "busy" with 100% iowait.
    
    While this isn't a grave issue, it is confusing to users. Rather than
    always mark us as being in iowait, gate setting of current->in_iowait
    to 1 by whether or not the waiting task has pending requests.
    
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/io-uring/CAMEGJJ2RxopfNQ7GNLhr7X9=bHXKo+G5OOe0LUq=+UgLXsv1Xg@mail.gmail.com/
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217699
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217700
    Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name>
    Reported-by: Phil Elwell <phil@raspberrypi.com>
    Tested-by: Andres Freund <andres@anarazel.de>
    Fixes: 8a796565cec3 ("io_uring: Use io_schedule* in cqring wait")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>