Linux 5.10.216

 
af_unix: Do not use atomic ops for unix_sk(sk)->inflight. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Tue Jan 23 09:08:53 2024 -0800

    af_unix: Do not use atomic ops for unix_sk(sk)->inflight.
    
    [ Upstream commit 97af84a6bba2ab2b9c704c08e67de3b5ea551bb2 ]
    
    When touching unix_sk(sk)->inflight, we are always under
    spin_lock(&unix_gc_lock).
    
    Let's convert unix_sk(sk)->inflight to the normal unsigned long.
    
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 47d8ac011fe1 ("af_unix: Fix garbage collector racing against connect()")
    Signed-off-by: Sasha Levin <[email protected]>

af_unix: Fix garbage collector racing against connect() [+ + +]
Author: Michal Luczaj <[email protected]>
Date:   Tue Apr 9 22:09:39 2024 +0200

    af_unix: Fix garbage collector racing against connect()
    
    [ Upstream commit 47d8ac011fe1c9251070e1bd64cb10b48193ec51 ]
    
    Garbage collector does not take into account the risk of embryo getting
    enqueued during the garbage collection. If such embryo has a peer that
    carries SCM_RIGHTS, two consecutive passes of scan_children() may see a
    different set of children. Leading to an incorrectly elevated inflight
    count, and then a dangling pointer within the gc_inflight_list.
    
    sockets are AF_UNIX/SOCK_STREAM
    S is an unconnected socket
    L is a listening in-flight socket bound to addr, not in fdtable
    V's fd will be passed via sendmsg(), gets inflight count bumped
    
    connect(S, addr)        sendmsg(S, [V]); close(V)       __unix_gc()
    ----------------        -------------------------       -----------
    
    NS = unix_create1()
    skb1 = sock_wmalloc(NS)
    L = unix_find_other(addr)
    unix_state_lock(L)
    unix_peer(S) = NS
                            // V count=1 inflight=0
    
                            NS = unix_peer(S)
                            skb2 = sock_alloc()
                            skb_queue_tail(NS, skb2[V])
    
                            // V became in-flight
                            // V count=2 inflight=1
    
                            close(V)
    
                            // V count=1 inflight=1
                            // GC candidate condition met
    
                                                    for u in gc_inflight_list:
                                                      if (total_refs == inflight_refs)
                                                        add u to gc_candidates
    
                                                    // gc_candidates={L, V}
    
                                                    for u in gc_candidates:
                                                      scan_children(u, dec_inflight)
    
                                                    // embryo (skb1) was not
                                                    // reachable from L yet, so V's
                                                    // inflight remains unchanged
    __skb_queue_tail(L, skb1)
    unix_state_unlock(L)
                                                    for u in gc_candidates:
                                                      if (u.inflight)
                                                        scan_children(u, inc_inflight_move_tail)
    
                                                    // V count=1 inflight=2 (!)
    
    If there is a GC-candidate listening socket, lock/unlock its state. This
    makes GC wait until the end of any ongoing connect() to that socket. After
    flipping the lock, a possibly SCM-laden embryo is already enqueued. And if
    there is another embryo coming, it can not possibly carry SCM_RIGHTS. At
    this point, unix_inflight() can not happen because unix_gc_lock is already
    taken. Inflight graph remains unaffected.
    
    Fixes: 1fd05ba5a2f2 ("[AF_UNIX]: Rewrite garbage collector, fixes race.")
    Signed-off-by: Michal Luczaj <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc(). [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Wed Apr 24 10:04:43 2024 -0700

    af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc().
    
    [ Upstream commit 1971d13ffa84a551d29a81fdf5b5ec5be166ac83 ]
    
    syzbot reported a lockdep splat regarding unix_gc_lock and
    unix_state_lock().
    
    One is called from recvmsg() for a connected socket, and another
    is called from GC for TCP_LISTEN socket.
    
    So, the splat is false-positive.
    
    Let's add a dedicated lock class for the latter to suppress the splat.
    
    Note that this change is not necessary for net-next.git as the issue
    is only applied to the old GC impl.
    
    [0]:
    WARNING: possible circular locking dependency detected
    6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0 Not tainted
     -----------------------------------------------------
    kworker/u8:1/11 is trying to acquire lock:
    ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
    ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
    
    but task is already holding lock:
    ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
    ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
     -> #1 (unix_gc_lock){+.+.}-{2:2}:
           lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
           __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
           _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
           spin_lock include/linux/spinlock.h:351 [inline]
           unix_notinflight+0x13d/0x390 net/unix/garbage.c:140
           unix_detach_fds net/unix/af_unix.c:1819 [inline]
           unix_destruct_scm+0x221/0x350 net/unix/af_unix.c:1876
           skb_release_head_state+0x100/0x250 net/core/skbuff.c:1188
           skb_release_all net/core/skbuff.c:1200 [inline]
           __kfree_skb net/core/skbuff.c:1216 [inline]
           kfree_skb_reason+0x16d/0x3b0 net/core/skbuff.c:1252
           kfree_skb include/linux/skbuff.h:1262 [inline]
           manage_oob net/unix/af_unix.c:2672 [inline]
           unix_stream_read_generic+0x1125/0x2700 net/unix/af_unix.c:2749
           unix_stream_splice_read+0x239/0x320 net/unix/af_unix.c:2981
           do_splice_read fs/splice.c:985 [inline]
           splice_file_to_pipe+0x299/0x500 fs/splice.c:1295
           do_splice+0xf2d/0x1880 fs/splice.c:1379
           __do_splice fs/splice.c:1436 [inline]
           __do_sys_splice fs/splice.c:1652 [inline]
           __se_sys_splice+0x331/0x4a0 fs/splice.c:1634
           do_syscall_x64 arch/x86/entry/common.c:52 [inline]
           do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
           entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
     -> #0 (&u->lock){+.+.}-{2:2}:
           check_prev_add kernel/locking/lockdep.c:3134 [inline]
           check_prevs_add kernel/locking/lockdep.c:3253 [inline]
           validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
           __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
           lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
           __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
           _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
           spin_lock include/linux/spinlock.h:351 [inline]
           __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
           process_one_work kernel/workqueue.c:3254 [inline]
           process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
           worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
           kthread+0x2f0/0x390 kernel/kthread.c:388
           ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
           ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
    
    other info that might help us debug this:
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(unix_gc_lock);
                                   lock(&u->lock);
                                   lock(unix_gc_lock);
      lock(&u->lock);
    
     *** DEADLOCK ***
    
    3 locks held by kworker/u8:1/11:
     #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
     #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x17c0 kernel/workqueue.c:3335
     #1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
     #1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x17c0 kernel/workqueue.c:3335
     #2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
     #2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261
    
    stack backtrace:
    CPU: 0 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    Workqueue: events_unbound __unix_gc
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
     check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
     check_prev_add kernel/locking/lockdep.c:3134 [inline]
     check_prevs_add kernel/locking/lockdep.c:3253 [inline]
     validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
     __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
     lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
     __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
     _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
     spin_lock include/linux/spinlock.h:351 [inline]
     __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
     process_one_work kernel/workqueue.c:3254 [inline]
     process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
     worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
     kthread+0x2f0/0x390 kernel/kthread.c:388
     ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
     </TASK>
    
    Fixes: 47d8ac011fe1 ("af_unix: Fix garbage collector racing against connect()")
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=fa379358c28cc87cc307
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ARC: [plat-hsdk]: Remove misplaced interrupt-cells property [+ + +]
Author: Alexey Brodkin <[email protected]>
Date:   Fri Mar 29 10:36:50 2024 +0000

    ARC: [plat-hsdk]: Remove misplaced interrupt-cells property
    
    [ Upstream commit 61231eb8113ce47991f35024f9c20810b37996bf ]
    
    "gmac" node stands for just an ordinary Ethernet controller,
    which is by no means a provider of interrupts, i.e. it doesn't serve
    as an interrupt controller, thus "#interrupt-cells" property doesn't
    belong to it and so we remove it.
    
    Fixes:
    ------------>8------------
      DTC     arch/arc/boot/dts/hsdk.dtb
    arch/arc/boot/dts/hsdk.dts:207.23-235.5: Warning (interrupt_provider): /soc/ethernet@8000: '#interrupt-cells' found, but node is not an interrupt provider
    arch/arc/boot/dts/hsdk.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
    ------------>8------------
    
    Reported-by: Vineet Gupta <[email protected]>
    Signed-off-by: Alexey Brodkin <[email protected]>
    Signed-off-by: Vineet Gupta <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
arm64: dts: mediatek: mt2712: fix validation errors [+ + +]
Author: Rafał Miłecki <[email protected]>
Date:   Fri Mar 1 08:47:41 2024 +0100

    arm64: dts: mediatek: mt2712: fix validation errors
    
    [ Upstream commit 3baac7291effb501c4d52df7019ebf52011e5772 ]
    
    1. Fixup infracfg clock controller binding
       It also acts as reset controller so #reset-cells is required.
    2. Use -pins suffix for pinctrl
    
    This fixes:
    arch/arm64/boot/dts/mediatek/mt2712-evb.dtb: syscon@10001000: '#reset-cells' is a required property
            from schema $id: http://devicetree.org/schemas/arm/mediatek/mediatek,infracfg.yaml#
    arch/arm64/boot/dts/mediatek/mt2712-evb.dtb: pinctrl@1000b000: 'eth_default', 'eth_sleep', 'usb0_iddig', 'usb1_iddig' do not match any of the regexes: 'pinctrl-[0-9]+', 'pins$'
            from schema $id: http://devicetree.org/schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml#
    
    Signed-off-by: Rafał Miłecki <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [Angelo: Added Fixes tags]
    Fixes: 5d4839709c8e ("arm64: dts: mt2712: Add clock controller device nodes")
    Fixes: 1724f4cc5133 ("arm64: dts: Add USB3 related nodes for MT2712")
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: add support for coherent DMA [+ + +]
Author: Felix Fietkau <[email protected]>
Date:   Tue Apr 5 21:57:44 2022 +0200

    arm64: dts: mediatek: mt7622: add support for coherent DMA
    
    [ Upstream commit 3abd063019b6a01762f9fccc39505f29d029360a ]
    
    It improves performance by eliminating the need for a cache flush on rx and tx
    
    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: 3ba5a6159434 ("arm64: dts: mediatek: mt7622: fix clock controllers")
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: drop "reset-names" from thermal block [+ + +]
Author: Rafał Miłecki <[email protected]>
Date:   Sun Mar 17 23:10:50 2024 +0100

    arm64: dts: mediatek: mt7622: drop "reset-names" from thermal block
    
    [ Upstream commit ecb5b0034f5bcc35003b4b965cf50c6e98316e79 ]
    
    Binding doesn't specify "reset-names" property and Linux driver also
    doesn't use it.
    
    Fix following validation error:
    arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb: thermal@1100b000: Unevaluated properties are not allowed ('reset-names' was unexpected)
            from schema $id: http://devicetree.org/schemas/thermal/mediatek,thermal.yaml#
    
    Fixes: ae457b7679c4 ("arm64: dts: mt7622: add SoC and peripheral related device nodes")
    Signed-off-by: Rafał Miłecki <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: fix clock controllers [+ + +]
Author: Rafał Miłecki <[email protected]>
Date:   Sun Mar 17 23:10:47 2024 +0100

    arm64: dts: mediatek: mt7622: fix clock controllers
    
    [ Upstream commit 3ba5a61594347ab46e7c2cff6cd63ea0f1282efb ]
    
    1. Drop unneeded "syscon"s (bindings were updated recently)
    2. Use "clock-controller" in nodenames
    3. Add missing "#clock-cells"
    
    Fixes: d7167881e03e ("arm64: dts: mt7622: add clock controller device nodes")
    Fixes: e9b65ecb7c30 ("arm64: dts: mediatek: mt7622: introduce nodes for Wireless Ethernet Dispatch")
    Signed-off-by: Rafał Miłecki <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: fix ethernet controller "compatible" [+ + +]
Author: Rafał Miłecki <[email protected]>
Date:   Sun Mar 17 23:10:49 2024 +0100

    arm64: dts: mediatek: mt7622: fix ethernet controller "compatible"
    
    [ Upstream commit 208add29ce5b7291f6c466e4dfd9cbf61c72888e ]
    
    Fix following validation error:
    arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb: ethernet@1b100000: compatible: ['mediatek,mt7622-eth', 'mediatek,mt2701-eth', 'syscon'] is too long
            from schema $id: http://devicetree.org/schemas/net/mediatek,net.yaml#
    (and other complains about wrong clocks).
    
    Fixes: 5f599b3a0bb8 ("arm64: dts: mt7622: add ethernet device nodes")
    Signed-off-by: Rafał Miłecki <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: fix IR nodename [+ + +]
Author: Rafał Miłecki <[email protected]>
Date:   Sun Mar 17 23:10:48 2024 +0100

    arm64: dts: mediatek: mt7622: fix IR nodename
    
    [ Upstream commit 800dc93c3941e372c94278bf4059e6e82f60bd66 ]
    
    Fix following validation error:
    arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb: cir@10009000: $nodename:0: 'cir@10009000' does not match '^ir(-receiver)?(@[a-f0-9]+)?$'
            from schema $id: http://devicetree.org/schemas/media/mediatek,mt7622-cir.yaml#
    
    Fixes: ae457b7679c4 ("arm64: dts: mt7622: add SoC and peripheral related device nodes")
    Signed-off-by: Rafał Miłecki <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt7622: introduce nodes for Wireless Ethernet Dispatch [+ + +]
Author: Felix Fietkau <[email protected]>
Date:   Tue Apr 5 21:57:49 2022 +0200

    arm64: dts: mediatek: mt7622: introduce nodes for Wireless Ethernet Dispatch
    
    [ Upstream commit e9b65ecb7c3050dd34ee22ce17f1cf95e8405b15 ]
    
    Introduce wed0 and wed1 nodes in order to enable offloading forwarding
    between ethernet and wireless devices on the mt7622 chipset.
    
    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: 3ba5a6159434 ("arm64: dts: mediatek: mt7622: fix clock controllers")
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: rockchip: enable internal pull-up for Q7_THRM# on RK3399 Puma [+ + +]
Author: Iskander Amara <[email protected]>
Date:   Fri Mar 8 09:52:42 2024 +0100

    arm64: dts: rockchip: enable internal pull-up for Q7_THRM# on RK3399 Puma
    
    commit 0ac417b8f124427c90ec8c2ef4f632b821d924cc upstream.
    
    Q7_THRM# pin is connected to a diode on the module which is used
    as a level shifter, and the pin have a pull-down enabled by
    default. We need to configure it to internal pull-up, other-
    wise whenever the pin is configured as INPUT and we try to
    control it externally the value will always remain zero.
    
    Signed-off-by: Iskander Amara <[email protected]>
    Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM")
    Reviewed-by: Quentin Schulz <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Heiko Stuebner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: dts: rockchip: enable internal pull-up on PCIE_WAKE# for RK3399 Puma [+ + +]
Author: Quentin Schulz <[email protected]>
Date:   Fri Mar 8 16:46:08 2024 +0100

    arm64: dts: rockchip: enable internal pull-up on PCIE_WAKE# for RK3399 Puma
    
    [ Upstream commit 945a7c8570916650a415757d15d83e0fa856a686 ]
    
    The PCIE_WAKE# has a diode used as a level-shifter, and is used as an
    input pin. While the SoC default is to enable the pull-up, the core
    rk3399 pinconf for this pin opted for pull-none. So as to not disturb
    the behaviour of other boards which may rely on pull-none instead of
    pull-up, set the needed pull-up only for RK3399 Puma.
    
    Fixes: 60fd9f72ce8a ("arm64: dts: rockchip: add Haikou baseboard with RK3399-Q7 SoM")
    Signed-off-by: Quentin Schulz <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Heiko Stuebner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: rockchip: fix alphabetical ordering RK3399 puma [+ + +]
Author: Iskander Amara <[email protected]>
Date:   Fri Mar 8 09:52:43 2024 +0100

    arm64: dts: rockchip: fix alphabetical ordering RK3399 puma
    
    [ Upstream commit f0abb4b2c7acf3c3e4130dc3f54cd90cf2ae62bc ]
    
    Nodes overridden by their reference should be ordered alphabetically to
    make it easier to read the DTS. pinctrl node is defined in the wrong
    location so let's reorder it.
    
    Signed-off-by: Iskander Amara <[email protected]>
    Reviewed-by: Quentin Schulz <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Heiko Stuebner <[email protected]>
    Stable-dep-of: 945a7c857091 ("arm64: dts: rockchip: enable internal pull-up on PCIE_WAKE# for RK3399 Puma")
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: rockchip: Remove unsupported node from the Pinebook Pro dts [+ + +]
Author: Dragan Simic <[email protected]>
Date:   Mon Apr 1 00:20:56 2024 +0200

    arm64: dts: rockchip: Remove unsupported node from the Pinebook Pro dts
    
    [ Upstream commit 43853e843aa6c3d47ff2b0cce898318839483d05 ]
    
    Remove a redundant node from the Pine64 Pinebook Pro dts, which is intended
    to provide a value for the delay in PCI Express enumeration, but that isn't
    supported without additional out-of-tree kernel patches.
    
    There were already efforts to upstream those kernel patches, because they
    reportedly make some PCI Express cards (such as LSI SAS HBAs) usable in
    Pine64 RockPro64 (which is also based on the RK3399);  otherwise, those PCI
    Express cards fail to enumerate.  However, providing the required background
    and explanations proved to be a tough nut to crack, which is the reason why
    those patches remain outside of the kernel mainline for now.
    
    If those out-of-tree patches eventually become upstreamed, the resulting
    device-tree changes will almost surely belong to the RK3399 SoC dtsi.  Also,
    the above-mentioned unusable-without-out-of-tree-patches PCI Express devices
    are in all fairness not usable in a Pinebook Pro without some extensive
    hardware modifications, which is another reason to delete this redundant
    node.  When it comes to the Pinebook Pro, only M.2 NVMe SSDs can be installed
    out of the box (using an additional passive adapter PCB sold separately by
    Pine64), which reportedly works fine with no additional patches.
    
    Fixes: 5a65505a6988 ("arm64: dts: rockchip: Add initial support for Pinebook Pro")
    Signed-off-by: Dragan Simic <[email protected]>
    Link: https://lore.kernel.org/r/0f82c3f97cb798d012270d13b34d8d15305ef293.1711923520.git.dsimic@manjaro.org
    Signed-off-by: Heiko Stuebner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
batman-adv: Avoid infinite loop trying to resize local TT [+ + +]
Author: Sven Eckelmann <[email protected]>
Date:   Mon Feb 12 13:58:33 2024 +0100

    batman-adv: Avoid infinite loop trying to resize local TT
    
    commit b1f532a3b1e6d2e5559c7ace49322922637a28aa upstream.
    
    If the MTU of one of an attached interface becomes too small to transmit
    the local translation table then it must be resized to fit inside all
    fragments (when enabled) or a single packet.
    
    But if the MTU becomes too low to transmit even the header + the VLAN
    specific part then the resizing of the local TT will never succeed. This
    can for example happen when the usable space is 110 bytes and 11 VLANs are
    on top of batman-adv. In this case, at least 116 byte would be needed.
    There will just be an endless spam of
    
       batman_adv: batadv0: Forced to purge local tt entries to fit new maximum fragment MTU (110)
    
    in the log but the function will never finish. Problem here is that the
    timeout will be halved all the time and will then stagnate at 0 and
    therefore never be able to reduce the table even more.
    
    There are other scenarios possible with a similar result. The number of
    BATADV_TT_CLIENT_NOPURGE entries in the local TT can for example be too
    high to fit inside a packet. Such a scenario can therefore happen also with
    only a single VLAN + 7 non-purgable addresses - requiring at least 120
    bytes.
    
    While this should be handled proactively when:
    
    * interface with too low MTU is added
    * VLAN is added
    * non-purgeable local mac is added
    * MTU of an attached interface is reduced
    * fragmentation setting gets disabled (which most likely requires dropping
      attached interfaces)
    
    not all of these scenarios can be prevented because batman-adv is only
    consuming events without the the possibility to prevent these actions
    (non-purgable MAC address added, MTU of an attached interface is reduced).
    It is therefore necessary to also make sure that the code is able to handle
    also the situations when there were already incompatible system
    configuration are present.
    
    Cc: [email protected]
    Fixes: a19d3d85e1b8 ("batman-adv: limit local translation table max size")
    Reported-by: [email protected]
    Signed-off-by: Sven Eckelmann <[email protected]>
    Signed-off-by: Simon Wunderlich <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
 
binder: check offset alignment in binder_get_object() [+ + +]
Author: Carlos Llamas <[email protected]>
Date:   Sat Mar 30 19:01:14 2024 +0000

    binder: check offset alignment in binder_get_object()
    
    commit aaef73821a3b0194a01bd23ca77774f704a04d40 upstream.
    
    Commit 6d98eb95b450 ("binder: avoid potential data leakage when copying
    txn") introduced changes to how binder objects are copied. In doing so,
    it unintentionally removed an offset alignment check done through calls
    to binder_alloc_copy_from_buffer() -> check_buffer().
    
    These calls were replaced in binder_get_object() with copy_from_user(),
    so now an explicit offset alignment check is needed here. This avoids
    later complications when unwinding the objects gets harder.
    
    It is worth noting this check existed prior to commit 7a67a39320df
    ("binder: add function to copy binder object from buffer"), likely
    removed due to redundancy at the time.
    
    Fixes: 6d98eb95b450 ("binder: avoid potential data leakage when copying txn")
    Cc: [email protected]
    Signed-off-by: Carlos Llamas <[email protected]>
    Acked-by: Todd Kjos <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0bda:0x4853 [+ + +]
Author: WangYuli <[email protected]>
Date:   Fri Mar 29 10:34:39 2024 +0800

    Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0bda:0x4853
    
    commit d1a5a7eede2977da3d2002d5ea3b519019cc1a98 upstream.
    
    Add the support ID(0x0bda, 0x4853) to usb_device_id table for
    Realtek RTL8852BE.
    
    Without this change the device utilizes an obsolete version of
    the firmware that is encoded in it rather than the updated Realtek
    firmware and config files from the firmware directory. The latter
    files implement many new features.
    
    The device table is as follows:
    
    T: Bus=03 Lev=01 Prnt=01 Port=09 Cnt=03 Dev#= 4 Spd=12 MxCh= 0
    D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0bda ProdID=4853 Rev= 0.00
    S: Manufacturer=Realtek
    S: Product=Bluetooth Radio
    S: SerialNumber=00e04c000001
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
    E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    
    Cc: [email protected]
    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: WangYuli <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: Fix memory leak in hci_req_sync_complete() [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Tue Apr 2 14:32:05 2024 +0300

    Bluetooth: Fix memory leak in hci_req_sync_complete()
    
    commit 45d355a926ab40f3ae7bc0b0a00cb0e3e8a5a810 upstream.
    
    In 'hci_req_sync_complete()', always free the previous sync
    request state before assigning reference to a new one.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d
    Cc: [email protected]
    Fixes: f60cb30579d3 ("Bluetooth: Convert hci_req_sync family of function to new request API")
    Signed-off-by: Dmitry Antipov <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old() [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Apr 1 11:24:17 2024 -0700

    Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old()
    
    commit 9bf4e919ccad613b3596eebf1ff37b05b6405307 upstream.
    
    After an innocuous optimization change in LLVM main (19.0.0), x86_64
    allmodconfig (which enables CONFIG_KCSAN / -fsanitize=thread) fails to
    build due to the checks in check_copy_size():
    
      In file included from net/bluetooth/sco.c:27:
      In file included from include/linux/module.h:13:
      In file included from include/linux/stat.h:19:
      In file included from include/linux/time.h:60:
      In file included from include/linux/time32.h:13:
      In file included from include/linux/timex.h:67:
      In file included from arch/x86/include/asm/timex.h:6:
      In file included from arch/x86/include/asm/tsc.h:10:
      In file included from arch/x86/include/asm/msr.h:15:
      In file included from include/linux/percpu.h:7:
      In file included from include/linux/smp.h:118:
      include/linux/thread_info.h:244:4: error: call to '__bad_copy_from'
      declared with 'error' attribute: copy source size is too small
        244 |                         __bad_copy_from();
            |                         ^
    
    The same exact error occurs in l2cap_sock.c. The copy_to_user()
    statements that are failing come from l2cap_sock_getsockopt_old() and
    sco_sock_getsockopt_old(). This does not occur with GCC with or without
    KCSAN or Clang without KCSAN enabled.
    
    len is defined as an 'int' because it is assigned from
    '__user int *optlen'. However, it is clamped against the result of
    sizeof(), which has a type of 'size_t' ('unsigned long' for 64-bit
    platforms). This is done with min_t() because min() requires compatible
    types, which results in both len and the result of sizeof() being casted
    to 'unsigned int', meaning len changes signs and the result of sizeof()
    is truncated. From there, len is passed to copy_to_user(), which has a
    third parameter type of 'unsigned long', so it is widened and changes
    signs again. This excessive casting in combination with the KCSAN
    instrumentation causes LLVM to fail to eliminate the __bad_copy_from()
    call, failing the build.
    
    The official recommendation from LLVM developers is to consistently use
    long types for all size variables to avoid the unnecessary casting in
    the first place. Change the type of len to size_t in both
    l2cap_sock_getsockopt_old() and sco_sock_getsockopt_old(). This clears
    up the error while allowing min_t() to be replaced with min(), resulting
    in simpler code with no casts and fewer implicit conversions. While len
    is a different type than optlen now, it should result in no functional
    change because the result of sizeof() will clamp all values of optlen in
    the same manner as before.
    
    Cc: [email protected]
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2007
    Link: https://github.com/llvm/llvm-project/issues/85647
    Signed-off-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Justin Stitt <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: SCO: Fix not validating setsockopt user input [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Fri Apr 5 15:41:52 2024 -0400

    Bluetooth: SCO: Fix not validating setsockopt user input
    
    [ Upstream commit 51eda36d33e43201e7a4fd35232e069b2c850b01 ]
    
    syzbot reported sco_sock_setsockopt() is copying data without
    checking user input length.
    
    BUG: KASAN: slab-out-of-bounds in copy_from_sockptr_offset
    include/linux/sockptr.h:49 [inline]
    BUG: KASAN: slab-out-of-bounds in copy_from_sockptr
    include/linux/sockptr.h:55 [inline]
    BUG: KASAN: slab-out-of-bounds in sco_sock_setsockopt+0xc0b/0xf90
    net/bluetooth/sco.c:893
    Read of size 4 at addr ffff88805f7b15a3 by task syz-executor.5/12578
    
    Fixes: ad10b1a48754 ("Bluetooth: Add Bluetooth socket voice option")
    Fixes: b96e9c671b05 ("Bluetooth: Add BT_DEFER_SETUP option to sco socket")
    Fixes: 00398e1d5183 ("Bluetooth: Add support for BT_PKT_STATUS CMSG data for SCO connections")
    Fixes: f6873401a608 ("Bluetooth: Allow setting of codec for HFP offload use case")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS [+ + +]
Author: Matthew Wilcox (Oracle) <[email protected]>
Date:   Mon Apr 29 15:47:51 2024 +0100

    bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS
    
    commit 5af385f5f4cddf908f663974847a4083b2ff2c79 upstream.
    
    bits_per() rounds up to the next power of two when passed a power of
    two.  This causes crashes on some machines and configurations.
    
    Reported-by: Михаил Новоселов <[email protected]>
    Tested-by: Ильфат Гаптрахманов <[email protected]>
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3347
    Link: https://lore.kernel.org/all/[email protected]/
    Fixes: f2d5dcb48f7b (bounds: support non-power-of-two CONFIG_NR_CPUS)
    Cc:  <[email protected]>
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Cc: Rik van Riel <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
btrfs: fix information leak in btrfs_ioctl_logical_to_ino() [+ + +]
Author: Johannes Thumshirn <[email protected]>
Date:   Wed Apr 17 10:45:47 2024 +0200

    btrfs: fix information leak in btrfs_ioctl_logical_to_ino()
    
    commit 2f7ef5bb4a2f3e481ef05fab946edb97c84f67cf upstream.
    
    Syzbot reported the following information leak for in
    btrfs_ioctl_logical_to_ino():
    
      BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
      BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x110 lib/usercopy.c:40
       instrument_copy_to_user include/linux/instrumented.h:114 [inline]
       _copy_to_user+0xbc/0x110 lib/usercopy.c:40
       copy_to_user include/linux/uaccess.h:191 [inline]
       btrfs_ioctl_logical_to_ino+0x440/0x750 fs/btrfs/ioctl.c:3499
       btrfs_ioctl+0x714/0x1260
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x261/0x450 fs/ioctl.c:890
       __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:890
       x64_sys_call+0x1883/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:17
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
      Uninit was created at:
       __kmalloc_large_node+0x231/0x370 mm/slub.c:3921
       __do_kmalloc_node mm/slub.c:3954 [inline]
       __kmalloc_node+0xb07/0x1060 mm/slub.c:3973
       kmalloc_node include/linux/slab.h:648 [inline]
       kvmalloc_node+0xc0/0x2d0 mm/util.c:634
       kvmalloc include/linux/slab.h:766 [inline]
       init_data_container+0x49/0x1e0 fs/btrfs/backref.c:2779
       btrfs_ioctl_logical_to_ino+0x17c/0x750 fs/btrfs/ioctl.c:3480
       btrfs_ioctl+0x714/0x1260
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x261/0x450 fs/ioctl.c:890
       __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:890
       x64_sys_call+0x1883/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:17
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
      Bytes 40-65535 of 65536 are uninitialized
      Memory access of size 65536 starts at ffff888045a40000
    
    This happens, because we're copying a 'struct btrfs_data_container' back
    to user-space. This btrfs_data_container is allocated in
    'init_data_container()' via kvmalloc(), which does not zero-fill the
    memory.
    
    Fix this by using kvzalloc() which zeroes out the memory on allocation.
    
    CC: [email protected] # 4.14+
    Reported-by:  <[email protected]>
    Reviewed-by: Qu Wenruo <[email protected]>
    Reviewed-by: Filipe Manana <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: qgroup: correctly model root qgroup rsv in convert [+ + +]
Author: Boris Burkov <[email protected]>
Date:   Tue Mar 19 10:54:22 2024 -0700

    btrfs: qgroup: correctly model root qgroup rsv in convert
    
    commit 141fb8cd206ace23c02cd2791c6da52c1d77d42a upstream.
    
    We use add_root_meta_rsv and sub_root_meta_rsv to track prealloc and
    pertrans reservations for subvolumes when quotas are enabled. The
    convert function does not properly increment pertrans after decrementing
    prealloc, so the count is not accurate.
    
    Note: we check that the fs is not read-only to mirror the logic in
    qgroup_convert_meta, which checks that before adding to the pertrans rsv.
    
    Fixes: 8287475a2055 ("btrfs: qgroup: Use root::qgroup_meta_rsv_* to record qgroup meta reserved space")
    CC: [email protected] # 6.1+
    Reviewed-by: Qu Wenruo <[email protected]>
    Signed-off-by: Boris Burkov <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: record delayed inode root in transaction [+ + +]
Author: Boris Burkov <[email protected]>
Date:   Thu Mar 21 10:14:24 2024 -0700

    btrfs: record delayed inode root in transaction
    
    [ Upstream commit 71537e35c324ea6fbd68377a4f26bb93a831ae35 ]
    
    When running delayed inode updates, we do not record the inode's root in
    the transaction, but we do allocate PREALLOC and thus converted PERTRANS
    space for it. To be sure we free that PERTRANS meta rsv, we must ensure
    that we record the root in the transaction.
    
    Fixes: 4f5427ccce5d ("btrfs: delayed-inode: Use new qgroup meta rsv for delayed inode and item")
    CC: [email protected] # 6.1+
    Reviewed-by: Qu Wenruo <[email protected]>
    Signed-off-by: Boris Burkov <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
clk: Get runtime PM before walking tree during disable_unused [+ + +]
Author: Stephen Boyd <[email protected]>
Date:   Mon Mar 25 11:41:58 2024 -0700

    clk: Get runtime PM before walking tree during disable_unused
    
    [ Upstream commit e581cf5d216289ef292d1a4036d53ce90e122469 ]
    
    Doug reported [1] the following hung task:
    
     INFO: task swapper/0:1 blocked for more than 122 seconds.
           Not tainted 5.15.149-21875-gf795ebc40eb8 #1
     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
     task:swapper/0       state:D stack:    0 pid:    1 ppid:     0 flags:0x00000008
     Call trace:
      __switch_to+0xf4/0x1f4
      __schedule+0x418/0xb80
      schedule+0x5c/0x10c
      rpm_resume+0xe0/0x52c
      rpm_resume+0x178/0x52c
      __pm_runtime_resume+0x58/0x98
      clk_pm_runtime_get+0x30/0xb0
      clk_disable_unused_subtree+0x58/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused+0x4c/0xe4
      do_one_initcall+0xcc/0x2d8
      do_initcall_level+0xa4/0x148
      do_initcalls+0x5c/0x9c
      do_basic_setup+0x24/0x30
      kernel_init_freeable+0xec/0x164
      kernel_init+0x28/0x120
      ret_from_fork+0x10/0x20
     INFO: task kworker/u16:0:9 blocked for more than 122 seconds.
           Not tainted 5.15.149-21875-gf795ebc40eb8 #1
     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
     task:kworker/u16:0   state:D stack:    0 pid:    9 ppid:     2 flags:0x00000008
     Workqueue: events_unbound deferred_probe_work_func
     Call trace:
      __switch_to+0xf4/0x1f4
      __schedule+0x418/0xb80
      schedule+0x5c/0x10c
      schedule_preempt_disabled+0x2c/0x48
      __mutex_lock+0x238/0x488
      __mutex_lock_slowpath+0x1c/0x28
      mutex_lock+0x50/0x74
      clk_prepare_lock+0x7c/0x9c
      clk_core_prepare_lock+0x20/0x44
      clk_prepare+0x24/0x30
      clk_bulk_prepare+0x40/0xb0
      mdss_runtime_resume+0x54/0x1c8
      pm_generic_runtime_resume+0x30/0x44
      __genpd_runtime_resume+0x68/0x7c
      genpd_runtime_resume+0x108/0x1f4
      __rpm_callback+0x84/0x144
      rpm_callback+0x30/0x88
      rpm_resume+0x1f4/0x52c
      rpm_resume+0x178/0x52c
      __pm_runtime_resume+0x58/0x98
      __device_attach+0xe0/0x170
      device_initial_probe+0x1c/0x28
      bus_probe_device+0x3c/0x9c
      device_add+0x644/0x814
      mipi_dsi_device_register_full+0xe4/0x170
      devm_mipi_dsi_device_register_full+0x28/0x70
      ti_sn_bridge_probe+0x1dc/0x2c0
      auxiliary_bus_probe+0x4c/0x94
      really_probe+0xcc/0x2c8
      __driver_probe_device+0xa8/0x130
      driver_probe_device+0x48/0x110
      __device_attach_driver+0xa4/0xcc
      bus_for_each_drv+0x8c/0xd8
      __device_attach+0xf8/0x170
      device_initial_probe+0x1c/0x28
      bus_probe_device+0x3c/0x9c
      deferred_probe_work_func+0x9c/0xd8
      process_one_work+0x148/0x518
      worker_thread+0x138/0x350
      kthread+0x138/0x1e0
      ret_from_fork+0x10/0x20
    
    The first thread is walking the clk tree and calling
    clk_pm_runtime_get() to power on devices required to read the clk
    hardware via struct clk_ops::is_enabled(). This thread holds the clk
    prepare_lock, and is trying to runtime PM resume a device, when it finds
    that the device is in the process of resuming so the thread schedule()s
    away waiting for the device to finish resuming before continuing. The
    second thread is runtime PM resuming the same device, but the runtime
    resume callback is calling clk_prepare(), trying to grab the
    prepare_lock waiting on the first thread.
    
    This is a classic ABBA deadlock. To properly fix the deadlock, we must
    never runtime PM resume or suspend a device with the clk prepare_lock
    held. Actually doing that is near impossible today because the global
    prepare_lock would have to be dropped in the middle of the tree, the
    device runtime PM resumed/suspended, and then the prepare_lock grabbed
    again to ensure consistency of the clk tree topology. If anything
    changes with the clk tree in the meantime, we've lost and will need to
    start the operation all over again.
    
    Luckily, most of the time we're simply incrementing or decrementing the
    runtime PM count on an active device, so we don't have the chance to
    schedule away with the prepare_lock held. Let's fix this immediate
    problem that can be triggered more easily by simply booting on Qualcomm
    sc7180.
    
    Introduce a list of clk_core structures that have been registered, or
    are in the process of being registered, that require runtime PM to
    operate. Iterate this list and call clk_pm_runtime_get() on each of them
    without holding the prepare_lock during clk_disable_unused(). This way
    we can be certain that the runtime PM state of the devices will be
    active and resumed so we can't schedule away while walking the clk tree
    with the prepare_lock held. Similarly, call clk_pm_runtime_put() without
    the prepare_lock held to properly drop the runtime PM reference. We
    remove the calls to clk_pm_runtime_{get,put}() in this path because
    they're superfluous now that we know the devices are runtime resumed.
    
    Reported-by: Douglas Anderson <[email protected]>
    Closes: https://lore.kernel.org/all/20220922084322.RFC.2.I375b6b9e0a0a5348962f004beb3dafee6a12dfbb@changeid/ [1]
    Closes: https://issuetracker.google.com/328070191
    Cc: Marek Szyprowski <[email protected]>
    Cc: Ulf Hansson <[email protected]>
    Cc: Krzysztof Kozlowski <[email protected]>
    Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
    Signed-off-by: Stephen Boyd <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Douglas Anderson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

clk: Initialize struct clk_core kref earlier [+ + +]
Author: Stephen Boyd <[email protected]>
Date:   Mon Mar 25 11:41:57 2024 -0700

    clk: Initialize struct clk_core kref earlier
    
    [ Upstream commit 9d05ae531c2cff20d5d527f04e28d28e04379929 ]
    
    Initialize this kref once we allocate memory for the struct clk_core so
    that we can reuse the release function to free any memory associated
    with the structure. This mostly consolidates code, but also clarifies
    that the kref lifetime exists once the container structure (struct
    clk_core) is allocated instead of leaving it in a half-baked state for
    most of __clk_core_init().
    
    Reviewed-by: Douglas Anderson <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <[email protected]>

clk: Mark 'all_lists' as const [+ + +]
Author: Stephen Boyd <[email protected]>
Date:   Thu Feb 17 14:05:53 2022 -0800

    clk: Mark 'all_lists' as const
    
    [ Upstream commit 75061a6ff49ba3482c6319ded0c26e6a526b0967 ]
    
    This list array doesn't change at runtime. Mark it const to move to RO
    memory.
    
    Signed-off-by: Stephen Boyd <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <[email protected]>

clk: Print an info line before disabling unused clocks [+ + +]
Author: Konrad Dybcio <[email protected]>
Date:   Tue Mar 7 14:29:28 2023 +0100

    clk: Print an info line before disabling unused clocks
    
    [ Upstream commit 12ca59b91d04df32e41be5a52f0cabba912c11de ]
    
    Currently, the regulator framework informs us before calling into
    their unused cleanup paths, which eases at least some debugging. The
    same could be beneficial for clocks, so that random shutdowns shortly
    after most initcalls are done can be less of a guess.
    
    Add a pr_info before disabling unused clocks to do so.
    
    Reviewed-by: Marijn Suijten <[email protected]>
    Signed-off-by: Konrad Dybcio <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Stephen Boyd <[email protected]>
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <[email protected]>

clk: remove extra empty line [+ + +]
Author: Claudiu Beznea <[email protected]>
Date:   Thu Jun 30 18:12:04 2022 +0300

    clk: remove extra empty line
    
    [ Upstream commit 79806d338829b2bf903480428d8ce5aab8e2d24b ]
    
    Remove extra empty line.
    
    Signed-off-by: Claudiu Beznea <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Stephen Boyd <[email protected]>
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <[email protected]>

clk: Remove prepare_lock hold assertion in __clk_release() [+ + +]
Author: Stephen Boyd <[email protected]>
Date:   Mon Mar 25 11:41:55 2024 -0700

    clk: Remove prepare_lock hold assertion in __clk_release()
    
    [ Upstream commit 8358a76cfb47c9a5af627a0c4e7168aa14fa25f6 ]
    
    Removing this assertion lets us move the kref_put() call outside the
    prepare_lock section. We don't need to hold the prepare_lock here to
    free memory and destroy the clk_core structure. We've already unlinked
    the clk from the clk tree and by the time the release function runs
    nothing holds a reference to the clk_core anymore so anything with the
    pointer can't access the memory that's being freed anyway. Way back in
    commit 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of
    prepare_lock") we didn't need to have this assertion either.
    
    Fixes: 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of prepare_lock")
    Cc: Krzysztof Kozlowski <[email protected]>
    Reviewed-by: Douglas Anderson <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
comedi: vmk80xx: fix incomplete endpoint checking [+ + +]
Author: Nikita Zhandarovich <[email protected]>
Date:   Mon Apr 8 10:16:33 2024 -0700

    comedi: vmk80xx: fix incomplete endpoint checking
    
    commit d1718530e3f640b7d5f0050e725216eab57a85d8 upstream.
    
    While vmk80xx does have endpoint checking implemented, some things
    can fall through the cracks. Depending on the hardware model,
    URBs can have either bulk or interrupt type, and current version
    of vmk80xx_find_usb_endpoints() function does not take that fully
    into account. While this warning does not seem to be too harmful,
    at the very least it will crash systems with 'panic_on_warn' set on
    them.
    
    Fix the issue found by Syzkaller [1] by somewhat simplifying the
    endpoint checking process with usb_find_common_endpoints() and
    ensuring that only expected endpoint types are present.
    
    This patch has not been tested on real hardware.
    
    [1] Syzkaller report:
    usb 1-1: BOGUS urb xfer, pipe 1 != type 3
    WARNING: CPU: 0 PID: 781 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
    ...
    Call Trace:
     <TASK>
     usb_start_wait_urb+0x113/0x520 drivers/usb/core/message.c:59
     vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:227 [inline]
     vmk80xx_auto_attach+0xa1c/0x1a40 drivers/comedi/drivers/vmk80xx.c:818
     comedi_auto_config+0x238/0x380 drivers/comedi/drivers.c:1067
     usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399
    ...
    
    Similar issue also found by Syzkaller:
    Link: https://syzkaller.appspot.com/bug?extid=5205eb2f17de3e01946e
    
    Reported-and-tested-by: [email protected]
    Cc: stable <[email protected]>
    Fixes: 49253d542cc0 ("staging: comedi: vmk80xx: factor out usb endpoint detection")
    Reviewed-by: Ian Abbott <[email protected]>
    Signed-off-by: Nikita Zhandarovich <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cpu: Re-enable CPU mitigations by default for !X86 architectures [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Apr 19 17:05:54 2024 -0700

    cpu: Re-enable CPU mitigations by default for !X86 architectures
    
    commit fe42754b94a42d08cf9501790afc25c4f6a5f631 upstream.
    
    Rename x86's to CPU_MITIGATIONS, define it in generic code, and force it
    on for all architectures exception x86.  A recent commit to turn
    mitigations off by default if SPECULATION_MITIGATIONS=n kinda sorta
    missed that "cpu_mitigations" is completely generic, whereas
    SPECULATION_MITIGATIONS is x86-specific.
    
    Rename x86's SPECULATIVE_MITIGATIONS instead of keeping both and have it
    select CPU_MITIGATIONS, as having two configs for the same thing is
    unnecessary and confusing.  This will also allow x86 to use the knob to
    manage mitigations that aren't strictly related to speculative
    execution.
    
    Use another Kconfig to communicate to common code that CPU_MITIGATIONS
    is already defined instead of having x86's menu depend on the common
    CPU_MITIGATIONS.  This allows keeping a single point of contact for all
    of x86's mitigations, and it's not clear that other architectures *want*
    to allow disabling mitigations at compile-time.
    
    Fixes: f337a6a21e2f ("x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n")
    Closes: https://lkml.kernel.org/r/20240413115324.53303a68%40canb.auug.org.au
    Reported-by: Stephen Rothwell <[email protected]>
    Reported-by: Michael Ellerman <[email protected]>
    Reported-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Sean Christopherson <[email protected]>
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Acked-by: Josh Poimboeuf <[email protected]>
    Acked-by: Borislav Petkov (AMD) <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dma: xilinx_dpdma: Fix locking [+ + +]
Author: Sean Anderson <[email protected]>
Date:   Fri Mar 8 16:00:32 2024 -0500

    dma: xilinx_dpdma: Fix locking
    
    [ Upstream commit 244296cc3a155199a8b080d19e645d7d49081a38 ]
    
    There are several places where either chan->lock or chan->vchan.lock was
    not held. Add appropriate locking. This fixes lockdep warnings like
    
    [   31.077578] ------------[ cut here ]------------
    [   31.077831] WARNING: CPU: 2 PID: 40 at drivers/dma/xilinx/xilinx_dpdma.c:834 xilinx_dpdma_chan_queue_transfer+0x274/0x5e0
    [   31.077953] Modules linked in:
    [   31.078019] CPU: 2 PID: 40 Comm: kworker/u12:1 Not tainted 6.6.20+ #98
    [   31.078102] Hardware name: xlnx,zynqmp (DT)
    [   31.078169] Workqueue: events_unbound deferred_probe_work_func
    [   31.078272] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [   31.078377] pc : xilinx_dpdma_chan_queue_transfer+0x274/0x5e0
    [   31.078473] lr : xilinx_dpdma_chan_queue_transfer+0x270/0x5e0
    [   31.078550] sp : ffffffc083bb2e10
    [   31.078590] x29: ffffffc083bb2e10 x28: 0000000000000000 x27: ffffff880165a168
    [   31.078754] x26: ffffff880164e920 x25: ffffff880164eab8 x24: ffffff880164d480
    [   31.078920] x23: ffffff880165a148 x22: ffffff880164e988 x21: 0000000000000000
    [   31.079132] x20: ffffffc082aa3000 x19: ffffff880164e880 x18: 0000000000000000
    [   31.079295] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
    [   31.079453] x14: 0000000000000000 x13: ffffff8802263dc0 x12: 0000000000000001
    [   31.079613] x11: 0001ffc083bb2e34 x10: 0001ff880164e98f x9 : 0001ffc082aa3def
    [   31.079824] x8 : 0001ffc082aa3dec x7 : 0000000000000000 x6 : 0000000000000516
    [   31.079982] x5 : ffffffc7f8d43000 x4 : ffffff88003c9c40 x3 : ffffffffffffffff
    [   31.080147] x2 : ffffffc7f8d43000 x1 : 00000000000000c0 x0 : 0000000000000000
    [   31.080307] Call trace:
    [   31.080340]  xilinx_dpdma_chan_queue_transfer+0x274/0x5e0
    [   31.080518]  xilinx_dpdma_issue_pending+0x11c/0x120
    [   31.080595]  zynqmp_disp_layer_update+0x180/0x3ac
    [   31.080712]  zynqmp_dpsub_plane_atomic_update+0x11c/0x21c
    [   31.080825]  drm_atomic_helper_commit_planes+0x20c/0x684
    [   31.080951]  drm_atomic_helper_commit_tail+0x5c/0xb0
    [   31.081139]  commit_tail+0x234/0x294
    [   31.081246]  drm_atomic_helper_commit+0x1f8/0x210
    [   31.081363]  drm_atomic_commit+0x100/0x140
    [   31.081477]  drm_client_modeset_commit_atomic+0x318/0x384
    [   31.081634]  drm_client_modeset_commit_locked+0x8c/0x24c
    [   31.081725]  drm_client_modeset_commit+0x34/0x5c
    [   31.081812]  __drm_fb_helper_restore_fbdev_mode_unlocked+0x104/0x168
    [   31.081899]  drm_fb_helper_set_par+0x50/0x70
    [   31.081971]  fbcon_init+0x538/0xc48
    [   31.082047]  visual_init+0x16c/0x23c
    [   31.082207]  do_bind_con_driver.isra.0+0x2d0/0x634
    [   31.082320]  do_take_over_console+0x24c/0x33c
    [   31.082429]  do_fbcon_takeover+0xbc/0x1b0
    [   31.082503]  fbcon_fb_registered+0x2d0/0x34c
    [   31.082663]  register_framebuffer+0x27c/0x38c
    [   31.082767]  __drm_fb_helper_initial_config_and_unlock+0x5c0/0x91c
    [   31.082939]  drm_fb_helper_initial_config+0x50/0x74
    [   31.083012]  drm_fbdev_dma_client_hotplug+0xb8/0x108
    [   31.083115]  drm_client_register+0xa0/0xf4
    [   31.083195]  drm_fbdev_dma_setup+0xb0/0x1cc
    [   31.083293]  zynqmp_dpsub_drm_init+0x45c/0x4e0
    [   31.083431]  zynqmp_dpsub_probe+0x444/0x5e0
    [   31.083616]  platform_probe+0x8c/0x13c
    [   31.083713]  really_probe+0x258/0x59c
    [   31.083793]  __driver_probe_device+0xc4/0x224
    [   31.083878]  driver_probe_device+0x70/0x1c0
    [   31.083961]  __device_attach_driver+0x108/0x1e0
    [   31.084052]  bus_for_each_drv+0x9c/0x100
    [   31.084125]  __device_attach+0x100/0x298
    [   31.084207]  device_initial_probe+0x14/0x20
    [   31.084292]  bus_probe_device+0xd8/0xdc
    [   31.084368]  deferred_probe_work_func+0x11c/0x180
    [   31.084451]  process_one_work+0x3ac/0x988
    [   31.084643]  worker_thread+0x398/0x694
    [   31.084752]  kthread+0x1bc/0x1c0
    [   31.084848]  ret_from_fork+0x10/0x20
    [   31.084932] irq event stamp: 64549
    [   31.084970] hardirqs last  enabled at (64548): [<ffffffc081adf35c>] _raw_spin_unlock_irqrestore+0x80/0x90
    [   31.085157] hardirqs last disabled at (64549): [<ffffffc081adf010>] _raw_spin_lock_irqsave+0xc0/0xdc
    [   31.085277] softirqs last  enabled at (64503): [<ffffffc08001071c>] __do_softirq+0x47c/0x500
    [   31.085390] softirqs last disabled at (64498): [<ffffffc080017134>] ____do_softirq+0x10/0x1c
    [   31.085501] ---[ end trace 0000000000000000 ]---
    
    Fixes: 7cbb0c63de3f ("dmaengine: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver")
    Signed-off-by: Sean Anderson <[email protected]>
    Reviewed-by: Tomi Valkeinen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
dmaengine: owl: fix register access functions [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Mar 22 14:21:07 2024 +0100

    dmaengine: owl: fix register access functions
    
    [ Upstream commit 43c633ef93a5d293c96ebcedb40130df13128428 ]
    
    When building with 'make W=1', clang notices that the computed register
    values are never actually written back but instead the wrong variable
    is set:
    
    drivers/dma/owl-dma.c:244:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
      244 |         u32 regval;
          |             ^
    drivers/dma/owl-dma.c:268:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
      268 |         u32 regval;
          |             ^
    
    Change these to what was most likely intended.
    
    Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Peter Korsgaard <[email protected]>
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amdgpu/sdma5.2: use legacy HDP flush for SDMA2/3 [+ + +]
Author: Alex Deucher <[email protected]>
Date:   Sun Apr 14 21:20:56 2024 -0400

    drm/amdgpu/sdma5.2: use legacy HDP flush for SDMA2/3
    
    commit 9792b7cc18aaa0c2acae6af5d0acf249bcb1ab0d upstream.
    
    This avoids a potential conflict with firmwares with the newer
    HDP flush mechanism.
    
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu: Fix leak when GPU memory allocation fails [+ + +]
Author: Mukul Joshi <[email protected]>
Date:   Thu Apr 18 11:32:34 2024 -0400

    drm/amdgpu: Fix leak when GPU memory allocation fails
    
    commit 25e9227c6afd200bed6774c866980b8e36d033af upstream.
    
    Free the sync object if the memory allocation fails for any
    reason.
    
    Signed-off-by: Mukul Joshi <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: validate the parameters of bo mapping operations more clearly [+ + +]
Author: xinhui pan <[email protected]>
Date:   Thu Apr 11 11:11:38 2024 +0800

    drm/amdgpu: validate the parameters of bo mapping operations more clearly
    
    commit 6fef2d4c00b5b8561ad68dd2b68173f5c6af1e75 upstream.
    
    Verify the parameters of
    amdgpu_vm_bo_(map/replace_map/clearing_mappings) in one common place.
    
    Fixes: dc54d3d1744d ("drm/amdgpu: implement AMDGPU_VA_OP_CLEAR v2")
    Cc: [email protected]
    Reported-by: Vlad Stolyarov <[email protected]>
    Suggested-by: Christian König <[email protected]>
    Signed-off-by: xinhui pan <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/client: Fully protect modes[] with dev->mode_config.mutex [+ + +]
Author: Ville Syrjälä <[email protected]>
Date:   Thu Apr 4 23:33:25 2024 +0300

    drm/client: Fully protect modes[] with dev->mode_config.mutex
    
    commit 3eadd887dbac1df8f25f701e5d404d1b90fd0fea upstream.
    
    The modes[] array contains pointers to modes on the connectors'
    mode lists, which are protected by dev->mode_config.mutex.
    Thus we need to extend modes[] the same protection or by the
    time we use it the elements may already be pointing to
    freed/reused memory.
    
    Cc: [email protected]
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10583
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Reviewed-by: Jani Nikula <[email protected]>
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/panel: visionox-rm69299: don't unregister DSI device [+ + +]
Author: Dmitry Baryshkov <[email protected]>
Date:   Thu Apr 4 13:07:59 2024 +0300

    drm/panel: visionox-rm69299: don't unregister DSI device
    
    [ Upstream commit 9e4d3f4f34455abbaa9930bf6b7575a5cd081496 ]
    
    The DSI device for the panel was registered by the DSI host, so it is an
    error to unregister it from the panel driver. Drop the call to
    mipi_dsi_device_unregister().
    
    Fixes: c7f66d32dd43 ("drm/panel: add support for rm69299 visionox panel")
    Reviewed-by: Jessica Zhang <[email protected]>
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
drm: nv04: Fix out of bounds access [+ + +]
Author: Mikhail Kobuk <[email protected]>
Date:   Thu Apr 11 14:08:52 2024 +0300

    drm: nv04: Fix out of bounds access
    
    [ Upstream commit cf92bb778eda7830e79452c6917efa8474a30c1e ]
    
    When Output Resource (dcb->or) value is assigned in
    fabricate_dcb_output(), there may be out of bounds access to
    dac_users array in case dcb->or is zero because ffs(dcb->or) is
    used as index there.
    The 'or' argument of fabricate_dcb_output() must be interpreted as a
    number of bit to set, not value.
    
    Utilize macros from 'enum nouveau_or' in calls instead of hardcoding.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 2e5702aff395 ("drm/nouveau: fabricate DCB encoder table for iMac G4")
    Fixes: 670820c0e6a9 ("drm/nouveau: Workaround incorrect DCB entry on a GeForce3 Ti 200.")
    Signed-off-by: Mikhail Kobuk <[email protected]>
    Signed-off-by: Danilo Krummrich <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
ethernet: Add helper for assigning packet type when dest address does not match device address [+ + +]
Author: Rahul Rameshbabu <[email protected]>
Date:   Tue Apr 23 11:13:03 2024 -0700

    ethernet: Add helper for assigning packet type when dest address does not match device address
    
    commit 6e159fd653d7ebf6290358e0330a0cb8a75cf73b upstream.
    
    Enable reuse of logic in eth_type_trans for determining packet type.
    
    Suggested-by: Sabrina Dubroca <[email protected]>
    Cc: [email protected]
    Signed-off-by: Rahul Rameshbabu <[email protected]>
    Reviewed-by: Sabrina Dubroca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fs: sysfs: Fix reference leak in sysfs_break_active_protection() [+ + +]
Author: Alan Stern <[email protected]>
Date:   Wed Mar 13 17:43:41 2024 -0400

    fs: sysfs: Fix reference leak in sysfs_break_active_protection()
    
    commit a90bca2228c0646fc29a72689d308e5fe03e6d78 upstream.
    
    The sysfs_break_active_protection() routine has an obvious reference
    leak in its error path.  If the call to kernfs_find_and_get() fails then
    kn will be NULL, so the companion sysfs_unbreak_active_protection()
    routine won't get called (and would only cause an access violation by
    trying to dereference kn->parent if it was called).  As a result, the
    reference to kobj acquired at the start of the function will never be
    released.
    
    Fix the leak by adding an explicit kobject_put() call when kn is NULL.
    
    Signed-off-by: Alan Stern <[email protected]>
    Fixes: 2afc9166f79b ("scsi: sysfs: Introduce sysfs_{un,}break_active_protection()")
    Cc: Bart Van Assche <[email protected]>
    Cc: [email protected]
    Reviewed-by: Bart Van Assche <[email protected]>
    Acked-by: Tejun Heo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
geneve: fix header validation in geneve[6]_xmit_skb [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Apr 5 10:30:34 2024 +0000

    geneve: fix header validation in geneve[6]_xmit_skb
    
    [ Upstream commit d8a6213d70accb403b82924a1c229e733433a5ef ]
    
    syzbot is able to trigger an uninit-value in geneve_xmit() [1]
    
    Problem : While most ip tunnel helpers (like ip_tunnel_get_dsfield())
    uses skb_protocol(skb, true), pskb_inet_may_pull() is only using
    skb->protocol.
    
    If anything else than ETH_P_IPV6 or ETH_P_IP is found in skb->protocol,
    pskb_inet_may_pull() does nothing at all.
    
    If a vlan tag was provided by the caller (af_packet in the syzbot case),
    the network header might not point to the correct location, and skb
    linear part could be smaller than expected.
    
    Add skb_vlan_inet_prepare() to perform a complete mac validation.
    
    Use this in geneve for the moment, I suspect we need to adopt this
    more broadly.
    
    v4 - Jakub reported v3 broke l2_tos_ttl_inherit.sh selftest
       - Only call __vlan_get_protocol() for vlan types.
    Link: https://lore.kernel.org/netdev/[email protected]/
    
    v2,v3 - Addressed Sabrina comments on v1 and v2
    Link: https://lore.kernel.org/netdev/Zg1l9L2BNoZWZDZG@hog/
    
    [1]
    
    BUG: KMSAN: uninit-value in geneve_xmit_skb drivers/net/geneve.c:910 [inline]
     BUG: KMSAN: uninit-value in geneve_xmit+0x302d/0x5420 drivers/net/geneve.c:1030
      geneve_xmit_skb drivers/net/geneve.c:910 [inline]
      geneve_xmit+0x302d/0x5420 drivers/net/geneve.c:1030
      __netdev_start_xmit include/linux/netdevice.h:4903 [inline]
      netdev_start_xmit include/linux/netdevice.h:4917 [inline]
      xmit_one net/core/dev.c:3531 [inline]
      dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3547
      __dev_queue_xmit+0x348d/0x52c0 net/core/dev.c:4335
      dev_queue_xmit include/linux/netdevice.h:3091 [inline]
      packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276
      packet_snd net/packet/af_packet.c:3081 [inline]
      packet_sendmsg+0x8bb0/0x9ef0 net/packet/af_packet.c:3113
      sock_sendmsg_nosec net/socket.c:730 [inline]
      __sock_sendmsg+0x30f/0x380 net/socket.c:745
      __sys_sendto+0x685/0x830 net/socket.c:2191
      __do_sys_sendto net/socket.c:2203 [inline]
      __se_sys_sendto net/socket.c:2199 [inline]
      __x64_sys_sendto+0x125/0x1d0 net/socket.c:2199
     do_syscall_64+0xd5/0x1f0
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    
    Uninit was created at:
      slab_post_alloc_hook mm/slub.c:3804 [inline]
      slab_alloc_node mm/slub.c:3845 [inline]
      kmem_cache_alloc_node+0x613/0xc50 mm/slub.c:3888
      kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:577
      __alloc_skb+0x35b/0x7a0 net/core/skbuff.c:668
      alloc_skb include/linux/skbuff.h:1318 [inline]
      alloc_skb_with_frags+0xc8/0xbf0 net/core/skbuff.c:6504
      sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2795
      packet_alloc_skb net/packet/af_packet.c:2930 [inline]
      packet_snd net/packet/af_packet.c:3024 [inline]
      packet_sendmsg+0x722d/0x9ef0 net/packet/af_packet.c:3113
      sock_sendmsg_nosec net/socket.c:730 [inline]
      __sock_sendmsg+0x30f/0x380 net/socket.c:745
      __sys_sendto+0x685/0x830 net/socket.c:2191
      __do_sys_sendto net/socket.c:2203 [inline]
      __se_sys_sendto net/socket.c:2199 [inline]
      __x64_sys_sendto+0x125/0x1d0 net/socket.c:2199
     do_syscall_64+0xd5/0x1f0
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    
    CPU: 0 PID: 5033 Comm: syz-executor346 Not tainted 6.9.0-rc1-syzkaller-00005-g928a87efa423 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
    
    Fixes: d13f048dd40e ("net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb")
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Phillip Potter <[email protected]>
    Cc: Sabrina Dubroca <[email protected]>
    Reviewed-by: Sabrina Dubroca <[email protected]>
    Reviewed-by: Phillip Potter <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up [+ + +]
Author: Nam Cao <[email protected]>
Date:   Mon Mar 18 11:59:02 2024 +0100

    HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up
    
    commit 9c0f59e47a90c54d0153f8ddc0f80d7a36207d0e upstream.
    
    The flag I2C_HID_READ_PENDING is used to serialize I2C operations.
    However, this is not necessary, because I2C core already has its own
    locking for that.
    
    More importantly, this flag can cause a lock-up: if the flag is set in
    i2c_hid_xfer() and an interrupt happens, the interrupt handler
    (i2c_hid_irq) will check this flag and return immediately without doing
    anything, then the interrupt handler will be invoked again in an
    infinite loop.
    
    Since interrupt handler is an RT task, it takes over the CPU and the
    flag-clearing task never gets scheduled, thus we have a lock-up.
    
    Delete this unnecessary flag.
    
    Reported-and-tested-by: Eva Kurchatova <[email protected]>
    Closes: https://lore.kernel.org/r/CA+eeCSPUDpUg76ZO8dszSbAGn+UHjcyv8F1J-CUPVARAzEtW9w@mail.gmail.com
    Fixes: 4a200c3b9a40 ("HID: i2c-hid: introduce HID over i2c specification implementation")
    Cc: <[email protected]>
    Signed-off-by: Nam Cao <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    [apply to v4.19 -> v5.15]
    Signed-off-by: Nam Cao <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
i2c: smbus: fix NULL function pointer dereference [+ + +]
Author: Wolfram Sang <[email protected]>
Date:   Fri Apr 26 08:44:08 2024 +0200

    i2c: smbus: fix NULL function pointer dereference
    
    [ Upstream commit 91811a31b68d3765b3065f4bb6d7d6d84a7cfc9f ]
    
    Baruch reported an OOPS when using the designware controller as target
    only. Target-only modes break the assumption of one transfer function
    always being available. Fix this by always checking the pointer in
    __i2c_transfer.
    
    Reported-by: Baruch Siach <[email protected]>
    Closes: https://lore.kernel.org/r/4269631780e5ba789cf1ae391eec1b959def7d99.1712761976.git.baruch@tkos.co.il
    Fixes: 4b1acc43331d ("i2c: core changes for slave support")
    [wsa: dropped the simplification in core-smbus to avoid theoretical regressions]
    Signed-off-by: Wolfram Sang <[email protected]>
    Tested-by: Baruch Siach <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
i40e: Do not use WQ_MEM_RECLAIM flag for workqueue [+ + +]
Author: Sindhu Devale <[email protected]>
Date:   Tue Apr 23 11:27:17 2024 -0700

    i40e: Do not use WQ_MEM_RECLAIM flag for workqueue
    
    [ Upstream commit 2cc7d150550cc981aceedf008f5459193282425c ]
    
    Issue reported by customer during SRIOV testing, call trace:
    When both i40e and the i40iw driver are loaded, a warning
    in check_flush_dependency is being triggered. This seems
    to be because of the i40e driver workqueue is allocated with
    the WQ_MEM_RECLAIM flag, and the i40iw one is not.
    
    Similar error was encountered on ice too and it was fixed by
    removing the flag. Do the same for i40e too.
    
    [Feb 9 09:08] ------------[ cut here ]------------
    [  +0.000004] workqueue: WQ_MEM_RECLAIM i40e:i40e_service_task [i40e] is
    flushing !WQ_MEM_RECLAIM infiniband:0x0
    [  +0.000060] WARNING: CPU: 0 PID: 937 at kernel/workqueue.c:2966
    check_flush_dependency+0x10b/0x120
    [  +0.000007] Modules linked in: snd_seq_dummy snd_hrtimer snd_seq
    snd_timer snd_seq_device snd soundcore nls_utf8 cifs cifs_arc4
    nls_ucs2_utils rdma_cm iw_cm ib_cm cifs_md4 dns_resolver netfs qrtr
    rfkill sunrpc vfat fat intel_rapl_msr intel_rapl_common irdma
    intel_uncore_frequency intel_uncore_frequency_common ice ipmi_ssif
    isst_if_common skx_edac nfit libnvdimm x86_pkg_temp_thermal
    intel_powerclamp gnss coretemp ib_uverbs rapl intel_cstate ib_core
    iTCO_wdt iTCO_vendor_support acpi_ipmi mei_me ipmi_si intel_uncore
    ioatdma i2c_i801 joydev pcspkr mei ipmi_devintf lpc_ich
    intel_pch_thermal i2c_smbus ipmi_msghandler acpi_power_meter acpi_pad
    xfs libcrc32c ast sd_mod drm_shmem_helper t10_pi drm_kms_helper sg ixgbe
    drm i40e ahci crct10dif_pclmul libahci crc32_pclmul igb crc32c_intel
    libata ghash_clmulni_intel i2c_algo_bit mdio dca wmi dm_mirror
    dm_region_hash dm_log dm_mod fuse
    [  +0.000050] CPU: 0 PID: 937 Comm: kworker/0:3 Kdump: loaded Not
    tainted 6.8.0-rc2-Feb-net_dev-Qiueue-00279-gbd43c5687e05 #1
    [  +0.000003] Hardware name: Intel Corporation S2600BPB/S2600BPB, BIOS
    SE5C620.86B.02.01.0013.121520200651 12/15/2020
    [  +0.000001] Workqueue: i40e i40e_service_task [i40e]
    [  +0.000024] RIP: 0010:check_flush_dependency+0x10b/0x120
    [  +0.000003] Code: ff 49 8b 54 24 18 48 8d 8b b0 00 00 00 49 89 e8 48
    81 c6 b0 00 00 00 48 c7 c7 b0 97 fa 9f c6 05 8a cc 1f 02 01 e8 35 b3 fd
    ff <0f> 0b e9 10 ff ff ff 80 3d 78 cc 1f 02 00 75 94 e9 46 ff ff ff 90
    [  +0.000002] RSP: 0018:ffffbd294976bcf8 EFLAGS: 00010282
    [  +0.000002] RAX: 0000000000000000 RBX: ffff94d4c483c000 RCX:
    0000000000000027
    [  +0.000001] RDX: ffff94d47f620bc8 RSI: 0000000000000001 RDI:
    ffff94d47f620bc0
    [  +0.000001] RBP: 0000000000000000 R08: 0000000000000000 R09:
    00000000ffff7fff
    [  +0.000001] R10: ffffbd294976bb98 R11: ffffffffa0be65e8 R12:
    ffff94c5451ea180
    [  +0.000001] R13: ffff94c5ab5e8000 R14: ffff94c5c20b6e05 R15:
    ffff94c5f1330ab0
    [  +0.000001] FS:  0000000000000000(0000) GS:ffff94d47f600000(0000)
    knlGS:0000000000000000
    [  +0.000002] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  +0.000001] CR2: 00007f9e6f1fca70 CR3: 0000000038e20004 CR4:
    00000000007706f0
    [  +0.000000] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
    0000000000000000
    [  +0.000001] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
    0000000000000400
    [  +0.000001] PKRU: 55555554
    [  +0.000001] Call Trace:
    [  +0.000001]  <TASK>
    [  +0.000002]  ? __warn+0x80/0x130
    [  +0.000003]  ? check_flush_dependency+0x10b/0x120
    [  +0.000002]  ? report_bug+0x195/0x1a0
    [  +0.000005]  ? handle_bug+0x3c/0x70
    [  +0.000003]  ? exc_invalid_op+0x14/0x70
    [  +0.000002]  ? asm_exc_invalid_op+0x16/0x20
    [  +0.000006]  ? check_flush_dependency+0x10b/0x120
    [  +0.000002]  ? check_flush_dependency+0x10b/0x120
    [  +0.000002]  __flush_workqueue+0x126/0x3f0
    [  +0.000015]  ib_cache_cleanup_one+0x1c/0xe0 [ib_core]
    [  +0.000056]  __ib_unregister_device+0x6a/0xb0 [ib_core]
    [  +0.000023]  ib_unregister_device_and_put+0x34/0x50 [ib_core]
    [  +0.000020]  i40iw_close+0x4b/0x90 [irdma]
    [  +0.000022]  i40e_notify_client_of_netdev_close+0x54/0xc0 [i40e]
    [  +0.000035]  i40e_service_task+0x126/0x190 [i40e]
    [  +0.000024]  process_one_work+0x174/0x340
    [  +0.000003]  worker_thread+0x27e/0x390
    [  +0.000001]  ? __pfx_worker_thread+0x10/0x10
    [  +0.000002]  kthread+0xdf/0x110
    [  +0.000002]  ? __pfx_kthread+0x10/0x10
    [  +0.000002]  ret_from_fork+0x2d/0x50
    [  +0.000003]  ? __pfx_kthread+0x10/0x10
    [  +0.000001]  ret_from_fork_asm+0x1b/0x30
    [  +0.000004]  </TASK>
    [  +0.000001] ---[ end trace 0000000000000000 ]---
    
    Fixes: 4d5957cbdecd ("i40e: remove WQ_UNBOUND and the task limit of our workqueue")
    Signed-off-by: Sindhu Devale <[email protected]>
    Reviewed-by: Arkadiusz Kubalewski <[email protected]>
    Reviewed-by: Mateusz Polchlopek <[email protected]>
    Signed-off-by: Aleksandr Loktionov <[email protected]>
    Tested-by: Robert Ganzynkowicz <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

i40e: Report MFS in decimal base instead of hex [+ + +]
Author: Erwan Velu <[email protected]>
Date:   Tue Apr 23 11:27:18 2024 -0700

    i40e: Report MFS in decimal base instead of hex
    
    [ Upstream commit ef3c313119ea448c22da10366faa26b5b4b1a18e ]
    
    If the MFS is set below the default (0x2600), a warning message is
    reported like the following :
    
            MFS for port 1 has been set below the default: 600
    
    This message is a bit confusing as the number shown here (600) is in
    fact an hexa number: 0x600 = 1536
    
    Without any explicit "0x" prefix, this message is read like the MFS is
    set to 600 bytes.
    
    MFS, as per MTUs, are usually expressed in decimal base.
    
    This commit reports both current and default MFS values in decimal
    so it's less confusing for end-users.
    
    A typical warning message looks like the following :
    
            MFS for port 1 (1536) has been set below the default (9728)
    
    Signed-off-by: Erwan Velu <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Tony Brelinski <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Fixes: 3a2c6ced90e1 ("i40e: Add a check to see if MFS is set")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
iavf: Fix TC config comparison with existing adapter TC config [+ + +]
Author: Sudheer Mogilappagari <[email protected]>
Date:   Tue Apr 23 11:27:19 2024 -0700

    iavf: Fix TC config comparison with existing adapter TC config
    
    [ Upstream commit 54976cf58d6168b8d15cebb395069f23b2f34b31 ]
    
    Same number of TCs doesn't imply that underlying TC configs are
    same. The config could be different due to difference in number
    of queues in each TC. Add utility function to determine if TC
    configs are same.
    
    Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf")
    Signed-off-by: Sudheer Mogilappagari <[email protected]>
    Tested-by: Mineri Bhange <[email protected]> (A Contingent Worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
idma64: Don't try to serve interrupts when device is powered off [+ + +]
Author: Andy Shevchenko <[email protected]>
Date:   Thu Mar 21 14:04:21 2024 +0200

    idma64: Don't try to serve interrupts when device is powered off
    
    [ Upstream commit 9140ce47872bfd89fca888c2f992faa51d20c2bc ]
    
    When iDMA 64-bit device is powered off, the IRQ status register
    is all 1:s. This is never happen in real case and signalling that
    the device is simply powered off. Don't try to serve interrupts
    that are not ours.
    
    Fixes: 667dfed98615 ("dmaengine: add a driver for Intel integrated DMA 64-bit")
    Reported-by: Heiner Kallweit <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]
    Tested-by: Heiner Kallweit <[email protected]>
    Signed-off-by: Andy Shevchenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
init/main.c: Fix potential static_command_line memory overflow [+ + +]
Author: Yuntao Wang <[email protected]>
Date:   Fri Apr 12 16:17:32 2024 +0800

    init/main.c: Fix potential static_command_line memory overflow
    
    commit 46dad3c1e57897ab9228332f03e1c14798d2d3b9 upstream.
    
    We allocate memory of size 'xlen + strlen(boot_command_line) + 1' for
    static_command_line, but the strings copied into static_command_line are
    extra_command_line and command_line, rather than extra_command_line and
    boot_command_line.
    
    When strlen(command_line) > strlen(boot_command_line), static_command_line
    will overflow.
    
    This patch just recovers strlen(command_line) which was miss-consolidated
    with strlen(boot_command_line) in the commit f5c7310ac73e ("init/main: add
    checks for the return value of memblock_alloc*()")
    
    Link: https://lore.kernel.org/all/[email protected]/
    
    Fixes: f5c7310ac73e ("init/main: add checks for the return value of memblock_alloc*()")
    Cc: [email protected]
    Signed-off-by: Yuntao Wang <[email protected]>
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommu/vt-d: Allocate local memory for page request queue [+ + +]
Author: Jacob Pan <[email protected]>
Date:   Thu Apr 11 11:07:43 2024 +0800

    iommu/vt-d: Allocate local memory for page request queue
    
    [ Upstream commit a34f3e20ddff02c4f12df2c0635367394e64c63d ]
    
    The page request queue is per IOMMU, its allocation should be made
    NUMA-aware for performance reasons.
    
    Fixes: a222a7f0bb6c ("iommu/vt-d: Implement page request handling")
    Signed-off-by: Jacob Pan <[email protected]>
    Reviewed-by: Kevin Tian <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Lu Baolu <[email protected]>
    Signed-off-by: Joerg Roedel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv4/route: avoid unused-but-set-variable warning [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Mon Apr 8 09:42:03 2024 +0200

    ipv4/route: avoid unused-but-set-variable warning
    
    [ Upstream commit cf1b7201df59fb936f40f4a807433fe3f2ce310a ]
    
    The log_martians variable is only used in an #ifdef, causing a 'make W=1'
    warning with gcc:
    
    net/ipv4/route.c: In function 'ip_rt_send_redirect':
    net/ipv4/route.c:880:13: error: variable 'log_martians' set but not used [-Werror=unused-but-set-variable]
    
    Change the #ifdef to an equivalent IS_ENABLED() to let the compiler
    see where the variable is used.
    
    Fixes: 30038fc61adf ("net: ip_rt_send_redirect() optimization")
    Reviewed-by: David Ahern <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv4: check for NULL idev in ip_route_use_hint() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Sun Apr 21 18:43:26 2024 +0000

    ipv4: check for NULL idev in ip_route_use_hint()
    
    [ Upstream commit 58a4c9b1e5a3e53c9148e80b90e1e43897ce77d1 ]
    
    syzbot was able to trigger a NULL deref in fib_validate_source()
    in an old tree [1].
    
    It appears the bug exists in latest trees.
    
    All calls to __in_dev_get_rcu() must be checked for a NULL result.
    
    [1]
    general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN
    KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
    CPU: 2 PID: 3257 Comm: syz-executor.3 Not tainted 5.10.0-syzkaller #0
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
     RIP: 0010:fib_validate_source+0xbf/0x15a0 net/ipv4/fib_frontend.c:425
    Code: 18 f2 f2 f2 f2 42 c7 44 20 23 f3 f3 f3 f3 48 89 44 24 78 42 c6 44 20 27 f3 e8 5d 88 48 fc 4c 89 e8 48 c1 e8 03 48 89 44 24 18 <42> 80 3c 20 00 74 08 4c 89 ef e8 d2 15 98 fc 48 89 5c 24 10 41 bf
    RSP: 0018:ffffc900015fee40 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: ffff88800f7a4000 RCX: ffff88800f4f90c0
    RDX: 0000000000000000 RSI: 0000000004001eac RDI: ffff8880160c64c0
    RBP: ffffc900015ff060 R08: 0000000000000000 R09: ffff88800f7a4000
    R10: 0000000000000002 R11: ffff88800f4f90c0 R12: dffffc0000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: ffff88800f7a4000
    FS:  00007f938acfe6c0(0000) GS:ffff888058c00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f938acddd58 CR3: 000000001248e000 CR4: 0000000000352ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
      ip_route_use_hint+0x410/0x9b0 net/ipv4/route.c:2231
      ip_rcv_finish_core+0x2c4/0x1a30 net/ipv4/ip_input.c:327
      ip_list_rcv_finish net/ipv4/ip_input.c:612 [inline]
      ip_sublist_rcv+0x3ed/0xe50 net/ipv4/ip_input.c:638
      ip_list_rcv+0x422/0x470 net/ipv4/ip_input.c:673
      __netif_receive_skb_list_ptype net/core/dev.c:5572 [inline]
      __netif_receive_skb_list_core+0x6b1/0x890 net/core/dev.c:5620
      __netif_receive_skb_list net/core/dev.c:5672 [inline]
      netif_receive_skb_list_internal+0x9f9/0xdc0 net/core/dev.c:5764
      netif_receive_skb_list+0x55/0x3e0 net/core/dev.c:5816
      xdp_recv_frames net/bpf/test_run.c:257 [inline]
      xdp_test_run_batch net/bpf/test_run.c:335 [inline]
      bpf_test_run_xdp_live+0x1818/0x1d00 net/bpf/test_run.c:363
      bpf_prog_test_run_xdp+0x81f/0x1170 net/bpf/test_run.c:1376
      bpf_prog_test_run+0x349/0x3c0 kernel/bpf/syscall.c:3736
      __sys_bpf+0x45c/0x710 kernel/bpf/syscall.c:5115
      __do_sys_bpf kernel/bpf/syscall.c:5201 [inline]
      __se_sys_bpf kernel/bpf/syscall.c:5199 [inline]
      __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5199
    
    Fixes: 02b24941619f ("ipv4: use dst hint for ipv4 list receive")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Acked-by: Paolo Abeni <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv6: fib: hide unused 'pn' variable [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Mon Apr 8 09:42:02 2024 +0200

    ipv6: fib: hide unused 'pn' variable
    
    [ Upstream commit 74043489fcb5e5ca4074133582b5b8011b67f9e7 ]
    
    When CONFIG_IPV6_SUBTREES is disabled, the only user is hidden, causing
    a 'make W=1' warning:
    
    net/ipv6/ip6_fib.c: In function 'fib6_add':
    net/ipv6/ip6_fib.c:1388:32: error: variable 'pn' set but not used [-Werror=unused-but-set-variable]
    
    Add another #ifdef around the variable declaration, matching the other
    uses in this file.
    
    Fixes: 66729e18df08 ("[IPV6] ROUTE: Make sure we have fn->leaf when adding a node on subtree.")
    Link: https://lore.kernel.org/netdev/[email protected]/
    Reviewed-by: David Ahern <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr [+ + +]
Author: Jiri Benc <[email protected]>
Date:   Mon Apr 8 16:18:21 2024 +0200

    ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr
    
    [ Upstream commit 7633c4da919ad51164acbf1aa322cc1a3ead6129 ]
    
    Although ipv6_get_ifaddr walks inet6_addr_lst under the RCU lock, it
    still means hlist_for_each_entry_rcu can return an item that got removed
    from the list. The memory itself of such item is not freed thanks to RCU
    but nothing guarantees the actual content of the memory is sane.
    
    In particular, the reference count can be zero. This can happen if
    ipv6_del_addr is called in parallel. ipv6_del_addr removes the entry
    from inet6_addr_lst (hlist_del_init_rcu(&ifp->addr_lst)) and drops all
    references (__in6_ifa_put(ifp) + in6_ifa_put(ifp)). With bad enough
    timing, this can happen:
    
    1. In ipv6_get_ifaddr, hlist_for_each_entry_rcu returns an entry.
    
    2. Then, the whole ipv6_del_addr is executed for the given entry. The
       reference count drops to zero and kfree_rcu is scheduled.
    
    3. ipv6_get_ifaddr continues and tries to increments the reference count
       (in6_ifa_hold).
    
    4. The rcu is unlocked and the entry is freed.
    
    5. The freed entry is returned.
    
    Prevent increasing of the reference count in such case. The name
    in6_ifa_hold_safe is chosen to mimic the existing fib6_info_hold_safe.
    
    [   41.506330] refcount_t: addition on 0; use-after-free.
    [   41.506760] WARNING: CPU: 0 PID: 595 at lib/refcount.c:25 refcount_warn_saturate+0xa5/0x130
    [   41.507413] Modules linked in: veth bridge stp llc
    [   41.507821] CPU: 0 PID: 595 Comm: python3 Not tainted 6.9.0-rc2.main-00208-g49563be82afa #14
    [   41.508479] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
    [   41.509163] RIP: 0010:refcount_warn_saturate+0xa5/0x130
    [   41.509586] Code: ad ff 90 0f 0b 90 90 c3 cc cc cc cc 80 3d c0 30 ad 01 00 75 a0 c6 05 b7 30 ad 01 01 90 48 c7 c7 38 cc 7a 8c e8 cc 18 ad ff 90 <0f> 0b 90 90 c3 cc cc cc cc 80 3d 98 30 ad 01 00 0f 85 75 ff ff ff
    [   41.510956] RSP: 0018:ffffbda3c026baf0 EFLAGS: 00010282
    [   41.511368] RAX: 0000000000000000 RBX: ffff9e9c46914800 RCX: 0000000000000000
    [   41.511910] RDX: ffff9e9c7ec29c00 RSI: ffff9e9c7ec1c900 RDI: ffff9e9c7ec1c900
    [   41.512445] RBP: ffff9e9c43660c9c R08: 0000000000009ffb R09: 00000000ffffdfff
    [   41.512998] R10: 00000000ffffdfff R11: ffffffff8ca58a40 R12: ffff9e9c4339a000
    [   41.513534] R13: 0000000000000001 R14: ffff9e9c438a0000 R15: ffffbda3c026bb48
    [   41.514086] FS:  00007fbc4cda1740(0000) GS:ffff9e9c7ec00000(0000) knlGS:0000000000000000
    [   41.514726] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [   41.515176] CR2: 000056233b337d88 CR3: 000000000376e006 CR4: 0000000000370ef0
    [   41.515713] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [   41.516252] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [   41.516799] Call Trace:
    [   41.517037]  <TASK>
    [   41.517249]  ? __warn+0x7b/0x120
    [   41.517535]  ? refcount_warn_saturate+0xa5/0x130
    [   41.517923]  ? report_bug+0x164/0x190
    [   41.518240]  ? handle_bug+0x3d/0x70
    [   41.518541]  ? exc_invalid_op+0x17/0x70
    [   41.520972]  ? asm_exc_invalid_op+0x1a/0x20
    [   41.521325]  ? refcount_warn_saturate+0xa5/0x130
    [   41.521708]  ipv6_get_ifaddr+0xda/0xe0
    [   41.522035]  inet6_rtm_getaddr+0x342/0x3f0
    [   41.522376]  ? __pfx_inet6_rtm_getaddr+0x10/0x10
    [   41.522758]  rtnetlink_rcv_msg+0x334/0x3d0
    [   41.523102]  ? netlink_unicast+0x30f/0x390
    [   41.523445]  ? __pfx_rtnetlink_rcv_msg+0x10/0x10
    [   41.523832]  netlink_rcv_skb+0x53/0x100
    [   41.524157]  netlink_unicast+0x23b/0x390
    [   41.524484]  netlink_sendmsg+0x1f2/0x440
    [   41.524826]  __sys_sendto+0x1d8/0x1f0
    [   41.525145]  __x64_sys_sendto+0x1f/0x30
    [   41.525467]  do_syscall_64+0xa5/0x1b0
    [   41.525794]  entry_SYSCALL_64_after_hwframe+0x72/0x7a
    [   41.526213] RIP: 0033:0x7fbc4cfcea9a
    [   41.526528] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
    [   41.527942] RSP: 002b:00007ffcf54012a8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    [   41.528593] RAX: ffffffffffffffda RBX: 00007ffcf5401368 RCX: 00007fbc4cfcea9a
    [   41.529173] RDX: 000000000000002c RSI: 00007fbc4b9d9bd0 RDI: 0000000000000005
    [   41.529786] RBP: 00007fbc4bafb040 R08: 00007ffcf54013e0 R09: 000000000000000c
    [   41.530375] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    [   41.530977] R13: ffffffffc4653600 R14: 0000000000000001 R15: 00007fbc4ca85d1b
    [   41.531573]  </TASK>
    
    Fixes: 5c578aedcb21d ("IPv6: convert addrconf hash list to RCU")
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Signed-off-by: Jiri Benc <[email protected]>
    Link: https://lore.kernel.org/r/8ab821e36073a4a406c50ec83c9e8dc586c539e4.1712585809.git.jbenc@redhat.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipvs: Fix checksumming on GSO of SCTP packets [+ + +]
Author: Ismael Luceno <[email protected]>
Date:   Sun Apr 21 16:22:32 2024 +0200

    ipvs: Fix checksumming on GSO of SCTP packets
    
    [ Upstream commit e10d3ba4d434ed172914617ed8d74bd411421193 ]
    
    It was observed in the wild that pairs of consecutive packets would leave
    the IPVS with the same wrong checksum, and the issue only went away when
    disabling GSO.
    
    IPVS needs to avoid computing the SCTP checksum when using GSO.
    
    Fixes: 90017accff61 ("sctp: Add GSO support")
    Co-developed-by: Firo Yang <[email protected]>
    Signed-off-by: Ismael Luceno <[email protected]>
    Tested-by: Andreas Taschner <[email protected]>
    Acked-by: Julian Anastasov <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
irqchip/gic-v3-its: Prevent double free on error [+ + +]
Author: Guanrui Huang <[email protected]>
Date:   Thu Apr 18 14:10:52 2024 +0800

    irqchip/gic-v3-its: Prevent double free on error
    
    commit c26591afd33adce296c022e3480dea4282b7ef91 upstream.
    
    The error handling path in its_vpe_irq_domain_alloc() causes a double free
    when its_vpe_init() fails after successfully allocating at least one
    interrupt. This happens because its_vpe_irq_domain_free() frees the
    interrupts along with the area bitmap and the vprop_page and
    its_vpe_irq_domain_alloc() subsequently frees the area bitmap and the
    vprop_page again.
    
    Fix this by unconditionally invoking its_vpe_irq_domain_free() which
    handles all cases correctly and by removing the bitmap/vprop_page freeing
    from its_vpe_irq_domain_alloc().
    
    [ tglx: Massaged change log ]
    
    Fixes: 7d75bbb4bc1a ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
    Signed-off-by: Guanrui Huang <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Reviewed-by: Zenghui Yu <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
irqflags: Explicitly ignore lockdep_hrtimer_exit() argument [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Mon Apr 8 09:46:01 2024 +0200

    irqflags: Explicitly ignore lockdep_hrtimer_exit() argument
    
    commit c1d11fc2c8320871b40730991071dd0a0b405bc8 upstream.
    
    When building with 'make W=1' but CONFIG_TRACE_IRQFLAGS=n, the
    unused argument to lockdep_hrtimer_exit() causes a warning:
    
    kernel/time/hrtimer.c:1655:14: error: variable 'expires_in_hardirq' set but not used [-Werror=unused-but-set-variable]
    
    This is intentional behavior, so add a cast to void to shut up the warning.
    
    Fixes: 73d20564e0dc ("hrtimer: Don't dereference the hrtimer pointer after the callback")
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Sebastian Andrzej Siewior <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
kprobes: Fix possible use-after-free issue on kprobe registration [+ + +]
Author: Zheng Yejian <[email protected]>
Date:   Wed Apr 10 09:58:02 2024 +0800

    kprobes: Fix possible use-after-free issue on kprobe registration
    
    commit 325f3fb551f8cd672dbbfc4cf58b14f9ee3fc9e8 upstream.
    
    When unloading a module, its state is changing MODULE_STATE_LIVE ->
     MODULE_STATE_GOING -> MODULE_STATE_UNFORMED. Each change will take
    a time. `is_module_text_address()` and `__module_text_address()`
    works with MODULE_STATE_LIVE and MODULE_STATE_GOING.
    If we use `is_module_text_address()` and `__module_text_address()`
    separately, there is a chance that the first one is succeeded but the
    next one is failed because module->state becomes MODULE_STATE_UNFORMED
    between those operations.
    
    In `check_kprobe_address_safe()`, if the second `__module_text_address()`
    is failed, that is ignored because it expected a kernel_text address.
    But it may have failed simply because module->state has been changed
    to MODULE_STATE_UNFORMED. In this case, arm_kprobe() will try to modify
    non-exist module text address (use-after-free).
    
    To fix this problem, we should not use separated `is_module_text_address()`
    and `__module_text_address()`, but use only `__module_text_address()`
    once and do `try_module_get(module)` which is only available with
    MODULE_STATE_LIVE.
    
    Link: https://lore.kernel.org/all/[email protected]/
    
    Fixes: 28f6c37a2910 ("kprobes: Forbid probing on trampoline and BPF code areas")
    Cc: [email protected]
    Signed-off-by: Zheng Yejian <[email protected]>
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    [Fix conflict due to lack dependency
    commit 223a76b268c9 ("kprobes: Fix coding style issues")]
    Signed-off-by: Zheng Yejian <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: Linux 5.10.216 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu May 2 16:23:46 2024 +0200

    Linux 5.10.216
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Salvatore Bonaccorso <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Florian Fainelli <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Pavel Machek (CIP) <[email protected]>
    Tested-by: Dominique Martinet <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mailbox: imx: fix suspend failue [+ + +]
Author: Daisuke Mizobuchi <[email protected]>
Date:   Fri Apr 12 14:21:33 2024 +0900

    mailbox: imx: fix suspend failue
    
    imx_mu_isr() always calls pm_system_wakeup() even when it should not,
    making the system unable to enter sleep.
    
    Suspend fails as follows:
     armadillo:~# echo mem > /sys/power/state
     [ 2614.602432] PM: suspend entry (deep)
     [ 2614.610640] Filesystems sync: 0.004 seconds
     [ 2614.618016] Freezing user space processes ... (elapsed 0.001 seconds) done.
     [ 2614.626555] OOM killer disabled.
     [ 2614.629792] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
     [ 2614.638456] printk: Suspending console(s) (use no_console_suspend to debug)
     [ 2614.649504] PM: Some devices failed to suspend, or early wake event detected
     [ 2614.730103] PM: resume devices took 0.080 seconds
     [ 2614.741924] OOM killer enabled.
     [ 2614.745073] Restarting tasks ... done.
     [ 2614.754532] PM: suspend exit
     ash: write error: Resource busy
     armadillo:~#
    
    Upstream commit 892cb524ae8a is correct, so this seems to be a
    mistake during cherry-pick.
    
    Cc: <[email protected]>
    Fixes: a16f5ae8ade1 ("mailbox: imx: fix wakeup failure from freeze mode")
    Signed-off-by: Daisuke Mizobuchi <[email protected]>
    Reviewed-by: Dominique Martinet <[email protected]>
    Reviewed-by: Peng Fan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
media: cec: core: remove length check of Timer Status [+ + +]
Author: Nini Song <[email protected]>
Date:   Thu Jan 25 21:28:45 2024 +0800

    media: cec: core: remove length check of Timer Status
    
    commit ce5d241c3ad4568c12842168288993234345c0eb upstream.
    
    The valid_la is used to check the length requirements,
    including special cases of Timer Status. If the length is
    shorter than 5, that means no Duration Available is returned,
    the message will be forced to be invalid.
    
    However, the description of Duration Available in the spec
    is that this parameter may be returned when these cases, or
    that it can be optionally return when these cases. The key
    words in the spec description are flexible choices.
    
    Remove the special length check of Timer Status to fit the
    spec which is not compulsory about that.
    
    Signed-off-by: Nini Song <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mei: me: disable RPL-S on SPS and IGN firmwares [+ + +]
Author: Alexander Usyskin <[email protected]>
Date:   Tue Mar 12 07:19:58 2024 +0200

    mei: me: disable RPL-S on SPS and IGN firmwares
    
    commit 0dc04112bee6fdd6eb847ccb32214703022c0269 upstream.
    
    Extend the quirk to disable MEI interface on Intel PCH Ignition (IGN)
    and SPS firmwares for RPL-S devices. These firmwares do not support
    the MEI protocol.
    
    Fixes: 3ed8c7d39cfe ("mei: me: add raptor lake point S DID")
    Cc: [email protected]
    Signed-off-by: Alexander Usyskin <[email protected]>
    Signed-off-by: Tomas Winkler <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mlxsw: core: Unregister EMAD trap using FORWARD action [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Thu Apr 18 15:46:06 2024 +0200

    mlxsw: core: Unregister EMAD trap using FORWARD action
    
    [ Upstream commit 976c44af48141cd8595601c0af2a19a43c5b228b ]
    
    The device's manual (PRM - Programmer's Reference Manual) classifies the
    trap that is used to deliver EMAD responses as an "event trap". Among
    other things, it means that the only actions that can be associated with
    the trap are TRAP and FORWARD (NOP).
    
    Currently, during driver de-initialization the driver unregisters the
    trap by setting its action to DISCARD, which violates the above
    guideline. Future firmware versions will prevent such misuses by
    returning an error. This does not prevent the driver from working, but
    an error will be printed to the kernel log during module removal /
    devlink reload:
    
    mlxsw_spectrum 0000:03:00.0: Reg cmd access status failed (status=7(bad parameter))
    mlxsw_spectrum 0000:03:00.0: Reg cmd access failed (reg_id=7003(hpkt),type=write)
    
    Suppress the error message by aligning the driver to the manual and use
    a FORWARD (NOP) action when unregistering the trap.
    
    Fixes: 4ec14b7634b2 ("mlxsw: Add interface to access registers and process events")
    Cc: Jiri Pirko <[email protected]>
    Cc: Amit Cohen <[email protected]>
    Signed-off-by: Ido Schimmel <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Link: https://lore.kernel.org/r/753a89e14008fde08cb4a2c1e5f537b81d8eb2d6.1713446092.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix incorrect list API usage [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:26:01 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix incorrect list API usage
    
    [ Upstream commit b377add0f0117409c418ddd6504bd682ebe0bf79 ]
    
    Both the function that migrates all the chunks within a region and the
    function that migrates all the entries within a chunk call
    list_first_entry() on the respective lists without checking that the
    lists are not empty. This is incorrect usage of the API, which leads to
    the following warning [1].
    
    Fix by returning if the lists are empty as there is nothing to migrate
    in this case.
    
    [1]
    WARNING: CPU: 0 PID: 6437 at drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:1266 mlxsw_sp_acl_tcam_vchunk_migrate_all+0x1f1/0>
    Modules linked in:
    CPU: 0 PID: 6437 Comm: kworker/0:37 Not tainted 6.9.0-rc3-custom-00883-g94a65f079ef6 #39
    Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
    Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
    RIP: 0010:mlxsw_sp_acl_tcam_vchunk_migrate_all+0x1f1/0x2c0
    [...]
    Call Trace:
     <TASK>
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x6c/0x4a0
     process_one_work+0x151/0x370
     worker_thread+0x2cb/0x3e0
     kthread+0xd0/0x100
     ret_from_fork+0x34/0x50
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Fixes: 6f9579d4e302 ("mlxsw: spectrum_acl: Remember where to continue rehash migration")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/4628e9a22d1d84818e28310abbbc498e7bc31bc9.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix memory leak during rehash [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:25:59 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix memory leak during rehash
    
    [ Upstream commit 8ca3f7a7b61393804c46f170743c3b839df13977 ]
    
    The rehash delayed work migrates filters from one region to another.
    This is done by iterating over all chunks (all the filters with the same
    priority) in the region and in each chunk iterating over all the
    filters.
    
    If the migration fails, the code tries to migrate the filters back to
    the old region. However, the rollback itself can also fail in which case
    another migration will be erroneously performed. Besides the fact that
    this ping pong is not a very good idea, it also creates a problem.
    
    Each virtual chunk references two chunks: The currently used one
    ('vchunk->chunk') and a backup ('vchunk->chunk2'). During migration the
    first holds the chunk we want to migrate filters to and the second holds
    the chunk we are migrating filters from.
    
    The code currently assumes - but does not verify - that the backup chunk
    does not exist (NULL) if the currently used chunk does not reference the
    target region. This assumption breaks when we are trying to rollback a
    rollback, resulting in the backup chunk being overwritten and leaked
    [1].
    
    Fix by not rolling back a failed rollback and add a warning to avoid
    future cases.
    
    [1]
    WARNING: CPU: 5 PID: 1063 at lib/parman.c:291 parman_destroy+0x17/0x20
    Modules linked in:
    CPU: 5 PID: 1063 Comm: kworker/5:11 Tainted: G        W          6.9.0-rc2-custom-00784-gc6a05c468a0b #14
    Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
    Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
    RIP: 0010:parman_destroy+0x17/0x20
    [...]
    Call Trace:
     <TASK>
     mlxsw_sp_acl_atcam_region_fini+0x19/0x60
     mlxsw_sp_acl_tcam_region_destroy+0x49/0xf0
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x1f1/0x470
     process_one_work+0x151/0x370
     worker_thread+0x2cb/0x3e0
     kthread+0xd0/0x100
     ret_from_fork+0x34/0x50
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Fixes: 843500518509 ("mlxsw: spectrum_acl: Do rollback as another call to mlxsw_sp_acl_tcam_vchunk_migrate_all()")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/d5edd4f4503934186ae5cfe268503b16345b4e0f.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix memory leak when canceling rehash work [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:26:02 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix memory leak when canceling rehash work
    
    [ Upstream commit fb4e2b70a7194b209fc7320bbf33b375f7114bd5 ]
    
    The rehash delayed work is rescheduled with a delay if the number of
    credits at end of the work is not negative as supposedly it means that
    the migration ended. Otherwise, it is rescheduled immediately.
    
    After "mlxsw: spectrum_acl_tcam: Fix possible use-after-free during
    rehash" the above is no longer accurate as a non-negative number of
    credits is no longer indicative of the migration being done. It can also
    happen if the work encountered an error in which case the migration will
    resume the next time the work is scheduled.
    
    The significance of the above is that it is possible for the work to be
    pending and associated with hints that were allocated when the migration
    started. This leads to the hints being leaked [1] when the work is
    canceled while pending as part of ACL region dismantle.
    
    Fix by freeing the hints if hints are associated with a work that was
    canceled while pending.
    
    Blame the original commit since the reliance on not having a pending
    work associated with hints is fragile.
    
    [1]
    unreferenced object 0xffff88810e7c3000 (size 256):
      comm "kworker/0:16", pid 176, jiffies 4295460353
      hex dump (first 32 bytes):
        00 30 95 11 81 88 ff ff 61 00 00 00 00 00 00 80  .0......a.......
        00 00 61 00 40 00 00 00 00 00 00 00 04 00 00 00  ..a.@...........
      backtrace (crc 2544ddb9):
        [<00000000cf8cfab3>] kmalloc_trace+0x23f/0x2a0
        [<000000004d9a1ad9>] objagg_hints_get+0x42/0x390
        [<000000000b143cf3>] mlxsw_sp_acl_erp_rehash_hints_get+0xca/0x400
        [<0000000059bdb60a>] mlxsw_sp_acl_tcam_vregion_rehash_work+0x868/0x1160
        [<00000000e81fd734>] process_one_work+0x59c/0xf20
        [<00000000ceee9e81>] worker_thread+0x799/0x12c0
        [<00000000bda6fe39>] kthread+0x246/0x300
        [<0000000070056d23>] ret_from_fork+0x34/0x70
        [<00000000dea2b93e>] ret_from_fork_asm+0x1a/0x30
    
    Fixes: c9c9af91f1d9 ("mlxsw: spectrum_acl: Allow to interrupt/continue rehash work")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/0cc12ebb07c4d4c41a1265ee2c28b392ff997a86.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix possible use-after-free during activity update [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:25:56 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix possible use-after-free during activity update
    
    [ Upstream commit 79b5b4b18bc85b19d3a518483f9abbbe6d7b3ba4 ]
    
    The rule activity update delayed work periodically traverses the list of
    configured rules and queries their activity from the device.
    
    As part of this task it accesses the entry pointed by 'ventry->entry',
    but this entry can be changed concurrently by the rehash delayed work,
    leading to a use-after-free [1].
    
    Fix by closing the race and perform the activity query under the
    'vregion->lock' mutex.
    
    [1]
    BUG: KASAN: slab-use-after-free in mlxsw_sp_acl_tcam_flower_rule_activity_get+0x121/0x140
    Read of size 8 at addr ffff8881054ed808 by task kworker/0:18/181
    
    CPU: 0 PID: 181 Comm: kworker/0:18 Not tainted 6.9.0-rc2-custom-00781-gd5ab772d32f7 #2
    Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
    Workqueue: mlxsw_core mlxsw_sp_acl_rule_activity_update_work
    Call Trace:
     <TASK>
     dump_stack_lvl+0xc6/0x120
     print_report+0xce/0x670
     kasan_report+0xd7/0x110
     mlxsw_sp_acl_tcam_flower_rule_activity_get+0x121/0x140
     mlxsw_sp_acl_rule_activity_update_work+0x219/0x400
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Allocated by task 1039:
     kasan_save_stack+0x33/0x60
     kasan_save_track+0x14/0x30
     __kasan_kmalloc+0x8f/0xa0
     __kmalloc+0x19c/0x360
     mlxsw_sp_acl_tcam_entry_create+0x7b/0x1f0
     mlxsw_sp_acl_tcam_vchunk_migrate_all+0x30d/0xb50
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
    
    Freed by task 1039:
     kasan_save_stack+0x33/0x60
     kasan_save_track+0x14/0x30
     kasan_save_free_info+0x3b/0x60
     poison_slab_object+0x102/0x170
     __kasan_slab_free+0x14/0x30
     kfree+0xc1/0x290
     mlxsw_sp_acl_tcam_vchunk_migrate_all+0x3d7/0xb50
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
    
    Fixes: 2bffc5322fd8 ("mlxsw: spectrum_acl: Don't take mutex in mlxsw_sp_acl_tcam_vregion_rehash_work()")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/1fcce0a60b231ebeb2515d91022284ba7b4ffe7a.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix possible use-after-free during rehash [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:25:57 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix possible use-after-free during rehash
    
    [ Upstream commit 54225988889931467a9b55fdbef534079b665519 ]
    
    The rehash delayed work migrates filters from one region to another
    according to the number of available credits.
    
    The migrated from region is destroyed at the end of the work if the
    number of credits is non-negative as the assumption is that this is
    indicative of migration being complete. This assumption is incorrect as
    a non-negative number of credits can also be the result of a failed
    migration.
    
    The destruction of a region that still has filters referencing it can
    result in a use-after-free [1].
    
    Fix by not destroying the region if migration failed.
    
    [1]
    BUG: KASAN: slab-use-after-free in mlxsw_sp_acl_ctcam_region_entry_remove+0x21d/0x230
    Read of size 8 at addr ffff8881735319e8 by task kworker/0:31/3858
    
    CPU: 0 PID: 3858 Comm: kworker/0:31 Tainted: G        W          6.9.0-rc2-custom-00782-gf2275c2157d8 #5
    Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
    Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
    Call Trace:
     <TASK>
     dump_stack_lvl+0xc6/0x120
     print_report+0xce/0x670
     kasan_report+0xd7/0x110
     mlxsw_sp_acl_ctcam_region_entry_remove+0x21d/0x230
     mlxsw_sp_acl_ctcam_entry_del+0x2e/0x70
     mlxsw_sp_acl_atcam_entry_del+0x81/0x210
     mlxsw_sp_acl_tcam_vchunk_migrate_all+0x3cd/0xb50
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Allocated by task 174:
     kasan_save_stack+0x33/0x60
     kasan_save_track+0x14/0x30
     __kasan_kmalloc+0x8f/0xa0
     __kmalloc+0x19c/0x360
     mlxsw_sp_acl_tcam_region_create+0xdf/0x9c0
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x954/0x1300
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
    
    Freed by task 7:
     kasan_save_stack+0x33/0x60
     kasan_save_track+0x14/0x30
     kasan_save_free_info+0x3b/0x60
     poison_slab_object+0x102/0x170
     __kasan_slab_free+0x14/0x30
     kfree+0xc1/0x290
     mlxsw_sp_acl_tcam_region_destroy+0x272/0x310
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x731/0x1300
     process_one_work+0x8eb/0x19b0
     worker_thread+0x6c9/0xf70
     kthread+0x2c9/0x3b0
     ret_from_fork+0x4d/0x80
     ret_from_fork_asm+0x1a/0x30
    
    Fixes: c9c9af91f1d9 ("mlxsw: spectrum_acl: Allow to interrupt/continue rehash work")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/3e412b5659ec2310c5c615760dfe5eac18dd7ebd.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix race during rehash delayed work [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:25:55 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix race during rehash delayed work
    
    [ Upstream commit d90cfe20562407d9f080d24123078d666d730707 ]
    
    The purpose of the rehash delayed work is to reduce the number of masks
    (eRPs) used by an ACL region as the eRP bank is a global and limited
    resource.
    
    This is done in three steps:
    
    1. Creating a new set of masks and a new ACL region which will use the
       new masks and to which the existing filters will be migrated to. The
       new region is assigned to 'vregion->region' and the region from which
       the filters are migrated from is assigned to 'vregion->region2'.
    
    2. Migrating all the filters from the old region to the new region.
    
    3. Destroying the old region and setting 'vregion->region2' to NULL.
    
    Only the second steps is performed under the 'vregion->lock' mutex
    although its comments says that among other things it "Protects
    consistency of region, region2 pointers".
    
    This is problematic as the first step can race with filter insertion
    from user space that uses 'vregion->region', but under the mutex.
    
    Fix by holding the mutex across the entirety of the delayed work and not
    only during the second step.
    
    Fixes: 2bffc5322fd8 ("mlxsw: spectrum_acl: Don't take mutex in mlxsw_sp_acl_tcam_vregion_rehash_work()")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/1ec1d54edf2bad0a369e6b4fa030aba64e1f124b.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Fix warning during rehash [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:26:00 2024 +0200

    mlxsw: spectrum_acl_tcam: Fix warning during rehash
    
    [ Upstream commit 743edc8547a92b6192aa1f1b6bb78233fa21dc9b ]
    
    As previously explained, the rehash delayed work migrates filters from
    one region to another. This is done by iterating over all chunks (all
    the filters with the same priority) in the region and in each chunk
    iterating over all the filters.
    
    When the work runs out of credits it stores the current chunk and entry
    as markers in the per-work context so that it would know where to resume
    the migration from the next time the work is scheduled.
    
    Upon error, the chunk marker is reset to NULL, but without resetting the
    entry markers despite being relative to it. This can result in migration
    being resumed from an entry that does not belong to the chunk being
    migrated. In turn, this will eventually lead to a chunk being iterated
    over as if it is an entry. Because of how the two structures happen to
    be defined, this does not lead to KASAN splats, but to warnings such as
    [1].
    
    Fix by creating a helper that resets all the markers and call it from
    all the places the currently only reset the chunk marker. For good
    measures also call it when starting a completely new rehash. Add a
    warning to avoid future cases.
    
    [1]
    WARNING: CPU: 7 PID: 1076 at drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c:407 mlxsw_afk_encode+0x242/0x2f0
    Modules linked in:
    CPU: 7 PID: 1076 Comm: kworker/7:24 Tainted: G        W          6.9.0-rc3-custom-00880-g29e61d91b77b #29
    Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
    Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
    RIP: 0010:mlxsw_afk_encode+0x242/0x2f0
    [...]
    Call Trace:
     <TASK>
     mlxsw_sp_acl_atcam_entry_add+0xd9/0x3c0
     mlxsw_sp_acl_tcam_entry_create+0x5e/0xa0
     mlxsw_sp_acl_tcam_vchunk_migrate_all+0x109/0x290
     mlxsw_sp_acl_tcam_vregion_rehash_work+0x6c/0x470
     process_one_work+0x151/0x370
     worker_thread+0x2cb/0x3e0
     kthread+0xd0/0x100
     ret_from_fork+0x34/0x50
     </TASK>
    
    Fixes: 6f9579d4e302 ("mlxsw: spectrum_acl: Remember where to continue rehash migration")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/cc17eed86b41dd829d39b07906fec074a9ce580e.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mlxsw: spectrum_acl_tcam: Rate limit error message [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Mon Apr 22 17:25:58 2024 +0200

    mlxsw: spectrum_acl_tcam: Rate limit error message
    
    [ Upstream commit 5bcf925587e9b5d36420d572a0b4d131c90fb306 ]
    
    In the rare cases when the device resources are exhausted it is likely
    that the rehash delayed work will fail. An error message will be printed
    whenever this happens which can be overwhelming considering the fact
    that the work is per-region and that there can be hundreds of regions.
    
    Fix by rate limiting the error message.
    
    Fixes: e5e7962ee5c2 ("mlxsw: spectrum_acl: Implement region migration according to hints")
    Signed-off-by: Ido Schimmel <[email protected]>
    Tested-by: Alexander Zubkov <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Signed-off-by: Petr Machata <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/c510763b2ebd25e7990d80183feff91cde593145.1713797103.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mtd: diskonchip: work around ubsan link failure [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Apr 5 16:30:04 2024 +0200

    mtd: diskonchip: work around ubsan link failure
    
    commit 21c9fb611c25d5cd038f6fe485232e7884bb0b3d upstream.
    
    I ran into a randconfig build failure with UBSAN using gcc-13.2:
    
    arm-linux-gnueabi-ld: error: unplaced orphan section `.bss..Lubsan_data31' from `drivers/mtd/nand/raw/diskonchip.o'
    
    I'm not entirely sure what is going on here, but I suspect this has something
    to do with the check for the end of the doc_locations[] array that contains
    an (unsigned long)0xffffffff element, which is compared against the signed
    (int)0xffffffff. If this is the case, we should get a runtime check for
    undefined behavior, but we instead get an unexpected build-time error.
    
    I would have expected this to work fine on 32-bit architectures despite the
    signed integer overflow, though on 64-bit architectures this likely won't
    ever work.
    
    Changing the contition to instead check for the size of the array makes the
    code safe everywhere and avoids the ubsan check that leads to the link
    error. The loop code goes back to before 2.6.12.
    
    Cc: [email protected]
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://lore.kernel.org/linux-mtd/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net/mlx5: Properly link new fs rules into the tree [+ + +]
Author: Cosmin Ratiu <[email protected]>
Date:   Tue Apr 9 22:08:12 2024 +0300

    net/mlx5: Properly link new fs rules into the tree
    
    [ Upstream commit 7c6782ad4911cbee874e85630226ed389ff2e453 ]
    
    Previously, add_rule_fg would only add newly created rules from the
    handle into the tree when they had a refcount of 1. On the other hand,
    create_flow_handle tries hard to find and reference already existing
    identical rules instead of creating new ones.
    
    These two behaviors can result in a situation where create_flow_handle
    1) creates a new rule and references it, then
    2) in a subsequent step during the same handle creation references it
       again,
    resulting in a rule with a refcount of 2 that is not linked into the
    tree, will have a NULL parent and root and will result in a crash when
    the flow group is deleted because del_sw_hw_rule, invoked on rule
    deletion, assumes node->parent is != NULL.
    
    This happened in the wild, due to another bug related to incorrect
    handling of duplicate pkt_reformat ids, which lead to the code in
    create_flow_handle incorrectly referencing a just-added rule in the same
    flow handle, resulting in the problem described above. Full details are
    at [1].
    
    This patch changes add_rule_fg to add new rules without parents into
    the tree, properly initializing them and avoiding the crash. This makes
    it more consistent with how rules are added to an FTE in
    create_flow_handle.
    
    Fixes: 74491de93712 ("net/mlx5: Add multi dest support")
    Link: https://lore.kernel.org/netdev/[email protected]/T/#u [1]
    Signed-off-by: Cosmin Ratiu <[email protected]>
    Reviewed-by: Tariq Toukan <[email protected]>
    Reviewed-by: Mark Bloch <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Tariq Toukan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/mlx5e: Fix a race in command alloc flow [+ + +]
Author: Shifeng Li <[email protected]>
Date:   Sat Dec 2 00:01:26 2023 -0800

    net/mlx5e: Fix a race in command alloc flow
    
    commit 8f5100da56b3980276234e812ce98d8f075194cd upstream.
    
    Fix a cmd->ent use after free due to a race on command entry.
    Such race occurs when one of the commands releases its last refcount and
    frees its index and entry while another process running command flush
    flow takes refcount to this command entry. The process which handles
    commands flush may see this command as needed to be flushed if the other
    process allocated a ent->idx but didn't set ent to cmd->ent_arr in
    cmd_work_handler(). Fix it by moving the assignment of cmd->ent_arr into
    the spin lock.
    
    [70013.081955] BUG: KASAN: use-after-free in mlx5_cmd_trigger_completions+0x1e2/0x4c0 [mlx5_core]
    [70013.081967] Write of size 4 at addr ffff88880b1510b4 by task kworker/26:1/1433361
    [70013.081968]
    [70013.082028] Workqueue: events aer_isr
    [70013.082053] Call Trace:
    [70013.082067]  dump_stack+0x8b/0xbb
    [70013.082086]  print_address_description+0x6a/0x270
    [70013.082102]  kasan_report+0x179/0x2c0
    [70013.082173]  mlx5_cmd_trigger_completions+0x1e2/0x4c0 [mlx5_core]
    [70013.082267]  mlx5_cmd_flush+0x80/0x180 [mlx5_core]
    [70013.082304]  mlx5_enter_error_state+0x106/0x1d0 [mlx5_core]
    [70013.082338]  mlx5_try_fast_unload+0x2ea/0x4d0 [mlx5_core]
    [70013.082377]  remove_one+0x200/0x2b0 [mlx5_core]
    [70013.082409]  pci_device_remove+0xf3/0x280
    [70013.082439]  device_release_driver_internal+0x1c3/0x470
    [70013.082453]  pci_stop_bus_device+0x109/0x160
    [70013.082468]  pci_stop_and_remove_bus_device+0xe/0x20
    [70013.082485]  pcie_do_fatal_recovery+0x167/0x550
    [70013.082493]  aer_isr+0x7d2/0x960
    [70013.082543]  process_one_work+0x65f/0x12d0
    [70013.082556]  worker_thread+0x87/0xb50
    [70013.082571]  kthread+0x2e9/0x3a0
    [70013.082592]  ret_from_fork+0x1f/0x40
    
    The logical relationship of this error is as follows:
    
                 aer_recover_work              |          ent->work
    -------------------------------------------+------------------------------
    aer_recover_work_func                      |
    |- pcie_do_recovery                        |
      |- report_error_detected                 |
        |- mlx5_pci_err_detected               |cmd_work_handler
          |- mlx5_enter_error_state            |  |- cmd_alloc_index
            |- enter_error_state               |    |- lock cmd->alloc_lock
              |- mlx5_cmd_flush                |    |- clear_bit
                |- mlx5_cmd_trigger_completions|    |- unlock cmd->alloc_lock
                  |- lock cmd->alloc_lock      |
                  |- vector = ~dev->cmd.vars.bitmask
                  |- for_each_set_bit          |
                    |- cmd_ent_get(cmd->ent_arr[i]) (UAF)
                  |- unlock cmd->alloc_lock    |  |- cmd->ent_arr[ent->idx]=ent
    
    The cmd->ent_arr[ent->idx] assignment and the bit clearing are not
    protected by the cmd->alloc_lock in cmd_work_handler().
    
    Fixes: 50b2412b7e78 ("net/mlx5: Avoid possible free of command entry while timeout comp handler")
    Reviewed-by: Moshe Shemesh <[email protected]>
    Signed-off-by: Shifeng Li <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Samasth Norway Ananda <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net: b44: set pause params only when interface is up [+ + +]
Author: Peter Münster <[email protected]>
Date:   Wed Apr 24 15:51:52 2024 +0200

    net: b44: set pause params only when interface is up
    
    commit e3eb7dd47bd4806f00e104eb6da092c435f9fb21 upstream.
    
    b44_free_rings() accesses b44::rx_buffers (and ::tx_buffers)
    unconditionally, but b44::rx_buffers is only valid when the
    device is up (they get allocated in b44_open(), and deallocated
    again in b44_close()), any other time these are just a NULL pointers.
    
    So if you try to change the pause params while the network interface
    is disabled/administratively down, everything explodes (which likely
    netifd tries to do).
    
    Link: https://github.com/openwrt/openwrt/issues/13789
    Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
    Cc: [email protected]
    Reported-by: Peter Münster <[email protected]>
    Suggested-by: Jonas Gorski <[email protected]>
    Signed-off-by: Vaclav Svoboda <[email protected]>
    Tested-by: Peter Münster <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Signed-off-by: Peter Münster <[email protected]>
    Reviewed-by: Michael Chan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: ena: Fix incorrect descriptor free behavior [+ + +]
Author: David Arinzon <[email protected]>
Date:   Wed Apr 10 09:13:57 2024 +0000

    net: ena: Fix incorrect descriptor free behavior
    
    [ Upstream commit bf02d9fe00632d22fa91d34749c7aacf397b6cde ]
    
    ENA has two types of TX queues:
    - queues which only process TX packets arriving from the network stack
    - queues which only process TX packets forwarded to it by XDP_REDIRECT
      or XDP_TX instructions
    
    The ena_free_tx_bufs() cycles through all descriptors in a TX queue
    and unmaps + frees every descriptor that hasn't been acknowledged yet
    by the device (uncompleted TX transactions).
    The function assumes that the processed TX queue is necessarily from
    the first category listed above and ends up using napi_consume_skb()
    for descriptors belonging to an XDP specific queue.
    
    This patch solves a bug in which, in case of a VF reset, the
    descriptors aren't freed correctly, leading to crashes.
    
    Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
    Signed-off-by: Shay Agroskin <[email protected]>
    Signed-off-by: David Arinzon <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ena: Fix potential sign extension issue [+ + +]
Author: David Arinzon <[email protected]>
Date:   Wed Apr 10 09:13:55 2024 +0000

    net: ena: Fix potential sign extension issue
    
    [ Upstream commit 713a85195aad25d8a26786a37b674e3e5ec09e3c ]
    
    Small unsigned types are promoted to larger signed types in
    the case of multiplication, the result of which may overflow.
    In case the result of such a multiplication has its MSB
    turned on, it will be sign extended with '1's.
    This changes the multiplication result.
    
    Code example of the phenomenon:
    -------------------------------
    u16 x, y;
    size_t z1, z2;
    
    x = y = 0xffff;
    printk("x=%x y=%x\n",x,y);
    
    z1 = x*y;
    z2 = (size_t)x*y;
    
    printk("z1=%lx z2=%lx\n", z1, z2);
    
    Output:
    -------
    x=ffff y=ffff
    z1=fffffffffffe0001 z2=fffe0001
    
    The expected result of ffff*ffff is fffe0001, and without the
    explicit casting to avoid the unwanted sign extension we got
    fffffffffffe0001.
    
    This commit adds an explicit casting to avoid the sign extension
    issue.
    
    Fixes: 689b2bdaaa14 ("net: ena: add functions for handling Low Latency Queues in ena_com")
    Signed-off-by: Arthur Kiyanovski <[email protected]>
    Signed-off-by: David Arinzon <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ena: Wrong missing IO completions check order [+ + +]
Author: David Arinzon <[email protected]>
Date:   Wed Apr 10 09:13:56 2024 +0000

    net: ena: Wrong missing IO completions check order
    
    [ Upstream commit f7e417180665234fdb7af2ebe33d89aaa434d16f ]
    
    Missing IO completions check is called every second (HZ jiffies).
    This commit fixes several issues with this check:
    
    1. Duplicate queues check:
       Max of 4 queues are scanned on each check due to monitor budget.
       Once reaching the budget, this check exits under the assumption that
       the next check will continue to scan the remainder of the queues,
       but in practice, next check will first scan the last already scanned
       queue which is not necessary and may cause the full queue scan to
       last a couple of seconds longer.
       The fix is to start every check with the next queue to scan.
       For example, on 8 IO queues:
       Bug: [0,1,2,3], [3,4,5,6], [6,7]
       Fix: [0,1,2,3], [4,5,6,7]
    
    2. Unbalanced queues check:
       In case the number of active IO queues is not a multiple of budget,
       there will be checks which don't utilize the full budget
       because the full scan exits when reaching the last queue id.
       The fix is to run every TX completion check with exact queue budget
       regardless of the queue id.
       For example, on 7 IO queues:
       Bug: [0,1,2,3], [4,5,6], [0,1,2,3]
       Fix: [0,1,2,3], [4,5,6,0], [1,2,3,4]
       The budget may be lowered in case the number of IO queues is less
       than the budget (4) to make sure there are no duplicate queues on
       the same check.
       For example, on 3 IO queues:
       Bug: [0,1,2,0], [1,2,0,1]
       Fix: [0,1,2], [0,1,2]
    
    Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
    Signed-off-by: Amit Bernstein <[email protected]>
    Signed-off-by: David Arinzon <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets [+ + +]
Author: Jason Reeder <[email protected]>
Date:   Wed Apr 24 12:46:26 2024 +0530

    net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets
    
    [ Upstream commit 1b9e743e923b256e353a9a644195372285e5a6c0 ]
    
    The CPTS, by design, captures the messageType (Sync, Delay_Req, etc.)
    field from the second nibble of the PTP header which is defined in the
    PTPv2 (1588-2008) specification. In the PTPv1 (1588-2002) specification
    the first two bytes of the PTP header are defined as the versionType
    which is always 0x0001. This means that any PTPv1 packets that are
    tagged for TX timestamping by the CPTS will have their messageType set
    to 0x0 which corresponds to a Sync message type. This causes issues
    when a PTPv1 stack is expecting a Delay_Req (messageType: 0x1)
    timestamp that never appears.
    
    Fix this by checking if the ptp_class of the timestamped TX packet is
    PTP_CLASS_V1 and then matching the PTP sequence ID to the stored
    sequence ID in the skb->cb data structure. If the sequence IDs match
    and the packet is of type PTPv1 then there is a chance that the
    messageType has been incorrectly stored by the CPTS so overwrite the
    messageType stored by the CPTS with the messageType from the skb->cb
    data structure. This allows the PTPv1 stack to receive TX timestamps
    for Delay_Req packets which are necessary to lock onto a PTP Leader.
    
    Signed-off-by: Jason Reeder <[email protected]>
    Signed-off-by: Ravi Gunasekaran <[email protected]>
    Tested-by: Ed Trexel <[email protected]>
    Fixes: f6bd59526ca5 ("net: ethernet: ti: introduce am654 common platform time sync driver")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: gtp: Fix Use-After-Free in gtp_dellink [+ + +]
Author: Hyunwoo Kim <[email protected]>
Date:   Mon Apr 22 05:39:30 2024 -0400

    net: gtp: Fix Use-After-Free in gtp_dellink
    
    [ Upstream commit f2a904107ee2b647bb7794a1a82b67740d7c8a64 ]
    
    Since call_rcu, which is called in the hlist_for_each_entry_rcu traversal
    of gtp_dellink, is not part of the RCU read critical section, it
    is possible that the RCU grace period will pass during the traversal and
    the key will be free.
    
    To prevent this, it should be changed to hlist_for_each_entry_safe.
    
    Fixes: 94dc550a5062 ("gtp: fix an use-after-free in ipv4_pdp_find()")
    Signed-off-by: Hyunwoo Kim <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: openvswitch: fix unwanted error log on timeout policy probing [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Wed Apr 3 22:38:01 2024 +0200

    net: openvswitch: fix unwanted error log on timeout policy probing
    
    [ Upstream commit 4539f91f2a801c0c028c252bffae56030cfb2cae ]
    
    On startup, ovs-vswitchd probes different datapath features including
    support for timeout policies.  While probing, it tries to execute
    certain operations with OVS_PACKET_ATTR_PROBE or OVS_FLOW_ATTR_PROBE
    attributes set.  These attributes tell the openvswitch module to not
    log any errors when they occur as it is expected that some of the
    probes will fail.
    
    For some reason, setting the timeout policy ignores the PROBE attribute
    and logs a failure anyway.  This is causing the following kernel log
    on each re-start of ovs-vswitchd:
    
      kernel: Failed to associated timeout policy `ovs_test_tp'
    
    Fix that by using the same logging macro that all other messages are
    using.  The message will still be printed at info level when needed
    and will be rate limited, but with a net rate limiter instead of
    generic printk one.
    
    The nf_ct_set_timeout() itself will still print some info messages,
    but at least this change makes logging in openvswitch module more
    consistent.
    
    Fixes: 06bd2bdf19d2 ("openvswitch: Add timeout support to ct action")
    Signed-off-by: Ilya Maximets <[email protected]>
    Acked-by: Eelco Chaudron <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: openvswitch: Fix Use-After-Free in ovs_ct_exit [+ + +]
Author: Hyunwoo Kim <[email protected]>
Date:   Mon Apr 22 05:37:17 2024 -0400

    net: openvswitch: Fix Use-After-Free in ovs_ct_exit
    
    [ Upstream commit 5ea7b72d4fac2fdbc0425cd8f2ea33abe95235b2 ]
    
    Since kfree_rcu, which is called in the hlist_for_each_entry_rcu traversal
    of ovs_ct_limit_exit, is not part of the RCU read critical section, it
    is possible that the RCU grace period will pass during the traversal and
    the key will be free.
    
    To prevent this, it should be changed to hlist_for_each_entry_safe.
    
    Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
    Signed-off-by: Hyunwoo Kim <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Aaron Conole <[email protected]>
    Link: https://lore.kernel.org/r/ZiYvzQN/Ry5oeFQW@v4bel-B760M-AORUS-ELITE-AX
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: ax88179_178a: stop lying about skb->truesize [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Sun Apr 21 19:38:28 2024 +0000

    net: usb: ax88179_178a: stop lying about skb->truesize
    
    [ Upstream commit 4ce62d5b2f7aecd4900e7d6115588ad7f9acccca ]
    
    Some usb drivers try to set small skb->truesize and break
    core networking stacks.
    
    In this patch, I removed one of the skb->truesize overide.
    
    I also replaced one skb_clone() by an allocation of a fresh
    and small skb, to get minimally sized skbs, like we did
    in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize
    in rx path")
    
    Fixes: f8ebb3ac881b ("net: usb: ax88179_178a: Fix packet receiving")
    Reported-by: shironeko <[email protected]>
    Closes: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Jose Alonso <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfilter: complete validation of user input [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue Apr 9 12:07:41 2024 +0000

    netfilter: complete validation of user input
    
    [ Upstream commit 65acf6e0501ac8880a4f73980d01b5d27648b956 ]
    
    In my recent commit, I missed that do_replace() handlers
    use copy_from_sockptr() (which I fixed), followed
    by unsafe copy_from_sockptr_offset() calls.
    
    In all functions, we can perform the @optlen validation
    before even calling xt_alloc_table_info() with the following
    check:
    
    if ((u64)optlen < (u64)tmp.size + sizeof(tmp))
            return -EINVAL;
    
    Fixes: 0c83842df40f ("netfilter: validate user input for expected length")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Pablo Neira Ayuso <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get() [+ + +]
Author: Ziyang Xuan <[email protected]>
Date:   Sun Apr 7 14:56:04 2024 +0800

    netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()
    
    [ Upstream commit f969eb84ce482331a991079ab7a5c4dc3b7f89bf ]
    
    nft_unregister_expr() can concurrent with __nft_expr_type_get(),
    and there is not any protection when iterate over nf_tables_expressions
    list in __nft_expr_type_get(). Therefore, there is potential data-race
    of nf_tables_expressions list entry.
    
    Use list_for_each_entry_rcu() to iterate over nf_tables_expressions
    list in __nft_expr_type_get(), and use rcu_read_lock() in the caller
    nft_expr_type_get() to protect the entire type query process.
    
    Fixes: ef1f7df9170d ("netfilter: nf_tables: expression ops overloading")
    Signed-off-by: Ziyang Xuan <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nf_tables: honor table dormant flag from netdev release event path [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Wed Apr 24 20:45:01 2024 +0200

    netfilter: nf_tables: honor table dormant flag from netdev release event path
    
    [ Upstream commit 8e30abc9ace4f0add4cd761dfdbfaebae5632dd2 ]
    
    Check for table dormant flag otherwise netdev release event path tries
    to unregister an already unregistered hook.
    
    [524854.857999] ------------[ cut here ]------------
    [524854.858010] WARNING: CPU: 0 PID: 3386599 at net/netfilter/core.c:501 __nf_unregister_net_hook+0x21a/0x260
    [...]
    [524854.858848] CPU: 0 PID: 3386599 Comm: kworker/u32:2 Not tainted 6.9.0-rc3+ #365
    [524854.858869] Workqueue: netns cleanup_net
    [524854.858886] RIP: 0010:__nf_unregister_net_hook+0x21a/0x260
    [524854.858903] Code: 24 e8 aa 73 83 ff 48 63 43 1c 83 f8 01 0f 85 3d ff ff ff e8 98 d1 f0 ff 48 8b 3c 24 e8 8f 73 83 ff 48 63 43 1c e9 26 ff ff ff <0f> 0b 48 83 c4 18 48 c7 c7 00 68 e9 82 5b 5d 41 5c 41 5d 41 5e 41
    [524854.858914] RSP: 0018:ffff8881e36d79e0 EFLAGS: 00010246
    [524854.858926] RAX: 0000000000000000 RBX: ffff8881339ae790 RCX: ffffffff81ba524a
    [524854.858936] RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff8881c8a16438
    [524854.858945] RBP: ffff8881c8a16438 R08: 0000000000000001 R09: ffffed103c6daf34
    [524854.858954] R10: ffff8881e36d79a7 R11: 0000000000000000 R12: 0000000000000005
    [524854.858962] R13: ffff8881c8a16000 R14: 0000000000000000 R15: ffff8881351b5a00
    [524854.858971] FS:  0000000000000000(0000) GS:ffff888390800000(0000) knlGS:0000000000000000
    [524854.858982] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [524854.858991] CR2: 00007fc9be0f16f4 CR3: 00000001437cc004 CR4: 00000000001706f0
    [524854.859000] Call Trace:
    [524854.859006]  <TASK>
    [524854.859013]  ? __warn+0x9f/0x1a0
    [524854.859027]  ? __nf_unregister_net_hook+0x21a/0x260
    [524854.859044]  ? report_bug+0x1b1/0x1e0
    [524854.859060]  ? handle_bug+0x3c/0x70
    [524854.859071]  ? exc_invalid_op+0x17/0x40
    [524854.859083]  ? asm_exc_invalid_op+0x1a/0x20
    [524854.859100]  ? __nf_unregister_net_hook+0x6a/0x260
    [524854.859116]  ? __nf_unregister_net_hook+0x21a/0x260
    [524854.859135]  nf_tables_netdev_event+0x337/0x390 [nf_tables]
    [524854.859304]  ? __pfx_nf_tables_netdev_event+0x10/0x10 [nf_tables]
    [524854.859461]  ? packet_notifier+0xb3/0x360
    [524854.859476]  ? _raw_spin_unlock_irqrestore+0x11/0x40
    [524854.859489]  ? dcbnl_netdevice_event+0x35/0x140
    [524854.859507]  ? __pfx_nf_tables_netdev_event+0x10/0x10 [nf_tables]
    [524854.859661]  notifier_call_chain+0x7d/0x140
    [524854.859677]  unregister_netdevice_many_notify+0x5e1/0xae0
    
    Fixes: d54725cd11a5 ("netfilter: nf_tables: support for multiple devices per netdev hook")
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nft_set_pipapo: do not free live element [+ + +]
Author: Florian Westphal <[email protected]>
Date:   Wed Apr 10 21:05:13 2024 +0200

    netfilter: nft_set_pipapo: do not free live element
    
    [ Upstream commit 3cfc9ec039af60dbd8965ae085b2c2ccdcfbe1cc ]
    
    Pablo reports a crash with large batches of elements with a
    back-to-back add/remove pattern.  Quoting Pablo:
    
      add_elem("00000000") timeout 100 ms
      ...
      add_elem("0000000X") timeout 100 ms
      del_elem("0000000X") <---------------- delete one that was just added
      ...
      add_elem("00005000") timeout 100 ms
    
      1) nft_pipapo_remove() removes element 0000000X
      Then, KASAN shows a splat.
    
    Looking at the remove function there is a chance that we will drop a
    rule that maps to a non-deactivated element.
    
    Removal happens in two steps, first we do a lookup for key k and return the
    to-be-removed element and mark it as inactive in the next generation.
    Then, in a second step, the element gets removed from the set/map.
    
    The _remove function does not work correctly if we have more than one
    element that share the same key.
    
    This can happen if we insert an element into a set when the set already
    holds an element with same key, but the element mapping to the existing
    key has timed out or is not active in the next generation.
    
    In such case its possible that removal will unmap the wrong element.
    If this happens, we will leak the non-deactivated element, it becomes
    unreachable.
    
    The element that got deactivated (and will be freed later) will
    remain reachable in the set data structure, this can result in
    a crash when such an element is retrieved during lookup (stale
    pointer).
    
    Add a check that the fully matching key does in fact map to the element
    that we have marked as inactive in the deactivation step.
    If not, we need to continue searching.
    
    Add a bug/warn trap at the end of the function as well, the remove
    function must not ever be called with an invisible/unreachable/non-existent
    element.
    
    v2: avoid uneeded temporary variable (Stefano)
    
    Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")
    Reported-by: Pablo Neira Ayuso <[email protected]>
    Reviewed-by: Stefano Brivio <[email protected]>
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
NFC: trf7970a: disable all regulators on removal [+ + +]
Author: Paul Geurts <[email protected]>
Date:   Thu Apr 18 21:25:38 2024 +0200

    NFC: trf7970a: disable all regulators on removal
    
    [ Upstream commit 6bea4f03c6a4e973ef369e15aac88f37981db49e ]
    
    During module probe, regulator 'vin' and 'vdd-io' are used and enabled,
    but the vdd-io regulator overwrites the 'vin' regulator pointer. During
    remove, only the vdd-io is disabled, as the vin regulator pointer is not
    available anymore. When regulator_put() is called during resource
    cleanup a kernel warning is given, as the regulator is still enabled.
    
    Store the two regulators in separate pointers and disable both the
    regulators on module remove.
    
    Fixes: 49d22c70aaf0 ("NFC: trf7970a: Add device tree option of 1.8 Volt IO voltage")
    Signed-off-by: Paul Geurts <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/DB7PR09MB26847A4EBF88D9EDFEB1DA0F950E2@DB7PR09MB2684.eurprd09.prod.outlook.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nilfs2: fix OOB in nilfs_set_de_type [+ + +]
Author: Jeongjun Park <[email protected]>
Date:   Tue Apr 16 03:20:48 2024 +0900

    nilfs2: fix OOB in nilfs_set_de_type
    
    commit c4a7dc9523b59b3e73fd522c73e95e072f876b16 upstream.
    
    The size of the nilfs_type_by_mode array in the fs/nilfs2/dir.c file is
    defined as "S_IFMT >> S_SHIFT", but the nilfs_set_de_type() function,
    which uses this array, specifies the index to read from the array in the
    same way as "(mode & S_IFMT) >> S_SHIFT".
    
    static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode
     *inode)
    {
            umode_t mode = inode->i_mode;
    
            de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; // oob
    }
    
    However, when the index is determined this way, an out-of-bounds (OOB)
    error occurs by referring to an index that is 1 larger than the array size
    when the condition "mode & S_IFMT == S_IFMT" is satisfied.  Therefore, a
    patch to resize the nilfs_type_by_mode array should be applied to prevent
    OOB errors.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=2e22057de05b9f3b30d8
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Jeongjun Park <[email protected]>
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Tested-by: Ryusuke Konishi <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nouveau: fix function cast warning [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Thu Apr 4 18:02:25 2024 +0200

    nouveau: fix function cast warning
    
    [ Upstream commit 185fdb4697cc9684a02f2fab0530ecdd0c2f15d4 ]
    
    Calling a function through an incompatible pointer type causes breaks
    kcfi, so clang warns about the assignment:
    
    drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c:73:10: error: cast from 'void (*)(const void *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
       73 |         .fini = (void(*)(void *))kfree,
    
    Avoid this with a trivial wrapper.
    
    Fixes: c39f472e9f14 ("drm/nouveau: remove symlinks, move core/ to nvkm/ (no code changes)")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Danilo Krummrich <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

nouveau: fix instmem race condition around ptr stores [+ + +]
Author: Dave Airlie <[email protected]>
Date:   Thu Apr 11 11:15:09 2024 +1000

    nouveau: fix instmem race condition around ptr stores
    
    commit fff1386cc889d8fb4089d285f883f8cba62d82ce upstream.
    
    Running a lot of VK CTS in parallel against nouveau, once every
    few hours you might see something like this crash.
    
    BUG: kernel NULL pointer dereference, address: 0000000000000008
    PGD 8000000114e6e067 P4D 8000000114e6e067 PUD 109046067 PMD 0
    Oops: 0000 [#1] PREEMPT SMP PTI
    CPU: 7 PID: 53891 Comm: deqp-vk Not tainted 6.8.0-rc6+ #27
    Hardware name: Gigabyte Technology Co., Ltd. Z390 I AORUS PRO WIFI/Z390 I AORUS PRO WIFI-CF, BIOS F8 11/05/2021
    RIP: 0010:gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
    Code: c7 48 01 c8 49 89 45 58 85 d2 0f 84 95 00 00 00 41 0f b7 46 12 49 8b 7e 08 89 da 42 8d 2c f8 48 8b 47 08 41 83 c7 01 48 89 ee <48> 8b 40 08 ff d0 0f 1f 00 49 8b 7e 08 48 89 d9 48 8d 75 04 48 c1
    RSP: 0000:ffffac20c5857838 EFLAGS: 00010202
    RAX: 0000000000000000 RBX: 00000000004d8001 RCX: 0000000000000001
    RDX: 00000000004d8001 RSI: 00000000000006d8 RDI: ffffa07afe332180
    RBP: 00000000000006d8 R08: ffffac20c5857ad0 R09: 0000000000ffff10
    R10: 0000000000000001 R11: ffffa07af27e2de0 R12: 000000000000001c
    R13: ffffac20c5857ad0 R14: ffffa07a96fe9040 R15: 000000000000001c
    FS:  00007fe395eed7c0(0000) GS:ffffa07e2c980000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000008 CR3: 000000011febe001 CR4: 00000000003706f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    
    ...
    
     ? gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
     ? gp100_vmm_pgt_mem+0x37/0x180 [nouveau]
     nvkm_vmm_iter+0x351/0xa20 [nouveau]
     ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     ? __lock_acquire+0x3ed/0x2170
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     nvkm_vmm_ptes_get_map+0xc2/0x100 [nouveau]
     ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     nvkm_vmm_map_locked+0x224/0x3a0 [nouveau]
    
    Adding any sort of useful debug usually makes it go away, so I hand
    wrote the function in a line, and debugged the asm.
    
    Every so often pt->memory->ptrs is NULL. This ptrs ptr is set in
    the nv50_instobj_acquire called from nvkm_kmap.
    
    If Thread A and Thread B both get to nv50_instobj_acquire around
    the same time, and Thread A hits the refcount_set line, and in
    lockstep thread B succeeds at refcount_inc_not_zero, there is a
    chance the ptrs value won't have been stored since refcount_set
    is unordered. Force a memory barrier here, I picked smp_mb, since
    we want it on all CPUs and it's write followed by a read.
    
    v2: use paired smp_rmb/smp_wmb.
    
    Cc: <[email protected]>
    Fixes: be55287aa5ba ("drm/nouveau/imem/nv50: embed nvkm_instobj directly into nv04_instobj")
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Danilo Krummrich <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
octeontx2-af: Fix NIX SQ mode and BP config [+ + +]
Author: Geetha sowjanya <[email protected]>
Date:   Mon Apr 8 12:06:43 2024 +0530

    octeontx2-af: Fix NIX SQ mode and BP config
    
    [ Upstream commit faf23006185e777db18912685922c5ddb2df383f ]
    
    NIX SQ mode and link backpressure configuration is required for
    all platforms. But in current driver this code is wrongly placed
    under specific platform check. This patch fixes the issue by
    moving the code out of platform check.
    
    Fixes: 5d9b976d4480 ("octeontx2-af: Support fixed transmit scheduler topology")
    Signed-off-by: Geetha sowjanya <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
PM / devfreq: Fix buffer overflow in trans_stat_show [+ + +]
Author: Christian Marangi <[email protected]>
Date:   Tue Oct 24 20:30:15 2023 +0200

    PM / devfreq: Fix buffer overflow in trans_stat_show
    
    commit 08e23d05fa6dc4fc13da0ccf09defdd4bbc92ff4 upstream.
    
    Fix buffer overflow in trans_stat_show().
    
    Convert simple snprintf to the more secure scnprintf with size of
    PAGE_SIZE.
    
    Add condition checking if we are exceeding PAGE_SIZE and exit early from
    loop. Also add at the end a warning that we exceeded PAGE_SIZE and that
    stats is disabled.
    
    Return -EFBIG in the case where we don't have enough space to write the
    full transition table.
    
    Also document in the ABI that this function can return -EFBIG error.
    
    Link: https://lore.kernel.org/all/[email protected]/
    Cc: [email protected]
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218041
    Fixes: e552bbaf5b98 ("PM / devfreq: Add sysfs node for representing frequency transition information.")
    Signed-off-by: Christian Marangi <[email protected]>
    Signed-off-by: Chanwoo Choi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Jan Kiszka <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
RDMA/cm: Print the old state when cm_destroy_id gets timeout [+ + +]
Author: Mark Zhang <[email protected]>
Date:   Fri Mar 22 13:20:49 2024 +0200

    RDMA/cm: Print the old state when cm_destroy_id gets timeout
    
    [ Upstream commit b68e1acb5834ed1a2ad42d9d002815a8bae7c0b6 ]
    
    The old state is helpful for debugging, as the current state is always
    IB_CM_IDLE when timeout happens.
    
    Fixes: 96d9cbe2f2ff ("RDMA/cm: add timeout to cm_destroy_id wait")
    Signed-off-by: Mark Zhang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/mlx5: Fix port number for counter query in multi-port configuration [+ + +]
Author: Michael Guralnik <[email protected]>
Date:   Wed Apr 3 12:03:46 2024 +0300

    RDMA/mlx5: Fix port number for counter query in multi-port configuration
    
    [ Upstream commit be121ffb384f53e966ee7299ffccc6eeb61bc73d ]
    
    Set the correct port when querying PPCNT in multi-port configuration.
    Distinguish between cases where switchdev mode was enabled to multi-port
    configuration and don't overwrite the queried port to 1 in multi-port
    case.
    
    Fixes: 74b30b3ad5ce ("RDMA/mlx5: Set local port to one when accessing counters")
    Signed-off-by: Michael Guralnik <[email protected]>
    Link: https://lore.kernel.org/r/9bfcc8ade958b760a51408c3ad654a01b11f7d76.1712134988.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/rxe: Fix the problem "mutex_destroy missing" [+ + +]
Author: Yanjun.Zhu <[email protected]>
Date:   Thu Mar 14 07:51:40 2024 +0100

    RDMA/rxe: Fix the problem "mutex_destroy missing"
    
    [ Upstream commit 481047d7e8391d3842ae59025806531cdad710d9 ]
    
    When a mutex lock is not used any more, the function mutex_destroy
    should be called to mark the mutex lock uninitialized.
    
    Fixes: 8700e3e7c485 ("Soft RoCE driver")
    Signed-off-by: Yanjun.Zhu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Daisuke Matsuda <[email protected]>
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "crypto: api - Disallow identical driver names" [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Apr 29 12:53:46 2024 +0200

    Revert "crypto: api - Disallow identical driver names"
    
    This reverts commit 462c383e732fa99c60aff711c43ec9d6eb27921e which is
    commit 27016f75f5ed47e2d8e0ca75a8ff1f40bc1a5e27 upstream.
    
    It is reported to cause problems in older kernels due to some crypto
    drivers having the same name, so revert it here to fix the problems.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reported-by: Guenter Roeck <[email protected]>
    Cc: Ovidiu Panait <[email protected]>
    Cc: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "tracing/trigger: Fix to return error if failed to alloc snapshot" [+ + +]
Author: Siddh Raman Pant <[email protected]>
Date:   Thu Apr 18 18:58:06 2024 +0530

    Revert "tracing/trigger: Fix to return error if failed to alloc snapshot"
    
    This reverts commit 56cfbe60710772916a5ba092c99542332b48e870 which is
    commit 0958b33ef5a04ed91f61cef4760ac412080c4e08 upstream.
    
    The change has an incorrect assumption about the return value because
    in the current stable trees for versions 5.15 and before, the following
    commit responsible for making 0 a success value is not present:
    b8cc44a4d3c1 ("tracing: Remove logic for registering multiple event triggers at a time")
    
    The return value should be 0 on failure in the current tree, because in
    the functions event_trigger_callback() and event_enable_trigger_func(),
    we have:
    
            ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
            /*
             * The above returns on success the # of functions enabled,
             * but if it didn't find any functions it returns zero.
             * Consider no functions a failure too.
             */
            if (!ret) {
                    ret = -ENOENT;
    
    Cc: [email protected] # 5.15, 5.10, 5.4, 4.19
    Signed-off-by: Siddh Raman Pant <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "usb: cdc-wdm: close race between read and workqueue" [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Apr 18 16:33:28 2024 +0200

    Revert "usb: cdc-wdm: close race between read and workqueue"
    
    commit 1607830dadeefc407e4956336d9fcd9e9defd810 upstream.
    
    This reverts commit 339f83612f3a569b194680768b22bf113c26a29d.
    
    It has been found to cause problems in a number of Chromebook devices,
    so revert the change until it can be brought back in a safe way.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reported-by:: Aleksander Morgado <[email protected]>
    Fixes: 339f83612f3a ("usb: cdc-wdm: close race between read and workqueue")
    Cc: stable <[email protected]>
    Cc: Oliver Neukum <[email protected]>
    Cc: Bjørn Mork <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
riscv: Disable STACKPROTECTOR_PER_TASK if GCC_PLUGIN_RANDSTRUCT is enabled [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Tue Jul 6 09:26:21 2021 -0700

    riscv: Disable STACKPROTECTOR_PER_TASK if GCC_PLUGIN_RANDSTRUCT is enabled
    
    commit a18b14d8886614b3c7d290c4cfc33389822b0535 upstream.
    
    riscv uses the value of TSK_STACK_CANARY to set
    stack-protector-guard-offset. With GCC_PLUGIN_RANDSTRUCT enabled, that
    value is non-deterministic, and with riscv:allmodconfig often results
    in build errors such as
    
    cc1: error: '8120' is not a valid offset in '-mstack-protector-guard-offset='
    
    Enable STACKPROTECTOR_PER_TASK only if GCC_PLUGIN_RANDSTRUCT is disabled
    to fix the problem.
    
    Fixes: fea2fed201ee5 ("riscv: Enable per-task stack canaries")
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

riscv: Enable per-task stack canaries [+ + +]
Author: Guo Ren <[email protected]>
Date:   Thu Dec 17 16:29:18 2020 +0000

    riscv: Enable per-task stack canaries
    
    [ Upstream commit fea2fed201ee5647699018a56fbb6a5e8cc053a5 ]
    
    This enables the use of per-task stack canary values if GCC has
    support for emitting the stack canary reference relative to the
    value of tp, which holds the task struct pointer in the riscv
    kernel.
    
    After compare arm64 and x86 implementations, seems arm64's is more
    flexible and readable. The key point is how gcc get the offset of
    stack_canary from gs/el0_sp.
    
    x86: Use a fix offset from gs, not flexible.
    
    struct fixed_percpu_data {
            /*
             * GCC hardcodes the stack canary as %gs:40.  Since the
             * irq_stack is the object at %gs:0, we reserve the bottom
             * 48 bytes of the irq stack for the canary.
             */
            char            gs_base[40]; // :(
            unsigned long   stack_canary;
    };
    
    arm64: Use -mstack-protector-guard-offset & guard-reg
            gcc options:
            -mstack-protector-guard=sysreg
            -mstack-protector-guard-reg=sp_el0
            -mstack-protector-guard-offset=xxx
    
    riscv: Use -mstack-protector-guard-offset & guard-reg
            gcc options:
            -mstack-protector-guard=tls
            -mstack-protector-guard-reg=tp
            -mstack-protector-guard-offset=xxx
    
     GCC's implementation has been merged:
     commit c931e8d5a96463427040b0d11f9c4352ac22b2b0
     Author: Cooper Qu <[email protected]>
     Date:   Mon Jul 13 16:15:08 2020 +0800
    
         RISC-V: Add support for TLS stack protector canary access
    
    In the end, these codes are inserted by gcc before return:
    
    *  0xffffffe00020b396 <+120>:   ld      a5,1008(tp) # 0x3f0
    *  0xffffffe00020b39a <+124>:   xor     a5,a5,a4
    *  0xffffffe00020b39c <+126>:   mv      a0,s5
    *  0xffffffe00020b39e <+128>:   bnez    a5,0xffffffe00020b61c <_do_fork+766>
       0xffffffe00020b3a2 <+132>:   ld      ra,136(sp)
       0xffffffe00020b3a4 <+134>:   ld      s0,128(sp)
       0xffffffe00020b3a6 <+136>:   ld      s1,120(sp)
       0xffffffe00020b3a8 <+138>:   ld      s2,112(sp)
       0xffffffe00020b3aa <+140>:   ld      s3,104(sp)
       0xffffffe00020b3ac <+142>:   ld      s4,96(sp)
       0xffffffe00020b3ae <+144>:   ld      s5,88(sp)
       0xffffffe00020b3b0 <+146>:   ld      s6,80(sp)
       0xffffffe00020b3b2 <+148>:   ld      s7,72(sp)
       0xffffffe00020b3b4 <+150>:   addi    sp,sp,144
       0xffffffe00020b3b6 <+152>:   ret
       ...
    *  0xffffffe00020b61c <+766>:   auipc   ra,0x7f8
    *  0xffffffe00020b620 <+770>:   jalr    -1764(ra) # 0xffffffe000a02f38 <__stack_chk_fail>
    
    Signed-off-by: Guo Ren <[email protected]>
    Signed-off-by: Cooper Qu <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Stable-dep-of: d14fa1fcf69d ("riscv: process: Fix kernel gp leakage")
    Signed-off-by: Sasha Levin <[email protected]>

riscv: Fix TASK_SIZE on 64-bit NOMMU [+ + +]
Author: Samuel Holland <[email protected]>
Date:   Mon Feb 26 16:34:46 2024 -0800

    riscv: Fix TASK_SIZE on 64-bit NOMMU
    
    [ Upstream commit 6065e736f82c817c9a597a31ee67f0ce4628e948 ]
    
    On NOMMU, userspace memory can come from anywhere in physical RAM. The
    current definition of TASK_SIZE is wrong if any RAM exists above 4G,
    causing spurious failures in the userspace access routines.
    
    Fixes: 6bd33e1ece52 ("riscv: add nommu support")
    Fixes: c3f896dcf1e4 ("mm: switch the test_vmalloc module to use __vmalloc_node")
    Signed-off-by: Samuel Holland <[email protected]>
    Reviewed-by: Jisheng Zhang <[email protected]>
    Reviewed-by: Bo Gan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

riscv: fix VMALLOC_START definition [+ + +]
Author: Baoquan He <[email protected]>
Date:   Tue Dec 5 11:02:55 2023 +0800

    riscv: fix VMALLOC_START definition
    
    [ Upstream commit ac88ff6b9d7dea9f0907c86bdae204dde7d5c0e6 ]
    
    When below config items are set, compiler complained:
    
    --------------------
    CONFIG_CRASH_CORE=y
    CONFIG_KEXEC_CORE=y
    CONFIG_CRASH_DUMP=y
    ......
    -----------------------
    
    -------------------------------------------------------------------
    arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
    arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
    11 |         vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
       |                                                        ~~^
       |                                                          |
       |                                                          long unsigned int
       |                                                        %x
    ----------------------------------------------------------------------
    
    This is because on riscv macro VMALLOC_START has different type when
    CONFIG_MMU is set or unset.
    
    arch/riscv/include/asm/pgtable.h:
    --------------------------------------------------
    
    Changing it to _AC(0, UL) in case CONFIG_MMU=n can fix the warning.
    
    Link: https://lkml.kernel.org/r/ZW7OsX4zQRA3mO4+@MiWiFi-R3L-srv
    Signed-off-by: Baoquan He <[email protected]>
    Reported-by: Randy Dunlap <[email protected]>
    Acked-by: Randy Dunlap <[email protected]>
    Tested-by: Randy Dunlap <[email protected]> # build-tested
    Cc: Eric DeVolder <[email protected]>
    Cc: Ignat Korchagin <[email protected]>
    Cc: Stephen Rothwell <[email protected]>
    Cc: Paul Walmsley <[email protected]>
    Cc: Palmer Dabbelt <[email protected]>
    Cc: Albert Ou <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Stable-dep-of: 6065e736f82c ("riscv: Fix TASK_SIZE on 64-bit NOMMU")
    Signed-off-by: Sasha Levin <[email protected]>

riscv: process: Fix kernel gp leakage [+ + +]
Author: Stefan O'Rear <[email protected]>
Date:   Wed Mar 27 02:12:58 2024 -0400

    riscv: process: Fix kernel gp leakage
    
    [ Upstream commit d14fa1fcf69db9d070e75f1c4425211fa619dfc8 ]
    
    childregs represents the registers which are active for the new thread
    in user context. For a kernel thread, childregs->gp is never used since
    the kernel gp is not touched by switch_to. For a user mode helper, the
    gp value can be observed in user space after execve or possibly by other
    means.
    
    [From the email thread]
    
    The /* Kernel thread */ comment is somewhat inaccurate in that it is also used
    for user_mode_helper threads, which exec a user process, e.g. /sbin/init or
    when /proc/sys/kernel/core_pattern is a pipe. Such threads do not have
    PF_KTHREAD set and are valid targets for ptrace etc. even before they exec.
    
    childregs is the *user* context during syscall execution and it is observable
    from userspace in at least five ways:
    
    1. kernel_execve does not currently clear integer registers, so the starting
       register state for PID 1 and other user processes started by the kernel has
       sp = user stack, gp = kernel __global_pointer$, all other integer registers
       zeroed by the memset in the patch comment.
    
       This is a bug in its own right, but I'm unwilling to bet that it is the only
       way to exploit the issue addressed by this patch.
    
    2. ptrace(PTRACE_GETREGSET): you can PTRACE_ATTACH to a user_mode_helper thread
       before it execs, but ptrace requires SIGSTOP to be delivered which can only
       happen at user/kernel boundaries.
    
    3. /proc/*/task/*/syscall: this is perfectly happy to read pt_regs for
       user_mode_helpers before the exec completes, but gp is not one of the
       registers it returns.
    
    4. PERF_SAMPLE_REGS_USER: LOCKDOWN_PERF normally prevents access to kernel
       addresses via PERF_SAMPLE_REGS_INTR, but due to this bug kernel addresses
       are also exposed via PERF_SAMPLE_REGS_USER which is permitted under
       LOCKDOWN_PERF. I have not attempted to write exploit code.
    
    5. Much of the tracing infrastructure allows access to user registers. I have
       not attempted to determine which forms of tracing allow access to user
       registers without already allowing access to kernel registers.
    
    Fixes: 7db91e57a0ac ("RISC-V: Task implementation")
    Cc: [email protected]
    Signed-off-by: Stefan O'Rear <[email protected]>
    Reviewed-by: Alexandre Ghiti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/ftrace: Limit length in subsystem-enable tests [+ + +]
Author: Yuanhe Shu <[email protected]>
Date:   Mon Feb 26 11:18:16 2024 +0800

    selftests/ftrace: Limit length in subsystem-enable tests
    
    commit 1a4ea83a6e67f1415a1f17c1af5e9c814c882bb5 upstream.
    
    While sched* events being traced and sched* events continuously happen,
    "[xx] event tracing - enable/disable with subsystem level files" would
    not stop as on some slower systems it seems to take forever.
    Select the first 100 lines of output would be enough to judge whether
    there are more than 3 types of sched events.
    
    Fixes: 815b18ea66d6 ("ftracetest: Add basic event tracing test cases")
    Cc: [email protected]
    Signed-off-by: Yuanhe Shu <[email protected]>
    Acked-by: Masami Hiramatsu (Google) <[email protected]>
    Acked-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests: timers: Fix abs() warning in posix_timers test [+ + +]
Author: John Stultz <[email protected]>
Date:   Wed Apr 10 16:26:30 2024 -0700

    selftests: timers: Fix abs() warning in posix_timers test
    
    commit ed366de8ec89d4f960d66c85fc37d9de22f7bf6d upstream.
    
    Building with clang results in the following warning:
    
      posix_timers.c:69:6: warning: absolute value function 'abs' given an
          argument of type 'long long' but has parameter of type 'int' which may
          cause truncation of value [-Wabsolute-value]
            if (abs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) {
                ^
    So switch to using llabs() instead.
    
    Fixes: 0bc4b0cf1570 ("selftests: add basic posix timers selftests")
    Signed-off-by: John Stultz <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
serial/pmac_zilog: Remove flawed mitigation for rx irq flood [+ + +]
Author: Finn Thain <[email protected]>
Date:   Mon Apr 8 19:23:43 2024 +1000

    serial/pmac_zilog: Remove flawed mitigation for rx irq flood
    
    commit 1be3226445362bfbf461c92a5bcdb1723f2e4907 upstream.
    
    The mitigation was intended to stop the irq completely. That may be
    better than a hard lock-up but it turns out that you get a crash anyway
    if you're using pmac_zilog as a serial console:
    
    ttyPZ0: pmz: rx irq flood !
    BUG: spinlock recursion on CPU#0, swapper/0
    
    That's because the pr_err() call in pmz_receive_chars() results in
    pmz_console_write() attempting to lock a spinlock already locked in
    pmz_interrupt(). With CONFIG_DEBUG_SPINLOCK=y, this produces a fatal
    BUG splat. The spinlock in question is the one in struct uart_port.
    
    Even when it's not fatal, the serial port rx function ceases to work.
    Also, the iteration limit doesn't play nicely with QEMU, as can be
    seen in the bug report linked below.
    
    A web search for other reports of the error message "pmz: rx irq flood"
    didn't produce anything. So I don't think this code is needed any more.
    Remove it.
    
    Cc: Benjamin Herrenschmidt <[email protected]>
    Cc: Michael Ellerman <[email protected]>
    Cc: Nicholas Piggin <[email protected]>
    Cc: Christophe Leroy <[email protected]>
    Cc: Aneesh Kumar K.V <[email protected]>
    Cc: Naveen N. Rao <[email protected]>
    Cc: Andy Shevchenko <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Link: https://github.com/vivier/qemu-m68k/issues/44
    Link: https://lore.kernel.org/all/1078874617.9746.36.camel@gaston/
    Acked-by: Michael Ellerman <[email protected]>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable <[email protected]>
    Signed-off-by: Finn Thain <[email protected]>
    Link: https://lore.kernel.org/r/e853cf2c762f23101cd2ddec0cc0c2be0e72685f.1712568223.git.fthain@linux-m68k.org
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
serial: core: fix kernel-doc for uart_port_unlock_irqrestore() [+ + +]
Author: Randy Dunlap <[email protected]>
Date:   Tue Sep 26 21:41:28 2023 -0700

    serial: core: fix kernel-doc for uart_port_unlock_irqrestore()
    
    commit 29bff582b74ed0bdb7e6986482ad9e6799ea4d2f upstream.
    
    Fix the function name to avoid a kernel-doc warning:
    
    include/linux/serial_core.h:666: warning: expecting prototype for uart_port_lock_irqrestore(). Prototype was for uart_port_unlock_irqrestore() instead
    
    Fixes: b0af4bcb4946 ("serial: core: Provide port lock wrappers")
    Signed-off-by: Randy Dunlap <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: John Ogness <[email protected]>
    Cc: [email protected]
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Jiri Slaby <[email protected]>
    Reviewed-by: John Ogness <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: core: Provide port lock wrappers [+ + +]
Author: Thomas Gleixner <[email protected]>
Date:   Thu Sep 14 20:43:18 2023 +0206

    serial: core: Provide port lock wrappers
    
    [ Upstream commit b0af4bcb49464c221ad5f95d40f2b1b252ceedcc ]
    
    When a serial port is used for kernel console output, then all
    modifications to the UART registers which are done from other contexts,
    e.g. getty, termios, are interference points for the kernel console.
    
    So far this has been ignored and the printk output is based on the
    principle of hope. The rework of the console infrastructure which aims to
    support threaded and atomic consoles, requires to mark sections which
    modify the UART registers as unsafe. This allows the atomic write function
    to make informed decisions and eventually to restore operational state. It
    also allows to prevent the regular UART code from modifying UART registers
    while printk output is in progress.
    
    All modifications of UART registers are guarded by the UART port lock,
    which provides an obvious synchronization point with the console
    infrastructure.
    
    Provide wrapper functions for spin_[un]lock*(port->lock) invocations so
    that the console mechanics can be applied later on at a single place and
    does not require to copy the same logic all over the drivers.
    
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: John Ogness <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 54c4ec5f8c47 ("serial: mxs-auart: add spinlock around changing cts state")
    Signed-off-by: Sasha Levin <[email protected]>

serial: mxs-auart: add spinlock around changing cts state [+ + +]
Author: Emil Kronborg <[email protected]>
Date:   Wed Mar 20 12:15:36 2024 +0000

    serial: mxs-auart: add spinlock around changing cts state
    
    [ Upstream commit 54c4ec5f8c471b7c1137a1f769648549c423c026 ]
    
    The uart_handle_cts_change() function in serial_core expects the caller
    to hold uport->lock. For example, I have seen the below kernel splat,
    when the Bluetooth driver is loaded on an i.MX28 board.
    
        [   85.119255] ------------[ cut here ]------------
        [   85.124413] WARNING: CPU: 0 PID: 27 at /drivers/tty/serial/serial_core.c:3453 uart_handle_cts_change+0xb4/0xec
        [   85.134694] Modules linked in: hci_uart bluetooth ecdh_generic ecc wlcore_sdio configfs
        [   85.143314] CPU: 0 PID: 27 Comm: kworker/u3:0 Not tainted 6.6.3-00021-gd62a2f068f92 #1
        [   85.151396] Hardware name: Freescale MXS (Device Tree)
        [   85.156679] Workqueue: hci0 hci_power_on [bluetooth]
        (...)
        [   85.191765]  uart_handle_cts_change from mxs_auart_irq_handle+0x380/0x3f4
        [   85.198787]  mxs_auart_irq_handle from __handle_irq_event_percpu+0x88/0x210
        (...)
    
    Cc: [email protected]
    Fixes: 4d90bb147ef6 ("serial: core: Document and assert lock requirements for irq helpers")
    Reviewed-by: Frank Li <[email protected]>
    Signed-off-by: Emil Kronborg <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
speakup: Avoid crash on very long word [+ + +]
Author: Samuel Thibault <[email protected]>
Date:   Sat Mar 23 17:48:43 2024 +0100

    speakup: Avoid crash on very long word
    
    commit c8d2f34ea96ea3bce6ba2535f867f0d4ee3b22e1 upstream.
    
    In case a console is set up really large and contains a really long word
    (> 256 characters), we have to stop before the length of the word buffer.
    
    Signed-off-by: Samuel Thibault <[email protected]>
    Fixes: c6e3fd22cd538 ("Staging: add speakup to the staging directory")
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
stackdepot: respect __GFP_NOLOCKDEP allocation flag [+ + +]
Author: Andrey Ryabinin <[email protected]>
Date:   Thu Apr 18 16:11:33 2024 +0200

    stackdepot: respect __GFP_NOLOCKDEP allocation flag
    
    commit 6fe60465e1d53ea321ee909be26d97529e8f746c upstream.
    
    If stack_depot_save_flags() allocates memory it always drops
    __GFP_NOLOCKDEP flag.  So when KASAN tries to track __GFP_NOLOCKDEP
    allocation we may end up with lockdep splat like bellow:
    
    ======================================================
     WARNING: possible circular locking dependency detected
     6.9.0-rc3+ #49 Not tainted
     ------------------------------------------------------
     kswapd0/149 is trying to acquire lock:
     ffff88811346a920
    (&xfs_nondir_ilock_class){++++}-{4:4}, at: xfs_reclaim_inode+0x3ac/0x590
    [xfs]
    
     but task is already holding lock:
     ffffffff8bb33100 (fs_reclaim){+.+.}-{0:0}, at:
    balance_pgdat+0x5d9/0xad0
    
     which lock already depends on the new lock.
    
     the existing dependency chain (in reverse order) is:
     -> #1 (fs_reclaim){+.+.}-{0:0}:
            __lock_acquire+0x7da/0x1030
            lock_acquire+0x15d/0x400
            fs_reclaim_acquire+0xb5/0x100
     prepare_alloc_pages.constprop.0+0xc5/0x230
            __alloc_pages+0x12a/0x3f0
            alloc_pages_mpol+0x175/0x340
            stack_depot_save_flags+0x4c5/0x510
            kasan_save_stack+0x30/0x40
            kasan_save_track+0x10/0x30
            __kasan_slab_alloc+0x83/0x90
            kmem_cache_alloc+0x15e/0x4a0
            __alloc_object+0x35/0x370
            __create_object+0x22/0x90
     __kmalloc_node_track_caller+0x477/0x5b0
            krealloc+0x5f/0x110
            xfs_iext_insert_raw+0x4b2/0x6e0 [xfs]
            xfs_iext_insert+0x2e/0x130 [xfs]
            xfs_iread_bmbt_block+0x1a9/0x4d0 [xfs]
            xfs_btree_visit_block+0xfb/0x290 [xfs]
            xfs_btree_visit_blocks+0x215/0x2c0 [xfs]
            xfs_iread_extents+0x1a2/0x2e0 [xfs]
     xfs_buffered_write_iomap_begin+0x376/0x10a0 [xfs]
            iomap_iter+0x1d1/0x2d0
     iomap_file_buffered_write+0x120/0x1a0
            xfs_file_buffered_write+0x128/0x4b0 [xfs]
            vfs_write+0x675/0x890
            ksys_write+0xc3/0x160
            do_syscall_64+0x94/0x170
     entry_SYSCALL_64_after_hwframe+0x71/0x79
    
    Always preserve __GFP_NOLOCKDEP to fix this.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: cd11016e5f52 ("mm, kasan: stackdepot implementation. Enable stackdepot for SLAB")
    Signed-off-by: Andrey Ryabinin <[email protected]>
    Reported-by: Xiubo Li <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Reported-by: Damien Le Moal <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Suggested-by: Dave Chinner <[email protected]>
    Tested-by: Xiubo Li <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Alexander Potapenko <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tcp: Clean up kernel listener's reqsk in inet_twsk_purge() [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Wed Oct 12 07:50:36 2022 -0700

    tcp: Clean up kernel listener's reqsk in inet_twsk_purge()
    
    commit 740ea3c4a0b2e326b23d7cdf05472a0e92aa39bc upstream.
    
    Eric Dumazet reported a use-after-free related to the per-netns ehash
    series. [0]
    
    When we create a TCP socket from userspace, the socket always holds a
    refcnt of the netns.  This guarantees that a reqsk timer is always fired
    before netns dismantle.  Each reqsk has a refcnt of its listener, so the
    listener is not freed before the reqsk, and the net is not freed before
    the listener as well.
    
    OTOH, when in-kernel users create a TCP socket, it might not hold a refcnt
    of its netns.  Thus, a reqsk timer can be fired after the netns dismantle
    and access freed per-netns ehash.
    
    To avoid the use-after-free, we need to clean up TCP_NEW_SYN_RECV sockets
    in inet_twsk_purge() if the netns uses a per-netns ehash.
    
    [0]: https://lore.kernel.org/netdev/CANn89iLXMup0dRD_Ov79Xt8N9FM0XdhCHEN05sf3eLwxKweM6w@mail.gmail.com/
    
    BUG: KASAN: use-after-free in tcp_or_dccp_get_hashinfo
    include/net/inet_hashtables.h:181 [inline]
    BUG: KASAN: use-after-free in reqsk_queue_unlink+0x320/0x350
    net/ipv4/inet_connection_sock.c:913
    Read of size 8 at addr ffff88807545bd80 by task syz-executor.2/8301
    
    CPU: 1 PID: 8301 Comm: syz-executor.2 Not tainted
    6.0.0-syzkaller-02757-gaf7d23f9d96a #0
    Hardware name: Google Google Compute Engine/Google Compute Engine,
    BIOS Google 09/22/2022
    Call Trace:
    <IRQ>
    __dump_stack lib/dump_stack.c:88 [inline]
    dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
    print_address_description mm/kasan/report.c:317 [inline]
    print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
    kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
    tcp_or_dccp_get_hashinfo include/net/inet_hashtables.h:181 [inline]
    reqsk_queue_unlink+0x320/0x350 net/ipv4/inet_connection_sock.c:913
    inet_csk_reqsk_queue_drop net/ipv4/inet_connection_sock.c:927 [inline]
    inet_csk_reqsk_queue_drop_and_put net/ipv4/inet_connection_sock.c:939 [inline]
    reqsk_timer_handler+0x724/0x1160 net/ipv4/inet_connection_sock.c:1053
    call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474
    expire_timers kernel/time/timer.c:1519 [inline]
    __run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790
    __run_timers kernel/time/timer.c:1768 [inline]
    run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
    __do_softirq+0x1d0/0x9c8 kernel/softirq.c:571
    invoke_softirq kernel/softirq.c:445 [inline]
    __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
    irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
    sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1107
    </IRQ>
    
    Fixes: d1e5e6408b30 ("tcp: Introduce optional per-netns ehash.")
    Reported-by: syzbot <[email protected]>
    Reported-by: Eric Dumazet <[email protected]>
    Suggested-by: Eric Dumazet <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [shaozhengchao: resolved conflicts in 5.10]
    Signed-off-by: Zhengchao Shao <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tcp: Fix NEW_SYN_RECV handling in inet_twsk_purge() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Mar 8 12:01:21 2024 -0800

    tcp: Fix NEW_SYN_RECV handling in inet_twsk_purge()
    
    commit 1c4e97dd2d3c9a3e84f7e26346aa39bc426d3249 upstream.
    
    inet_twsk_purge() uses rcu to find TIME_WAIT and NEW_SYN_RECV
    objects to purge.
    
    These objects use SLAB_TYPESAFE_BY_RCU semantic and need special
    care. We need to use refcount_inc_not_zero(&sk->sk_refcnt).
    
    Reuse the existing correct logic I wrote for TIME_WAIT,
    because both structures have common locations for
    sk_state, sk_family, and netns pointer.
    
    If after the refcount_inc_not_zero() the object fields longer match
    the keys, use sock_gen_put(sk) to release the refcount.
    
    Then we can call inet_twsk_deschedule_put() for TIME_WAIT,
    inet_csk_reqsk_queue_drop_and_put() for NEW_SYN_RECV sockets,
    with BH disabled.
    
    Then we need to restart the loop because we had drop rcu_read_lock().
    
    Fixes: 740ea3c4a0b2 ("tcp: Clean up kernel listener's reqsk in inet_twsk_purge()")
    Link: https://lore.kernel.org/netdev/CANn89iLvFuuihCtt9PME2uS1WJATnf5fKjDToa1WzVnRzHnPfg@mail.gmail.com/T/#u
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [shaozhengchao: resolved conflicts in 5.10]
    Signed-off-by: Zhengchao Shao <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
thunderbolt: Avoid notify PM core about runtime PM resume [+ + +]
Author: Gil Fine <[email protected]>
Date:   Fri Mar 1 15:11:18 2024 +0200

    thunderbolt: Avoid notify PM core about runtime PM resume
    
    commit dcd12acaf384c30437fa5a9a1f71df06fc9835fd upstream.
    
    Currently we notify PM core about occurred wakes after any resume. This
    is not actually needed after resume from runtime suspend. Hence, notify
    PM core about occurred wakes only after resume from system sleep. Also,
    if the wake occurred in USB4 router upstream port, we don't notify the
    PM core about it since it is not actually needed and can cause
    unexpected autowake (e.g. if /sys/power/wakeup_count is used).
    
    While there add the missing kernel-doc for tb_switch_resume().
    
    Signed-off-by: Gil Fine <[email protected]>
    Cc: [email protected]
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Fix wake configurations after device unplug [+ + +]
Author: Gil Fine <[email protected]>
Date:   Fri Mar 1 15:22:53 2024 +0200

    thunderbolt: Fix wake configurations after device unplug
    
    commit c38fa07dc69f0b9e6f43ecab96dc7861a70c827c upstream.
    
    Currently we don't configure correctly the wake events after unplug of device
    router. What can happen is that the downstream ports of host router will be
    configured to wake on: USB4-wake and wake-on-disconnect, but not on
    wake-on-connect. This may cause the later plugged device not to wake the
    domain and fail in enumeration. Fix this by clearing downstream port's "USB4
    Port is Configured" bit, after unplug of a device router.
    
    Signed-off-by: Gil Fine <[email protected]>
    Cc: [email protected]
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing: Increase PERF_MAX_TRACE_SIZE to handle Sentinel1 and docker together [+ + +]
Author: Robin H. Johnson <[email protected]>
Date:   Mon Aug 30 21:37:23 2021 -0700

    tracing: Increase PERF_MAX_TRACE_SIZE to handle Sentinel1 and docker together
    
    commit e531e90b5ab0f7ce5ff298e165214c1aec6ed187 upstream.
    
    Running endpoint security solutions like Sentinel1 that use perf-based
    tracing heavily lead to this repeated dump complaining about dockerd.
    The default value of 2048 is nowhere near not large enough.
    
    Using the prior patch "tracing: show size of requested buffer", we get
    "perf buffer not large enough, wanted 6644, have 6144", after repeated
    up-sizing (I did 2/4/6/8K). With 8K, the problem doesn't occur at all,
    so below is the trace for 6K.
    
    I'm wondering if this value should be selectable at boot time, but this
    is a good starting point.
    
    ```
    ------------[ cut here ]------------
    perf buffer not large enough, wanted 6644, have 6144
    WARNING: CPU: 1 PID: 4997 at kernel/trace/trace_event_perf.c:402 perf_trace_buf_alloc+0x8c/0xa0
    Modules linked in: [..]
    CPU: 1 PID: 4997 Comm: sh Tainted: G                T 5.13.13-x86_64-00039-gb3959163488e #63
    Hardware name: LENOVO 20KH002JUS/20KH002JUS, BIOS N23ET66W (1.41 ) 09/02/2019
    RIP: 0010:perf_trace_buf_alloc+0x8c/0xa0
    Code: 80 3d 43 97 d0 01 00 74 07 31 c0 5b 5d 41 5c c3 ba 00 18 00 00 89 ee 48 c7 c7 00 82 7d 91 c6 05 25 97 d0 01 01 e8 22 ee bc 00 <0f> 0b 31 c0 eb db 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 55 89
    RSP: 0018:ffffb922026b7d58 EFLAGS: 00010282
    RAX: 0000000000000000 RBX: ffff9da5ee012000 RCX: 0000000000000027
    RDX: ffff9da881657828 RSI: 0000000000000001 RDI: ffff9da881657820
    RBP: 00000000000019f4 R08: 0000000000000000 R09: ffffb922026b7b80
    R10: ffffb922026b7b78 R11: ffffffff91dda688 R12: 000000000000000f
    R13: ffff9da5ee012108 R14: ffff9da8816570a0 R15: ffffb922026b7e30
    FS:  00007f420db1a080(0000) GS:ffff9da881640000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000060 CR3: 00000002504a8006 CR4: 00000000003706e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     kprobe_perf_func+0x11e/0x270
     ? do_execveat_common.isra.0+0x1/0x1c0
     ? do_execveat_common.isra.0+0x5/0x1c0
     kprobe_ftrace_handler+0x10e/0x1d0
     0xffffffffc03aa0c8
     ? do_execveat_common.isra.0+0x1/0x1c0
     do_execveat_common.isra.0+0x5/0x1c0
     __x64_sys_execve+0x33/0x40
     do_syscall_64+0x6b/0xc0
     ? do_syscall_64+0x11/0xc0
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    RIP: 0033:0x7f420dc1db37
    Code: ff ff 76 e7 f7 d8 64 41 89 00 eb df 0f 1f 80 00 00 00 00 f7 d8 64 41 89 00 eb dc 0f 1f 84 00 00 00 00 00 b8 3b 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 01 43 0f 00 f7 d8 64 89 01 48
    RSP: 002b:00007ffd4e8b4e38 EFLAGS: 00000246 ORIG_RAX: 000000000000003b
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f420dc1db37
    RDX: 0000564338d1e740 RSI: 0000564338d32d50 RDI: 0000564338d28f00
    RBP: 0000564338d28f00 R08: 0000564338d32d50 R09: 0000000000000020
    R10: 00000000000001b6 R11: 0000000000000246 R12: 0000564338d28f00
    R13: 0000564338d32d50 R14: 0000564338d1e740 R15: 0000564338d28c60
    ---[ end trace 83ab3e8e16275e49 ]---
    ```
    
    Link: https://lkml.kernel.org/r/[email protected]
    
    Signed-off-by: Robin H. Johnson <[email protected]>
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Show size of requested perf buffer [+ + +]
Author: Robin H. Johnson <[email protected]>
Date:   Mon Aug 30 21:37:22 2021 -0700

    tracing: Show size of requested perf buffer
    
    commit a90afe8d020da9298c98fddb19b7a6372e2feb45 upstream.
    
    If the perf buffer isn't large enough, provide a hint about how large it
    needs to be for whatever is running.
    
    Link: https://lkml.kernel.org/r/[email protected]
    
    Signed-off-by: Robin H. Johnson <[email protected]>
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>

 
tun: limit printing rate when illegal packet received by tun dev [+ + +]
Author: Lei Chen <[email protected]>
Date:   Sun Apr 14 22:02:46 2024 -0400

    tun: limit printing rate when illegal packet received by tun dev
    
    [ Upstream commit f8bbc07ac535593139c875ffa19af924b1084540 ]
    
    vhost_worker will call tun call backs to receive packets. If too many
    illegal packets arrives, tun_do_read will keep dumping packet contents.
    When console is enabled, it will costs much more cpu time to dump
    packet and soft lockup will be detected.
    
    net_ratelimit mechanism can be used to limit the dumping rate.
    
    PID: 33036    TASK: ffff949da6f20000  CPU: 23   COMMAND: "vhost-32980"
     #0 [fffffe00003fce50] crash_nmi_callback at ffffffff89249253
     #1 [fffffe00003fce58] nmi_handle at ffffffff89225fa3
     #2 [fffffe00003fceb0] default_do_nmi at ffffffff8922642e
     #3 [fffffe00003fced0] do_nmi at ffffffff8922660d
     #4 [fffffe00003fcef0] end_repeat_nmi at ffffffff89c01663
        [exception RIP: io_serial_in+20]
        RIP: ffffffff89792594  RSP: ffffa655314979e8  RFLAGS: 00000002
        RAX: ffffffff89792500  RBX: ffffffff8af428a0  RCX: 0000000000000000
        RDX: 00000000000003fd  RSI: 0000000000000005  RDI: ffffffff8af428a0
        RBP: 0000000000002710   R8: 0000000000000004   R9: 000000000000000f
        R10: 0000000000000000  R11: ffffffff8acbf64f  R12: 0000000000000020
        R13: ffffffff8acbf698  R14: 0000000000000058  R15: 0000000000000000
        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
     #5 [ffffa655314979e8] io_serial_in at ffffffff89792594
     #6 [ffffa655314979e8] wait_for_xmitr at ffffffff89793470
     #7 [ffffa65531497a08] serial8250_console_putchar at ffffffff897934f6
     #8 [ffffa65531497a20] uart_console_write at ffffffff8978b605
     #9 [ffffa65531497a48] serial8250_console_write at ffffffff89796558
     #10 [ffffa65531497ac8] console_unlock at ffffffff89316124
     #11 [ffffa65531497b10] vprintk_emit at ffffffff89317c07
     #12 [ffffa65531497b68] printk at ffffffff89318306
     #13 [ffffa65531497bc8] print_hex_dump at ffffffff89650765
     #14 [ffffa65531497ca8] tun_do_read at ffffffffc0b06c27 [tun]
     #15 [ffffa65531497d38] tun_recvmsg at ffffffffc0b06e34 [tun]
     #16 [ffffa65531497d68] handle_rx at ffffffffc0c5d682 [vhost_net]
     #17 [ffffa65531497ed0] vhost_worker at ffffffffc0c644dc [vhost]
     #18 [ffffa65531497f10] kthread at ffffffff892d2e72
     #19 [ffffa65531497f50] ret_from_fork at ffffffff89c0022f
    
    Fixes: ef3db4a59542 ("tun: avoid BUG, dump packet on GSO errors")
    Signed-off-by: Lei Chen <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Acked-by: Jason Wang <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Acked-by: Michael S. Tsirkin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file [+ + +]
Author: Petr Tesarik <[email protected]>
Date:   Thu Apr 4 09:57:40 2024 +0200

    u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file
    
    [ Upstream commit 38a15d0a50e0a43778561a5861403851f0b0194c ]
    
    Fix bogus lockdep warnings if multiple u64_stats_sync variables are
    initialized in the same file.
    
    With CONFIG_LOCKDEP, seqcount_init() is a macro which declares:
    
            static struct lock_class_key __key;
    
    Since u64_stats_init() is a function (albeit an inline one), all calls
    within the same file end up using the same instance, effectively treating
    them all as a single lock-class.
    
    Fixes: 9464ca650008 ("net: make u64_stats_init() a function")
    Closes: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Petr Tesarik <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udp: preserve the connected status if only UDP cmsg [+ + +]
Author: Yick Xie <[email protected]>
Date:   Fri Apr 19 01:06:10 2024 +0800

    udp: preserve the connected status if only UDP cmsg
    
    commit 680d11f6e5427b6af1321932286722d24a8b16c1 upstream.
    
    If "udp_cmsg_send()" returned 0 (i.e. only UDP cmsg),
    "connected" should not be set to 0. Otherwise it stops
    the connected socket from using the cached route.
    
    Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
    Signed-off-by: Yick Xie <[email protected]>
    Cc: [email protected]
    Reviewed-by: Willem de Bruijn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Yick Xie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: Disable USB3 LPM at shutdown [+ + +]
Author: Kai-Heng Feng <[email protected]>
Date:   Tue Mar 5 14:51:38 2024 +0800

    usb: Disable USB3 LPM at shutdown
    
    commit d920a2ed8620be04a3301e1a9c2b7cc1de65f19d upstream.
    
    SanDisks USB3 storage may disapper after system reboot:
    
    usb usb2-port3: link state change
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
    usb usb2-port3: do warm reset, port only
    xhci_hcd 0000:00:14.0: xhci_hub_status_data: stopping usb2 port polling
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2b0, return 0x2b0
    usb usb2-port3: not warm reset yet, waiting 50ms
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2f0, return 0x2f0
    usb usb2-port3: not warm reset yet, waiting 200ms
    ...
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x6802c0, return 0x7002c0
    usb usb2-port3: not warm reset yet, waiting 200ms
    xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x4802c0
    xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x4002c0
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2c0, return 0x2c0
    usb usb2-port3: not enabled, trying warm reset again...
    
    This is due to the USB device still cause port change event after xHCI is
    shuted down:
    
    xhci_hcd 0000:38:00.0: // Setting command ring address to 0xffffe001
    xhci_hcd 0000:38:00.0: xhci_resume: starting usb3 port polling.
    xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb4 port polling
    xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb3 port polling
    xhci_hcd 0000:38:00.0: hcd_pci_runtime_resume: 0
    xhci_hcd 0000:38:00.0: xhci_shutdown: stopping usb3 port polling.
    xhci_hcd 0000:38:00.0: // Halt the HC
    xhci_hcd 0000:38:00.0: xhci_shutdown completed - status = 1
    xhci_hcd 0000:00:14.0: xhci_shutdown: stopping usb1 port polling.
    xhci_hcd 0000:00:14.0: // Halt the HC
    xhci_hcd 0000:00:14.0: xhci_shutdown completed - status = 1
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
    xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1311
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x201203, return 0x100203
    xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 connect change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
    usb 2-3: device not accepting address 2, error -108
    xhci_hcd 0000:00:14.0: xHCI dying or halted, can't queue_command
    xhci_hcd 0000:00:14.0: Set port 2-3 link state, portsc: 0x1203, write 0x11261
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1263, return 0x263
    xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1271
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12b1, return 0x2b1
    usb usb2-port3: not reset yet, waiting 60ms
    ACPI: PM: Preparing to enter system sleep state S5
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12f1, return 0x2f1
    usb usb2-port3: not reset yet, waiting 200ms
    reboot: Restarting system
    
    The port change event is caused by LPM transition, so disabling LPM at shutdown
    to make sure the device is in U0 for warmboot.
    
    Signed-off-by: Kai-Heng Feng <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: dwc2: host: Fix dereference issue in DDMA completion flow. [+ + +]
Author: Minas Harutyunyan <[email protected]>
Date:   Tue Apr 9 12:27:54 2024 +0000

    usb: dwc2: host: Fix dereference issue in DDMA completion flow.
    
    commit eed04fa96c48790c1cce73c8a248e9d460b088f8 upstream.
    
    Fixed variable dereference issue in DDMA completion flow.
    
    Fixes: b258e4268850 ("usb: dwc2: host: Fix ISOC flow in DDMA mode")
    CC: [email protected]
    Reported-by: Dan Carpenter <[email protected]>
    Closes: https://lore.kernel.org/linux-usb/2024040834-ethically-rumble-701f@gregkh/T/#m4c4b83bef0ebb4b67fe2e0a7d6466cbb6f416e39
    Signed-off-by: Minas Harutyunyan <[email protected]>
    Link: https://lore.kernel.org/r/cc826d3ef53c934d8e6d98870f17f3cdc3d2755d.1712665387.git.Minas.Harutyunyan@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
USB: serial: option: add Fibocom FM135-GL variants [+ + +]
Author: bolan wang <[email protected]>
Date:   Wed Mar 6 19:03:39 2024 +0800

    USB: serial: option: add Fibocom FM135-GL variants
    
    commit 356952b13af5b2c338df1e06889fd1b5e12cbbf4 upstream.
    
    Update the USB serial option driver support for the Fibocom
    FM135-GL LTE modules.
    - VID:PID 2cb7:0115, FM135-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    
    0x0115: mbim, diag, at, pipe
    
    Here are the outputs of usb-devices:
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0115 Rev=05.15
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=Fibocom Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: bolan wang <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Lonsung U8300/U9300 product [+ + +]
Author: Coia Prant <[email protected]>
Date:   Mon Apr 15 07:26:25 2024 -0700

    USB: serial: option: add Lonsung U8300/U9300 product
    
    commit cf16ffa17c398434a77b8a373e69287c95b60de2 upstream.
    
    Update the USB serial option driver to support Longsung U8300/U9300.
    
    For U8300
    
    Interface 4 is used by for QMI interface in stock firmware of U8300, the
    router which uses U8300 modem.
    Interface 5 is used by for ADB interface in stock firmware of U8300, the
    router which uses U8300 modem.
    
    Interface mapping is:
    0: unknown (Debug), 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI, 5: ADB
    
    T:  Bus=05 Lev=01 Prnt=03 Port=02 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1c9e ProdID=9b05 Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    C:  #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    For U9300
    
    Interface 1 is used by for ADB interface in stock firmware of U9300, the
    router which uses U9300 modem.
    Interface 4 is used by for QMI interface in stock firmware of U9300, the
    router which uses U9300 modem.
    
    Interface mapping is:
    0: ADB, 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI
    
    Note: Interface 3 of some models of the U9300 series can send AT commands.
    
    T:  Bus=05 Lev=01 Prnt=05 Port=04 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1c9e ProdID=9b3c Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    C:  #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    
    Tested successfully using Modem Manager on U9300.
    Tested successfully AT commands using If=1, If=2 and If=3 on U9300.
    
    Signed-off-by: Coia Prant <[email protected]>
    Reviewed-by: Lars Melin <[email protected]>
    [ johan: drop product defines, trim commit message ]
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Rolling RW101-GL and RW135-GL support [+ + +]
Author: Vanillan Wang <[email protected]>
Date:   Tue Apr 16 18:02:55 2024 +0800

    USB: serial: option: add Rolling RW101-GL and RW135-GL support
    
    commit 311f97a4c7c22a01f8897bddf00428dfd0668e79 upstream.
    
    Update the USB serial option driver support for the Rolling
    LTE modules.
    
    - VID:PID 33f8:01a2, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a2: mbim, diag, at, pipe
    - VID:PID 33f8:01a3, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a3: mbim, pipe
    - VID:PID 33f8:01a4, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a4: mbim, diag, at, pipe
    - VID:PID 33f8:0104, RW101-GL for laptop debug M.2 cards(with RMNET
    interface for /Linux/Chrome OS)
    0x0104: RMNET, diag, at, pipe
    - VID:PID 33f8:0115, RW135-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x0115: MBIM, diag, at, pipe
    
    Here are the outputs of usb-devices:
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a2 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a3 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 17 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a4 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
    D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=33f8 ProdID=0104 Rev=05.04
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=ba2eb033
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=0115 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Vanillan Wang <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add support for Fibocom FM650/FG650 [+ + +]
Author: Chuanhong Guo <[email protected]>
Date:   Tue Mar 12 14:29:12 2024 +0800

    USB: serial: option: add support for Fibocom FM650/FG650
    
    commit fb1f4584b1215e8c209f6b3a4028ed8351a0e961 upstream.
    
    Fibocom FM650/FG650 are 5G modems with ECM/NCM/RNDIS/MBIM modes.
    This patch adds support to all 4 modes.
    
    In all 4 modes, the first serial port is the AT console while the other
    3 appear to be diagnostic interfaces for dumping modem logs.
    
    usb-devices output for all modes:
    
    ECM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a04 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    NCM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a05 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    RNDIS:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a06 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    MBIM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a07 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    Signed-off-by: Chuanhong Guo <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Telit FN920C04 rmnet compositions [+ + +]
Author: Daniele Palmas <[email protected]>
Date:   Thu Apr 18 13:34:30 2024 +0200

    USB: serial: option: add Telit FN920C04 rmnet compositions
    
    commit 582ee2f9d268d302595db3e36b985e5cbb93284d upstream.
    
    Add the following Telit FN920C04 compositions:
    
    0x10a0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  5 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a0 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x10a4: rmnet + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a4 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x10a9: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  9 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a9 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Daniele Palmas <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: support Quectel EM060K sub-models [+ + +]
Author: Jerry Meng <[email protected]>
Date:   Mon Apr 15 15:04:29 2024 +0800

    USB: serial: option: support Quectel EM060K sub-models
    
    commit c840244aba7ad2b83ed904378b36bd6aef25511c upstream.
    
    EM060K_129, EM060K_12a, EM060K_12b and EM0060K_12c are EM060K's sub-models,
    having the same name "Quectel EM060K-GL" and the same interface layout.
    
    MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
    
    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=0129 Rev= 5.04
    S:  Manufacturer=Quectel
    S:  Product=Quectel EM060K-GL
    S:  SerialNumber=f6fa08b6
    C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Jerry Meng <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vhost: Add smp_rmb() in vhost_vq_avail_empty() [+ + +]
Author: Gavin Shan <[email protected]>
Date:   Thu Mar 28 10:21:47 2024 +1000

    vhost: Add smp_rmb() in vhost_vq_avail_empty()
    
    commit 22e1992cf7b034db5325660e98c41ca5afa5f519 upstream.
    
    A smp_rmb() has been missed in vhost_vq_avail_empty(), spotted by
    Will. Otherwise, it's not ensured the available ring entries pushed
    by guest can be observed by vhost in time, leading to stale available
    ring entries fetched by vhost in vhost_get_vq_desc(), as reported by
    Yihuang Yu on NVidia's grace-hopper (ARM64) platform.
    
      /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64      \
      -accel kvm -machine virt,gic-version=host -cpu host          \
      -smp maxcpus=1,cpus=1,sockets=1,clusters=1,cores=1,threads=1 \
      -m 4096M,slots=16,maxmem=64G                                 \
      -object memory-backend-ram,id=mem0,size=4096M                \
       :                                                           \
      -netdev tap,id=vnet0,vhost=true                              \
      -device virtio-net-pci,bus=pcie.8,netdev=vnet0,mac=52:54:00:f1:26:b0
       :
      guest# netperf -H 10.26.1.81 -l 60 -C -c -t UDP_STREAM
      virtio_net virtio0: output.0:id 100 is not a head!
    
    Add the missed smp_rmb() in vhost_vq_avail_empty(). When tx_can_batch()
    returns true, it means there's still pending tx buffers. Since it might
    read indices, so it still can bypass the smp_rmb() in vhost_get_vq_desc().
    Note that it should be safe until vq->avail_idx is changed by commit
    275bf960ac697 ("vhost: better detection of available buffers").
    
    Fixes: 275bf960ac69 ("vhost: better detection of available buffers")
    Cc: <[email protected]> # v4.11+
    Reported-by: Yihuang Yu <[email protected]>
    Suggested-by: Will Deacon <[email protected]>
    Signed-off-by: Gavin Shan <[email protected]>
    Acked-by: Jason Wang <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Michael S. Tsirkin <[email protected]>
    Reviewed-by: Stefano Garzarella <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vxlan: drop packets from invalid src-address [+ + +]
Author: David Bauer <[email protected]>
Date:   Thu Apr 18 15:29:08 2024 +0200

    vxlan: drop packets from invalid src-address
    
    [ Upstream commit f58f45c1e5b92975e91754f5407250085a6ae7cf ]
    
    The VXLAN driver currently does not check if the inner layer2
    source-address is valid.
    
    In case source-address snooping/learning is enabled, a entry in the FDB
    for the invalid address is created with the layer3 address of the tunnel
    endpoint.
    
    If the frame happens to have a non-unicast address set, all this
    non-unicast traffic is subsequently not flooded to the tunnel network
    but sent to the learnt host in the FDB. To make matters worse, this FDB
    entry does not expire.
    
    Apply the same filtering for packets as it is done for bridges. This not
    only drops these invalid packets but avoids them from being learnt into
    the FDB.
    
    Fixes: d342894c5d2f ("vxlan: virtual extensible lan")
    Suggested-by: Ido Schimmel <[email protected]>
    Signed-off-by: David Bauer <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
wifi: iwlwifi: mvm: remove old PASN station when adding a new one [+ + +]
Author: Avraham Stern <[email protected]>
Date:   Mon Apr 15 11:54:43 2024 +0300

    wifi: iwlwifi: mvm: remove old PASN station when adding a new one
    
    [ Upstream commit dbfff5bf9292714f02ace002fea8ce6599ea1145 ]
    
    If a PASN station is added, and an old PASN station already exists
    for the same mac address, remove the old station before adding the
    new one. Keeping the old station caueses old security context to
    be used in measurements.
    
    Fixes: 0739a7d70e00 ("iwlwifi: mvm: initiator: add option for adding a PASN responder")
    Signed-off-by: Avraham Stern <[email protected]>
    Signed-off-by: Miri Korenblit <[email protected]>
    Link: https://msgid.link/20240415114847.ef3544a416f2.I4e8c7c8ca22737f4f908ae5cd4fc0b920c703dd3@changeid
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/apic: Force native_apic_mem_read() to use the MOV instruction [+ + +]
Author: Adam Dunlap <[email protected]>
Date:   Mon Mar 18 16:09:27 2024 -0700

    x86/apic: Force native_apic_mem_read() to use the MOV instruction
    
    commit 5ce344beaca688f4cdea07045e0b8f03dc537e74 upstream.
    
    When done from a virtual machine, instructions that touch APIC memory
    must be emulated. By convention, MMIO accesses are typically performed
    via io.h helpers such as readl() or writeq() to simplify instruction
    emulation/decoding (ex: in KVM hosts and SEV guests) [0].
    
    Currently, native_apic_mem_read() does not follow this convention,
    allowing the compiler to emit instructions other than the MOV
    instruction generated by readl(). In particular, when the kernel is
    compiled with clang and run as a SEV-ES or SEV-SNP guest, the compiler
    would emit a TESTL instruction which is not supported by the SEV-ES
    emulator, causing a boot failure in that environment. It is likely the
    same problem would happen in a TDX guest as that uses the same
    instruction emulator as SEV-ES.
    
    To make sure all emulators can emulate APIC memory reads via MOV, use
    the readl() function in native_apic_mem_read(). It is expected that any
    emulator would support MOV in any addressing mode as it is the most
    generic and is what is usually emitted currently.
    
    The TESTL instruction is emitted when native_apic_mem_read() is inlined
    into apic_mem_wait_icr_idle(). The emulator comes from
    insn_decode_mmio() in arch/x86/lib/insn-eval.c. It's not worth it to
    extend insn_decode_mmio() to support more instructions since, in theory,
    the compiler could choose to output nearly any instruction for such
    reads which would bloat the emulator beyond reason.
    
      [0] https://lore.kernel.org/all/[email protected]/
    
      [ bp: Massage commit message, fix typos. ]
    
    Signed-off-by: Adam Dunlap <[email protected]>
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Reviewed-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Ard Biesheuvel <[email protected]>
    Tested-by: Kevin Loughlin <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Tue Apr 9 10:51:05 2024 -0700

    x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
    
    commit f337a6a21e2fd67eadea471e93d05dd37baaa9be upstream.
    
    Initialize cpu_mitigations to CPU_MITIGATIONS_OFF if the kernel is built
    with CONFIG_SPECULATION_MITIGATIONS=n, as the help text quite clearly
    states that disabling SPECULATION_MITIGATIONS is supposed to turn off all
    mitigations by default.
    
      │ If you say N, all mitigations will be disabled. You really
      │ should know what you are doing to say so.
    
    As is, the kernel still defaults to CPU_MITIGATIONS_AUTO, which results in
    some mitigations being enabled in spite of SPECULATION_MITIGATIONS=n.
    
    Fixes: f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs")
    Signed-off-by: Sean Christopherson <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Daniel Sneddon <[email protected]>
    Cc: [email protected]
    Cc: Linus Torvalds <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ [+ + +]
Author: Eric Biggers <[email protected]>
Date:   Tue Apr 16 23:04:34 2024 -0700

    x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ
    
    [ Upstream commit 9543f6e26634537997b6e909c20911b7bf4876de ]
    
    Fix cpuid_deps[] to list the correct dependencies for GFNI, VAES, and
    VPCLMULQDQ.  These features don't depend on AVX512, and there exist CPUs
    that support these features but not AVX512.  GFNI actually doesn't even
    depend on AVX.
    
    This prevents GFNI from being unnecessarily disabled if AVX is disabled
    to mitigate the GDS vulnerability.
    
    This also prevents all three features from being unnecessarily disabled
    if AVX512VL (or its dependency AVX512F) were to be disabled, but it
    looks like there isn't any case where this happens anyway.
    
    Fixes: c128dbfa0f87 ("x86/cpufeatures: Enable new SSE/AVX/AVX512 CPU features")
    Signed-off-by: Eric Biggers <[email protected]>
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Acked-by: Dave Hansen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Apr 4 20:27:38 2024 +0000

    xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING
    
    [ Upstream commit 237f3cf13b20db183d3706d997eedc3c49eacd44 ]
    
    syzbot reported an illegal copy in xsk_setsockopt() [1]
    
    Make sure to validate setsockopt() @optlen parameter.
    
    [1]
    
     BUG: KASAN: slab-out-of-bounds in copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
     BUG: KASAN: slab-out-of-bounds in copy_from_sockptr include/linux/sockptr.h:55 [inline]
     BUG: KASAN: slab-out-of-bounds in xsk_setsockopt+0x909/0xa40 net/xdp/xsk.c:1420
    Read of size 4 at addr ffff888028c6cde3 by task syz-executor.0/7549
    
    CPU: 0 PID: 7549 Comm: syz-executor.0 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    Call Trace:
     <TASK>
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
      print_address_description mm/kasan/report.c:377 [inline]
      print_report+0x169/0x550 mm/kasan/report.c:488
      kasan_report+0x143/0x180 mm/kasan/report.c:601
      copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
      copy_from_sockptr include/linux/sockptr.h:55 [inline]
      xsk_setsockopt+0x909/0xa40 net/xdp/xsk.c:1420
      do_sock_setsockopt+0x3af/0x720 net/socket.c:2311
      __sys_setsockopt+0x1ae/0x250 net/socket.c:2334
      __do_sys_setsockopt net/socket.c:2343 [inline]
      __se_sys_setsockopt net/socket.c:2340 [inline]
      __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340
     do_syscall_64+0xfb/0x240
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    RIP: 0033:0x7fb40587de69
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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:00007fb40665a0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
    RAX: ffffffffffffffda RBX: 00007fb4059abf80 RCX: 00007fb40587de69
    RDX: 0000000000000005 RSI: 000000000000011b RDI: 0000000000000006
    RBP: 00007fb4058ca47a R08: 0000000000000002 R09: 0000000000000000
    R10: 0000000020001980 R11: 0000000000000246 R12: 0000000000000000
    R13: 000000000000000b R14: 00007fb4059abf80 R15: 00007fff57ee4d08
     </TASK>
    
    Allocated by task 7549:
      kasan_save_stack mm/kasan/common.c:47 [inline]
      kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
      poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
      __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
      kasan_kmalloc include/linux/kasan.h:211 [inline]
      __do_kmalloc_node mm/slub.c:3966 [inline]
      __kmalloc+0x233/0x4a0 mm/slub.c:3979
      kmalloc include/linux/slab.h:632 [inline]
      __cgroup_bpf_run_filter_setsockopt+0xd2f/0x1040 kernel/bpf/cgroup.c:1869
      do_sock_setsockopt+0x6b4/0x720 net/socket.c:2293
      __sys_setsockopt+0x1ae/0x250 net/socket.c:2334
      __do_sys_setsockopt net/socket.c:2343 [inline]
      __se_sys_setsockopt net/socket.c:2340 [inline]
      __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340
     do_syscall_64+0xfb/0x240
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    
    The buggy address belongs to the object at ffff888028c6cde0
     which belongs to the cache kmalloc-8 of size 8
    The buggy address is located 1 bytes to the right of
     allocated 2-byte region [ffff888028c6cde0, ffff888028c6cde2)
    
    The buggy address belongs to the physical page:
    page:ffffea0000a31b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888028c6c9c0 pfn:0x28c6c
    anon flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
    page_type: 0xffffffff()
    raw: 00fff00000000800 ffff888014c41280 0000000000000000 dead000000000001
    raw: ffff888028c6c9c0 0000000080800057 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 6648, tgid 6644 (syz-executor.0), ts 133906047828, free_ts 133859922223
      set_page_owner include/linux/page_owner.h:31 [inline]
      post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
      prep_new_page mm/page_alloc.c:1540 [inline]
      get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
      __alloc_pages+0x256/0x680 mm/page_alloc.c:4569
      __alloc_pages_node include/linux/gfp.h:238 [inline]
      alloc_pages_node include/linux/gfp.h:261 [inline]
      alloc_slab_page+0x5f/0x160 mm/slub.c:2175
      allocate_slab mm/slub.c:2338 [inline]
      new_slab+0x84/0x2f0 mm/slub.c:2391
      ___slab_alloc+0xc73/0x1260 mm/slub.c:3525
      __slab_alloc mm/slub.c:3610 [inline]
      __slab_alloc_node mm/slub.c:3663 [inline]
      slab_alloc_node mm/slub.c:3835 [inline]
      __do_kmalloc_node mm/slub.c:3965 [inline]
      __kmalloc_node+0x2db/0x4e0 mm/slub.c:3973
      kmalloc_node include/linux/slab.h:648 [inline]
      __vmalloc_area_node mm/vmalloc.c:3197 [inline]
      __vmalloc_node_range+0x5f9/0x14a0 mm/vmalloc.c:3392
      __vmalloc_node mm/vmalloc.c:3457 [inline]
      vzalloc+0x79/0x90 mm/vmalloc.c:3530
      bpf_check+0x260/0x19010 kernel/bpf/verifier.c:21162
      bpf_prog_load+0x1667/0x20f0 kernel/bpf/syscall.c:2895
      __sys_bpf+0x4ee/0x810 kernel/bpf/syscall.c:5631
      __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
      __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
      __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5736
     do_syscall_64+0xfb/0x240
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    page last free pid 6650 tgid 6647 stack trace:
      reset_page_owner include/linux/page_owner.h:24 [inline]
      free_pages_prepare mm/page_alloc.c:1140 [inline]
      free_unref_page_prepare+0x95d/0xa80 mm/page_alloc.c:2346
      free_unref_page_list+0x5a3/0x850 mm/page_alloc.c:2532
      release_pages+0x2117/0x2400 mm/swap.c:1042
      tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
      tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
      tlb_flush_mmu+0x34d/0x4e0 mm/mmu_gather.c:300
      tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:392
      exit_mmap+0x4b6/0xd40 mm/mmap.c:3300
      __mmput+0x115/0x3c0 kernel/fork.c:1345
      exit_mm+0x220/0x310 kernel/exit.c:569
      do_exit+0x99e/0x27e0 kernel/exit.c:865
      do_group_exit+0x207/0x2c0 kernel/exit.c:1027
      get_signal+0x176e/0x1850 kernel/signal.c:2907
      arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
      exit_to_user_mode_loop kernel/entry/common.c:105 [inline]
      exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
      __syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline]
      syscall_exit_to_user_mode+0xc9/0x360 kernel/entry/common.c:212
      do_syscall_64+0x10a/0x240 arch/x86/entry/common.c:89
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    
    Memory state around the buggy address:
     ffff888028c6cc80: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc
     ffff888028c6cd00: fa fc fc fc fa fc fc fc 00 fc fc fc 06 fc fc fc
    >ffff888028c6cd80: fa fc fc fc fa fc fc fc fa fc fc fc 02 fc fc fc
                                                           ^
     ffff888028c6ce00: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc
     ffff888028c6ce80: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc
    
    Fixes: 423f38329d26 ("xsk: add umem fill queue support and mmap")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: "Björn Töpel" <[email protected]>
    Cc: Magnus Karlsson <[email protected]>
    Cc: Maciej Fijalkowski <[email protected]>
    Cc: Jonathan Lemon <[email protected]>
    Acked-by: Daniel Borkmann <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>