Changelog in Linux kernel 6.6.47

 
ALSA: usb: Fix UBSAN warning in parse_audio_unit() [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Mon Jul 15 14:35:54 2024 +0200

    ALSA: usb: Fix UBSAN warning in parse_audio_unit()
    
    [ Upstream commit 2f38cf730caedaeacdefb7ff35b0a3c1168117f9 ]
    
    A malformed USB descriptor may pass the lengthy mixer description with
    a lot of channels, and this may overflow the 32bit integer shift
    size, as caught by syzbot UBSAN test.  Although this won't cause any
    real trouble, it's better to address.
    
    This patch introduces a sanity check of the number of channels to bail
    out the parsing when too many channels are found.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/[email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoC: topology: Clean up route loading [+ + +]
Author: Amadeusz Sławiński <[email protected]>
Date:   Mon Jun 3 12:28:18 2024 +0200

    ASoC: topology: Clean up route loading
    
    commit e0e7bc2cbee93778c4ad7d9a792d425ffb5af6f7 upstream.
    
    Instead of using very long macro name, assign it to shorter variable
    and use it instead. While doing that, we can reduce multiple if checks
    using this define to one.
    
    Reviewed-by: Cezary Rojewski <[email protected]>
    Signed-off-by: Amadeusz Sławiński <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: topology: Fix route memory corruption [+ + +]
Author: Amadeusz Sławiński <[email protected]>
Date:   Thu Jun 13 11:01:26 2024 +0200

    ASoC: topology: Fix route memory corruption
    
    commit 0298f51652be47b79780833e0b63194e1231fa34 upstream.
    
    It was reported that recent fix for memory corruption during topology
    load, causes corruption in other cases. Instead of being overeager with
    checking topology, assume that it is properly formatted and just
    duplicate strings.
    
    Reported-by: Pierre-Louis Bossart <[email protected]>
    Closes: https://lore.kernel.org/linux-sound/[email protected]/T/#m8c4bd5abf453960fde6f826c4b7f84881da63e9d
    Suggested-by: Péter Ujfalusi <[email protected]>
    Signed-off-by: Amadeusz Sławiński <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
binfmt_flat: Fix corruption when not offsetting data start [+ + +]
Author: Kees Cook <[email protected]>
Date:   Wed Aug 7 12:51:23 2024 -0700

    binfmt_flat: Fix corruption when not offsetting data start
    
    [ Upstream commit 3eb3cd5992f7a0c37edc8d05b4c38c98758d8671 ]
    
    Commit 04d82a6d0881 ("binfmt_flat: allow not offsetting data start")
    introduced a RISC-V specific variant of the FLAT format which does
    not allocate any space for the (obsolete) array of shared library
    pointers. However, it did not disable the code which initializes the
    array, resulting in the corruption of sizeof(long) bytes before the DATA
    segment, generally the end of the TEXT segment.
    
    Introduce MAX_SHARED_LIBS_UPDATE which depends on the state of
    CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET to guard the initialization of
    the shared library pointer region so that it will only be initialized
    if space is reserved for it.
    
    Fixes: 04d82a6d0881 ("binfmt_flat: allow not offsetting data start")
    Co-developed-by: Stefan O'Rear <[email protected]>
    Signed-off-by: Stefan O'Rear <[email protected]>
    Reviewed-by: Damien Le Moal <[email protected]>
    Acked-by: Greg Ungerer <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

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

    Bluetooth: RFCOMM: Fix not validating setsockopt user input
    
    [ Upstream commit a97de7bff13b1cc825c1b1344eaed8d6c2d3e695 ]
    
    syzbot reported rfcomm_sock_setsockopt_old() 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 rfcomm_sock_setsockopt_old
    net/bluetooth/rfcomm/sock.c:632 [inline]
    BUG: KASAN: slab-out-of-bounds in rfcomm_sock_setsockopt+0x893/0xa70
    net/bluetooth/rfcomm/sock.c:673
    Read of size 4 at addr ffff8880209a8bc3 by task syz-executor632/5064
    
    Fixes: 9f2c8a03fbb3 ("Bluetooth: Replace RFCOMM link mode with security level")
    Fixes: bb23c0ab8246 ("Bluetooth: Add support for deferring RFCOMM connection setup")
    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]>

 
bpf, net: Use DEV_STAT_INC() [+ + +]
Author: yunshui <[email protected]>
Date:   Thu May 23 11:35:20 2024 +0800

    bpf, net: Use DEV_STAT_INC()
    
    [ Upstream commit d9cbd8343b010016fcaabc361c37720dcafddcbe ]
    
    syzbot/KCSAN reported that races happen when multiple CPUs updating
    dev->stats.tx_error concurrently. Adopt SMP safe DEV_STATS_INC() to
    update the dev->stats fields.
    
    Reported-by: syzbot <[email protected]>
    Signed-off-by: yunshui <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
bpf: Avoid kfree_rcu() under lock in bpf_lpm_trie. [+ + +]
Author: Alexei Starovoitov <[email protected]>
Date:   Fri Mar 29 10:14:39 2024 -0700

    bpf: Avoid kfree_rcu() under lock in bpf_lpm_trie.
    
    [ Upstream commit 59f2f841179aa6a0899cb9cf53659149a35749b7 ]
    
    syzbot reported the following lock sequence:
    cpu 2:
      grabs timer_base lock
        spins on bpf_lpm lock
    
    cpu 1:
      grab rcu krcp lock
        spins on timer_base lock
    
    cpu 0:
      grab bpf_lpm lock
        spins on rcu krcp lock
    
    bpf_lpm lock can be the same.
    timer_base lock can also be the same due to timer migration.
    but rcu krcp lock is always per-cpu, so it cannot be the same lock.
    Hence it's a false positive.
    To avoid lockdep complaining move kfree_rcu() after spin_unlock.
    
    Reported-by: [email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Andrii Nakryiko <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

bpf: Replace bpf_lpm_trie_key 0-length array with flexible array [+ + +]
Author: Kees Cook <[email protected]>
Date:   Thu Feb 22 07:56:15 2024 -0800

    bpf: Replace bpf_lpm_trie_key 0-length array with flexible array
    
    [ Upstream commit 896880ff30866f386ebed14ab81ce1ad3710cfc4 ]
    
    Replace deprecated 0-length array in struct bpf_lpm_trie_key with
    flexible array. Found with GCC 13:
    
    ../kernel/bpf/lpm_trie.c:207:51: warning: array subscript i is outside array bounds of 'const __u8[0]' {aka 'const unsigned char[]'} [-Warray-bounds=]
      207 |                                        *(__be16 *)&key->data[i]);
          |                                                   ^~~~~~~~~~~~~
    ../include/uapi/linux/swab.h:102:54: note: in definition of macro '__swab16'
      102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
          |                                                      ^
    ../include/linux/byteorder/generic.h:97:21: note: in expansion of macro '__be16_to_cpu'
       97 | #define be16_to_cpu __be16_to_cpu
          |                     ^~~~~~~~~~~~~
    ../kernel/bpf/lpm_trie.c:206:28: note: in expansion of macro 'be16_to_cpu'
      206 |                 u16 diff = be16_to_cpu(*(__be16 *)&node->data[i]
    ^
          |                            ^~~~~~~~~~~
    In file included from ../include/linux/bpf.h:7:
    ../include/uapi/linux/bpf.h:82:17: note: while referencing 'data'
       82 |         __u8    data[0];        /* Arbitrary size */
          |                 ^~~~
    
    And found at run-time under CONFIG_FORTIFY_SOURCE:
    
      UBSAN: array-index-out-of-bounds in kernel/bpf/lpm_trie.c:218:49
      index 0 is out of range for type '__u8 [*]'
    
    Changing struct bpf_lpm_trie_key is difficult since has been used by
    userspace. For example, in Cilium:
    
            struct egress_gw_policy_key {
                    struct bpf_lpm_trie_key lpm_key;
                    __u32 saddr;
                    __u32 daddr;
            };
    
    While direct references to the "data" member haven't been found, there
    are static initializers what include the final member. For example,
    the "{}" here:
    
            struct egress_gw_policy_key in_key = {
                    .lpm_key = { 32 + 24, {} },
                    .saddr   = CLIENT_IP,
                    .daddr   = EXTERNAL_SVC_IP & 0Xffffff,
            };
    
    To avoid the build time and run time warnings seen with a 0-sized
    trailing array for struct bpf_lpm_trie_key, introduce a new struct
    that correctly uses a flexible array for the trailing bytes,
    struct bpf_lpm_trie_key_u8. As part of this, include the "header"
    portion (which is just the "prefixlen" member), so it can be used
    by anything building a bpf_lpr_trie_key that has trailing members that
    aren't a u8 flexible array (like the self-test[1]), which is named
    struct bpf_lpm_trie_key_hdr.
    
    Unfortunately, C++ refuses to parse the __struct_group() helper, so
    it is not possible to define struct bpf_lpm_trie_key_hdr directly in
    struct bpf_lpm_trie_key_u8, so we must open-code the union directly.
    
    Adjust the kernel code to use struct bpf_lpm_trie_key_u8 through-out,
    and for the selftest to use struct bpf_lpm_trie_key_hdr. Add a comment
    to the UAPI header directing folks to the two new options.
    
    Reported-by: Mark Rutland <[email protected]>
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Acked-by: Gustavo A. R. Silva <[email protected]>
    Closes: https://paste.debian.net/hidden/ca500597/
    Link: https://lore.kernel.org/all/202206281009.4332AA33@keescook/ [1]
    Link: https://lore.kernel.org/bpf/[email protected]
    Stable-dep-of: 59f2f841179a ("bpf: Avoid kfree_rcu() under lock in bpf_lpm_trie.")
    Signed-off-by: Sasha Levin <[email protected]>

 
cgroup: Make operations on the cgroup root_list RCU safe [+ + +]
Author: Yafang Shao <[email protected]>
Date:   Sun Oct 29 06:14:29 2023 +0000

    cgroup: Make operations on the cgroup root_list RCU safe
    
    commit d23b5c577715892c87533b13923306acc6243f93 upstream.
    
    At present, when we perform operations on the cgroup root_list, we must
    hold the cgroup_mutex, which is a relatively heavyweight lock. In reality,
    we can make operations on this list RCU-safe, eliminating the need to hold
    the cgroup_mutex during traversal. Modifications to the list only occur in
    the cgroup root setup and destroy paths, which should be infrequent in a
    production environment. In contrast, traversal may occur frequently.
    Therefore, making it RCU-safe would be beneficial.
    
    Signed-off-by: Yafang Shao <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    To: Michal Koutný <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cgroup: Move rcu_head up near the top of cgroup_root [+ + +]
Author: Waiman Long <[email protected]>
Date:   Thu Dec 7 08:46:14 2023 -0500

    cgroup: Move rcu_head up near the top of cgroup_root
    
    commit a7fb0423c201ba12815877a0b5a68a6a1710b23a upstream.
    
    Commit d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU
    safe") adds a new rcu_head to the cgroup_root structure and kvfree_rcu()
    for freeing the cgroup_root.
    
    The current implementation of kvfree_rcu(), however, has the limitation
    that the offset of the rcu_head structure within the larger data
    structure must be less than 4096 or the compilation will fail. See the
    macro definition of __is_kvfree_rcu_offset() in include/linux/rcupdate.h
    for more information.
    
    By putting rcu_head below the large cgroup structure, any change to the
    cgroup structure that makes it larger run the risk of causing build
    failure under certain configurations. Commit 77070eeb8821 ("cgroup:
    Avoid false cacheline sharing of read mostly rstat_cpu") happens to be
    the last straw that breaks it. Fix this problem by moving the rcu_head
    structure up before the cgroup structure.
    
    Fixes: d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU safe")
    Reported-by: Stephen Rothwell <[email protected]>
    Closes: https://lore.kernel.org/lkml/[email protected]/
    Signed-off-by: Waiman Long <[email protected]>
    Acked-by: Yafang Shao <[email protected]>
    Reviewed-by: Yosry Ahmed <[email protected]>
    Reviewed-by: Michal Koutný <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
erofs: avoid debugging output for (de)compressed data [+ + +]
Author: Gao Xiang <[email protected]>
Date:   Wed Dec 27 23:19:03 2023 +0800

    erofs: avoid debugging output for (de)compressed data
    
    [ Upstream commit 496530c7c1dfc159d59a75ae00b572f570710c53 ]
    
    Syzbot reported a KMSAN warning,
    erofs: (device loop0): z_erofs_lz4_decompress_mem: failed to decompress -12 in[46, 4050] out[917]
    =====================================================
    BUG: KMSAN: uninit-value in hex_dump_to_buffer+0xae9/0x10f0 lib/hexdump.c:194
      ..
      print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276
      z_erofs_lz4_decompress_mem fs/erofs/decompressor.c:252 [inline]
      z_erofs_lz4_decompress+0x257e/0x2a70 fs/erofs/decompressor.c:311
      z_erofs_decompress_pcluster fs/erofs/zdata.c:1290 [inline]
      z_erofs_decompress_queue+0x338c/0x6460 fs/erofs/zdata.c:1372
      z_erofs_runqueue+0x36cd/0x3830
      z_erofs_read_folio+0x435/0x810 fs/erofs/zdata.c:1843
    
    The root cause is that the printed decompressed buffer may be filled
    incompletely due to decompression failure.  Since they were once only
    used for debugging, get rid of them now.
    
    Reported-and-tested-by: [email protected]
    Closes: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Yue Hu <[email protected]>
    Signed-off-by: Gao Xiang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
exec: Fix ToCToU between perm check and set-uid/gid usage [+ + +]
Author: Kees Cook <[email protected]>
Date:   Thu Aug 8 11:39:08 2024 -0700

    exec: Fix ToCToU between perm check and set-uid/gid usage
    
    commit f50733b45d865f91db90919f8311e2127ce5a0cb upstream.
    
    When opening a file for exec via do_filp_open(), permission checking is
    done against the file's metadata at that moment, and on success, a file
    pointer is passed back. Much later in the execve() code path, the file
    metadata (specifically mode, uid, and gid) is used to determine if/how
    to set the uid and gid. However, those values may have changed since the
    permissions check, meaning the execution may gain unintended privileges.
    
    For example, if a file could change permissions from executable and not
    set-id:
    
    ---------x 1 root root 16048 Aug  7 13:16 target
    
    to set-id and non-executable:
    
    ---S------ 1 root root 16048 Aug  7 13:16 target
    
    it is possible to gain root privileges when execution should have been
    disallowed.
    
    While this race condition is rare in real-world scenarios, it has been
    observed (and proven exploitable) when package managers are updating
    the setuid bits of installed programs. Such files start with being
    world-executable but then are adjusted to be group-exec with a set-uid
    bit. For example, "chmod o-x,u+s target" makes "target" executable only
    by uid "root" and gid "cdrom", while also becoming setuid-root:
    
    -rwxr-xr-x 1 root cdrom 16048 Aug  7 13:16 target
    
    becomes:
    
    -rwsr-xr-- 1 root cdrom 16048 Aug  7 13:16 target
    
    But racing the chmod means users without group "cdrom" membership can
    get the permission to execute "target" just before the chmod, and when
    the chmod finishes, the exec reaches brpm_fill_uid(), and performs the
    setuid to root, violating the expressed authorization of "only cdrom
    group members can setuid to root".
    
    Re-check that we still have execute permissions in case the metadata
    has changed. It would be better to keep a copy from the perm-check time,
    but until we can do that refactoring, the least-bad option is to do a
    full inode_permission() call (under inode lock). It is understood that
    this is safe against dead-locks, but hardly optimal.
    
    Reported-by: Marco Vanotti <[email protected]>
    Tested-by: Marco Vanotti <[email protected]>
    Suggested-by: Linus Torvalds <[email protected]>
    Cc: [email protected]
    Cc: Eric Biederman <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
 
ext4: convert ext4_da_do_write_end() to take a folio [+ + +]
Author: Matthew Wilcox (Oracle) <[email protected]>
Date:   Thu Dec 14 05:30:35 2023 +0000

    ext4: convert ext4_da_do_write_end() to take a folio
    
    [ Upstream commit 4d5cdd757d0c74924b629559fccb68d8803ce995 ]
    
    There's nothing page-specific happening in ext4_da_do_write_end();
    it's merely used for its refcount & lock, both of which are folio
    properties.  Saves four calls to compound_head().
    
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Stable-dep-of: 83f4414b8f84 ("ext4: sanity check for NULL pointer after ext4_force_shutdown")
    Signed-off-by: Sasha Levin <[email protected]>

ext4: do not create EA inode under buffer lock [+ + +]
Author: Jan Kara <[email protected]>
Date:   Thu Mar 21 17:26:50 2024 +0100

    ext4: do not create EA inode under buffer lock
    
    [ Upstream commit 0a46ef234756dca04623b7591e8ebb3440622f0b ]
    
    ext4_xattr_set_entry() creates new EA inodes while holding buffer lock
    on the external xattr block. This is problematic as it nests all the
    allocation locking (which acquires locks on other buffers) under the
    buffer lock. This can even deadlock when the filesystem is corrupted and
    e.g. quota file is setup to contain xattr block as data block. Move the
    allocation of EA inode out of ext4_xattr_set_entry() into the callers.
    
    Reported-by: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ext4: fold quota accounting into ext4_xattr_inode_lookup_create() [+ + +]
Author: Jan Kara <[email protected]>
Date:   Fri Feb 9 12:20:59 2024 +0100

    ext4: fold quota accounting into ext4_xattr_inode_lookup_create()
    
    [ Upstream commit 8208c41c43ad5e9b63dce6c45a73e326109ca658 ]
    
    When allocating EA inode, quota accounting is done just before
    ext4_xattr_inode_lookup_create(). Logically these two operations belong
    together so just fold quota accounting into
    ext4_xattr_inode_lookup_create(). We also make
    ext4_xattr_inode_lookup_create() return the looked up / created inode to
    convert the function to a more standard calling convention.
    
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Stable-dep-of: 0a46ef234756 ("ext4: do not create EA inode under buffer lock")
    Signed-off-by: Sasha Levin <[email protected]>

ext4: sanity check for NULL pointer after ext4_force_shutdown [+ + +]
Author: Wojciech Gładysz <[email protected]>
Date:   Wed Jul 3 09:01:12 2024 +0200

    ext4: sanity check for NULL pointer after ext4_force_shutdown
    
    [ Upstream commit 83f4414b8f84249d538905825b088ff3ae555652 ]
    
    Test case: 2 threads write short inline data to a file.
    In ext4_page_mkwrite the resulting inline data is converted.
    Handling ext4_grp_locked_error with description "block bitmap
    and bg descriptor inconsistent: X vs Y free clusters" calls
    ext4_force_shutdown. The conversion clears
    EXT4_STATE_MAY_INLINE_DATA but fails for
    ext4_destroy_inline_data_nolock and ext4_mark_iloc_dirty due
    to ext4_forced_shutdown. The restoration of inline data fails
    for the same reason not setting EXT4_STATE_MAY_INLINE_DATA.
    Without the flag set a regular process path in ext4_da_write_end
    follows trying to dereference page folio private pointer that has
    not been set. The fix calls early return with -EIO error shall the
    pointer to private be NULL.
    
    Sample crash report:
    
    Unable to handle kernel paging request at virtual address dfff800000000004
    KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
    Mem abort info:
      ESR = 0x0000000096000005
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
      FSC = 0x05: level 1 translation fault
    Data abort info:
      ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
      CM = 0, WnR = 0, TnD = 0, TagAccess = 0
      GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [dfff800000000004] address between user and kernel address ranges
    Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 1 PID: 20274 Comm: syz-executor185 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : __block_commit_write+0x64/0x2b0 fs/buffer.c:2167
    lr : __block_commit_write+0x3c/0x2b0 fs/buffer.c:2160
    sp : ffff8000a1957600
    x29: ffff8000a1957610 x28: dfff800000000000 x27: ffff0000e30e34b0
    x26: 0000000000000000 x25: dfff800000000000 x24: dfff800000000000
    x23: fffffdffc397c9e0 x22: 0000000000000020 x21: 0000000000000020
    x20: 0000000000000040 x19: fffffdffc397c9c0 x18: 1fffe000367bd196
    x17: ffff80008eead000 x16: ffff80008ae89e3c x15: 00000000200000c0
    x14: 1fffe0001cbe4e04 x13: 0000000000000000 x12: 0000000000000000
    x11: 0000000000000001 x10: 0000000000ff0100 x9 : 0000000000000000
    x8 : 0000000000000004 x7 : 0000000000000000 x6 : 0000000000000000
    x5 : fffffdffc397c9c0 x4 : 0000000000000020 x3 : 0000000000000020
    x2 : 0000000000000040 x1 : 0000000000000020 x0 : fffffdffc397c9c0
    Call trace:
     __block_commit_write+0x64/0x2b0 fs/buffer.c:2167
     block_write_end+0xb4/0x104 fs/buffer.c:2253
     ext4_da_do_write_end fs/ext4/inode.c:2955 [inline]
     ext4_da_write_end+0x2c4/0xa40 fs/ext4/inode.c:3028
     generic_perform_write+0x394/0x588 mm/filemap.c:3985
     ext4_buffered_write_iter+0x2c0/0x4ec fs/ext4/file.c:299
     ext4_file_write_iter+0x188/0x1780
     call_write_iter include/linux/fs.h:2110 [inline]
     new_sync_write fs/read_write.c:497 [inline]
     vfs_write+0x968/0xc3c fs/read_write.c:590
     ksys_write+0x15c/0x26c fs/read_write.c:643
     __do_sys_write fs/read_write.c:655 [inline]
     __se_sys_write fs/read_write.c:652 [inline]
     __arm64_sys_write+0x7c/0x90 fs/read_write.c:652
     __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
     invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
     el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
     do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
     el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
     el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
     el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
    Code: 97f85911 f94002da 91008356 d343fec8 (38796908)
    ---[ end trace 0000000000000000 ]---
    ----------------
    Code disassembly (best guess):
       0:   97f85911        bl      0xffffffffffe16444
       4:   f94002da        ldr     x26, [x22]
       8:   91008356        add     x22, x26, #0x20
       c:   d343fec8        lsr     x8, x22, #3
    * 10:   38796908        ldrb    w8, [x8, x25] <-- trapping instruction
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6
    Link: https://lore.kernel.org/all/[email protected]/T/
    Signed-off-by: Wojciech Gładysz <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
f2fs: fix to cover read extent cache access with lock [+ + +]
Author: Chao Yu <[email protected]>
Date:   Fri May 31 10:00:32 2024 +0800

    f2fs: fix to cover read extent cache access with lock
    
    [ Upstream commit d7409b05a64f212735f0d33f5f1602051a886eab ]
    
    syzbot reports a f2fs bug as below:
    
    BUG: KASAN: slab-use-after-free in sanity_check_extent_cache+0x370/0x410 fs/f2fs/extent_cache.c:46
    Read of size 4 at addr ffff8880739ab220 by task syz-executor200/5097
    
    CPU: 0 PID: 5097 Comm: syz-executor200 Not tainted 6.9.0-rc6-syzkaller #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
     sanity_check_extent_cache+0x370/0x410 fs/f2fs/extent_cache.c:46
     do_read_inode fs/f2fs/inode.c:509 [inline]
     f2fs_iget+0x33e1/0x46e0 fs/f2fs/inode.c:560
     f2fs_nfs_get_inode+0x74/0x100 fs/f2fs/super.c:3237
     generic_fh_to_dentry+0x9f/0xf0 fs/libfs.c:1413
     exportfs_decode_fh_raw+0x152/0x5f0 fs/exportfs/expfs.c:444
     exportfs_decode_fh+0x3c/0x80 fs/exportfs/expfs.c:584
     do_handle_to_path fs/fhandle.c:155 [inline]
     handle_to_path fs/fhandle.c:210 [inline]
     do_handle_open+0x495/0x650 fs/fhandle.c:226
     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
    
    We missed to cover sanity_check_extent_cache() w/ extent cache lock,
    so, below race case may happen, result in use after free issue.
    
    - f2fs_iget
     - do_read_inode
      - f2fs_init_read_extent_tree
      : add largest extent entry in to cache
                                            - shrink
                                             - f2fs_shrink_read_extent_tree
                                              - __shrink_extent_tree
                                               - __detach_extent_node
                                               : drop largest extent entry
      - sanity_check_extent_cache
      : access et->largest w/o lock
    
    let's refactor sanity_check_extent_cache() to avoid extent cache access
    and call it before f2fs_init_read_extent_tree() to fix this issue.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/linux-f2fs-devel/[email protected]
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

f2fs: fix to do sanity check on F2FS_INLINE_DATA flag in inode during GC [+ + +]
Author: Chao Yu <[email protected]>
Date:   Tue May 21 14:23:17 2024 +0800

    f2fs: fix to do sanity check on F2FS_INLINE_DATA flag in inode during GC
    
    [ Upstream commit fc01008c92f40015aeeced94750855a7111b6929 ]
    
    syzbot reports a f2fs bug as below:
    
    ------------[ cut here ]------------
    kernel BUG at fs/f2fs/inline.c:258!
    CPU: 1 PID: 34 Comm: kworker/u8:2 Not tainted 6.9.0-rc6-syzkaller-00012-g9e4bc4bcae01 #0
    RIP: 0010:f2fs_write_inline_data+0x781/0x790 fs/f2fs/inline.c:258
    Call Trace:
     f2fs_write_single_data_page+0xb65/0x1d60 fs/f2fs/data.c:2834
     f2fs_write_cache_pages fs/f2fs/data.c:3133 [inline]
     __f2fs_write_data_pages fs/f2fs/data.c:3288 [inline]
     f2fs_write_data_pages+0x1efe/0x3a90 fs/f2fs/data.c:3315
     do_writepages+0x35b/0x870 mm/page-writeback.c:2612
     __writeback_single_inode+0x165/0x10b0 fs/fs-writeback.c:1650
     writeback_sb_inodes+0x905/0x1260 fs/fs-writeback.c:1941
     wb_writeback+0x457/0xce0 fs/fs-writeback.c:2117
     wb_do_writeback fs/fs-writeback.c:2264 [inline]
     wb_workfn+0x410/0x1090 fs/fs-writeback.c:2304
     process_one_work kernel/workqueue.c:3254 [inline]
     process_scheduled_works+0xa12/0x17c0 kernel/workqueue.c:3335
     worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
     kthread+0x2f2/0x390 kernel/kthread.c:388
     ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
    
    The root cause is: inline_data inode can be fuzzed, so that there may
    be valid blkaddr in its direct node, once f2fs triggers background GC
    to migrate the block, it will hit f2fs_bug_on() during dirty page
    writeback.
    
    Let's add sanity check on F2FS_INLINE_DATA flag in inode during GC,
    so that, it can forbid migrating inline_data inode's data block for
    fixing.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/linux-f2fs-devel/[email protected]
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fou: remove warn in gue_gro_receive on unsupported protocol [+ + +]
Author: Willem de Bruijn <[email protected]>
Date:   Fri Jun 14 08:25:18 2024 -0400

    fou: remove warn in gue_gro_receive on unsupported protocol
    
    [ Upstream commit dd89a81d850fa9a65f67b4527c0e420d15bf836c ]
    
    Drop the WARN_ON_ONCE inn gue_gro_receive if the encapsulated type is
    not known or does not have a GRO handler.
    
    Such a packet is easily constructed. Syzbot generates them and sets
    off this warning.
    
    Remove the warning as it is expected and not actionable.
    
    The warning was previously reduced from WARN_ON to WARN_ON_ONCE in
    commit 270136613bf7 ("fou: Do WARN_ON_ONCE in gue_gro_receive for bad
    proto callbacks").
    
    Signed-off-by: Willem de Bruijn <[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]>

 
fs/ntfs3: Do copy_to_user out of run_lock [+ + +]
Author: Konstantin Komarov <[email protected]>
Date:   Mon Jun 17 15:14:07 2024 +0300

    fs/ntfs3: Do copy_to_user out of run_lock
    
    [ Upstream commit d57431c6f511bf020e474026d9f3123d7bfbea8c ]
    
    In order not to call copy_to_user (from fiemap_fill_next_extent)
    we allocate memory in the kernel, fill it and copy it to user memory
    after up_read(run_lock).
    
    Reported-by: [email protected]
    Signed-off-by: Konstantin Komarov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs: Annotate struct file_handle with __counted_by() and use struct_size() [+ + +]
Author: Gustavo A. R. Silva <[email protected]>
Date:   Mon Mar 25 19:34:01 2024 -0600

    fs: Annotate struct file_handle with __counted_by() and use struct_size()
    
    [ Upstream commit 68d6f4f3fbd9b1baae53e7cf33fb3362b5a21494 ]
    
    Prepare for the coming implementation by GCC and Clang of the __counted_by
    attribute. Flexible array members annotated with __counted_by can have
    their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
    array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
    functions).
    
    While there, use struct_size() helper, instead of the open-coded
    version.
    
    [[email protected]: contains a fix by Edward for an OOB access]
    Reported-by: [email protected]
    Signed-off-by: Edward Adam Davis <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Gustavo A. R. Silva <[email protected]>
    Link: https://lore.kernel.org/r/ZgImCXTdGDTeBvSS@neat
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

fs: Convert to bdev_open_by_dev() [+ + +]
Author: Jan Kara <[email protected]>
Date:   Wed Sep 27 11:34:25 2023 +0200

    fs: Convert to bdev_open_by_dev()
    
    [ Upstream commit f4a48bc36cdfae7c603e8e3f2a51e2a283f3f365 ]
    
    Convert mount code to use bdev_open_by_dev() and propagate the handle
    around to bdev_release().
    
    Acked-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Stable-dep-of: 6306ff39a7fc ("jfs: fix log->bdev_handle null ptr deref in lbmStartIO")
    Signed-off-by: Sasha Levin <[email protected]>

 
genirq/cpuhotplug: Retry with cpu_online_mask when migration fails [+ + +]
Author: Dongli Zhang <[email protected]>
Date:   Tue Apr 23 00:34:13 2024 -0700

    genirq/cpuhotplug: Retry with cpu_online_mask when migration fails
    
    commit 88d724e2301a69c1ab805cd74fc27aa36ae529e0 upstream.
    
    When a CPU goes offline, the interrupts affine to that CPU are
    re-configured.
    
    Managed interrupts undergo either migration to other CPUs or shutdown if
    all CPUs listed in the affinity are offline. The migration of managed
    interrupts is guaranteed on x86 because there are interrupt vectors
    reserved.
    
    Regular interrupts are migrated to a still online CPU in the affinity mask
    or if there is no online CPU to any online CPU.
    
    This works as long as the still online CPUs in the affinity mask have
    interrupt vectors available, but in case that none of those CPUs has a
    vector available the migration fails and the device interrupt becomes
    stale.
    
    This is not any different from the case where the affinity mask does not
    contain any online CPU, but there is no fallback operation for this.
    
    Instead of giving up, retry the migration attempt with the online CPU mask
    if the interrupt is not managed, as managed interrupts cannot be affected
    by this problem.
    
    Signed-off-by: Dongli Zhang <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: Bart Van Assche <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

genirq/cpuhotplug: Skip suspended interrupts when restoring affinity [+ + +]
Author: David Stevens <[email protected]>
Date:   Wed Apr 24 18:03:41 2024 +0900

    genirq/cpuhotplug: Skip suspended interrupts when restoring affinity
    
    commit a60dd06af674d3bb76b40da5d722e4a0ecefe650 upstream.
    
    irq_restore_affinity_of_irq() restarts managed interrupts unconditionally
    when the first CPU in the affinity mask comes online. That's correct during
    normal hotplug operations, but not when resuming from S3 because the
    drivers are not resumed yet and interrupt delivery is not expected by them.
    
    Skip the startup of suspended interrupts and let resume_device_irqs() deal
    with restoring them. This ensures that irqs are not delivered to drivers
    during the noirq phase of resuming from S3, after non-boot CPUs are brought
    back online.
    
    Signed-off-by: David Stevens <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: Bart Van Assche <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Input: bcm5974 - check endpoint type before starting traffic [+ + +]
Author: Javier Carrasco <[email protected]>
Date:   Sat Oct 14 12:20:15 2023 +0200

    Input: bcm5974 - check endpoint type before starting traffic
    
    [ Upstream commit 2b9c3eb32a699acdd4784d6b93743271b4970899 ]
    
    syzbot has found a type mismatch between a USB pipe and the transfer
    endpoint, which is triggered by the bcm5974 driver[1].
    
    This driver expects the device to provide input interrupt endpoints and
    if that is not the case, the driver registration should terminate.
    
    Repros are available to reproduce this issue with a certain setup for
    the dummy_hcd, leading to an interrupt/bulk mismatch which is caught in
    the USB core after calling usb_submit_urb() with the following message:
    "BOGUS urb xfer, pipe 1 != type 3"
    
    Some other device drivers (like the appletouch driver bcm5974 is mainly
    based on) provide some checking mechanism to make sure that an IN
    interrupt endpoint is available. In this particular case the endpoint
    addresses are provided by a config table, so the checking can be
    targeted to the provided endpoints.
    
    Add some basic checking to guarantee that the endpoints available match
    the expected type for both the trackpad and button endpoints.
    
    This issue was only found for the trackpad endpoint, but the checking
    has been added to the button endpoint as well for the same reasons.
    
    Given that there was never a check for the endpoint type, this bug has
    been there since the first implementation of the driver (f89bd95c5c94).
    
    [1] https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622
    
    Fixes: f89bd95c5c94 ("Input: bcm5974 - add driver for Macbook Air and Pro Penryn touchpads")
    Signed-off-by: Javier Carrasco <[email protected]>
    Reported-and-tested-by: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
jfs: Convert to bdev_open_by_dev() [+ + +]
Author: Jan Kara <[email protected]>
Date:   Wed Sep 27 11:34:30 2023 +0200

    jfs: Convert to bdev_open_by_dev()
    
    [ Upstream commit 898c57f456b537e90493a9e9222226aa3ea66267 ]
    
    Convert jfs to use bdev_open_by_dev() and pass the handle around.
    
    CC: Dave Kleikamp <[email protected]>
    CC: [email protected]
    Acked-by: Christoph Hellwig <[email protected]>
    Acked-by: Dave Kleikamp <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Stable-dep-of: 6306ff39a7fc ("jfs: fix log->bdev_handle null ptr deref in lbmStartIO")
    Signed-off-by: Sasha Levin <[email protected]>

jfs: fix log->bdev_handle null ptr deref in lbmStartIO [+ + +]
Author: Lizhi Xu <[email protected]>
Date:   Mon Oct 9 17:45:57 2023 +0800

    jfs: fix log->bdev_handle null ptr deref in lbmStartIO
    
    [ Upstream commit 6306ff39a7fcb7e9c59a00e6860b933b71a2ed3e ]
    
    When sbi->flag is JFS_NOINTEGRITY in lmLogOpen(), log->bdev_handle can't
    be inited, so it value will be NULL.
    Therefore, add the "log ->no_integrity=1" judgment in lbmStartIO() to avoid such
    problems.
    
    Reported-and-tested-by: [email protected]
    Signed-off-by: Lizhi Xu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: fix null ptr deref in dtInsertEntry [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Thu Apr 11 20:05:28 2024 +0800

    jfs: fix null ptr deref in dtInsertEntry
    
    [ Upstream commit ce6dede912f064a855acf6f04a04cbb2c25b8c8c ]
    
    [syzbot reported]
    general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
    KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
    CPU: 0 PID: 5061 Comm: syz-executor404 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    RIP: 0010:dtInsertEntry+0xd0c/0x1780 fs/jfs/jfs_dtree.c:3713
    ...
    [Analyze]
    In dtInsertEntry(), when the pointer h has the same value as p, after writing
    name in UniStrncpy_to_le(), p->header.flag will be cleared. This will cause the
    previously true judgment "p->header.flag & BT-LEAF" to change to no after writing
    the name operation, this leads to entering an incorrect branch and accessing the
    uninitialized object ih when judging this condition for the second time.
    
    [Fix]
    After got the page, check freelist first, if freelist == 0 then exit dtInsert()
    and return -EINVAL.
    
    Reported-by: [email protected]
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: Fix shift-out-of-bounds in dbDiscardAG [+ + +]
Author: Pei Li <[email protected]>
Date:   Tue Jun 25 09:42:05 2024 -0700

    jfs: Fix shift-out-of-bounds in dbDiscardAG
    
    [ Upstream commit 7063b80268e2593e58bee8a8d709c2f3ff93e2f2 ]
    
    When searching for the next smaller log2 block, BLKSTOL2() returned 0,
    causing shift exponent -1 to be negative.
    
    This patch fixes the issue by exiting the loop directly when negative
    shift is found.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=61be3359d2ee3467e7e4
    Signed-off-by: Pei Li <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: fix shift-out-of-bounds in dbJoin [+ + +]
Author: Manas Ghandat <[email protected]>
Date:   Wed Oct 11 20:09:37 2023 +0530

    jfs: fix shift-out-of-bounds in dbJoin
    
    [ Upstream commit cca974daeb6c43ea971f8ceff5a7080d7d49ee30 ]
    
    Currently while joining the leaf in a buddy system there is shift out
    of bound error in calculation of BUDSIZE. Added the required check
    to the BUDSIZE and fixed the documentation as well.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=411debe54d318eaed386
    Signed-off-by: Manas Ghandat <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
KVM: arm64: Don't defer TLB invalidation when zapping table entries [+ + +]
Author: Will Deacon <[email protected]>
Date:   Thu Aug 15 13:46:25 2024 +0100

    KVM: arm64: Don't defer TLB invalidation when zapping table entries
    
    commit f62d4c3eb687d87b616b4279acec7862553bda77 upstream.
    
    Commit 7657ea920c54 ("KVM: arm64: Use TLBI range-based instructions for
    unmap") introduced deferred TLB invalidation for the stage-2 page-table
    so that range-based invalidation can be used for the accumulated
    addresses. This works fine if the structure of the page-tables remains
    unchanged, but if entire tables are zapped and subsequently freed then
    we transiently leave the hardware page-table walker with a reference
    to freed memory thanks to the translation walk caches. For example,
    stage2_unmap_walker() will free page-table pages:
    
            if (childp)
                    mm_ops->put_page(childp);
    
    and issue the TLB invalidation later in kvm_pgtable_stage2_unmap():
    
            if (stage2_unmap_defer_tlb_flush(pgt))
                    /* Perform the deferred TLB invalidations */
                    kvm_tlb_flush_vmid_range(pgt->mmu, addr, size);
    
    For now, take the conservative approach and invalidate the TLB eagerly
    when we clear a table entry. Note, however, that the existing level
    hint passed to __kvm_tlb_flush_vmid_ipa() is incorrect and will be
    fixed in a subsequent patch.
    
    Cc: Raghavendra Rao Ananta <[email protected]>
    Cc: Shaoqin Huang <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Reviewed-by: Shaoqin Huang <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Oliver Upton <[email protected]>
    Cc: <[email protected]> # 6.6.y only
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Don't pass a TLBI level hint when zapping table entries [+ + +]
Author: Will Deacon <[email protected]>
Date:   Thu Aug 15 13:46:26 2024 +0100

    KVM: arm64: Don't pass a TLBI level hint when zapping table entries
    
    commit 36e008323926036650299cfbb2dca704c7aba849 upstream.
    
    The TLBI level hints are for leaf entries only, so take care not to pass
    them incorrectly after clearing a table entry.
    
    Cc: Gavin Shan <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Quentin Perret <[email protected]>
    Fixes: 82bb02445de5 ("KVM: arm64: Implement kvm_pgtable_hyp_unmap() at EL2")
    Fixes: 6d9d2115c480 ("KVM: arm64: Add support for stage-2 map()/unmap() in generic page-table")
    Signed-off-by: Will Deacon <[email protected]>
    Reviewed-by: Shaoqin Huang <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Oliver Upton <[email protected]>
    Cc: <[email protected]> # 6.6.y only
    [will@: Use '0' instead of TLBI_TTL_UNKNOWN to indicate "no level"]
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: Linux 6.6.47 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Aug 19 06:04:32 2024 +0200

    Linux 6.6.47
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: ChromeOS CQ Test <[email protected]>
    Tested-by: Peter Schneider <[email protected]>
    Tested-by: Florian Fainelli <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h [+ + +]
Author: Huacai Chen <[email protected]>
Date:   Sat Jul 20 22:40:58 2024 +0800

    LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h
    
    commit 7697a0fe0154468f5df35c23ebd7aa48994c2cdc upstream.
    
    Chromium sandbox apparently wants to deny statx [1] so it could properly
    inspect arguments after the sandboxed process later falls back to fstat.
    Because there's currently not a "fd-only" version of statx, so that the
    sandbox has no way to ensure the path argument is empty without being
    able to peek into the sandboxed process's memory. For architectures able
    to do newfstatat though, glibc falls back to newfstatat after getting
    -ENOSYS for statx, then the respective SIGSYS handler [2] takes care of
    inspecting the path argument, transforming allowed newfstatat's into
    fstat instead which is allowed and has the same type of return value.
    
    But, as LoongArch is the first architecture to not have fstat nor
    newfstatat, the LoongArch glibc does not attempt falling back at all
    when it gets -ENOSYS for statx -- and you see the problem there!
    
    Actually, back when the LoongArch port was under review, people were
    aware of the same problem with sandboxing clone3 [3], so clone was
    eventually kept. Unfortunately it seemed at that time no one had noticed
    statx, so besides restoring fstat/newfstatat to LoongArch uapi (and
    postponing the problem further), it seems inevitable that we would need
    to tackle seccomp deep argument inspection.
    
    However, this is obviously a decision that shouldn't be taken lightly,
    so we just restore fstat/newfstatat by defining __ARCH_WANT_NEW_STAT
    in unistd.h. This is the simplest solution for now, and so we hope the
    community will tackle the long-standing problem of seccomp deep argument
    inspection in the future [4][5].
    
    Also add "newstat" to syscall_abis_64 in Makefile.syscalls due to
    upstream asm-generic changes.
    
    More infomation please reading this thread [6].
    
    [1] https://chromium-review.googlesource.com/c/chromium/src/+/2823150
    [2] https://chromium.googlesource.com/chromium/src/sandbox/+/c085b51940bd/linux/seccomp-bpf-helpers/sigsys_handlers.cc#355
    [3] https://lore.kernel.org/linux-arch/[email protected]/
    [4] https://lwn.net/Articles/799557/
    [5] https://lpc.events/event/4/contributions/560/attachments/397/640/deep-arg-inspection.pdf
    [6] https://lore.kernel.org/loongarch/20240226-granit-seilschaft-eccc2433014d@brauner/T/#t
    
    Cc: [email protected]
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()" [+ + +]
Author: Sean Young <[email protected]>
Date:   Thu Aug 8 10:35:19 2024 +0200

    media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()"
    
    commit 0c84bde4f37ba27d50e4c70ecacd33fe4a57030d upstream.
    
    This reverts commit 2052138b7da52ad5ccaf74f736d00f39a1c9198c.
    
    This breaks the TeVii s480 dual DVB-S2 S660. The device has a bulk in
    endpoint but no corresponding out endpoint, so the device does not pass
    the "has both receive and send bulk endpoint" test.
    
    Seemingly this device does not use dvb_usb_generic_rw() so I have tried
    removing the generic_bulk_ctrl_endpoint entry, but this resulted in
    different problems.
    
    As we have no explanation yet, revert.
    
    $ dmesg | grep -i -e dvb -e dw21 -e usb\ 4
    [    0.999122] usb 1-1: new high-speed USB device number 2 using ehci-pci
    [    1.023123] usb 4-1: new high-speed USB device number 2 using ehci-pci
    [    1.130247] usb 1-1: New USB device found, idVendor=9022, idProduct=d482,
    +bcdDevice= 0.01
    [    1.130257] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.152323] usb 4-1: New USB device found, idVendor=9022, idProduct=d481,
    +bcdDevice= 0.01
    [    1.152329] usb 4-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    6.701033] dvb-usb: found a 'TeVii S480.2 USB' in cold state, will try to
    +load a firmware
    [    6.701178] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
    [    6.701179] dw2102: start downloading DW210X firmware
    [    6.703715] dvb-usb: found a 'Microsoft Xbox One Digital TV Tuner' in cold
    +state, will try to load a firmware
    [    6.703974] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
    [    6.756432] usb 1-1: USB disconnect, device number 2
    [    6.862119] dvb-usb: found a 'TeVii S480.2 USB' in warm state.
    [    6.862194] dvb-usb: TeVii S480.2 USB error while loading driver (-22)
    [    6.862209] dvb-usb: found a 'TeVii S480.1 USB' in cold state, will try to
    +load a firmware
    [    6.862244] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
    [    6.862245] dw2102: start downloading DW210X firmware
    [    6.914811] usb 4-1: USB disconnect, device number 2
    [    7.014131] dvb-usb: found a 'TeVii S480.1 USB' in warm state.
    [    7.014487] dvb-usb: TeVii S480.1 USB error while loading driver (-22)
    [    7.014538] usbcore: registered new interface driver dw2102
    
    Closes: https://lore.kernel.org/stable/20240801165146.38991f60@mir/
    
    Fixes: 2052138b7da5 ("media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()")
    Reported-by: Stefan Lippers-Hollmann <[email protected]>
    Cc: [email protected]
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mISDN: fix MISDN_TIME_STAMP handling [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Mon Apr 8 08:28:44 2024 +0000

    mISDN: fix MISDN_TIME_STAMP handling
    
    [ Upstream commit 138b787804f4a10417618e8d1e6e2700539fd88c ]
    
    syzbot reports one unsafe call to copy_from_sockptr() [1]
    
    Use copy_safe_from_sockptr() instead.
    
    [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 data_sock_setsockopt+0x46c/0x4cc drivers/isdn/mISDN/socket.c:417
    Read of size 4 at addr ffff0000c6d54083 by task syz-executor406/6167
    
    CPU: 1 PID: 6167 Comm: syz-executor406 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    Call trace:
      dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
      show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
      print_address_description mm/kasan/report.c:377 [inline]
      print_report+0x178/0x518 mm/kasan/report.c:488
      kasan_report+0xd8/0x138 mm/kasan/report.c:601
      __asan_report_load_n_noabort+0x1c/0x28 mm/kasan/report_generic.c:391
      copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
      copy_from_sockptr include/linux/sockptr.h:55 [inline]
      data_sock_setsockopt+0x46c/0x4cc drivers/isdn/mISDN/socket.c:417
      do_sock_setsockopt+0x2a0/0x4e0 net/socket.c:2311
      __sys_setsockopt+0x128/0x1a8 net/socket.c:2334
      __do_sys_setsockopt net/socket.c:2343 [inline]
      __se_sys_setsockopt net/socket.c:2340 [inline]
      __arm64_sys_setsockopt+0xb8/0xd4 net/socket.c:2340
      __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
      invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
      el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
      do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
      el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
      el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
      el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
    
    Fixes: 1b2b03f8e514 ("Add mISDN core files")
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: syzbot <[email protected]>
    Cc: Karsten Keil <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm/debug_vm_pgtable: drop RANDOM_ORVALUE trick [+ + +]
Author: Peter Xu <[email protected]>
Date:   Thu May 23 09:21:39 2024 -0400

    mm/debug_vm_pgtable: drop RANDOM_ORVALUE trick
    
    commit 0b1ef4fde7a24909ff2afacffd0d6afa28b73652 upstream.
    
    Macro RANDOM_ORVALUE was used to make sure the pgtable entry will be
    populated with !none data in clear tests.
    
    The RANDOM_ORVALUE tried to cover mostly all the bits in a pgtable entry,
    even if there's no discussion on whether all the bits will be vaild.  Both
    S390 and PPC64 have their own masks to avoid touching some bits.  Now it's
    the turn for x86_64.
    
    The issue is there's a recent report from Mikhail Gavrilov showing that
    this can cause a warning with the newly added pte set check in commit
    8430557fc5 on writable v.s.  userfaultfd-wp bit, even though the check
    itself was valid, the random pte is not.  We can choose to mask more bits
    out.
    
    However the need to have such random bits setup is questionable, as now
    it's already guaranteed to be true on below:
    
      - For pte level, the pgtable entry will be installed with value from
        pfn_pte(), where pfn points to a valid page.  Hence the pte will be
        !none already if populated with pfn_pte().
    
      - For upper-than-pte level, the pgtable entry should contain a directory
        entry always, which is also !none.
    
    All the cases look like good enough to test a pxx_clear() helper.  Instead
    of extending the bitmask, drop the "set random bits" trick completely.  Add
    some warning guards to make sure the entries will be !none before clear().
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 8430557fc584 ("mm/page_table_check: support userfault wr-protect entries")
    Signed-off-by: Peter Xu <[email protected]>
    Reported-by: Mikhail Gavrilov <[email protected]>
    Link: https://lore.kernel.org/r/CABXGCsMB9A8-X+Np_Q+fWLURYL_0t3Y-MdoNabDM-Lzk58-DGA@mail.gmail.com
    Tested-by: Mikhail Gavrilov <[email protected]>
    Reviewed-by: Pasha Tatashin <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Cc: Aneesh Kumar K.V <[email protected]>
    Cc: Gavin Shan <[email protected]>
    Cc: Anshuman Khandual <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/page_table_check: support userfault wr-protect entries [+ + +]
Author: Peter Xu <[email protected]>
Date:   Wed Apr 17 17:25:49 2024 -0400

    mm/page_table_check: support userfault wr-protect entries
    
    [ Upstream commit 8430557fc584657559bfbd5150b6ae1bb90f35a0 ]
    
    Allow page_table_check hooks to check over userfaultfd wr-protect criteria
    upon pgtable updates.  The rule is no co-existance allowed for any
    writable flag against userfault wr-protect flag.
    
    This should be better than c2da319c2e, where we used to only sanitize such
    issues during a pgtable walk, but when hitting such issue we don't have a
    good chance to know where does that writable bit came from [1], so that
    even the pgtable walk exposes a kernel bug (which is still helpful on
    triaging) but not easy to track and debug.
    
    Now we switch to track the source.  It's much easier too with the recent
    introduction of page table check.
    
    There are some limitations with using the page table check here for
    userfaultfd wr-protect purpose:
    
      - It is only enabled with explicit enablement of page table check configs
      and/or boot parameters, but should be good enough to track at least
      syzbot issues, as syzbot should enable PAGE_TABLE_CHECK[_ENFORCED] for
      x86 [1].  We used to have DEBUG_VM but it's now off for most distros,
      while distros also normally not enable PAGE_TABLE_CHECK[_ENFORCED], which
      is similar.
    
      - It conditionally works with the ptep_modify_prot API.  It will be
      bypassed when e.g. XEN PV is enabled, however still work for most of the
      rest scenarios, which should be the common cases so should be good
      enough.
    
      - Hugetlb check is a bit hairy, as the page table check cannot identify
      hugetlb pte or normal pte via trapping at set_pte_at(), because of the
      current design where hugetlb maps every layers to pte_t... For example,
      the default set_huge_pte_at() can invoke set_pte_at() directly and lose
      the hugetlb context, treating it the same as a normal pte_t. So far it's
      fine because we have huge_pte_uffd_wp() always equals to pte_uffd_wp() as
      long as supported (x86 only).  It'll be a bigger problem when we'll
      define _PAGE_UFFD_WP differently at various pgtable levels, because then
      one huge_pte_uffd_wp() per-arch will stop making sense first.. as of now
      we can leave this for later too.
    
    This patch also removes commit c2da319c2e altogether, as we have something
    better now.
    
    [1] https://lore.kernel.org/all/[email protected]/
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Peter Xu <[email protected]>
    Reviewed-by: Pasha Tatashin <[email protected]>
    Cc: Axel Rasmussen <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Nadav Amit <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm: gup: stop abusing try_grab_folio [+ + +]
Author: Yang Shi <[email protected]>
Date:   Fri Jun 28 12:14:58 2024 -0700

    mm: gup: stop abusing try_grab_folio
    
    commit f442fa6141379a20b48ae3efabee827a3d260787 upstream.
    
    A kernel warning was reported when pinning folio in CMA memory when
    launching SEV virtual machine.  The splat looks like:
    
    [  464.325306] WARNING: CPU: 13 PID: 6734 at mm/gup.c:1313 __get_user_pages+0x423/0x520
    [  464.325464] CPU: 13 PID: 6734 Comm: qemu-kvm Kdump: loaded Not tainted 6.6.33+ #6
    [  464.325477] RIP: 0010:__get_user_pages+0x423/0x520
    [  464.325515] Call Trace:
    [  464.325520]  <TASK>
    [  464.325523]  ? __get_user_pages+0x423/0x520
    [  464.325528]  ? __warn+0x81/0x130
    [  464.325536]  ? __get_user_pages+0x423/0x520
    [  464.325541]  ? report_bug+0x171/0x1a0
    [  464.325549]  ? handle_bug+0x3c/0x70
    [  464.325554]  ? exc_invalid_op+0x17/0x70
    [  464.325558]  ? asm_exc_invalid_op+0x1a/0x20
    [  464.325567]  ? __get_user_pages+0x423/0x520
    [  464.325575]  __gup_longterm_locked+0x212/0x7a0
    [  464.325583]  internal_get_user_pages_fast+0xfb/0x190
    [  464.325590]  pin_user_pages_fast+0x47/0x60
    [  464.325598]  sev_pin_memory+0xca/0x170 [kvm_amd]
    [  464.325616]  sev_mem_enc_register_region+0x81/0x130 [kvm_amd]
    
    Per the analysis done by yangge, when starting the SEV virtual machine, it
    will call pin_user_pages_fast(..., FOLL_LONGTERM, ...) to pin the memory.
    But the page is in CMA area, so fast GUP will fail then fallback to the
    slow path due to the longterm pinnalbe check in try_grab_folio().
    
    The slow path will try to pin the pages then migrate them out of CMA area.
    But the slow path also uses try_grab_folio() to pin the page, it will
    also fail due to the same check then the above warning is triggered.
    
    In addition, the try_grab_folio() is supposed to be used in fast path and
    it elevates folio refcount by using add ref unless zero.  We are guaranteed
    to have at least one stable reference in slow path, so the simple atomic add
    could be used.  The performance difference should be trivial, but the
    misuse may be confusing and misleading.
    
    Redefined try_grab_folio() to try_grab_folio_fast(), and try_grab_page()
    to try_grab_folio(), and use them in the proper paths.  This solves both
    the abuse and the kernel warning.
    
    The proper naming makes their usecase more clear and should prevent from
    abusing in the future.
    
    peterx said:
    
    : The user will see the pin fails, for gpu-slow it further triggers the WARN
    : right below that failure (as in the original report):
    :
    :         folio = try_grab_folio(page, page_increm - 1,
    :                                 foll_flags);
    :         if (WARN_ON_ONCE(!folio)) { <------------------------ here
    :                 /*
    :                         * Release the 1st page ref if the
    :                         * folio is problematic, fail hard.
    :                         */
    :                 gup_put_folio(page_folio(page), 1,
    :                                 foll_flags);
    :                 ret = -EFAULT;
    :                 goto out;
    :         }
    
    [1] https://lore.kernel.org/linux-mm/[email protected]/
    
    [[email protected]: fix implicit declaration of function try_grab_folio_fast]
      Link: https://lkml.kernel.org/r/CAHbLzkowMSso-4Nufc9hcMehQsK9PNz3OSu-+eniU-2Mm-xjhA@mail.gmail.com
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 57edfcfd3419 ("mm/gup: accelerate thp gup even for "pages != NULL"")
    Signed-off-by: Yang Shi <[email protected]>
    Reported-by: yangge <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: <[email protected]>    [6.6+]
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net: add copy_safe_from_sockptr() helper [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Mon Apr 8 08:28:43 2024 +0000

    net: add copy_safe_from_sockptr() helper
    
    [ Upstream commit 6309863b31dd80317cd7d6824820b44e254e2a9c ]
    
    copy_from_sockptr() helper is unsafe, unless callers
    did the prior check against user provided optlen.
    
    Too many callers get this wrong, lets add a helper to
    fix them and avoid future copy/paste bugs.
    
    Instead of :
    
       if (optlen < sizeof(opt)) {
           err = -EINVAL;
           break;
       }
       if (copy_from_sockptr(&opt, optval, sizeof(opt)) {
           err = -EFAULT;
           break;
       }
    
    Use :
    
       err = copy_safe_from_sockptr(&opt, sizeof(opt),
                                    optval, optlen);
       if (err)
           break;
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 7a87441c9651 ("nfc: llcp: fix nfc_llcp_setsockopt() unsafe copies")
    Signed-off-by: Sasha Levin <[email protected]>

net: don't dump stack on queue timeout [+ + +]
Author: Jakub Kicinski <[email protected]>
Date:   Tue Nov 14 00:11:42 2023 -0500

    net: don't dump stack on queue timeout
    
    [ Upstream commit e316dd1cf1358ff9c44b37c7be273a7dc4349986 ]
    
    The top syzbot report for networking (#14 for the entire kernel)
    is the queue timeout splat. We kept it around for a long time,
    because in real life it provides pretty strong signal that
    something is wrong with the driver or the device.
    
    Removing it is also likely to break monitoring for those who
    track it as a kernel warning.
    
    Nevertheless, WARN()ings are best suited for catching kernel
    programming bugs. If a Tx queue gets starved due to a pause
    storm, priority configuration, or other weirdness - that's
    obviously a problem, but not a problem we can fix at
    the kernel level.
    
    Bite the bullet and convert the WARN() to a print.
    
    Before:
    
      NETDEV WATCHDOG: eni1np1 (netdevsim): transmit queue 0 timed out 1975 ms
      WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:525 dev_watchdog+0x39e/0x3b0
      [... completely pointless stack trace of a timer follows ...]
    
    Now:
    
      netdevsim netdevsim1 eni1np1: NETDEV WATCHDOG: CPU: 0: transmit queue 0 timed out 1769 ms
    
    Alternatively we could mark the drivers which syzbot has
    learned to abuse as "print-instead-of-WARN" selectively.
    
    Reported-by: [email protected]
    Reviewed-by: Jiri Pirko <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: sctp: fix skb leak in sctp_inq_free() [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Wed Feb 14 11:22:24 2024 +0300

    net: sctp: fix skb leak in sctp_inq_free()
    
    [ Upstream commit 4e45170d9acc2d5ae8f545bf3f2f67504a361338 ]
    
    In case of GSO, 'chunk->skb' pointer may point to an entry from
    fraglist created in 'sctp_packet_gso_append()'. To avoid freeing
    random fraglist entry (and so undefined behavior and/or memory
    leak), introduce 'sctp_inq_chunk_free()' helper to ensure that
    'chunk->skb' is set to 'chunk->head_skb' (i.e. fraglist head)
    before calling 'sctp_chunk_free()', and use the aforementioned
    helper in 'sctp_inq_pop()' as well.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?id=0d8351bbe54fd04a492c2daab0164138db008042
    Fixes: 90017accff61 ("sctp: Add GSO support")
    Suggested-by: Xin Long <[email protected]>
    Signed-off-by: Dmitry Antipov <[email protected]>
    Acked-by: Xin Long <[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: tls, add test to capture error on large splice [+ + +]
Author: John Fastabend <[email protected]>
Date:   Fri Jan 12 16:32:58 2024 -0800

    net: tls, add test to capture error on large splice
    
    [ Upstream commit 034ea1305e659ddae44c19ba8449166fec318e2d ]
    
    syzbot found an error with how splice() is handled with a msg greater
    than 32. This was fixed in previous patch, but lets add a test for
    it to ensure it continues to work.
    
    Signed-off-by: John Fastabend <[email protected]>
    Reviewed-by: Jakub Kicinski <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: net:rds: Fix possible deadlock in rds_message_put [+ + +]
Author: Allison Henderson <[email protected]>
Date:   Thu Feb 8 19:28:54 2024 -0700

    net:rds: Fix possible deadlock in rds_message_put
    
    [ Upstream commit f1acf1ac84d2ae97b7889b87223c1064df850069 ]
    
    Functions rds_still_queued and rds_clear_recv_queue lock a given socket
    in order to safely iterate over the incoming rds messages. However
    calling rds_inc_put while under this lock creates a potential deadlock.
    rds_inc_put may eventually call rds_message_purge, which will lock
    m_rs_lock. This is the incorrect locking order since m_rs_lock is
    meant to be locked before the socket. To fix this, we move the message
    item to a local list or variable that wont need rs_recv_lock protection.
    Then we can safely call rds_inc_put on any item stored locally after
    rs_recv_lock is released.
    
    Fixes: bdbe6fbc6a2f ("RDS: recv.c")
    Reported-by: [email protected]
    Reported-by: [email protected]
    Signed-off-by: Allison Henderson <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nfc: llcp: fix nfc_llcp_setsockopt() unsafe copies [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Mon Apr 8 08:28:45 2024 +0000

    nfc: llcp: fix nfc_llcp_setsockopt() unsafe copies
    
    [ Upstream commit 7a87441c9651ba37842f4809224aca13a554a26f ]
    
    syzbot reported unsafe calls to copy_from_sockptr() [1]
    
    Use copy_safe_from_sockptr() instead.
    
    [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 nfc_llcp_setsockopt+0x6c2/0x850 net/nfc/llcp_sock.c:255
    Read of size 4 at addr ffff88801caa1ec3 by task syz-executor459/5078
    
    CPU: 0 PID: 5078 Comm: syz-executor459 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]
      nfc_llcp_setsockopt+0x6c2/0x850 net/nfc/llcp_sock.c:255
      do_sock_setsockopt+0x3b1/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+0xfd/0x240
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    RIP: 0033:0x7f7fac07fd89
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 91 18 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 b8 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007fff660eb788 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f7fac07fd89
    RDX: 0000000000000000 RSI: 0000000000000118 RDI: 0000000000000004
    RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000000
    R10: 0000000020000a80 R11: 0000000000000246 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: syzbot <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nfsd: expose /proc/net/sunrpc/nfsd in net namespaces [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:36:01 2024 -0400

    nfsd: expose /proc/net/sunrpc/nfsd in net namespaces
    
    [ Upstream commit 93483ac5fec62cc1de166051b219d953bb5e4ef4 ]
    
    We are running nfsd servers inside of containers with their own network
    namespace, and we want to monitor these services using the stats found
    in /proc.  However these are not exposed in the proc inside of the
    container, so we have to bind mount the host /proc into our containers
    to get at this information.
    
    Separate out the stat counters init and the proc registration, and move
    the proc registration into the pernet operations entry and exit points
    so that these stats can be exposed inside of network namespaces.
    
    This is an intermediate step, this just exposes the global counters in
    the network namespace.  Subsequent patches will move these counters into
    the per-network namespace container.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFSD: Fix frame size warning in svc_export_parse() [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Mon Aug 12 18:35:54 2024 -0400

    NFSD: Fix frame size warning in svc_export_parse()
    
    [ Upstream commit 6939ace1f22681fface7841cdbf34d3204cc94b5 ]
    
    fs/nfsd/export.c: In function 'svc_export_parse':
    fs/nfsd/export.c:737:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
        737 | }
    
    On my systems, svc_export_parse() has a stack frame of over 800
    bytes, not 1040, but nonetheless, it could do with some reduction.
    
    When a struct svc_export is on the stack, it's a temporary structure
    used as an argument, and not visible as an actual exported FS. No
    need to reserve space for export_stats in such cases.
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Cc: Amir Goldstein <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Stable-dep-of: 4b14885411f7 ("nfsd: make all of the nfsd stats per-network namespace")
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfsd: make all of the nfsd stats per-network namespace [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:36:02 2024 -0400

    nfsd: make all of the nfsd stats per-network namespace
    
    [ Upstream commit 4b14885411f74b2b0ce0eb2b39d0fffe54e5ca0d ]
    
    We have a global set of counters that we modify for all of the nfsd
    operations, but now that we're exposing these stats across all network
    namespaces we need to make the stats also be per-network namespace.  We
    already have some caching stats that are per-network namespace, so move
    these definitions into the same counter and then adjust all the helpers
    and users of these stats to provide the appropriate nfsd_net struct so
    that the stats are maintained for the per-network namespace objects.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: make svc_stat per-network namespace instead of global [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:36:04 2024 -0400

    nfsd: make svc_stat per-network namespace instead of global
    
    [ Upstream commit 16fb9808ab2c99979f081987752abcbc5b092eac ]
    
    The final bit of stats that is global is the rpc svc_stat.  Move this
    into the nfsd_net struct and use that everywhere instead of the global
    struct.  Remove the unused global struct.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: remove nfsd_stats, make th_cnt a global counter [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:36:03 2024 -0400

    nfsd: remove nfsd_stats, make th_cnt a global counter
    
    [ Upstream commit e41ee44cc6a473b1f414031782c3b4283d7f3e5f ]
    
    This is the last global stat, take it out of the nfsd_stats struct and
    make it a global part of nfsd, report it the same as always.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: rename NFSD_NET_* to NFSD_STATS_* [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:36:00 2024 -0400

    nfsd: rename NFSD_NET_* to NFSD_STATS_*
    
    [ Upstream commit d98416cc2154053950610bb6880911e3dcbdf8c5 ]
    
    We're going to merge the stats all into per network namespace in
    subsequent patches, rename these nn counters to be consistent with the
    rest of the stats.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFSD: Rewrite synopsis of nfsd_percpu_counters_init() [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Mon Aug 12 18:35:53 2024 -0400

    NFSD: Rewrite synopsis of nfsd_percpu_counters_init()
    
    [ Upstream commit 5ec39944f874e1ecc09f624a70dfaa8ac3bf9d08 ]
    
    In function ‘export_stats_init’,
        inlined from ‘svc_export_alloc’ at fs/nfsd/export.c:866:6:
    fs/nfsd/export.c:337:16: warning: ‘nfsd_percpu_counters_init’ accessing 40 bytes in a region of size 0 [-Wstringop-overflow=]
      337 |         return nfsd_percpu_counters_init(&stats->counter, EXP_STATS_COUNTERS_NUM);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fs/nfsd/export.c:337:16: note: referencing argument 1 of type ‘struct percpu_counter[0]’
    fs/nfsd/stats.h: In function ‘svc_export_alloc’:
    fs/nfsd/stats.h:40:5: note: in a call to function ‘nfsd_percpu_counters_init’
       40 | int nfsd_percpu_counters_init(struct percpu_counter counters[], int num);
          |     ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Cc: Amir Goldstein <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Stable-dep-of: 93483ac5fec6 ("nfsd: expose /proc/net/sunrpc/nfsd in net namespaces")
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfsd: stop setting ->pg_stats for unused stats [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:35:56 2024 -0400

    nfsd: stop setting ->pg_stats for unused stats
    
    [ Upstream commit a2214ed588fb3c5b9824a21cff870482510372bb ]
    
    A lot of places are setting a blank svc_stats in ->pg_stats and never
    utilizing these stats.  Remove all of these extra structs as we're not
    reporting these stats anywhere.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvme/pci: Add APST quirk for Lenovo N60z laptop [+ + +]
Author: WangYuli <[email protected]>
Date:   Mon Jul 15 17:31:44 2024 +0800

    nvme/pci: Add APST quirk for Lenovo N60z laptop
    
    commit ab091ec536cb7b271983c0c063b17f62f3591583 upstream.
    
    There is a hardware power-saving problem with the Lenovo N60z
    board. When turn it on and leave it for 10 hours, there is a
    20% chance that a nvme disk will not wake up until reboot.
    
    Link: https://lore.kernel.org/all/2B5581C46AC6E335+9c7a81f1-05fb-4fd0-9fbb-108757c21628@uniontech.com
    Signed-off-by: hmy <[email protected]>
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: WangYuli <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pppoe: Fix memory leak in pppoe_sendmsg() [+ + +]
Author: Gavrilov Ilia <[email protected]>
Date:   Wed Feb 14 09:01:50 2024 +0000

    pppoe: Fix memory leak in pppoe_sendmsg()
    
    [ Upstream commit dc34ebd5c018b0edf47f39d11083ad8312733034 ]
    
    syzbot reports a memory leak in pppoe_sendmsg [1].
    
    The problem is in the pppoe_recvmsg() function that handles errors
    in the wrong order. For the skb_recv_datagram() function, check
    the pointer to skb for NULL first, and then check the 'error' variable,
    because the skb_recv_datagram() function can set 'error'
    to -EAGAIN in a loop but return a correct pointer to socket buffer
    after a number of attempts, though 'error' remains set to -EAGAIN.
    
    skb_recv_datagram
          __skb_recv_datagram          // Loop. if (err == -EAGAIN) then
                                       // go to the next loop iteration
              __skb_try_recv_datagram  // if (skb != NULL) then return 'skb'
                                       // else if a signal is received then
                                       // return -EAGAIN
    
    Found by InfoTeCS on behalf of Linux Verification Center
    (linuxtesting.org) with Syzkaller.
    
    Link: https://syzkaller.appspot.com/bug?extid=6bdfd184eac7709e5cc9 [1]
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=6bdfd184eac7709e5cc9
    Signed-off-by: Gavrilov Ilia <[email protected]>
    Reviewed-by: Guillaume Nault <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
quota: Detect loops in quota tree [+ + +]
Author: Jan Kara <[email protected]>
Date:   Wed Feb 7 19:12:15 2024 +0100

    quota: Detect loops in quota tree
    
    [ Upstream commit a898cb621ac589b0b9e959309689a027e765aa12 ]
    
    Syzbot has found that when it creates corrupted quota files where the
    quota tree contains a loop, we will deadlock when tryling to insert a
    dquot. Add loop detection into functions traversing the quota tree.
    
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
reiserfs: fix uninit-value in comp_keys [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Tue Dec 26 15:16:09 2023 +0800

    reiserfs: fix uninit-value in comp_keys
    
    [ Upstream commit dd8f87f21dc3da2eaf46e7401173f935b90b13a8 ]
    
    The cpu_key was not initialized in reiserfs_delete_solid_item(), which triggered
    this issue.
    
    Reported-and-tested-by:  <[email protected]>
    Signed-off-by: Edward Adam Davis <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error" [+ + +]
Author: Niklas Cassel <[email protected]>
Date:   Tue Aug 13 15:19:01 2024 +0200

    Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error"
    
    commit fa0db8e568787c665384430eaf2221b299b85367 upstream.
    
    This reverts commit 28ab9769117ca944cb6eb537af5599aa436287a4.
    
    Sense data can be in either fixed format or descriptor format.
    
    SAT-6 revision 1, "10.4.6 Control mode page", defines the D_SENSE bit:
    "The SATL shall support this bit as defined in SPC-5 with the following
    exception: if the D_ SENSE bit is set to zero (i.e., fixed format sense
    data), then the SATL should return fixed format sense data for ATA
    PASS-THROUGH commands."
    
    The libata SATL has always kept D_SENSE set to zero by default. (It is
    however possible to change the value using a MODE SELECT SG_IO command.)
    
    Failed ATA PASS-THROUGH commands correctly respected the D_SENSE bit,
    however, successful ATA PASS-THROUGH commands incorrectly returned the
    sense data in descriptor format (regardless of the D_SENSE bit).
    
    Commit 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE bit for
    CK_COND=1 and no error") fixed this bug for successful ATA PASS-THROUGH
    commands.
    
    However, after commit 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE
    bit for CK_COND=1 and no error"), there were bug reports that hdparm,
    hddtemp, and udisks were no longer working as expected.
    
    These applications incorrectly assume the returned sense data is in
    descriptor format, without even looking at the RESPONSE CODE field in the
    returned sense data (to see which format the returned sense data is in).
    
    Considering that there will be broken versions of these applications around
    roughly forever, we are stuck with being bug compatible with older kernels.
    
    Cc: [email protected] # 4.19+
    Reported-by: Stephan Eisvogel <[email protected]>
    Reported-by: Christian Heusel <[email protected]>
    Closes: https://lore.kernel.org/linux-ide/[email protected]/
    Fixes: 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error")
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Martin K. Petersen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Niklas Cassel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "Input: bcm5974 - check endpoint type before starting traffic" [+ + +]
Author: Javier Carrasco <[email protected]>
Date:   Tue Mar 5 08:49:21 2024 +0100

    Revert "Input: bcm5974 - check endpoint type before starting traffic"
    
    commit 7105e92c60c9cc4112c782d69c172e96b69a43dc upstream.
    
    This patch intended to fix an well-knonw issue in old drivers where the
    endpoint type is taken for granted, which is often triggered by fuzzers.
    
    That was the case for this driver [1], and although the fix seems to be
    correct, it uncovered another issue that leads to a regression [2], if
    the endpoints of the current interface are checked.
    
    The driver makes use of endpoints that belong to a different interface
    rather than the one it binds (it binds to the third interface, but also
    accesses an endpoint from a different one). The driver should claim the
    interfaces it requires, but that is still not the case.
    
    Given that the regression is more severe than the issue found by
    syzkaller, the best approach is reverting the patch that causes the
    regression, and trying to fix the underlying problem before checking
    the endpoint types again.
    
    Note that reverting this patch will probably trigger the syzkaller bug
    at some point.
    
    This reverts commit 2b9c3eb32a699acdd4784d6b93743271b4970899.
    
    Link: https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622 [1]
    Link: https://lore.kernel.org/linux-input/[email protected]/ [2]
    
    Fixes: 2b9c3eb32a69 ("Input: bcm5974 - check endpoint type before starting traffic")
    Reported-by: Jacopo Radice <[email protected]>
    Closes: https://bugzilla.suse.com/show_bug.cgi?id=1220030
    Signed-off-by: Javier Carrasco <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "jfs: fix shift-out-of-bounds in dbJoin" [+ + +]
Author: Dave Kleikamp <[email protected]>
Date:   Mon Jan 29 08:40:23 2024 -0600

    Revert "jfs: fix shift-out-of-bounds in dbJoin"
    
    commit e42e29cc442395d62f1a8963ec2dfb700ba6a5d7 upstream.
    
    This reverts commit cca974daeb6c43ea971f8ceff5a7080d7d49ee30.
    
    The added sanity check is incorrect. BUDMIN is not the wrong value and
    is too small.
    
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Squashfs: fix variable overflow triggered by sysbot [+ + +]
Author: Phillip Lougher <[email protected]>
Date:   Mon Nov 13 16:09:01 2023 +0000

    Squashfs: fix variable overflow triggered by sysbot
    
    [ Upstream commit 12427de9439d68b8e96ba6f50b601ef15f437612 ]
    
    Sysbot reports a slab out of bounds write in squashfs_readahead().
    
    This is ultimately caused by a file reporting an (infeasibly) large file
    size (1407374883553280 bytes) with the minimum block size of 4K.
    
    This causes variable overflow.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Phillip Lougher <[email protected]>
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
squashfs: squashfs_read_data need to check if the length is 0 [+ + +]
Author: Lizhi Xu <[email protected]>
Date:   Thu Nov 16 11:13:52 2023 +0800

    squashfs: squashfs_read_data need to check if the length is 0
    
    [ Upstream commit eb66b8abae98f869c224f7c852b685ae02144564 ]
    
    When the length passed in is 0, the pagemap_scan_test_walk() caller should
    bail.  This error causes at least a WARN_ON().
    
    Link: https://lkml.kernel.org/r/[email protected]
    Reported-by: [email protected]
    Closes: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Lizhi Xu <[email protected]>
    Reviewed-by: Phillip Lougher <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sunrpc: don't change ->sv_stats if it doesn't exist [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:35:55 2024 -0400

    sunrpc: don't change ->sv_stats if it doesn't exist
    
    [ Upstream commit ab42f4d9a26f1723dcfd6c93fcf768032b2bb5e7 ]
    
    We check for the existence of ->sv_stats elsewhere except in the core
    processing code.  It appears that only nfsd actual exports these values
    anywhere, everybody else just has a write only copy of sv_stats in their
    svc_program.  Add a check for ->sv_stats before every adjustment to
    allow us to eliminate the stats struct from all the users who don't
    report the stats.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sunrpc: pass in the sv_stats struct through svc_create_pooled [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:35:57 2024 -0400

    sunrpc: pass in the sv_stats struct through svc_create_pooled
    
    [ Upstream commit f094323867668d50124886ad884b665de7319537 ]
    
    Since only one service actually reports the rpc stats there's not much
    of a reason to have a pointer to it in the svc_program struct.  Adjust
    the svc_create_pooled function to take the sv_stats as an argument and
    pass the struct through there as desired instead of getting it from the
    svc_program->pg_stats.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    [ cel: adjusted to apply to v6.6.y ]
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sunrpc: remove ->pg_stats from svc_program [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:35:58 2024 -0400

    sunrpc: remove ->pg_stats from svc_program
    
    [ Upstream commit 3f6ef182f144dcc9a4d942f97b6a8ed969f13c95 ]
    
    Now that this isn't used anywhere, remove it.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sunrpc: use the struct net as the svc proc private [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Mon Aug 12 18:35:59 2024 -0400

    sunrpc: use the struct net as the svc proc private
    
    [ Upstream commit 418b9687dece5bd763c09b5c27a801a7e3387be9 ]
    
    nfsd is the only thing using this helper, and it doesn't use the private
    currently.  When we switch to per-network namespace stats we will need
    the struct net * in order to get to the nfsd_net.  Use the net as the
    proc private so we can utilize this when we make the switch over.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tcp_metrics: optimize tcp_metrics_flush_all() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Sep 22 22:03:56 2023 +0000

    tcp_metrics: optimize tcp_metrics_flush_all()
    
    [ Upstream commit 6532e257aa73645e28dee5b2232cc3c88be62083 ]
    
    This is inspired by several syzbot reports where
    tcp_metrics_flush_all() was seen in the traces.
    
    We can avoid acquiring tcp_metrics_lock for empty buckets,
    and we should add one cond_resched() to break potential long loops.
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Acked-by: Neal Cardwell <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
wifi: cfg80211: restrict NL80211_ATTR_TXQ_QUANTUM values [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Sat Jun 15 16:08:00 2024 +0000

    wifi: cfg80211: restrict NL80211_ATTR_TXQ_QUANTUM values
    
    [ Upstream commit d1cba2ea8121e7fdbe1328cea782876b1dd80993 ]
    
    syzbot is able to trigger softlockups, setting NL80211_ATTR_TXQ_QUANTUM
    to 2^31.
    
    We had a similar issue in sch_fq, fixed with commit
    d9e15a273306 ("pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM")
    
    watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [kworker/1:0:24]
    Modules linked in:
    irq event stamp: 131135
     hardirqs last  enabled at (131134): [<ffff80008ae8778c>] __exit_to_kernel_mode arch/arm64/kernel/entry-common.c:85 [inline]
     hardirqs last  enabled at (131134): [<ffff80008ae8778c>] exit_to_kernel_mode+0xdc/0x10c arch/arm64/kernel/entry-common.c:95
     hardirqs last disabled at (131135): [<ffff80008ae85378>] __el1_irq arch/arm64/kernel/entry-common.c:533 [inline]
     hardirqs last disabled at (131135): [<ffff80008ae85378>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:551
     softirqs last  enabled at (125892): [<ffff80008907e82c>] neigh_hh_init net/core/neighbour.c:1538 [inline]
     softirqs last  enabled at (125892): [<ffff80008907e82c>] neigh_resolve_output+0x268/0x658 net/core/neighbour.c:1553
     softirqs last disabled at (125896): [<ffff80008904166c>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
    CPU: 1 PID: 24 Comm: kworker/1:0 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
    Workqueue: mld mld_ifc_work
    pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
     pc : __list_del include/linux/list.h:195 [inline]
     pc : __list_del_entry include/linux/list.h:218 [inline]
     pc : list_move_tail include/linux/list.h:310 [inline]
     pc : fq_tin_dequeue include/net/fq_impl.h:112 [inline]
     pc : ieee80211_tx_dequeue+0x6b8/0x3b4c net/mac80211/tx.c:3854
     lr : __list_del_entry include/linux/list.h:218 [inline]
     lr : list_move_tail include/linux/list.h:310 [inline]
     lr : fq_tin_dequeue include/net/fq_impl.h:112 [inline]
     lr : ieee80211_tx_dequeue+0x67c/0x3b4c net/mac80211/tx.c:3854
    sp : ffff800093d36700
    x29: ffff800093d36a60 x28: ffff800093d36960 x27: dfff800000000000
    x26: ffff0000d800ad50 x25: ffff0000d800abe0 x24: ffff0000d800abf0
    x23: ffff0000e0032468 x22: ffff0000e00324d4 x21: ffff0000d800abf0
    x20: ffff0000d800abf8 x19: ffff0000d800abf0 x18: ffff800093d363c0
    x17: 000000000000d476 x16: ffff8000805519dc x15: ffff7000127a6cc8
    x14: 1ffff000127a6cc8 x13: 0000000000000004 x12: ffffffffffffffff
    x11: ffff7000127a6cc8 x10: 0000000000ff0100 x9 : 0000000000000000
    x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
    x5 : ffff80009287aa08 x4 : 0000000000000008 x3 : ffff80008034c7fc
    x2 : ffff0000e0032468 x1 : 00000000da0e46b8 x0 : ffff0000e0032470
    Call trace:
      __list_del include/linux/list.h:195 [inline]
      __list_del_entry include/linux/list.h:218 [inline]
      list_move_tail include/linux/list.h:310 [inline]
      fq_tin_dequeue include/net/fq_impl.h:112 [inline]
      ieee80211_tx_dequeue+0x6b8/0x3b4c net/mac80211/tx.c:3854
      wake_tx_push_queue net/mac80211/util.c:294 [inline]
      ieee80211_handle_wake_tx_queue+0x118/0x274 net/mac80211/util.c:315
      drv_wake_tx_queue net/mac80211/driver-ops.h:1350 [inline]
      schedule_and_wake_txq net/mac80211/driver-ops.h:1357 [inline]
      ieee80211_queue_skb+0x18e8/0x2244 net/mac80211/tx.c:1664
      ieee80211_tx+0x260/0x400 net/mac80211/tx.c:1966
      ieee80211_xmit+0x278/0x354 net/mac80211/tx.c:2062
      __ieee80211_subif_start_xmit+0xab8/0x122c net/mac80211/tx.c:4338
      ieee80211_subif_start_xmit+0xe0/0x438 net/mac80211/tx.c:4532
      __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+0x27c/0x938 net/core/dev.c:3547
      __dev_queue_xmit+0x1678/0x33fc net/core/dev.c:4341
      dev_queue_xmit include/linux/netdevice.h:3091 [inline]
      neigh_resolve_output+0x558/0x658 net/core/neighbour.c:1563
      neigh_output include/net/neighbour.h:542 [inline]
      ip6_finish_output2+0x104c/0x1ee8 net/ipv6/ip6_output.c:137
      ip6_finish_output+0x428/0x7a0 net/ipv6/ip6_output.c:222
      NF_HOOK_COND include/linux/netfilter.h:303 [inline]
      ip6_output+0x270/0x594 net/ipv6/ip6_output.c:243
      dst_output include/net/dst.h:450 [inline]
      NF_HOOK+0x160/0x4f0 include/linux/netfilter.h:314
      mld_sendpack+0x7b4/0x10f4 net/ipv6/mcast.c:1818
      mld_send_cr net/ipv6/mcast.c:2119 [inline]
      mld_ifc_work+0x840/0xd0c net/ipv6/mcast.c:2650
      process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3267
      process_scheduled_works kernel/workqueue.c:3348 [inline]
      worker_thread+0x938/0xef4 kernel/workqueue.c:3429
      kthread+0x288/0x310 kernel/kthread.c:388
      ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
    
    Fixes: 52539ca89f36 ("cfg80211: Expose TXQ stats and parameters to userspace")
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: mac80211: fix change_address deadlock during unregister [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Thu Oct 12 12:34:47 2023 +0200

    wifi: mac80211: fix change_address deadlock during unregister
    
    [ Upstream commit 74a7c93f45abba538914a65dd2ef2ea7cf7150e2 ]
    
    When using e.g. bonding, and doing a sequence such as
    
     # iw wlan0 set type __ap
     # ip link add name bond1 type bond
     # ip link set wlan0 master bond1
     # iw wlan0 interface del
    
    we deadlock, since the wlan0 interface removal will cause
    bonding to reset the MAC address of wlan0.
    
    The locking would be somewhat difficult to fix, but since
    this only happens during removal, we can simply ignore the
    MAC address change at this time.
    
    Reported-by: [email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Link: https://lore.kernel.org/r/20231012123447.9f9d7fd1f237.Ic3a5ef4391b670941a69cec5592aefc79d9c2890@changeid
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211: take wiphy lock for MAC addr change [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Mon Aug 28 14:00:00 2023 +0200

    wifi: mac80211: take wiphy lock for MAC addr change
    
    [ Upstream commit a26787aa13974fb0b3fb42bfeb4256c1b686e305 ]
    
    We want to ensure everything holds the wiphy lock,
    so also extend that to the MAC change callback.
    
    Signed-off-by: Johannes Berg <[email protected]>
    Stable-dep-of: 74a7c93f45ab ("wifi: mac80211: fix change_address deadlock during unregister")
    Signed-off-by: Sasha Levin <[email protected]>