commit 3a2fa3c01fc7c2183eb3278bd912e5bcec20eb2a
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Nov 4 00:00:35 2022 +0900

    Linux 6.0.7
    
    Link: https://lore.kernel.org/r/20221102022111.398283374@linuxfoundation.org
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Fenil Jain <fkjainco@gmail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Allen Pais <apais@linux.microsoft.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Tested-by: Rudi Heitbaum <rudi@heitbaum.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c5d628f1e1d049c33595693fab1b6e9baf25795
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Thu Oct 6 11:53:45 2022 -0700

    tcp/udp: Fix memory leak in ipv6_renew_options().
    
    commit 3c52c6bb831f6335c176a0fc7214e26f43adbd11 upstream.
    
    syzbot reported a memory leak [0] related to IPV6_ADDRFORM.
    
    The scenario is that while one thread is converting an IPv6 socket into
    IPv4 with IPV6_ADDRFORM, another thread calls do_ipv6_setsockopt() and
    allocates memory to inet6_sk(sk)->XXX after conversion.
    
    Then, the converted sk with (tcp|udp)_prot never frees the IPv6 resources,
    which inet6_destroy_sock() should have cleaned up.
    
    setsockopt(IPV6_ADDRFORM)                 setsockopt(IPV6_DSTOPTS)
    +-----------------------+                 +----------------------+
    - do_ipv6_setsockopt(sk, ...)
      - sockopt_lock_sock(sk)                 - do_ipv6_setsockopt(sk, ...)
        - lock_sock(sk)                         ^._ called via tcpv6_prot
      - WRITE_ONCE(sk->sk_prot, &tcp_prot)          before WRITE_ONCE()
      - xchg(&np->opt, NULL)
      - txopt_put(opt)
      - sockopt_release_sock(sk)
        - release_sock(sk)                      - sockopt_lock_sock(sk)
                                                  - lock_sock(sk)
                                                - ipv6_set_opt_hdr(sk, ...)
                                                  - ipv6_update_options(sk, opt)
                                                    - xchg(&inet6_sk(sk)->opt, opt)
                                                      ^._ opt is never freed.
    
                                                - sockopt_release_sock(sk)
                                                  - release_sock(sk)
    
    Since IPV6_DSTOPTS allocates options under lock_sock(), we can avoid this
    memory leak by testing whether sk_family is changed by IPV6_ADDRFORM after
    acquiring the lock.
    
    This issue exists from the initial commit between IPV6_ADDRFORM and
    IPV6_PKTOPTIONS.
    
    [0]:
    BUG: memory leak
    unreferenced object 0xffff888009ab9f80 (size 96):
      comm "syz-executor583", pid 328, jiffies 4294916198 (age 13.034s)
      hex dump (first 32 bytes):
        01 00 00 00 48 00 00 00 08 00 00 00 00 00 00 00  ....H...........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<000000002ee98ae1>] kmalloc include/linux/slab.h:605 [inline]
        [<000000002ee98ae1>] sock_kmalloc+0xb3/0x100 net/core/sock.c:2566
        [<0000000065d7b698>] ipv6_renew_options+0x21e/0x10b0 net/ipv6/exthdrs.c:1318
        [<00000000a8c756d7>] ipv6_set_opt_hdr net/ipv6/ipv6_sockglue.c:354 [inline]
        [<00000000a8c756d7>] do_ipv6_setsockopt.constprop.0+0x28b7/0x4350 net/ipv6/ipv6_sockglue.c:668
        [<000000002854d204>] ipv6_setsockopt+0xdf/0x190 net/ipv6/ipv6_sockglue.c:1021
        [<00000000e69fdcf8>] tcp_setsockopt+0x13b/0x2620 net/ipv4/tcp.c:3789
        [<0000000090da4b9b>] __sys_setsockopt+0x239/0x620 net/socket.c:2252
        [<00000000b10d192f>] __do_sys_setsockopt net/socket.c:2263 [inline]
        [<00000000b10d192f>] __se_sys_setsockopt net/socket.c:2260 [inline]
        [<00000000b10d192f>] __x64_sys_setsockopt+0xbe/0x160 net/socket.c:2260
        [<000000000a80d7aa>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        [<000000000a80d7aa>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
        [<000000004562b5c6>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5b962b004afa3c11e651c07232f2402b4678007b
Author: D Scott Phillips <scott@os.amperecomputing.com>
Date:   Mon Oct 10 19:21:40 2022 -0700

    arm64: Add AMPERE1 to the Spectre-BHB affected list
    
    [ Upstream commit 0e5d5ae837c8ce04d2ddb874ec5f920118bd9d31 ]
    
    Per AmpereOne erratum AC03_CPU_12, "Branch history may allow control of
    speculative execution across software contexts," the AMPERE1 core needs the
    bhb clearing loop to mitigate Spectre-BHB, with a loop iteration count of
    11.
    
    Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
    Link: https://lore.kernel.org/r/20221011022140.432370-1-scott@os.amperecomputing.com
    Reviewed-by: James Morse <james.morse@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 05f1740fd3357f17501938e7c68a7053df8fea08
Author: Conor Dooley <conor.dooley@microchip.com>
Date:   Thu Oct 6 18:35:21 2022 +0100

    riscv: fix detection of toolchain Zihintpause support
    
    [ Upstream commit aae538cd03bc8fc35979653d9180922d146da0ca ]
    
    It is not sufficient to check if a toolchain supports a particular
    extension without checking if the linker supports that extension
    too. For example, Clang 15 supports Zihintpause but GNU bintutils
    2.35.2 does not, leading build errors like so:
    
    riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zihintpause2p0: Invalid or unknown z ISA extension: 'zihintpause'
    
    Add a TOOLCHAIN_HAS_ZIHINTPAUSE which checks if each of the compiler,
    assembler and linker support the extension. Replace the ifdef in the
    vdso with one depending on this new symbol.
    
    Fixes: 8eb060e10185 ("arch/riscv: add Zihintpause support")
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Heiko Stuebner <heiko@sntech.de>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20221006173520.1785507-3-conor@kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6071dfefcc449db9b44bb5fa59bdc7e816ffcb20
Author: Conor Dooley <conor.dooley@microchip.com>
Date:   Thu Oct 6 18:35:20 2022 +0100

    riscv: fix detection of toolchain Zicbom support
    
    [ Upstream commit b8c86872d1dc171d8f1c137917d6913cae2fa4f2 ]
    
    It is not sufficient to check if a toolchain supports a particular
    extension without checking if the linker supports that extension too.
    For example, Clang 15 supports Zicbom but GNU bintutils 2.35.2 does
    not, leading build errors like so:
    
    riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicbom1p0_zihintpause2p0: Invalid or unknown z ISA extension: 'zicbom'
    
    Convert CC_HAS_ZICBOM to TOOLCHAIN_HAS_ZICBOM & check if the linker
    also supports Zicbom.
    
    Reported-by: Kevin Hilman <khilman@baylibre.com>
    Link: https://github.com/ClangBuiltLinux/linux/issues/1714
    Link: https://storage.kernelci.org/next/master/next-20220920/riscv/defconfig+CONFIG_EFI=n/clang-16/logs/kernel.log
    Fixes: 1631ba1259d6 ("riscv: Add support for non-coherent devices using zicbom extension")
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Heiko Stuebner <heiko@sntech.de>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20221006173520.1785507-2-conor@kernel.org
    [Palmer: Check for ld-2.38, not 2.39, as 2.38 no longer errors.]
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ff0f6becf3a6f817838b6f80a2c9cca43dce0576
Author: Qinglin Pan <panqinglin2020@iscas.ac.cn>
Date:   Sun Oct 9 16:30:50 2022 +0800

    riscv: mm: add missing memcpy in kasan_init
    
    [ Upstream commit 9f2ac64d6ca60db99132e08628ac2899f956a0ec ]
    
    Hi Atish,
    
    It seems that the panic is due to the missing memcpy during kasan_init.
    Could you please check whether this patch is helpful?
    
    When doing kasan_populate, the new allocated base_pud/base_p4d should
    contain kasan_early_shadow_{pud, p4d}'s content. Add the missing memcpy
    to avoid page fault when read/write kasan shadow region.
    
    Tested on:
     - qemu with sv57 and CONFIG_KASAN on.
     - qemu with sv48 and CONFIG_KASAN on.
    
    Signed-off-by: Qinglin Pan <panqinglin2020@iscas.ac.cn>
    Tested-by: Atish Patra <atishp@rivosinc.com>
    Fixes: 8fbdccd2b173 ("riscv: mm: Support kasan for sv57")
    Link: https://lore.kernel.org/r/20221009083050.3814850-1-panqinglin2020@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4f24447911521dfa60733538e9d059335986f795
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Thu Oct 27 21:29:25 2022 +0300

    net: enetc: survive memory pressure without crashing
    
    [ Upstream commit 84ce1ca3fe9e1249bf21176ff162200f1c4e5ed1 ]
    
    Under memory pressure, enetc_refill_rx_ring() may fail, and when called
    during the enetc_open() -> enetc_setup_rxbdr() procedure, this is not
    checked for.
    
    An extreme case of memory pressure will result in exactly zero buffers
    being allocated for the RX ring, and in such a case it is expected that
    hardware drops all RX packets due to lack of buffers.
    
    This does not happen, because the reset-default value of the consumer
    and produces index is 0, and this makes the ENETC think that all buffers
    have been initialized and that it owns them (when in reality none were).
    
    The hardware guide explains this best:
    
    | Configure the receive ring producer index register RBaPIR with a value
    | of 0. The producer index is initially configured by software but owned
    | by hardware after the ring has been enabled. Hardware increments the
    | index when a frame is received which may consume one or more BDs.
    | Hardware is not allowed to increment the producer index to match the
    | consumer index since it is used to indicate an empty condition. The ring
    | can hold at most RBLENR[LENGTH]-1 received BDs.
    |
    | Configure the receive ring consumer index register RBaCIR. The
    | consumer index is owned by software and updated during operation of the
    | of the BD ring by software, to indicate that any receive data occupied
    | in the BD has been processed and it has been prepared for new data.
    | - If consumer index and producer index are initialized to the same
    |   value, it indicates that all BDs in the ring have been prepared and
    |   hardware owns all of the entries.
    | - If consumer index is initialized to producer index plus N, it would
    |   indicate N BDs have been prepared. Note that hardware cannot start if
    |   only a single buffer is prepared due to the restrictions described in
    |   (2).
    | - Software may write consumer index to match producer index anytime
    |   while the ring is operational to indicate all received BDs prior have
    |   been processed and new BDs prepared for hardware.
    
    Normally, the value of rx_ring->rcir (consumer index) is brought in sync
    with the rx_ring->next_to_use software index, but this only happens if
    page allocation ever succeeded.
    
    When PI==CI==0, the hardware appears to receive frames and write them to
    DMA address 0x0 (?!), then set the READY bit in the BD.
    
    The enetc_clean_rx_ring() function (and its XDP derivative) is naturally
    not prepared to handle such a condition. It will attempt to process
    those frames using the rx_swbd structure associated with index i of the
    RX ring, but that structure is not fully initialized (enetc_new_page()
    does all of that). So what happens next is undefined behavior.
    
    To operate using no buffer, we must initialize the CI to PI + 1, which
    will block the hardware from advancing the CI any further, and drop
    everything.
    
    The issue was seen while adding support for zero-copy AF_XDP sockets,
    where buffer memory comes from user space, which can even decide to
    supply no buffers at all (example: "xdpsock --txonly"). However, the bug
    is present also with the network stack code, even though it would take a
    very determined person to trigger a page allocation failure at the
    perfect time (a series of ifup/ifdown under memory pressure should
    eventually reproduce it given enough retries).
    
    Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
    Link: https://lore.kernel.org/r/20221027182925.3256653-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1a757c63fccfd80bde490fb87e75460bd9707c38
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Oct 27 04:06:37 2022 +0000

    kcm: do not sense pfmemalloc status in kcm_sendpage()
    
    [ Upstream commit ee15e1f38dc201fa7d63c13aa258b728dce27f4d ]
    
    Similar to changes done in TCP in blamed commit.
    We should not sense pfmemalloc status in sendpage() methods.
    
    Fixes: 326140063946 ("tcp: TX zerocopy should not sense pfmemalloc status")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20221027040637.1107703-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 847a2859814b31392340a2b16604b25afaa92dcc
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Oct 27 04:03:46 2022 +0000

    net: do not sense pfmemalloc status in skb_append_pagefrags()
    
    [ Upstream commit 228ebc41dfab5b5d34cd76835ddb0ca8ee12f513 ]
    
    skb_append_pagefrags() is used by af_unix and udp sendpage()
    implementation so far.
    
    In commit 326140063946 ("tcp: TX zerocopy should not sense
    pfmemalloc status") we explained why we should not sense
    pfmemalloc status for pages owned by user space.
    
    We should also use skb_fill_page_desc_noacc()
    in skb_append_pagefrags() to avoid following KCSAN report:
    
    BUG: KCSAN: data-race in lru_add_fn / skb_append_pagefrags
    
    write to 0xffffea00058fc1c8 of 8 bytes by task 17319 on cpu 0:
    __list_add include/linux/list.h:73 [inline]
    list_add include/linux/list.h:88 [inline]
    lruvec_add_folio include/linux/mm_inline.h:323 [inline]
    lru_add_fn+0x327/0x410 mm/swap.c:228
    folio_batch_move_lru+0x1e1/0x2a0 mm/swap.c:246
    lru_add_drain_cpu+0x73/0x250 mm/swap.c:669
    lru_add_drain+0x21/0x60 mm/swap.c:773
    free_pages_and_swap_cache+0x16/0x70 mm/swap_state.c:311
    tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
    tlb_flush_mmu_free mm/mmu_gather.c:256 [inline]
    tlb_flush_mmu+0x5b2/0x640 mm/mmu_gather.c:263
    tlb_finish_mmu+0x86/0x100 mm/mmu_gather.c:363
    exit_mmap+0x190/0x4d0 mm/mmap.c:3098
    __mmput+0x27/0x1b0 kernel/fork.c:1185
    mmput+0x3d/0x50 kernel/fork.c:1207
    copy_process+0x19fc/0x2100 kernel/fork.c:2518
    kernel_clone+0x166/0x550 kernel/fork.c:2671
    __do_sys_clone kernel/fork.c:2812 [inline]
    __se_sys_clone kernel/fork.c:2796 [inline]
    __x64_sys_clone+0xc3/0xf0 kernel/fork.c:2796
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    read to 0xffffea00058fc1c8 of 8 bytes by task 17325 on cpu 1:
    page_is_pfmemalloc include/linux/mm.h:1817 [inline]
    __skb_fill_page_desc include/linux/skbuff.h:2432 [inline]
    skb_fill_page_desc include/linux/skbuff.h:2453 [inline]
    skb_append_pagefrags+0x210/0x600 net/core/skbuff.c:3974
    unix_stream_sendpage+0x45e/0x990 net/unix/af_unix.c:2338
    kernel_sendpage+0x184/0x300 net/socket.c:3561
    sock_sendpage+0x5a/0x70 net/socket.c:1054
    pipe_to_sendpage+0x128/0x160 fs/splice.c:361
    splice_from_pipe_feed fs/splice.c:415 [inline]
    __splice_from_pipe+0x222/0x4d0 fs/splice.c:559
    splice_from_pipe fs/splice.c:594 [inline]
    generic_splice_sendpage+0x89/0xc0 fs/splice.c:743
    do_splice_from fs/splice.c:764 [inline]
    direct_splice_actor+0x80/0xa0 fs/splice.c:931
    splice_direct_to_actor+0x305/0x620 fs/splice.c:886
    do_splice_direct+0xfb/0x180 fs/splice.c:974
    do_sendfile+0x3bf/0x910 fs/read_write.c:1255
    __do_sys_sendfile64 fs/read_write.c:1323 [inline]
    __se_sys_sendfile64 fs/read_write.c:1309 [inline]
    __x64_sys_sendfile64+0x10c/0x150 fs/read_write.c:1309
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    value changed: 0x0000000000000000 -> 0xffffea00058fc188
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 PID: 17325 Comm: syz-executor.0 Not tainted 6.1.0-rc1-syzkaller-00158-g440b7895c990-dirty #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
    
    Fixes: 326140063946 ("tcp: TX zerocopy should not sense pfmemalloc status")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20221027040346.1104204-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8a088b73f16eb7aff3bf5e697fb5921dc28bc326
Author: Suresh Devarakonda <ramad@nvidia.com>
Date:   Wed Oct 26 14:51:49 2022 +0100

    net/mlx5: Fix crash during sync firmware reset
    
    [ Upstream commit aefb62a9988749703435e941704624949a80a2a9 ]
    
    When setting Bluefield to DPU NIC mode using mlxconfig tool +  sync
    firmware reset flow, we run into scenario where the host was not
    eswitch manager at the time of mlx5 driver load but becomes eswitch manager
    after the sync firmware reset flow. This results in null pointer
    access of mpfs structure during mac filter add. This change prevents null
    pointer access but mpfs table entries will not be added.
    
    Fixes: 5ec697446f46 ("net/mlx5: Add support for devlink reload action fw activate")
    Signed-off-by: Suresh Devarakonda <ramad@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Reviewed-by: Bodong Wang <bodong@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-12-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8ce33602a95c0256a82d06bd421f1365e903234f
Author: Roy Novich <royno@nvidia.com>
Date:   Wed Oct 26 14:51:48 2022 +0100

    net/mlx5: Update fw fatal reporter state on PCI handlers successful recover
    
    [ Upstream commit 416ef713631937cf5452476a7f1041a3ae7b06c6 ]
    
    Update devlink health fw fatal reporter state to "healthy" is needed by
    strictly calling devlink_health_reporter_state_update() after recovery
    was done by PCI error handler. This is needed when fw_fatal reporter was
    triggered due to PCI error. Poll health is called and set reporter state
    to error. Health recovery failed (since EEH didn't re-enable the PCI).
    PCI handlers keep on recover flow and succeed later without devlink
    acknowledgment. Fix this by adding devlink state update at the end of
    the PCI handler recovery process.
    
    Fixes: 6181e5cb752e ("devlink: add support for reporter recovery completion")
    Signed-off-by: Roy Novich <royno@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Reviewed-by: Aya Levin <ayal@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-11-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 82ba1cabd5f8295503d2117599bef3139f9299ca
Author: Ariel Levkovich <lariel@nvidia.com>
Date:   Wed Oct 26 14:51:46 2022 +0100

    net/mlx5e: TC, Reject forwarding from internal port to internal port
    
    [ Upstream commit f382a2413dae8c855226a72600812a4b37432c48 ]
    
    Reject TC rules that forward from internal port to internal port
    as it is not supported.
    
    This include rules that are explicitly have internal port as
    the filter device as well as rules that apply on tunnel interfaces
    as the route device for the tunnel interface can be an internal
    port.
    
    Fixes: 27484f7170ed ("net/mlx5e: Offload tc rules that redirect to ovs internal port")
    Signed-off-by: Ariel Levkovich <lariel@nvidia.com>
    Reviewed-by: Maor Dickman <maord@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-9-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e
Author: Tariq Toukan <tariqt@nvidia.com>
Date:   Wed Oct 26 14:51:45 2022 +0100

    net/mlx5: Fix possible use-after-free in async command interface
    
    [ Upstream commit bacd22df95147ed673bec4692ab2d4d585935241 ]
    
    mlx5_cmd_cleanup_async_ctx should return only after all its callback
    handlers were completed. Before this patch, the below race between
    mlx5_cmd_cleanup_async_ctx and mlx5_cmd_exec_cb_handler was possible and
    lead to a use-after-free:
    
    1. mlx5_cmd_cleanup_async_ctx is called while num_inflight is 2 (i.e.
       elevated by 1, a single inflight callback).
    2. mlx5_cmd_cleanup_async_ctx decreases num_inflight to 1.
    3. mlx5_cmd_exec_cb_handler is called, decreases num_inflight to 0 and
       is about to call wake_up().
    4. mlx5_cmd_cleanup_async_ctx calls wait_event, which returns
       immediately as the condition (num_inflight == 0) holds.
    5. mlx5_cmd_cleanup_async_ctx returns.
    6. The caller of mlx5_cmd_cleanup_async_ctx frees the mlx5_async_ctx
       object.
    7. mlx5_cmd_exec_cb_handler goes on and calls wake_up() on the freed
       object.
    
    Fix it by syncing using a completion object. Mark it completed when
    num_inflight reaches 0.
    
    Trace:
    
    BUG: KASAN: use-after-free in do_raw_spin_lock+0x23d/0x270
    Read of size 4 at addr ffff888139cd12f4 by task swapper/5/0
    
    CPU: 5 PID: 0 Comm: swapper/5 Not tainted 6.0.0-rc3_for_upstream_debug_2022_08_30_13_10 #1
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    Call Trace:
     <IRQ>
     dump_stack_lvl+0x57/0x7d
     print_report.cold+0x2d5/0x684
     ? do_raw_spin_lock+0x23d/0x270
     kasan_report+0xb1/0x1a0
     ? do_raw_spin_lock+0x23d/0x270
     do_raw_spin_lock+0x23d/0x270
     ? rwlock_bug.part.0+0x90/0x90
     ? __delete_object+0xb8/0x100
     ? lock_downgrade+0x6e0/0x6e0
     _raw_spin_lock_irqsave+0x43/0x60
     ? __wake_up_common_lock+0xb9/0x140
     __wake_up_common_lock+0xb9/0x140
     ? __wake_up_common+0x650/0x650
     ? destroy_tis_callback+0x53/0x70 [mlx5_core]
     ? kasan_set_track+0x21/0x30
     ? destroy_tis_callback+0x53/0x70 [mlx5_core]
     ? kfree+0x1ba/0x520
     ? do_raw_spin_unlock+0x54/0x220
     mlx5_cmd_exec_cb_handler+0x136/0x1a0 [mlx5_core]
     ? mlx5_cmd_cleanup_async_ctx+0x220/0x220 [mlx5_core]
     ? mlx5_cmd_cleanup_async_ctx+0x220/0x220 [mlx5_core]
     mlx5_cmd_comp_handler+0x65a/0x12b0 [mlx5_core]
     ? dump_command+0xcc0/0xcc0 [mlx5_core]
     ? lockdep_hardirqs_on_prepare+0x400/0x400
     ? cmd_comp_notifier+0x7e/0xb0 [mlx5_core]
     cmd_comp_notifier+0x7e/0xb0 [mlx5_core]
     atomic_notifier_call_chain+0xd7/0x1d0
     mlx5_eq_async_int+0x3ce/0xa20 [mlx5_core]
     atomic_notifier_call_chain+0xd7/0x1d0
     ? irq_release+0x140/0x140 [mlx5_core]
     irq_int_handler+0x19/0x30 [mlx5_core]
     __handle_irq_event_percpu+0x1f2/0x620
     handle_irq_event+0xb2/0x1d0
     handle_edge_irq+0x21e/0xb00
     __common_interrupt+0x79/0x1a0
     common_interrupt+0x78/0xa0
     </IRQ>
     <TASK>
     asm_common_interrupt+0x22/0x40
    RIP: 0010:default_idle+0x42/0x60
    Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 0f b6 14 11 38 d0 7c 04 84 d2 75 14 8b 05 eb 47 22 02 85 c0 7e 07 0f 00 2d e0 9f 48 00 fb f4 <c3> 48 c7 c7 80 08 7f 85 e8 d1 d3 3e fe eb de 66 66 2e 0f 1f 84 00
    RSP: 0018:ffff888100dbfdf0 EFLAGS: 00000242
    RAX: 0000000000000001 RBX: ffffffff84ecbd48 RCX: 1ffffffff0afe110
    RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffff835cc9bc
    RBP: 0000000000000005 R08: 0000000000000001 R09: ffff88881dec4ac3
    R10: ffffed1103bd8958 R11: 0000017d0ca571c9 R12: 0000000000000005
    R13: ffffffff84f024e0 R14: 0000000000000000 R15: dffffc0000000000
     ? default_idle_call+0xcc/0x450
     default_idle_call+0xec/0x450
     do_idle+0x394/0x450
     ? arch_cpu_idle_exit+0x40/0x40
     ? do_idle+0x17/0x450
     cpu_startup_entry+0x19/0x20
     start_secondary+0x221/0x2b0
     ? set_cpu_sibling_map+0x2070/0x2070
     secondary_startup_64_no_verify+0xcd/0xdb
     </TASK>
    
    Allocated by task 49502:
     kasan_save_stack+0x1e/0x40
     __kasan_kmalloc+0x81/0xa0
     kvmalloc_node+0x48/0xe0
     mlx5e_bulk_async_init+0x35/0x110 [mlx5_core]
     mlx5e_tls_priv_tx_list_cleanup+0x84/0x3e0 [mlx5_core]
     mlx5e_ktls_cleanup_tx+0x38f/0x760 [mlx5_core]
     mlx5e_cleanup_nic_tx+0xa7/0x100 [mlx5_core]
     mlx5e_detach_netdev+0x1ca/0x2b0 [mlx5_core]
     mlx5e_suspend+0xdb/0x140 [mlx5_core]
     mlx5e_remove+0x89/0x190 [mlx5_core]
     auxiliary_bus_remove+0x52/0x70
     device_release_driver_internal+0x40f/0x650
     driver_detach+0xc1/0x180
     bus_remove_driver+0x125/0x2f0
     auxiliary_driver_unregister+0x16/0x50
     mlx5e_cleanup+0x26/0x30 [mlx5_core]
     cleanup+0xc/0x4e [mlx5_core]
     __x64_sys_delete_module+0x2b5/0x450
     do_syscall_64+0x3d/0x90
     entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    Freed by task 49502:
     kasan_save_stack+0x1e/0x40
     kasan_set_track+0x21/0x30
     kasan_set_free_info+0x20/0x30
     ____kasan_slab_free+0x11d/0x1b0
     kfree+0x1ba/0x520
     mlx5e_tls_priv_tx_list_cleanup+0x2e7/0x3e0 [mlx5_core]
     mlx5e_ktls_cleanup_tx+0x38f/0x760 [mlx5_core]
     mlx5e_cleanup_nic_tx+0xa7/0x100 [mlx5_core]
     mlx5e_detach_netdev+0x1ca/0x2b0 [mlx5_core]
     mlx5e_suspend+0xdb/0x140 [mlx5_core]
     mlx5e_remove+0x89/0x190 [mlx5_core]
     auxiliary_bus_remove+0x52/0x70
     device_release_driver_internal+0x40f/0x650
     driver_detach+0xc1/0x180
     bus_remove_driver+0x125/0x2f0
     auxiliary_driver_unregister+0x16/0x50
     mlx5e_cleanup+0x26/0x30 [mlx5_core]
     cleanup+0xc/0x4e [mlx5_core]
     __x64_sys_delete_module+0x2b5/0x450
     do_syscall_64+0x3d/0x90
     entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    Fixes: e355477ed9e4 ("net/mlx5: Make mlx5_cmd_exec_cb() a safe API")
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-8-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de677d82480c4ff1b4d41f5df8d7d751eaad8153
Author: Saeed Mahameed <saeedm@nvidia.com>
Date:   Wed Oct 26 14:51:44 2022 +0100

    net/mlx5: ASO, Create the ASO SQ with the correct timestamp format
    
    [ Upstream commit 0f3caaa2c6fbf9f892bd235c9dce9eb551f8d815 ]
    
    mlx5 SQs must select the timestamp format explicitly according to the
    active clock mode, select the current active timestamp mode so ASO SQ create
    will succeed.
    
    This fixes the following error prints when trying to create ipsec ASO SQ
    while the timestamp format is real time mode.
    
    mlx5_cmd_out_err:778:(pid 34874): CREATE_SQ(0x904) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0xd61c0b), err(-22)
    mlx5_aso_create_sq:285:(pid 34874): Failed to open aso wq sq, err=-22
    mlx5e_ipsec_init:436:(pid 34874): IPSec initialization failed, -22
    
    Fixes: cdd04f4d4d71 ("net/mlx5: Add support to create SQ and CQ for ASO")
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Reported-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-7-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 264e5a4c24833b0842ee802a764149db48f7afb2
Author: Paul Blakey <paulb@nvidia.com>
Date:   Wed Oct 26 14:51:43 2022 +0100

    net/mlx5e: Update restore chain id for slow path packets
    
    [ Upstream commit 8dc47c0527c1586e3ebe0efd323f1d8abb181c77 ]
    
    Currently encap slow path rules just forward to software without
    setting the chain id miss register, so driver doesn't restore
    the chain, and packets hitting this rule will restart from tc chain
    0 instead of continuing to the chain the encap rule was on.
    
    Fix this by setting the chain id miss register to the chain id mapping.
    
    Fixes: 8f1e0b97cc70 ("net/mlx5: E-Switch, Mark miss packets with new chain id mapping")
    Signed-off-by: Paul Blakey <paulb@nvidia.com>
    Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-6-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 75fea00366a451f71a8b6323fc6b3f4945558e45
Author: Aya Levin <ayal@nvidia.com>
Date:   Wed Oct 26 14:51:42 2022 +0100

    net/mlx5e: Extend SKB room check to include PTP-SQ
    
    [ Upstream commit 19b43a432e3e47db656a8269a74b50aef826950c ]
    
    When tx_port_ts is set, the driver diverts all UPD traffic over PTP port
    to a dedicated PTP-SQ. The SKBs are cached until the wire-CQE arrives.
    When the packet size is greater then MTU, the firmware might drop it and
    the packet won't be transmitted to the wire, hence the wire-CQE won't
    reach the driver. In this case the SKBs are accumulated in the SKB fifo.
    Add room check to consider the PTP-SQ SKB fifo, when the SKB fifo is
    full, driver stops the queue resulting in a TX timeout. Devlink
    TX-reporter can recover from it.
    
    Fixes: 1880bc4e4a96 ("net/mlx5e: Add TX port timestamp support")
    Signed-off-by: Aya Levin <ayal@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-5-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit afefb43dfb1aec055e7f102da9c1cfb946905981
Author: Rongwei Liu <rongweil@nvidia.com>
Date:   Wed Oct 26 14:51:41 2022 +0100

    net/mlx5: DR, Fix matcher disconnect error flow
    
    [ Upstream commit 4ea9891d66410da5030dababb4b825d8e41cd7bb ]
    
    When 2nd flow rules arrives, it will merge together with the
    1st one if matcher criteria is the same.
    
    If merge fails, driver will rollback the merge contents, and
    reject the 2nd rule. At rollback stage, matcher can't be
    disconnected unconditionally, otherise the 1st rule can't be
    hit anymore.
    
    Add logic to check if the matcher should be disconnected or not.
    
    Fixes: cc2295cd54e4 ("net/mlx5: DR, Improve steering for empty or RX/TX-only matchers")
    Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-4-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a23a0aacbba726ab68ed08c8ae5f947e7ddf7776
Author: Moshe Shemesh <moshe@nvidia.com>
Date:   Wed Oct 26 14:51:40 2022 +0100

    net/mlx5: Wait for firmware to enable CRS before pci_restore_state
    
    [ Upstream commit 212b4d7251c169f87fa734e79bdec8dd413be5cf ]
    
    After firmware reset driver should verify firmware already enabled CRS
    and became responsive to pci config cycles before restoring pci state.
    Fix that by waiting till device_id is readable through PCI again.
    
    Fixes: eabe8e5e88f5 ("net/mlx5: Handle sync reset now event")
    Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-3-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 19b199efd61218741f3d32b69746fe3ffb3942e8
Author: Hyong Youb Kim <hyonkim@cisco.com>
Date:   Wed Oct 26 14:51:39 2022 +0100

    net/mlx5e: Do not increment ESN when updating IPsec ESN state
    
    [ Upstream commit 888be6b279b7257b5f6e4c9527675bff0a335596 ]
    
    An offloaded SA stops receiving after about 2^32 + replay_window
    packets. For example, when SA reaches <seq-hi 0x1, seq 0x2c>, all
    subsequent packets get dropped with SA-icv-failure (integrity_failed).
    
    To reproduce the bug:
    - ConnectX-6 Dx with crypto enabled (FW 22.30.1004)
    - ipsec.conf:
      nic-offload = yes
      replay-window = 32
      esn = yes
      salifetime=24h
    - Run netperf for a long time to send more than 2^32 packets
      netperf -H <device-under-test> -t TCP_STREAM -l 20000
    
    When 2^32 + replay_window packets are received, the replay window
    moves from the 2nd half of subspace (overlap=1) to the 1st half
    (overlap=0). The driver then updates the 'esn' value in NIC
    (i.e. seq_hi) as follows.
    
     seq_hi = xfrm_replay_seqhi(seq_bottom)
     new esn in NIC = seq_hi + 1
    
    The +1 increment is wrong, as seq_hi already contains the correct
    seq_hi. For example, when seq_hi=1, the driver actually tells NIC to
    use seq_hi=2 (esn). This incorrect esn value causes all subsequent
    packets to fail integrity checks (SA-icv-failure). So, do not
    increment.
    
    Fixes: cb01008390bb ("net/mlx5: IPSec, Add support for ESN")
    Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
    Acked-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20221026135153.154807-2-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5f946eb3ae4e9a580372ac3762b9778ed487c8ca
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 26 09:46:42 2022 +0800

    netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir failed
    
    [ Upstream commit a6aa8d0ce2cfba57ac0f23293fcb3be0b9f53fba ]
    
    Remove dir in nsim_dev_debugfs_init() when creating ports dir failed.
    Otherwise, the netdevsim device will not be created next time. Kernel
    reports an error: debugfs: Directory 'netdevsim1' with parent 'netdevsim'
    already present!
    
    Fixes: ab1d0cc004d7 ("netdevsim: change debugfs tree topology")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7c4957fe40e2a628b7cceaf4c9bfb5b701774d05
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 26 09:46:41 2022 +0800

    netdevsim: fix memory leak in nsim_drv_probe() when nsim_dev_resources_register() failed
    
    [ Upstream commit 6b1da9f7126f05e857da6db24c6a04aa7974d644 ]
    
    If some items in nsim_dev_resources_register() fail, memory leak will
    occur. The following is the memory leak information.
    
    unreferenced object 0xffff888074c02600 (size 128):
      comm "echo", pid 8159, jiffies 4294945184 (age 493.530s)
      hex dump (first 32 bytes):
        40 47 ea 89 ff ff ff ff 01 00 00 00 00 00 00 00  @G..............
        ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
      backtrace:
        [<0000000011a31c98>] kmalloc_trace+0x22/0x60
        [<0000000027384c69>] devl_resource_register+0x144/0x4e0
        [<00000000a16db248>] nsim_drv_probe+0x37a/0x1260
        [<000000007d1f448c>] really_probe+0x20b/0xb10
        [<00000000c416848a>] __driver_probe_device+0x1b3/0x4a0
        [<00000000077e0351>] driver_probe_device+0x49/0x140
        [<0000000054f2465a>] __device_attach_driver+0x18c/0x2a0
        [<000000008538f359>] bus_for_each_drv+0x151/0x1d0
        [<0000000038e09747>] __device_attach+0x1c9/0x4e0
        [<00000000dd86e533>] bus_probe_device+0x1d5/0x280
        [<00000000839bea35>] device_add+0xae0/0x1cb0
        [<000000009c2abf46>] new_device_store+0x3b6/0x5f0
        [<00000000fb823d7f>] bus_attr_store+0x72/0xa0
        [<000000007acc4295>] sysfs_kf_write+0x106/0x160
        [<000000005f50cb4d>] kernfs_fop_write_iter+0x3a8/0x5a0
        [<0000000075eb41bf>] vfs_write+0x8f0/0xc80
    
    Fixes: 37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77579e4065295071fbd9662f03430dca5b50b086
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 26 09:54:05 2022 +0800

    netdevsim: fix memory leak in nsim_bus_dev_new()
    
    [ Upstream commit cf2010aa1c739bab067cbc90b690d28eaa0b47da ]
    
    If device_register() failed in nsim_bus_dev_new(), the value of reference
    in nsim_bus_dev->dev is 1. obj->name in nsim_bus_dev->dev will not be
    released.
    
    unreferenced object 0xffff88810352c480 (size 16):
      comm "echo", pid 5691, jiffies 4294945921 (age 133.270s)
      hex dump (first 16 bytes):
        6e 65 74 64 65 76 73 69 6d 31 00 00 00 00 00 00  netdevsim1......
      backtrace:
        [<000000005e2e5e26>] __kmalloc_node_track_caller+0x3a/0xb0
        [<0000000094ca4fc8>] kvasprintf+0xc3/0x160
        [<00000000aad09bcc>] kvasprintf_const+0x55/0x180
        [<000000009bac868d>] kobject_set_name_vargs+0x56/0x150
        [<000000007c1a5d70>] dev_set_name+0xbb/0xf0
        [<00000000ad0d126b>] device_add+0x1f8/0x1cb0
        [<00000000c222ae24>] new_device_store+0x3b6/0x5e0
        [<0000000043593421>] bus_attr_store+0x72/0xa0
        [<00000000cbb1833a>] sysfs_kf_write+0x106/0x160
        [<00000000d0dedb8a>] kernfs_fop_write_iter+0x3a8/0x5a0
        [<00000000770b66e2>] vfs_write+0x8f0/0xc80
        [<0000000078bb39be>] ksys_write+0x106/0x210
        [<00000000005e55a4>] do_syscall_64+0x35/0x80
        [<00000000eaa40bbc>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    Fixes: 40e4fe4ce115 ("netdevsim: move device registration and related code to bus.c")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Link: https://lore.kernel.org/r/20221026015405.128795-1-shaozhengchao@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2adedc80faec243ede55355e57142110d6f46e08
Author: Rafał Miłecki <rafal@milecki.pl>
Date:   Thu Oct 27 13:24:30 2022 +0200

    net: broadcom: bcm4908_enet: update TX stats after actual transmission
    
    [ Upstream commit ef3556ee16c68735ec69bd08df41d1cd83b14ad3 ]
    
    Queueing packets doesn't guarantee their transmission. Update TX stats
    after hardware confirms consuming submitted data.
    
    This also fixes a possible race and NULL dereference.
    bcm4908_enet_start_xmit() could try to access skb after freeing it in
    the bcm4908_enet_poll_tx().
    
    Reported-by: Florian Fainelli <f.fainelli@gmail.com>
    Fixes: 4feffeadbcb2e ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
    Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Link: https://lore.kernel.org/r/20221027112430.8696-1-zajec5@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c26249b15a254e9ada5a495b902f1ef1ddad4204
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date:   Thu Oct 20 12:09:52 2022 +0200

    nh: fix scope used to find saddr when adding non gw nh
    
    [ Upstream commit bac0f937c343d651874f83b265ca8f5070ed4f06 ]
    
    As explained by Julian, fib_nh_scope is related to fib_nh_gw4, but
    fib_info_update_nhc_saddr() needs the scope of the route, which is
    the scope "before" fib_nh_scope, ie fib_nh_scope - 1.
    
    This patch fixes the problem described in commit 747c14307214 ("ip: fix
    dflt addr selection for connected nexthop").
    
    Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
    Link: https://lore.kernel.org/netdev/6c8a44ba-c2d5-cdf-c5c7-5baf97cba38@ssi.bg/
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Reviewed-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9bcce9a459f391b69f872253d5b06e221ee8700b
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Tue Oct 25 16:42:01 2022 -0700

    net: bcmsysport: Indicate MAC is in charge of PHY PM
    
    [ Upstream commit 9f172134dde7e4f5bf4b9139f23a1e741ec1c36e ]
    
    Avoid the PHY library call unnecessarily into the suspend/resume
    functions by setting phydev->mac_managed_pm to true. The SYSTEMPORT
    driver essentially does exactly what mdio_bus_phy_resume() does by
    calling phy_resume().
    
    Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Link: https://lore.kernel.org/r/20221025234201.2549360-1-f.fainelli@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 63e3f7b6bd543f00da7737a5834f8c5b48b1a3c4
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Tue Oct 25 21:00:11 2022 +0800

    net: ehea: fix possible memory leak in ehea_register_port()
    
    [ Upstream commit 0e7ce23a917a9cc83ca3c779fbba836bca3bcf1e ]
    
    If of_device_register() returns error, the of node and the
    name allocated in dev_set_name() is leaked, call put_device()
    to give up the reference that was set in device_initialize(),
    so that of node is put in logical_port_release() and the name
    is freed in kobject_cleanup().
    
    Fixes: 1acf2318dd13 ("ehea: dynamic add / remove port")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221025130011.1071357-1-yangyingliang@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7bd495f6d2ccfae3951de2e88afdeb636a4737e2
Author: Aaron Conole <aconole@redhat.com>
Date:   Tue Oct 25 06:50:17 2022 -0400

    openvswitch: switch from WARN to pr_warn
    
    [ Upstream commit fd954cc1919e35cb92f78671cab6e42d661945a3 ]
    
    As noted by Paolo Abeni, pr_warn doesn't generate any splat and can still
    preserve the warning to the user that feature downgrade occurred.  We
    likely cannot introduce other kinds of checks / enforcement here because
    syzbot can generate different genl versions to the datapath.
    
    Reported-by: syzbot+31cde0bef4bbf8ba2d86@syzkaller.appspotmail.com
    Fixes: 44da5ae5fbea ("openvswitch: Drop user features if old user space attempted to create datapath")
    Cc: Thomas Graf <tgraf@suug.ch>
    Signed-off-by: Aaron Conole <aconole@redhat.com>
    Acked-by: Ilya Maximets <i.maximets@ovn.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 350ca9b453a4f636ad70d01966bf7e865394905c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Oct 27 08:52:33 2022 +0200

    ALSA: aoa: Fix I2S device accounting
    
    [ Upstream commit f1fae475f10a26b7e34da4ff2e2f19b7feb3548e ]
    
    i2sbus_add_dev() is supposed to return the number of probed devices,
    i.e. either 1 or 0.  However, i2sbus_add_dev() has one error handling
    that returns -ENODEV; this will screw up the accumulation number
    counted in the caller, i2sbus_probe().
    
    Fix the return value to 0 and add the comment for better understanding
    for readers.
    
    Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
    Link: https://lore.kernel.org/r/20221027065233.13292-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c7524279c8ddc7dbf3463bec70e0289097959944
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Thu Oct 27 09:34:38 2022 +0800

    ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
    
    [ Upstream commit 4a4c8482e370d697738a78dcd7bf2780832cb712 ]
    
    dev_set_name() in soundbus_add_one() allocates memory for name, it need be
    freed when of_device_register() fails, call soundbus_dev_put() to give up
    the reference that hold in device_initialize(), so that it can be freed in
    kobject_cleanup() when the refcount hit to 0. And other resources are also
    freed in i2sbus_release_dev(), so it can return 0 directly.
    
    Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221027013438.991920-1-yangyingliang@huawei.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ab6240cc56c9a6fe824e04f13e3ba0d26a260c8d
Author: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Date:   Mon Oct 24 16:22:27 2022 +0900

    net: ethernet: ave: Fix MAC to be in charge of PHY PM
    
    [ Upstream commit e2badb4bd33abe13ddc35975bd7f7f8693955a4b ]
    
    The phylib callback is called after MAC driver's own resume callback is
    called. For AVE driver, after resuming immediately, PHY state machine is
    in PHY_NOLINK because there is a time lag from link-down to link-up due to
    autoneg. The result is WARN_ON() dump in mdio_bus_phy_resume().
    
    Since ave_resume() itself calls phy_resume(), AVE driver should manage
    PHY PM. To indicate that MAC driver manages PHY PM, set
    phydev->mac_managed_pm to true to avoid the unnecessary phylib call and
    add missing phy_init_hw() to ave_resume().
    
    Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
    Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
    Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
    Link: https://lore.kernel.org/r/20221024072227.24769-1-hayashi.kunihiko@socionext.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9728d121bb58d809bf35591359ed9ce0844899d0
Author: Juergen Borleis <jbe@pengutronix.de>
Date:   Mon Oct 24 10:05:52 2022 +0200

    net: fec: limit register access on i.MX6UL
    
    [ Upstream commit 0a8b43b12dd78daa77a7dc007b92770d262a2714 ]
    
    Using 'ethtool -d […]' on an i.MX6UL leads to a kernel crash:
    
       Unhandled fault: external abort on non-linefetch (0x1008) at […]
    
    due to this SoC has less registers in its FEC implementation compared to other
    i.MX6 variants. Thus, a run-time decision is required to avoid access to
    non-existing registers.
    
    Fixes: a51d3ab50702 ("net: fec: use a more proper compatible string for i.MX6UL type device")
    Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20221024080552.21004-1-jbe@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 82c6b0bcd9393657ba1d99bf7ded5093ba2b9c2b
Author: Shang XiaoJing <shangxiaojing@huawei.com>
Date:   Fri Oct 21 18:50:33 2022 +0800

    perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics
    
    [ Upstream commit e9229d5b6254a75291536f582652c599957344d2 ]
    
    Commit 0cc177cfc95d565e ("perf vendor events arm64: Add Hisi hip08 L3
    metrics") add L3 metrics of hip08, but some metrics (IF_BP_MISP_BR_RET,
    IF_BP_MISP_BR_RET, IF_BP_MISP_BR_BL) have incorrect event number due to
    the mistakes in document, which caused incorrect result. Fix the
    incorrect metrics.
    
    Before:
    
      65,811,214,308        armv8_pmuv3_0/event=0x1014/     # 18.87 push_branch
                                                            # -40.19 other_branch
      3,564,316,780 BR_MIS_PRED                             # 0.51 indirect_branch
                                                            # 21.81 pop_branch
    
    After:
    
      6,537,146,245 BR_MIS_PRED                     # 0.48 indirect_branch
                                                    # 0.47 pop_branch
                                                    # 0.00 push_branch
                                                    # 0.05 other_branch
    
    Fixes: 0cc177cfc95d565e ("perf vendor events arm64: Add Hisi hip08 L3 metrics")
    Reviewed-by: John Garry <john.garry@huawei.com>
    Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
    Acked-by: James Clark <james.clark@arm.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: John Garry <john.garry@huawei.com>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mike Leach <mike.leach@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20221021105035.10000-2-shangxiaojing@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6abb6787c07cc3fe3dc00353f15ff0637e447d3a
Author: Sudeep Holla <sudeep.holla@arm.com>
Date:   Tue Oct 25 13:34:32 2022 +0100

    PM: domains: Fix handling of unavailable/disabled idle states
    
    [ Upstream commit e0c57a5c70c13317238cb19a7ded0eab4a5f7de5 ]
    
    Platforms can provide the information about the availability of each
    idle states via status flag. Platforms may have to disable one or more
    idle states for various reasons like broken firmware or other unmet
    dependencies.
    
    Fix handling of such unavailable/disabled idle states by ignoring them
    while parsing the states.
    
    Fixes: a3381e3a65cb ("PM / domains: Fix up domain-idle-states OF parsing")
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8f70efcd01373d5d316de961ef6dcf4d6d05a82c
Author: Jisheng Zhang <jszhang@kernel.org>
Date:   Sat Oct 8 22:54:37 2022 +0800

    riscv: jump_label: mark arguments as const to satisfy asm constraints
    
    [ Upstream commit 89fd4a1df829187d4d35f6a520cc531de622e6f0 ]
    
    Samuel reported that the static branch usage in cpu_relax() breaks
    building with CONFIG_CC_OPTIMIZE_FOR_SIZE:
    
    In file included from <command-line>:
    ./arch/riscv/include/asm/jump_label.h: In function 'cpu_relax':
    ././include/linux/compiler_types.h:285:33: warning: 'asm' operand 0
    probably does not match constraints
      285 | #define asm_volatile_goto(x...) asm goto(x)
          |                                 ^~~
    ./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro
    'asm_volatile_goto'
       41 |         asm_volatile_goto(
          |         ^~~~~~~~~~~~~~~~~
    ././include/linux/compiler_types.h:285:33: error: impossible constraint
    in 'asm'
      285 | #define asm_volatile_goto(x...) asm goto(x)
          |                                 ^~~
    ./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro
    'asm_volatile_goto'
       41 |         asm_volatile_goto(
          |         ^~~~~~~~~~~~~~~~~
    make[1]: *** [scripts/Makefile.build:249:
    arch/riscv/kernel/vdso/vgettimeofday.o] Error 1
    make: *** [arch/riscv/Makefile:128: vdso_prepare] Error 2
    
    Maybe "-Os" prevents GCC from detecting that the key/branch arguments
    can be treated as constants and used as immediate operands. Inspired
    by x86's commit 864b435514b2("x86/jump_label: Mark arguments as const to
    satisfy asm constraints"), and as pointed out by Steven: "The "i"
    constraint needs to be a constant.", let's do similar modifications to
    riscv.
    
    Tested by CC_OPTIMIZE_FOR_SIZE + gcc and CC_OPTIMIZE_FOR_SIZE + clang.
    
    Link: https://lore.kernel.org/linux-riscv/20220922060958.44203-1-samuel@sholland.org/
    Link: https://lore.kernel.org/all/20210212094059.5f8d05e8@gandalf.local.home/
    Fixes: 8eb060e10185 ("arch/riscv: add Zihintpause support")
    Reported-by: Samuel Holland <samuel@sholland.org>
    Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Tested-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://lore.kernel.org/r/20221008145437.491-1-jszhang@kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f5b5c69f2406da0cd663f017dcaea031224c55fb
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Mon Oct 24 21:13:38 2022 +0800

    net: ksz884x: fix missing pci_disable_device() on error in pcidev_init()
    
    [ Upstream commit 5da6d65590a0698199df44d095e54b0ed1708178 ]
    
    pci_disable_device() need be called while module exiting, switch to use
    pcim_enable(), pci_disable_device() will be called in pcim_release()
    while unbinding device.
    
    Fixes: 8ca86fd83eae ("net: Micrel KSZ8841/2 PCI Ethernet driver")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221024131338.2848959-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 96114fd3b5c85fe8e0f1ab8b732733a901183724
Author: Slawomir Laba <slawomirx.laba@intel.com>
Date:   Mon Oct 24 03:05:26 2022 -0700

    i40e: Fix flow-type by setting GL_HASH_INSET registers
    
    [ Upstream commit 3b32c9932853e11d71f9db012d69e92e4669ba23 ]
    
    Fix setting bits for specific flow_type for GLQF_HASH_INSET register.
    In previous version all of the bits were set only in hena register, while
    in inset only one bit was set. In order for this working correctly on all
    types of cards these bits needs to be set correctly for both hena and inset
    registers.
    
    Fixes: eb0dd6e4a3b3 ("i40e: Allow RSS Hash set with less than four parameters")
    Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
    Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20221024100526.1874914-3-jacob.e.keller@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 02f949747e6fb767b29f7931d4bbf40911684e7a
Author: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Date:   Mon Oct 24 03:05:25 2022 -0700

    i40e: Fix VF hang when reset is triggered on another VF
    
    [ Upstream commit 52424f974bc53c26ba3f00300a00e9de9afcd972 ]
    
    When a reset was triggered on one VF with i40e_reset_vf
    global PF state __I40E_VF_DISABLE was set on a PF until
    the reset finished. If immediately after triggering reset
    on one VF there is a request to reset on another
    it will cause a hang on VF side because VF will be notified
    of incoming reset but the reset will never happen because
    of this global state, we will get such error message:
    
    [  +4.890195] iavf 0000:86:02.1: Never saw reset
    
    and VF will hang waiting for the reset to be triggered.
    
    Fix this by introducing new VF state I40E_VF_STATE_RESETTING
    that will be set on a VF if it is currently resetting instead of
    the global __I40E_VF_DISABLE PF state.
    
    Fixes: 3ba9bcb4b68f ("i40e: add locking around VF reset")
    Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20221024100526.1874914-2-jacob.e.keller@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 43af836bfd08dde6d0f3c5a5e90165c399d4ef2d
Author: Slawomir Laba <slawomirx.laba@intel.com>
Date:   Mon Oct 24 03:05:24 2022 -0700

    i40e: Fix ethtool rx-flow-hash setting for X722
    
    [ Upstream commit 54b5af5a438076082d482cab105b1bd484ab5074 ]
    
    When enabling flow type for RSS hash via ethtool:
    
    ethtool -N $pf rx-flow-hash tcp4|tcp6|udp4|udp6 s|d
    
    the driver would fail to setup this setting on X722
    device since it was using the mask on the register
    dedicated for X710 devices.
    
    Apply a different mask on the register when setting the
    RSS hash for the X722 device.
    
    When displaying the flow types enabled via ethtool:
    
    ethtool -n $pf rx-flow-hash tcp4|tcp6|udp4|udp6
    
    the driver would print wrong values for X722 device.
    
    Fix this issue by testing masks for X722 device in
    i40e_get_rss_hash_opts function.
    
    Fixes: eb0dd6e4a3b3 ("i40e: Allow RSS Hash set with less than four parameters")
    Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
    Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20221024100526.1874914-1-jacob.e.keller@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ccd94bd4939690e24d13e23814bce7ed853a09f3
Author: Eric Dumazet <edumazet@google.com>
Date:   Sun Oct 23 19:01:24 2022 -0700

    ipv6: ensure sane device mtu in tunnels
    
    [ Upstream commit d89d7ff01235f218dad37de84457717f699dee79 ]
    
    Another syzbot report [1] with no reproducer hints
    at a bug in ip6_gre tunnel (dev:ip6gretap0)
    
    Since ipv6 mcast code makes sure to read dev->mtu once
    and applies a sanity check on it (see commit b9b312a7a451
    "ipv6: mcast: better catch silly mtu values"), a remaining
    possibility is that a layer is able to set dev->mtu to
    an underflowed value (high order bit set).
    
    This could happen indeed in ip6gre_tnl_link_config_route(),
    ip6_tnl_link_config() and ipip6_tunnel_bind_dev()
    
    Make sure to sanitize mtu value in a local variable before
    it is written once on dev->mtu, as lockless readers could
    catch wrong temporary value.
    
    [1]
    skbuff: skb_over_panic: text:ffff80000b7a2f38 len:40 put:40 head:ffff000149dcf200 data:ffff000149dcf2b0 tail:0xd8 end:0xc0 dev:ip6gretap0
    ------------[ cut here ]------------
    kernel BUG at net/core/skbuff.c:120
    Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 1 PID: 10241 Comm: kworker/1:1 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
    Workqueue: mld mld_ifc_work
    pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : skb_panic+0x4c/0x50 net/core/skbuff.c:116
    lr : skb_panic+0x4c/0x50 net/core/skbuff.c:116
    sp : ffff800020dd3b60
    x29: ffff800020dd3b70 x28: 0000000000000000 x27: ffff00010df2a800
    x26: 00000000000000c0 x25: 00000000000000b0 x24: ffff000149dcf200
    x23: 00000000000000c0 x22: 00000000000000d8 x21: ffff80000b7a2f38
    x20: ffff00014c2f7800 x19: 0000000000000028 x18: 00000000000001a9
    x17: 0000000000000000 x16: ffff80000db49158 x15: ffff000113bf1a80
    x14: 0000000000000000 x13: 00000000ffffffff x12: ffff000113bf1a80
    x11: ff808000081c0d5c x10: 0000000000000000 x9 : 73f125dc5c63ba00
    x8 : 73f125dc5c63ba00 x7 : ffff800008161d1c x6 : 0000000000000000
    x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
    x2 : ffff0001fefddcd0 x1 : 0000000100000000 x0 : 0000000000000089
    Call trace:
    skb_panic+0x4c/0x50 net/core/skbuff.c:116
    skb_over_panic net/core/skbuff.c:125 [inline]
    skb_put+0xd4/0xdc net/core/skbuff.c:2049
    ip6_mc_hdr net/ipv6/mcast.c:1714 [inline]
    mld_newpack+0x14c/0x270 net/ipv6/mcast.c:1765
    add_grhead net/ipv6/mcast.c:1851 [inline]
    add_grec+0xa20/0xae0 net/ipv6/mcast.c:1989
    mld_send_cr+0x438/0x5a8 net/ipv6/mcast.c:2115
    mld_ifc_work+0x38/0x290 net/ipv6/mcast.c:2653
    process_one_work+0x2d8/0x504 kernel/workqueue.c:2289
    worker_thread+0x340/0x610 kernel/workqueue.c:2436
    kthread+0x12c/0x158 kernel/kthread.c:376
    ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
    Code: 91011400 aa0803e1 a90027ea 94373093 (d4210000)
    
    Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20221024020124.3756833-1-eric.dumazet@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dd29907378d535cb0be15c8c37d3533e125970f0
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Fri Oct 21 10:25:57 2022 +0200

    perf list: Fix PMU name pai_crypto in perf list on s390
    
    [ Upstream commit 5a6c184a72a375072cffe788d93ad6052c48f16b ]
    
    Commit e0b23af82d6f454c ("perf list: Add PMU pai_crypto event
    description for IBM z16") introduced the "Processor Activity
    Instrumentation" for cryptographic counters for z16. The PMU device
    driver exports the counters via sysfs files listed in directory
    /sys/devices/pai_crypto.
    
    To specify an event from that PMU, use 'perf stat -e pai_crypto/XXX/'.
    
    However the JSON file mentioned in above commit exports the counter
    decriptions in file pmu-events/arch/s390/cf_z16/pai.json.  Rename this
    file to pmu-events/arch/s390/cf_z16/pai_crypto.json to make the naming
    consistent.
    
    Now 'perf list' shows the counter names under pai_crypto section:
    
      pai_crypto:
    
        CRYPTO_ALL
             [CRYPTO ALL. Unit: pai_crypto]
        ...
    
    Output before was
    
      pai:
        CRYPTO_ALL
             [CRYPTO ALL. Unit: pai_crypto]
        ...
    
    Fixes: e0b23af82d6f454c ("perf list: Add PMU pai_crypto event description for IBM z16")
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Thomas Richter <tmricht@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Link: https://lore.kernel.org/r/20221021082557.2695382-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c83feba6b363e01e1633ce94ff8378789b02018e
Author: Kajol Jain <kjain@linux.ibm.com>
Date:   Fri Oct 14 19:32:20 2022 +0530

    perf vendor events power10: Fix hv-24x7 metric events
    
    [ Upstream commit b92dd11725a7c57f55e148c7d3ce58a86f480575 ]
    
    Testcase stat_all_metrics.sh fails in powerpc:
    
      90: perf all metrics test : FAILED!
    
    The testcase "stat_all_metrics.sh" verifies perf stat result for all the
    metric events present in perf list.  It runs perf metric events with
    various commands and expects non-empty metric result.
    
    Incase of powerpc:hv-24x7 events, some of the event count can be 0 based
    on system configuration. And if that event used as denominator in divide
    equation, it can cause divide by 0 error. The current nest_metric.json
    file creating divide by 0 issue for some of the metric events, which
    results in failure of the "stat_all_metrics.sh" test case.
    
    Most of the metrics events have cycles or an event which expect to have
    a larger value as denominator, so adding 1 to the denominator of the
    metric expression as a fix.
    
    Result in powerpc box after this patch changes:
    
      90: perf all metrics test : Ok
    
    Fixes: a3cbcadfdfc330c2 ("perf vendor events power10: Adds 24x7 nest metric events for power10 platform")
    Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
    Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
    Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
    Link: https://lore.kernel.org/r/20221014140220.122251-1-kjain@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5f75077efa6adb221b1a80317b102537a2605ebb
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Mon Oct 17 15:09:06 2022 +0100

    media: vivid: set num_in/outputs to 0 if not supported
    
    [ Upstream commit 69d78a80da4ef12faf2a6f9cfa2097ab4ac43983 ]
    
    If node_types does not have video/vbi/meta inputs or outputs,
    then set num_inputs/num_outputs to 0 instead of 1.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: 0c90f649d2f5 (media: vivid: add vivid_create_queue() helper)
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 648d545c12134cafa7b80968fbf948329bf89f16
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Wed Oct 12 16:46:17 2022 +0100

    media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced'
    
    [ Upstream commit 8da7f0976b9071b528c545008de9d10cc81883b1 ]
    
    If it is a progressive (non-interlaced) format, then ignore the
    interlaced timing values.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: 7f68127fa11f ([media] videodev2.h: defines to calculate blanking and frame sizes)
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dc7276c3f6ca008be1faf531f84b49906c9bcf7f
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Thu Oct 13 09:00:34 2022 +0100

    media: v4l2-dv-timings: add sanity checks for blanking values
    
    [ Upstream commit 4b6d66a45ed34a15721cb9e11492fa1a24bc83df ]
    
    Add sanity checks to v4l2_valid_dv_timings() to ensure that the provided
    blanking values are reasonable.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: b18787ed1ce3 ([media] v4l2-dv-timings: add new helper module)
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 74e2e978d1e36c3b67e998e779c02cbc8f481527
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Thu Oct 13 15:18:46 2022 +0100

    media: vivid: dev->bitmap_cap wasn't freed in all cases
    
    [ Upstream commit 1f65ea411cc7b6ff128d82a3493d7b5648054e6f ]
    
    Whenever the compose width/height values change, the dev->bitmap_cap
    vmalloc'ed array must be freed and dev->bitmap_cap set to NULL.
    
    This was done in some places, but not all. This is only an issue if
    overlay support is enabled and the bitmap clipping is used.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 832423238350c91ac33e05bac75ae28732eeb1a7
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Wed Oct 12 15:32:28 2022 +0100

    media: vivid: s_fbuf: add more sanity checks
    
    [ Upstream commit f8bcaf714abfc94818dff8c0db84d750433984f4 ]
    
    VIDIOC_S_FBUF is by definition a scary ioctl, which is why only root
    can use it. But at least check if the framebuffer parameters match that
    of one of the framebuffer created by vivid, and reject anything else.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 99edd711c52a8401ba4f2ac6f379d46319a3202c
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Oct 12 22:50:17 2022 -0500

    PM: hibernate: Allow hybrid sleep to work with s2idle
    
    [ Upstream commit 85850af4fc47132f3f2f0dd698b90f67906600b4 ]
    
    Hybrid sleep is currently hardcoded to only operate with S3 even
    on systems that might not support it.
    
    Instead of assuming this mode is what the user wants to use, for
    hybrid sleep follow the setting of `mem_sleep_current` which
    will respect mem_sleep_default kernel command line and policy
    decisions made by the presence of the FADT low power idle bit.
    
    Fixes: 81d45bdf8913 ("PM / hibernate: Untangle power_down()")
    Reported-and-tested-by: kolAflash <kolAflash@kolahilft.de>
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216574
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b5b545662cc5b0ec9e5bd0b37c1fc45e496a32c1
Author: Dongliang Mu <dzm91@hust.edu.cn>
Date:   Mon Oct 24 17:02:52 2022 +0800

    can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() in error path
    
    [ Upstream commit b1a09b63684cea56774786ca14c13b7041ffee63 ]
    
    In mcp251x_can_probe(), if mcp251x_gpio_setup() fails, it forgets to
    unregister the CAN device.
    
    Fix this by unregistering can device in mcp251x_can_probe().
    
    Fixes: 2d52dabbef60 ("can: mcp251x: add GPIO support")
    Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
    Link: https://lore.kernel.org/all/20221024090256.717236-1-dzm91@hust.edu.cn
    [mkl: adjust label]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b83ca06a28ee1976acf05715979c0847d6defa5d
Author: Dongliang Mu <dzm91@hust.edu.cn>
Date:   Mon Oct 24 19:48:07 2022 +0800

    can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path
    
    [ Upstream commit 3e5b3418827cefb5e1cc658806f02965791b8f07 ]
    
    The commit 1149108e2fbf ("can: mscan: improve clock API use") only
    adds put_clock() in mpc5xxx_can_remove() function, forgetting to add
    put_clock() in the error handling code.
    
    Fix this bug by adding put_clock() in the error handling code.
    
    Fixes: 1149108e2fbf ("can: mscan: improve clock API use")
    Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
    Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@pengutronix.de
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3e8a567fb96cd3635cc775b26e1e8aaefb88430e
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 21 15:58:54 2022 -0700

    mptcp: set msk local address earlier
    
    [ Upstream commit e72e4032637f4646554794ac28a3abecc6c2416d ]
    
    The mptcp_pm_nl_get_local_id() code assumes that the msk local address
    is available at that point. For passive sockets, we initialize such
    address at accept() time.
    
    Depending on the running configuration and the user-space timing, a
    passive MPJ subflow can join the msk socket before accept() completes.
    
    In such case, the PM assigns a wrong local id to the MPJ subflow
    and later PM netlink operations will end-up touching the wrong/unexpected
    subflow.
    
    All the above causes sporadic self-tests failures, especially when
    the host is heavy loaded.
    
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/308
    Fixes: 01cacb00b35c ("mptcp: add netlink-based PM")
    Fixes: d045b9eb95a9 ("mptcp: introduce implicit endpoints")
    Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 337936ded0b397e90105c9d0c53ed48fd94e2045
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Fri Oct 21 11:07:11 2022 +0200

    net: lan966x: Stop replacing tx dcbs and dcbs_buf when changing MTU
    
    [ Upstream commit 4a4b6848d1e932b977e6a00cda393adf7e839ff8 ]
    
    When a frame is sent using FDMA, the skb is mapped and then the mapped
    address is given to an tx dcb that is different than the last used tx
    dcb. Once the HW finish with this frame, it would generate an interrupt
    and then the dcb can be reused and memory can be freed. For each dcb
    there is an dcb buf that contains some meta-data(is used by PTP, is
    it free). There is 1 to 1 relationship between dcb and dcb_buf.
    The following issue was observed. That sometimes after changing the MTU
    to allocate new tx dcbs and dcbs_buf, two frames were not
    transmitted. The frames were not transmitted because when reloading the
    tx dcbs, it was always presuming to use the first dcb but that was not
    always happening. Because it could be that the last tx dcb used before
    changing MTU was first dcb and then when it tried to get the next dcb it
    would take dcb 1 instead of 0. Because it is supposed to take a
    different dcb than the last used one. This can be fixed simply by
    changing tx->last_in_use to -1 when the fdma is disabled to reload the
    new dcb and dcbs_buff.
    But there could be a different issue. For example, right after the frame
    is sent, the MTU is changed. Now all the dcbs and dcbs_buf will be
    cleared. And now get the interrupt from HW that it finished with the
    frame. So when we try to clear the skb, it is not possible because we
    lost all the dcbs_buf.
    The solution here is to stop replacing the tx dcbs and dcbs_buf when
    changing MTU because the TX doesn't care what is the MTU size, it is
    only the RX that needs this information.
    
    Fixes: 2ea1cbac267e ("net: lan966x: Update FDMA to change MTU.")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Link: https://lore.kernel.org/r/20221021090711.3749009-1-horatiu.vultur@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c6dc4c9ba093829ebe1450d5fb101da6fb7a2a58
Author: Rafael Mendonca <rafaelmendsr@gmail.com>
Date:   Mon Oct 17 22:27:50 2022 -0300

    drm/amdkfd: Fix memory leak in kfd_mem_dmamap_userptr()
    
    [ Upstream commit 90bfee142af0f0e9d3bec80e7acd5f49b230acf7 ]
    
    If the number of pages from the userptr BO differs from the SG BO then the
    allocated memory for the SG table doesn't get freed before returning
    -EINVAL, which may lead to a memory leak in some error paths. Fix this by
    checking the number of pages before allocating memory for the SG table.
    
    Fixes: 264fb4d332f5 ("drm/amdgpu: Add multi-GPU DMA mapping helpers")
    Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
    Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 568737b2829631927b6aed7308e37bc33a3bd3a4
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Oct 21 09:03:04 2022 -0700

    net-memcg: avoid stalls when under memory pressure
    
    [ Upstream commit 720ca52bcef225b967a339e0fffb6d0c7e962240 ]
    
    As Shakeel explains the commit under Fixes had the unintended
    side-effect of no longer pre-loading the cached memory allowance.
    Even tho we previously dropped the first packet received when
    over memory limit - the consecutive ones would get thru by using
    the cache. The charging was happening in batches of 128kB, so
    we'd let in 128kB (truesize) worth of packets per one drop.
    
    After the change we no longer force charge, there will be no
    cache filling side effects. This causes significant drops and
    connection stalls for workloads which use a lot of page cache,
    since we can't reclaim page cache under GFP_NOWAIT.
    
    Some of the latency can be recovered by improving SACK reneg
    handling but nowhere near enough to get back to the pre-5.15
    performance (the application I'm experimenting with still
    sees 5-10x worst latency).
    
    Apply the suggested workaround of using GFP_ATOMIC. We will now
    be more permissive than previously as we'll drop _no_ packets
    in softirq when under pressure. But I can't think of any good
    and simple way to address that within networking.
    
    Link: https://lore.kernel.org/all/20221012163300.795e7b86@kernel.org/
    Suggested-by: Shakeel Butt <shakeelb@google.com>
    Fixes: 4b1327be9fe5 ("net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()")
    Acked-by: Shakeel Butt <shakeelb@google.com>
    Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
    Link: https://lore.kernel.org/r/20221021160304.1362511-1-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0262c9f7cfdf1e43d2a2fdc5d4617c14e4ba0879
Author: Neal Cardwell <ncardwell@google.com>
Date:   Fri Oct 21 17:08:21 2022 +0000

    tcp: fix indefinite deferral of RTO with SACK reneging
    
    [ Upstream commit 3d2af9cce3133b3bc596a9d065c6f9d93419ccfb ]
    
    This commit fixes a bug that can cause a TCP data sender to repeatedly
    defer RTOs when encountering SACK reneging.
    
    The bug is that when we're in fast recovery in a scenario with SACK
    reneging, every time we get an ACK we call tcp_check_sack_reneging()
    and it can note the apparent SACK reneging and rearm the RTO timer for
    srtt/2 into the future. In some SACK reneging scenarios that can
    happen repeatedly until the receive window fills up, at which point
    the sender can't send any more, the ACKs stop arriving, and the RTO
    fires at srtt/2 after the last ACK. But that can take far too long
    (O(10 secs)), since the connection is stuck in fast recovery with a
    low cwnd that cannot grow beyond ssthresh, even if more bandwidth is
    available.
    
    This fix changes the logic in tcp_check_sack_reneging() to only rearm
    the RTO timer if data is cumulatively ACKed, indicating forward
    progress. This avoids this kind of nearly infinite loop of RTO timer
    re-arming. In addition, this meets the goals of
    tcp_check_sack_reneging() in handling Windows TCP behavior that looks
    temporarily like SACK reneging but is not really.
    
    Many thanks to Jakub Kicinski and Neil Spring, who reported this issue
    and provided critical packet traces that enabled root-causing this
    issue. Also, many thanks to Jakub Kicinski for testing this fix.
    
    Fixes: 5ae344c949e7 ("tcp: reduce spurious retransmits due to transient SACK reneging")
    Reported-by: Jakub Kicinski <kuba@kernel.org>
    Reported-by: Neil Spring <ntspring@fb.com>
    Signed-off-by: Neal Cardwell <ncardwell@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Cc: Yuchung Cheng <ycheng@google.com>
    Tested-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20221021170821.1093930-1-ncardwell.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 28addf029417d53b1df062b4c87feb7bc033cb5f
Author: Lu Wei <luwei32@huawei.com>
Date:   Fri Oct 21 12:06:22 2022 +0800

    tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
    
    [ Upstream commit ec791d8149ff60c40ad2074af3b92a39c916a03f ]
    
    The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and
    in tcp_add_backlog(), the variable limit is caculated by adding
    sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value
    of int and overflow. This patch reduces the limit budget by
    halving the sndbuf to solve this issue since ACK packets are much
    smaller than the payload.
    
    Fixes: c9c3321257e1 ("tcp: add tcp_add_backlog()")
    Signed-off-by: Lu Wei <luwei32@huawei.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7439672043afcee324fc03c7abf6cfcc54e4fe48
Author: Zhang Changzhong <zhangchangzhong@huawei.com>
Date:   Fri Oct 21 09:32:24 2022 +0800

    net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
    
    [ Upstream commit 9c1eaa27ec599fcc25ed4970c0b73c247d147a2b ]
    
    The ndo_start_xmit() method must not free skb when returning
    NETDEV_TX_BUSY, since caller is going to requeue freed skb.
    
    Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")
    Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a4df5e78712de39d6f90d6a64b5eb48dca03bd5
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Thu Oct 20 10:42:13 2022 +0800

    net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed
    
    [ Upstream commit d266935ac43d57586e311a087510fe6a084af742 ]
    
    When the ops_init() interface is invoked to initialize the net, but
    ops->init() fails, data is released. However, the ptr pointer in
    net->gen is invalid. In this case, when nfqnl_nf_hook_drop() is invoked
    to release the net, invalid address access occurs.
    
    The process is as follows:
    setup_net()
            ops_init()
                    data = kzalloc(...)   ---> alloc "data"
                    net_assign_generic()  ---> assign "date" to ptr in net->gen
                    ...
                    ops->init()           ---> failed
                    ...
                    kfree(data);          ---> ptr in net->gen is invalid
            ...
            ops_exit_list()
                    ...
                    nfqnl_nf_hook_drop()
                            *q = nfnl_queue_pernet(net) ---> q is invalid
    
    The following is the Call Trace information:
    BUG: KASAN: use-after-free in nfqnl_nf_hook_drop+0x264/0x280
    Read of size 8 at addr ffff88810396b240 by task ip/15855
    Call Trace:
    <TASK>
    dump_stack_lvl+0x8e/0xd1
    print_report+0x155/0x454
    kasan_report+0xba/0x1f0
    nfqnl_nf_hook_drop+0x264/0x280
    nf_queue_nf_hook_drop+0x8b/0x1b0
    __nf_unregister_net_hook+0x1ae/0x5a0
    nf_unregister_net_hooks+0xde/0x130
    ops_exit_list+0xb0/0x170
    setup_net+0x7ac/0xbd0
    copy_net_ns+0x2e6/0x6b0
    create_new_namespaces+0x382/0xa50
    unshare_nsproxy_namespaces+0xa6/0x1c0
    ksys_unshare+0x3a4/0x7e0
    __x64_sys_unshare+0x2d/0x40
    do_syscall_64+0x35/0x80
    entry_SYSCALL_64_after_hwframe+0x46/0xb0
    </TASK>
    
    Allocated by task 15855:
    kasan_save_stack+0x1e/0x40
    kasan_set_track+0x21/0x30
    __kasan_kmalloc+0xa1/0xb0
    __kmalloc+0x49/0xb0
    ops_init+0xe7/0x410
    setup_net+0x5aa/0xbd0
    copy_net_ns+0x2e6/0x6b0
    create_new_namespaces+0x382/0xa50
    unshare_nsproxy_namespaces+0xa6/0x1c0
    ksys_unshare+0x3a4/0x7e0
    __x64_sys_unshare+0x2d/0x40
    do_syscall_64+0x35/0x80
    entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    Freed by task 15855:
    kasan_save_stack+0x1e/0x40
    kasan_set_track+0x21/0x30
    kasan_save_free_info+0x2a/0x40
    ____kasan_slab_free+0x155/0x1b0
    slab_free_freelist_hook+0x11b/0x220
    __kmem_cache_free+0xa4/0x360
    ops_init+0xb9/0x410
    setup_net+0x5aa/0xbd0
    copy_net_ns+0x2e6/0x6b0
    create_new_namespaces+0x382/0xa50
    unshare_nsproxy_namespaces+0xa6/0x1c0
    ksys_unshare+0x3a4/0x7e0
    __x64_sys_unshare+0x2d/0x40
    do_syscall_64+0x35/0x80
    entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    Fixes: f875bae06533 ("net: Automatically allocate per namespace data.")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2733fb2ad5bfbe6538f2f93a21f2504e3dba9d6a
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Oct 20 22:45:12 2022 +0000

    kcm: annotate data-races around kcm->rx_wait
    
    [ Upstream commit 0c745b5141a45a076f1cb9772a399f7ebcb0948a ]
    
    kcm->rx_psock can be read locklessly in kcm_rfree().
    Annotate the read and writes accordingly.
    
    syzbot reported:
    
    BUG: KCSAN: data-race in kcm_rcv_strparser / kcm_rfree
    
    write to 0xffff88810784e3d0 of 1 bytes by task 1823 on cpu 1:
    reserve_rx_kcm net/kcm/kcmsock.c:283 [inline]
    kcm_rcv_strparser+0x250/0x3a0 net/kcm/kcmsock.c:363
    __strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
    strp_recv+0x6d/0x80 net/strparser/strparser.c:335
    tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
    strp_read_sock net/strparser/strparser.c:358 [inline]
    do_strp_work net/strparser/strparser.c:406 [inline]
    strp_work+0xe8/0x180 net/strparser/strparser.c:415
    process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
    worker_thread+0x618/0xa70 kernel/workqueue.c:2436
    kthread+0x1a9/0x1e0 kernel/kthread.c:376
    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
    
    read to 0xffff88810784e3d0 of 1 bytes by task 17869 on cpu 0:
    kcm_rfree+0x121/0x220 net/kcm/kcmsock.c:181
    skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
    skb_release_all net/core/skbuff.c:852 [inline]
    __kfree_skb net/core/skbuff.c:868 [inline]
    kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
    kfree_skb include/linux/skbuff.h:1216 [inline]
    kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
    ____sys_recvmsg+0x16c/0x2e0
    ___sys_recvmsg net/socket.c:2743 [inline]
    do_recvmmsg+0x2f1/0x710 net/socket.c:2837
    __sys_recvmmsg net/socket.c:2916 [inline]
    __do_sys_recvmmsg net/socket.c:2939 [inline]
    __se_sys_recvmmsg net/socket.c:2932 [inline]
    __x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    value changed: 0x01 -> 0x00
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 17869 Comm: syz-executor.2 Not tainted 6.1.0-rc1-syzkaller-00010-gbb1a1146467a-dirty #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
    
    Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    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 12a0eb340c9a22e0f8c00d2c0c1a60695ead926a
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Oct 20 22:45:11 2022 +0000

    kcm: annotate data-races around kcm->rx_psock
    
    [ Upstream commit 15e4dabda11b0fa31d510a915d1a580f47dfc92e ]
    
    kcm->rx_psock can be read locklessly in kcm_rfree().
    Annotate the read and writes accordingly.
    
    We do the same for kcm->rx_wait in the following patch.
    
    syzbot reported:
    BUG: KCSAN: data-race in kcm_rfree / unreserve_rx_kcm
    
    write to 0xffff888123d827b8 of 8 bytes by task 2758 on cpu 1:
    unreserve_rx_kcm+0x72/0x1f0 net/kcm/kcmsock.c:313
    kcm_rcv_strparser+0x2b5/0x3a0 net/kcm/kcmsock.c:373
    __strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
    strp_recv+0x6d/0x80 net/strparser/strparser.c:335
    tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
    strp_read_sock net/strparser/strparser.c:358 [inline]
    do_strp_work net/strparser/strparser.c:406 [inline]
    strp_work+0xe8/0x180 net/strparser/strparser.c:415
    process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
    worker_thread+0x618/0xa70 kernel/workqueue.c:2436
    kthread+0x1a9/0x1e0 kernel/kthread.c:376
    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
    
    read to 0xffff888123d827b8 of 8 bytes by task 5859 on cpu 0:
    kcm_rfree+0x14c/0x220 net/kcm/kcmsock.c:181
    skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
    skb_release_all net/core/skbuff.c:852 [inline]
    __kfree_skb net/core/skbuff.c:868 [inline]
    kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
    kfree_skb include/linux/skbuff.h:1216 [inline]
    kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
    ____sys_recvmsg+0x16c/0x2e0
    ___sys_recvmsg net/socket.c:2743 [inline]
    do_recvmmsg+0x2f1/0x710 net/socket.c:2837
    __sys_recvmmsg net/socket.c:2916 [inline]
    __do_sys_recvmmsg net/socket.c:2939 [inline]
    __se_sys_recvmmsg net/socket.c:2932 [inline]
    __x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    value changed: 0xffff88812971ce00 -> 0x0000000000000000
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 5859 Comm: syz-executor.3 Not tainted 6.0.0-syzkaller-12189-g19d17ab7c68b-dirty #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
    
    Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    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 2838631b4bf00e5354afa4dc82c41c2148d7d5db
Author: Íñigo Huguet <ihuguet@redhat.com>
Date:   Thu Oct 20 09:53:10 2022 +0200

    atlantic: fix deadlock at aq_nic_stop
    
    [ Upstream commit 6960d133f66ecddcd3af2b1cbd0c7dcd104268b8 ]
    
    NIC is stopped with rtnl_lock held, and during the stop it cancels the
    'service_task' work and free irqs.
    
    However, if CONFIG_MACSEC is set, rtnl_lock is acquired both from
    aq_nic_service_task and aq_linkstate_threaded_isr. Then a deadlock
    happens if aq_nic_stop tries to cancel/disable them when they've already
    started their execution.
    
    As the deadlock is caused by rtnl_lock, it causes many other processes
    to stall, not only atlantic related stuff.
    
    Fix it by introducing a mutex that protects each NIC's macsec related
    data, and locking it instead of the rtnl_lock from the service task and
    the threaded IRQ.
    
    Before this patch, all macsec data was protected with rtnl_lock, but
    maybe not all of it needs to be protected. With this new mutex, further
    efforts can be made to limit the protected data only to that which
    requires it. However, probably it doesn't worth it because all macsec's
    data accesses are infrequent, and almost all are done from macsec_ops
    or ethtool callbacks, called holding rtnl_lock, so macsec_mutex won't
    never be much contended.
    
    The issue appeared repeteadly attaching and deattaching the NIC to a
    bond interface. Doing that after this patch I cannot reproduce the bug.
    
    Fixes: 62c1c2e606f6 ("net: atlantic: MACSec offload skeleton")
    Reported-by: Li Liang <liali@redhat.com>
    Suggested-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
    Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3c8863bb0430dc4223cd45f2ed26f2f710b29e78
Author: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Date:   Tue Oct 11 12:04:40 2022 +0530

    drm/i915/dp: Reset frl trained flag before restarting FRL training
    
    [ Upstream commit 63720a561b3c98199adf0c73e152807f15cc3b7f ]
    
    For cases where DP has HDMI2.1 sink and FRL Link issues are detected,
    reset the flag to state FRL trained status before restarting FRL
    training.
    
    Fixes: 9488a030ac91 ("drm/i915: Add support for enabling link status and recovery")
    Cc: Swati Sharma <swati2.sharma@intel.com>
    Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Cc: Uma Shankar <uma.shankar@intel.com> (v2)
    Cc: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221011063447.904649-2-ankit.k.nautiyal@intel.com
    (cherry picked from commit 47e1a59e60c688c5f95b67277202f05b7e84c189)
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit facddef7989045e81a5611afe95b0fe258aaa5af
Author: Anshuman Gupta <anshuman.gupta@intel.com>
Date:   Fri Oct 14 17:02:58 2022 +0530

    drm/i915/dgfx: Keep PCI autosuspend control 'on' by default on all dGPU
    
    [ Upstream commit 62c52eac1ad680fc68ef6d75955127dca46e2740 ]
    
    DGFX platforms has lmem and cpu can access the lmem objects
    via mmap and i915 internal i915_gem_object_pin_map() for
    i915 own usages. Both of these methods has pre-requisite
    requirement to keep GFX PCI endpoint in D0 for a supported
    iomem transaction over PCI link. (Refer PCIe specs 5.3.1.4.1)
    
    Both DG1/DG2 have a known hardware bug that violates the PCIe specs
    and support the iomem read write transaction over PCIe bus despite
    endpoint is D3 state.
    Due to above H/W bug, we had never observed any issue with i915 runtime
    PM versus lmem access.
    But this issue becomes visible when PCIe gfx endpoint's upstream
    bridge enters to D3, at this point any lmem read/write access will be
    returned as unsupported request. But again this issue is not observed
    on every platform because it has been observed on few host machines
    DG1/DG2 endpoint's upstream bridge does not bind with pcieport driver.
    which really disables the PCIe  power savings and leaves the bridge
    at D0 state.
    
    We need a unique interface to read/write from lmem with runtime PM
    wakeref protection something similar to intel_uncore_{read, write},
    keep autosuspend control to 'on' on all discrete platforms,
    until we have a unique interface to read/write from lmem.
    
    This just change the default autosuspend setting of i915 on dGPU,
    user can still change it to 'auto'.
    
    v2:
    - Modified the commit message and subject with more information.
    - Changed the Fixes tag to LMEM support commit. [Joonas]
    - Changed !HAS_LMEM() Cond to !IS_DGFX(). [Rodrigo]
    
    Fixes: b908be543e44 ("drm/i915: support creating LMEM objects")
    Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221014113258.1284226-1-anshuman.gupta@intel.com
    (cherry picked from commit 66eb93e71a7a6695b7c5eb682e3ca1c980cf9d58)
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 532cb5a0dfb45239c09c7728628ff36c1ec060cd
Author: Raju Rangoju <Raju.Rangoju@amd.com>
Date:   Thu Oct 20 12:12:15 2022 +0530

    amd-xgbe: add the bit rate quirk for Molex cables
    
    [ Upstream commit 170a9e341a3b02c0b2ea0df16ef14a33a4f41de8 ]
    
    The offset 12 (bit-rate) of EEPROM SFP DAC (passive) cables is expected
    to be in the range 0x64 to 0x68. However, the 5 meter and 7 meter Molex
    passive cables have the rate ceiling 0x78 at offset 12.
    
    Add a quirk for Molex passive cables to extend the rate ceiling to 0x78.
    
    Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
    Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ee972a30278bea8cac5678541ceb8a751499710a
Author: Raju Rangoju <Raju.Rangoju@amd.com>
Date:   Thu Oct 20 12:12:14 2022 +0530

    amd-xgbe: fix the SFP compliance codes check for DAC cables
    
    [ Upstream commit 09c5f6bf11ac98874339e55f4f5f79a9dbc9b375 ]
    
    The current XGBE code assumes that offset 6 of EEPROM SFP DAC (passive)
    cables is NULL. However, some cables (the 5 meter and 7 meter Molex
    passive cables) have non-zero data at offset 6. Fix the logic by moving
    the passive cable check above the active checks, so as not to be
    improperly identified as an active cable. This will fix the issue for
    any passive cable that advertises 1000Base-CX in offset 6.
    
    Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
    Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2bc4496d2a9a9903ff6b4e8552652d8104180b2e
Author: Raju Rangoju <Raju.Rangoju@amd.com>
Date:   Thu Oct 20 12:12:11 2022 +0530

    amd-xgbe: Yellow carp devices do not need rrc
    
    [ Upstream commit f97fc7ef414603189d5ba6f529407c5341c03c2a ]
    
    Link stability issues are noticed on Yellow carp platforms when Receiver
    Reset Cycle is issued. Since the CDR workaround is disabled on these
    platforms, the Receiver Reset Cycle is not needed.
    
    So, avoid issuing rrc on Yellow carp platforms.
    
    Fixes: dbb6c58b5a61 ("net: amd-xgbe: Add Support for Yellow Carp Ethernet device")
    Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6ff29642fd28965a8f8d6d326ac91bf6075f3113
Author: Chang S. Bae <chang.seok.bae@intel.com>
Date:   Fri Oct 21 11:58:44 2022 -0700

    x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly
    
    [ Upstream commit 471f0aa7fa64e23766a1473b32d9ec3f0718895a ]
    
    When an extended state component is not present in fpstate, but in init
    state, the function copies from init_fpstate via copy_feature().
    
    But, dynamic states are not present in init_fpstate because of all-zeros
    init states. Then retrieving them from init_fpstate will explode like this:
    
     BUG: kernel NULL pointer dereference, address: 0000000000000000
     ...
     RIP: 0010:memcpy_erms+0x6/0x10
      ? __copy_xstate_to_uabi_buf+0x381/0x870
      fpu_copy_guest_fpstate_to_uabi+0x28/0x80
      kvm_arch_vcpu_ioctl+0x14c/0x1460 [kvm]
      ? __this_cpu_preempt_check+0x13/0x20
      ? vmx_vcpu_put+0x2e/0x260 [kvm_intel]
      kvm_vcpu_ioctl+0xea/0x6b0 [kvm]
      ? kvm_vcpu_ioctl+0xea/0x6b0 [kvm]
      ? __fget_light+0xd4/0x130
      __x64_sys_ioctl+0xe3/0x910
      ? debug_smp_processor_id+0x17/0x20
      ? fpregs_assert_state_consistent+0x27/0x50
      do_syscall_64+0x3f/0x90
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Adjust the 'mask' to zero out the userspace buffer for the features that
    are not available both from fpstate and from init_fpstate.
    
    The dynamic features depend on the compacted XSAVE format. Ensure it is
    enabled before reading XCOMP_BV in init_fpstate.
    
    Fixes: 2308ee57d93d ("x86/fpu/amx: Enable the AMX feature in 64-bit mode")
    Reported-by: Yuan Yao <yuan.yao@intel.com>
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Tested-by: Yuan Yao <yuan.yao@intel.com>
    Link: https://lore.kernel.org/lkml/BYAPR11MB3717EDEF2351C958F2C86EED95259@BYAPR11MB3717.namprd11.prod.outlook.com/
    Link: https://lkml.kernel.org/r/20221021185844.13472-1-chang.seok.bae@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0c2a107b26c8e1ee3dccf31b27d7752f3041028f
Author: Douglas Anderson <dianders@chromium.org>
Date:   Mon Oct 17 12:18:51 2022 -0700

    drm/bridge: ps8640: Add back the 50 ms mystery delay after HPD
    
    [ Upstream commit cb8e30ddb7e345867f6f2da8a08291d7d9e037db ]
    
    Back in commit 826cff3f7ebb ("drm/bridge: parade-ps8640: Enable
    runtime power management") we removed a mysterious 50 ms delay because
    "Parade's support [couldn't] explain what the delay [was] for".
    
    While I'm always a fan of removing mysterious delays, I suspect that
    we need this mysterious delay to avoid some problems.
    
    Specifically, what I found recently is that on sc7180-trogdor-homestar
    sometimes the AUX backlight wasn't initializing properly. Some
    debugging showed that the drm_dp_dpcd_read() function that the AUX
    backlight driver was calling was returning bogus data about 1% of the
    time when I booted up. This confused
    drm_panel_dp_aux_backlight(). From continued debugging:
    - If I retried the read then the read worked just fine.
    - If I added a loop to perform the same read that
      drm_panel_dp_aux_backlight() was doing 30 times at bootup I could
      see that some percentage of the time the first read would give bogus
      data but all 29 additional reads would always be fine.
    - If I added a large delay _after_ powering on the panel but before
      powering on PS8640 I could still reproduce the problem.
    - If I added a delay after PS8640 powered on then I couldn't reproduce
      the problem.
    - I couldn't reproduce the problem on a board with the same panel but
      the ti-sn65dsi86 bridge chip.
    
    To me, the above indicated that there was a problem with PS8640 and
    not the panel.
    
    I don't really have any insight into what's going on in the MCU, but
    my best guess is that when the MCU itself sees the HPD go high that it
    does some AUX transfers itself and this is confusing things.
    
    Let's go back and add back in the mysterious 50 ms delay. We only want
    to do this the first time we see HPD go high after booting the MCU,
    not every time we double-check HPD.
    
    With this, the backlight initializes reliably on homestar.
    
    Fixes: 826cff3f7ebb ("drm/bridge: parade-ps8640: Enable runtime power management")
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221017121813.1.I59700c745fbc31559a5d5c8e2a960279c751dbd5@changeid
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 671f399008a2138058536808ca54fd222d6c4b46
Author: Chen Zhongjin <chenzhongjin@huawei.com>
Date:   Wed Jul 27 11:15:06 2022 +0800

    x86/unwind/orc: Fix unreliable stack dump with gcov
    
    [ Upstream commit 230db82413c091bc16acee72650f48d419cebe49 ]
    
    When a console stack dump is initiated with CONFIG_GCOV_PROFILE_ALL
    enabled, show_trace_log_lvl() gets out of sync with the ORC unwinder,
    causing the stack trace to show all text addresses as unreliable:
    
      # echo l > /proc/sysrq-trigger
      [  477.521031] sysrq: Show backtrace of all active CPUs
      [  477.523813] NMI backtrace for cpu 0
      [  477.524492] CPU: 0 PID: 1021 Comm: bash Not tainted 6.0.0 #65
      [  477.525295] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-1.fc36 04/01/2014
      [  477.526439] Call Trace:
      [  477.526854]  <TASK>
      [  477.527216]  ? dump_stack_lvl+0xc7/0x114
      [  477.527801]  ? dump_stack+0x13/0x1f
      [  477.528331]  ? nmi_cpu_backtrace.cold+0xb5/0x10d
      [  477.528998]  ? lapic_can_unplug_cpu+0xa0/0xa0
      [  477.529641]  ? nmi_trigger_cpumask_backtrace+0x16a/0x1f0
      [  477.530393]  ? arch_trigger_cpumask_backtrace+0x1d/0x30
      [  477.531136]  ? sysrq_handle_showallcpus+0x1b/0x30
      [  477.531818]  ? __handle_sysrq.cold+0x4e/0x1ae
      [  477.532451]  ? write_sysrq_trigger+0x63/0x80
      [  477.533080]  ? proc_reg_write+0x92/0x110
      [  477.533663]  ? vfs_write+0x174/0x530
      [  477.534265]  ? handle_mm_fault+0x16f/0x500
      [  477.534940]  ? ksys_write+0x7b/0x170
      [  477.535543]  ? __x64_sys_write+0x1d/0x30
      [  477.536191]  ? do_syscall_64+0x6b/0x100
      [  477.536809]  ? entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [  477.537609]  </TASK>
    
    This happens when the compiled code for show_stack() has a single word
    on the stack, and doesn't use a tail call to show_stack_log_lvl().
    (CONFIG_GCOV_PROFILE_ALL=y is the only known case of this.)  Then the
    __unwind_start() skip logic hits an off-by-one bug and fails to unwind
    all the way to the intended starting frame.
    
    Fix it by reverting the following commit:
    
      f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
    
    The original justification for that commit no longer exists.  That
    original issue was later fixed in a different way, with the following
    commit:
    
      f2ac57a4c49d ("x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels")
    
    Fixes: f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
    Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
    [jpoimboe: rewrite commit log]
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ac1ca01c934ee3bf1c422030df4576d9439a452c
Author: Anup Patel <apatel@ventanamicro.com>
Date:   Fri Oct 21 11:52:45 2022 +0530

    RISC-V: KVM: Fix kvm_riscv_vcpu_timer_pending() for Sstc
    
    [ Upstream commit cea8896bd936135559253e9b23340cfa1cdf0caf ]
    
    The kvm_riscv_vcpu_timer_pending() checks per-VCPU next_cycles
    and per-VCPU software injected VS timer interrupt. This function
    returns incorrect value when Sstc is available because the per-VCPU
    next_cycles are only updated by kvm_riscv_vcpu_timer_save() called
    from kvm_arch_vcpu_put(). As a result, when Sstc is available the
    VCPU does not block properly upon WFI traps.
    
    To fix the above issue, we introduce kvm_riscv_vcpu_timer_sync()
    which will update per-VCPU next_cycles upon every VM exit instead
    of kvm_riscv_vcpu_timer_save().
    
    Fixes: 8f5cb44b1bae ("RISC-V: KVM: Support sstc extension")
    Signed-off-by: Anup Patel <apatel@ventanamicro.com>
    Reviewed-by: Atish Patra <atishp@rivosinc.com>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 45b7e231aa6e73ea8f59278077cd4b74ed97bbd9
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Fri Oct 21 11:52:39 2022 +0530

    RISC-V: Fix compilation without RISCV_ISA_ZICBOM
    
    [ Upstream commit 5c20a3a9df19811051441214e7f5091cb3546db0 ]
    
    riscv_cbom_block_size and riscv_init_cbom_blocksize() should always
    be available and riscv_init_cbom_blocksize() should always be
    invoked, even when compiling without RISCV_ISA_ZICBOM enabled. This
    is because disabling RISCV_ISA_ZICBOM means "don't use zicbom
    instructions in the kernel" not "pretend there isn't zicbom, even
    when there is". When zicbom is available, whether the kernel enables
    its use with RISCV_ISA_ZICBOM or not, KVM will offer it to guests.
    Ensure we can build KVM and that the block size is initialized even
    when compiling without RISCV_ISA_ZICBOM.
    
    Fixes: 8f7e001e0325 ("RISC-V: Clean up the Zicbom block size probing")
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Signed-off-by: Anup Patel <apatel@ventanamicro.com>
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Heiko Stuebner <heiko@sntech.de>
    Tested-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f5ac718855fa3e84a9be7c467abf4b17087c59c6
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Sun Oct 2 10:18:59 2022 +0530

    RISC-V: KVM: Provide UAPI for Zicbom block size
    
    [ Upstream commit afd5dde9a186b8fc5742fff707f184760c4af1a9 ]
    
    We're about to allow guests to use the Zicbom extension. KVM
    userspace needs to know the cache block size in order to
    properly advertise it to the guest. Provide a virtual config
    register for userspace to get it with the GET_ONE_REG API, but
    setting it cannot be supported, so disallow SET_ONE_REG.
    
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Atish Patra <atishp@rivosinc.com>
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Stable-dep-of: 5c20a3a9df19 ("RISC-V: Fix compilation without RISCV_ISA_ZICBOM")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2c46a9a5f0b1c7341aa67667801079f3ff571678
Author: Shang XiaoJing <shangxiaojing@huawei.com>
Date:   Thu Oct 20 11:05:05 2022 +0800

    nfc: virtual_ncidev: Fix memory leak in virtual_nci_send()
    
    [ Upstream commit e840d8f4a1b323973052a1af5ad4edafcde8ae3d ]
    
    skb should be free in virtual_nci_send(), otherwise kmemleak will report
    memleak.
    
    Steps for reproduction (simulated in qemu):
            cd tools/testing/selftests/nci
            make
            ./nci_dev
    
    BUG: memory leak
    unreferenced object 0xffff888107588000 (size 208):
      comm "nci_dev", pid 206, jiffies 4294945376 (age 368.248s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<000000008d94c8fd>] __alloc_skb+0x1da/0x290
        [<00000000278bc7f8>] nci_send_cmd+0xa3/0x350
        [<0000000081256a22>] nci_reset_req+0x6b/0xa0
        [<000000009e721112>] __nci_request+0x90/0x250
        [<000000005d556e59>] nci_dev_up+0x217/0x5b0
        [<00000000e618ce62>] nfc_dev_up+0x114/0x220
        [<00000000981e226b>] nfc_genl_dev_up+0x94/0xe0
        [<000000009bb03517>] genl_family_rcv_msg_doit.isra.14+0x228/0x2d0
        [<00000000b7f8c101>] genl_rcv_msg+0x35c/0x640
        [<00000000c94075ff>] netlink_rcv_skb+0x11e/0x350
        [<00000000440cfb1e>] genl_rcv+0x24/0x40
        [<0000000062593b40>] netlink_unicast+0x43f/0x640
        [<000000001d0b13cc>] netlink_sendmsg+0x73a/0xbf0
        [<000000003272487f>] __sys_sendto+0x324/0x370
        [<00000000ef9f1747>] __x64_sys_sendto+0xdd/0x1b0
        [<000000001e437841>] do_syscall_64+0x3f/0x90
    
    Fixes: e624e6c3e777 ("nfc: Add a virtual nci device driver")
    Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20221020030505.15572-1-shangxiaojing@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4c8904a8fc1dddc8d82b1b1458c8a90cff68939b
Author: Sergiu Moga <sergiu.moga@microchip.com>
Date:   Wed Oct 19 15:09:32 2022 +0300

    net: macb: Specify PHY PM management done by MAC
    
    [ Upstream commit 15a9dbec631cd69dfbbfc4e2cbf90c9dd8432a8f ]
    
    The `macb_resume`/`macb_suspend` methods already call the
    `phylink_start`/`phylink_stop` methods during their execution so
    explicitly say that the PM of the PHY is done by MAC by using the
    `mac_managed_pm` flag of the `struct phylink_config`.
    
    This also fixes the warning message issued during resume:
    WARNING: CPU: 0 PID: 237 at drivers/net/phy/phy_device.c:323 mdio_bus_phy_resume+0x144/0x148
    
    Depends-on: 96de900ae78e ("net: phylink: add mac_managed_pm in phylink_config structure")
    Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
    Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Link: https://lore.kernel.org/r/20221019120929.63098-1-sergiu.moga@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 840677a29299f17e347ca939a0390fe5297c7d5a
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 19 17:57:54 2022 +0800

    net: hinic: fix the issue of double release MBOX callback of VF
    
    [ Upstream commit 8ec2f4c6b2e11a4249bba77460f0cfe6d95a82f8 ]
    
    In hinic_vf_func_init(), if VF fails to register information with PF
    through the MBOX, the MBOX callback function of VF is released once. But
    it is released again in hinic_init_hwdev(). Remove one.
    
    Fixes: 7dd29ee12865 ("hinic: add sriov feature support")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9145d512ddff76df88832b29575488199df544a1
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 19 17:57:53 2022 +0800

    net: hinic: fix the issue of CMDQ memory leaks
    
    [ Upstream commit 363cc87767f6ddcfb9158ad2e2afa2f8d5c4b94e ]
    
    When hinic_set_cmdq_depth() fails in hinic_init_cmdqs(), the cmdq memory is
    not released correctly. Fix it.
    
    Fixes: 72ef908bb3ff ("hinic: add three net_device_ops of vf")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ee98ab337036c983239aa550850861c88a5c4262
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 19 17:57:52 2022 +0800

    net: hinic: fix memory leak when reading function table
    
    [ Upstream commit 4c1f602df8956bc0decdafd7e4fc7eef50c550b1 ]
    
    When the input parameter idx meets the expected case option in
    hinic_dbg_get_func_table(), read_data is not released. Fix it.
    
    Fixes: 5215e16244ee ("hinic: add support to query function table")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 12b2fa821df18930e9b068a9187f3812a47a3397
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Wed Oct 19 17:57:51 2022 +0800

    net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg()
    
    [ Upstream commit c0605cd6750f2db9890c43a91ea4d77be8fb4908 ]
    
    The value of lli_credit_cnt is incorrectly assigned, fix it.
    
    Fixes: a0337c0dee68 ("hinic: add support to set and get irq coalesce")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8df70d6ee3daf81203389da7a36f79273809a51a
Author: Benjamin Poirier <bpoirier@nvidia.com>
Date:   Wed Oct 19 18:10:42 2022 +0900

    selftests: net: Fix netdev name mismatch in cleanup
    
    [ Upstream commit b2c0921b926ca69cc399eb356162f35340598112 ]
    
    lag_lib.sh creates the interfaces dummy1 and dummy2 whereas
    dev_addr_lists.sh:destroy() deletes the interfaces dummy0 and dummy1. Fix
    the mismatch in names.
    
    Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management")
    Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
    Reviewed-by: Jonathan Toppins <jtoppins@redhat.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ae22b2fb3946b0731e3678820328359aa44ca668
Author: Benjamin Poirier <bpoirier@nvidia.com>
Date:   Wed Oct 19 18:10:41 2022 +0900

    selftests: net: Fix cross-tree inclusion of scripts
    
    [ Upstream commit ae108c48b5d2b34bcef3c4fb5076f42c922c426a ]
    
    When exporting and running a subset of selftests via kselftest, files from
    parts of the source tree which were not exported are not available. A few
    tests are trying to source such files. Address the problem by using
    symlinks.
    
    The problem can be reproduced by running:
    make -C tools/testing/selftests gen_tar TARGETS="drivers/net/bonding"
    [... extract archive ...]
    ./run_kselftest.sh
    
    or:
    make kselftest KBUILD_OUTPUT=/tmp/kselftests TARGETS="drivers/net/bonding"
    
    Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management")
    Fixes: eccd0a80dc7f ("selftests: net: dsa: add a stress test for unlocked FDB operations")
    Link: https://lore.kernel.org/netdev/40f04ded-0c86-8669-24b1-9a313ca21076@redhat.com/
    Reported-by: Jonathan Toppins <jtoppins@redhat.com>
    Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
    Reviewed-by: Jonathan Toppins <jtoppins@redhat.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 17b20911fb7b3e9c31f137dbdee6b4ab5fbb0a0f
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Wed Oct 19 10:30:56 2022 +0200

    net: lan966x: Fix the rx drop counter
    
    [ Upstream commit f8c1c66b99a570c08b9d26e4347276f00e49bba7 ]
    
    Currently the rx drop is calculated as the sum of multiple HW drop
    counters. The issue is that not all the HW drop counters were added for
    the rx drop counter. So if for example you have a police that drops
    frames, they were not see in the rx drop counter.
    Fix this by updating how the rx drop counter is calculated. It is
    required to add also RX_RED_PRIO_* HW counters.
    
    Fixes: 12c2d0a5b8e2 ("net: lan966x: add ethtool configuration and statistics")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Link: https://lore.kernel.org/r/20221019083056.2744282-1-horatiu.vultur@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 846e677daf51220d7975c61a20e440a88473951e
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Oct 19 14:41:04 2022 +0800

    net: netsec: fix error handling in netsec_register_mdio()
    
    [ Upstream commit 94423589689124e8cd145b38a1034be7f25835b2 ]
    
    If phy_device_register() fails, phy_device_free() need be called to
    put refcount, so memory of phy device and device name can be freed
    in callback function.
    
    If get_phy_device() fails, mdiobus_unregister() need be called,
    or it will cause warning in mdiobus_free() and kobject is leaked.
    
    Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221019064104.3228892-1-yangyingliang@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cedb41664e27b2cae7e21487f1bee22dcd84037d
Author: Xin Long <lucien.xin@gmail.com>
Date:   Tue Oct 18 15:19:50 2022 -0400

    tipc: fix a null-ptr-deref in tipc_topsrv_accept
    
    [ Upstream commit 82cb4e4612c633a9ce320e1773114875604a3cce ]
    
    syzbot found a crash in tipc_topsrv_accept:
    
      KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
      Workqueue: tipc_rcv tipc_topsrv_accept
      RIP: 0010:kernel_accept+0x22d/0x350 net/socket.c:3487
      Call Trace:
       <TASK>
       tipc_topsrv_accept+0x197/0x280 net/tipc/topsrv.c:460
       process_one_work+0x991/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e4/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
    
    It was caused by srv->listener that might be set to null by
    tipc_topsrv_stop() in net .exit whereas it's still used in
    tipc_topsrv_accept() worker.
    
    srv->listener is protected by srv->idr_lock in tipc_topsrv_stop(), so add
    a check for srv->listener under srv->idr_lock in tipc_topsrv_accept() to
    avoid the null-ptr-deref. To ensure the lsock is not released during the
    tipc_topsrv_accept(), move sock_release() after tipc_topsrv_work_stop()
    where it's waiting until the tipc_topsrv_accept worker to be done.
    
    Note that sk_callback_lock is used to protect sk->sk_user_data instead of
    srv->listener, and it should check srv in tipc_topsrv_listener_data_ready()
    instead. This also ensures that no more tipc_topsrv_accept worker will be
    started after tipc_conn_close() is called in tipc_topsrv_stop() where it
    sets sk->sk_user_data to null.
    
    Fixes: 0ef897be12b8 ("tipc: separate topology server listener socket from subcsriber sockets")
    Reported-by: syzbot+c5ce866a8d30f4be0651@syzkaller.appspotmail.com
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Acked-by: Jon Maloy <jmaloy@redhat.com>
    Link: https://lore.kernel.org/r/4eee264380c409c61c6451af1059b7fb271a7e7b.1666120790.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ff17ed27caf7cb16d8cd4f8bb2589525382fd604
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Thu Oct 20 10:58:14 2022 -0700

    rcu: Keep synchronize_rcu() from enabling irqs in early boot
    
    [ Upstream commit 31d8aaa87fcef1be5932f3813ea369e21bd3b11d ]
    
    Making polled RCU grace periods account for expedited grace periods
    required acquiring the leaf rcu_node structure's lock during early boot,
    but after rcu_init() was called.  This lock is irq-disabled, but the
    code incorrectly assumes that irqs are always disabled when invoking
    synchronize_rcu().  The exception is early boot before the scheduler has
    started, which means that upon return from synchronize_rcu(), irqs will
    be incorrectly enabled.
    
    This commit fixes this bug by using irqsave/irqrestore locking primitives.
    
    Fixes: bf95b2bc3e42 ("rcu: Switch polled grace-period APIs to ->gp_seq_polled")
    
    Reported-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e81e58a514b401d661f2773257f81fdb6f0e07fc
Author: Maxim Levitsky <mlevitsk@redhat.com>
Date:   Mon Jul 18 17:11:19 2022 +0300

    perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of clear_cpu_cap()
    
    [ Upstream commit b329f5ddc9ce4b622d9c7aaf5c6df4de52caf91a ]
    
    clear_cpu_cap(&boot_cpu_data) is very similar to setup_clear_cpu_cap()
    except that the latter also sets a bit in 'cpu_caps_cleared' which
    later clears the same cap in secondary cpus, which is likely what is
    meant here.
    
    Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR")
    Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
    Link: https://lkml.kernel.org/r/20220718141123.136106-2-mlevitsk@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c68b2e9ef246117f696e360bbdd2f5736b3a7127
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Oct 19 17:30:25 2022 +0800

    ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
    
    [ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]
    
    If device_register() fails in snd_ac97_dev_register(), it should
    call put_device() to give up reference, or the name allocated in
    dev_set_name() is leaked.
    
    Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5c8bc3938524b8e487fa2acc845a143b9f257dee
Author: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date:   Wed Oct 19 10:49:26 2022 -0500

    ASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor
    
    [ Upstream commit 05de5cf6fb7d73d2bf0a0c882433f31db5c93f63 ]
    
    ADL-N uses a different signing key, which means we can't reuse the
    regular ADL descriptor used for ADL-P/M/S.
    
    Fixes: cd57eb3c403cb ("ASoC: SOF: Intel: pci-tgl: add ADL-N support")
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Reviewed-by: Chao Song <chao.song@intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Link: https://lore.kernel.org/r/20221019154926.163539-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 22757b3f119563f6936e6d17032b395b7c90526a
Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Date:   Tue Aug 16 16:05:10 2022 +0300

    ASoC: SOF: Intel: pci-tgl: use RPL specific firmware definitions
    
    [ Upstream commit 63d375b9f2a99bb111e3fb5f3e2442a391988949 ]
    
    Split out firmware definitions for Intel Raptor Lake platforms.
    
    Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Suggested-by: Gopal Vamshi Krishna <vamshi.krishna.gopal@intel.com>
    Link: https://lore.kernel.org/r/20220816130510.190427-2-kai.vehmanen@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: 05de5cf6fb7d ("ASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dde19797bdf37432a87fe0753f9e85baa146a757
Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Date:   Tue Aug 16 16:05:09 2022 +0300

    ASoC: Intel: common: add ACPI matching tables for Raptor Lake
    
    [ Upstream commit 5f3db54cfbc21772d984372fdcc5bb17b57f425f ]
    
    Initial support for RPL w/ RT711
    
    Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Tested-by: Gopal Vamshi Krishna <vamshi.krishna.gopal@intel.com>
    Link: https://lore.kernel.org/r/20220816130510.190427-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: 05de5cf6fb7d ("ASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 279f04b82fe73e6bee3596fe4beece6c76c51605
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Sat Oct 15 14:48:50 2022 +0530

    ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile
    
    [ Upstream commit 1dd5166102e7ca91e8c5d833110333835e147ddb ]
    
    Update LPASS_HDMI_TX_PARITY_ADDR register as volatile, to fix
    dp audio failures observed with some of external monitors.
    
    Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
    
    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Link: https://lore.kernel.org/r/1665825530-7593-1-git-send-email-quic_srivasam@quicinc.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b9f0e9b43574f653e93e310aa2aa3ef96f51bcac
Author: Cédric Le Goater <clg@kaod.org>
Date:   Sun Oct 16 17:57:22 2022 +0200

    spi: aspeed: Fix window offset of CE1
    
    [ Upstream commit f8aa6c895d482847c9b799dcdac8bbdb56cb8e04 ]
    
    The offset value of the mapping window in the kernel structure is
    calculated using the value of the previous window offset. This doesn't
    reflect how the HW is configured and can lead to erroneous setting of
    the second flash device (CE1).
    
    Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
    Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem")
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Joel Stanley <joel@jms.id.au>
    Link: https://lore.kernel.org/r/20221016155722.3520802-1-clg@kaod.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit afbb36c6721844a450e3ff86c7017072a337a565
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Mon Oct 10 09:42:07 2022 +0200

    selftests/ftrace: fix dynamic_events dependency check
    
    [ Upstream commit cb05c81ada76a30a25a5f79b249375e33473af33 ]
    
    commit 95c104c378dc ("tracing: Auto generate event name when creating a
    group of events") changed the syntax in the ftrace README file which is
    used by the selftests to check what features are support. Adjust the
    string to make test_duplicates.tc and trigger-synthetic-eprobe.tc work
    again.
    
    Fixes: 95c104c378dc ("tracing: Auto generate event name when creating a group of events")
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 460058927905d95a29ff4824aeabec2657bfb2be
Author: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date:   Mon Oct 17 15:40:04 2022 -0500

    ASoC: SOF: Intel: pci-mtl: fix firmware name
    
    [ Upstream commit 73189c064e11137c8b78a825800a374924ebb7b7 ]
    
    Initial IPC4 tests used the same conventions as previous reference
    closed-source firmware, but for MeteorLake the convention is the same
    as previous SOF releases (sof-<platform>.ri). Only the prefix changes
    to avoid confusions between IPC types.
    
    This change has no impact on users since the firmware has not yet been
    released.
    
    Fixes: 064520e8aeaa2 ("ASoC: SOF: Intel: Add support for MeteorLake (MTL)")
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Reviewed-by: Chao Song <chao.song@intel.com>
    Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Link: https://lore.kernel.org/r/20221017204004.207446-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 449a940434f066df72dbabd29001c700be835edb
Author: Geert Uytterhoeven <geert@linux-m68k.org>
Date:   Sun Oct 16 10:33:50 2022 +0200

    ASoC: codecs: tlv320adc3xxx: Wrap adc3xxx_i2c_remove() in __exit_p()
    
    [ Upstream commit 4e8ff35878685291978b93543d6b9e9290be770a ]
    
    If CONFIG_SND_SOC_TLV320ADC3XXX=y:
    
        `.exit.text' referenced in section `.data' of sound/soc/codecs/tlv320adc3xxx.o: defined in discarded section `.exit.text' of sound/soc/codecs/tlv320adc3xxx.o
    
    Fix this by wrapping the adc3xxx_i2c_remove() pointer in __exit_p().
    
    Fixes: e9a3b57efd28fe88 ("ASoC: codec: tlv320adc3xxx: New codec driver")
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/r/3225ba4cfe558d9380155e75385954dd21d4e7eb.1665909132.git.geert@linux-m68k.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 06e84176dd53101100ddfd0bd3f64d050a53a032
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Tue Oct 18 09:09:59 2022 +0200

    pinctrl: ocelot: Fix incorrect trigger of the interrupt.
    
    [ Upstream commit e9945b2633deccda74a769d94060df49c53ff181 ]
    
    The interrupt controller can detect only link changes. So in case an
    external device generated a level based interrupt, then the interrupt
    controller detected correctly the first edge. But the problem was that
    the interrupt controller was detecting also the edge when the interrupt
    was cleared. So it would generate another interrupt.
    The fix for this is to clear the second interrupt but still check the
    interrupt line status.
    
    Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Tested-by: Michael Walle <michael@walle.cc>
    Link: https://lore.kernel.org/r/20221018070959.1322606-1-horatiu.vultur@microchip.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cb9aa46bba58f6c0f5aed48016c2fbda349da30d
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Sat Sep 24 21:10:10 2022 +0800

    mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe()
    
    [ Upstream commit 1f3b494d1fc18ebb37aaa47107e9b84bf5b54ff7 ]
    
    The 'chip_np' returned by of_get_next_child() with refcount decremented,
    of_node_put() need be called in error path to decrease the refcount.
    
    Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220924131010.957117-1-yangyingliang@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b56f6103ea68d79fca38229b1e1b203ce9967af1
Author: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date:   Sun Jul 3 01:12:27 2022 +0200

    mtd: rawnand: intel: Use devm_platform_ioremap_resource_byname()
    
    [ Upstream commit 7471a53ddce54cee9b7a340dc930eb35b02c9eed ]
    
    Switch from open-coded platform_get_resource_byname() and
    devm_ioremap_resource() to devm_platform_ioremap_resource_byname() where
    possible to simplify the code.
    
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-9-martin.blumenstingl@googlemail.com
    Stable-dep-of: 1f3b494d1fc1 ("mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 03c762b88eeea5ac587c5640a47d7ae9ce8c3764
Author: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date:   Sun Jul 3 01:12:25 2022 +0200

    mtd: rawnand: intel: Remove unused nand_pa member from ebu_nand_cs
    
    [ Upstream commit dbe5f7880fb020f1984f72105189e877bd2c808c ]
    
    The nand_pa member from struct ebu_nand_cs is only written but never
    read. Remove this unused and unneeded member.
    
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-7-martin.blumenstingl@googlemail.com
    Stable-dep-of: 1f3b494d1fc1 ("mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9e54ce00505d291ef88f2c05e5eef46269daf83c
Author: Rafał Miłecki <rafal@milecki.pl>
Date:   Tue Oct 18 07:18:22 2022 +0200

    mtd: core: add missing of_node_get() in dynamic partitions code
    
    [ Upstream commit 12b58961de0bd88b3c7dfa5d21f6d67f4678b780 ]
    
    This fixes unbalanced of_node_put():
    [    1.078910] 6 cmdlinepart partitions found on MTD device gpmi-nand
    [    1.085116] Creating 6 MTD partitions on "gpmi-nand":
    [    1.090181] 0x000000000000-0x000008000000 : "nandboot"
    [    1.096952] 0x000008000000-0x000009000000 : "nandfit"
    [    1.103547] 0x000009000000-0x00000b000000 : "nandkernel"
    [    1.110317] 0x00000b000000-0x00000c000000 : "nanddtb"
    [    1.115525] ------------[ cut here ]------------
    [    1.120141] refcount_t: addition on 0; use-after-free.
    [    1.125328] WARNING: CPU: 0 PID: 1 at lib/refcount.c:25 refcount_warn_saturate+0xdc/0x148
    [    1.133528] Modules linked in:
    [    1.136589] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc7-next-20220930-04543-g8cf3f7
    [    1.146342] Hardware name: Freescale i.MX8DXL DDR3L EVK (DT)
    [    1.151999] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    1.158965] pc : refcount_warn_saturate+0xdc/0x148
    [    1.163760] lr : refcount_warn_saturate+0xdc/0x148
    [    1.168556] sp : ffff800009ddb080
    [    1.171866] x29: ffff800009ddb080 x28: ffff800009ddb35a x27: 0000000000000002
    [    1.179015] x26: ffff8000098b06ad x25: ffffffffffffffff x24: ffff0a00ffffff05
    [    1.186165] x23: ffff00001fdf6470 x22: ffff800009ddb367 x21: 0000000000000000
    [    1.193314] x20: ffff00001fdfebe8 x19: ffff00001fdfec50 x18: ffffffffffffffff
    [    1.200464] x17: 0000000000000000 x16: 0000000000000118 x15: 0000000000000004
    [    1.207614] x14: 0000000000000fff x13: ffff800009bca248 x12: 0000000000000003
    [    1.214764] x11: 00000000ffffefff x10: c0000000ffffefff x9 : 4762cb2ccb52de00
    [    1.221914] x8 : 4762cb2ccb52de00 x7 : 205d313431303231 x6 : 312e31202020205b
    [    1.229063] x5 : ffff800009d55c1f x4 : 0000000000000001 x3 : 0000000000000000
    [    1.236213] x2 : 0000000000000000 x1 : ffff800009954be6 x0 : 000000000000002a
    [    1.243365] Call trace:
    [    1.245806]  refcount_warn_saturate+0xdc/0x148
    [    1.250253]  kobject_get+0x98/0x9c
    [    1.253658]  of_node_get+0x20/0x34
    [    1.257072]  of_fwnode_get+0x3c/0x54
    [    1.260652]  fwnode_get_nth_parent+0xd8/0xf4
    [    1.264926]  fwnode_full_name_string+0x3c/0xb4
    [    1.269373]  device_node_string+0x498/0x5b4
    [    1.273561]  pointer+0x41c/0x5d0
    [    1.276793]  vsnprintf+0x4d8/0x694
    [    1.280198]  vprintk_store+0x164/0x528
    [    1.283951]  vprintk_emit+0x98/0x164
    [    1.287530]  vprintk_default+0x44/0x6c
    [    1.291284]  vprintk+0xf0/0x134
    [    1.294428]  _printk+0x54/0x7c
    [    1.297486]  of_node_release+0xe8/0x128
    [    1.301326]  kobject_put+0x98/0xfc
    [    1.304732]  of_node_put+0x1c/0x28
    [    1.308137]  add_mtd_device+0x484/0x6d4
    [    1.311977]  add_mtd_partitions+0xf0/0x1d0
    [    1.316078]  parse_mtd_partitions+0x45c/0x518
    [    1.320439]  mtd_device_parse_register+0xb0/0x274
    [    1.325147]  gpmi_nand_probe+0x51c/0x650
    [    1.329074]  platform_probe+0xa8/0xd0
    [    1.332740]  really_probe+0x130/0x334
    [    1.336406]  __driver_probe_device+0xb4/0xe0
    [    1.340681]  driver_probe_device+0x3c/0x1f8
    [    1.344869]  __driver_attach+0xdc/0x1a4
    [    1.348708]  bus_for_each_dev+0x80/0xcc
    [    1.352548]  driver_attach+0x24/0x30
    [    1.356127]  bus_add_driver+0x108/0x1f4
    [    1.359967]  driver_register+0x78/0x114
    [    1.363807]  __platform_driver_register+0x24/0x30
    [    1.368515]  gpmi_nand_driver_init+0x1c/0x28
    [    1.372798]  do_one_initcall+0xbc/0x238
    [    1.376638]  do_initcall_level+0x94/0xb4
    [    1.380565]  do_initcalls+0x54/0x94
    [    1.384058]  do_basic_setup+0x1c/0x28
    [    1.387724]  kernel_init_freeable+0x110/0x188
    [    1.392084]  kernel_init+0x20/0x1a0
    [    1.395578]  ret_from_fork+0x10/0x20
    [    1.399157] ---[ end trace 0000000000000000 ]---
    [    1.403782] ------------[ cut here ]------------
    
    Reported-by: Han Xu <han.xu@nxp.com>
    Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions")
    Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
    Tested-by: Han Xu <han.xu@nxp.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20221018051822.28685-1-zajec5@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 033ffa156be43c7f260a01ced43e964b523de38f
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Sun Oct 9 19:28:46 2022 -0700

    arc: iounmap() arg is volatile
    
    [ Upstream commit c44f15c1c09481d50fd33478ebb5b8284f8f5edb ]
    
    Add 'volatile' to iounmap()'s argument to prevent build warnings.
    This make it the same as other major architectures.
    
    Placates these warnings: (12 such warnings)
    
    ../drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe':
    ../drivers/video/fbdev/riva/fbdev.c:2067:42: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Werror=discarded-qualifiers]
     2067 |                 iounmap(default_par->riva.PRAMIN);
    
    Fixes: 1162b0701b14b ("ARC: I/O and DMA Mappings")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: Vineet Gupta <vgupta@kernel.org>
    Cc: linux-snps-arc@lists.infradead.org
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Vineet Gupta <vgupta@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e9dbb4c539d058852b76937dcd7347d3f38054f2
Author: Stanislav Fomichev <sdf@google.com>
Date:   Fri Oct 14 17:24:44 2022 -0700

    bpf: prevent decl_tag from being referenced in func_proto
    
    [ Upstream commit ea68376c8bed5cd156900852aada20c3a0874d17 ]
    
    Syzkaller was able to hit the following issue:
    
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 3609 at kernel/bpf/btf.c:1946
    btf_type_id_size+0x2d5/0x9d0 kernel/bpf/btf.c:1946
    Modules linked in:
    CPU: 0 PID: 3609 Comm: syz-executor361 Not tainted
    6.0.0-syzkaller-02734-g0326074ff465 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 09/22/2022
    RIP: 0010:btf_type_id_size+0x2d5/0x9d0 kernel/bpf/btf.c:1946
    Code: ef e8 7f 8e e4 ff 41 83 ff 0b 77 28 f6 44 24 10 18 75 3f e8 6d 91
    e4 ff 44 89 fe bf 0e 00 00 00 e8 20 8e e4 ff e8 5b 91 e4 ff <0f> 0b 45
    31 f6 e9 98 02 00 00 41 83 ff 12 74 18 e8 46 91 e4 ff 44
    RSP: 0018:ffffc90003cefb40 EFLAGS: 00010293
    RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
    RDX: ffff8880259c0000 RSI: ffffffff81968415 RDI: 0000000000000005
    RBP: ffff88801270ca00 R08: 0000000000000005 R09: 000000000000000e
    R10: 0000000000000011 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000011 R14: ffff888026ee6424 R15: 0000000000000011
    FS:  000055555641b300(0000) GS:ffff8880b9a00000(0000)
    knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000f2e258 CR3: 000000007110e000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     btf_func_proto_check kernel/bpf/btf.c:4447 [inline]
     btf_check_all_types kernel/bpf/btf.c:4723 [inline]
     btf_parse_type_sec kernel/bpf/btf.c:4752 [inline]
     btf_parse kernel/bpf/btf.c:5026 [inline]
     btf_new_fd+0x1926/0x1e70 kernel/bpf/btf.c:6892
     bpf_btf_load kernel/bpf/syscall.c:4324 [inline]
     __sys_bpf+0xb7d/0x4cf0 kernel/bpf/syscall.c:5010
     __do_sys_bpf kernel/bpf/syscall.c:5069 [inline]
     __se_sys_bpf kernel/bpf/syscall.c:5067 [inline]
     __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5067
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f0fbae41c69
    Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89
    f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
    f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007ffc8aeb6228 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0fbae41c69
    RDX: 0000000000000020 RSI: 0000000020000140 RDI: 0000000000000012
    RBP: 00007f0fbae05e10 R08: 0000000000000000 R09: 0000000000000000
    R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f0fbae05ea0
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
     </TASK>
    
    Looks like it tries to create a func_proto which return type is
    decl_tag. For the details, see Martin's spot on analysis in [0].
    
    0: https://lore.kernel.org/bpf/CAKH8qBuQDLva_hHxxBuZzyAcYNO4ejhovz6TQeVSk8HY-2SO6g@mail.gmail.com/T/#mea6524b3fcd6298347432226e81b1e6155efc62c
    
    Cc: Yonghong Song <yhs@fb.com>
    Cc: Martin KaFai Lau <martin.lau@kernel.org>
    Fixes: bd16dee66ae4 ("bpf: Add BTF_KIND_DECL_TAG typedef support")
    Reported-by: syzbot+d8bd751aef7c6b39a344@syzkaller.appspotmail.com
    Signed-off-by: Stanislav Fomichev <sdf@google.com>
    Acked-by: Yonghong Song <yhs@fb.com>
    Link: https://lore.kernel.org/r/20221015002444.2680969-2-sdf@google.com
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3ebae5649fe8a1ca41a0a9c83b5e6d93bdbbff87
Author: Lin Shengwang <linshengwang1@huawei.com>
Date:   Sat Oct 8 10:27:09 2022 +0800

    sched/core: Fix comparison in sched_group_cookie_match()
    
    [ Upstream commit e705968dd687574b6ca3ebe772683d5642759132 ]
    
    In commit 97886d9dcd86 ("sched: Migration changes for core scheduling"),
    sched_group_cookie_match() was added to help determine if a cookie
    matches the core state.
    
    However, while it iterates the SMT group, it fails to actually use the
    RQ for each of the CPUs iterated, use cpu_rq(cpu) instead of rq to fix
    things.
    
    Fixes: 97886d9dcd86 ("sched: Migration changes for core scheduling")
    Signed-off-by: Lin Shengwang <linshengwang1@huawei.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20221008022709.642-1-linshengwang1@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 078c12ccf1fb943cc18c84894c76113dc89e5975
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Thu Oct 6 15:00:39 2022 +0200

    perf: Fix missing SIGTRAPs
    
    [ Upstream commit ca6c21327c6af02b7eec31ce4b9a740a18c6c13f ]
    
    Marco reported:
    
    Due to the implementation of how SIGTRAP are delivered if
    perf_event_attr::sigtrap is set, we've noticed 3 issues:
    
      1. Missing SIGTRAP due to a race with event_sched_out() (more
         details below).
    
      2. Hardware PMU events being disabled due to returning 1 from
         perf_event_overflow(). The only way to re-enable the event is
         for user space to first "properly" disable the event and then
         re-enable it.
    
      3. The inability to automatically disable an event after a
         specified number of overflows via PERF_EVENT_IOC_REFRESH.
    
    The worst of the 3 issues is problem (1), which occurs when a
    pending_disable is "consumed" by a racing event_sched_out(), observed
    as follows:
    
                    CPU0                    |       CPU1
            --------------------------------+---------------------------
            __perf_event_overflow()         |
             perf_event_disable_inatomic()  |
              pending_disable = CPU0        | ...
                                            | _perf_event_enable()
                                            |  event_function_call()
                                            |   task_function_call()
                                            |    /* sends IPI to CPU0 */
            <IPI>                           | ...
             __perf_event_enable()          +---------------------------
              ctx_resched()
               task_ctx_sched_out()
                ctx_sched_out()
                 group_sched_out()
                  event_sched_out()
                   pending_disable = -1
            </IPI>
            <IRQ-work>
             perf_pending_event()
              perf_pending_event_disable()
               /* Fails to send SIGTRAP because no pending_disable! */
            </IRQ-work>
    
    In the above case, not only is that particular SIGTRAP missed, but also
    all future SIGTRAPs because 'event_limit' is not reset back to 1.
    
    To fix, rework pending delivery of SIGTRAP via IRQ-work by introduction
    of a separate 'pending_sigtrap', no longer using 'event_limit' and
    'pending_disable' for its delivery.
    
    Additionally; and different to Marco's proposed patch:
    
     - recognise that pending_disable effectively duplicates oncpu for
       the case where it is set. As such, change the irq_work handler to
       use ->oncpu to target the event and use pending_* as boolean toggles.
    
     - observe that SIGTRAP targets the ctx->task, so the context switch
       optimization that carries contexts between tasks is invalid. If
       the irq_work were delayed enough to hit after a context switch the
       SIGTRAP would be delivered to the wrong task.
    
     - observe that if the event gets scheduled out
       (rotation/migration/context-switch/...) the irq-work would be
       insufficient to deliver the SIGTRAP when the event gets scheduled
       back in (the irq-work might still be pending on the old CPU).
    
       Therefore have event_sched_out() convert the pending sigtrap into a
       task_work which will deliver the signal at return_to_user.
    
    Fixes: 97ba62b27867 ("perf: Add support for SIGTRAP on perf events")
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Debugged-by: Dmitry Vyukov <dvyukov@google.com>
    Reported-by: Marco Elver <elver@google.com>
    Debugged-by: Marco Elver <elver@google.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Marco Elver <elver@google.com>
    Tested-by: Marco Elver <elver@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3f7e637592dabcdde92ec8dc8f1cd05094f92b04
Author: Chang S. Bae <chang.seok.bae@intel.com>
Date:   Wed Aug 24 12:12:23 2022 -0700

    x86/fpu: Exclude dynamic states from init_fpstate
    
    [ Upstream commit a401f45e38754953c9d402f8b3bc965707eecc91 ]
    
    == Background ==
    
    The XSTATE init code initializes all enabled and supported components.
    Then, the init states are saved in the init_fpstate buffer that is
    statically allocated in about one page.
    
    The AMX TILE_DATA state is large (8KB) but its init state is zero. And the
    feature comes only with the compacted format with these established
    dependencies: AMX->XFD->XSAVES. So this state is excludable from
    init_fpstate.
    
    == Problem ==
    
    But the buffer is formatted to include that large state. Then, this can be
    the cause of a noisy splat like the below.
    
    This came from XRSTORS for the task with init_fpstate in its XSAVE buffer.
    It is reproducible on AMX systems when the running kernel is built with
    CONFIG_DEBUG_PAGEALLOC=y and CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT=y:
    
     Bad FPU state detected at restore_fpregs_from_fpstate+0x57/0xd0, reinitializing FPU registers.
     ...
     RIP: 0010:restore_fpregs_from_fpstate+0x57/0xd0
      ? restore_fpregs_from_fpstate+0x45/0xd0
      switch_fpu_return+0x4e/0xe0
      exit_to_user_mode_prepare+0x17b/0x1b0
      syscall_exit_to_user_mode+0x29/0x40
      do_syscall_64+0x67/0x80
      ? do_syscall_64+0x67/0x80
      ? exc_page_fault+0x86/0x180
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    == Solution ==
    
    Adjust init_fpstate to exclude dynamic states. XRSTORS from init_fpstate
    still initializes those states when their bits are set in the
    requested-feature bitmap.
    
    Fixes: 2308ee57d93d ("x86/fpu/amx: Enable the AMX feature in 64-bit mode")
    Reported-by: Lin X Wang <lin.x.wang@intel.com>
    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Lin X Wang <lin.x.wang@intel.com>
    Link: https://lore.kernel.org/r/20220824191223.1248-4-chang.seok.bae@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 642029d85eebeb4ac006636aa4a4f8ca57e65995
Author: Chang S. Bae <chang.seok.bae@intel.com>
Date:   Wed Aug 24 12:12:22 2022 -0700

    x86/fpu: Fix the init_fpstate size check with the actual size
    
    [ Upstream commit d3e021adac7c51a26d9ede167c789fcc1b878467 ]
    
    The init_fpstate buffer is statically allocated. Thus, the sanity test was
    established to check whether the pre-allocated buffer is enough for the
    calculated size or not.
    
    The currently measured size is not strictly relevant. Fix to validate the
    calculated init_fpstate size with the pre-allocated area.
    
    Also, replace the sanity check function with open code for clarity. The
    abstraction itself and the function naming do not tend to represent simply
    what it does.
    
    Fixes: 2ae996e0c1a3 ("x86/fpu: Calculate the default sizes independently")
    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220824191223.1248-3-chang.seok.bae@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c4f98c0af568aa9ea96a429f21fa108f5d76b325
Author: Chang S. Bae <chang.seok.bae@intel.com>
Date:   Wed Aug 24 12:12:21 2022 -0700

    x86/fpu: Configure init_fpstate attributes orderly
    
    [ Upstream commit c32d7cab57e3a77af8ecc17cde7a5761a26483b8 ]
    
    The init_fpstate setup code is spread out and out of order. The init image
    is recorded before its scoped features and the buffer size are determined.
    
    Determine the scope of init_fpstate components and its size before
    recording the init state. Also move the relevant code together.
    
    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: neelnatu@google.com
    Link: https://lore.kernel.org/r/20220824191223.1248-2-chang.seok.bae@intel.com
    Stable-dep-of: d3e021adac7c ("x86/fpu: Fix the init_fpstate size check with the actual size")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 32f837b103ccdd2e130687fa5bb0f3661e98a156
Author: Robert Marko <robert.marko@sartura.hr>
Date:   Thu Oct 6 21:48:19 2022 +0200

    spi: qup: support using GPIO as chip select line
    
    [ Upstream commit b40af6183b685b0cf7870987b858de0d48db9ea0 ]
    
    Most of the device with QUP SPI adapter are actually using GPIO-s for
    chip select.
    
    However, this stopped working after ("spi: Retire legacy GPIO handling")
    as it introduced a check on ->use_gpio_descriptors flag and since spi-qup
    driver does not set the flag it meant that all of boards using GPIO-s and
    with QUP adapter SPI devices stopped working.
    
    So, to enable using GPIO-s again set ->use_gpio_descriptors to true and
    populate ->max_native_cs.
    
    Fixes: f48dc6b96649 ("spi: Retire legacy GPIO handling")
    Signed-off-by: Robert Marko <robert.marko@sartura.hr>
    Cc: luka.perkov@sartura.hr
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Link: https://lore.kernel.org/r/20221006194819.1536932-1-robert.marko@sartura.hr
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80dcb581c45549740b3adb753f3e731197774932
Author: Douglas Anderson <dianders@chromium.org>
Date:   Fri Oct 14 10:33:18 2022 -0700

    pinctrl: qcom: Avoid glitching lines when we first mux to output
    
    [ Upstream commit d21f4b7ffc22c009da925046b69b15af08de9d75 ]
    
    Back in the description of commit e440e30e26dd ("arm64: dts: qcom:
    sc7180: Avoid glitching SPI CS at bootup on trogdor") we described a
    problem that we were seeing on trogdor devices. I'll re-summarize here
    but you can also re-read the original commit.
    
    On trogdor devices, the BIOS is setting up the SPI chip select as:
    - mux special function (SPI chip select)
    - output enable
    - output low (unused because we've muxed as special function)
    
    In the kernel, however, we've moved away from using the chip select
    line as special function. Since the kernel wants to fully control the
    chip select it's far more efficient to treat the line as a GPIO rather
    than sending packet-like commands to the GENI firmware every time we
    want the line to toggle.
    
    When we transition from how the BIOS had the pin configured to how the
    kernel has the pin configured we end up glitching the line. That's
    because we _first_ change the mux of the line and then later set its
    output. This glitch is bad and can confuse the device on the other end
    of the line.
    
    The old commit e440e30e26dd ("arm64: dts: qcom: sc7180: Avoid
    glitching SPI CS at bootup on trogdor") fixed the glitch, though the
    solution was far from elegant. It essentially did the thing that
    everyone always hates: encoding a sequential program in device tree,
    even if it's a simple one. It also, unfortunately, got broken by
    commit b991f8c3622c ("pinctrl: core: Handling pinmux and pinconf
    separately"). After that commit we did all the muxing _first_ even
    though the config (set the pin to output high) was listed first. :(
    
    I looked at ideas for how to solve this more properly. My first
    thought was to use the "init" pinctrl state. In theory the "init"
    pinctrl state is supposed to be exactly for achieving glitch-free
    transitions. My dream would have been for the "init" pinctrl to do
    nothing at all. That would let us delay the automatic pin muxing until
    the driver could set things up and call pinctrl_init_done(). In other
    words, my dream was:
    
      /* Request the GPIO; init it 1 (because DT says GPIO_ACTIVE_LOW) */
      devm_gpiod_get_index(dev, "cs", GPIOD_OUT_LOW);
      /* Output should be right, so we can remux, yay! */
      pinctrl_init_done(dev);
    
    Unfortunately, it didn't work out. The primary reason is that the MSM
    GPIO driver implements gpio_request_enable(). As documented in
    pinmux.h, that function automatically remuxes a line as a GPIO. ...and
    it does this remuxing _before_ specifying the output of the pin. You
    can see in gpiod_get_index() that we call gpiod_request() before
    gpiod_configure_flags(). gpiod_request() isn't passed any flags so it
    has no idea what the eventual output will be.
    
    We could have debates about whether or not the automatic remuxing to
    GPIO for the MSM pinctrl was a good idea or not, but at this point I
    think there is a plethora of code that's relying on it and I certainly
    wouldn't suggest changing it.
    
    Alternatively, we could try to come up with a way to pass the initial
    output state to gpio_request_enable() and plumb all that through. That
    seems like it would be doable, but we'd have to plumb it through
    several layers in the stack.
    
    This patch implements yet another alternative. Here, we specifically
    avoid glitching the first time a pin is muxed to GPIO function if the
    direction of the pin is output. The idea is that we can read the state
    of the pin before we set the mux and make sure that the re-mux won't
    change the state.
    
    NOTES:
    - We only do this the first time since later swaps between mux states
      might want to preserve the old output value. In other words, I
      wouldn't want to break a driver that did:
         gpiod_set_value(g, 1);
         pinctrl_select_state(pinctrl, special_state);
         pinctrl_select_default_state();
         /* We should be driving 1 even if "special_state" made the pin 0 */
    - It's safe to do this the first time since the driver _couldn't_ have
      explicitly set a state. In order to even be able to control the GPIO
      (at least using gpiod) we have to have requested it which would have
      counted as the first mux.
    - In theory, instead of keeping track of the first time a pin was set
      as a GPIO we could enable the glitch-free behavior only when
      msm_pinmux_request_gpio() is in the callchain. That works an enables
      my "dream" implementation above where we use an "init" state to
      solve this. However, it's nice not to have to do this. By handling
      just the first transition to GPIO we can simply let the normal
      "default" remuxing happen and we can be assured that there won't be
      a glitch.
    
    Before this change I could see the glitch reported on the EC console
    when booting. It would say this when booting the kernel:
      Unexpected state 1 in CSNRE ISR
    
    After this change there is no error reported.
    
    Note that I haven't reproduced the original problem described in
    e440e30e26dd ("arm64: dts: qcom: sc7180: Avoid glitching SPI CS at
    bootup on trogdor") but I could believe it might happen in certain
    timing conditions.
    
    Fixes: b991f8c3622c ("pinctrl: core: Handling pinmux and pinconf separately")
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Link: https://lore.kernel.org/r/20221014103217.1.I656bb2c976ed626e5d37294eb252c1cf3be769dc@changeid
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 913fd33114e79561bc8626405ebbd831f7068d87
Author: Gao Xiang <xiang@kernel.org>
Date:   Fri Oct 14 14:49:15 2022 +0800

    erofs: fix up inplace decompression success rate
    
    [ Upstream commit e7933278b442f97809b1ea84264586302bd08a03 ]
    
    Partial decompression should be checked after updating length.
    It's a new regression when introducing multi-reference pclusters.
    
    Fixes: 2bfab9c0edac ("erofs: record the longest decompressed size in this round")
    Reviewed-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20221014064915.8103-1-hsiangkao@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0f0fedc9bceb292075894fa16bff89f821f3eced
Author: Yue Hu <huyue2@coolpad.com>
Date:   Wed Oct 5 09:35:28 2022 +0800

    erofs: fix illegal unmapped accesses in z_erofs_fill_inode_lazy()
    
    [ Upstream commit 664609e49f1c84fc97987b2bf64544e586b8849c ]
    
    Note that we are still accessing 'h_idata_size' and 'h_fragmentoff'
    after calling erofs_put_metabuf(), that is not correct. Fix it.
    
    Fixes: ab92184ff8f1 ("erofs: add on-disk compressed tail-packing inline support")
    Fixes: b15b2e307c3a ("erofs: support on-disk compressed fragments data")
    Signed-off-by: Yue Hu <huyue2@coolpad.com>
    Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Reviewed-by: Chao Yu <chao@kernel.org>
    Link: https://lore.kernel.org/r/20221005013528.62977-1-zbestahu@163.com
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4b1bbc0571a5d7ee10f754186dc3d619b9ced5c1
Author: Rob Clark <robdclark@chromium.org>
Date:   Thu Oct 13 15:55:13 2022 -0700

    drm/msm/a6xx: Fix kvzalloc vs state_kcalloc usage
    
    [ Upstream commit 83d18e9d9c0150d98dc24e3642ea93f5e245322c ]
    
    adreno_show_object() is a trap!  It will re-allocate the pointer it is
    passed on first call, when the data is ascii85 encoded, using kvmalloc/
    kvfree().  Which means the data *passed* to it must be kvmalloc'd, ie.
    we cannot use the state_kcalloc() helper.
    
    This partially reverts commit ec8f1813bf8d ("drm/msm/a6xx: Replace
    kcalloc() with kvzalloc()"), but adds the missing kvfree() to fix the
    memory leak that was present previously.  And adds a warning comment.
    
    Fixes: ec8f1813bf8d ("drm/msm/a6xx: Replace kcalloc() with kvzalloc()")
    Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/20
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
    Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/507014/
    Link: https://lore.kernel.org/r/20221013225520.371226-2-robdclark@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0a7833ad904788283993c5fa2d7c34cbafec385f
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Thu Oct 13 10:38:31 2022 +0530

    ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile
    
    [ Upstream commit c9a3545b1d771fb7b06a487796c40288c02c41c5 ]
    
    Update HDMI volatile registers list as DMA, Channel Selection registers,
    vbit control registers are being reflected by hardware DP port
    disconnection.
    
    This update is required to fix no display and no sound issue observed
    after reconnecting TAMA/SANWA DP cables.
    Once DP cable is unplugged, DMA control registers are being reset by
    hardware, however at second plugin, new dma control values does not
    updated to the dma hardware registers since new register value and
    cached values at the time of first plugin are same.
    
    Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
    
    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reported-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Link: https://lore.kernel.org/r/1665637711-13300-1-git-send-email-quic_srivasam@quicinc.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 29f3284393bc214a72f6b33ab78be458b5ade23b
Author: Gavin Shan <gshan@redhat.com>
Date:   Thu Oct 13 14:30:20 2022 +0800

    KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test
    
    [ Upstream commit 05c2224d4b049406b0545a10be05280ff4b8ba0a ]
    
    It's required by vm_userspace_mem_region_add() that memory size
    should be aligned to host page size. However, one guest page is
    provided by memslot_modification_stress_test. It triggers failure
    in the scenario of 64KB-page-size-host and 4KB-page-size-guest,
    as the following messages indicate.
    
     # ./memslot_modification_stress_test
     Testing guest mode: PA-bits:40,  VA-bits:48,  4K pages
     guest physical test memory: [0xffbfff0000, 0xffffff0000)
     Finished creating vCPUs
     Started all vCPUs
     ==== Test Assertion Failure ====
       lib/kvm_util.c:824: vm_adjust_num_guest_pages(vm->mode, npages) == npages
       pid=5712 tid=5712 errno=0 - Success
          1 0x0000000000404eeb: vm_userspace_mem_region_add at kvm_util.c:822
          2 0x0000000000401a5b: add_remove_memslot at memslot_modification_stress_test.c:82
          3  (inlined by) run_test at memslot_modification_stress_test.c:110
          4 0x0000000000402417: for_each_guest_mode at guest_modes.c:100
          5 0x00000000004016a7: main at memslot_modification_stress_test.c:187
          6 0x0000ffffb8cd4383: ?? ??:0
          7 0x0000000000401827: _start at :?
       Number of guest pages is not compatible with the host. Try npages=16
    
    Fix the issue by providing 16 guest pages to the memory slot for this
    particular combination of 64KB-page-size-host and 4KB-page-size-guest
    on aarch64.
    
    Fixes: ef4c9f4f65462 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
    Signed-off-by: Gavin Shan <gshan@redhat.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221013063020.201856-1-gshan@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5a4951e1ec703d9c531ff75e05717bac708a4c42
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Thu Oct 6 16:58:22 2022 -0700

    ASoC: codec: tlv320adc3xxx: add GPIOLIB dependency
    
    [ Upstream commit 551f2994b8ccdbe296e239278531e345d6e94d4d ]
    
    Fix build errors when CONFIG_GPIOLIB is not enabled:
    
    ../sound/soc/codecs/tlv320adc3xxx.c: In function 'adc3xxx_i2c_probe':
    ../sound/soc/codecs/tlv320adc3xxx.c:1352:28: error: implicit declaration of function 'devm_gpiod_get'; did you mean 'devm_gpio_free'? [-Werror=implicit-function-declaration]
     1352 |         adc3xxx->rst_pin = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
    ../sound/soc/codecs/tlv320adc3xxx.c:1352:57: error: 'GPIOD_OUT_LOW' undeclared (first use in this function); did you mean 'GPIOF_INIT_LOW'?
     1352 |         adc3xxx->rst_pin = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
      CC      lib/dynamic_debug.o
    ../sound/soc/codecs/tlv320adc3xxx.c:1400:9: error: implicit declaration of function 'gpiod_set_value_cansleep'; did you mean 'gpio_set_value_cansleep'? [-Werror=implicit-function-declaration]
     1400 |         gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    
    Fixes: e9a3b57efd28 ("ASoC: codec: tlv320adc3xxx: New codec driver")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Reported-by: kernel test robot <lkp@intel.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Liam Girdwood <lgirdwood@gmail.com>
    Cc: Ricard Wanderlof <ricardw@axis.com>
    Cc: Jaroslav Kysela <perex@perex.cz>
    Cc: Takashi Iwai <tiwai@suse.com>
    Cc: alsa-devel@alsa-project.org
    Link: https://lore.kernel.org/r/20221006235822.30074-1-rdunlap@infradead.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a8f6f8d5308c9799917a225272d14cdef347fe5a
Author: Kuogee Hsieh <quic_khsieh@quicinc.com>
Date:   Mon Sep 12 09:23:48 2022 -0700

    drm/msm/dp: cleared DP_DOWNSPREAD_CTRL register before start link training
    
    [ Upstream commit 70445dee1b4cf44c9fecc580dfa08079011866f1 ]
    
    DOWNSPREAD_CTRL (0x107) shall be cleared to 0 upon power-on reset or an
    upstream device disconnect. This patch will enforce this rule by always
    cleared DOWNSPREAD_CTRL register to 0 before start link training. At rare
    case that DP MSA timing parameters may be mis-interpreted by the sink
    which causes audio sampling rate be calculated wrongly and cause audio
    did not work at sink if DOWNSPREAD_CTRL register is not cleared to 0.
    
    Changes in v2:
    1) fix spelling at commit text
    2) merge ssc variable into encoding[0]
    
    Changes in v3:
    -- correct spelling of DOWNSPREAD_CTRL
    -- replace err with len of ssize_t
    
    Changes in v4:
    -- split into 2 patches
    
    Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
    Patchwork: https://patchwork.freedesktop.org/patch/502532/
    Link: https://lore.kernel.org/r/1662999830-13916-2-git-send-email-quic_khsieh@quicinc.com
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 843a162e8a613118ba3e3f2ed63fd7dbbf49e620
Author: Nathan Huckleberry <nhuck@google.com>
Date:   Tue Sep 13 13:55:48 2022 -0700

    drm/msm: Fix return type of mdp4_lvds_connector_mode_valid
    
    [ Upstream commit 0b33a33bd15d5bab73b87152b220a8d0153a4587 ]
    
    The mode_valid field in drm_connector_helper_funcs is expected to be of
    type:
    enum drm_mode_status (* mode_valid) (struct drm_connector *connector,
                                         struct drm_display_mode *mode);
    
    The mismatched return type breaks forward edge kCFI since the underlying
    function definition does not match the function hook definition.
    
    The return type of mdp4_lvds_connector_mode_valid should be changed from
    int to enum drm_mode_status.
    
    Reported-by: Dan Carpenter <error27@gmail.com>
    Link: https://github.com/ClangBuiltLinux/linux/issues/1703
    Cc: llvm@lists.linux.dev
    Signed-off-by: Nathan Huckleberry <nhuck@google.com>
    Fixes: 3e87599b68e7 ("drm/msm/mdp4: add LVDS panel support")
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Patchwork: https://patchwork.freedesktop.org/patch/502878/
    Link: https://lore.kernel.org/r/20220913205551.155128-1-nhuck@google.com
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d106b866439c63a618d020477bfbe7b46c759657
Author: Kuogee Hsieh <quic_khsieh@quicinc.com>
Date:   Wed Sep 28 16:36:51 2022 -0700

    drm/msm/dp: add atomic_check to bridge ops
    
    [ Upstream commit 3a661247967a6f3c99a95a8ba4c8073c5846ea4b ]
    
    DRM commit_tails() will disable downstream crtc/encoder/bridge if
    both disable crtc is required and crtc->active is set before pushing
    a new frame downstream.
    
    There is a rare case that user space display manager issue an extra
    screen update immediately followed by close DRM device while down
    stream display interface is disabled. This extra screen update will
    timeout due to the downstream interface is disabled but will cause
    crtc->active be set. Hence the followed commit_tails() called by
    drm_release() will pass the disable downstream crtc/encoder/bridge
    conditions checking even downstream interface is disabled.
    This cause the crash to happen at dp_bridge_disable() due to it trying
    to access the main link register to push the idle pattern out while main
    link clocks is disabled.
    
    This patch adds atomic_check to prevent the extra frame will not
    be pushed down if display interface is down so that crtc->active
    will not be set neither. This will fail the conditions checking
    of disabling down stream crtc/encoder/bridge which prevent
    drm_release() from calling dp_bridge_disable() so that crash
    at dp_bridge_disable() prevented.
    
    There is no protection in the DRM framework to check if the display
    pipeline has been already disabled before trying again. The only
    check is the crtc_state->active but this is controlled by usermode
    using UAPI. Hence if the usermode sets this and then crashes, the
    driver needs to protect against double disable.
    
    SError Interrupt on CPU7, code 0x00000000be000411 -- SError
    CPU: 7 PID: 3878 Comm: Xorg Not tainted 5.19.0-stb-cbq #19
    Hardware name: Google Lazor (rev3 - 8) (DT)
    pstate: a04000c9 (NzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : __cmpxchg_case_acq_32+0x14/0x2c
    lr : do_raw_spin_lock+0xa4/0xdc
    sp : ffffffc01092b6a0
    x29: ffffffc01092b6a0 x28: 0000000000000028 x27: 0000000000000038
    x26: 0000000000000004 x25: ffffffd2973dce48 x24: 0000000000000000
    x23: 00000000ffffffff x22: 00000000ffffffff x21: ffffffd2978d0008
    x20: ffffffd2978d0008 x19: ffffff80ff759fc0 x18: 0000000000000000
    x17: 004800a501260460 x16: 0441043b04600438 x15: 04380000089807d0
    x14: 07b0089807800780 x13: 0000000000000000 x12: 0000000000000000
    x11: 0000000000000438 x10: 00000000000007d0 x9 : ffffffd2973e09e4
    x8 : ffffff8092d53300 x7 : ffffff808902e8b8 x6 : 0000000000000001
    x5 : ffffff808902e880 x4 : 0000000000000000 x3 : ffffff80ff759fc0
    x2 : 0000000000000001 x1 : 0000000000000000 x0 : ffffff80ff759fc0
    Kernel panic - not syncing: Asynchronous SError Interrupt
    CPU: 7 PID: 3878 Comm: Xorg Not tainted 5.19.0-stb-cbq #19
    Hardware name: Google Lazor (rev3 - 8) (DT)
    Call trace:
     dump_backtrace.part.0+0xbc/0xe4
     show_stack+0x24/0x70
     dump_stack_lvl+0x68/0x84
     dump_stack+0x18/0x34
     panic+0x14c/0x32c
     nmi_panic+0x58/0x7c
     arm64_serror_panic+0x78/0x84
     do_serror+0x40/0x64
     el1h_64_error_handler+0x30/0x48
     el1h_64_error+0x68/0x6c
     __cmpxchg_case_acq_32+0x14/0x2c
     _raw_spin_lock_irqsave+0x38/0x4c
     lock_timer_base+0x40/0x78
     __mod_timer+0xf4/0x25c
     schedule_timeout+0xd4/0xfc
     __wait_for_common+0xac/0x140
     wait_for_completion_timeout+0x2c/0x54
     dp_ctrl_push_idle+0x40/0x88
     dp_bridge_disable+0x24/0x30
     drm_atomic_bridge_chain_disable+0x90/0xbc
     drm_atomic_helper_commit_modeset_disables+0x198/0x444
     msm_atomic_commit_tail+0x1d0/0x374
     commit_tail+0x80/0x108
     drm_atomic_helper_commit+0x118/0x11c
     drm_atomic_commit+0xb4/0xe0
     drm_client_modeset_commit_atomic+0x184/0x224
     drm_client_modeset_commit_locked+0x58/0x160
     drm_client_modeset_commit+0x3c/0x64
     __drm_fb_helper_restore_fbdev_mode_unlocked+0x98/0xac
     drm_fb_helper_set_par+0x74/0x80
     drm_fb_helper_hotplug_event+0xdc/0xe0
     __drm_fb_helper_restore_fbdev_mode_unlocked+0x7c/0xac
     drm_fb_helper_restore_fbdev_mode_unlocked+0x20/0x2c
     drm_fb_helper_lastclose+0x20/0x2c
     drm_lastclose+0x44/0x6c
     drm_release+0x88/0xd4
     __fput+0x104/0x220
     ____fput+0x1c/0x28
     task_work_run+0x8c/0x100
     do_exit+0x450/0x8d0
     do_group_exit+0x40/0xac
     __wake_up_parent+0x0/0x38
     invoke_syscall+0x84/0x11c
     el0_svc_common.constprop.0+0xb8/0xe4
     do_el0_svc+0x8c/0xb8
     el0_svc+0x2c/0x54
     el0t_64_sync_handler+0x120/0x1c0
     el0t_64_sync+0x190/0x194
    SMP: stopping secondary CPUs
    Kernel Offset: 0x128e800000 from 0xffffffc008000000
    PHYS_OFFSET: 0x80000000
    CPU features: 0x800,00c2a015,19801c82
    Memory Limit: none
    
    Changes in v2:
    -- add more commit text
    
    Changes in v3:
    -- add comments into dp_bridge_atomic_check()
    
    Changes in v4:
    -- rewording the comment into dp_bridge_atomic_check()
    
    Changes in v5:
    -- removed quote x at end of commit text
    
    Changes in v6:
    -- removed quote x at end of comment in dp_bridge_atomic_check()
    
    Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable")
    Reported-by: Leonard Lausen <leonard@lausen.nl>
    Suggested-by: Rob Clark <robdclark@gmail.com>
    Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/17
    Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/505331/
    Link: https://lore.kernel.org/r/1664408211-25314-1-git-send-email-quic_khsieh@quicinc.com
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ecd63b2fbabc8fd6e5355c25fe1e186a74fa5272
Author: Akhil P Oommen <quic_akhilpo@quicinc.com>
Date:   Wed Sep 28 12:48:59 2022 +0530

    drm/msm/a6xx: Replace kcalloc() with kvzalloc()
    
    [ Upstream commit ec8f1813bf8d0737898f99a8c1c69df0cde0d7dd ]
    
    In order to reduce chance of allocation failure while capturing a6xx
    gpu state, use kvzalloc() instead of kcalloc() in state_kcalloc().
    
    Indirectly, this patch helps to fix leaking memory allocated for
    gmu_debug object.
    
    Fixes: b859f9b009b (drm/msm/gpu: Snapshot GMU debug buffer)
    Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/505074/
    Link: https://lore.kernel.org/r/20220928124830.1.I8ea24a8d586b4978823b848adde000f92f74d5c2@changeid
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80c4f07e87b93a502783353ffa13206f31ffbcc7
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:35 2022 +0200

    media: cedrus: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit 26686b0da9f3fd042578c1093862c853f8e4ff1b ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9bd02badf9d889dbe6fb35cca1b0d3967faa04c6
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:34 2022 +0200

    media: sun8i-rotate: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit b9273150b8b7f8b02ac961463057191d243f953d ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: d77182ada3d4 ("media: sun8i: Add Allwinner A83T Rotate driver")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fd16edd7c20392eb66746890a3a21973eb7c4e89
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:33 2022 +0200

    media: sun8i-di: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit c2a46b19f0340e6647168f4ceac4e5e4cb9197d8 ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8c484b3786171a1ad445c4331d250ed9a1f2262d
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:32 2022 +0200

    media: sun4i-csi: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit 140a9b57d3a306ca77a92e903facbdc4a31ccd51 ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9352ad87a3a3ba9b58e49ce1a0e291619ab0d26e
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:31 2022 +0200

    media: sun6i-csi: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit 6a720df702db764e2b3bbdaaa217e9d344efcfb2 ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8834173e86f8886fcba3aa630ff5eadb45e854f2
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:30 2022 +0200

    media: sun8i-a83t-mipi-csi2: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit 398c479234894c3d3347d83869760db3c406c269 ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    Fixes: 576d196c522b ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 867b03a56bbcaf5c60c234987b7b3441c3d0d541
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Thu Aug 25 12:20:29 2022 +0200

    media: sun6i-mipi-csi2: Add a Kconfig dependency on RESET_CONTROLLER
    
    [ Upstream commit d0734dab5480325fd67548aa51ee126570d48574 ]
    
    The driver relies on the reset controller API to work, so add
    RESET_CONTROLLER as one of its Kconfig dependencies.
    
    It also selects PHY_SUN6I_MIPI_DPHY, which depends on RESET_CONTROLLER.
    
    Fixes: af54b4f4c17f ("media: sunxi: Add support for the A31 MIPI CSI-2 controller")
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 04706a765ec4e8c332396562949c0356575bf9d1
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Tue Aug 23 09:42:11 2022 +0200

    media: sunxi: Fix some error handling path of sun6i_mipi_csi2_probe()
    
    [ Upstream commit 51e1440d309a74a3e4e252019a00f9d0df329945 ]
    
    Release some resources in the error handling path of the probe and of
    sun6i_mipi_csi2_resources_setup(), as already done in the remove
    function.
    
    Fixes: af54b4f4c17f ("media: sunxi: Add support for the A31 MIPI CSI-2 controller")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 075281612a9f79b8c34311cb826017c7e47838e3
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Tue Aug 23 09:42:01 2022 +0200

    media: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe()
    
    [ Upstream commit 466c1e6d05003707e8baa16668e7bc287d875d5e ]
    
    Release some resources in the error handling path of the probe and of
    sun8i_a83t_mipi_csi2_resources_setup(), as already done in the remove
    function.
    
    Fixes: 576d196c522b ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a549517e4b761f3940011db30320cb8c9badde54
Author: Dan Carpenter <error27@gmail.com>
Date:   Thu Sep 1 07:20:09 2022 +0200

    media: atomisp: prevent integer overflow in sh_css_set_black_frame()
    
    [ Upstream commit 3ad290194bb06979367622e47357462836c1d3b4 ]
    
    The "height" and "width" values come from the user so the "height * width"
    multiplication can overflow.
    
    Link: https://lore.kernel.org/r/YxBBCRnm3mmvaiuR@kili
    
    Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 019076e3775a0d9866d938d9fcfdfb685d936c10
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Mon Sep 5 11:52:35 2022 +0200

    media: sun6i-mipi-csi2: Depend on PHY_SUN6I_MIPI_DPHY
    
    [ Upstream commit ff37bc8c7099b673e9838bfbd0de78eff740316b ]
    
    PHY_SUN6I_MIPI_DPHY is not a freely selectable option and so may not
    always be available. Depend on it instead.
    
    Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY")
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1f55a2273a7b41895ea6272e51ccb1d797cfd39b
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun Aug 7 08:43:29 2022 +0200

    media: ov8865: Fix an error handling path in ov8865_probe()
    
    [ Upstream commit 080e0b7404850406628674b07286f16cc389a892 ]
    
    The commit in Fixes also introduced some new error handling which should
    goto the existing error handling path.
    Otherwise some resources leak.
    
    Fixes: 73dcffeb2ff9 ("media: i2c: Support 19.2MHz input clock in ov8865")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88230c5145b47526e7f6fa55be5d7244a8e300d8
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Tue Aug 30 12:32:36 2022 +0200

    media: ar0521: Fix return value check in writing initial registers
    
    commit 54bb7671ca6de58929b3994468c330bedb9a3b7e upstream.
    
    The return value from register writes is ignored apart from the last
    value. Fix this.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec74ac5f4e6617b9caa34484c89ff45c448e583f
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Fri Jul 15 10:59:24 2022 +0200

    media: ar0521: fix error return code in ar0521_power_on()
    
    [ Upstream commit b5f8fa876931c1adfd2c5eca5b189fd2be893238 ]
    
    Return error code if ar0521_write_regs() fails in ar0521_power_on().
    
    Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cf4cae3929cf29a7534d7b4dc99c40516737bf06
Author: Alexander Stein <alexander.stein@ew.tq-group.com>
Date:   Fri Jul 22 09:11:31 2022 +0200

    media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation
    
    [ Upstream commit bb9ea2c31fa11b789ade4c3abcdda3c5370a76ab ]
    
    The doc says the I²C device's name is used if devname is NULL, but
    actually the I²C device driver's name is used.
    
    Fixes: 0658293012af ("media: v4l: subdev: Add a function to set an I²C sub-device's name")
    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7495e388a58f72c41c1d1f4eb37a9058c6b7c835
Author: Ming Qian <ming.qian@nxp.com>
Date:   Mon Aug 29 07:33:16 2022 +0200

    media: amphion: release m2m ctx when releasing vpu instance
    
    [ Upstream commit d91d7bc85062309aae6d8064563ddf17947cb6bc ]
    
    release m2m ctx in the callback function that
    release the vpu instance, then there is no need
    to add lock around releasing m2m ctx.
    
    Fixes: 3cd084519c6f ("media: amphion: add vpu v4l2 m2m support")
    Signed-off-by: Ming Qian <ming.qian@nxp.com>
    Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit db20af4f3a2d8fe6e52a75eb1fe5f6b3c1c87114
Author: Wei Yongjun <weiyongjun1@huawei.com>
Date:   Mon Sep 19 16:08:30 2022 +0000

    net: ieee802154: fix error return code in dgram_bind()
    
    commit 444d8ad4916edec8a9fc684e841287db9b1e999f upstream.
    
    Fix to return error code -EINVAL from the error handling
    case instead of 0, as done elsewhere in this function.
    
    Fixes: 94160108a70c ("net/ieee802154: fix uninit value bug in dgram_sendmsg")
    Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
    Link: https://lore.kernel.org/r/20220919160830.1436109-1-weiyongjun@huaweicloud.com
    Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 096fcd3381c456b9b241e145cc33065ffe41bac9
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Sat Oct 22 15:22:07 2022 +1000

    powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to soft-masked context
    
    commit 65722736c3baf29e02e964a09e85c9ef71c48e8d upstream.
    
    Commit a4cb3651a1743 ("powerpc/64s/interrupt: Fix lost interrupts when
    returning to soft-masked context") fixed the problem of pending irqs
    being cleared when clearing the HARD_DIS bit, but then it didn't clear
    the bit at all. This change clears HARD_DIS without affecting other bits
    in the mask.
    
    When an interrupt hits in a soft-masked section that has MSR[EE]=1, it
    can hard disable and set PACA_IRQS_HARD_DIS, which must be cleared when
    returning to the EE=1 caller (unless it was set due to a MUST_HARD_MASK
    interrupt becoming pending). Failure to clear this leaves the
    returned-to context running with MSR[EE]=1 and PACA_IRQS_HARD_DIS, which
    confuses irq assertions and could be dangerous for code that might test
    the flag.
    
    This was observed in a hash MMU kernel where a kernel hash fault hits in
    a local_irqs_disabled region that has EE=1. The hash fault also runs
    with EE=1, then as it returns, a decrementer hits in the restart section
    and the irq restart code hard-masks which sets the PACA_IRQ_HARD_DIS
    flag, which is not clear when the original context is returned to.
    
    Reported-by: Sachin Sant <sachinp@linux.ibm.com>
    Fixes: a4cb3651a1743 ("powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Tested-by: Sachin Sant <sachinp@linux.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20221022052207.471328-1-npiggin@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b96f226e777d63a07b9dfd15ad8e0badd09bfb8e
Author: Manank Patel <pmanank200502@gmail.com>
Date:   Tue Oct 18 00:13:39 2022 +0530

    ACPI: PCC: Fix unintentional integer overflow
    
    commit 8338b74a750c534c223e8943cc0ed0e198ece261 upstream.
    
    Fix an unintentional u32 overflow by changing PCC_CMD_WAIT_RETRIES_NUM
    to 500ULL.
    
    Fixes: 91cefefb6991 ("ACPI: PCC: replace wait_for_completion()")
    Signed-off-by: Manank Patel <pmanank200502@gmail.com>
    Acked-by: Sudeep Holla <sudeep.holla@arm.com>
    Acked-by: Huisong Li <lihuisong@huawei.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5ad8ba88d68908a49fc03109a66cad0d21d9a75b
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date:   Thu Oct 27 02:06:16 2022 +0200

    fbdev/core: Avoid uninitialized read in aperture_remove_conflicting_pci_device()
    
    commit e0ba1a39b8dfe4f005bebdd85daa89e7382e26b7 upstream.
    
    Return on error directly from the BAR-iterating loop instead of
    break+return.
    
    This is actually a cosmetic fix, since it would be highly unusual to
    have this called for a PCI device without any memory BARs.
    
    Fixes: 9d69ef183815 ("fbdev/core: Remove remove_conflicting_pci_framebuffers()")
    Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/e75323732bedc46d613d72ecb40f97e3bc75eea8.1666829073.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1e3be98592a12511d4e78a9a67aaff3e6ca4980c
Author: Xin Long <lucien.xin@gmail.com>
Date:   Fri Oct 21 10:22:47 2022 -0400

    ethtool: eeprom: fix null-deref on genl_info in dump
    
    commit 9d9effca9d7d7cf6341182a7c5cabcbd6fa28063 upstream.
    
    The similar fix as commit 46cdedf2a0fa ("ethtool: pse-pd: fix null-deref on
    genl_info in dump") is also needed for ethtool eeprom.
    
    Fixes: c781ff12a2f3 ("ethtool: Allow network drivers to dump arbitrary EEPROM data")
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Link: https://lore.kernel.org/r/5575919a2efc74cd9ad64021880afc3805c54166.1666362167.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3565bc1a810ee2292c0cdf31263cd680bfbced3
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Oct 18 13:48:34 2022 +0200

    s390/pci: add missing EX_TABLE entries to __pcistg_mio_inuser()/__pcilg_mio_inuser()
    
    commit 6ec803025cf3173a57222e4411097166bd06fa98 upstream.
    
    For some exception types the instruction address points behind the
    instruction that caused the exception. Take that into account and add
    the missing exception table entry.
    
    Cc: <stable@vger.kernel.org>
    Fixes: f058599e22d5 ("s390/pci: Fix s390_mmio_read/write with MIO")
    Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed5ed8886a77d717e6c919be05e0e15c03e6a0b9
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Oct 18 13:44:11 2022 +0200

    s390/futex: add missing EX_TABLE entry to __futex_atomic_op()
    
    commit a262d3ad6a433e4080cecd0a8841104a5906355e upstream.
    
    For some exception types the instruction address points behind the
    instruction that caused the exception. Take that into account and add
    the missing exception table entry.
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 75afd49596458fa85672723ae363f297059b2311
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Oct 18 13:39:43 2022 +0200

    s390/uaccess: add missing EX_TABLE entries to __clear_user()
    
    commit 4e1b5a86a5edfbefc9396d41b0fc1a2ebd0101b6 upstream.
    
    For some exception types the instruction address points behind the
    instruction that caused the exception. Take that into account and add
    the missing exception table entries.
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 106ab66cf5467726ca5ead51623043d37c06820a
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Fri Oct 14 12:24:58 2022 +0200

    s390/cio: fix out-of-bounds access on cio_ignore free
    
    commit 1b6074112742f65ece71b0f299ca5a6a887d2db6 upstream.
    
    The channel-subsystem-driver scans for newly available devices whenever
    device-IDs are removed from the cio_ignore list using a command such as:
    
      echo free >/proc/cio_ignore
    
    Since an I/O device scan might interfer with running I/Os, commit
    172da89ed0ea ("s390/cio: avoid excessive path-verification requests")
    introduced an optimization to exclude online devices from the scan.
    
    The newly added check for online devices incorrectly assumes that
    an I/O-subchannel's drvdata points to a struct io_subchannel_private.
    For devices that are bound to a non-default I/O subchannel driver, such
    as the vfio_ccw driver, this results in an out-of-bounds read access
    during each scan.
    
    Fix this by changing the scan logic to rely on a driver-independent
    online indication. For this we can use struct subchannel->config.ena,
    which is the driver's requested subchannel-enabled state. Since I/Os
    can only be started on enabled subchannels, this matches the intent
    of the original optimization of not scanning devices where I/O might
    be running.
    
    Fixes: 172da89ed0ea ("s390/cio: avoid excessive path-verification requests")
    Fixes: 0c3812c347bf ("s390/cio: derive cdev information only for IO-subchannels")
    Cc: <stable@vger.kernel.org> # v5.15
    Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
    Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c4f52290b6b4c3595933a06065d2d72c349d5d7
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Fri Sep 16 15:01:36 2022 +0200

    s390/boot: add secure boot trailer
    
    commit aa127a069ef312aca02b730d5137e1778d0c3ba7 upstream.
    
    This patch enhances the kernel image adding a trailer as required for
    secure boot by future firmware versions.
    
    Cc: <stable@vger.kernel.org> # 5.2+
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bd125dd44644eb1c0086a73bec177da3bb459d4b
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Wed Oct 26 10:27:36 2022 +0300

    perf auxtrace: Fix address filter symbol name match for modules
    
    commit cba04f3136b658583adb191556f99d087589c1cc upstream.
    
    For modules, names from kallsyms__parse() contain the module name which
    meant that module symbols did not match exactly by name.
    
    Fix by matching the name string up to the separating tab character.
    
    Fixes: 1b36c03e356936d6 ("perf record: Add support for using symbols in address filters")
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221026072736.2982-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d83a69966e8b6ae9dd447f3ac704c0223bceb7f7
Author: Pavel Kozlov <pavel.kozlov@synopsys.com>
Date:   Mon Oct 17 20:11:27 2022 +0400

    ARC: mm: fix leakage of memory allocated for PTE
    
    commit 4fd9df10cb7a9289fbd22d669f9f98164d95a1ce upstream.
    
    Since commit d9820ff ("ARC: mm: switch pgtable_t back to struct page *")
    a memory leakage problem occurs. Memory allocated for page table entries
    not released during process termination. This issue can be reproduced by
    a small program that allocates a large amount of memory. After several
    runs, you'll see that the amount of free memory has reduced and will
    continue to reduce after each run. All ARC CPUs are effected by this
    issue. The issue was introduced since the kernel stable release v5.15-rc1.
    
    As described in commit d9820ff after switch pgtable_t back to struct
    page *, a pointer to "struct page" and appropriate functions are used to
    allocate and free a memory page for PTEs, but the pmd_pgtable macro hasn't
    changed and returns the direct virtual address from the PMD (PGD) entry.
    Than this address used as a parameter in the __pte_free() and as a result
    this function couldn't release memory page allocated for PTEs.
    
    Fix this issue by changing the pmd_pgtable macro and returning pointer to
    struct page.
    
    Fixes: d9820ff76f95 ("ARC: mm: switch pgtable_t back to struct page *")
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: <stable@vger.kernel.org> # 5.15.x
    Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
    Signed-off-by: Vineet Gupta <vgupta@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 74cf11bd39769153e84f93767063f9582da20a22
Author: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Date:   Mon Oct 17 18:33:02 2022 +0530

    Revert "pinctrl: pinctrl-zynqmp: Add support for output-enable and bias-high-impedance"
    
    commit 9989bc33c4894e0751679b91fc6eb585772487b9 upstream.
    
    This reverts commit ad2bea79ef0144043721d4893eef719c907e2e63.
    
    On systems with older PMUFW (Xilinx ZynqMP Platform Management Firmware)
    using these pinctrl properties can cause system hang because there is
    missing feature autodetection.
    When this feature is implemented in the PMUFW, support for these two
    properties should bring back.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
    Acked-by: Michal Simek <michal.simek@amd.com>
    Link: https://lore.kernel.org/r/20221017130303.21746-2-sai.krishna.potthuri@amd.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ba82dc32230a640852f6ee296d60c8a03b56a8db
Author: Siarhei Volkau <lis8215@gmail.com>
Date:   Sun Oct 16 18:35:48 2022 +0300

    pinctrl: Ingenic: JZ4755 bug fixes
    
    commit 17747577bbcb496e1b1c4096d64c2fc1e7bc0fef upstream.
    
    Fixes UART1 function bits and MMC groups typo.
    
    For pins 0x97,0x99 function 0 is designated to PWM3/PWM5
    respectively, function is 1 designated to the UART1.
    
    Diff from v1:
     - sent separately
     - added tag Fixes
    
    Cc: stable@vger.kernel.org
    Fixes: b582b5a434d3 ("pinctrl: Ingenic: Add pinctrl driver for JZ4755.")
    Tested-by: Siarhei Volkau <lis8215@gmail.com>
    Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
    Link: https://lore.kernel.org/r/20221016153548.3024209-1-lis8215@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d1b4d001d58dd2982d15718cec65fad00574253
Author: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Date:   Mon Oct 17 18:33:03 2022 +0530

    Revert "dt-bindings: pinctrl-zynqmp: Add output-enable configuration"
    
    commit ff8356060e3a5e126abb5e1f6b6e9931c220dec2 upstream.
    
    This reverts commit 133ad0d9af99bdca90705dadd8d31c20bfc9919f.
    
    On systems with older PMUFW (Xilinx ZynqMP Platform Management Firmware)
    using these pinctrl properties can cause system hang because there is
    missing feature autodetection.
    When this feature is implemented, support for these two properties should
    bring back.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
    Acked-by: Michal Simek <michal.simek@amd.com>
    Link: https://lore.kernel.org/r/20221017130303.21746-3-sai.krishna.potthuri@amd.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af1b57cc39beca203559576b3046094fc9e5eb32
Author: Christian A. Ehrhardt <lk@c--e.de>
Date:   Tue Sep 13 14:17:23 2022 +0200

    kernfs: fix use-after-free in __kernfs_remove
    
    commit 4abc99652812a2ddf932f137515d5c5a04723538 upstream.
    
    Syzkaller managed to trigger concurrent calls to
    kernfs_remove_by_name_ns() for the same file resulting in
    a KASAN detected use-after-free. The race occurs when the root
    node is freed during kernfs_drain().
    
    To prevent this acquire an additional reference for the root
    of the tree that is removed before calling __kernfs_remove().
    
    Found by syzkaller with the following reproducer (slab_nomerge is
    required):
    
    syz_mount_image$ext4(0x0, &(0x7f0000000100)='./file0\x00', 0x100000, 0x0, 0x0, 0x0, 0x0)
    r0 = openat(0xffffffffffffff9c, &(0x7f0000000080)='/proc/self/exe\x00', 0x0, 0x0)
    close(r0)
    pipe2(&(0x7f0000000140)={0xffffffffffffffff, <r1=>0xffffffffffffffff}, 0x800)
    mount$9p_fd(0x0, &(0x7f0000000040)='./file0\x00', &(0x7f00000000c0), 0x408, &(0x7f0000000280)={'trans=fd,', {'rfdno', 0x3d, r0}, 0x2c, {'wfdno', 0x3d, r1}, 0x2c, {[{@cache_loose}, {@mmap}, {@loose}, {@loose}, {@mmap}], [{@mask={'mask', 0x3d, '^MAY_EXEC'}}, {@fsmagic={'fsmagic', 0x3d, 0x10001}}, {@dont_hash}]}})
    
    Sample report:
    
    ==================================================================
    BUG: KASAN: use-after-free in kernfs_type include/linux/kernfs.h:335 [inline]
    BUG: KASAN: use-after-free in kernfs_leftmost_descendant fs/kernfs/dir.c:1261 [inline]
    BUG: KASAN: use-after-free in __kernfs_remove.part.0+0x843/0x960 fs/kernfs/dir.c:1369
    Read of size 2 at addr ffff8880088807f0 by task syz-executor.2/857
    
    CPU: 0 PID: 857 Comm: syz-executor.2 Not tainted 6.0.0-rc3-00363-g7726d4c3e60b #5
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x6e/0x91 lib/dump_stack.c:106
     print_address_description mm/kasan/report.c:317 [inline]
     print_report.cold+0x5e/0x5e5 mm/kasan/report.c:433
     kasan_report+0xa3/0x130 mm/kasan/report.c:495
     kernfs_type include/linux/kernfs.h:335 [inline]
     kernfs_leftmost_descendant fs/kernfs/dir.c:1261 [inline]
     __kernfs_remove.part.0+0x843/0x960 fs/kernfs/dir.c:1369
     __kernfs_remove fs/kernfs/dir.c:1356 [inline]
     kernfs_remove_by_name_ns+0x108/0x190 fs/kernfs/dir.c:1589
     sysfs_slab_add+0x133/0x1e0 mm/slub.c:5943
     __kmem_cache_create+0x3e0/0x550 mm/slub.c:4899
     create_cache mm/slab_common.c:229 [inline]
     kmem_cache_create_usercopy+0x167/0x2a0 mm/slab_common.c:335
     p9_client_create+0xd4d/0x1190 net/9p/client.c:993
     v9fs_session_init+0x1e6/0x13c0 fs/9p/v9fs.c:408
     v9fs_mount+0xb9/0xbd0 fs/9p/vfs_super.c:126
     legacy_get_tree+0xf1/0x200 fs/fs_context.c:610
     vfs_get_tree+0x85/0x2e0 fs/super.c:1530
     do_new_mount fs/namespace.c:3040 [inline]
     path_mount+0x675/0x1d00 fs/namespace.c:3370
     do_mount fs/namespace.c:3383 [inline]
     __do_sys_mount fs/namespace.c:3591 [inline]
     __se_sys_mount fs/namespace.c:3568 [inline]
     __x64_sys_mount+0x282/0x300 fs/namespace.c:3568
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f725f983aed
    Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f725f0f7028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
    RAX: ffffffffffffffda RBX: 00007f725faa3f80 RCX: 00007f725f983aed
    RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 0000000000000000
    RBP: 00007f725f9f419c R08: 0000000020000280 R09: 0000000000000000
    R10: 0000000000000408 R11: 0000000000000246 R12: 0000000000000000
    R13: 0000000000000006 R14: 00007f725faa3f80 R15: 00007f725f0d7000
     </TASK>
    
    Allocated by task 855:
     kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
     kasan_set_track mm/kasan/common.c:45 [inline]
     set_alloc_info mm/kasan/common.c:437 [inline]
     __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:470
     kasan_slab_alloc include/linux/kasan.h:224 [inline]
     slab_post_alloc_hook mm/slab.h:727 [inline]
     slab_alloc_node mm/slub.c:3243 [inline]
     slab_alloc mm/slub.c:3251 [inline]
     __kmem_cache_alloc_lru mm/slub.c:3258 [inline]
     kmem_cache_alloc+0xbf/0x200 mm/slub.c:3268
     kmem_cache_zalloc include/linux/slab.h:723 [inline]
     __kernfs_new_node+0xd4/0x680 fs/kernfs/dir.c:593
     kernfs_new_node fs/kernfs/dir.c:655 [inline]
     kernfs_create_dir_ns+0x9c/0x220 fs/kernfs/dir.c:1010
     sysfs_create_dir_ns+0x127/0x290 fs/sysfs/dir.c:59
     create_dir lib/kobject.c:63 [inline]
     kobject_add_internal+0x24a/0x8d0 lib/kobject.c:223
     kobject_add_varg lib/kobject.c:358 [inline]
     kobject_init_and_add+0x101/0x160 lib/kobject.c:441
     sysfs_slab_add+0x156/0x1e0 mm/slub.c:5954
     __kmem_cache_create+0x3e0/0x550 mm/slub.c:4899
     create_cache mm/slab_common.c:229 [inline]
     kmem_cache_create_usercopy+0x167/0x2a0 mm/slab_common.c:335
     p9_client_create+0xd4d/0x1190 net/9p/client.c:993
     v9fs_session_init+0x1e6/0x13c0 fs/9p/v9fs.c:408
     v9fs_mount+0xb9/0xbd0 fs/9p/vfs_super.c:126
     legacy_get_tree+0xf1/0x200 fs/fs_context.c:610
     vfs_get_tree+0x85/0x2e0 fs/super.c:1530
     do_new_mount fs/namespace.c:3040 [inline]
     path_mount+0x675/0x1d00 fs/namespace.c:3370
     do_mount fs/namespace.c:3383 [inline]
     __do_sys_mount fs/namespace.c:3591 [inline]
     __se_sys_mount fs/namespace.c:3568 [inline]
     __x64_sys_mount+0x282/0x300 fs/namespace.c:3568
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Freed by task 857:
     kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
     kasan_set_track+0x21/0x30 mm/kasan/common.c:45
     kasan_set_free_info+0x20/0x40 mm/kasan/generic.c:370
     ____kasan_slab_free mm/kasan/common.c:367 [inline]
     ____kasan_slab_free mm/kasan/common.c:329 [inline]
     __kasan_slab_free+0x108/0x190 mm/kasan/common.c:375
     kasan_slab_free include/linux/kasan.h:200 [inline]
     slab_free_hook mm/slub.c:1754 [inline]
     slab_free_freelist_hook mm/slub.c:1780 [inline]
     slab_free mm/slub.c:3534 [inline]
     kmem_cache_free+0x9c/0x340 mm/slub.c:3551
     kernfs_put.part.0+0x2b2/0x520 fs/kernfs/dir.c:547
     kernfs_put+0x42/0x50 fs/kernfs/dir.c:521
     __kernfs_remove.part.0+0x72d/0x960 fs/kernfs/dir.c:1407
     __kernfs_remove fs/kernfs/dir.c:1356 [inline]
     kernfs_remove_by_name_ns+0x108/0x190 fs/kernfs/dir.c:1589
     sysfs_slab_add+0x133/0x1e0 mm/slub.c:5943
     __kmem_cache_create+0x3e0/0x550 mm/slub.c:4899
     create_cache mm/slab_common.c:229 [inline]
     kmem_cache_create_usercopy+0x167/0x2a0 mm/slab_common.c:335
     p9_client_create+0xd4d/0x1190 net/9p/client.c:993
     v9fs_session_init+0x1e6/0x13c0 fs/9p/v9fs.c:408
     v9fs_mount+0xb9/0xbd0 fs/9p/vfs_super.c:126
     legacy_get_tree+0xf1/0x200 fs/fs_context.c:610
     vfs_get_tree+0x85/0x2e0 fs/super.c:1530
     do_new_mount fs/namespace.c:3040 [inline]
     path_mount+0x675/0x1d00 fs/namespace.c:3370
     do_mount fs/namespace.c:3383 [inline]
     __do_sys_mount fs/namespace.c:3591 [inline]
     __se_sys_mount fs/namespace.c:3568 [inline]
     __x64_sys_mount+0x282/0x300 fs/namespace.c:3568
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    The buggy address belongs to the object at ffff888008880780
     which belongs to the cache kernfs_node_cache of size 128
    The buggy address is located 112 bytes inside of
     128-byte region [ffff888008880780, ffff888008880800)
    
    The buggy address belongs to the physical page:
    page:00000000732833f8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8880
    flags: 0x100000000000200(slab|node=0|zone=1)
    raw: 0100000000000200 0000000000000000 dead000000000122 ffff888001147280
    raw: 0000000000000000 0000000000150015 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
     ffff888008880680: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
     ffff888008880700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    >ffff888008880780: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                 ^
     ffff888008880800: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
     ffff888008880880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    ==================================================================
    
    Acked-by: Tejun Heo <tj@kernel.org>
    Cc: stable <stable@kernel.org> # -rc3
    Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
    Link: https://lore.kernel.org/r/20220913121723.691454-1-lk@c--e.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c093b57186ec5666ebb66e859237e92d7b8018d
Author: Hugh Dickins <hughd@google.com>
Date:   Sat Oct 22 00:51:06 2022 -0700

    mm: prep_compound_tail() clear page->private
    
    commit 5aae9265ee1a30cf716d6caf6b29fe99b9d55130 upstream.
    
    Although page allocation always clears page->private in the first page or
    head page of an allocation, it has never made a point of clearing
    page->private in the tails (though 0 is often what is already there).
    
    But now commit 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t
    during THP split") issues a warning when page_tail->private is found to be
    non-0 (unless it's swapcache).
    
    Change that warning to dump page_tail (which also dumps head), instead of
    just the head: so far we have seen dead000000000122, dead000000000003,
    dead000000000001 or 0000000000000002 in the raw output for tail private.
    
    We could just delete the warning, but today's consensus appears to want
    page->private to be 0, unless there's a good reason for it to be set: so
    now clear it in prep_compound_tail() (more general than just for THP; but
    not for high order allocation, which makes no pass down the tails).
    
    Link: https://lkml.kernel.org/r/1c4233bb-4e4d-5969-fbd4-96604268a285@google.com
    Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8cace0eeb03d6043827faa6cf6c9067a9f05cd9f
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Wed Oct 19 14:41:56 2022 +0100

    mm/huge_memory: do not clobber swp_entry_t during THP split
    
    commit 71e2d666ef85d51834d658830f823560c402b8b6 upstream.
    
    The following has been observed when running stressng mmap since commit
    b653db77350c ("mm: Clear page->private when splitting or migrating a page")
    
       watchdog: BUG: soft lockup - CPU#75 stuck for 26s! [stress-ng:9546]
       CPU: 75 PID: 9546 Comm: stress-ng Tainted: G            E      6.0.0-revert-b653db77-fix+ #29 0357d79b60fb09775f678e4f3f64ef0579ad1374
       Hardware name: SGI.COM C2112-4GP3/X10DRT-P-Series, BIOS 2.0a 05/09/2016
       RIP: 0010:xas_descend+0x28/0x80
       Code: cc cc 0f b6 0e 48 8b 57 08 48 d3 ea 83 e2 3f 89 d0 48 83 c0 04 48 8b 44 c6 08 48 89 77 18 48 89 c1 83 e1 03 48 83 f9 02 75 08 <48> 3d fd 00 00 00 76 08 88 57 12 c3 cc cc cc cc 48 c1 e8 02 89 c2
       RSP: 0018:ffffbbf02a2236a8 EFLAGS: 00000246
       RAX: ffff9cab7d6a0002 RBX: ffffe04b0af88040 RCX: 0000000000000002
       RDX: 0000000000000030 RSI: ffff9cab60509b60 RDI: ffffbbf02a2236c0
       RBP: 0000000000000000 R08: ffff9cab60509b60 R09: ffffbbf02a2236c0
       R10: 0000000000000001 R11: ffffbbf02a223698 R12: 0000000000000000
       R13: ffff9cab4e28da80 R14: 0000000000039c01 R15: ffff9cab4e28da88
       FS:  00007fab89b85e40(0000) GS:ffff9cea3fcc0000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007fab84e00000 CR3: 00000040b73a4003 CR4: 00000000003706e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        <TASK>
        xas_load+0x3a/0x50
        __filemap_get_folio+0x80/0x370
        ? put_swap_page+0x163/0x360
        pagecache_get_page+0x13/0x90
        __try_to_reclaim_swap+0x50/0x190
        scan_swap_map_slots+0x31e/0x670
        get_swap_pages+0x226/0x3c0
        folio_alloc_swap+0x1cc/0x240
        add_to_swap+0x14/0x70
        shrink_page_list+0x968/0xbc0
        reclaim_page_list+0x70/0xf0
        reclaim_pages+0xdd/0x120
        madvise_cold_or_pageout_pte_range+0x814/0xf30
        walk_pgd_range+0x637/0xa30
        __walk_page_range+0x142/0x170
        walk_page_range+0x146/0x170
        madvise_pageout+0xb7/0x280
        ? asm_common_interrupt+0x22/0x40
        madvise_vma_behavior+0x3b7/0xac0
        ? find_vma+0x4a/0x70
        ? find_vma+0x64/0x70
        ? madvise_vma_anon_name+0x40/0x40
        madvise_walk_vmas+0xa6/0x130
        do_madvise+0x2f4/0x360
        __x64_sys_madvise+0x26/0x30
        do_syscall_64+0x5b/0x80
        ? do_syscall_64+0x67/0x80
        ? syscall_exit_to_user_mode+0x17/0x40
        ? do_syscall_64+0x67/0x80
        ? syscall_exit_to_user_mode+0x17/0x40
        ? do_syscall_64+0x67/0x80
        ? do_syscall_64+0x67/0x80
        ? common_interrupt+0x8b/0xa0
        entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    The problem can be reproduced with the mmtests config
    config-workload-stressng-mmap.  It does not always happen and when it
    triggers is variable but it has happened on multiple machines.
    
    The intent of commit b653db77350c patch was to avoid the case where
    PG_private is clear but folio->private is not-NULL.  However, THP tail
    pages uses page->private for "swp_entry_t if folio_test_swapcache()" as
    stated in the documentation for struct folio.  This patch only clobbers
    page->private for tail pages if the head page was not in swapcache and
    warns once if page->private had an unexpected value.
    
    Link: https://lkml.kernel.org/r/20221019134156.zjyyn5aownakvztf@techsingularity.net
    Fixes: b653db77350c ("mm: Clear page->private when splitting or migrating a page")
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Brian Foster <bfoster@redhat.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 37fd7341de6c4d93b8be940efe428424de22b3a8
Author: Waiman Long <longman@redhat.com>
Date:   Thu Oct 20 13:56:19 2022 -0400

    mm/kmemleak: prevent soft lockup in kmemleak_scan()'s object iteration loops
    
    commit 984a608377cb623351b8a3670b285f32ebeb2d32 upstream.
    
    Commit 6edda04ccc7c ("mm/kmemleak: prevent soft lockup in first object
    iteration loop of kmemleak_scan()") adds cond_resched() in the first
    object iteration loop of kmemleak_scan().  However, it turns that the 2nd
    objection iteration loop can still cause soft lockup to happen in some
    cases.  So add a cond_resched() call in the 2nd and 3rd loops as well to
    prevent that and for completeness.
    
    Link: https://lkml.kernel.org/r/20221020175619.366317-1-longman@redhat.com
    Fixes: 6edda04ccc7c ("mm/kmemleak: prevent soft lockup in first object iteration loop of kmemleak_scan()")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ca5a1d93dcb462c721c582a31c8b2f3f7649460
Author: Rik van Riel <riel@surriel.com>
Date:   Fri Oct 21 19:28:05 2022 -0400

    mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs
    
    commit 8ebe0a5eaaeb099de03d09ad20f54ed962e2261e upstream.
    
    A common use case for hugetlbfs is for the application to create
    memory pools backed by huge pages, which then get handed over to
    some malloc library (eg. jemalloc) for further management.
    
    That malloc library may be doing MADV_DONTNEED calls on memory
    that is no longer needed, expecting those calls to happen on
    PAGE_SIZE boundaries.
    
    However, currently the MADV_DONTNEED code rounds up any such
    requests to HPAGE_PMD_SIZE boundaries. This leads to undesired
    outcomes when jemalloc expects a 4kB MADV_DONTNEED, but 2MB of
    memory get zeroed out, instead.
    
    Use of pre-built shared libraries means that user code does not
    always know the page size of every memory arena in use.
    
    Avoid unexpected data loss with MADV_DONTNEED by rounding up
    only to PAGE_SIZE (in do_madvise), and rounding down to huge
    page granularity.
    
    That way programs will only get as much memory zeroed out as
    they requested.
    
    Link: https://lkml.kernel.org/r/20221021192805.366ad573@imladris.surriel.com
    Fixes: 90e7e7f5ef3f ("mm: enable MADV_DONTNEED for hugetlb mappings")
    Signed-off-by: Rik van Riel <riel@surriel.com>
    Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7f8a85455909804b050691cb7d9e197aa476b28f
Author: Baolin Wang <baolin.wang@linux.alibaba.com>
Date:   Mon Oct 24 16:34:21 2022 +0800

    mm: migrate: fix return value if all subpages of THPs are migrated successfully
    
    commit 03e5f82ea632af329e32ec03d952b2d99497eeaa upstream.
    
    During THP migration, if THPs are not migrated but they are split and all
    subpages are migrated successfully, migrate_pages() will still return the
    number of THP pages that were not migrated.  This will confuse the callers
    of migrate_pages().  For example, the longterm pinning will failed though
    all pages are migrated successfully.
    
    Thus we should return 0 to indicate that all pages are migrated in this
    case
    
    Link: https://lkml.kernel.org/r/de386aa864be9158d2f3b344091419ea7c38b2f7.1666599848.git.baolin.wang@linux.alibaba.com
    Fixes: b5bade978e9b ("mm: migrate: fix the return value of migrate_pages()")
    Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d77f1fb83c0ec79d8038d4c5cd7e33f9fd08b389
Author: Peter Xu <peterx@redhat.com>
Date:   Mon Oct 24 15:33:35 2022 -0400

    mm/uffd: fix vma check on userfault for wp
    
    commit 67eae54bc227b30dedcce9db68b063ba1adb7838 upstream.
    
    We used to have a report that pte-marker code can be reached even when
    uffd-wp is not compiled in for file memories, here:
    
    https://lore.kernel.org/all/YzeR+R6b4bwBlBHh@x1n/T/#u
    
    I just got time to revisit this and found that the root cause is we simply
    messed up with the vma check, so that for !PTE_MARKER_UFFD_WP system, we
    will allow UFFDIO_REGISTER of MINOR & WP upon shmem as the check was
    wrong:
    
        if (vm_flags & VM_UFFD_MINOR)
            return is_vm_hugetlb_page(vma) || vma_is_shmem(vma);
    
    Where we'll allow anything to pass on shmem as long as minor mode is
    requested.
    
    Axel did it right when introducing minor mode but I messed it up in
    b1f9e876862d when moving code around.  Fix it.
    
    Link: https://lkml.kernel.org/r/20221024193336.1233616-1-peterx@redhat.com
    Link: https://lkml.kernel.org/r/20221024193336.1233616-2-peterx@redhat.com
    Fixes: b1f9e876862d ("mm/uffd: enable write protection for shmem & hugetlbfs")
    Signed-off-by: Peter Xu <peterx@redhat.com>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Nadav Amit <nadav.amit@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 50531cd8070b2934f13ea0ec79d7471dc7d31e55
Author: William Breathitt Gray <william.gray@linaro.org>
Date:   Thu Oct 20 10:11:21 2022 -0400

    counter: 104-quad-8: Fix race getting function mode and direction
    
    commit d501d37841d3b7f18402d71a9ef057eb9dde127e upstream.
    
    The quad8_action_read() function checks the Count function mode and
    Count direction without first acquiring a lock. This is a race condition
    because the function mode could change by the time the direction is
    checked.
    
    Because the quad8_function_read() already acquires a lock internally,
    the quad8_function_read() is refactored to spin out the no-lock code to
    a new quad8_function_get() function.
    
    To resolve the race condition in quad8_action_read(), a lock is acquired
    before calling quad8_function_get() and quad8_direction_read() in order
    to get both function mode and direction atomically.
    
    Fixes: f1d8a071d45b ("counter: 104-quad-8: Add Generic Counter interface support")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221020141121.15434-1-william.gray@linaro.org/
    Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c6b32e868141e79513438780eeac813118d1ae17
Author: William Breathitt Gray <william.gray@linaro.org>
Date:   Tue Oct 18 08:10:14 2022 -0400

    counter: microchip-tcb-capture: Handle Signal1 read and Synapse
    
    commit d917a62af81b133f35f627e7936e193c842a7947 upstream.
    
    The signal_read(), action_read(), and action_write() callbacks have been
    assuming Signal0 is requested without checking. This results in requests
    for Signal1 returning data for Signal0. This patch fixes these
    oversights by properly checking for the Signal's id in the respective
    callbacks and handling accordingly based on the particular Signal
    requested. The trig_inverted member of the mchp_tc_data is removed as
    superfluous.
    
    Fixes: 106b104137fd ("counter: Add microchip TCB capture counter")
    Cc: stable@vger.kernel.org
    Reviewed-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
    Link: https://lore.kernel.org/r/20221018121014.7368-1-william.gray@linaro.org/
    Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1fa55126940c09fd3522be10a4dd5599d2012bf2
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Thu Oct 13 11:32:48 2022 +0200

    mmc: sdhci-esdhc-imx: Propagate ESDHC_FLAG_HS400* only on 8bit bus
    
    commit 1ed5c3b22fc78735c539e4767832aea58db6761c upstream.
    
    The core issues the warning "drop HS400 support since no 8-bit bus" when
    one of the ESDHC_FLAG_HS400* flags is set on a non 8bit capable host. To
    avoid this warning set these flags only on hosts that actually can do
    8bit, i.e. have bus-width = <8> set in the device tree.
    
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
    Fixes: 029e2476f9e6 ("mmc: sdhci-esdhc-imx: add HS400_ES support for i.MX8QXP")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221013093248.2220802-1-s.hauer@pengutronix.de
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c20db2df310c29b00b29e597a53e0324a67caaca
Author: Patrick Thompson <ptf@google.com>
Date:   Thu Oct 13 17:00:17 2022 -0400

    mmc: sdhci-pci-core: Disable ES for ASUS BIOS on Jasper Lake
    
    commit 9dc0033e4658d6f9d9952c3c0c6be3ec25bc2985 upstream.
    
    Enhanced Strobe (ES) does not work correctly on the ASUS 1100 series of
    devices. Jasper Lake eMMCs (pci_id 8086:4dc4) are supposed to support
    ES. There are also two system families under the series, thus this is
    being scoped to the ASUS BIOS.
    
    The failing ES prevents the installer from writing to disk. Falling back
    to HS400 without ES fixes the issue.
    
    Signed-off-by: Patrick Thompson <ptf@google.com>
    Fixes: 315e3bd7ac19 ("mmc: sdhci-pci: Add support for Intel JSL")
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221013210017.3751025-1-ptf@google.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 649fee1acc626e170134c9986802402702e00479
Author: Vincent Whitchurch <vincent.whitchurch@axis.com>
Date:   Thu Oct 20 15:01:23 2022 +0200

    mmc: core: Fix WRITE_ZEROES CQE handling
    
    commit 028822b714bd3a159d65416c53f1549345b53d9e upstream.
    
    WRITE_ZEROES requests use TRIM, so mark them as needing to be issued
    synchronously even when a CQE is being used.  Without this,
    mmc_blk_mq_issue_rq() triggers a WARN_ON_ONCE() and fails the request
    since we don't have any handling for issuing this asynchronously.
    
    Fixes: f7b6fc327327 ("mmc: core: Support zeroout using TRIM for eMMC")
    Reported-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
    Reviewed-by: Avri Altman <avri.altman@wdc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221020130123.4033218-1-vincent.whitchurch@axis.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66d461a92f32b6995b630625d350259b6b1f961b
Author: Matthew Ma <mahongwei@zeku.com>
Date:   Fri Oct 14 11:49:51 2022 +0800

    mmc: core: Fix kernel panic when remove non-standard SDIO card
    
    commit 9972e6b404884adae9eec7463e30d9b3c9a70b18 upstream.
    
    SDIO tuple is only allocated for standard SDIO card, especially it causes
    memory corruption issues when the non-standard SDIO card has removed, which
    is because the card device's reference counter does not increase for it at
    sdio_init_func(), but all SDIO card device reference counter gets decreased
    at sdio_release_func().
    
    Fixes: 6f51be3d37df ("sdio: allow non-standard SDIO cards")
    Signed-off-by: Matthew Ma <mahongwei@zeku.com>
    Reviewed-by: Weizhao Ouyang <ouyangweizhao@zeku.com>
    Reviewed-by: John Wang <wangdayu@zeku.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@zeku.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5dde1fe0af21630edbe53dce4c43a5c9733b6db7
Author: Christian Löhle <CLoehle@hyperstone.com>
Date:   Fri Oct 7 15:43:52 2022 +0000

    mmc: queue: Cancel recovery work on cleanup
    
    commit 339e3eb1facd18a98ceb1171d70674780e5014a7 upstream.
    
    To prevent any recovery work running after the queue cleanup cancel it.
    Any recovery running post-cleanup dereferenced mq->card as NULL
    and was not meaningful to begin with.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/c865c0c9789d428494b67b820a78923e@hyperstone.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c7671f6dcde58eae0d1522a562a1e47f6d9e40c
Author: Christian Löhle <CLoehle@hyperstone.com>
Date:   Thu Oct 13 11:16:37 2022 +0000

    mmc: block: Remove error check of hw_reset on reset
    
    commit 406e14808ee695cbae1eafa5fd3ac563c29470ab upstream.
    
    Before switching back to the right partition in mmc_blk_reset there used
    to be a check if hw_reset was even supported. This return value
    was removed, so there is no reason to check. Furthermore ensure
    part_curr is not falsely set to a valid value on reset or
    partition switch error.
    
    As part of this change the code paths of mmc_blk_reset calls were checked
    to ensure no commands are issued after a failed mmc_blk_reset directly
    without going through the block layer.
    
    Fixes: fefdd3c91e0a ("mmc: core: Drop superfluous validations in mmc_hw|sw_reset()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
    Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/e91be6199d04414a91e20611c81bfe1d@hyperstone.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 485e5d9ca4ecb62c58806a4a3a336dc7771e0b50
Author: Brian Norris <briannorris@chromium.org>
Date:   Mon Oct 24 11:02:59 2022 -0700

    mmc: sdhci_am654: 'select', not 'depends' REGMAP_MMIO
    
    commit 8d280b1df87e0b3d1355aeac7e62b62214b93f1c upstream.
    
    REGMAP_MMIO is not user-configurable, so we can only satisfy this
    dependency by enabling some other Kconfig symbol that properly 'select's
    it. Use select like everybody else.
    
    Noticed when trying to enable this driver for compile testing.
    
    Fixes: 59592cc1f593 ("mmc: sdhci_am654: Add dependency on MMC_SDHCI_AM654")
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221024180300.2292208-1-briannorris@chromium.org
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c51cfba50df8b9e16bfe0e6d4f2f252a4a10063d
Author: James Clark <james.clark@arm.com>
Date:   Tue Oct 25 14:10:32 2022 +0100

    coresight: cti: Fix hang in cti_disable_hw()
    
    commit 6746eae4bbaddcc16b40efb33dab79210828b3ce upstream.
    
    cti_enable_hw() and cti_disable_hw() are called from an atomic context
    so shouldn't use runtime PM because it can result in a sleep when
    communicating with firmware.
    
    Since commit 3c6656337852 ("Revert "firmware: arm_scmi: Add clock
    management to the SCMI power domain""), this causes a hang on Juno when
    running the Perf Coresight tests or running this command:
    
      perf record -e cs_etm//u -- ls
    
    This was also missed until the revert commit because pm_runtime_put()
    was called with the wrong device until commit 692c9a499b28 ("coresight:
    cti: Correct the parameter for pm_runtime_put")
    
    With lock and scheduler debugging enabled the following is output:
    
       coresight cti_sys0: cti_enable_hw -- dev:cti_sys0  parent: 20020000.cti
       BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1151
       in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 330, name: perf-exec
       preempt_count: 2, expected: 0
       RCU nest depth: 0, expected: 0
       INFO: lockdep is turned off.
       irq event stamp: 0
       hardirqs last  enabled at (0): [<0000000000000000>] 0x0
       hardirqs last disabled at (0): [<ffff80000822b394>] copy_process+0xa0c/0x1948
       softirqs last  enabled at (0): [<ffff80000822b394>] copy_process+0xa0c/0x1948
       softirqs last disabled at (0): [<0000000000000000>] 0x0
       CPU: 3 PID: 330 Comm: perf-exec Not tainted 6.0.0-00053-g042116d99298 #7
       Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Sep 13 2022
       Call trace:
        dump_backtrace+0x134/0x140
        show_stack+0x20/0x58
        dump_stack_lvl+0x8c/0xb8
        dump_stack+0x18/0x34
        __might_resched+0x180/0x228
        __might_sleep+0x50/0x88
        __pm_runtime_resume+0xac/0xb0
        cti_enable+0x44/0x120
        coresight_control_assoc_ectdev+0xc0/0x150
        coresight_enable_path+0xb4/0x288
        etm_event_start+0x138/0x170
        etm_event_add+0x48/0x70
        event_sched_in.isra.122+0xb4/0x280
        merge_sched_in+0x1fc/0x3d0
        visit_groups_merge.constprop.137+0x16c/0x4b0
        ctx_sched_in+0x114/0x1f0
        perf_event_sched_in+0x60/0x90
        ctx_resched+0x68/0xb0
        perf_event_exec+0x138/0x508
        begin_new_exec+0x52c/0xd40
        load_elf_binary+0x6b8/0x17d0
        bprm_execve+0x360/0x7f8
        do_execveat_common.isra.47+0x218/0x238
        __arm64_sys_execve+0x48/0x60
        invoke_syscall+0x4c/0x110
        el0_svc_common.constprop.4+0xfc/0x120
        do_el0_svc+0x34/0xc0
        el0_svc+0x40/0x98
        el0t_64_sync_handler+0x98/0xc0
        el0t_64_sync+0x170/0x174
    
    Fix the issue by removing the runtime PM calls completely. They are not
    needed here because it must have already been done when building the
    path for a trace.
    
    Fixes: 835d722ba10a ("coresight: cti: Initial CoreSight CTI Driver")
    Cc: stable <stable@kernel.org>
    Reported-by: Aishwarya TCV <Aishwarya.TCV@arm.com>
    Reported-by: Cristian Marussi <Cristian.Marussi@arm.com>
    Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Signed-off-by: James Clark <james.clark@arm.com>
    Reviewed-by: Mike Leach <mike.leach@linaro.org>
    Tested-by: Mike Leach <mike.leach@linaro.org>
    [ Fix build warnings ]
    Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Link: https://lore.kernel.org/r/20221025131032.1149459-1-suzuki.poulose@arm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 94cfd1a238c6e7460611d0ff19ae185113a866f7
Author: Jean-Philippe Brucker <jean-philippe@linaro.org>
Date:   Fri Oct 28 17:00:42 2022 +0100

    random: use arch_get_random*_early() in random_init()
    
    commit f5e4ec155d145002fd9840868453d785fab86d42 upstream.
    
    While reworking the archrandom handling, commit d349ab99eec7 ("random:
    handle archrandom with multiple longs") switched to the non-early
    archrandom helpers in random_init(), which broke initialization of the
    entropy pool from the arm64 random generator.
    
    Indeed at that point the arm64 CPU features, which verify that all CPUs
    have compatible capabilities, are not finalized so arch_get_random_seed_longs()
    is unsuccessful. Instead random_init() should use the _early functions,
    which check only the boot CPU on arm64. On other architectures the
    _early functions directly call the normal ones.
    
    Fixes: d349ab99eec7 ("random: handle archrandom with multiple longs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ca2893296ae7c8997d67f1bda9080a7f96d716e8
Author: Nathan Huckleberry <nhuck@google.com>
Date:   Tue Oct 18 16:04:12 2022 -0700

    crypto: x86/polyval - Fix crashes when keys are not 16-byte aligned
    
    commit 9f6035af06b526e678808d492fc0830aef6cfbd8 upstream.
    
    crypto_tfm::__crt_ctx is not guaranteed to be 16-byte aligned on x86-64.
    This causes crashes due to movaps instructions in clmul_polyval_update.
    
    Add logic to align polyval_tfm_ctx to 16 bytes.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 34f7f6c30112 ("crypto: x86/polyval - Add PCLMULQDQ accelerated implementation of POLYVAL")
    Reported-by: Bruno Goncalves <bgoncalv@redhat.com>
    Signed-off-by: Nathan Huckleberry <nhuck@google.com>
    Reviewed-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7eda6977e8058dd45607a5bbc6517a0f42ccd6c9
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:17 2022 +0200

    drm/msm/dp: fix bridge lifetime
    
    commit 16194958f888d63839042d1190f7001e5ddec47b upstream.
    
    Device-managed resources allocated post component bind must be tied to
    the lifetime of the aggregate DRM device or they will not necessarily be
    released when binding of the aggregate device is deferred.
    
    This can lead resource leaks or failure to bind the aggregate device
    when binding is later retried and a second attempt to allocate the
    resources is made.
    
    For the DP bridges, previously allocated bridges will leak on probe
    deferral.
    
    Fix this by amending the DP parser interface and tying the lifetime of
    the bridge device to the DRM device rather than DP platform device.
    
    Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
    Cc: stable@vger.kernel.org      # 5.19
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/502667/
    Link: https://lore.kernel.org/r/20220913085320.8577-8-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e93a61163d34e6d0c504a3aa0973a73898afca4d
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:15 2022 +0200

    drm/msm/dp: fix IRQ lifetime
    
    commit a79343dcaba4b11adb57350e0b6426906a9b658e upstream.
    
    Device-managed resources allocated post component bind must be tied to
    the lifetime of the aggregate DRM device or they will not necessarily be
    released when binding of the aggregate device is deferred.
    
    This is specifically true for the DP IRQ, which will otherwise remain
    requested so that the next bind attempt fails when requesting the IRQ a
    second time.
    
    Since commit c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
    this can happen when the aux-bus panel driver has not yet been loaded so
    that probe is deferred.
    
    Fix this by tying the device-managed lifetime of the DP IRQ to the DRM
    device so that it is released when bind fails.
    
    Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
    Cc: stable@vger.kernel.org      # 5.10
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/502679/
    Link: https://lore.kernel.org/r/20220913085320.8577-6-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8768663188e4169333f66583e4d2432e65c421df
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:16 2022 +0200

    drm/msm/dp: fix aux-bus EP lifetime
    
    commit 2b57f726611e294dc4297dd48eb8c98ef1938e82 upstream.
    
    Device-managed resources allocated post component bind must be tied to
    the lifetime of the aggregate DRM device or they will not necessarily be
    released when binding of the aggregate device is deferred.
    
    This can lead resource leaks or failure to bind the aggregate device
    when binding is later retried and a second attempt to allocate the
    resources is made.
    
    For the DP aux-bus, an attempt to populate the bus a second time will
    simply fail ("DP AUX EP device already populated").
    
    Fix this by tying the lifetime of the EP device to the DRM device rather
    than DP controller platform device.
    
    Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
    Cc: stable@vger.kernel.org      # 5.19
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/502672/
    Link: https://lore.kernel.org/r/20220913085320.8577-7-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b312fcab461bd9484c61409007a6fe059f9c2074
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:12 2022 +0200

    drm/msm/dp: fix memory corruption with too many bridges
    
    commit 74466e46e7543c7f74f1502181e9ba93f7521374 upstream.
    
    Add the missing sanity check on the bridge counter to avoid corrupting
    data beyond the fixed-sized bridge array in case there are ever more
    than eight bridges.
    
    Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable")
    Cc: stable@vger.kernel.org      # 5.17
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/502664/
    Link: https://lore.kernel.org/r/20220913085320.8577-3-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c4b1f540f9b69ec9bca0a011d61b5e4aea5f46dd
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:18 2022 +0200

    drm/msm/hdmi: fix IRQ lifetime
    
    commit 152d394842bb564148e68b92486a87db0bf54859 upstream.
    
    Device-managed resources allocated post component bind must be tied to
    the lifetime of the aggregate DRM device or they will not necessarily be
    released when binding of the aggregate device is deferred.
    
    This is specifically true for the HDMI IRQ, which will otherwise remain
    requested so that the next bind attempt fails when requesting the IRQ a
    second time.
    
    Fix this by tying the device-managed lifetime of the HDMI IRQ to the DRM
    device so that it is released when bind fails.
    
    Fixes: 067fef372c73 ("drm/msm/hdmi: refactor bind/init")
    Cc: stable@vger.kernel.org      # 3.19
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/502666/
    Link: https://lore.kernel.org/r/20220913085320.8577-9-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9efb45b45ff6254bfd1f1997a06725cb3fc998a5
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:14 2022 +0200

    drm/msm/hdmi: fix memory corruption with too many bridges
    
    commit 4c1294da6aed1f16d47a417dcfe6602833c3c95c upstream.
    
    Add the missing sanity check on the bridge counter to avoid corrupting
    data beyond the fixed-sized bridge array in case there are ever more
    than eight bridges.
    
    Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
    Cc: stable@vger.kernel.org      # 3.12
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/502670/
    Link: https://lore.kernel.org/r/20220913085320.8577-5-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e83b354890a3c1d5256162f87a6cc38c47ae7f20
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:13 2022 +0200

    drm/msm/dsi: fix memory corruption with too many bridges
    
    commit 2e786eb2f9cebb07e317226b60054df510b60c65 upstream.
    
    Add the missing sanity check on the bridge counter to avoid corrupting
    data beyond the fixed-sized bridge array in case there are ever more
    than eight bridges.
    
    Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support")
    Cc: stable@vger.kernel.org      # 4.1
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/502668/
    Link: https://lore.kernel.org/r/20220913085320.8577-4-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a30a47741b6df1f9555a0fac6aebb7e8c363bad
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Sep 13 10:53:11 2022 +0200

    drm/msm: fix use-after-free on probe deferral
    
    commit 6808abdb33bf90330e70a687d29f038507e06ebb upstream.
    
    The bridge counter was never reset when tearing down the DRM device so
    that stale pointers to deallocated structures would be accessed on the
    next tear down (e.g. after a second late bind deferral).
    
    Given enough bridges and a few probe deferrals this could currently also
    lead to data beyond the bridge array being corrupted.
    
    Fixes: d28ea556267c ("drm/msm: properly add and remove internal bridges")
    Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
    Cc: stable@vger.kernel.org      # 3.12
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/502665/
    Link: https://lore.kernel.org/r/20220913085320.8577-2-johan+linaro@kernel.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f01acf19b8935e1db4892417202a707b87ddb739
Author: Jesse Zhang <jesse.zhang@amd.com>
Date:   Tue Oct 11 05:23:10 2022 +0000

    drm/amdkfd: correct the cache info for gfx1036
    
    commit 969758bbf5e9360b63bbb2328ac3fda46bbbc9f5 upstream.
    
    correct the cache information for gfx1036
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
    Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
    Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e60a87e401e5c06cc492bd91b54d579c78df46b3
Author: Prike Liang <Prike.Liang@amd.com>
Date:   Thu Oct 20 14:44:26 2022 +0800

    drm/amdkfd: update gfx1037 Lx cache setting
    
    commit 9656db1b933caf6ffaaef10322093fe018359090 upstream.
    
    Update the gfx1037 L1/L2 cache setting.
    
    Signed-off-by: Prike Liang <Prike.Liang@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c46dda486e4f9b86eeac40aaea65a6f93dc44dad
Author: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Date:   Mon Oct 24 08:33:59 2022 -0300

    drm/amd/display: Revert logic for plane modifiers
    
    commit 809734c110548dca410fb0cca52e6b1540319f5e upstream.
    
    This file was split in commit 5d945cbcd4b16a29d6470a80dfb19738f9a4319f
    ("drm/amd/display: Create a file dedicated to planes") and the logic in
    dm_plane_format_mod_supported() function got changed by a switch logic.
    That change broke drm_plane modifiers setting on series 5000 APUs
    (tested on OXP mini AMD 5800U and HP Dev One 5850U PRO)
    leading to Gamescope not working as reported on GitHub[1]
    
    To reproduce the issue, enter a TTY and run:
    
    $ gamescope -- vkcube
    
    With said commit applied it will abort. This one restores the old logic,
    fixing the issue that affects Gamescope.
    
    [1](https://github.com/Plagman/gamescope/issues/624)
    
    Cc: <stable@vger.kernel.org> # 6.0.x
    Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
    Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6607901fce79959130db485e7549dacaaeef034e
Author: Chengming Gui <Jack.Gui@amd.com>
Date:   Tue Oct 18 17:31:38 2022 +0800

    drm/amdgpu: fix pstate setting issue
    
    commit 79610d3041338dc1ef554d6fd8b3b3e23be527f5 upstream.
    
    [WHY]
    0, original pstate X
    1, ctx_A_create -> ctx_A->stable_pstate = X
    2, ctx_A_set_pstate (Y) -> current pstate is Y (PEAK or STANDARD)
    3, ctx_B_create -> ctx_B->stable_pstate =  Y
    4, ctx_A_destroy -> restore pstate to X
    5, ctx_B_destroy -> restore pstate to Y
    Above sequence will cause final pstate is wrong (Y), should be original X.
    
    [HOW]
    When ctx_B create,
    if  ctx_A touched pstate setting
    (not auto, stable_pstate_ctx != NULL),
    set ctx_B->stable_pstate the same value as ctx_A saved,
    if stable_pstate_ctx == NULL,
    fetch current pstate to fill
    ctx_B->stable_pstate.
    
    Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 557d06fdb274f2d3d2ad138ad99f7866c36373d3
Author: Prike Liang <Prike.Liang@amd.com>
Date:   Fri Oct 21 10:04:40 2022 +0800

    drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume
    
    commit d61e1d1d5225a9baeb995bcbdb904f66f70ed87e upstream.
    
    In the S2idle suspend/resume phase the gfxoff is keeping functional so
    some IP blocks will be likely to reinitialize at gfxoff entry and that
    will result in failing to program GC registers.Therefore, let disallow
    gfxoff until AMDGPU IPs reinitialized completely.
    
    Signed-off-by: Prike Liang <Prike.Liang@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org # 5.15.x
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 33e8da29bc1c8b4464385c9ab09094a6d0a2db6f
Author: Lijo Lazar <lijo.lazar@amd.com>
Date:   Fri Sep 30 10:43:08 2022 +0530

    drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x
    
    commit d2c4c1569a7d7d5c8f75963bf2d62d7aeac30e2a upstream.
    
    MMHUB 2.1.x versions don't have ATCL2. Remove accesses to ATCL2 registers.
    
    Since they are non-existing registers, read access will cause a
    'Completer Abort' and gets reported when AER is enabled with the below patch.
    Tagging with the patch so that this is backported along with it.
    
    v2: squash in uninitialized warning fix (Nathan Chancellor)
    
    Fixes: 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
    
    Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
    Reviewed-by: Guchun Chen <guchun.chen@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 731e6ea3ec1391b706163c24089ea5dfbcbed79a
Author: José Roberto de Souza <jose.souza@intel.com>
Date:   Mon Oct 17 06:24:32 2022 -0700

    drm/i915: Extend Wa_1607297627 to Alderlake-P
    
    commit 1a3abd12a394f5c66943fee75cef533069e831fb upstream.
    
    Workaround 1607297627 was missed for Alderlake-P, so here extending it
    to it and adding the fixes tag so this WA is backported to all
    stable kernels.
    
    v2:
    - fixed subject
    - added Fixes tag
    
    BSpec: 54369
    Cc: <stable@vger.kernel.org> # v5.17+
    Fixes: dfb924e33927 ("drm/i915/adlp: Remove require_force_probe protection")
    Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221017132432.112850-1-jose.souza@intel.com
    (cherry picked from commit 847eec69f01a28ca44f5ac7e1d71d3a60263d680)
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bcac3b673b09a4bfb061a4fd76cc8b73d65683f4
Author: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Date:   Tue Oct 18 07:08:38 2022 -0700

    drm/amdgpu: Fix for BO move issue
    
    commit 8273b4048664fff356fd10059033f0e2f5a422a1 upstream.
    
    A user reported a bug on CAPE VERDE system where uvd_v3_1
    IP component failed to initialize as there is an issue with
    BO move code from one memory to other.
    
    In function amdgpu_mem_visible() called by amdgpu_bo_move(),
    when there are no blocks to compare or if we have a single
    block then break the loop.
    
    Fixes: 312b4dc11d4f ("drm/amdgpu: Fix VRAM BO swap issue")
    Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: "Limonciello, Mario" <Mario.Limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e63300a09eed792a3a7a2f7aff265c0c3fb9ae38
Author: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Date:   Tue Oct 4 07:33:39 2022 -0700

    drm/amdgpu: Fix VRAM BO swap issue
    
    commit 312b4dc11d4f74bfe03ea25ffe04c1f2fdd13cb9 upstream.
    
    DRM buddy manager allocates the contiguous memory requests in
    a single block or multiple blocks. So for the ttm move operation
    (incase of low vram memory) we should consider all the blocks to
    compute the total memory size which compared with the struct
    ttm_resource num_pages in order to verify that the blocks are
    contiguous for the eviction process.
    
    v2: Added a Fixes tag
    v3: Rewrite the code to save a bit of calculations and
        variables (Christian)
    
    Fixes: c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
    Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: "Limonciello, Mario" <Mario.Limonciello@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2bc9b08130ccfc68c769f2437f46c3a86969955e
Author: Manish Rangankar <mrangankar@marvell.com>
Date:   Tue Sep 27 04:59:46 2022 -0700

    scsi: qla2xxx: Use transport-defined speed mask for supported_speeds
    
    commit 0b863257c17c5f57a41e0a48de140ed026957a63 upstream.
    
    One of the sysfs values reported for supported_speeds was not valid (20Gb/s
    reported instead of 64Gb/s).  Instead of driver internal speed mask
    definition, use speed mask defined in transport_fc for reporting
    host->supported_speeds.
    
    Link: https://lore.kernel.org/r/20220927115946.17559-1-njavali@marvell.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 49cf484163030cb9e48bc5efa8ab94e246364e91
Author: Miquel Raynal <miquel.raynal@bootlin.com>
Date:   Thu Oct 20 16:25:35 2022 +0200

    mac802154: Fix LQI recording
    
    commit 5a5c4e06fd03b595542d5590f2bc05a6b7fc5c2b upstream.
    
    Back in 2014, the LQI was saved in the skb control buffer (skb->cb, or
    mac_cb(skb)) without any actual reset of this area prior to its use.
    
    As part of a useful rework of the use of this region, 32edc40ae65c
    ("ieee802154: change _cb handling slightly") introduced mac_cb_init() to
    basically memset the cb field to 0. In particular, this new function got
    called at the beginning of mac802154_parse_frame_start(), right before
    the location where the buffer got actually filled.
    
    What went through unnoticed however, is the fact that the very first
    helper called by device drivers in the receive path already used this
    area to save the LQI value for later extraction. Resetting the cb field
    "so late" led to systematically zeroing the LQI.
    
    If we consider the reset of the cb field needed, we can make it as soon
    as we get an skb from a device driver, right before storing the LQI,
    as is the very first time we need to write something there.
    
    Cc: stable@vger.kernel.org
    Fixes: 32edc40ae65c ("ieee802154: change _cb handling slightly")
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Acked-by: Alexander Aring <aahringo@redhat.com>
    Link: https://lore.kernel.org/r/20221020142535.1038885-1-miquel.raynal@bootlin.com
    Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 88337718780d4c492013d7bffb70fe4387847704
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Mon Jun 7 15:54:27 2021 +0200

    exec: Copy oldsighand->action under spin-lock
    
    commit 5bf2fedca8f59379025b0d52f917b9ddb9bfe17e upstream.
    
    unshare_sighand should only access oldsighand->action
    while holding oldsighand->siglock, to make sure that
    newsighand->action is in a consistent state.
    
    Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/AM8PR10MB470871DEBD1DED081F9CC391E4389@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit acd9b4914f1c5928c7ae8ebc623d6291eb1a573a
Author: Li Zetao <lizetao1@huawei.com>
Date:   Mon Oct 24 23:44:21 2022 +0800

    fs/binfmt_elf: Fix memory leak in load_elf_binary()
    
    commit 594d2a14f2168c09b13b114c3d457aa939403e52 upstream.
    
    There is a memory leak reported by kmemleak:
    
      unreferenced object 0xffff88817104ef80 (size 224):
        comm "xfs_admin", pid 47165, jiffies 4298708825 (age 1333.476s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          60 a8 b3 00 81 88 ff ff a8 10 5a 00 81 88 ff ff  `.........Z.....
        backtrace:
          [<ffffffff819171e1>] __alloc_file+0x21/0x250
          [<ffffffff81918061>] alloc_empty_file+0x41/0xf0
          [<ffffffff81948cda>] path_openat+0xea/0x3d30
          [<ffffffff8194ec89>] do_filp_open+0x1b9/0x290
          [<ffffffff8192660e>] do_open_execat+0xce/0x5b0
          [<ffffffff81926b17>] open_exec+0x27/0x50
          [<ffffffff81a69250>] load_elf_binary+0x510/0x3ed0
          [<ffffffff81927759>] bprm_execve+0x599/0x1240
          [<ffffffff8192a997>] do_execveat_common.isra.0+0x4c7/0x680
          [<ffffffff8192b078>] __x64_sys_execve+0x88/0xb0
          [<ffffffff83bbf0a5>] do_syscall_64+0x35/0x80
    
    If "interp_elf_ex" fails to allocate memory in load_elf_binary(),
    the program will take the "out_free_ph" error handing path,
    resulting in "interpreter" file resource is not released.
    
    Fix it by adding an error handing path "out_free_file", which will
    release the file resource when "interp_elf_ex" failed to allocate
    memory.
    
    Fixes: 0693ffebcfe5 ("fs/binfmt_elf.c: allocate less for static executable")
    Signed-off-by: Li Zetao <lizetao1@huawei.com>
    Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20221024154421.982230-1-lizetao1@huawei.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db52f11c19d7fb0bb66532a63e53cb7d65b1f40d
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Oct 24 21:22:48 2022 +0200

    cpufreq: intel_pstate: hybrid: Use known scaling factor for P-cores
    
    commit f5c8cf2a4992dd929fa0c2f25c09ee69b8dcbce1 upstream.
    
    Commit 46573fd6369f ("cpufreq: intel_pstate: hybrid: Rework HWP
    calibration") attempted to use the information from CPPC (the nominal
    performance in particular) to obtain the scaling factor allowing the
    frequency to be computed if the HWP performance level of the given CPU
    is known or vice versa.
    
    However, it turns out that on some platforms this doesn't work, because
    the CPPC information on them does not align with the contents of the
    MSR_HWP_CAPABILITIES registers.
    
    This basically means that the only way to make intel_pstate work on all
    of the hybrid platforms to date is to use the observation that on all
    of them the scaling factor between the HWP performance levels and
    frequency for P-cores is 78741 (approximately 100000/1.27).  For
    E-cores it is 100000, which is the same as for all of the non-hybrid
    "core" platforms and does not require any changes.
    
    Accordingly, make intel_pstate use 78741 as the scaling factor between
    HWP performance levels and frequency for P-cores on all hybrid platforms
    and drop the dependency of the HWP calibration code on CPPC.
    
    Fixes: 46573fd6369f ("cpufreq: intel_pstate: hybrid: Rework HWP calibration")
    Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Cc: 5.15+ <stable@vger.kernel.org> # 5.15+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b25ad654c0d6d0f8de883aea13f792d087d1a2fe
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Oct 24 21:21:00 2022 +0200

    cpufreq: intel_pstate: Read all MSRs on the target CPU
    
    commit 8dbab94d45fb1094cefac7956b7fb987a36e2b12 upstream.
    
    Some of the MSR accesses in intel_pstate are carried out on the CPU
    that is running the code, but the values coming from them are used
    for the performance scaling of the other CPUs.
    
    This is problematic, for example, on hybrid platforms where
    MSR_TURBO_RATIO_LIMIT for P-cores and E-cores is different, so the
    values read from it on a P-core are generally not applicable to E-cores
    and the other way around.
    
    For this reason, make the driver access all MSRs on the target CPU on
    platforms using the "core" pstate_funcs callbacks which is the case for
    all of the hybrid platforms released to date.  For this purpose, pass
    a CPU argument to the ->get_max(), ->get_max_physical(), ->get_min()
    and ->get_turbo() pstate_funcs callbacks and from there pass it to
    rdmsrl_on_cpu() or rdmsrl_safe_on_cpu() to access the MSR on the target
    CPU.
    
    Fixes: 46573fd6369f ("cpufreq: intel_pstate: hybrid: Rework HWP calibration")
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Cc: 5.15+ <stable@vger.kernel.org> # 5.15+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d924b262f3178a9b17c17d4306a9f426c508bd9
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Thu Oct 20 18:15:44 2022 -0700

    fbdev: smscufx: Fix several use-after-free bugs
    
    commit cc67482c9e5f2c80d62f623bcc347c29f9f648e1 upstream.
    
    Several types of UAFs can occur when physically removing a USB device.
    
    Adds ufx_ops_destroy() function to .fb_destroy of fb_ops, and
    in this function, there is kref_put() that finally calls ufx_free().
    
    This fix prevents multiple UAFs.
    
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Link: https://lore.kernel.org/linux-fbdev/20221011153436.GA4446@ubuntu/
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 31d019f2a4f223ed65ec67bf10e00ae6e33fd12a
Author: Helge Deller <deller@gmx.de>
Date:   Fri Oct 14 20:01:17 2022 +0200

    fbdev: stifb: Fall back to cfb_fillrect() on 32-bit HCRX cards
    
    commit 776d875fd4cbb3884860ea7f63c3958f02b0c80e upstream.
    
    When the text console is scrolling text upwards it calls the fillrect()
    function to empty the new line. The current implementation doesn't seem
    to work correctly on HCRX cards in 32-bit mode and leave garbage in that
    line instead. Fix it by falling back to standard cfb_fillrect() in that
    case.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3857686d12c3844240678c433e728a3bacdda5c9
Author: Matti Vaittinen <mazziesaccount@gmail.com>
Date:   Mon Oct 3 11:10:29 2022 +0300

    iio: adxl367: Fix unsafe buffer attributes
    
    commit 5e23b33d1e84f04c80da6f1d89cbb3d3a3f81e01 upstream.
    
    The devm_iio_kfifo_buffer_setup_ext() was changed by
    commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
    to silently expect that all attributes given in buffer_attrs array are
    device-attributes. This expectation was not forced by the API - and some
    drivers did register attributes created by IIO_CONST_ATTR().
    
    The added attribute "wrapping" does not copy the pointer to stored
    string constant and when the sysfs file is read the kernel will access
    to invalid location.
    
    Change the IIO_CONST_ATTRs from the driver to IIO_DEVICE_ATTR in order
    to prevent the invalid memory access.
    
    Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/2e2d9ec34fb1df8ab8e2749199822db8cc91d302.1664782676.git.mazziesaccount@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8e7f895ff9bf47bdc9f6a8a501bca6f4f780b349
Author: Matti Vaittinen <mazziesaccount@gmail.com>
Date:   Mon Oct 3 11:10:51 2022 +0300

    iio: adxl372: Fix unsafe buffer attributes
    
    commit ab0ee36e90f611f32c3a53afe9dc743de48138e2 upstream.
    
    The iio_triggered_buffer_setup_ext() was changed by
    commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
    to silently expect that all attributes given in buffer_attrs array are
    device-attributes. This expectation was not forced by the API - and some
    drivers did register attributes created by IIO_CONST_ATTR().
    
    The added attribute "wrapping" does not copy the pointer to stored
    string constant and when the sysfs file is read the kernel will access
    to invalid location.
    
    Change the IIO_CONST_ATTRs from the driver to IIO_DEVICE_ATTR in order
    to prevent the invalid memory access.
    
    Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/19158499623cdf7f9c5efae1f13c9f1a918ff75f.1664782676.git.mazziesaccount@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a9f294d2a327501ae5c301b33da1ccab6752aebe
Author: Cosmin Tanislav <cosmin.tanislav@analog.com>
Date:   Fri Oct 14 15:37:22 2022 +0300

    iio: temperature: ltc2983: allocate iio channels once
    
    commit 4132f19173211856d35180958d2754f5c56d520a upstream.
    
    Currently, every time the device wakes up from sleep, the
    iio_chan array is reallocated, leaking the previous one
    until the device is removed (basically never).
    
    Move the allocation to the probe function to avoid this.
    
    Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
    Fixes: f110f3188e563 ("iio: temperature: Add support for LTC2983")
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221014123724.1401011-2-demonsingur@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 18eb4951a7df3ef3c32cb25d45bd157fa0448418
Author: Shreeya Patel <shreeya.patel@collabora.com>
Date:   Fri Aug 26 17:53:52 2022 +0530

    iio: light: tsl2583: Fix module unloading
    
    commit 0dec4d2f2636b9e54d9d29f17afc7687c5407f78 upstream.
    
    tsl2583 probe() uses devm_iio_device_register() and calling
    iio_device_unregister() causes the unregister to occur twice. s
    Switch to iio_device_register() instead of devm_iio_device_register()
    in probe to avoid the device managed cleanup.
    
    Fixes: 371894f5d1a0 ("iio: tsl2583: add runtime power management support")
    Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
    Link: https://lore.kernel.org/r/20220826122352.288438-1-shreeya.patel@collabora.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 103c598220f3f4fce17cd67ef8871bd9ab4d416e
Author: Matti Vaittinen <mazziesaccount@gmail.com>
Date:   Thu Oct 13 15:04:04 2022 +0300

    tools: iio: iio_utils: fix digit calculation
    
    commit 72b2aa38191bcba28389b0e20bf6b4f15017ff2b upstream.
    
    The iio_utils uses a digit calculation in order to know length of the
    file name containing a buffer number. The digit calculation does not
    work for number 0.
    
    This leads to allocation of one character too small buffer for the
    file-name when file name contains value '0'. (Eg. buffer0).
    
    Fix digit calculation by returning one digit to be present for number
    '0'.
    
    Fixes: 096f9b862e60 ("tools:iio:iio_utils: implement digit calculation")
    Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Link: https://lore.kernel.org/r/Y0f+tKCz+ZAIoroQ@dc75zzyyyyyyyyyyyyycy-3.rev.dnainternet.fi
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3bf860a41e0f2fcea0ac3aae8f7ef887a7994b70
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Mon Oct 24 17:27:20 2022 +0300

    xhci: Remove device endpoints from bandwidth list when freeing the device
    
    commit 5aed5b7c2430ce318a8e62f752f181e66f0d1053 upstream.
    
    Endpoints are normally deleted from the bandwidth list when they are
    dropped, before the virt device is freed.
    
    If xHC host is dying or being removed then the endpoints aren't dropped
    cleanly due to functions returning early to avoid interacting with a
    non-accessible host controller.
    
    So check and delete endpoints that are still on the bandwidth list when
    freeing the virt device.
    
    Solves a list_del corruption kernel crash when unbinding xhci-pci,
    caused by xhci_mem_cleanup() when it later tried to delete already freed
    endpoints from the bandwidth list.
    
    This only affects hosts that use software bandwidth checking, which
    currenty is only the xHC in intel Panther Point PCH (Ivy Bridge)
    
    Cc: stable@vger.kernel.org
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20221024142720.4122053-5-mathias.nyman@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4bf5ed8145d8750b790c4cd66a12fc9528cec923
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Mon Oct 24 17:27:19 2022 +0300

    xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices
    
    commit a611bf473d1f77b70f7188b5577542cb39b4701b upstream.
    
    For optimal power consumption of USB4 routers the XHCI PCIe endpoint
    used for tunneling must be in D3.  Historically this is accomplished
    by a long list of PCIe IDs that correspond to these endpoints because
    the xhci_hcd driver will not default to allowing runtime PM for all
    devices.
    
    As both AMD and Intel have released new products with new XHCI controllers
    this list continues to grow. In reviewing the XHCI specification v1.2 on
    page 607 there is already a requirement that the PCI power management
    states D3hot and D3cold must be supported.
    
    In the quirk list, use this to indicate that runtime PM should be allowed
    on XHCI controllers. The following controllers are known to be xHC 1.2 and
    dropped explicitly:
    * AMD Yellow Carp
    * Intel Alder Lake
    * Intel Meteor Lake
    * Intel Raptor Lake
    
    [keep PCI ID for Alder Lake PCH for recently added quirk -Mathias]
    
    Cc: stable@vger.kernel.org
    Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20221024142720.4122053-4-mathias.nyman@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 609b6d38f42b442324e7a2e8d1f5ec26e7b1e19e
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Mon Oct 24 17:27:18 2022 +0300

    xhci: Add quirk to reset host back to default state at shutdown
    
    commit 34cd2db408d591bc15771cbcc90939ade0a99a21 upstream.
    
    Systems based on Alder Lake P see significant boot time delay if
    boot firmware tries to control usb ports in unexpected link states.
    
    This is seen with self-powered usb devices that survive in U3 link
    suspended state over S5.
    
    A more generic solution to power off ports at shutdown was attempted in
    commit 83810f84ecf1 ("xhci: turn off port power in shutdown")
    but it caused regression.
    
    Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and
    ports back to default state in shutdown.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20221024142720.4122053-3-mathias.nyman@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4bd562e89bf20278aacd9ecb8e6452e38111c8ce
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date:   Thu Oct 20 23:36:16 2022 +0100

    squashfs: fix buffer release race condition in readahead code
    
    commit e11c4e088be4c39d17f304fcf331670891905f42 upstream.
    
    Fix a buffer release race condition, where the error value was used after
    release.
    
    Link: https://lkml.kernel.org/r/20221020223616.7571-4-phillip@squashfs.org.uk
    Fixes: b09a7a036d20 ("squashfs: support reading fragments in readahead call")
    Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Reported-by: Marc Miltenberger <marcmiltenberger@gmail.com>
    Cc: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
    Cc: Hsin-Yi Wang <hsinyi@chromium.org>
    Cc: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Cc: Slade Watkins <srw@sladewatkins.net>
    Cc: Thorsten Leemhuis <regressions@leemhuis.info>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2d6f5a3544921c0d25899f82d76c05698c904d0
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date:   Thu Oct 20 23:36:15 2022 +0100

    squashfs: fix extending readahead beyond end of file
    
    commit c9199de82bad03bceb94ec3c5195c879d7e11911 upstream.
    
    The readahead code will try to extend readahead to the entire size of the
    Squashfs data block.
    
    But, it didn't take into account that the last block at the end of the
    file may not be a whole block.  In this case, the code would extend
    readahead to beyond the end of the file, leaving trailing pages.
    
    Fix this by only requesting the expected number of pages.
    
    Link: https://lkml.kernel.org/r/20221020223616.7571-3-phillip@squashfs.org.uk
    Fixes: 8fc78b6fe24c ("squashfs: implement readahead")
    Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Reported-by: Marc Miltenberger <marcmiltenberger@gmail.com>
    Cc: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
    Cc: Hsin-Yi Wang <hsinyi@chromium.org>
    Cc: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Cc: Slade Watkins <srw@sladewatkins.net>
    Cc: Thorsten Leemhuis <regressions@leemhuis.info>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

commit 4addfd77483620c858a088f668f52cc7dc4685bd
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date:   Thu Oct 20 23:36:14 2022 +0100

    squashfs: fix read regression introduced in readahead code
    
    commit 9ef8eb6104527bfe9ed31f7a4ffa721390adf9a8 upstream.
    
    Patch series "squashfs: fix some regressions introduced in the readahead
    code".
    
    This patchset fixes 3 regressions introduced by the recent readahead code
    changes.  The first regression is causing "snaps" to randomly fail after a
    couple of hours or days, which how the regression came to light.
    
    
    This patch (of 3):
    
    If a file isn't a whole multiple of the page size, the last page will have
    trailing bytes unfilled.
    
    There was a mistake in the readahead code which did this.  In particular
    it incorrectly assumed that the last page in the readahead page array
    (page[nr_pages - 1]) will always contain the last page in the block, which
    if we're at file end, will be the page that needs to be zero filled.
    
    But the readahead code may not return the last page in the block, which
    means it is unmapped and will be skipped by the decompressors (a temporary
    buffer used).
    
    In this case the zero filling code will zero out the wrong page, leading
    to data corruption.
    
    Fix this by by extending the "page actor" to return the last page if
    present, or NULL if a temporary buffer was used.
    
    Link: https://lkml.kernel.org/r/20221020223616.7571-1-phillip@squashfs.org.uk
    Link: https://lkml.kernel.org/r/20221020223616.7571-2-phillip@squashfs.org.uk
    Fixes: 8fc78b6fe24c ("squashfs: implement readahead")
    Link: https://lore.kernel.org/lkml/b0c258c3-6dcf-aade-efc4-d62a8b3a1ce2@alu.unizg.hr/
    Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
    Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Tested-by: Slade Watkins <srw@sladewatkins.net>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Reported-by: Marc Miltenberger <marcmiltenberger@gmail.com>
    Cc: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
    Cc: Hsin-Yi Wang <hsinyi@chromium.org>
    Cc: Thorsten Leemhuis <regressions@leemhuis.info>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c4c6d26fba84425674bedc016e4966e2c1e968bf
Author: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>
Date:   Tue Sep 27 15:47:28 2022 +1300

    mtd: rawnand: marvell: Use correct logic for nand-keep-config
    
    commit ce107713b722af57c4b7f2477594d445b496420e upstream.
    
    Originally the absence of the marvell,nand-keep-config property caused
    the setup_data_interface function to be provided. However when
    setup_data_interface was moved into nand_controller_ops the logic was
    unintentionally inverted. Update the logic so that only if the
    marvell,nand-keep-config property is present the bootloader NAND config
    kept.
    
    Cc: stable@vger.kernel.org
    Fixes: 7a08dbaedd36 ("mtd: rawnand: Move ->setup_data_interface() to nand_controller_ops")
    Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>
    Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
    Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220927024728.28447-1-chris.packham@alliedtelesis.co.nz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8960e81ca2e3d88adda30ed7c5233e57ac2eff65
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Tue Oct 18 11:11:29 2022 +0200

    mtd: parsers: bcm47xxpart: Fix halfblock reads
    
    commit 05e258c6ec669d6d18c494ea03d35962d6f5b545 upstream.
    
    There is some code in the parser that tries to read 0x8000
    bytes into a block to "read in the middle" of the block. Well
    that only works if the block is also 0x10000 bytes all the time,
    else we get these parse errors as we reach the end of the flash:
    
    spi-nor spi0.0: mx25l1606e (2048 Kbytes)
    mtd_read error while parsing (offset: 0x200000): -22
    mtd_read error while parsing (offset: 0x201000): -22
    (...)
    
    Fix the code to do what I think was intended.
    
    Cc: stable@vger.kernel.org
    Fixes: f0501e81fbaa ("mtd: bcm47xxpart: alternative MAGIC for board_data partition")
    Cc: Rafał Miłecki <zajec5@gmail.com>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20221018091129.280026-1-linus.walleij@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d08884b010014ff3e633b964e84b1e625b27846f
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Fri Sep 23 12:34:41 2022 +0300

    mtd: spi-nor: core: Ignore -ENOTSUPP in spi_nor_init()
    
    commit 69d04ca999499bccb6ca849fa2bfc5e6448f7233 upstream.
    
    The Intel SPI-NOR controller does not support the 4-byte address opcode
    so ->set_4byte_addr_mode() ends up returning -ENOTSUPP and the SPI flash
    chip probe fail like this:
    
      [ 12.291082] spi-nor: probe of spi0.0 failed with error -524
    
    Whereas previously before commit 08412e72afba ("mtd: spi-nor: core:
    Return error code from set_4byte_addr_mode()") it worked just fine.
    
    Fix this by ignoring -ENOTSUPP in spi_nor_init().
    
    Fixes: 08412e72afba ("mtd: spi-nor: core: Return error code from set_4byte_addr_mode()")
    Cc: stable@vger.kernel.org
    Reported-by: Hongyu Ning <hongyu.ning@intel.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: Michael Walle <michael@walle.cc>
    Acked-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220923093441.3178-1-mika.westerberg@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34d77d4acda58cd585a93a944e69c732345e65eb
Author: Zhang Qilong <zhangqilong3@huawei.com>
Date:   Mon Sep 26 16:44:56 2022 +0800

    mtd: rawnand: tegra: Fix PM disable depth imbalance in probe
    
    commit 3ada71310d2c68eebb57772df6bb1f5f033ae802 upstream.
    
    The pm_runtime_enable will increase power disable depth. Thus
    a pairing decrement is needed on the error handling path to
    keep it balanced according to context.
    
    Cc: stable@vger.kernel.org
    Fixes: d7d9f8ec77fe9 ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
    Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20220926084456.98160-1-zhangqilong3@huawei.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 69cb3ebb39cedd2dd4bca6e5330c44a73bd6e614
Author: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Date:   Mon Oct 24 17:27:17 2022 +0300

    usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller
    
    commit 4f547472380136718b56064ea5689a61e135f904 upstream.
    
    This appears to fix the error:
    "xhci_hcd <address>; ERROR Transfer event TRB DMA ptr not part of
    current TD ep_index 2 comp_code 13" that appear spuriously (or pretty
    often) when using a r8152 USB3 ethernet adapter with integrated hub.
    
    ASM1042 reports as a 0.96 controller, but appears to behave more like 1.0
    
    Inspired by this email thread: https://markmail.org/thread/7vzqbe7t6du6qsw3
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20221024142720.4122053-2-mathias.nyman@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 237b63d4e5ae9f6aa44bac94f7332deb91b6c8fc
Author: Justin Chen <justinpopo6@gmail.com>
Date:   Wed Oct 5 12:13:55 2022 -0700

    usb: bdc: change state when port disconnected
    
    commit fb8f60dd1b67520e0e0d7978ef17d015690acfc1 upstream.
    
    When port is connected and then disconnected, the state stays as
    configured. Which is incorrect as the port is no longer configured,
    but in a not attached state.
    
    Signed-off-by: Justin Chen <justinpopo6@gmail.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Fixes: efed421a94e6 ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC")
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/1664997235-18198-1-git-send-email-justinpopo6@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1efb7ca66717b0d9f9ae92910cb1e1a6734c21b
Author: Andrey Smirnov <andrew.smirnov@gmail.com>
Date:   Tue Oct 18 02:35:10 2022 +0300

    usb: dwc3: Don't switch OTG -> peripheral if extcon is present
    
    commit d182c2e1bc92084c038b44c618f29589a4de9f66 upstream.
    
    If the extcon device exists, get the mode from the extcon device. If
    the controller is DRD and the driver is unable to determine the mode,
    only then default the dr_mode to USB_DR_MODE_PERIPHERAL.
    
    Reported-by: Steev Klimaszewski <steev@kali.org>
    Fixes: 7a84e7353e23 ("Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present"")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Tested-by: Steev Klimaszewski <steev@kali.org>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20221017233510.53336-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3a2e492e95173d714ae707d6c3f6ab363306758
Author: Patrice Chotard <patrice.chotard@foss.st.com>
Date:   Fri Sep 30 16:20:18 2022 +0200

    usb: dwc3: st: Rely on child's compatible instead of name
    
    commit 3f53c329b31d53b2a2e7992819242fc0d4f883e0 upstream.
    
    To ensure that child node is found, don't rely on child's node name
    which can take different value, but on child's compatible name.
    
    Fixes: f5c5936d6b4d ("usb: dwc3: st: Fix node's child name")
    Cc: stable <stable@kernel.org>
    Cc: Jerome Audu <jerome.audu@st.com>
    Reported-by: Felipe Balbi <felipe@balbi.sh>
    Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
    Link: https://lore.kernel.org/r/20220930142018.890535-1-patrice.chotard@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 14886b72e4592519125a4746a1492118f5540312
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Fri Oct 7 13:09:51 2022 +0300

    usb: typec: ucsi: acpi: Implement resume callback
    
    commit 4e3a50293c2b21961f02e1afa2f17d3a1a90c7c8 upstream.
    
    The ACPI driver needs to resume the interface by calling
    ucsi_resume(). Otherwise we may fail to detect connections
    and disconnections that happen while the system is
    suspended.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=210425
    Fixes: a94ecde41f7e ("usb: typec: ucsi: ccg: enable runtime pm support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://lore.kernel.org/r/20221007100951.43798-3-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76bac6cfb0b9dfe53eddd124e85ab7a605696409
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Fri Oct 7 13:09:50 2022 +0300

    usb: typec: ucsi: Check the connection on resume
    
    commit 99f6d43611135bd6f211dec9e88bb41e4167e304 upstream.
    
    Checking the connection status of every port on resume. This
    fixes an issue where the partner device is not unregistered
    properly after resume if it was unplugged while the system
    was suspended.
    
    The function ucsi_check_connection() is also modified so
    that it can be used also for registering the connection on
    top of unregistering it.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=210425
    Fixes: a94ecde41f7e ("usb: typec: ucsi: ccg: enable runtime pm support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://lore.kernel.org/r/20221007100951.43798-2-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d1b9d6a56881e6de48b519f4056a555d2cfe740f
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Tue Oct 18 19:39:01 2022 -0700

    usb: dwc3: gadget: Don't delay End Transfer on delayed_status
    
    commit 4db0fbb601361767144e712beb96704b966339f5 upstream.
    
    The gadget driver may wait on the request completion when it sets the
    USB_GADGET_DELAYED_STATUS. Make sure that the End Transfer command can
    go through if the dwc->delayed_status is set so that the request can
    complete. When the delayed_status is set, the Setup packet is already
    processed, and the next phase should be either Data or Status. It's
    unlikely that the host would cancel the control transfer and send a new
    Setup packet during End Transfer command. But if that's the case, we can
    try again when ep0state returns to EP0_SETUP_PHASE.
    
    Fixes: e1ee843488d5 ("usb: dwc3: gadget: Force sending delayed status during soft disconnect")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/3f9f59e5d74efcbaee444cf4b30ef639cc7b124e.1666146954.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9e4f07f4a02f9ff0a485c0b1e76482f41a773fdf
Author: Wesley Cheng <quic_wcheng@quicinc.com>
Date:   Wed Aug 17 11:23:52 2022 -0700

    usb: dwc3: gadget: Force sending delayed status during soft disconnect
    
    commit e1ee843488d58099a89979627ef85d5bd6c5cacd upstream.
    
    If any function drivers request for a delayed status phase, this leads to a
    SETUP transfer timeout error, since the function may take longer to process
    the DATA stage.  This eventually results in end transfer timeouts, as there
    is a pending SETUP transaction.
    
    In addition, allow the DWC3_EP_DELAY_STOP to be set for if there is a
    delayed status requested.  Ocasionally, a host may abort the current SETUP
    transaction, by issuing a subsequent SETUP token.  In those situations, it
    would result in an endxfer timeout as well.
    
    Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20220817182359.13550-3-quic_wcheng@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d179b68c251b96df8cd9e0b1a3b78a316cab3b6a
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Tue Oct 25 15:10:20 2022 -0700

    usb: dwc3: gadget: Don't set IMI for no_interrupt
    
    commit 308c316d16cbad99bb834767382baa693ac42169 upstream.
    
    The gadget driver may have a certain expectation of how the request
    completion flow should be from to its configuration. Make sure the
    controller driver respect that. That is, don't set IMI (Interrupt on
    Missed Isoc) when usb_request->no_interrupt is set. Also, the driver
    should only set IMI to the last TRB of a chain.
    
    Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Reviewed-by: Jeff Vanhoof <jdv1029@gmail.com>
    Tested-by: Jeff Vanhoof <jdv1029@gmail.com>
    Link: https://lore.kernel.org/r/ced336c84434571340c07994e3667a0ee284fefe.1666735451.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7f6014a8edd750498024037cda4523aa852a70a
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Tue Oct 25 15:10:14 2022 -0700

    usb: dwc3: gadget: Stop processing more requests on IMI
    
    commit f78961f8380b940e0cfc7e549336c21a2ad44f4d upstream.
    
    When servicing a transfer completion event, the dwc3 driver will reclaim
    TRBs of started requests up to the request associated with the interrupt
    event. Currently we don't check for interrupt due to missed isoc, and
    the driver may attempt to reclaim TRBs beyond the associated event. This
    causes invalid memory access when the hardware still owns the TRB. If
    there's a missed isoc TRB with IMI (interrupt on missed isoc), make sure
    to stop servicing further.
    
    Note that only the last TRB of chained TRBs has its status updated with
    missed isoc.
    
    Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
    Cc: stable@vger.kernel.org
    Reported-by: Jeff Vanhoof <jdv1029@gmail.com>
    Reported-by: Dan Vacura <w36195@motorola.com>
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Reviewed-by: Jeff Vanhoof <jdv1029@gmail.com>
    Tested-by: Jeff Vanhoof <jdv1029@gmail.com>
    Link: https://lore.kernel.org/r/b29acbeab531b666095dfdafd8cb5c7654fbb3e1.1666735451.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1ef943c7fda85727e042ef0e98fcc1bec49e3567
Author: Joel Stanley <joel@jms.id.au>
Date:   Mon Oct 17 16:00:06 2022 +1030

    usb: gadget: aspeed: Fix probe regression
    
    commit 48ed32482c4100069d0c0eebdc6b198c6ae5f71f upstream.
    
    Since commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets"),
    the gadget devices are proper driver core devices, which caused each
    device to request pinmux settings:
    
     aspeed_vhub 1e6a0000.usb-vhub: Initialized virtual hub in USB2 mode
     aspeed-g5-pinctrl 1e6e2080.pinctrl: pin A7 already requested by 1e6a0000.usb-vhub; cannot claim for gadget.0
     aspeed-g5-pinctrl 1e6e2080.pinctrl: pin-232 (gadget.0) status -22
     aspeed-g5-pinctrl 1e6e2080.pinctrl: could not request pin 232 (A7) from group USB2AD  on device aspeed-g5-pinctrl
     g_mass_storage gadget.0: Error applying setting, reverse things back
    
    The vhub driver has already claimed the pins, so prevent the gadgets
    from requesting them too by setting the magic of_node_reused flag. This
    causes the driver core to skip the mux request.
    
    Reported-by: Zev Weiss <zev@bewilderbeest.net>
    Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
    Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joel Stanley <joel@jms.id.au>
    Tested-by: Zev Weiss <zev@bewilderbeest.net>
    Tested-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
    Link: https://lore.kernel.org/r/20221017053006.358520-1-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c028cec22129d61e2673d437dd6150fd710edd9c
Author: Jeff Vanhoof <qjv001@motorola.com>
Date:   Tue Oct 18 16:50:40 2022 -0500

    usb: gadget: uvc: fix sg handling during video encode
    
    commit b57b08e6f431348363adffa5b6643fe3ec9dc7fe upstream.
    
    In uvc_video_encode_isoc_sg, the uvc_request's sg list is
    incorrectly being populated leading to corrupt video being
    received by the remote end. When building the sg list the
    usage of buf->sg's 'dma_length' field is not correct and
    instead its 'length' field should be used.
    
    Fixes: e81e7f9a0eb9 ("usb: gadget: uvc: add scatter gather support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Jeff Vanhoof <qjv001@motorola.com>
    Signed-off-by: Dan Vacura <w36195@motorola.com>
    Link: https://lore.kernel.org/r/20221018215044.765044-5-w36195@motorola.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a96c8afe53d1d7bbb44430d06f4b5f638323cac8
Author: Dan Vacura <w36195@motorola.com>
Date:   Tue Oct 18 16:50:39 2022 -0500

    usb: gadget: uvc: fix sg handling in error case
    
    commit 0a0a2760b04814428800d48281a447a7522470ad upstream.
    
    If there is a transmission error the buffer will be returned too early,
    causing a memory fault as subsequent requests for that buffer are still
    queued up to be sent. Refactor the error handling to wait for the final
    request to come in before reporting back the buffer to userspace for all
    transfer types (bulk/isoc/isoc_sg). This ensures userspace knows if the
    frame was successfully sent.
    
    Fixes: e81e7f9a0eb9 ("usb: gadget: uvc: add scatter gather support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Dan Vacura <w36195@motorola.com>
    Link: https://lore.kernel.org/r/20221018215044.765044-4-w36195@motorola.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 912475a2b87da71c15102b8569520dcea461b28c
Author: Dan Vacura <w36195@motorola.com>
Date:   Tue Oct 18 16:50:37 2022 -0500

    usb: gadget: uvc: fix dropped frame after missed isoc
    
    commit 8e8e923a49967b798e7d69f1ce9eff1dd2533547 upstream.
    
    With the re-use of the previous completion status in 0d1c407b1a749
    ("usb: dwc3: gadget: Return proper request status") it could be possible
    that the next frame would also get dropped if the current frame has a
    missed isoc error. Ensure that an interrupt is requested for the start
    of a new frame.
    
    Fixes: fc78941d8169 ("usb: gadget: uvc: decrease the interrupt load to a quarter")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Dan Vacura <w36195@motorola.com>
    Link: https://lore.kernel.org/r/20221018215044.765044-2-w36195@motorola.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a0928db7c752f107321766a93e09c9b73437d790
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Oct 26 14:09:06 2022 +0200

    Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets"
    
    commit 88c8e05ed5c0f05a637e654bbe4e49a1ebe7013c upstream.
    
    This reverts commit 19905240aef0181d1e6944070eb85fce75f75bcd.
    
    It was a new feature, and it doesn't even work properly yet, so revert
    it from this branch as it is not needed for 6.1-final.
    
    Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Fixes: 19905240aef0 ("usb: gadget: uvc: limit isoc_sg to super speed gadgets")
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 48fd5d8c0f6921198b8ff7926c07a498156deff1
Author: Michael Grzeschik <m.grzeschik@pengutronix.de>
Date:   Tue Oct 18 00:11:41 2022 +0200

    usb: gadget: uvc: limit isoc_sg to super speed gadgets
    
    commit 19905240aef0181d1e6944070eb85fce75f75bcd upstream.
    
    The overhead of preparing sg data is high for transfers with limited
    payload. When transferring isoc over high-speed usb the maximum payload
    is rather small which is a good argument no to use sg. This patch is
    changing the uvc_video_encode_isoc_sg encode function only to be used
    for super speed gadgets.
    
    Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20221017221141.3134818-1-m.grzeschik@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6696b225603fffa6355191aac829fdd30daf5359
Author: Hannu Hartikainen <hannu@hrtk.in>
Date:   Mon Sep 19 20:16:10 2022 +0300

    USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM
    
    commit fc4ade55c617dc73c7e9756b57f3230b4ff24540 upstream.
    
    NVIDIA Jetson devices in Force Recovery mode (RCM) do not support
    suspending, ie. flashing fails if the device has been suspended. The
    devices are still visible in lsusb and seem to work otherwise, making
    the issue hard to debug. This has been discovered in various forum
    posts, eg. [1].
    
    The patch has been tested on NVIDIA Jetson AGX Xavier, but I'm adding
    all the Jetson models listed in [2] on the assumption that they all
    behave similarly.
    
    [1]: https://forums.developer.nvidia.com/t/flashing-not-working/72365
    [2]: https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3271/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/quick_start.html
    
    Signed-off-by: Hannu Hartikainen <hannu@hrtk.in>
    Cc: stable <stable@kernel.org>  # after 6.1-rc3
    Link: https://lore.kernel.org/r/20220919171610.30484-1-hannu@hrtk.in
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d49a4891f028cd893b7a3e97033baf9e14b508e8
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Tue Oct 25 02:03:13 2022 +0200

    ALSA: rme9652: use explicitly signed char
    
    commit 50895a55bcfde8ac6f22a37c6bc8cff506b3c7c6 upstream.
    
    With char becoming unsigned by default, and with `char` alone being
    ambiguous and based on architecture, signed chars need to be marked
    explicitly as such. This fixes warnings like:
    
    sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
    sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
    sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned
    
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221025000313.546261-1-Jason@zx2c4.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a37028712349ba665584c094407f4c9acf8f893
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Mon Oct 24 18:29:29 2022 +0200

    ALSA: au88x0: use explicitly signed char
    
    commit ee03c0f200eb0d9f22dd8732d9fb7956d91019c2 upstream.
    
    With char becoming unsigned by default, and with `char` alone being
    ambiguous and based on architecture, signed chars need to be marked
    explicitly as such. This fixes warnings like:
    
    sound/pci/au88x0/au88x0_core.c:2029 vortex_adb_checkinout() warn: signedness bug returning '(-22)'
    sound/pci/au88x0/au88x0_core.c:2046 vortex_adb_checkinout() warn: signedness bug returning '(-12)'
    sound/pci/au88x0/au88x0_core.c:2125 vortex_adb_allocroute() warn: 'vortex_adb_checkinout(vortex, (0), en, 0)' is unsigned
    sound/pci/au88x0/au88x0_core.c:2170 vortex_adb_allocroute() warn: 'vortex_adb_checkinout(vortex, stream->resources, en, 4)' is unsigned
    
    As well, since one function returns errnos, return an `int` rather than
    a `signed char`.
    
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221024162929.536004-1-Jason@zx2c4.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 58a6b4af5e0864e2c3929cedc81b0a7ffdaede5d
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:25 2022 +0200

    ALSA: ca0106: Use snd_ctl_rename() to rename a control
    
    commit 957ccc434c398a88a332ae92d70790c186a18a1c upstream.
    
    With the recent addition of hashed controls lookup it's not enough to just
    update the control name field, the hash entries for the modified control
    have to be updated too.
    
    snd_ctl_rename() takes care of that, so use it instead of directly
    modifying the control name.
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/bffee980a420f9b0eee5681d2f48d34a70cec0ce.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0203d3621972cca73c0997aa2fe1df0730e2faf0
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:22 2022 +0200

    ALSA: usb-audio: Use snd_ctl_rename() to rename a control
    
    commit 0b4f0debb34754002cee295441c9ca89ba8cdfcc upstream.
    
    With the recent addition of hashed controls lookup it's not enough to just
    update the control name field, the hash entries for the modified control
    have to be updated too.
    
    snd_ctl_rename() takes care of that, so use it instead of directly
    modifying the control name.
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/723877882e3a56bb42a2a2214cfc85f347d36e19.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afe272b49f9f5d394092d9e03814f3de5d2b1c7b
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:26 2022 +0200

    ALSA: ac97: Use snd_ctl_rename() to rename a control
    
    commit 52d256cc71f546f67037100c64eb4fa3ae5e4704 upstream.
    
    With the recent addition of hashed controls lookup it's not enough to just
    update the control name field, the hash entries for the modified control
    have to be updated too.
    
    snd_ctl_rename() takes care of that, so use it instead of directly
    modifying the control name.
    
    While we are at it, check also that the new control name doesn't
    accidentally overwrite the available buffer space.
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/adb68bfa0885ba4a2583794b828f8e20d23f67c7.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f1d610b792b62fb787e4326feca5bda0d6d937e9
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:24 2022 +0200

    ALSA: emu10k1: Use snd_ctl_rename() to rename a control
    
    commit 36476b81b2b5db1de5adb8ced1f71b8972a9d4dd upstream.
    
    With the recent addition of hashed controls lookup it's not enough to just
    update the control name field, the hash entries for the modified control
    have to be updated too.
    
    snd_ctl_rename() takes care of that, so use it instead of directly
    modifying the control name.
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/38b19f019f95ee78a6e4e59d39afb9e2c3379413.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 74e988ee3e7ec22d0b30d180d8e6731c6647a97f
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:23 2022 +0200

    ALSA: hda/realtek: Use snd_ctl_rename() to rename a control
    
    commit b51c225376a684d02fb58b49cf0ce3d693b6f14b upstream.
    
    With the recent addition of hashed controls lookup it's not enough to just
    update the control name field, the hash entries for the modified control
    have to be updated too.
    
    snd_ctl_rename() takes care of that, so use it instead of directly
    modifying the control name.
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/37496bd80f91f373268148f877fd735917d97287.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 862678dfec33f8ff7d9e4ae2875028a9c97b543d
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 20 22:46:21 2022 +0200

    ALSA: control: add snd_ctl_rename()
    
    commit 966f015fe4329199cc49084ee2886cfb626b34d3 upstream.
    
    Add a snd_ctl_rename() function that takes care of updating the control
    hash entries for callers that already have the relevant struct snd_kcontrol
    at hand and hold the control write lock (or simply haven't registered the
    card yet).
    
    Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Link: https://lore.kernel.org/r/4170b71117ea81357a4f7eb8410f7cde20836c70.1666296963.git.maciej.szmigiero@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6787388a1a36d643262c834a95ab23c511e8929c
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sat Oct 22 09:21:07 2022 +0200

    ALSA: hda/realtek: Add another HP ZBook G9 model quirks
    
    commit f86bfeb689f2c4ebe12782ef0578ef778fb1a050 upstream.
    
    HP ZBook Firefly 16 G9 (103c:896d) and HP ZBook Power 15.6 G9
    (103c:89c0) require the same quirk for enabling CS35L41 speaker amps.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221022072107.3401-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e8581095dd284a11c0f1c437862dfc716399c2f0
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Oct 21 14:27:22 2022 +0200

    ALSA: usb-audio: Add quirks for M-Audio Fast Track C400/600
    
    commit 794814529384721ce8f4d34228dc599cc010353d upstream.
    
    M-Audio Fast Track C400 and C600 devices (0763:2030 and 0763:2031,
    respectively) seem requiring the explicit setup for the implicit
    feedback mode.  This patch adds the quirk entries for those.
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214817
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221021122722.24784-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2cb009edf49a8f3eb8ba9d6f7657adc68aed61a0
Author: Stefan Binding <sbinding@opensource.cirrus.com>
Date:   Tue Oct 18 13:15:06 2022 +0100

    ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41
    
    commit 491a4ccd8a0258392900c80c6b2b622c7115fc23 upstream.
    
    This Asus Zenbook laptop use Realtek HDA codec combined with
    2xCS35L41 Amplifiers using SPI with External Boost.
    
    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20221018121506.2561397-1-sbinding@opensource.cirrus.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cbeb36b986c7b1269255ceb8c0d78fec6ed2fe89
Author: Steven Rostedt (Google) <rostedt@goodmis.org>
Date:   Wed Oct 26 23:12:36 2022 -0400

    ALSA: Use del_timer_sync() before freeing timer
    
    commit f0a868788fcbf63cdab51f5adcf73b271ede8164 upstream.
    
    The current code for freeing the emux timer is extremely dangerous:
    
      CPU0                          CPU1
      ----                          ----
    snd_emux_timer_callback()
                                snd_emux_free()
                                  spin_lock(&emu->voice_lock)
                                  del_timer(&emu->tlist); <-- returns immediately
                                  spin_unlock(&emu->voice_lock);
                                  [..]
                                  kfree(emu);
    
      spin_lock(&emu->voice_lock);
    
     [BOOM!]
    
    Instead just use del_timer_sync() which will wait for the timer to finish
    before continuing. No need to check if the timer is active or not when
    doing so.
    
    This doesn't fix the race of a possible re-arming of the timer, but at
    least it won't use the data that has just been freed.
    
    [ Fixed unused variable warning by tiwai ]
    
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20221026231236.6834b551@gandalf.local.home
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6804f4b3ff2a025090690ffd54a7d7a99c669bb4
Author: Biju Das <biju.das.jz@bp.renesas.com>
Date:   Tue Oct 25 16:56:56 2022 +0100

    can: rcar_canfd: fix channel specific IRQ handling for RZ/G2L
    
    commit d887087c896881715c1a82f1d4f71fbfe5344ffd upstream.
    
    RZ/G2L has separate channel specific IRQs for transmit and error
    interrupts. But the IRQ handler processes both channels, even if there
    no interrupt occurred on one of the channels.
    
    This patch fixes the issue by passing a channel specific context
    parameter instead of global one for the IRQ register and the IRQ
    handler, it just handles the channel which is triggered the interrupt.
    
    Fixes: 76e9353a80e9 ("can: rcar_canfd: Add support for RZ/G2L family")
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Link: https://lore.kernel.org/all/20221025155657.1426948-3-biju.das.jz@bp.renesas.com
    Cc: stable@vger.kernel.org
    [mkl: adjust commit message]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 89935f880db7392a38c93a6e03d81d5d8766ea19
Author: Biju Das <biju.das.jz@bp.renesas.com>
Date:   Tue Oct 25 16:56:55 2022 +0100

    can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive
    
    commit 702de2c21eed04c67cefaaedc248ef16e5f6b293 upstream.
    
    We are seeing an IRQ storm on the global receive IRQ line under heavy
    CAN bus load conditions with both CAN channels enabled.
    
    Conditions:
    
    The global receive IRQ line is shared between can0 and can1, either of
    the channels can trigger interrupt while the other channel's IRQ line
    is disabled (RFIE).
    
    When global a receive IRQ interrupt occurs, we mask the interrupt in
    the IRQ handler. Clearing and unmasking of the interrupt is happening
    in rx_poll(). There is a race condition where rx_poll() unmasks the
    interrupt, but the next IRQ handler does not mask the IRQ due to
    NAPIF_STATE_MISSED flag (e.g.: can0 RX FIFO interrupt is disabled and
    can1 is triggering RX interrupt, the delay in rx_poll() processing
    results in setting NAPIF_STATE_MISSED flag) leading to an IRQ storm.
    
    This patch fixes the issue by checking IRQ active and enabled before
    handling the IRQ on a particular channel.
    
    Fixes: dd3bd23eb438 ("can: rcar_canfd: Add Renesas R-Car CAN FD driver")
    Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Link: https://lore.kernel.org/all/20221025155657.1426948-2-biju.das.jz@bp.renesas.com
    Cc: stable@vger.kernel.org
    [mkl: adjust commit message]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e1a4048a4804471291e0d0433a676f61e3d0bd9b
Author: Anssi Hannula <anssi.hannula@bitwise.fi>
Date:   Mon Oct 10 20:52:27 2022 +0200

    can: kvaser_usb: Fix possible completions during init_completion
    
    commit 2871edb32f4622c3a25ce4b3977bad9050b91974 upstream.
    
    kvaser_usb uses completions to signal when a response event is received
    for outgoing commands.
    
    However, it uses init_completion() to reinitialize the start_comp and
    stop_comp completions before sending the start/stop commands.
    
    In case the device sends the corresponding response just before the
    actual command is sent, complete() may be called concurrently with
    init_completion() which is not safe.
    
    This might be triggerable even with a properly functioning device by
    stopping the interface (CMD_STOP_CHIP) just after it goes bus-off (which
    also causes the driver to send CMD_STOP_CHIP when restart-ms is off),
    but that was not tested.
    
    Fix the issue by using reinit_completion() instead.
    
    Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
    Tested-by: Jimmy Assarsson <extja@kvaser.com>
    Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
    Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
    Link: https://lore.kernel.org/all/20221010185237.319219-2-extja@kvaser.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c04325028afdaf48e0d7f265fca240da424f6709
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Thu Oct 27 17:12:37 2022 +0800

    can: j1939: transport: j1939_session_skb_drop_old(): spin_unlock_irqrestore() before kfree_skb()
    
    commit c3c06c61890da80494bb196f75d89b791adda87f upstream.
    
    It is not allowed to call kfree_skb() from hardware interrupt context
    or with interrupts being disabled. The skb is unlinked from the queue,
    so it can be freed after spin_unlock_irqrestore().
    
    Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://lore.kernel.org/all/20221027091237.2290111-1-yangyingliang@huawei.com
    Cc: stable@vger.kernel.org
    [mkl: adjust subject]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c44b338e4feab95b4751c20b8fae22cffff7d2aa
Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Date:   Thu Sep 22 23:26:08 2022 +0530

    platform/x86/amd: pmc: remove CONFIG_DEBUG_FS checks
    
    commit b37fe34c83099ba5105115f8287c5546af1f0a05 upstream.
    
    Since linux/debugfs.h already has the stubs for the used debugfs
    functions when debugfs is not enabled, remove the #ifdef CONFIG_DEBUG_FS
    checks.
    
    Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    Link: https://lore.kernel.org/r/20220922175608.630046-1-Shyam-sundar.S-k@amd.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Cc: Jaak Ristioja <jaak@ristioja.ee>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>