Changelog in Linux kernel 6.10.6

 
ALSA: usb: Fix UBSAN warning in parse_audio_unit() [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
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: syzbot+78d5b129a762182225aa@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/0000000000000adac5061d3c7355@google.com
    Link: https://patch.msgid.link/20240715123619.26612-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: cs35l56: Patch CS35L56_IRQ1_MASK_18 to the default value [+ + +]
Author: Simon Trimmer <simont@opensource.cirrus.com>
Date:   Wed Aug 7 14:26:48 2024 +0000

    ASoC: cs35l56: Patch CS35L56_IRQ1_MASK_18 to the default value
    
    commit 72776774b55bb59b7b1b09117e915a5030110304 upstream.
    
    Device tuning files made with early revision tooling may contain
    configuration that can unmask IRQ signals that are owned by the host.
    
    Adding a safe default to the regmap patch ensures that the hardware
    matches the driver expectations.
    
    Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
    Link: https://patch.msgid.link/20240807142648.46932-1-simont@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
binfmt_flat: Fix corruption when not offsetting data start [+ + +]
Author: Kees Cook <kees@kernel.org>
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 <sorear@fastmail.com>
    Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Acked-by: Greg Ungerer <gerg@linux-m68k.org>
    Link: https://lore.kernel.org/r/20240807195119.it.782-kees@kernel.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf, net: Use DEV_STAT_INC() [+ + +]
Author: yunshui <jiangyunshui@kylinos.cn>
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 <syzkaller@googlegroups.com>
    Signed-off-by: yunshui <jiangyunshui@kylinos.cn>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20240523033520.4029314-1-jiangyunshui@kylinos.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Defer handling mst up request in resume [+ + +]
Author: Wayne Lin <wayne.lin@amd.com>
Date:   Mon Apr 15 14:04:00 2024 +0800

    drm/amd/display: Defer handling mst up request in resume
    
    commit 202dc359addab29451d3d18243c3d957da5392c8 upstream.
    
    [Why]
    Like commit ec5fa9fcdeca ("drm/amd/display: Adjust the MST resume flow"), we
    want to avoid handling mst topology changes before restoring the old state.
    If we enable DP_UP_REQ_EN before calling drm_atomic_helper_resume(), have
    changce to handle CSN event first and fire hotplug event before restoring the
    cached state.
    
    [How]
    Disable mst branch sending up request event before we restoring the cached state.
    DP_UP_REQ_EN will be set later when we call drm_dp_mst_topology_mgr_resume().
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
    Signed-off-by: Wayne Lin <wayne.lin@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Prevent IPX From Link Detect and Set Mode [+ + +]
Author: Fangzhi Zuo <jerry.zuo@amd.com>
Date:   Fri May 10 15:23:02 2024 -0400

    drm/amd/display: Prevent IPX From Link Detect and Set Mode
    
    commit 1ff6631baeb1f5d69be192732d0157a06b43f20a upstream.
    
    IPX involvment proven to affect LT, causing link loss. Need to prevent
    IPX enabled in LT process in which link detect and set mode are main
    procedures that have LT taken place.
    
    Reviewed-by: Roman Li <roman.li@amd.com>
    Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: Kevin Holm <kevin@holm.dev>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Separate setting and programming of cursor [+ + +]
Author: Harry Wentland <harry.wentland@amd.com>
Date:   Fri Mar 15 11:19:15 2024 -0400

    drm/amd/display: Separate setting and programming of cursor
    
    commit f63f86b5affcc2abd1162f11824b9386fc06ac94 upstream.
    
    We're seeing issues when user-space tries to do an atomic update of
    the primary surface, as well as the cursor. These two updates are
    separate calls into DC and don't currently act as an atomic update.
    This might lead to cursor updates being locked out and cursors
    stuttering.
    
    In order to solve this problem we want to separate the setting
    and programming of cursor attributes and position. That's what
    we're doing in this patch. The subsequent patch will then be
    able to use the cursor setters in independent cursor updates,
    as well as in atomic commits.
    
    Reviewed-by: Agustin Gutierrez <agustin.gutierrez@amd.com>
    Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Harry Wentland <harry.wentland@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: Kevin Holm <kevin@holm.dev>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Solve mst monitors blank out problem after resume [+ + +]
Author: Wayne Lin <Wayne.Lin@amd.com>
Date:   Thu May 23 12:18:07 2024 +0800

    drm/amd/display: Solve mst monitors blank out problem after resume
    
    commit e33697141bac18906345ea46533a240f1ad3cd21 upstream.
    
    [Why]
    In dm resume, we firstly restore dc state and do the mst resume for topology
    probing thereafter. If we change dpcd DP_MSTM_CTRL value after LT in mst reume,
    it will cause light up problem on the hub.
    
    [How]
    Revert commit 202dc359adda ("drm/amd/display: Defer handling mst up request in resume").
    And adjust the reason to trigger dc_link_detect by DETECT_REASON_RESUMEFROMS3S4.
    
    Cc: stable@vger.kernel.org
    Fixes: 202dc359adda ("drm/amd/display: Defer handling mst up request in resume")
    Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
    Reviewed-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdgpu/display: Fix null pointer dereference in dc_stream_program_cursor_position [+ + +]
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Date:   Wed May 22 20:54:50 2024 +0530

    drm/amdgpu/display: Fix null pointer dereference in dc_stream_program_cursor_position
    
    commit fa4c500ce93f4f933c38e6d6388970e121e27b21 upstream.
    
    The fix involves adding a null check for 'stream' at the beginning of
    the function. If 'stream' is NULL, the function immediately returns
    false. This ensures that 'stream' is not NULL when we dereference it to
    access 'ctx' in 'dc = stream->ctx->dc;' the function.
    
    Fixes the below:
            drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:398 dc_stream_program_cursor_position()
            error: we previously assumed 'stream' could be null (see line 397)
    
    drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c
        389 bool dc_stream_program_cursor_position(
        390         struct dc_stream_state *stream,
        391         const struct dc_cursor_position *position)
        392 {
        393         struct dc *dc;
        394         bool reset_idle_optimizations = false;
        395         const struct dc_cursor_position *old_position;
        396
        397         old_position = stream ? &stream->cursor_position : NULL;
                                   ^^^^^^^^
    The patch adds a NULL check
    
    --> 398         dc = stream->ctx->dc;
                         ^^^^^^^^
    The old code didn't check
    
        399
        400         if (dc_stream_set_cursor_position(stream, position)) {
        401                 dc_z10_restore(dc);
        402
        403                 /* disable idle optimizations if enabling cursor */
        404                 if (dc->idle_optimizations_allowed &&
        405                     (!old_position->enable || dc->debug.exit_idle_opt_for_cursor_updates) &&
        406                     position->enable) {
        407                         dc_allow_idle_optimizations(dc, false);
    
    Fixes: f63f86b5affc ("drm/amd/display: Separate setting and programming of cursor")
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Cc: Tom Chung <chiahsuan.chung@amd.com>
    Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Cc: Roman Li <roman.li@amd.com>
    Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
exec: Fix ToCToU between perm check and set-uid/gid usage [+ + +]
Author: Kees Cook <kees@kernel.org>
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 <mvanotti@google.com>
    Tested-by: Marco Vanotti <mvanotti@google.com>
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
f2fs: fix to cover read extent cache access with lock [+ + +]
Author: Chao Yu <chao@kernel.org>
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: syzbot+74ebe2104433e9dc610d@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-f2fs-devel/00000000000009beea061740a531@google.com
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

f2fs: fix to do sanity check on F2FS_INLINE_DATA flag in inode during GC [+ + +]
Author: Chao Yu <chao@kernel.org>
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: syzbot+848062ba19c8782ca5c8@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-f2fs-devel/000000000000d103ce06174d7ec3@google.com
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fou: remove warn in gue_gro_receive on unsupported protocol [+ + +]
Author: Willem de Bruijn <willemb@google.com>
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 <willemb@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20240614122552.1649044-1-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs/ntfs3: Do copy_to_user out of run_lock [+ + +]
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
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: syzbot+36bb70085ef6edc2ebb9@syzkaller.appspotmail.com
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
jfs: fix null ptr deref in dtInsertEntry [+ + +]
Author: Edward Adam Davis <eadavis@qq.com>
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: syzbot+bba84aef3a26fb93deb9@syzkaller.appspotmail.com
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: Fix shift-out-of-bounds in dbDiscardAG [+ + +]
Author: Pei Li <peili.dev@gmail.com>
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: syzbot+61be3359d2ee3467e7e4@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=61be3359d2ee3467e7e4
    Signed-off-by: Pei Li <peili.dev@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 6.10.6 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Aug 19 06:05:40 2024 +0200

    Linux 6.10.6
    
    Link: https://lore.kernel.org/r/20240815131831.265729493@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-By: Kevin Holm <kevin@holm.dev>
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>                              =
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Christian Heusel <christian@heusel.eu>
    Link: https://lore.kernel.org/r/20240816085226.888902473@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Allen Pais <apais@linux.microsoft.com>
    Link: https://lore.kernel.org/r/20240817085406.129098889@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h [+ + +]
Author: Huacai Chen <chenhuacai@kernel.org>
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/20220511211231.GG7074@brightrain.aerifal.cx/
    [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: stable@vger.kernel.org
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()" [+ + +]
Author: Sean Young <sean@mess.org>
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 <s.l-h@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvme/pci: Add APST quirk for Lenovo N60z laptop [+ + +]
Author: WangYuli <wangyuli@uniontech.com>
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 <huanglin@uniontech.com>
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled [+ + +]
Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Date:   Tue Jul 30 19:53:16 2024 +0530

    platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled
    
    [ Upstream commit 78296429e20052b029211b0aca64aadc5052d581 ]
    
    If the Ambient Light Sensor (ALS) is disabled, the current code in the PMF
    driver does not query for Human Presence Detection (HPD) data in
    amd_pmf_get_sensor_info(). As a result, stale HPD data is used by PMF-TA
    to evaluate policy conditions, leading to unexpected behavior in the policy
    output actions.
    
    To resolve this issue, modify the PMF driver to query HPD data
    independently of ALS.
    
    Since user_present is a boolean, modify the current code to return true if
    the user is present and false if the user is away or if the sensor is not
    detected, and report this status to the PMF TA firmware accordingly.
    
    With this change, amd_pmf_get_sensor_info() now returns void instead of
    int.
    
    Fixes: cedecdba60f4 ("platform/x86/amd/pmf: Get ambient light information from AMD SFH driver")
    Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
    Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
    Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    Link: https://lore.kernel.org/r/20240730142316.3846259-1-Shyam-sundar.S-k@amd.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands [+ + +]
Author: Gergo Koteles <soyer@irl.hu>
Date:   Thu Jul 25 11:21:10 2024 +0200

    platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands
    
    [ Upstream commit 7cc06e729460a209b84d3db4db56c9f85f048cc2 ]
    
    Calling VPC commands consists of several VPCW and VPCR ACPI calls.
    These calls and their results can get mixed up if they are called
    simultaneously from different threads, like acpi notify handler,
    sysfs, debugfs, notification chain.
    
    The commit e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on
    all CPUs") made the race issues much worse than before it but some
    races were possible even before that commit.
    
    Add a mutex to synchronize VPC commands.
    
    Fixes: e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on all CPUs")
    Fixes: e82882cdd241 ("platform/x86: Add driver for Yoga Tablet Mode switch")
    Signed-off-by: Gergo Koteles <soyer@irl.hu>
    Link: https://lore.kernel.org/r/f26782fa1194ad11ed5d9ba121a804e59b58b026.1721898747.git.soyer@irl.hu
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: ideapad-laptop: introduce a generic notification chain [+ + +]
Author: Gergo Koteles <soyer@irl.hu>
Date:   Thu Jul 25 11:21:07 2024 +0200

    platform/x86: ideapad-laptop: introduce a generic notification chain
    
    [ Upstream commit 613e3900c24bb1379d994f44d75d31c3223cc263 ]
    
    There are several cases where a notification chain can simplify Lenovo
    WMI drivers.
    
    Add a generic notification chain into ideapad-laptop.
    
    Signed-off-by: Gergo Koteles <soyer@irl.hu>
    Link: https://lore.kernel.org/r/c5a43efae8a32bd034c3d19c0a686941347575a7.1721898747.git.soyer@irl.hu
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Stable-dep-of: 7cc06e729460 ("platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: ideapad-laptop: move ymc_trigger_ec from lenovo-ymc [+ + +]
Author: Gergo Koteles <soyer@irl.hu>
Date:   Thu Jul 25 11:21:08 2024 +0200

    platform/x86: ideapad-laptop: move ymc_trigger_ec from lenovo-ymc
    
    [ Upstream commit cde7886b35176d56e72bfc68dc104fa08e7b072c ]
    
    Some models need to trigger the EC after each YMC event for the yoga
    mode control to work properly. EC triggering consist of a VPC call from
    the lenovo-ymc module. Except for this, all VPC calls are in the
    ideapad-laptop module.
    
    Since ideapad-laptop has a notification chain, a new YMC_EVENT action
    can be added and triggered from the lenovo-ymc module. Then the
    ideapad-laptop can trigger the EC.
    
    If the triggering is in the ideapad-laptop module, then the ec_trigger
    module parameter should be there as well.
    
    Move the ymc_trigger_ec functionality and the ec_trigger module
    parameter to the ideapad-laptop module.
    
    Signed-off-by: Gergo Koteles <soyer@irl.hu>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/d980ab3ac32b5e554f456b0ff17279bfdbe2a203.1721898747.git.soyer@irl.hu
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Stable-dep-of: 7cc06e729460 ("platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error" [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
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: stable@vger.kernel.org # 4.19+
    Reported-by: Stephan Eisvogel <eisvogel@seitics.de>
    Reported-by: Christian Heusel <christian@heusel.eu>
    Closes: https://lore.kernel.org/linux-ide/0bf3f2f0-0fc6-4ba5-a420-c0874ef82d64@heusel.eu/
    Fixes: 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error")
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Link: https://lore.kernel.org/r/20240813131900.1285842-2-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "drm/amd/display: Refactor function dm_dp_mst_is_port_support_mode()" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Aug 17 10:39:50 2024 +0200

    Revert "drm/amd/display: Refactor function dm_dp_mst_is_port_support_mode()"
    
    This reverts commit 6b2fb172853261829229237766d078638267042f which is
    commit fa57924c76d995e87ca3533ec60d1d5e55769a27 upstream.
    
    It breaks the build on arm64 and arm systems, and trying to unwind the
    ifdef mess to fix it up was not simple at all.  So revert it and wait
    for a fixed change to come back.
    
    Cc: Jerry Zuo <jerry.zuo@amd.com>
    Cc: Zaeem Mohamed <zaeem.mohamed@amd.com>
    Cc: Wayne Lin <wayne.lin@amd.com>
    Cc: Daniel Wheeler <daniel.wheeler@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Kevin Holm <kevin@holm.dev>
    Reported-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/b27c5434-f1b1-4697-985b-91bb3e9a22df@roeck-us.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>