óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 4.19.295

 
9p: virtio: make sure 'offs' is initialized in zc_request [+ + +]
Author: Dominique Martinet <[email protected]>
Date:   Wed May 3 16:49:27 2023 +0900

    9p: virtio: make sure 'offs' is initialized in zc_request
    
    [ Upstream commit 4a73edab69d3a6623f03817fe950a2d9585f80e4 ]
    
    Similarly to the previous patch: offs can be used in handle_rerrors
    without initializing on small payloads; in this case handle_rerrors will
    not use it because of the size check, but it doesn't hurt to make sure
    it is zero to please scan-build.
    
    This fixes the following warning:
    net/9p/trans_virtio.c:539:3: warning: 3rd function call argument is an uninitialized value [core.CallAndMessage]
                    handle_rerror(req, in_hdr_len, offs, in_pages);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Dominique Martinet <[email protected]>
    Signed-off-by: Eric Van Hensbergen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470 [+ + +]
Author: Jiri Slaby (SUSE) <[email protected]>
Date:   Tue Apr 18 08:42:00 2023 +0200

    ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470
    
    [ Upstream commit 96b709be183c56293933ef45b8b75f8af268c6de ]
    
    The Lenovo Ideapad Z470 predates Windows 8, so it defaults to using
    acpi_video for backlight control. But this is not functional on this
    model.
    
    Add a DMI quirk to use the native backlight interface which works.
    
    Link: https://bugzilla.suse.com/show_bug.cgi?id=1208724
    Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
    Reviewed-by: Hans de Goede <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer [+ + +]
Author: Abhishek Mainkar <[email protected]>
Date:   Mon Jun 26 22:26:06 2023 +0000

    ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer
    
    [ Upstream commit 3a21ffdbc825e0919db9da0e27ee5ff2cc8a863e ]
    
    ACPICA commit 90310989a0790032f5a0140741ff09b545af4bc5
    
    According to the ACPI specification 19.6.134, no argument is required to be passed for ASL Timer instruction. For taking care of no argument, AML_NO_OPERAND_RESOLVE flag is added to ASL Timer instruction opcode.
    
    When ASL timer instruction interpreted by ACPI interpreter, getting error. After adding AML_NO_OPERAND_RESOLVE flag to ASL Timer instruction opcode, issue is not observed.
    
    =============================================================
    UBSAN: array-index-out-of-bounds in acpica/dswexec.c:401:12 index -1 is out of range for type 'union acpi_operand_object *[9]'
    CPU: 37 PID: 1678 Comm: cat Not tainted
    6.0.0-dev-th500-6.0.y-1+bcf8c46459e407-generic-64k
    HW name: NVIDIA BIOS v1.1.1-d7acbfc-dirty 12/19/2022 Call trace:
     dump_backtrace+0xe0/0x130
     show_stack+0x20/0x60
     dump_stack_lvl+0x68/0x84
     dump_stack+0x18/0x34
     ubsan_epilogue+0x10/0x50
     __ubsan_handle_out_of_bounds+0x80/0x90
     acpi_ds_exec_end_op+0x1bc/0x6d8
     acpi_ps_parse_loop+0x57c/0x618
     acpi_ps_parse_aml+0x1e0/0x4b4
     acpi_ps_execute_method+0x24c/0x2b8
     acpi_ns_evaluate+0x3a8/0x4bc
     acpi_evaluate_object+0x15c/0x37c
     acpi_evaluate_integer+0x54/0x15c
     show_power+0x8c/0x12c [acpi_power_meter]
    
    Link: https://github.com/acpica/acpica/commit/90310989
    Signed-off-by: Abhishek Mainkar <[email protected]>
    Signed-off-by: Bob Moore <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
af_unix: Fix data race around sk->sk_err. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Fri Sep 1 17:27:08 2023 -0700

    af_unix: Fix data race around sk->sk_err.
    
    [ Upstream commit b192812905e4b134f7b7994b079eb647e9d2d37e ]
    
    As with sk->sk_shutdown shown in the previous patch, sk->sk_err can be
    read locklessly by unix_dgram_sendmsg().
    
    Let's use READ_ONCE() for sk_err as well.
    
    Note that the writer side is marked by commit cc04410af7de ("af_unix:
    annotate lockless accesses to sk->sk_err").
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

af_unix: Fix data-race around unix_tot_inflight. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Fri Sep 1 17:27:06 2023 -0700

    af_unix: Fix data-race around unix_tot_inflight.
    
    [ Upstream commit ade32bd8a738d7497ffe9743c46728db26740f78 ]
    
    unix_tot_inflight is changed under spin_lock(unix_gc_lock), but
    unix_release_sock() reads it locklessly.
    
    Let's use READ_ONCE() for unix_tot_inflight.
    
    Note that the writer side was marked by commit 9d6d7f1cb67c ("af_unix:
    annote lockless accesses to unix_tot_inflight & gc_in_progress")
    
    BUG: KCSAN: data-race in unix_inflight / unix_release_sock
    
    write (marked) to 0xffffffff871852b8 of 4 bytes by task 123 on cpu 1:
     unix_inflight+0x130/0x180 net/unix/scm.c:64
     unix_attach_fds+0x137/0x1b0 net/unix/scm.c:123
     unix_scm_to_skb net/unix/af_unix.c:1832 [inline]
     unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1955
     sock_sendmsg_nosec net/socket.c:724 [inline]
     sock_sendmsg+0x148/0x160 net/socket.c:747
     ____sys_sendmsg+0x4e4/0x610 net/socket.c:2493
     ___sys_sendmsg+0xc6/0x140 net/socket.c:2547
     __sys_sendmsg+0x94/0x140 net/socket.c:2576
     __do_sys_sendmsg net/socket.c:2585 [inline]
     __se_sys_sendmsg net/socket.c:2583 [inline]
     __x64_sys_sendmsg+0x45/0x50 net/socket.c:2583
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    read to 0xffffffff871852b8 of 4 bytes by task 4891 on cpu 0:
     unix_release_sock+0x608/0x910 net/unix/af_unix.c:671
     unix_release+0x59/0x80 net/unix/af_unix.c:1058
     __sock_release+0x7d/0x170 net/socket.c:653
     sock_close+0x19/0x30 net/socket.c:1385
     __fput+0x179/0x5e0 fs/file_table.c:321
     ____fput+0x15/0x20 fs/file_table.c:349
     task_work_run+0x116/0x1a0 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
     exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204
     __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
     syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297
     do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    value changed: 0x00000000 -> 0x00000001
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 4891 Comm: systemd-coredum Not tainted 6.4.0-rc5-01219-gfa0e21fa4443 #5
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 9305cfa4443d ("[AF_UNIX]: Make unix_tot_inflight counter non-atomic")
    Reported-by: syzkaller <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

af_unix: Fix data-races around sk->sk_shutdown. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Fri Sep 1 17:27:07 2023 -0700

    af_unix: Fix data-races around sk->sk_shutdown.
    
    [ Upstream commit afe8764f76346ba838d4f162883e23d2fcfaa90e ]
    
    sk->sk_shutdown is changed under unix_state_lock(sk), but
    unix_dgram_sendmsg() calls two functions to read sk_shutdown locklessly.
    
      sock_alloc_send_pskb
      `- sock_wait_for_wmem
    
    Let's use READ_ONCE() there.
    
    Note that the writer side was marked by commit e1d09c2c2f57 ("af_unix:
    Fix data races around sk->sk_shutdown.").
    
    BUG: KCSAN: data-race in sock_alloc_send_pskb / unix_release_sock
    
    write (marked) to 0xffff8880069af12c of 1 bytes by task 1 on cpu 1:
     unix_release_sock+0x75c/0x910 net/unix/af_unix.c:631
     unix_release+0x59/0x80 net/unix/af_unix.c:1053
     __sock_release+0x7d/0x170 net/socket.c:654
     sock_close+0x19/0x30 net/socket.c:1386
     __fput+0x2a3/0x680 fs/file_table.c:384
     ____fput+0x15/0x20 fs/file_table.c:412
     task_work_run+0x116/0x1a0 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
     exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204
     __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
     syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297
     do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
    read to 0xffff8880069af12c of 1 bytes by task 28650 on cpu 0:
     sock_alloc_send_pskb+0xd2/0x620 net/core/sock.c:2767
     unix_dgram_sendmsg+0x2f8/0x14f0 net/unix/af_unix.c:1944
     unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
     unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
     sock_sendmsg_nosec net/socket.c:725 [inline]
     sock_sendmsg+0x148/0x160 net/socket.c:748
     ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
     ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
     __sys_sendmsg+0x94/0x140 net/socket.c:2577
     __do_sys_sendmsg net/socket.c:2586 [inline]
     __se_sys_sendmsg net/socket.c:2584 [inline]
     __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
    value changed: 0x00 -> 0x03
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 28650 Comm: systemd-coredum Not tainted 6.4.0-11989-g6843306689af #6
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzkaller <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

af_unix: Fix data-races around user->unix_inflight. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Fri Sep 1 17:27:05 2023 -0700

    af_unix: Fix data-races around user->unix_inflight.
    
    [ Upstream commit 0bc36c0650b21df36fbec8136add83936eaf0607 ]
    
    user->unix_inflight is changed under spin_lock(unix_gc_lock),
    but too_many_unix_fds() reads it locklessly.
    
    Let's annotate the write/read accesses to user->unix_inflight.
    
    BUG: KCSAN: data-race in unix_attach_fds / unix_inflight
    
    write to 0xffffffff8546f2d0 of 8 bytes by task 44798 on cpu 1:
     unix_inflight+0x157/0x180 net/unix/scm.c:66
     unix_attach_fds+0x147/0x1e0 net/unix/scm.c:123
     unix_scm_to_skb net/unix/af_unix.c:1827 [inline]
     unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1950
     unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
     unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
     sock_sendmsg_nosec net/socket.c:725 [inline]
     sock_sendmsg+0x148/0x160 net/socket.c:748
     ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
     ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
     __sys_sendmsg+0x94/0x140 net/socket.c:2577
     __do_sys_sendmsg net/socket.c:2586 [inline]
     __se_sys_sendmsg net/socket.c:2584 [inline]
     __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
    read to 0xffffffff8546f2d0 of 8 bytes by task 44814 on cpu 0:
     too_many_unix_fds net/unix/scm.c:101 [inline]
     unix_attach_fds+0x54/0x1e0 net/unix/scm.c:110
     unix_scm_to_skb net/unix/af_unix.c:1827 [inline]
     unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1950
     unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
     unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
     sock_sendmsg_nosec net/socket.c:725 [inline]
     sock_sendmsg+0x148/0x160 net/socket.c:748
     ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
     ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
     __sys_sendmsg+0x94/0x140 net/socket.c:2577
     __do_sys_sendmsg net/socket.c:2586 [inline]
     __se_sys_sendmsg net/socket.c:2584 [inline]
     __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
    value changed: 0x000000000000000c -> 0x000000000000000d
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 44814 Comm: systemd-coredum Not tainted 6.4.0-11989-g6843306689af #6
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 712f4aad406b ("unix: properly account for FDs passed over unix sockets")
    Reported-by: syzkaller <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Acked-by: Willy Tarreau <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ALSA: ac97: Fix possible error value of *rac97 [+ + +]
Author: Su Hui <[email protected]>
Date:   Wed Aug 23 10:52:13 2023 +0800

    ALSA: ac97: Fix possible error value of *rac97
    
    [ Upstream commit 67de40c9df94037769967ba28c7d951afb45b7fb ]
    
    Before committing 79597c8bf64c, *rac97 always be NULL if there is
    an error. When error happens, make sure *rac97 is NULL is safer.
    
    For examble, in snd_vortex_mixer():
            err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
            vortex->isquad = ((vortex->codec == NULL) ?
                    0 : (vortex->codec->ext_id&0x80));
    If error happened but vortex->codec isn't NULL, this may cause some
    problems.
    
    Move the judgement order to be clearer and better.
    
    Fixes: 79597c8bf64c ("ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer")
    Suggested-by: Christophe JAILLET <[email protected]>
    Acked-by: Christophe JAILLET <[email protected]>
    Signed-off-by: Su Hui <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Tue Aug 29 15:43:44 2023 +0200

    ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
    
    commit 358040e3807754944dbddf948a23c6d914297ed7 upstream.
    
    The update of rate_num/den and msbits were factored out to
    fixup_unreferenced_params() function to be called explicitly after the
    hw_refine or hw_params procedure.  It's called from
    snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl.
    This ended up with the incomplete rate_num/den and msbits parameters
    when 32bit compat ioctl is used.
    
    This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
    
    Reported-by: [email protected]
    Fixes: f9a076bff053 ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
    Reviewed-by: Takashi Sakamoto <[email protected]>
    Reviewed-by: Jaroslav Kysela <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: seq: oss: Fix racy open/close of MIDI devices [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Mon Jun 12 14:55:33 2023 +0200

    ALSA: seq: oss: Fix racy open/close of MIDI devices
    
    [ Upstream commit 297224fc0922e7385573a30c29ffdabb67f27b7d ]
    
    Although snd_seq_oss_midi_open() and snd_seq_oss_midi_close() can be
    called concurrently from different code paths, we have no proper data
    protection against races.  Introduce open_mutex to each seq_oss_midi
    object for avoiding the races.
    
    Reported-by: "Gong, Sishuai" <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
alx: fix OOB-read compiler warning [+ + +]
Author: GONG, Ruiqi <[email protected]>
Date:   Mon Aug 21 09:32:18 2023 +0800

    alx: fix OOB-read compiler warning
    
    [ Upstream commit 3a198c95c95da10ad844cbeade2fe40bdf14c411 ]
    
    The following message shows up when compiling with W=1:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘alx_get_ethtool_stats’ at drivers/net/ethernet/atheros/alx/ethtool.c:297:2:
    ./include/linux/fortify-string.h:592:4: error: call to ‘__read_overflow2_field’
    declared with attribute warning: detected read beyond size of field (2nd parameter);
    maybe use struct_group()? [-Werror=attribute-warning]
      592 |    __read_overflow2_field(q_size_field, size);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In order to get alx stats altogether, alx_get_ethtool_stats() reads
    beyond hw->stats.rx_ok. Fix this warning by directly copying hw->stats,
    and refactor the unnecessarily complicated BUILD_BUG_ON btw.
    
    Signed-off-by: GONG, Ruiqi <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
amba: bus: fix refcount leak [+ + +]
Author: Peng Fan <[email protected]>
Date:   Mon Aug 21 10:39:27 2023 +0800

    amba: bus: fix refcount leak
    
    [ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]
    
    commit 5de1540b7bc4 ("drivers/amba: create devices from device tree")
    increases the refcount of of_node, but not releases it in
    amba_device_release, so there is refcount leak. By using of_node_put
    to avoid refcount leak.
    
    Fixes: 5de1540b7bc4 ("drivers/amba: create devices from device tree")
    Signed-off-by: Peng Fan <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
arch: um: drivers: Kconfig: pedantic formatting [+ + +]
Author: Enrico Weigelt, metux IT consult <[email protected]>
Date:   Thu Mar 7 23:22:37 2019 +0100

    arch: um: drivers: Kconfig: pedantic formatting
    
    [ Upstream commit 75f24f78721048a271e2e50a563f51bcfd6f5c1c ]
    
    Formatting of Kconfig files doesn't look so pretty, so just
    take damp cloth and clean it up. Just indention changes.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Stable-dep-of: db4bfcba7bb8 ("um: Fix hostaudio build errors")
    Signed-off-by: Sasha Levin <[email protected]>

 
arm64: dts: msm8996: thermal: Add interrupt support [+ + +]
Author: Amit Kucheria <[email protected]>
Date:   Mon Oct 21 16:05:28 2019 +0530

    arm64: dts: msm8996: thermal: Add interrupt support
    
    [ Upstream commit 6eb1c8ade5e8665eb97f8416eee0942c9f90b12b ]
    
    Register upper-lower interrupts for each of the two tsens controllers.
    
    Signed-off-by: Amit Kucheria <[email protected]>
    Signed-off-by: Andy Gross <[email protected]>
    Stable-dep-of: 36541089c473 ("arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller")
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller [+ + +]
Author: Konrad Dybcio <[email protected]>
Date:   Tue Jun 27 18:24:27 2023 +0200

    arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller
    
    [ Upstream commit 36541089c4733355ed844c67eebd0c3936953454 ]
    
    The interrupt line was previously not described. Take care of that.
    
    Fixes: 1e39255ed29d ("arm64: dts: msm8996: Add device node for qcom,dwc3")
    Signed-off-by: Konrad Dybcio <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ARM: dts: BCM5301X: Harmonize EHCI/OHCI DT nodes name [+ + +]
Author: Serge Semin <[email protected]>
Date:   Tue Oct 20 14:59:37 2020 +0300

    ARM: dts: BCM5301X: Harmonize EHCI/OHCI DT nodes name
    
    [ Upstream commit 74abbfe99f43eb7466d26d9e48fbeb46b8f3d804 ]
    
    In accordance with the Generic EHCI/OHCI bindings the corresponding node
    name is suppose to comply with the Generic USB HCD DT schema, which
    requires the USB nodes to have the name acceptable by the regexp:
    "^usb(@.*)?" . Make sure the "generic-ehci" and "generic-ohci"-compatible
    nodes are correctly named.
    
    Signed-off-by: Serge Semin <[email protected]>
    Acked-by: Florian Fainelli <[email protected]>
    Acked-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Florian Fainelli <[email protected]>
    Stable-dep-of: 05d2c3d552b8 ("ARM: dts: BCM53573: Drop nonexistent #usb-cells")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: BCM53573: Add cells sizes to PCIe node [+ + +]
Author: RafaÅ‚ MiÅ‚ecki <[email protected]>
Date:   Fri Jul 7 13:40:03 2023 +0200

    ARM: dts: BCM53573: Add cells sizes to PCIe node
    
    [ Upstream commit 3392ef368d9b04622fe758b1079b512664b6110a ]
    
    This fixes:
    arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#address-cells' is a required property
            From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml
    arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#size-cells' is a required property
            From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml
    
    Two properties that need to be added later are "device_type" and
    "ranges". Adding "device_type" on its own causes a new warning and the
    value of "ranges" needs to be determined yet.
    
    Signed-off-by: RafaÅ‚ MiÅ‚ecki <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch [+ + +]
Author: RafaÅ‚ MiÅ‚ecki <[email protected]>
Date:   Mon Sep 20 16:10:23 2021 +0200

    ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch
    
    [ Upstream commit 9fb90ae6cae7f8fe4fbf626945f32cd9da2c3892 ]
    
    BCM53573 family SoC have Ethernet switch connected to the first Ethernet
    controller (accessible over MDIO).
    
    Signed-off-by: RafaÅ‚ MiÅ‚ecki <[email protected]>
    Signed-off-by: Florian Fainelli <[email protected]>
    Stable-dep-of: 05d2c3d552b8 ("ARM: dts: BCM53573: Drop nonexistent #usb-cells")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: BCM53573: Drop nonexistent #usb-cells [+ + +]
Author: RafaÅ‚ MiÅ‚ecki <[email protected]>
Date:   Fri Jul 7 13:40:02 2023 +0200

    ARM: dts: BCM53573: Drop nonexistent #usb-cells
    
    [ Upstream commit 05d2c3d552b8c92fc397377d9d1112fc58e2cd59 ]
    
    Such property simply doesn't exist (is not documented or used anywhere).
    
    This fixes:
    arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: usb@d000: Unevaluated properties are not allowed ('#usb-cells' was unexpected)
            From schema: Documentation/devicetree/bindings/usb/generic-ohci.yaml
    
    Signed-off-by: RafaÅ‚ MiÅ‚ecki <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: BCM53573: Fix Ethernet info for Luxul devices [+ + +]
Author: RafaÅ‚ MiÅ‚ecki <[email protected]>
Date:   Thu Jul 13 13:11:45 2023 +0200

    ARM: dts: BCM53573: Fix Ethernet info for Luxul devices
    
    [ Upstream commit 44ad8207806973f4e4f7d870fff36cc01f494250 ]
    
    Both Luxul's XAP devices (XAP-810 and XAP-1440) are access points that
    use a non-default design. They don't include switch but have a single
    Ethernet port and BCM54210E PHY connected to the Ethernet controller's
    MDIO bus.
    
    Support for those devices regressed due to two changes:
    
    1. Describing MDIO bus with switch
    After commit 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125
    rev 4 switch") Linux stopped probing for MDIO devices.
    
    2. Dropping hardcoded BCM54210E delays
    In commit fea7fda7f50a ("net: phy: broadcom: Fix RGMII delays
    configuration for BCM54210E") support for other PHY modes was added but
    that requires a proper "phy-mode" value in DT.
    
    Both above changes are correct (they don't need to be reverted or
    anything) but they need this fix for DT data to be correct and for Linux
    to work properly.
    
    Fixes: 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch")
    Signed-off-by: RafaÅ‚ MiÅ‚ecki <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: BCM53573: Use updated "spi-gpio" binding properties [+ + +]
Author: RafaÅ‚ MiÅ‚ecki <[email protected]>
Date:   Fri Jul 7 13:40:04 2023 +0200

    ARM: dts: BCM53573: Use updated "spi-gpio" binding properties
    
    [ Upstream commit 2c0fd6b3d0778ceab40205315ccef74568490f17 ]
    
    Switch away from deprecated properties.
    
    This fixes:
    arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-sck: False schema does not allow [[3, 21, 0]]
            From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
    arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-miso: False schema does not allow [[3, 22, 0]]
            From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
    arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-mosi: False schema does not allow [[3, 23, 0]]
            From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
    arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: 'sck-gpios' is a required property
            From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
    arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: Unevaluated properties are not allowed ('gpio-miso', 'gpio-mosi', 'gpio-sck' were unexpected)
            From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
    
    Signed-off-by: RafaÅ‚ MiÅ‚ecki <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s3c6410: align node SROM bus node name with dtschema in Mini6410 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Mon Sep 7 20:33:06 2020 +0200

    ARM: dts: s3c6410: align node SROM bus node name with dtschema in Mini6410
    
    [ Upstream commit 5911622eff5134c4bf1e16e4e1e2fd18c4f24889 ]
    
    The SROM controller is modeled with a bus so align the device node name
    with dtschema to fix warning:
    
      srom-cs1@18000000: $nodename:0: 'srom-cs1@18000000'
        does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: cf0cb2af6a18 ("ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s3c6410: move fixed clocks under root node in Mini6410 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Mon Sep 7 20:33:04 2020 +0200

    ARM: dts: s3c6410: move fixed clocks under root node in Mini6410
    
    [ Upstream commit 8b81a8decea77bf2ca3c718732184d4aaf949096 ]
    
    The fixed clocks are kept under dedicated 'clocks' node but this causes
    multiple dtschema warnings:
    
      clocks: $nodename:0: 'clocks' does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
      clocks: #size-cells:0:0: 0 is not one of [1, 2]
      clocks: oscillator@0:reg:0: [0] is too short
      clocks: oscillator@1:reg:0: [1] is too short
      clocks: 'ranges' is a required property
      oscillator@0: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: cf0cb2af6a18 ("ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s3c64xx: align pinctrl with dtschema [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Tue Jan 11 21:17:16 2022 +0100

    ARM: dts: s3c64xx: align pinctrl with dtschema
    
    [ Upstream commit 9e47ccc01284aba7fe5fbf6ee2a7abc29bf2a740 ]
    
    Align the pin controller related nodes with dtschema.  No functional
    change expected.
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: cf0cb2af6a18 ("ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Fri Apr 21 11:57:21 2023 +0200

    ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210
    
    [ Upstream commit b77904ba177a9c67b6dbc3637fdf1faa22df6e5c ]
    
    Backlight is supplied by DC5V regulator.  The DTS has no PMIC node, so
    just add a regulator-fixed to solve it and fix dtbs_check warning:
    
      s5pv210-smdkv210.dtb: backlight: 'power-supply' is a required property
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Stable-dep-of: 982655cb0e7f ("ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s5pv210: add RTC 32 KHz clock in SMDKV210 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Mon Sep 7 18:11:30 2020 +0200

    ARM: dts: s5pv210: add RTC 32 KHz clock in SMDKV210
    
    [ Upstream commit 7260b363457a22b8723d5cbc43fee67397896d07 ]
    
    The S3C RTC requires 32768 Hz clock as input which is provided by PMIC.
    However the PMIC is not described in DTS at all so at least add
    a workaround to model its clock with a fixed-clock.
    
    This fixes dtbs_check warnings:
    
      rtc@e2800000: clocks: [[2, 145]] is too short
      rtc@e2800000: clock-names: ['rtc'] is too short
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 982655cb0e7f ("ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s5pv210: correct ethernet unit address in SMDKV210 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Mon Sep 7 20:33:03 2020 +0200

    ARM: dts: s5pv210: correct ethernet unit address in SMDKV210
    
    [ Upstream commit 28ab4caccd17d7b84fd8aa36b13af5e735870bad ]
    
    The SROM bank 5 is at address 0xa8000000, just like the one put in "reg"
    property of ethernet node.  Fix the unit address of ethernet node.
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 982655cb0e7f ("ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: s5pv210: use defines for IRQ flags in SMDKV210 [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Mon Sep 7 18:11:34 2020 +0200

    ARM: dts: s5pv210: use defines for IRQ flags in SMDKV210
    
    [ Upstream commit c272f1cc9492d61dac362d2064ec41ca97fcb1e2 ]
    
    Replace hard-coded flags with defines for readability.  No functional
    change.
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 982655cb0e7f ("ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)")
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split) [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Thu Jul 13 17:29:25 2023 +0200

    ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)
    
    [ Upstream commit cf0cb2af6a18f28b84f9f1416bff50ca60d6e98a ]
    
    The davicom,dm9000 Ethernet Controller accepts two reg addresses.
    
    Fixes: a43736deb47d ("ARM: dts: Add dts file for S3C6410-based Mini6410 board")
    Reviewed-by: Alim Akhtar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split) [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Thu Jul 13 17:29:26 2023 +0200

    ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)
    
    [ Upstream commit 982655cb0e7f18934d7532c32366e574ad61dbd7 ]
    
    The davicom,dm9000 Ethernet Controller accepts two reg addresses.
    
    Fixes: b672b27d232e ("ARM: dts: Add Device tree for s5pc110/s5pv210 boards")
    Reviewed-by: Alim Akhtar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() [+ + +]
Author: Gustavo A. R. Silva <[email protected]>
Date:   Wed Jun 7 22:12:11 2023 -0600

    ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
    
    commit 847fb80cc01a54bc827b02547bb8743bdb59ddab upstream.
    
    If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end
    up accessing array pwrdm->state_counter through negative index
    -22. This is wrong and the compiler is legitimately warning us
    about this potential problem.
    
    Fix this by sanity checking the value stored in variable _prev_
    before accessing array pwrdm->state_counter.
    
    Address the following -Warray-bounds warning:
    arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
    
    Link: https://github.com/KSPP/linux/issues/307
    Fixes: ba20bb126940 ("OMAP: PM counter infrastructure.")
    Cc: [email protected]
    Reported-by: kernel test robot <[email protected]>
    Link: https://lore.kernel.org/lkml/20230607050639.LzbPn%[email protected]/
    Signed-off-by: Gustavo A. R. Silva <[email protected]>
    Message-ID: <ZIFVGwImU3kpaGeH@work>
    Acked-by: Ard Biesheuvel <[email protected]>
    Signed-off-by: Tony Lindgren <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ARM: pxa: remove use of symbol_get() [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Tue Aug 1 19:35:40 2023 +0200

    ARM: pxa: remove use of symbol_get()
    
    commit 0faa29c4207e6e29cfc81b427df60e326c37083a upstream.
    
    The spitz board file uses the obscure symbol_get() function
    to optionally call a function from sharpsl_pm.c if that is
    built. However, the two files are always built together
    these days, and have been for a long time, so this can
    be changed to a normal function call.
    
    Link: https://lore.kernel.org/lkml/[email protected]/
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ASoC: atmel: Fix the 8K sample parameter in I2SC master [+ + +]
Author: Guiting Shen <[email protected]>
Date:   Sat Jul 15 11:06:20 2023 +0800

    ASoC: atmel: Fix the 8K sample parameter in I2SC master
    
    [ Upstream commit f85739c0b2b0d98a32f5ca4fcc5501d2b76df4f6 ]
    
    The 8K sample parameter of 12.288Mhz main system bus clock doesn't work
    because the I2SC_MR.IMCKDIV must not be 0 according to the sama5d2
    series datasheet(I2SC Mode Register of Register Summary).
    
    So use the 6.144Mhz instead of 12.288Mhz to support 8K sample.
    
    Signed-off-by: Guiting Shen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoc: codecs: ES8316: Fix DMIC config [+ + +]
Author: Edgar <[email protected]>
Date:   Wed Jul 19 13:47:22 2023 +0800

    ASoc: codecs: ES8316: Fix DMIC config
    
    [ Upstream commit d20d35d1ad62c6cca36368c1e8f29335a068659e ]
    
    According to the datasheet, the DMIC config should
    be changed to { 0, 2 ,3 }
    
    Signed-off-by: Edgar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoC: da7219: Check for failure reading AAD IRQ events [+ + +]
Author: Dmytro Maluka <[email protected]>
Date:   Mon Jul 17 21:37:37 2023 +0200

    ASoC: da7219: Check for failure reading AAD IRQ events
    
    [ Upstream commit f0691dc16206f21b13c464434366e2cd632b8ed7 ]
    
    When handling an AAD interrupt, if IRQ events read failed (for example,
    due to i2c "Transfer while suspended" failure, i.e. when attempting to
    read it while DA7219 is suspended, which may happen due to a spurious
    AAD interrupt), the events array contains garbage uninitialized values.
    So instead of trying to interprete those values and doing any actions
    based on them (potentially resulting in misbehavior, e.g. reporting
    bogus events), refuse to handle the interrupt.
    
    Signed-off-by: Dmytro Maluka <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: da7219: Flush pending AAD IRQ when suspending [+ + +]
Author: Dmytro Maluka <[email protected]>
Date:   Mon Jul 17 21:37:36 2023 +0200

    ASoC: da7219: Flush pending AAD IRQ when suspending
    
    [ Upstream commit 91e292917dad64ab8d1d5ca2ab3069ad9dac6f72 ]
    
    da7219_aad_suspend() disables jack detection, which should prevent
    generating new interrupts by DA7219 while suspended. However, there is a
    theoretical possibility that there is a pending interrupt generated just
    before suspending DA7219 and not handled yet, so the IRQ handler may
    still run after DA7219 is suspended. To prevent that, wait until the
    pending IRQ handling is done.
    
    This patch arose as an attempt to fix the following I2C failure
    occurring sometimes during system suspend or resume:
    
    [  355.876211] i2c_designware i2c_designware.3: Transfer while suspended
    [  355.876245] WARNING: CPU: 2 PID: 3576 at drivers/i2c/busses/i2c-designware-master.c:570 i2c_dw_xfer+0x411/0x440
    ...
    [  355.876462] Call Trace:
    [  355.876468]  <TASK>
    [  355.876475]  ? update_load_avg+0x1b3/0x615
    [  355.876484]  __i2c_transfer+0x101/0x1d8
    [  355.876494]  i2c_transfer+0x74/0x10d
    [  355.876504]  regmap_i2c_read+0x6a/0x9c
    [  355.876513]  _regmap_raw_read+0x179/0x223
    [  355.876521]  regmap_raw_read+0x1e1/0x28e
    [  355.876527]  regmap_bulk_read+0x17d/0x1ba
    [  355.876532]  ? __wake_up+0xed/0x1bb
    [  355.876542]  da7219_aad_irq_thread+0x54/0x2c9 [snd_soc_da7219 5fb8ebb2179cf2fea29af090f3145d68ed8e2184]
    [  355.876556]  irq_thread+0x13c/0x231
    [  355.876563]  ? irq_forced_thread_fn+0x5f/0x5f
    [  355.876570]  ? irq_thread_fn+0x4d/0x4d
    [  355.876576]  kthread+0x13a/0x152
    [  355.876581]  ? synchronize_irq+0xc3/0xc3
    [  355.876587]  ? kthread_blkcg+0x31/0x31
    [  355.876592]  ret_from_fork+0x1f/0x30
    [  355.876601]  </TASK>
    
    which indicates that the AAD IRQ handler is unexpectedly running when
    DA7219 is suspended, and as a result, is trying to read data from DA7219
    over I2C and is hitting the I2C driver "Transfer while suspended"
    failure.
    
    However, with this patch the above failure is still reproducible. So
    this patch does not fix any real observed issue so far, but at least is
    useful for confirming that the above issue is not caused by a pending
    IRQ but rather looks like a DA7219 hardware issue with an IRQ
    unexpectedly generated after jack detection is already disabled.
    
    Signed-off-by: Dmytro Maluka <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ata: pata_ftide010: Add missing MODULE_DESCRIPTION [+ + +]
Author: Damien Le Moal <[email protected]>
Date:   Thu Aug 24 07:41:59 2023 +0900

    ata: pata_ftide010: Add missing MODULE_DESCRIPTION
    
    commit 7274eef5729037300f29d14edeb334a47a098f65 upstream.
    
    Add the missing MODULE_DESCRIPTION() to avoid warnings such as:
    
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/ata/pata_ftide010.o
    
    when compiling with W=1.
    
    Fixes: be4e456ed3a5 ("ata: Add driver for Faraday Technology FTIDE010")
    Cc: [email protected]
    Signed-off-by: Damien Le Moal <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ata: sata_gemini: Add missing MODULE_DESCRIPTION [+ + +]
Author: Damien Le Moal <[email protected]>
Date:   Thu Aug 24 07:43:18 2023 +0900

    ata: sata_gemini: Add missing MODULE_DESCRIPTION
    
    commit 8566572bf3b4d6e416a4bf2110dbb4817d11ba59 upstream.
    
    Add the missing MODULE_DESCRIPTION() to avoid warnings such as:
    
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/ata/sata_gemini.o
    
    when compiling with W=1.
    
    Fixes: be4e456ed3a5 ("ata: Add driver for Faraday Technology FTIDE010")
    Cc: [email protected]
    Signed-off-by: Damien Le Moal <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
attr: block mode changes of symlinks [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Wed Jul 12 20:58:49 2023 +0200

    attr: block mode changes of symlinks
    
    commit 5d1f903f75a80daa4dfb3d84e114ec8ecbf29956 upstream.
    
    Changing the mode of symlinks is meaningless as the vfs doesn't take the
    mode of a symlink into account during path lookup permission checking.
    
    However, the vfs doesn't block mode changes on symlinks. This however,
    has lead to an untenable mess roughly classifiable into the following
    two categories:
    
    (1) Filesystems that don't implement a i_op->setattr() for symlinks.
    
        Such filesystems may or may not know that without i_op->setattr()
        defined, notify_change() falls back to simple_setattr() causing the
        inode's mode in the inode cache to be changed.
    
        That's a generic issue as this will affect all non-size changing
        inode attributes including ownership changes.
    
        Example: afs
    
    (2) Filesystems that fail with EOPNOTSUPP but change the mode of the
        symlink nonetheless.
    
        Some filesystems will happily update the mode of a symlink but still
        return EOPNOTSUPP. This is the biggest source of confusion for
        userspace.
    
        The EOPNOTSUPP in this case comes from POSIX ACLs. Specifically it
        comes from filesystems that call posix_acl_chmod(), e.g., btrfs via
    
            if (!err && attr->ia_valid & ATTR_MODE)
                    err = posix_acl_chmod(idmap, dentry, inode->i_mode);
    
        Filesystems including btrfs don't implement i_op->set_acl() so
        posix_acl_chmod() will report EOPNOTSUPP.
    
        When posix_acl_chmod() is called, most filesystems will have
        finished updating the inode.
    
        Perversely, this has the consequences that this behavior may depend
        on two kconfig options and mount options:
    
        * CONFIG_POSIX_ACL={y,n}
        * CONFIG_${FSTYPE}_POSIX_ACL={y,n}
        * Opt_acl, Opt_noacl
    
        Example: btrfs, ext4, xfs
    
    The only way to change the mode on a symlink currently involves abusing
    an O_PATH file descriptor in the following manner:
    
            fd = openat(-1, "/path/to/link", O_CLOEXEC | O_PATH | O_NOFOLLOW);
    
            char path[PATH_MAX];
            snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
            chmod(path, 0000);
    
    But for most major filesystems with POSIX ACL support such as btrfs,
    ext4, ceph, tmpfs, xfs and others this will fail with EOPNOTSUPP with
    the mode still updated due to the aforementioned posix_acl_chmod()
    nonsense.
    
    So, given that for all major filesystems this would fail with EOPNOTSUPP
    and that both glibc (cf. [1]) and musl (cf. [2]) outright block mode
    changes on symlinks we should just try and block mode changes on
    symlinks directly in the vfs and have a clean break with this nonsense.
    
    If this causes any regressions, we do the next best thing and fix up all
    filesystems that do return EOPNOTSUPP with the mode updated to not call
    posix_acl_chmod() on symlinks.
    
    But as usual, let's try the clean cut solution first. It's a simple
    patch that can be easily reverted. Not marking this for backport as I'll
    do that manually if we're reasonably sure that this works and there are
    no strong objections.
    
    We could block this in chmod_common() but it's more appropriate to do it
    notify_change() as it will also mean that we catch filesystems that
    change symlink permissions explicitly or accidently.
    
    Similar proposals were floated in the past as in [3] and [4] and again
    recently in [5]. There's also a couple of bugs about this inconsistency
    as in [6] and [7].
    
    Link: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/fchmodat.c;h=99527a3727e44cb8661ee1f743068f108ec93979;hb=HEAD [1]
    Link: https://git.musl-libc.org/cgit/musl/tree/src/stat/fchmodat.c [2]
    Link: https://lore.kernel.org/all/[email protected] [3]
    Link: https://sourceware.org/legacy-ml/libc-alpha/2020-02/msg00518.html [4]
    Link: https://lore.kernel.org/lkml/[email protected] [5]
    Link: https://sourceware.org/legacy-ml/libc-alpha/2020-02/msg00467.html [6]
    Link: https://sourceware.org/bugzilla/show_bug.cgi?id=14578#c17 [7]
    Reviewed-by: Aleksa Sarai <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Cc: [email protected] # please backport to all LTSes but not before v6.6-rc2 is tagged
    Suggested-by: Christoph Hellwig <[email protected]>
    Suggested-by: Florian Weimer <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
audit: fix possible soft lockup in __audit_inode_child() [+ + +]
Author: Gaosheng Cui <[email protected]>
Date:   Tue Aug 8 20:14:35 2023 +0800

    audit: fix possible soft lockup in __audit_inode_child()
    
    [ Upstream commit b59bc6e37237e37eadf50cd5de369e913f524463 ]
    
    Tracefs or debugfs maybe cause hundreds to thousands of PATH records,
    too many PATH records maybe cause soft lockup.
    
    For example:
      1. CONFIG_KASAN=y && CONFIG_PREEMPTION=n
      2. auditctl -a exit,always -S open -k key
      3. sysctl -w kernel.watchdog_thresh=5
      4. mkdir /sys/kernel/debug/tracing/instances/test
    
    There may be a soft lockup as follows:
      watchdog: BUG: soft lockup - CPU#45 stuck for 7s! [mkdir:15498]
      Kernel panic - not syncing: softlockup: hung tasks
      Call trace:
       dump_backtrace+0x0/0x30c
       show_stack+0x20/0x30
       dump_stack+0x11c/0x174
       panic+0x27c/0x494
       watchdog_timer_fn+0x2bc/0x390
       __run_hrtimer+0x148/0x4fc
       __hrtimer_run_queues+0x154/0x210
       hrtimer_interrupt+0x2c4/0x760
       arch_timer_handler_phys+0x48/0x60
       handle_percpu_devid_irq+0xe0/0x340
       __handle_domain_irq+0xbc/0x130
       gic_handle_irq+0x78/0x460
       el1_irq+0xb8/0x140
       __audit_inode_child+0x240/0x7bc
       tracefs_create_file+0x1b8/0x2a0
       trace_create_file+0x18/0x50
       event_create_dir+0x204/0x30c
       __trace_add_new_event+0xac/0x100
       event_trace_add_tracer+0xa0/0x130
       trace_array_create_dir+0x60/0x140
       trace_array_create+0x1e0/0x370
       instance_mkdir+0x90/0xd0
       tracefs_syscall_mkdir+0x68/0xa0
       vfs_mkdir+0x21c/0x34c
       do_mkdirat+0x1b4/0x1d4
       __arm64_sys_mkdirat+0x4c/0x60
       el0_svc_common.constprop.0+0xa8/0x240
       do_el0_svc+0x8c/0xc0
       el0_svc+0x20/0x30
       el0_sync_handler+0xb0/0xb4
       el0_sync+0x160/0x180
    
    Therefore, we add cond_resched() to __audit_inode_child() to fix it.
    
    Fixes: 5195d8e217a7 ("audit: dynamically allocate audit_names when not enough space is in the names array")
    Signed-off-by: Gaosheng Cui <[email protected]>
    Signed-off-by: Paul Moore <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
autofs: fix memory leak of waitqueues in autofs_catatonic_mode [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Fri Aug 4 13:33:12 2023 +0800

    autofs: fix memory leak of waitqueues in autofs_catatonic_mode
    
    [ Upstream commit ccbe77f7e45dfb4420f7f531b650c00c6e9c7507 ]
    
    Syzkaller reports a memory leak:
    
    BUG: memory leak
    unreferenced object 0xffff88810b279e00 (size 96):
      comm "syz-executor399", pid 3631, jiffies 4294964921 (age 23.870s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 08 9e 27 0b 81 88 ff ff  ..........'.....
        08 9e 27 0b 81 88 ff ff 00 00 00 00 00 00 00 00  ..'.............
      backtrace:
        [<ffffffff814cfc90>] kmalloc_trace+0x20/0x90 mm/slab_common.c:1046
        [<ffffffff81bb75ca>] kmalloc include/linux/slab.h:576 [inline]
        [<ffffffff81bb75ca>] autofs_wait+0x3fa/0x9a0 fs/autofs/waitq.c:378
        [<ffffffff81bb88a7>] autofs_do_expire_multi+0xa7/0x3e0 fs/autofs/expire.c:593
        [<ffffffff81bb8c33>] autofs_expire_multi+0x53/0x80 fs/autofs/expire.c:619
        [<ffffffff81bb6972>] autofs_root_ioctl_unlocked+0x322/0x3b0 fs/autofs/root.c:897
        [<ffffffff81bb6a95>] autofs_root_ioctl+0x25/0x30 fs/autofs/root.c:910
        [<ffffffff81602a9c>] vfs_ioctl fs/ioctl.c:51 [inline]
        [<ffffffff81602a9c>] __do_sys_ioctl fs/ioctl.c:870 [inline]
        [<ffffffff81602a9c>] __se_sys_ioctl fs/ioctl.c:856 [inline]
        [<ffffffff81602a9c>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
        [<ffffffff84608225>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        [<ffffffff84608225>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
        [<ffffffff84800087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    autofs_wait_queue structs should be freed if their wait_ctr becomes zero.
    Otherwise they will be lost.
    
    In this case an AUTOFS_IOC_EXPIRE_MULTI ioctl is done, then a new
    waitqueue struct is allocated in autofs_wait(), its initial wait_ctr
    equals 2. After that wait_event_killable() is interrupted (it returns
    -ERESTARTSYS), so that 'wq->name.name == NULL' condition may be not
    satisfied. Actually, this condition can be satisfied when
    autofs_wait_release() or autofs_catatonic_mode() is called and, what is
    also important, wait_ctr is decremented in those places. Upon the exit of
    autofs_wait(), wait_ctr is decremented to 1. Then the unmounting process
    begins: kill_sb calls autofs_catatonic_mode(), which should have freed the
    waitqueues, but it only decrements its usage counter to zero which is not
    a correct behaviour.
    
    edit:imk
    This description is of course not correct. The umount performed as a result
    of an expire is a umount of a mount that has been automounted, it's not the
    autofs mount itself. They happen independently, usually after everything
    mounted within the autofs file system has been expired away. If everything
    hasn't been expired away the automount daemon can still exit leaving mounts
    in place. But expires done in both cases will result in a notification that
    calls autofs_wait_release() with a result status. The problem case is the
    summary execution of of the automount daemon. In this case any waiting
    processes won't be woken up until either they are terminated or the mount
    is umounted.
    end edit: imk
    
    So in catatonic mode we should free waitqueues which counter becomes zero.
    
    edit: imk
    Initially I was concerned that the calling of autofs_wait_release() and
    autofs_catatonic_mode() was not mutually exclusive but that can't be the
    case (obviously) because the queue entry (or entries) is removed from the
    list when either of these two functions are called. Consequently the wait
    entry will be freed by only one of these functions or by the woken process
    in autofs_wait() depending on the order of the calls.
    end edit: imk
    
    Reported-by: [email protected]
    Suggested-by: Takeshi Misawa <[email protected]>
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Signed-off-by: Alexey Khoroshilov <[email protected]>
    Signed-off-by: Ian Kent <[email protected]>
    Cc: Matthew Wilcox <[email protected]>
    Cc: Andrei Vagin <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Message-Id: <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
backlight/bd6107: Compare against struct fb_info.device [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Tue Jun 13 13:06:36 2023 +0200

    backlight/bd6107: Compare against struct fb_info.device
    
    commit 992bdddaabfba19bdc77c1c7a4977b2aa41ec891 upstream.
    
    Struct bd6107_platform_data refers to a platform device within
    the Linux device hierarchy. The test in bd6107_backlight_check_fb()
    compares it against the fbdev device in struct fb_info.dev, which
    is different. Fix the test by comparing to struct fb_info.device.
    
    Fixes a bug in the backlight driver and prepares fbdev for making
    struct fb_info.dev optional.
    
    v2:
            * move renames into separate patch (Javier, Sam, Michael)
    
    Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver")
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Cc: Laurent Pinchart <[email protected]>
    Cc: Lee Jones <[email protected]>
    Cc: Daniel Thompson <[email protected]>
    Cc: Jingoo Han <[email protected]>
    Cc: [email protected]
    Cc: <[email protected]> # v3.12+
    Reviewed-by: Javier Martinez Canillas <[email protected]>
    Reviewed-by: Sam Ravnborg <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
backlight/gpio_backlight: Compare against struct fb_info.device [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Tue Jun 13 13:06:38 2023 +0200

    backlight/gpio_backlight: Compare against struct fb_info.device
    
    commit 7b91d017f77c1bda56f27c2f4bbb70de7c6eca08 upstream.
    
    Struct gpio_backlight_platform_data refers to a platform device within
    the Linux device hierarchy. The test in gpio_backlight_check_fb()
    compares it against the fbdev device in struct fb_info.dev, which
    is different. Fix the test by comparing to struct fb_info.device.
    
    Fixes a bug in the backlight driver and prepares fbdev for making
    struct fb_info.dev optional.
    
    v2:
            * move renames into separate patch (Javier, Sam, Michael)
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Fixes: 8b770e3c9824 ("backlight: Add GPIO-based backlight driver")
    Cc: Laurent Pinchart <[email protected]>
    Cc: Rich Felker <[email protected]>
    Cc: John Paul Adrian Glaubitz <[email protected]>
    Cc: Lee Jones <[email protected]>
    Cc: Daniel Thompson <[email protected]>
    Cc: Jingoo Han <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: <[email protected]> # v3.12+
    Reviewed-by: Sam Ravnborg <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
backlight/lv5207lp: Compare against struct fb_info.device [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Tue Jun 13 13:06:40 2023 +0200

    backlight/lv5207lp: Compare against struct fb_info.device
    
    commit 1ca8819320fd84e7d95b04e7668efc5f9fe9fa5c upstream.
    
    Struct lv5207lp_platform_data refers to a platform device within
    the Linux device hierarchy. The test in lv5207lp_backlight_check_fb()
    compares it against the fbdev device in struct fb_info.dev, which
    is different. Fix the test by comparing to struct fb_info.device.
    
    Fixes a bug in the backlight driver and prepares fbdev for making
    struct fb_info.dev optional.
    
    v2:
            * move renames into separate patch (Javier, Sam, Michael)
    
    Fixes: 82e5c40d88f9 ("backlight: Add Sanyo LV5207LP backlight driver")
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Cc: Laurent Pinchart <[email protected]>
    Cc: Yoshinori Sato <[email protected]>
    Cc: Rich Felker <[email protected]>
    Cc: John Paul Adrian Glaubitz <[email protected]>
    Cc: Lee Jones <[email protected]>
    Cc: Daniel Thompson <[email protected]>
    Cc: Jingoo Han <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: <[email protected]> # v3.12+
    Reviewed-by: Javier Martinez Canillas <[email protected]>
    Reviewed-by: Sam Ravnborg <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Thu Mar 9 00:45:01 2023 +0800

    Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition
    
    commit 73f7b171b7c09139eb3c6a5677c200dc1be5f318 upstream.
    
    In btsdio_probe, the data->work is bound with btsdio_work. It will be
    started in btsdio_send_frame.
    
    If the btsdio_remove runs with a unfinished work, there may be a race
    condition that hdev is freed but used in btsdio_work. Fix it by
    canceling the work before do cleanup in btsdio_remove.
    
    Fixes: CVE-2023-1989
    Fixes: ddbaf13e3609 ("[Bluetooth] Add generic driver for Bluetooth SDIO devices")
    Cc: [email protected]
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    [ Denis: Added CVE-2023-1989 and fixes tags. ]
    Signed-off-by: Denis Efremov (Oracle) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe() [+ + +]
Author: Yuanjun Gong <[email protected]>
Date:   Wed Jul 26 21:30:00 2023 +0800

    Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe()
    
    [ Upstream commit e8b5aed31355072faac8092ead4938ddec3111fd ]
    
    in nokia_bluetooth_serdev_probe(), check the return value of
    clk_prepare_enable() and return the error code if
    clk_prepare_enable() returns an unexpected value.
    
    Fixes: 7bb318680e86 ("Bluetooth: add nokia driver")
    Signed-off-by: Yuanjun Gong <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bnx2x: fix page fault following EEH recovery [+ + +]
Author: David Christensen <[email protected]>
Date:   Thu Jun 8 16:01:43 2023 -0400

    bnx2x: fix page fault following EEH recovery
    
    [ Upstream commit 7ebe4eda4265642859507d1b3ca330d8c196cfe5 ]
    
    In the last step of the EEH recovery process, the EEH driver calls into
    bnx2x_io_resume() to re-initialize the NIC hardware via the function
    bnx2x_nic_load().  If an error occurs during bnx2x_nic_load(), OS and
    hardware resources are released and an error code is returned to the
    caller.  When called from bnx2x_io_resume(), the return code is ignored
    and the network interface is brought up unconditionally.  Later attempts
    to send a packet via this interface result in a page fault due to a null
    pointer reference.
    
    This patch checks the return code of bnx2x_nic_load(), prints an error
    message if necessary, and does not enable the interface.
    
    Signed-off-by: David Christensen <[email protected]>
    Reviewed-by: Sridhar Samudrala <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bpf: Clear the probe_addr for uprobe [+ + +]
Author: Yafang Shao <[email protected]>
Date:   Sun Jul 9 02:56:25 2023 +0000

    bpf: Clear the probe_addr for uprobe
    
    [ Upstream commit 5125e757e62f6c1d5478db4c2b61a744060ddf3f ]
    
    To avoid returning uninitialized or random values when querying the file
    descriptor (fd) and accessing probe_addr, it is necessary to clear the
    variable prior to its use.
    
    Fixes: 41bdc4b40ed6 ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY")
    Signed-off-by: Yafang Shao <[email protected]>
    Acked-by: Yonghong Song <[email protected]>
    Acked-by: Jiri Olsa <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART [+ + +]
Author: Filipe Manana <[email protected]>
Date:   Wed Jul 26 16:56:57 2023 +0100

    btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
    
    commit 4490e803e1fe9fab8db5025e44e23b55df54078b upstream.
    
    When joining a transaction with TRANS_JOIN_NOSTART, if we don't find a
    running transaction we end up creating one. This goes against the purpose
    of TRANS_JOIN_NOSTART which is to join a running transaction if its state
    is at or below the state TRANS_STATE_COMMIT_START, otherwise return an
    -ENOENT error and don't start a new transaction. So fix this to not create
    a new transaction if there's no running transaction at or below that
    state.
    
    CC: [email protected] # 4.14+
    Fixes: a6d155d2e363 ("Btrfs: fix deadlock between fiemap and transaction commits")
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: fix lockdep splat and potential deadlock after failure running delayed items [+ + +]
Author: Filipe Manana <[email protected]>
Date:   Tue Aug 29 11:34:52 2023 +0100

    btrfs: fix lockdep splat and potential deadlock after failure running delayed items
    
    commit e110f8911ddb93e6f55da14ccbbe705397b30d0b upstream.
    
    When running delayed items we are holding a delayed node's mutex and then
    we will attempt to modify a subvolume btree to insert/update/delete the
    delayed items. However if have an error during the insertions for example,
    btrfs_insert_delayed_items() may return with a path that has locked extent
    buffers (a leaf at the very least), and then we attempt to release the
    delayed node at __btrfs_run_delayed_items(), which requires taking the
    delayed node's mutex, causing an ABBA type of deadlock. This was reported
    by syzbot and the lockdep splat is the following:
    
      WARNING: possible circular locking dependency detected
      6.5.0-rc7-syzkaller-00024-g93f5de5f648d #0 Not tainted
      ------------------------------------------------------
      syz-executor.2/13257 is trying to acquire lock:
      ffff88801835c0c0 (&delayed_node->mutex){+.+.}-{3:3}, at: __btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256
    
      but task is already holding lock:
      ffff88802a5ab8e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_lock+0x3c/0x2a0 fs/btrfs/locking.c:198
    
      which lock already depends on the new lock.
    
      the existing dependency chain (in reverse order) is:
    
      -> #1 (btrfs-tree-00){++++}-{3:3}:
             __lock_release kernel/locking/lockdep.c:5475 [inline]
             lock_release+0x36f/0x9d0 kernel/locking/lockdep.c:5781
             up_write+0x79/0x580 kernel/locking/rwsem.c:1625
             btrfs_tree_unlock_rw fs/btrfs/locking.h:189 [inline]
             btrfs_unlock_up_safe+0x179/0x3b0 fs/btrfs/locking.c:239
             search_leaf fs/btrfs/ctree.c:1986 [inline]
             btrfs_search_slot+0x2511/0x2f80 fs/btrfs/ctree.c:2230
             btrfs_insert_empty_items+0x9c/0x180 fs/btrfs/ctree.c:4376
             btrfs_insert_delayed_item fs/btrfs/delayed-inode.c:746 [inline]
             btrfs_insert_delayed_items fs/btrfs/delayed-inode.c:824 [inline]
             __btrfs_commit_inode_delayed_items+0xd24/0x2410 fs/btrfs/delayed-inode.c:1111
             __btrfs_run_delayed_items+0x1db/0x430 fs/btrfs/delayed-inode.c:1153
             flush_space+0x269/0xe70 fs/btrfs/space-info.c:723
             btrfs_async_reclaim_metadata_space+0x106/0x350 fs/btrfs/space-info.c:1078
             process_one_work+0x92c/0x12c0 kernel/workqueue.c:2600
             worker_thread+0xa63/0x1210 kernel/workqueue.c:2751
             kthread+0x2b8/0x350 kernel/kthread.c:389
             ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145
             ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
    
      -> #0 (&delayed_node->mutex){+.+.}-{3:3}:
             check_prev_add kernel/locking/lockdep.c:3142 [inline]
             check_prevs_add kernel/locking/lockdep.c:3261 [inline]
             validate_chain kernel/locking/lockdep.c:3876 [inline]
             __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144
             lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761
             __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603
             __mutex_lock kernel/locking/mutex.c:747 [inline]
             mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799
             __btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256
             btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline]
             __btrfs_run_delayed_items+0x2b5/0x430 fs/btrfs/delayed-inode.c:1156
             btrfs_commit_transaction+0x859/0x2ff0 fs/btrfs/transaction.c:2276
             btrfs_sync_file+0xf56/0x1330 fs/btrfs/file.c:1988
             vfs_fsync_range fs/sync.c:188 [inline]
             vfs_fsync fs/sync.c:202 [inline]
             do_fsync fs/sync.c:212 [inline]
             __do_sys_fsync fs/sync.c:220 [inline]
             __se_sys_fsync fs/sync.c:218 [inline]
             __x64_sys_fsync+0x196/0x1e0 fs/sync.c:218
             do_syscall_x64 arch/x86/entry/common.c:50 [inline]
             do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
             entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
      other info that might help us debug this:
    
       Possible unsafe locking scenario:
    
             CPU0                    CPU1
             ----                    ----
        lock(btrfs-tree-00);
                                     lock(&delayed_node->mutex);
                                     lock(btrfs-tree-00);
        lock(&delayed_node->mutex);
    
       *** DEADLOCK ***
    
      3 locks held by syz-executor.2/13257:
       #0: ffff88802c1ee370 (btrfs_trans_num_writers){++++}-{0:0}, at: spin_unlock include/linux/spinlock.h:391 [inline]
       #0: ffff88802c1ee370 (btrfs_trans_num_writers){++++}-{0:0}, at: join_transaction+0xb87/0xe00 fs/btrfs/transaction.c:287
       #1: ffff88802c1ee398 (btrfs_trans_num_extwriters){++++}-{0:0}, at: join_transaction+0xbb2/0xe00 fs/btrfs/transaction.c:288
       #2: ffff88802a5ab8e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_lock+0x3c/0x2a0 fs/btrfs/locking.c:198
    
      stack backtrace:
      CPU: 0 PID: 13257 Comm: syz-executor.2 Not tainted 6.5.0-rc7-syzkaller-00024-g93f5de5f648d #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
       check_noncircular+0x375/0x4a0 kernel/locking/lockdep.c:2195
       check_prev_add kernel/locking/lockdep.c:3142 [inline]
       check_prevs_add kernel/locking/lockdep.c:3261 [inline]
       validate_chain kernel/locking/lockdep.c:3876 [inline]
       __lock_acquire+0x39ff/0x7f70 kernel/locking/lockdep.c:5144
       lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761
       __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799
       __btrfs_release_delayed_node+0x9a/0xaa0 fs/btrfs/delayed-inode.c:256
       btrfs_release_delayed_node fs/btrfs/delayed-inode.c:281 [inline]
       __btrfs_run_delayed_items+0x2b5/0x430 fs/btrfs/delayed-inode.c:1156
       btrfs_commit_transaction+0x859/0x2ff0 fs/btrfs/transaction.c:2276
       btrfs_sync_file+0xf56/0x1330 fs/btrfs/file.c:1988
       vfs_fsync_range fs/sync.c:188 [inline]
       vfs_fsync fs/sync.c:202 [inline]
       do_fsync fs/sync.c:212 [inline]
       __do_sys_fsync fs/sync.c:220 [inline]
       __se_sys_fsync fs/sync.c:218 [inline]
       __x64_sys_fsync+0x196/0x1e0 fs/sync.c:218
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f3ad047cae9
      Code: 28 00 00 00 75 (...)
      RSP: 002b:00007f3ad12510c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004a
      RAX: ffffffffffffffda RBX: 00007f3ad059bf80 RCX: 00007f3ad047cae9
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
      RBP: 00007f3ad04c847a R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 000000000000000b R14: 00007f3ad059bf80 R15: 00007ffe56af92f8
       </TASK>
      ------------[ cut here ]------------
    
    Fix this by releasing the path before releasing the delayed node in the
    error path at __btrfs_run_delayed_items().
    
    Reported-by: [email protected]
    Link: https://lore.kernel.org/linux-btrfs/[email protected]/
    CC: [email protected] # 4.14+
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: output extra debug info if we failed to find an inline backref [+ + +]
Author: Qu Wenruo <[email protected]>
Date:   Tue Aug 1 19:02:28 2023 +0800

    btrfs: output extra debug info if we failed to find an inline backref
    
    [ Upstream commit 7f72f50547b7af4ddf985b07fc56600a4deba281 ]
    
    [BUG]
    Syzbot reported several warning triggered inside
    lookup_inline_extent_backref().
    
    [CAUSE]
    As usual, the reproducer doesn't reliably trigger locally here, but at
    least we know the WARN_ON() is triggered when an inline backref can not
    be found, and it can only be triggered when @insert is true. (I.e.
    inserting a new inline backref, which means the backref should already
    exist)
    
    [ENHANCEMENT]
    After the WARN_ON(), dump all the parameters and the extent tree
    leaf to help debug.
    
    Link: https://syzkaller.appspot.com/bug?extid=d6f9ff86c1d804ba2bc6
    Signed-off-by: Qu Wenruo <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM [+ + +]
Author: Marc Kleine-Budde <[email protected]>
Date:   Tue Jul 4 11:23:37 2023 +0200

    can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM
    
    [ Upstream commit 6c8bc15f02b85bc8f47074110d8fd8caf7a1e42d ]
    
    In case of an RX overflow error from the CAN controller and an OOM
    where no skb can be allocated, the error counters are not incremented.
    
    Fix this by first incrementing the error counters and then allocate
    the skb.
    
    Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: cgroup:namespace: Remove unused cgroup_namespaces_init() [+ + +]
Author: Lu Jialin <[email protected]>
Date:   Thu Aug 10 11:25:28 2023 +0000

    cgroup:namespace: Remove unused cgroup_namespaces_init()
    
    [ Upstream commit 82b90b6c5b38e457c7081d50dff11ecbafc1e61a ]
    
    cgroup_namspace_init() just return 0. Therefore, there is no need to
    call it during start_kernel. Just remove it.
    
    Fixes: a79a908fd2b0 ("cgroup: introduce cgroup namespaces")
    Signed-off-by: Lu Jialin <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cifs: add a warning when the in-flight count goes negative [+ + +]
Author: Shyam Prasad N <[email protected]>
Date:   Fri Jun 9 17:46:56 2023 +0000

    cifs: add a warning when the in-flight count goes negative
    
    [ Upstream commit e4645cc2f1e2d6f268bb8dcfac40997c52432aed ]
    
    We've seen the in-flight count go into negative with some
    internal stress testing in Microsoft.
    
    Adding a WARN when this happens, in hope of understanding
    why this happens when it happens.
    
    Signed-off-by: Shyam Prasad N <[email protected]>
    Reviewed-by: Bharath SM <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock [+ + +]
Author: Dmitry Baryshkov <[email protected]>
Date:   Sat May 13 00:17:23 2023 +0300

    clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock
    
    commit 1583694bb4eaf186f17131dbc1b83d6057d2749b upstream.
    
    The pll0_vote clock definitely should have pll0 as a parent (instead of
    pll8).
    
    Fixes: 7792a8d6713c ("clk: mdm9615: Add support for MDM9615 Clock Controllers")
    Cc: [email protected]
    Reviewed-by: Neil Armstrong <[email protected]>
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Reviewed-by: Konrad Dybcio <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

clk: sunxi-ng: Modify mismatched function name [+ + +]
Author: Zhang Jianhua <[email protected]>
Date:   Sat Jul 22 15:31:07 2023 +0000

    clk: sunxi-ng: Modify mismatched function name
    
    [ Upstream commit 075d9ca5b4e17f84fd1c744a405e69ec743be7f0 ]
    
    No functional modification involved.
    
    drivers/clk/sunxi-ng/ccu_mmc_timing.c:54: warning: expecting prototype for sunxi_ccu_set_mmc_timing_mode(). Prototype was for sunxi_ccu_get_mmc_timing_mode() instead
    
    Fixes: f6f64ed868d3 ("clk: sunxi-ng: Add interface to query or configure MMC timing modes.")
    Signed-off-by: Zhang Jianhua <[email protected]>
    Reviewed-by: Randy Dunlap <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jernej Skrabec <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug [+ + +]
Author: Gustavo A. R. Silva <[email protected]>
Date:   Mon Jul 31 21:15:48 2023 -0600

    cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
    
    commit e520d0b6be950ce3738cf4b9bd3b392be818f1dc upstream.
    
    Allocate extra space for terminating element at:
    
    drivers/cpufreq/brcmstb-avs-cpufreq.c:
    449         table[i].frequency = CPUFREQ_TABLE_END;
    
    and add code comment to make this clear.
    
    This fixes the following -Warray-bounds warning seen after building
    ARM with multi_v7_defconfig (GCC 13):
    In function 'brcm_avs_get_freq_table',
        inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:
    drivers/cpufreq/brcmstb-avs-cpufreq.c:449:28: warning: array subscript 5 is outside array bounds of 'void[60]' [-Warray-bounds=]
      449 |         table[i].frequency = CPUFREQ_TABLE_END;
    In file included from include/linux/node.h:18,
                     from include/linux/cpu.h:17,
                     from include/linux/cpufreq.h:12,
                     from drivers/cpufreq/brcmstb-avs-cpufreq.c:44:
    In function 'devm_kmalloc_array',
        inlined from 'devm_kcalloc' at include/linux/device.h:328:9,
        inlined from 'brcm_avs_get_freq_table' at drivers/cpufreq/brcmstb-avs-cpufreq.c:437:10,
        inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:
    include/linux/device.h:323:16: note: at offset 60 into object of size 60 allocated by 'devm_kmalloc'
      323 |         return devm_kmalloc(dev, bytes, flags);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
    routines on memcpy() and help us make progress towards globally
    enabling -Warray-bounds.
    
    Link: https://github.com/KSPP/linux/issues/324
    Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
    Cc: [email protected]
    Signed-off-by: Gustavo A. R. Silva <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit() [+ + +]
Author: Liao Chang <[email protected]>
Date:   Sat Aug 26 09:51:13 2023 +0000

    cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit()
    
    [ Upstream commit 03997da042dac73c69e60d91942c727c76828b65 ]
    
    Since the 'cpus' field of policy structure will become empty in the
    cpufreq core API, it is better to use 'related_cpus' in the exit()
    callback of driver.
    
    Fixes: c3274763bfc3 ("cpufreq: powernow-k8: Initialize per-cpu data-structures properly")
    Signed-off-by: Liao Chang <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
crypto: caam - fix unchecked return value error [+ + +]
Author: Gaurav Jain <[email protected]>
Date:   Tue Aug 8 12:55:25 2023 +0200

    crypto: caam - fix unchecked return value error
    
    [ Upstream commit e30685204711a6be40dec2622606950ccd37dafe ]
    
    error:
    Unchecked return value (CHECKED_RETURN)
    check_return: Calling sg_miter_next without checking return value
    
    fix:
    added check if(!sg_miter_next)
    
    Fixes: 8a2a0dd35f2e ("crypto: caam - strip input zeros from RSA input buffer")
    Signed-off-by: Gaurav Jain <[email protected]>
    Signed-off-by: Meenakshi Aggarwal <[email protected]>
    Reviewed-by: Gaurav Jain <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui() [+ + +]
Author: Mark O'Donovan <[email protected]>
Date:   Fri Aug 4 09:32:18 2023 +0000

    crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui()
    
    [ Upstream commit 9e47a758b70167c9301d2b44d2569f86c7796f2d ]
    
    During NVMeTCP Authentication a controller can trigger a kernel
    oops by specifying the 8192 bit Diffie Hellman group and passing
    a correctly sized, but zeroed Diffie Hellamn value.
    mpi_cmp_ui() was detecting this if the second parameter was 0,
    but 1 is passed from dh_is_pubkey_valid(). This causes the null
    pointer u->d to be dereferenced towards the end of mpi_cmp_ui()
    
    Signed-off-by: Mark O'Donovan <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

crypto: stm32 - fix loop iterating through scatterlist for DMA [+ + +]
Author: Thomas Bourgoin <[email protected]>
Date:   Thu Jul 13 17:15:15 2023 +0200

    crypto: stm32 - fix loop iterating through scatterlist for DMA
    
    commit d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f upstream.
    
    We were reading the length of the scatterlist sg after copying value of
    tsg inside.
    So we are using the size of the previous scatterlist and for the first
    one we are using an unitialised value.
    Fix this by copying tsg in sg[0] before reading the size.
    
    Fixes : 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module")
    Cc: [email protected]
    Signed-off-by: Thomas Bourgoin <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dccp: Fix out of bounds access in DCCP error handler [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Aug 25 15:32:41 2023 +0200

    dccp: Fix out of bounds access in DCCP error handler
    
    commit 977ad86c2a1bcaf58f01ab98df5cc145083c489c upstream.
    
    There was a previous attempt to fix an out-of-bounds access in the DCCP
    error handlers, but that fix assumed that the error handlers only want
    to access the first 8 bytes of the DCCP header. Actually, they also look
    at the DCCP sequence number, which is stored beyond 8 bytes, so an
    explicit pskb_may_pull() is required.
    
    Fixes: 6706a97fec96 ("dccp: fix out of bound access in dccp_v4_err()")
    Fixes: 1aa9d1a0e7ee ("ipv6: dccp: fix out of bound access in dccp_v6_err()")
    Cc: [email protected]
    Signed-off-by: Jann Horn <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dlm: fix plock lookup when using multiple lockspaces [+ + +]
Author: Alexander Aring <[email protected]>
Date:   Thu Aug 24 16:51:42 2023 -0400

    dlm: fix plock lookup when using multiple lockspaces
    
    commit 7c53e847ff5e97f033fdd31f71949807633d506b upstream.
    
    All posix lock ops, for all lockspaces (gfs2 file systems) are
    sent to userspace (dlm_controld) through a single misc device.
    The dlm_controld daemon reads the ops from the misc device
    and sends them to other cluster nodes using separate, per-lockspace
    cluster api communication channels.  The ops for a single lockspace
    are ordered at this level, so that the results are received in
    the same sequence that the requests were sent.  When the results
    are sent back to the kernel via the misc device, they are again
    funneled through the single misc device for all lockspaces.  When
    the dlm code in the kernel processes the results from the misc
    device, these results will be returned in the same sequence that
    the requests were sent, on a per-lockspace basis.  A recent change
    in this request/reply matching code missed the "per-lockspace"
    check (fsid comparison) when matching request and reply, so replies
    could be incorrectly matched to requests from other lockspaces.
    
    Cc: [email protected]
    Reported-by: Barry Marson <[email protected]>
    Fixes: 57e2c2f2d94c ("fs: dlm: fix mismatch of plock results from userspace")
    Signed-off-by: Alexander Aring <[email protected]>
    Signed-off-by: David Teigland <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dma-buf/sync_file: Fix docs syntax [+ + +]
Author: Rob Clark <[email protected]>
Date:   Mon Jul 24 07:49:41 2023 -0700

    dma-buf/sync_file: Fix docs syntax
    
    [ Upstream commit 05d56d8079d510a2994039470f65bea85f0075ee ]
    
    Fixes the warning:
    
      include/uapi/linux/sync_file.h:77: warning: Function parameter or member 'num_fences' not described in 'sync_file_info'
    
    Fixes: 2d75c88fefb2 ("staging/android: refactor SYNC IOCTLs")
    Signed-off-by: Rob Clark <[email protected]>
    Reviewed-by: Randy Dunlap <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
dmaengine: ste_dma40: Add missing IRQ check in d40_probe [+ + +]
Author: ruanjinjie <[email protected]>
Date:   Mon Jul 24 14:41:08 2023 +0000

    dmaengine: ste_dma40: Add missing IRQ check in d40_probe
    
    [ Upstream commit c05ce6907b3d6e148b70f0bb5eafd61dcef1ddc1 ]
    
    Check for the return value of platform_get_irq(): if no interrupt
    is specified, it wouldn't make sense to call request_irq().
    
    Fixes: 8d318a50b3d7 ("DMAENGINE: Support for ST-Ericssons DMA40 block v3")
    Signed-off-by: Ruan Jinjie <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init() [+ + +]
Author: Minjie Du <[email protected]>
Date:   Wed Jul 12 18:22:46 2023 +0800

    drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init()
    
    [ Upstream commit a995c50db887ef97f3160775aef7d772635a6f6e ]
    
    The function clk_register_pll() may return NULL or an ERR_PTR. Don't
    treat an ERR_PTR as valid.
    
    Signed-off-by: Minjie Du <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: b9e0d40c0d83 ("clk: keystone: add Keystone PLL clock driver")
    [[email protected]: Reword commit text]
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drivers: usb: smsusb: fix error handling code in smsusb_init_device [+ + +]
Author: Dongliang Mu <[email protected]>
Date:   Mon Feb 27 18:24:08 2023 +0800

    drivers: usb: smsusb: fix error handling code in smsusb_init_device
    
    [ Upstream commit b9c7141f384097fa4fa67d2f72e5731d628aef7c ]
    
    The previous commit 4b208f8b561f ("[media] siano: register media controller
    earlier")moves siano_media_device_register before smscore_register_device,
    and adds corresponding error handling code if smscore_register_device
    fails. However, it misses the following error handling code of
    smsusb_init_device.
    
    Fix this by moving error handling code at the end of smsusb_init_device
    and adding a goto statement in the following error handling parts.
    
    Fixes: 4b208f8b561f ("[media] siano: register media controller earlier")
    Signed-off-by: Dongliang Mu <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/display: Fix a bug when searching for insert_above_mpcc [+ + +]
Author: Wesley Chalmers <[email protected]>
Date:   Wed Jun 21 19:13:26 2023 -0400

    drm/amd/display: Fix a bug when searching for insert_above_mpcc
    
    commit 3d028d5d60d516c536de1ddd3ebf3d55f3f8983b upstream.
    
    [WHY]
    Currently, when insert_plane is called with insert_above_mpcc
    parameter that is equal to tree->opp_list, the function returns NULL.
    
    [HOW]
    Instead, the function should insert the plane at the top of the tree.
    
    Cc: Mario Limonciello <[email protected]>
    Cc: Alex Deucher <[email protected]>
    Cc: [email protected]
    Reviewed-by: Jun Lei <[email protected]>
    Acked-by: Tom Chung <[email protected]>
    Signed-off-by: Wesley Chalmers <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Jul 7 13:11:51 2023 +0200

    drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar()
    
    [ Upstream commit 822130b5e8834ab30ad410cf19a582e5014b9a85 ]
    
    On 32-bit architectures comparing a resource against a value larger than
    U32_MAX can cause a warning:
    
    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1344:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                        res->start > 0x100000000ull)
                        ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
    
    As gcc does not warn about this in dead code, add an IS_ENABLED() check at
    the start of the function. This will always return success but not actually resize
    the BAR on 32-bit architectures without high memory, which is exactly what
    we want here, as the driver can fall back to bank switching the VRAM
    access.
    
    Fixes: 31b8adab3247 ("drm/amdgpu: require a root bus window above 4GB for BAR resize")
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdgpu: Correct Transmit Margin masks [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Wed Nov 20 17:52:48 2019 -0600

    drm/amdgpu: Correct Transmit Margin masks
    
    [ Upstream commit 19d7a95a8ba66b198f759cf610cc935ce9840d5b ]
    
    Previously we masked PCIe Link Control 2 register values with "7 << 9",
    which was apparently intended to be the Transmit Margin field, but instead
    was the high order bit of Transmit Margin, the Enter Modified Compliance
    bit, and the Compliance SOS bit.
    
    Correct the mask to "7 << 7", which is the Transmit Margin field.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdgpu: Prefer pcie_capability_read_word() [+ + +]
Author: Frederick Lawler <[email protected]>
Date:   Sun Nov 17 18:35:13 2019 -0600

    drm/amdgpu: Prefer pcie_capability_read_word()
    
    [ Upstream commit 88027c89ea146e32485251f1c2dddcde43c8d04e ]
    
    Commit 8c0d3a02c130 ("PCI: Add accessors for PCI Express Capability")
    added accessors for the PCI Express Capability so that drivers didn't
    need to be aware of differences between v1 and v2 of the PCI
    Express Capability.
    
    Replace pci_read_config_word() and pci_write_config_word() calls with
    pcie_capability_read_word() and pcie_capability_write_word().
    
    [bhelgaas: fix a couple remaining instances in cik.c]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Frederick Lawler <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Thu Nov 21 07:23:41 2019 -0600

    drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions
    
    [ Upstream commit 35e768e296729ac96a8c33b7810b6cb1673ae961 ]
    
    Replace hard-coded magic numbers with the descriptive PCI_EXP_LNKCTL2
    definitions.  No functional change intended.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdgpu: Use RMW accessors for changing LNKCTL [+ + +]
Author: Ilpo Järvinen <[email protected]>
Date:   Mon Jul 17 15:04:57 2023 +0300

    drm/amdgpu: Use RMW accessors for changing LNKCTL
    
    [ Upstream commit ce7d88110b9ed5f33fe79ea6d4ed049fb0e57bce ]
    
    Don't assume that only the driver would be accessing LNKCTL. ASPM policy
    changes can trigger write to LNKCTL outside of driver's control.  And in
    the case of upstream bridge, the driver does not even own the device it's
    changing the registers for.
    
    Use RMW capability accessors which do proper locking to avoid losing
    concurrent updates to the register value.
    
    Suggested-by: Lukas Wunner <[email protected]>
    Fixes: a2e73f56fa62 ("drm/amdgpu: Add support for CIK parts")
    Fixes: 62a37553414a ("drm/amdgpu: add si implementation v10")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/ast: Fix DRAM init on AST2200 [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Wed Jun 21 14:53:35 2023 +0200

    drm/ast: Fix DRAM init on AST2200
    
    commit 4cfe75f0f14f044dae66ad0e6eea812d038465d9 upstream.
    
    Fix the test for the AST2200 in the DRAM initialization. The value
    in ast->chip has to be compared against an enum constant instead of
    a numerical value.
    
    This bug got introduced when the driver was first imported into the
    kernel.
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Fixes: 312fec1405dd ("drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)")
    Cc: Dave Airlie <[email protected]>
    Cc: [email protected]
    Cc: <[email protected]> # v3.5+
    Reviewed-by: Sui Jingfeng <[email protected]>
    Reviewed-by: Jocelyn Falempe <[email protected]>
    Tested-by: Jocelyn Falempe <[email protected]> # AST2600
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/exynos: fix a possible null-pointer dereference due to data race in exynos_drm_crtc_atomic_disable() [+ + +]
Author: Tuo Li <[email protected]>
Date:   Fri Jun 30 10:19:06 2023 +0800

    drm/exynos: fix a possible null-pointer dereference due to data race in exynos_drm_crtc_atomic_disable()
    
    [ Upstream commit 2e63972a2de14482d0eae1a03a73e379f1c3f44c ]
    
    The variable crtc->state->event is often protected by the lock
    crtc->dev->event_lock when is accessed. However, it is accessed as a
    condition of an if statement in exynos_drm_crtc_atomic_disable() without
    holding the lock:
    
      if (crtc->state->event && !crtc->state->active)
    
    However, if crtc->state->event is changed to NULL by another thread right
    after the conditions of the if statement is checked to be true, a
    null-pointer dereference can occur in drm_crtc_send_vblank_event():
    
      e->pipe = pipe;
    
    To fix this possible null-pointer dereference caused by data race, the
    spin lock coverage is extended to protect the if statement as well as the
    function call to drm_crtc_send_vblank_event().
    
    Reported-by: BassCheck <[email protected]>
    Link: https://sites.google.com/view/basscheck/home
    Signed-off-by: Tuo Li <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Added relevant link.
    Signed-off-by: Inki Dae <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/msm/mdp5: Don't leak some plane state [+ + +]
Author: Daniel Vetter <[email protected]>
Date:   Thu Aug 3 22:45:21 2023 +0200

    drm/msm/mdp5: Don't leak some plane state
    
    [ Upstream commit fd0ad3b2365c1c58aa5a761c18efc4817193beb6 ]
    
    Apparently no one noticed that mdp5 plane states leak like a sieve
    ever since we introduced plane_state->commit refcount a few years ago
    in 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too
    early by tracking commits, v3.")
    
    Fix it by using the right helpers.
    
    Fixes: 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
    Cc: Maarten Lankhorst <[email protected]>
    Cc: Daniel Vetter <[email protected]>
    Cc: Rob Clark <[email protected]>
    Cc: Abhinav Kumar <[email protected]>
    Cc: Dmitry Baryshkov <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Reported-and-tested-by: [email protected]
    Cc: [email protected]
    Signed-off-by: Daniel Vetter <[email protected]>
    Reviewed-by: Rob Clark <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Reviewed-by: Abhinav Kumar <[email protected]>
    Patchwork: https://patchwork.freedesktop.org/patch/551236/
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/msm: Replace drm_framebuffer_{un/reference} with put, get functions [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Wed Sep 26 13:48:57 2018 +0200

    drm/msm: Replace drm_framebuffer_{un/reference} with put, get functions
    
    [ Upstream commit f2152d492ca4ff6d53b37edf1a137480c909f6ce ]
    
    This patch unifies the naming of DRM functions for reference counting
    of struct drm_framebuffer. The resulting code is more aligned with the
    rest of the Linux kernel interfaces.
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Signed-off-by: Rob Clark <[email protected]>
    Stable-dep-of: fd0ad3b2365c ("drm/msm/mdp5: Don't leak some plane state")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/radeon: Correct Transmit Margin masks [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Wed Nov 20 17:54:13 2019 -0600

    drm/radeon: Correct Transmit Margin masks
    
    [ Upstream commit 40bd4be5a652ce56068a8273b68caa38cb0d8f4b ]
    
    Previously we masked PCIe Link Control 2 register values with "7 << 9",
    which was apparently intended to be the Transmit Margin field, but instead
    was the high order bit of Transmit Margin, the Enter Modified Compliance
    bit, and the Compliance SOS bit.
    
    Correct the mask to "7 << 7", which is the Transmit Margin field.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: 7189576e8a82 ("drm/radeon: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/radeon: Prefer pcie_capability_read_word() [+ + +]
Author: Frederick Lawler <[email protected]>
Date:   Sun Nov 17 18:35:13 2019 -0600

    drm/radeon: Prefer pcie_capability_read_word()
    
    [ Upstream commit 3d581b11e34a92350983e5d3ecf469b5c677e295 ]
    
    Commit 8c0d3a02c130 ("PCI: Add accessors for PCI Express Capability")
    added accessors for the PCI Express Capability so that drivers didn't
    need to be aware of differences between v1 and v2 of the PCI
    Express Capability.
    
    Replace pci_read_config_word() and pci_write_config_word() calls with
    pcie_capability_read_word() and pcie_capability_write_word().
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Frederick Lawler <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: 7189576e8a82 ("drm/radeon: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Thu Nov 21 07:24:24 2019 -0600

    drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions
    
    [ Upstream commit ca56f99c18cafdeae6961ce9d87fc978506152ca ]
    
    Replace hard-coded magic numbers with the descriptive PCI_EXP_LNKCTL2
    definitions.  No functional change intended.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: 7189576e8a82 ("drm/radeon: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

drm/radeon: Use RMW accessors for changing LNKCTL [+ + +]
Author: Ilpo Järvinen <[email protected]>
Date:   Mon Jul 17 15:04:58 2023 +0300

    drm/radeon: Use RMW accessors for changing LNKCTL
    
    [ Upstream commit 7189576e8a829130192b33c5b64e8a475369c776 ]
    
    Don't assume that only the driver would be accessing LNKCTL. ASPM policy
    changes can trigger write to LNKCTL outside of driver's control.  And in
    the case of upstream bridge, the driver does not even own the device it's
    changing the registers for.
    
    Use RMW capability accessors which do proper locking to avoid losing
    concurrent updates to the register value.
    
    Suggested-by: Lukas Wunner <[email protected]>
    Fixes: 8a7cd27679d0 ("drm/radeon/cik: add support for pcie gen1/2/3 switching")
    Fixes: b9d305dfb66c ("drm/radeon: implement pcie gen2/3 support for SI")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/tegra: dpaux: Fix incorrect return value of platform_get_irq [+ + +]
Author: Yangtao Li <[email protected]>
Date:   Mon Jul 10 11:23:49 2023 +0800

    drm/tegra: dpaux: Fix incorrect return value of platform_get_irq
    
    [ Upstream commit 2a1ca44b654346cadfc538c4fb32eecd8daf3140 ]
    
    When platform_get_irq fails, we should return dpaux->irq
    instead of -ENXIO.
    
    Fixes: 6b6b604215c6 ("drm/tegra: Add eDP support")
    Signed-off-by: Yangtao Li <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/tegra: Remove superfluous error messages around platform_get_irq() [+ + +]
Author: Tan Zhongjun <[email protected]>
Date:   Thu Jun 10 14:39:55 2021 +0800

    drm/tegra: Remove superfluous error messages around platform_get_irq()
    
    [ Upstream commit d12919bb5da571ec50588ef97683d37e36dc2de5 ]
    
    The platform_get_irq() prints error message telling that interrupt is
    missing,hence there is no need to duplicated that message in the
    drivers.
    
    Signed-off-by: Tan Zhongjun <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Stable-dep-of: 2a1ca44b6543 ("drm/tegra: dpaux: Fix incorrect return value of platform_get_irq")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm: adv7511: Fix low refresh rate register for ADV7533/5 [+ + +]
Author: Bogdan Togorean <[email protected]>
Date:   Wed Jul 19 09:01:43 2023 +0300

    drm: adv7511: Fix low refresh rate register for ADV7533/5
    
    [ Upstream commit d281eeaa4de2636ff0c8e6ae387bb07b50e5fcbb ]
    
    For ADV7533 and ADV7535 low refresh rate is selected using
    bits [3:2] of 0x4a main register.
    So depending on ADV model write 0xfb or 0x4a register.
    
    Fixes: 2437e7cd88e8 ("drm/bridge: adv7533: Initial support for ADV7533")
    Reviewed-by: Robert Foss <[email protected]>
    Reviewed-by: Nuno Sa <[email protected]>
    Signed-off-by: Bogdan Togorean <[email protected]>
    Signed-off-by: Alexandru Ardelean <[email protected]>
    Reviewed-by: Frieder Schrempf <[email protected]>
    Signed-off-by: Robert Foss <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
erofs: ensure that the post-EOF tails are all zeroed [+ + +]
Author: Gao Xiang <[email protected]>
Date:   Thu Aug 31 19:29:59 2023 +0800

    erofs: ensure that the post-EOF tails are all zeroed
    
    commit e4c1cf523d820730a86cae2c6d55924833b6f7ac upstream.
    
    This was accidentally fixed up in commit e4c1cf523d82 but we can't
    take the full change due to other dependancy issues, so here is just
    the actual bugfix that is needed.
    
    [Background]
    
    keltargw reported an issue [1] that with mmaped I/Os, sometimes the
    tail of the last page (after file ends) is not filled with zeroes.
    
    The root cause is that such tail page could be wrongly selected for
    inplace I/Os so the zeroed part will then be filled with compressed
    data instead of zeroes.
    
    A simple fix is to avoid doing inplace I/Os for such tail parts,
    actually that was already fixed upstream in commit e4c1cf523d82
    ("erofs: tidy up z_erofs_do_read_page()") by accident.
    
    [1] https://lore.kernel.org/r/[email protected]
    
    Reported-by: keltargw <[email protected]>
    Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
    Signed-off-by: Gao Xiang <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
 
ethernet: atheros: fix return value check in atl1c_tso_csum() [+ + +]
Author: Yuanjun Gong <[email protected]>
Date:   Thu Jul 20 22:42:08 2023 +0800

    ethernet: atheros: fix return value check in atl1c_tso_csum()
    
    [ Upstream commit 8d01da0a1db237c44c92859ce3612df7af8d3a53 ]
    
    in atl1c_tso_csum, it should check the return value of pskb_trim(),
    and return an error code if an unexpected value is returned
    by pskb_trim().
    
    Signed-off-by: Yuanjun Gong <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
eventfd: Export eventfd_ctx_do_read() [+ + +]
Author: David Woodhouse <[email protected]>
Date:   Tue Oct 27 13:55:21 2020 +0000

    eventfd: Export eventfd_ctx_do_read()
    
    [ Upstream commit 28f1326710555bbe666f64452d08f2d7dd657cae ]
    
    Where events are consumed in the kernel, for example by KVM's
    irqfd_wakeup() and VFIO's virqfd_wakeup(), they currently lack a
    mechanism to drain the eventfd's counter.
    
    Since the wait queue is already locked while the wakeup functions are
    invoked, all they really need to do is call eventfd_ctx_do_read().
    
    Add a check for the lock, and export it for them.
    
    Signed-off-by: David Woodhouse <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Stable-dep-of: 758b49204781 ("eventfd: prevent underflow for eventfd semaphores")
    Signed-off-by: Sasha Levin <[email protected]>

eventfd: prevent underflow for eventfd semaphores [+ + +]
Author: Wen Yang <[email protected]>
Date:   Sun Jul 9 14:54:51 2023 +0800

    eventfd: prevent underflow for eventfd semaphores
    
    [ Upstream commit 758b492047816a3158d027e9fca660bc5bcf20bf ]
    
    For eventfd with flag EFD_SEMAPHORE, when its ctx->count is 0, calling
    eventfd_ctx_do_read will cause ctx->count to overflow to ULLONG_MAX.
    
    An underflow can happen with EFD_SEMAPHORE eventfds in at least the
    following three subsystems:
    
    (1) virt/kvm/eventfd.c
    (2) drivers/vfio/virqfd.c
    (3) drivers/virt/acrn/irqfd.c
    
    where (2) and (3) are just modeled after (1). An eventfd must be
    specified for use with the KVM_IRQFD ioctl(). This can also be an
    EFD_SEMAPHORE eventfd. When the eventfd count is zero or has been
    decremented to zero an underflow can be triggered when the irqfd is shut
    down by raising the KVM_IRQFD_FLAG_DEASSIGN flag in the KVM_IRQFD
    ioctl():
    
            // ctx->count == 0
            kvm_vm_ioctl()
            -> kvm_irqfd()
               -> kvm_irqfd_deassign()
                  -> irqfd_deactivate()
                     -> irqfd_shutdown()
                        -> eventfd_ctx_remove_wait_queue(&cnt)
                           -> eventfd_ctx_do_read(&cnt)
    
    Userspace polling on the eventfd wouldn't notice the underflow because 1
    is always returned as the value from eventfd_read() while ctx->count
    would've underflowed. It's not a huge deal because this should only be
    happening when the irqfd is shutdown but we should still fix it and
    avoid the spurious wakeup.
    
    Fixes: cb289d6244a3 ("eventfd - allow atomic read and waitqueue remove")
    Signed-off-by: Wen Yang <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Jens Axboe <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Dylan Yudaken <[email protected]>
    Cc: David Woodhouse <[email protected]>
    Cc: Matthew Wilcox <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Message-Id: <[email protected]>
    [brauner: rewrite commit message and add explanation how this underflow can happen]
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ext2: fix datatype of block number in ext2_xattr_set2() [+ + +]
Author: Georg Ottinger <[email protected]>
Date:   Tue Aug 15 12:03:40 2023 +0200

    ext2: fix datatype of block number in ext2_xattr_set2()
    
    [ Upstream commit e88076348425b7d0491c8c98d8732a7df8de7aa3 ]
    
    I run a small server that uses external hard drives for backups. The
    backup software I use uses ext2 filesystems with 4KiB block size and
    the server is running SELinux and therefore relies on xattr. I recently
    upgraded the hard drives from 4TB to 12TB models. I noticed that after
    transferring some TBs I got a filesystem error "Freeing blocks not in
    datazone - block = 18446744071529317386, count = 1" and the backup
    process stopped. Trying to fix the fs with e2fsck resulted in a
    completely corrupted fs. The error probably came from ext2_free_blocks(),
    and because of the large number 18e19 this problem immediately looked
    like some kind of integer overflow. Whereas the 4TB fs was about 1e9
    blocks, the new 12TB is about 3e9 blocks. So, searching the ext2 code,
    I came across the line in fs/ext2/xattr.c:745 where ext2_new_block()
    is called and the resulting block number is stored in the variable block
    as an int datatype. If a block with a block number greater than
    INT32_MAX is returned, this variable overflows and the call to
    sb_getblk() at line fs/ext2/xattr.c:750 fails, then the call to
    ext2_free_blocks() produces the error.
    
    Signed-off-by: Georg Ottinger <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fbdev/ep93xx-fb: Do not assign to struct fb_info.dev [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Tue Jun 13 13:06:49 2023 +0200

    fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
    
    commit f90a0e5265b60cdd3c77990e8105f79aa2fac994 upstream.
    
    Do not assing the Linux device to struct fb_info.dev. The call to
    register_framebuffer() initializes the field to the fbdev device.
    Drivers should not override its value.
    
    Fixes a bug where the driver incorrectly decreases the hardware
    device's reference counter and leaks the fbdev device.
    
    v2:
            * add Fixes tag (Dan)
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Fixes: 88017bda96a5 ("ep93xx video driver")
    Cc: <[email protected]> # v2.6.32+
    Reviewed-by: Javier Martinez Canillas <[email protected]>
    Reviewed-by: Sam Ravnborg <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount() [+ + +]
Author: Andrew Kanner <[email protected]>
Date:   Sat Jul 1 17:05:42 2023 +0300

    fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount()
    
    [ Upstream commit cade5397e5461295f3cb87880534b6a07cafa427 ]
    
    Syzkaller reported the following issue:
    ==================================================================
    BUG: KASAN: double-free in slab_free mm/slub.c:3787 [inline]
    BUG: KASAN: double-free in __kmem_cache_free+0x71/0x110 mm/slub.c:3800
    Free of addr ffff888086408000 by task syz-executor.4/12750
    [...]
    Call Trace:
     <TASK>
    [...]
     kasan_report_invalid_free+0xac/0xd0 mm/kasan/report.c:482
     ____kasan_slab_free+0xfb/0x120
     kasan_slab_free include/linux/kasan.h:177 [inline]
     slab_free_hook mm/slub.c:1781 [inline]
     slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1807
     slab_free mm/slub.c:3787 [inline]
     __kmem_cache_free+0x71/0x110 mm/slub.c:3800
     dbUnmount+0xf4/0x110 fs/jfs/jfs_dmap.c:264
     jfs_umount+0x248/0x3b0 fs/jfs/jfs_umount.c:87
     jfs_put_super+0x86/0x190 fs/jfs/super.c:194
     generic_shutdown_super+0x130/0x310 fs/super.c:492
     kill_block_super+0x79/0xd0 fs/super.c:1386
     deactivate_locked_super+0xa7/0xf0 fs/super.c:332
     cleanup_mnt+0x494/0x520 fs/namespace.c:1291
     task_work_run+0x243/0x300 kernel/task_work.c:179
     resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
     exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171
     exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203
     __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
     syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296
     do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [...]
     </TASK>
    
    Allocated by task 13352:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
     ____kasan_kmalloc mm/kasan/common.c:371 [inline]
     __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380
     kmalloc include/linux/slab.h:580 [inline]
     dbMount+0x54/0x980 fs/jfs/jfs_dmap.c:164
     jfs_mount+0x1dd/0x830 fs/jfs/jfs_mount.c:121
     jfs_fill_super+0x590/0xc50 fs/jfs/super.c:556
     mount_bdev+0x26c/0x3a0 fs/super.c:1359
     legacy_get_tree+0xea/0x180 fs/fs_context.c:610
     vfs_get_tree+0x88/0x270 fs/super.c:1489
     do_new_mount+0x289/0xad0 fs/namespace.c:3145
     do_mount fs/namespace.c:3488 [inline]
     __do_sys_mount fs/namespace.c:3697 [inline]
     __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3674
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Freed by task 13352:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
     kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:518
     ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
     kasan_slab_free include/linux/kasan.h:177 [inline]
     slab_free_hook mm/slub.c:1781 [inline]
     slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1807
     slab_free mm/slub.c:3787 [inline]
     __kmem_cache_free+0x71/0x110 mm/slub.c:3800
     dbUnmount+0xf4/0x110 fs/jfs/jfs_dmap.c:264
     jfs_mount_rw+0x545/0x740 fs/jfs/jfs_mount.c:247
     jfs_remount+0x3db/0x710 fs/jfs/super.c:454
     reconfigure_super+0x3bc/0x7b0 fs/super.c:935
     vfs_fsconfig_locked fs/fsopen.c:254 [inline]
     __do_sys_fsconfig fs/fsopen.c:439 [inline]
     __se_sys_fsconfig+0xad5/0x1060 fs/fsopen.c:314
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [...]
    
    JFS_SBI(ipbmap->i_sb)->bmap wasn't set to NULL after kfree() in
    dbUnmount().
    
    Syzkaller uses faultinject to reproduce this KASAN double-free
    warning. The issue is triggered if either diMount() or dbMount() fail
    in jfs_remount(), since diUnmount() or dbUnmount() already happened in
    such a case - they will do double-free on next execution: jfs_umount
    or jfs_remount.
    
    Tested on both upstream and jfs-next by syzkaller.
    
    Reported-and-tested-by: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/T/
    Link: https://syzkaller.appspot.com/bug?extid=6a93efb725385bc4b2e9
    Signed-off-by: Andrew Kanner <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs/nls: make load_nls() take a const parameter [+ + +]
Author: Winston Wen <[email protected]>
Date:   Mon Jul 24 10:10:56 2023 +0800

    fs/nls: make load_nls() take a const parameter
    
    [ Upstream commit c1ed39ec116272935528ca9b348b8ee79b0791da ]
    
    load_nls() take a char * parameter, use it to find nls module in list or
    construct the module name to load it.
    
    This change make load_nls() take a const parameter, so we don't need do
    some cast like this:
    
            ses->local_nls = load_nls((char *)ctx->local_nls->charset);
    
    Suggested-by: Stephen Rothwell <[email protected]>
    Signed-off-by: Winston Wen <[email protected]>
    Reviewed-by: Paulo Alcantara <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs: Fix error checking for d_hash_and_lookup() [+ + +]
Author: Wang Ming <[email protected]>
Date:   Thu Jul 13 20:05:42 2023 +0800

    fs: Fix error checking for d_hash_and_lookup()
    
    [ Upstream commit 0d5a4f8f775ff990142cdc810a84eae078589d27 ]
    
    The d_hash_and_lookup() function returns error pointers or NULL.
    Most incorrect error checks were fixed, but the one in int path_pts()
    was forgotten.
    
    Fixes: eedf265aa003 ("devpts: Make each mount of devpts an independent filesystem.")
    Signed-off-by: Wang Ming <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

fs: lockd: avoid possible wrong NULL parameter [+ + +]
Author: Su Hui <[email protected]>
Date:   Fri Aug 4 09:26:57 2023 +0800

    fs: lockd: avoid possible wrong NULL parameter
    
    [ Upstream commit de8d38cf44bac43e83bad28357ba84784c412752 ]
    
    clang's static analysis warning: fs/lockd/mon.c: line 293, column 2:
    Null pointer passed as 2nd argument to memory copy function.
    
    Assuming 'hostname' is NULL and calling 'nsm_create_handle()', this will
    pass NULL as 2nd argument to memory copy function 'memcpy()'. So return
    NULL if 'hostname' is invalid.
    
    Fixes: 77a3ef33e2de ("NSM: More clean up of nsm_get_handle()")
    Signed-off-by: Su Hui <[email protected]>
    Reviewed-by: Nick Desaulniers <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

fs: ocfs2: namei: check return value of ocfs2_add_entry() [+ + +]
Author: Artem Chernyshev <[email protected]>
Date:   Thu Aug 3 17:54:17 2023 +0300

    fs: ocfs2: namei: check return value of ocfs2_add_entry()
    
    [ Upstream commit 6b72e5f9e79360fce4f2be7fe81159fbdf4256a5 ]
    
    Process result of ocfs2_add_entry() in case we have an error
    value.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: ccd979bdbce9 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
    Signed-off-by: Artem Chernyshev <[email protected]>
    Reviewed-by: Joseph Qi <[email protected]>
    Cc: Artem Chernyshev <[email protected]>
    Cc: Joel Becker <[email protected]>
    Cc: Kurt Hackel <[email protected]>
    Cc: Mark Fasheh <[email protected]>
    Cc: Junxiao Bi <[email protected]>
    Cc: Changwei Ge <[email protected]>
    Cc: Gang He <[email protected]>
    Cc: Jun Piao <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fsi: master-ast-cf: Add MODULE_FIRMWARE macro [+ + +]
Author: Juerg Haefliger <[email protected]>
Date:   Wed Jun 28 11:50:39 2023 +0200

    fsi: master-ast-cf: Add MODULE_FIRMWARE macro
    
    commit 3a1d7aff6e65ad6e285e28abe55abbfd484997ee upstream.
    
    The module loads firmware so add a MODULE_FIRMWARE macro to provide that
    information via modinfo.
    
    Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire")
    Cc: [email protected] # 4.19+
    Signed-off-by: Juerg Haefliger <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Joel Stanley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
HID: multitouch: Correct devm device reference for hidinput input_dev name [+ + +]
Author: Rahul Rameshbabu <[email protected]>
Date:   Thu Aug 24 06:14:33 2023 +0000

    HID: multitouch: Correct devm device reference for hidinput input_dev name
    
    [ Upstream commit 4794394635293a3e74591351fff469cea7ad15a2 ]
    
    Reference the HID device rather than the input device for the devm
    allocation of the input_dev name. Referencing the input_dev would lead to a
    use-after-free when the input_dev was unregistered and subsequently fires a
    uevent that depends on the name. At the point of firing the uevent, the
    name would be freed by devres management.
    
    Use devm_kasprintf to simplify the logic for allocating memory and
    formatting the input_dev name string.
    
    Reported-by: Maxime Ripard <[email protected]>
    Closes: https://lore.kernel.org/linux-input/ZOZIZCND+L0P1wJc@penguin/T/#m443f3dce92520f74b6cf6ffa8653f9c92643d4ae
    Fixes: c08d46aa805b ("HID: multitouch: devm conversion")
    Suggested-by: Maxime Ripard <[email protected]>
    Suggested-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Rahul Rameshbabu <[email protected]>
    Reviewed-by: Maxime Ripard <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: wacom: remove the battery when the EKR is off [+ + +]
Author: Aaron Armstrong Skomra <[email protected]>
Date:   Tue Jul 25 15:20:25 2023 -0700

    HID: wacom: remove the battery when the EKR is off
    
    commit 9ac6678b95b0dd9458a7a6869f46e51cd55a1d84 upstream.
    
    Currently the EKR battery remains even after we stop getting information
    from the device. This can lead to a stale battery persisting indefinitely
    in userspace.
    
    The remote sends a heartbeat every 10 seconds. Delete the battery if we
    miss two heartbeats (after 21 seconds). Restore the battery once we see
    a heartbeat again.
    
    Signed-off-by: Aaron Skomra <[email protected]>
    Signed-off-by: Aaron Armstrong Skomra <[email protected]>
    Reviewed-by: Jason Gerecke <[email protected]>
    Fixes: 9f1015d45f62 ("HID: wacom: EKR: attach the power_supply on first connection")
    CC: [email protected]
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
hw_breakpoint: fix single-stepping when using bpf_overflow_handler [+ + +]
Author: Tomislav Novak <[email protected]>
Date:   Mon Jun 5 12:19:23 2023 -0700

    hw_breakpoint: fix single-stepping when using bpf_overflow_handler
    
    [ Upstream commit d11a69873d9a7435fe6a48531e165ab80a8b1221 ]
    
    Arm platforms use is_default_overflow_handler() to determine if the
    hw_breakpoint code should single-step over the breakpoint trigger or
    let the custom handler deal with it.
    
    Since bpf_overflow_handler() currently isn't recognized as a default
    handler, attaching a BPF program to a PERF_TYPE_BREAKPOINT event causes
    it to keep firing (the instruction triggering the data abort exception
    is never skipped). For example:
    
      # bpftrace -e 'watchpoint:0x10000:4:w { print("hit") }' -c ./test
      Attaching 1 probe...
      hit
      hit
      [...]
      ^C
    
    (./test performs a single 4-byte store to 0x10000)
    
    This patch replaces the check with uses_default_overflow_handler(),
    which accounts for the bpf_overflow_handler() case by also testing
    if one of the perf_event_output functions gets invoked indirectly,
    via orig_default_handler.
    
    Signed-off-by: Tomislav Novak <[email protected]>
    Tested-by: Samuel Gosselin <[email protected]> # arm64
    Reviewed-by: Catalin Marinas <[email protected]>
    Acked-by: Alexei Starovoitov <[email protected]>
    Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
IB/uverbs: Fix an potential error pointer dereference [+ + +]
Author: Xiang Yang <[email protected]>
Date:   Fri Aug 4 10:25:25 2023 +0800

    IB/uverbs: Fix an potential error pointer dereference
    
    [ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]
    
    smatch reports the warning below:
    drivers/infiniband/core/uverbs_std_types_counters.c:110
    ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr'
    dereferencing possible ERR_PTR()
    
    The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking
    the value of uattr before using it.
    
    Fixes: ebb6796bd397 ("IB/uverbs: Add read counters support")
    Signed-off-by: Xiang Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM [+ + +]
Author: Baoquan He <[email protected]>
Date:   Fri Jul 7 21:58:45 2023 +0800

    idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM
    
    [ Upstream commit b1e213a9e31c20206f111ec664afcf31cbfe0dbb ]
    
    On s390 systems (aka mainframes), it has classic channel devices for
    networking and permanent storage that are currently even more common
    than PCI devices. Hence it could have a fully functional s390 kernel
    with CONFIG_PCI=n, then the relevant iomem mapping functions
    [including ioremap(), devm_ioremap(), etc.] are not available.
    
    Here let FSL_EDMA and INTEL_IDMA64 depend on HAS_IOMEM so that it
    won't be built to cause below compiling error if PCI is unset.
    
    --------
    ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined!
    ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/idma64.ko] undefined!
    --------
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Baoquan He <[email protected]>
    Cc: Vinod Koul <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
idr: fix param name in idr_alloc_cyclic() doc [+ + +]
Author: Ariel Marcovitch <[email protected]>
Date:   Sat Aug 26 20:33:17 2023 +0300

    idr: fix param name in idr_alloc_cyclic() doc
    
    [ Upstream commit 2a15de80dd0f7e04a823291aa9eb49c5294f56af ]
    
    The relevant parameter is 'start' and not 'nextid'
    
    Fixes: 460488c58ca8 ("idr: Remove idr_alloc_ext")
    Signed-off-by: Ariel Marcovitch <[email protected]>
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igb: Change IGB_MIN to allow set rx/tx value between 64 and 80 [+ + +]
Author: Olga Zaborska <[email protected]>
Date:   Tue Jul 25 10:10:58 2023 +0200

    igb: Change IGB_MIN to allow set rx/tx value between 64 and 80
    
    [ Upstream commit 6319685bdc8ad5310890add907b7c42f89302886 ]
    
    Change the minimum value of RX/TX descriptors to 64 to enable setting the rx/tx
    value between 64 and 80. All igb devices can use as low as 64 descriptors.
    This change will unify igb with other drivers.
    Based on commit 7b1be1987c1e ("e1000e: lower ring minimum size to 64")
    
    Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")
    Signed-off-by: Olga Zaborska <[email protected]>
    Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igb: disable virtualization features on 82580 [+ + +]
Author: Corinna Vinschen <[email protected]>
Date:   Thu Aug 31 14:19:13 2023 +0200

    igb: disable virtualization features on 82580
    
    [ Upstream commit fa09bc40b21a33937872c4c4cf0f266ec9fa4869 ]
    
    Disable virtualization features on 82580 just as on i210/i211.
    This avoids that virt functions are acidentally called on 82850.
    
    Fixes: 55cac248caa4 ("igb: Add full support for 82580 devices")
    Signed-off-by: Corinna Vinschen <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igb: set max size RX buffer when store bad packet is enabled [+ + +]
Author: Radoslaw Tyl <[email protected]>
Date:   Thu Aug 24 13:46:19 2023 -0700

    igb: set max size RX buffer when store bad packet is enabled
    
    commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f upstream.
    
    Increase the RX buffer size to 3K when the SBP bit is on. The size of
    the RX buffer determines the number of pages allocated which may not
    be sufficient for receive frames larger than the set MTU size.
    
    Cc: [email protected]
    Fixes: 89eaefb61dc9 ("igb: Support RX-ALL feature flag.")
    Reported-by: Manfred Rudigier <[email protected]>
    Signed-off-by: Radoslaw Tyl <[email protected]>
    Tested-by: Arpana Arland <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80 [+ + +]
Author: Olga Zaborska <[email protected]>
Date:   Tue Jul 25 10:10:57 2023 +0200

    igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80
    
    [ Upstream commit 8360717524a24a421c36ef8eb512406dbd42160a ]
    
    Change the minimum value of RX/TX descriptors to 64 to enable setting the rx/tx
    value between 64 and 80. All igbvf devices can use as low as 64 descriptors.
    This change will unify igbvf with other drivers.
    Based on commit 7b1be1987c1e ("e1000e: lower ring minimum size to 64")
    
    Fixes: d4e0fe01a38a ("igbvf: add new driver to support 82576 virtual functions")
    Signed-off-by: Olga Zaborska <[email protected]>
    Tested-by: Rafal Romanowski <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue Sep 5 04:23:38 2023 +0000

    igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
    
    commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream.
    
    This is a follow up of commit 915d975b2ffa ("net: deal with integer
    overflows in kmalloc_reserve()") based on David Laight feedback.
    
    Back in 2010, I failed to realize malicious users could set dev->mtu
    to arbitrary values. This mtu has been since limited to 0x7fffffff but
    regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack()
    to allocate more than IP_MAX_MTU and risk various skb fields overflows.
    
    Fixes: 57e1ab6eaddc ("igmp: refine skb allocations")
    Link: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: David Laight <[email protected]>
    Cc: Kyle Zeng <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iio: core: Use min() instead of min_t() to make code more robust [+ + +]
Author: Andy Shevchenko <[email protected]>
Date:   Fri Jul 21 20:00:18 2023 +0300

    iio: core: Use min() instead of min_t() to make code more robust
    
    [ Upstream commit cb1d17535061ca295903f97f5cb0af9db719c02c ]
    
    min() has strict type checking and preferred over min_t() for
    unsigned types to avoid overflow. Here it's unclear why min_t()
    was chosen since both variables are of the same type. In any
    case update to use min().
    
    Signed-off-by: Andy Shevchenko <[email protected]>
    Reviewed-by: Nuno Sa <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipmi_si: fix a memleak in try_smi_init() [+ + +]
Author: Yi Yang <[email protected]>
Date:   Thu Jun 29 20:33:28 2023 +0800

    ipmi_si: fix a memleak in try_smi_init()
    
    commit 6cf1a126de2992b4efe1c3c4d398f8de4aed6e3f upstream.
    
    Kmemleak reported the following leak info in try_smi_init():
    
    unreferenced object 0xffff00018ecf9400 (size 1024):
      comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s)
      backtrace:
        [<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
        [<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
        [<000000006460d325>] 0xffff800081b10148
        [<0000000039206ea5>] do_one_initcall+0x64/0x2a4
        [<00000000601399ce>] do_init_module+0x50/0x300
        [<000000003c12ba3c>] load_module+0x7a8/0x9e0
        [<00000000c246fffe>] __se_sys_init_module+0x104/0x180
        [<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
        [<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
        [<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
        [<000000005a05337f>] el0_svc+0x24/0x3c
        [<000000005eb248d6>] el0_sync_handler+0x160/0x164
        [<0000000030a59039>] el0_sync+0x160/0x180
    
    The problem was that when an error occurred before handlers registration
    and after allocating `new_smi->si_sm`, the variable wouldn't be freed in
    the error handling afterwards since `shutdown_smi()` hadn't been
    registered yet. Fix it by adding a `kfree()` in the error handling path
    in `try_smi_init()`.
    
    Cc: [email protected] # 4.19+
    Fixes: 7960f18a5647 ("ipmi_si: Convert over to a shutdown handler")
    Signed-off-by: Yi Yang <[email protected]>
    Co-developed-by: GONG, Ruiqi <[email protected]>
    Signed-off-by: GONG, Ruiqi <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Corey Minyard <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ixgbe: fix timestamp configuration code [+ + +]
Author: Vadim Fedorenko <[email protected]>
Date:   Mon Sep 11 13:28:14 2023 -0700

    ixgbe: fix timestamp configuration code
    
    [ Upstream commit 3c44191dd76cf9c0cc49adaf34384cbd42ef8ad2 ]
    
    The commit in fixes introduced flags to control the status of hardware
    configuration while processing packets. At the same time another structure
    is used to provide configuration of timestamper to user-space applications.
    The way it was coded makes this structures go out of sync easily. The
    repro is easy for 82599 chips:
    
    [root@hostname ~]# hwstamp_ctl -i eth0 -r 12 -t 1
    current settings:
    tx_type 0
    rx_filter 0
    new settings:
    tx_type 1
    rx_filter 12
    
    The eth0 device is properly configured to timestamp any PTPv2 events.
    
    [root@hostname ~]# hwstamp_ctl -i eth0 -r 1 -t 1
    current settings:
    tx_type 1
    rx_filter 12
    SIOCSHWTSTAMP failed: Numerical result out of range
    The requested time stamping mode is not supported by the hardware.
    
    The error is properly returned because HW doesn't support all packets
    timestamping. But the adapter->flags is cleared of timestamp flags
    even though no HW configuration was done. From that point no RX timestamps
    are received by user-space application. But configuration shows good
    values:
    
    [root@hostname ~]# hwstamp_ctl -i eth0
    current settings:
    tx_type 1
    rx_filter 12
    
    Fix the issue by applying new flags only when the HW was actually
    configured.
    
    Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
    Signed-off-by: Vadim Fedorenko <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount [+ + +]
Author: Liu Shixin via Jfs-discussion <[email protected]>
Date:   Thu Dec 1 20:46:28 2022 +0800

    jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount
    
    [ Upstream commit 6e2bda2c192d0244b5a78b787ef20aa10cb319b7 ]
    
    syzbot found an invalid-free in diUnmount:
    
    BUG: KASAN: double-free in slab_free mm/slub.c:3661 [inline]
    BUG: KASAN: double-free in __kmem_cache_free+0x71/0x110 mm/slub.c:3674
    Free of addr ffff88806f410000 by task syz-executor131/3632
    
     CPU: 0 PID: 3632 Comm: syz-executor131 Not tainted 6.1.0-rc7-syzkaller-00012-gca57f02295f1 #0
     Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
     Call Trace:
      <TASK>
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
      print_address_description+0x74/0x340 mm/kasan/report.c:284
      print_report+0x107/0x1f0 mm/kasan/report.c:395
      kasan_report_invalid_free+0xac/0xd0 mm/kasan/report.c:460
      ____kasan_slab_free+0xfb/0x120
      kasan_slab_free include/linux/kasan.h:177 [inline]
      slab_free_hook mm/slub.c:1724 [inline]
      slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1750
      slab_free mm/slub.c:3661 [inline]
      __kmem_cache_free+0x71/0x110 mm/slub.c:3674
      diUnmount+0xef/0x100 fs/jfs/jfs_imap.c:195
      jfs_umount+0x108/0x370 fs/jfs/jfs_umount.c:63
      jfs_put_super+0x86/0x190 fs/jfs/super.c:194
      generic_shutdown_super+0x130/0x310 fs/super.c:492
      kill_block_super+0x79/0xd0 fs/super.c:1428
      deactivate_locked_super+0xa7/0xf0 fs/super.c:332
      cleanup_mnt+0x494/0x520 fs/namespace.c:1186
      task_work_run+0x243/0x300 kernel/task_work.c:179
      exit_task_work include/linux/task_work.h:38 [inline]
      do_exit+0x664/0x2070 kernel/exit.c:820
      do_group_exit+0x1fd/0x2b0 kernel/exit.c:950
      __do_sys_exit_group kernel/exit.c:961 [inline]
      __se_sys_exit_group kernel/exit.c:959 [inline]
      __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:959
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [...]
    
    JFS_IP(ipimap)->i_imap is not setting to NULL after free in diUnmount.
    If jfs_remount() free JFS_IP(ipimap)->i_imap but then failed at diMount().
    JFS_IP(ipimap)->i_imap will be freed once again.
    Fix this problem by setting JFS_IP(ipimap)->i_imap to NULL after free.
    
    Reported-by: [email protected]
    Signed-off-by: Liu Shixin <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: validate max amount of blocks before allocation. [+ + +]
Author: Alexei Filippov <[email protected]>
Date:   Sat Aug 19 20:32:16 2023 +0300

    jfs: validate max amount of blocks before allocation.
    
    [ Upstream commit 0225e10972fa809728b8d4c1bd2772b3ec3fdb57 ]
    
    The lack of checking bmp->db_max_freebud in extBalloc() can lead to
    shift out of bounds, so this patch prevents undefined behavior, because
    bmp->db_max_freebud == -1 only if there is no free space.
    
    Signed-off-by: Aleksei Filippov <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?id=01abadbd6ae6a08b1f1987aa61554c6b3ac19ff2
    Signed-off-by: Sasha Levin <[email protected]>

 
kcm: Destroy mutex in kcm_exit_net() [+ + +]
Author: Shigeru Yoshida <[email protected]>
Date:   Sun Sep 3 02:07:08 2023 +0900

    kcm: Destroy mutex in kcm_exit_net()
    
    [ Upstream commit 6ad40b36cd3b04209e2d6c89d252c873d8082a59 ]
    
    kcm_exit_net() should call mutex_destroy() on knet->mutex. This is especially
    needed if CONFIG_DEBUG_MUTEXES is enabled.
    
    Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
    Signed-off-by: Shigeru Yoshida <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg(). [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Mon Sep 11 19:27:53 2023 -0700

    kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
    
    [ Upstream commit a22730b1b4bf437c6bbfdeff5feddf54be4aeada ]
    
    syzkaller found a memory leak in kcm_sendmsg(), and commit c821a88bd720
    ("kcm: Fix memory leak in error path of kcm_sendmsg()") suppressed it by
    updating kcm_tx_msg(head)->last_skb if partial data is copied so that the
    following sendmsg() will resume from the skb.
    
    However, we cannot know how many bytes were copied when we get the error.
    Thus, we could mess up the MSG_MORE queue.
    
    When kcm_sendmsg() fails for SOCK_DGRAM, we should purge the queue as we
    do so for UDP by udp_flush_pending_frames().
    
    Even without this change, when the error occurred, the following sendmsg()
    resumed from a wrong skb and the queue was messed up.  However, we have
    yet to get such a report, and only syzkaller stumbled on it.  So, this
    can be changed safely.
    
    Note this does not change SOCK_SEQPACKET behaviour.
    
    Fixes: c821a88bd720 ("kcm: Fix memory leak in error path of kcm_sendmsg()")
    Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kcm: Fix memory leak in error path of kcm_sendmsg() [+ + +]
Author: Shigeru Yoshida <[email protected]>
Date:   Sun Sep 10 02:03:10 2023 +0900

    kcm: Fix memory leak in error path of kcm_sendmsg()
    
    [ Upstream commit c821a88bd720b0046433173185fd841a100d44ad ]
    
    syzbot reported a memory leak like below:
    
    BUG: memory leak
    unreferenced object 0xffff88810b088c00 (size 240):
      comm "syz-executor186", pid 5012, jiffies 4294943306 (age 13.680s)
      hex dump (first 32 bytes):
        00 89 08 0b 81 88 ff ff 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff83e5d5ff>] __alloc_skb+0x1ef/0x230 net/core/skbuff.c:634
        [<ffffffff84606e59>] alloc_skb include/linux/skbuff.h:1289 [inline]
        [<ffffffff84606e59>] kcm_sendmsg+0x269/0x1050 net/kcm/kcmsock.c:815
        [<ffffffff83e479c6>] sock_sendmsg_nosec net/socket.c:725 [inline]
        [<ffffffff83e479c6>] sock_sendmsg+0x56/0xb0 net/socket.c:748
        [<ffffffff83e47f55>] ____sys_sendmsg+0x365/0x470 net/socket.c:2494
        [<ffffffff83e4c389>] ___sys_sendmsg+0xc9/0x130 net/socket.c:2548
        [<ffffffff83e4c536>] __sys_sendmsg+0xa6/0x120 net/socket.c:2577
        [<ffffffff84ad7bb8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        [<ffffffff84ad7bb8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
        [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    In kcm_sendmsg(), kcm_tx_msg(head)->last_skb is used as a cursor to append
    newly allocated skbs to 'head'. If some bytes are copied, an error occurred,
    and jumped to out_error label, 'last_skb' is left unmodified. A later
    kcm_sendmsg() will use an obsoleted 'last_skb' reference, corrupting the
    'head' frag_list and causing the leak.
    
    This patch fixes this issue by properly updating the last allocated skb in
    'last_skb'.
    
    Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=6f98de741f7dbbfc4ccb
    Signed-off-by: Shigeru Yoshida <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
kconfig: fix possible buffer overflow [+ + +]
Author: Konstantin Meskhidze <[email protected]>
Date:   Tue Sep 5 17:59:14 2023 +0800

    kconfig: fix possible buffer overflow
    
    [ Upstream commit a3b7039bb2b22fcd2ad20d59c00ed4e606ce3754 ]
    
    Buffer 'new_argv' is accessed without bound check after accessing with
    bound check via 'new_argc' index.
    
    Fixes: e298f3b49def ("kconfig: add built-in function support")
    Co-developed-by: Ivanov Mikhail <[email protected]>
    Signed-off-by: Konstantin Meskhidze <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
kobject: Add sanity check for kset->kobj.ktype in kset_register() [+ + +]
Author: Zhen Lei <[email protected]>
Date:   Sat Aug 5 16:41:13 2023 +0800

    kobject: Add sanity check for kset->kobj.ktype in kset_register()
    
    [ Upstream commit 4d0fe8c52bb3029d83e323c961221156ab98680b ]
    
    When I register a kset in the following way:
            static struct kset my_kset;
            kobject_set_name(&my_kset.kobj, "my_kset");
            ret = kset_register(&my_kset);
    
    A null pointer dereference exception is occurred:
    [ 4453.568337] Unable to handle kernel NULL pointer dereference at \
    virtual address 0000000000000028
    ... ...
    [ 4453.810361] Call trace:
    [ 4453.813062]  kobject_get_ownership+0xc/0x34
    [ 4453.817493]  kobject_add_internal+0x98/0x274
    [ 4453.822005]  kset_register+0x5c/0xb4
    [ 4453.825820]  my_kobj_init+0x44/0x1000 [my_kset]
    ... ...
    
    Because I didn't initialize my_kset.kobj.ktype.
    
    According to the description in Documentation/core-api/kobject.rst:
     - A ktype is the type of object that embeds a kobject.  Every structure
       that embeds a kobject needs a corresponding ktype.
    
    So add sanity check to make sure kset->kobj.ktype is not NULL.
    
    Signed-off-by: Zhen Lei <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Linux 4.19.295 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat Sep 23 10:48:18 2023 +0200

    Linux 4.19.295
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
lwt: Check LWTUNNEL_XMIT_CONTINUE strictly [+ + +]
Author: Yan Zhai <[email protected]>
Date:   Thu Aug 17 19:58:14 2023 -0700

    lwt: Check LWTUNNEL_XMIT_CONTINUE strictly
    
    [ Upstream commit a171fbec88a2c730b108c7147ac5e7b2f5a02b47 ]
    
    LWTUNNEL_XMIT_CONTINUE is implicitly assumed in ip(6)_finish_output2,
    such that any positive return value from a xmit hook could cause
    unexpected continue behavior, despite that related skb may have been
    freed. This could be error-prone for future xmit hook ops. One of the
    possible errors is to return statuses of dst_output directly.
    
    To make the code safer, redefine LWTUNNEL_XMIT_CONTINUE value to
    distinguish from dst_output statuses and check the continue
    condition explicitly.
    
    Fixes: 3a0af8fd61f9 ("bpf: BPF for lightweight tunnel infrastructure")
    Suggested-by: Dan Carpenter <[email protected]>
    Signed-off-by: Yan Zhai <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Link: https://lore.kernel.org/bpf/96b939b85eda00e8df4f7c080f770970a4c5f698.1692326837.git.yan@cloudflare.com
    Signed-off-by: Sasha Levin <[email protected]>

 
m68k: Fix invalid .section syntax [+ + +]
Author: Ben Hutchings <[email protected]>
Date:   Fri Jun 16 17:36:10 2023 +0200

    m68k: Fix invalid .section syntax
    
    [ Upstream commit 922a9bd138101e3e5718f0f4d40dba68ef89bb43 ]
    
    gas supports several different forms for .section for ELF targets,
    including:
        .section NAME [, "FLAGS"[, @TYPE[,FLAG_SPECIFIC_ARGUMENTS]]]
    and:
        .section "NAME"[, #FLAGS...]
    
    In several places we use a mix of these two forms:
        .section NAME, #FLAGS...
    
    A current development snapshot of binutils (2.40.50.20230611) treats
    this mixed syntax as an error.
    
    Change to consistently use:
        .section NAME, "FLAGS"
    as is used elsewhere in the kernel.
    
    Link: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=m68k&ver=6.4%7Erc6-1%7Eexp1&stamp=1686907300&raw=1
    Signed-off-by: Ben Hutchings <[email protected]>
    Tested-by: Jan-Benedict Glaw <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
md/raid1: fix error: ISO C90 forbids mixed declarations [+ + +]
Author: Nigel Croxon <[email protected]>
Date:   Mon Sep 11 14:25:23 2023 -0700

    md/raid1: fix error: ISO C90 forbids mixed declarations
    
    [ Upstream commit df203da47f4428bc286fc99318936416253a321c ]
    
    There is a compile error when this commit is added:
    md: raid1: fix potential OOB in raid1_remove_disk()
    
    drivers/md/raid1.c: In function 'raid1_remove_disk':
    drivers/md/raid1.c:1844:9: error: ISO C90 forbids mixed declarations
    and code [-Werror=declaration-after-statement]
    1844 |         struct raid1_info *p = conf->mirrors + number;
         |         ^~~~~~
    
    That's because the new code was inserted before the struct.
    The change is move the struct command above this commit.
    
    Fixes: 8b0472b50bcf ("md: raid1: fix potential OOB in raid1_remove_disk()")
    Signed-off-by: Nigel Croxon <[email protected]>
    Signed-off-by: Song Liu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
md: raid1: fix potential OOB in raid1_remove_disk() [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sat Jul 22 15:53:53 2023 +0800

    md: raid1: fix potential OOB in raid1_remove_disk()
    
    [ Upstream commit 8b0472b50bcf0f19a5119b00a53b63579c8e1e4d ]
    
    If rddev->raid_disk is greater than mddev->raid_disks, there will be
    an out-of-bounds in raid1_remove_disk(). We have already found
    similar reports as follows:
    
    1) commit d17f744e883b ("md-raid10: fix KASAN warning")
    2) commit 1ebc2cec0b7d ("dm raid: fix KASAN warning in raid5_remove_disk")
    
    Fix this bug by checking whether the "number" variable is
    valid.
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Reviewed-by: Yu Kuai <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Song Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
media: af9005: Fix null-ptr-deref in af9005_i2c_xfer [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sat Jul 8 23:24:11 2023 +0800

    media: af9005: Fix null-ptr-deref in af9005_i2c_xfer
    
    [ Upstream commit f4ee84f27625ce1fdf41e8483fa0561a1b837d10 ]
    
    In af9005_i2c_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach af9005_i2c_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a
    ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: anysee: fix null-ptr-deref in anysee_master_xfer [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sun Jul 9 00:02:20 2023 +0800

    media: anysee: fix null-ptr-deref in anysee_master_xfer
    
    [ Upstream commit c30411266fd67ea3c02a05c157231654d5a3bdc9 ]
    
    In anysee_master_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach anysee_master_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a
    ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [hverkuil: add spaces around +]
    Signed-off-by: Sasha Levin <[email protected]>

media: az6007: Fix null-ptr-deref in az6007_i2c_xfer() [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sun Jul 9 00:28:17 2023 +0800

    media: az6007: Fix null-ptr-deref in az6007_i2c_xfer()
    
    [ Upstream commit 1047f9343011f2cedc73c64829686206a7e9fc3f ]
    
    In az6007_i2c_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach az6007_i2c_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a
    ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: cx24120: Add retval check for cx24120_message_send() [+ + +]
Author: Daniil Dulov <[email protected]>
Date:   Fri Jun 2 01:55:01 2023 -0700

    media: cx24120: Add retval check for cx24120_message_send()
    
    [ Upstream commit 96002c0ac824e1773d3f706b1f92e2a9f2988047 ]
    
    If cx24120_message_send() returns error, we should keep local struct
    unchanged.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 5afc9a25be8d ("[media] Add support for TechniSat Skystar S2")
    Signed-off-by: Daniil Dulov <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: dib7000p: Fix potential division by zero [+ + +]
Author: Daniil Dulov <[email protected]>
Date:   Fri Mar 24 06:38:32 2023 -0700

    media: dib7000p: Fix potential division by zero
    
    [ Upstream commit a1db7b2c5533fc67e2681eb5efc921a67bc7d5b8 ]
    
    Variable loopdiv can be assigned 0, then it is used as a denominator,
    without checking it for 0.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 713d54a8bd81 ("[media] DiB7090: add support for the dib7090 based")
    Signed-off-by: Daniil Dulov <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [hverkuil: (bw != NULL) -> bw]
    Signed-off-by: Sasha Levin <[email protected]>

media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xfer [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Thu Jul 6 00:06:54 2023 +0800

    media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xfer
    
    [ Upstream commit 7bf744f2de0a848fb1d717f5831b03db96feae89 ]
    
    In af9035_i2c_master_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach af9035_i2c_master_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a
    ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    [ moved variable declaration to fix build issues in older kernels - gregkh ]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer() [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Mon May 29 07:58:36 2023 +0200

    media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()
    
    [ Upstream commit ea9ef6c2e001c5dc94bee35ebd1c8a98621cf7b8 ]
    
    'read' is freed when it is known to be NULL, but not when a read error
    occurs.
    
    Revert the logic to avoid a small leak, should a m920x_read() call fail.
    
    Fixes: a2ab06d7c4d6 ("media: m920x: don't use stack on USB reads")
    Signed-off-by: Christophe JAILLET <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: dvb: symbol fixup for dvb_attach() [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Fri Sep 8 10:20:36 2023 +0100

    media: dvb: symbol fixup for dvb_attach()
    
    commit 86495af1171e1feec79faa9b64c05c89f46e41d1 upstream.
    
    In commit 9011e49d54dc ("modules: only allow symbol_get of
    EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted
    to GPL-only marked symbols.  This interacts oddly with the DVB logic
    which only uses dvb_attach() to load the dvb driver which then uses
    symbol_get().
    
    Fix this up by properly marking all of the dvb_attach attach symbols as
    EXPORT_SYMBOL_GPL().
    
    Fixes: 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules")
    Cc: stable <[email protected]>
    Reported-by: Stefan Lippers-Hollmann <[email protected]>
    Cc: Mauro Carvalho Chehab <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Acked-by: Luis Chamberlain <[email protected]>
    Acked-by: Hans Verkuil <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer() [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sat Jul 8 18:22:52 2023 +0800

    media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
    
    [ Upstream commit 5ae544d94abc8ff77b1b9bf8774def3fa5689b5b ]
    
    In dw2102_i2c_transfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach dw2102_i2c_transfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 950e252cb469
    ("[media] dw2102: limit messages to buffer size")
    
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: go7007: Remove redundant if statement [+ + +]
Author: Colin Ian King <[email protected]>
Date:   Thu Jul 27 19:40:07 2023 +0200

    media: go7007: Remove redundant if statement
    
    [ Upstream commit f33cb49081da0ec5af0888f8ecbd566bd326eed1 ]
    
    The if statement that compares msgs[i].len != 3 is always false because
    it is in a code block where msg[i].len is equal to 3. The check is
    redundant and can be removed.
    
    As detected by cppcheck static analysis:
    drivers/media/usb/go7007/go7007-i2c.c:168:20: warning: Opposite inner
    'if' condition leads to a dead code block. [oppositeInnerCondition]
    
    Link: https://lore.kernel.org/linux-media/[email protected]
    
    Fixes: 866b8695d67e ("Staging: add the go7007 video driver")
    Signed-off-by: Colin Ian King <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips [+ + +]
Author: Dave Stevenson <[email protected]>
Date:   Mon Dec 5 15:21:45 2022 +0000

    media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
    
    [ Upstream commit 66274280b2c745d380508dc27b9a4dfd736e5eda ]
    
    The driver changes the Bayer order based on the flips, but
    does not define the control correctly with the
    V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
    
    Add the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
    
    Signed-off-by: Dave Stevenson <[email protected]>
    Acked-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: 7b5a42e6ae71 ("media: ov2680: Remove auto-gain and auto-exposure controls")
    Signed-off-by: Sasha Levin <[email protected]>

media: mediatek: vcodec: Return NULL if no vdec_fb is found [+ + +]
Author: Irui Wang <[email protected]>
Date:   Wed Jul 5 17:14:41 2023 +0800

    media: mediatek: vcodec: Return NULL if no vdec_fb is found
    
    [ Upstream commit dfa2d6e07432270330ae191f50a0e70636a4cd2b ]
    
    "fb_use_list" is used to store used or referenced frame buffers for
    vp9 stateful decoder. "NULL" should be returned when getting target
    frame buffer failed from "fb_use_list", not a random unexpected one.
    
    Fixes: f77e89854b3e ("[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver")
    Signed-off-by: Irui Wang <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: ov2680: Fix ov2680_bayer_order() [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Thu Aug 3 11:33:17 2023 +0200

    media: ov2680: Fix ov2680_bayer_order()
    
    [ Upstream commit 50a7bad4e0a37d7018ab6fe843dd84bc6b2ecf72 ]
    
    The index into ov2680_hv_flip_bayer_order[] should be 0-3, but
    ov2680_bayer_order() was using 0 + BIT(2) + (BIT(2) << 1) as
    max index, while the intention was to use: 0 + 1 + 2 as max index.
    
    Fix the index calculation in ov2680_bayer_order(), while at it
    also just use the ctrl values rather then reading them back using
    a slow i2c-read transaction.
    
    This also allows making the function void, since there now are
    no more i2c-reads to error check.
    
    Note the check for the ctrls being NULL is there to allow
    adding an ov2680_fill_format() helper later, which will call
    ov2680_set_bayer_order() during probe() before the ctrls are created.
    
    [Sakari Ailus: Change all users of ov2680_set_bayer_order() here]
    
    Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver")
    Reviewed-by: Daniel Scally <[email protected]>
    Acked-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Thu Aug 3 11:33:23 2023 +0200

    media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
    
    [ Upstream commit 84b4bd7e0d98166aa32fd470e672721190492eae ]
    
    When the ov2680_power_on() "sensor soft reset failed" path is hit during
    probe() the WARN() about putting an enabled regulator at
    drivers/regulator/core.c:2398 triggers 3 times (once for each regulator),
    filling dmesg with backtraces.
    
    Fix this by properly disabling the regulators on ov2680_power_on() errors.
    
    Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver")
    Reviewed-by: Daniel Scally <[email protected]>
    Acked-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: ov2680: Fix vflip / hflip set functions [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Thu Aug 3 11:33:18 2023 +0200

    media: ov2680: Fix vflip / hflip set functions
    
    [ Upstream commit d5d08ad330c9ccebc5e066fda815423a290f48b0 ]
    
    ov2680_vflip_disable() / ov2680_hflip_disable() pass BIT(0) instead of
    0 as value to ov2680_mod_reg().
    
    While fixing this also:
    
    1. Stop having separate enable/disable functions for hflip / vflip
    2. Move the is_streaming check, which is unique to hflip / vflip
       into the ov2680_set_?flip() functions.
    
    for a nice code cleanup.
    
    Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver")
    Reviewed-by: Daniel Scally <[email protected]>
    Acked-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: ov2680: Remove auto-gain and auto-exposure controls [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Thu Aug 3 11:33:16 2023 +0200

    media: ov2680: Remove auto-gain and auto-exposure controls
    
    [ Upstream commit 7b5a42e6ae71927359ea67a2c22570ba97fa4059 ]
    
    Quoting the OV2680 datasheet:
    
    "3.2 exposure and gain control
    
    In the OV2680, the exposure time and gain are set manually from an external
    controller. The OV2680 supports manual gain and exposure control only for
    normal applications, no auto mode."
    
    And indeed testing with the atomisp_ov2680 fork of ov2680.c has shown that
    auto-exposure and auto-gain do not work.
    
    Note that the code setting the auto-exposure flag was broken, callers
    of ov2680_exposure_set() were directly passing !!ctrls->auto_exp->val as
    "bool auto_exp" value, but ctrls->auto_exp is a menu control with:
    
    enum  v4l2_exposure_auto_type {
            V4L2_EXPOSURE_AUTO = 0,
            V4L2_EXPOSURE_MANUAL = 1,
            ...
    
    So instead of passing !!ctrls->auto_exp->val they should have been passing
    ctrls->auto_exp->val == V4L2_EXPOSURE_AUTO, iow the passed value was
    inverted of what it should have been.
    
    Also remove ov2680_g_volatile_ctrl() since without auto support the gain
    and exposure controls are not volatile.
    
    This also fixes the control values not being properly applied in
    ov2680_mode_set(). The 800x600 mode register-list also sets gain,
    exposure and vflip overriding the last set ctrl values.
    
    ov2680_mode_set() does call ov2680_gain_set() and ov2680_exposure_set()
    but did this before writing the mode register-list, so these values
    would still be overridden by the mode register-list.
    
    Add a v4l2_ctrl_handler_setup() call after writing the mode register-list
    to restore all ctrl values. Also remove the ctrls->gain->is_new check from
    ov2680_gain_set() so that the gain always gets restored properly.
    
    Last since ov2680_mode_set() now calls v4l2_ctrl_handler_setup(), remove
    the v4l2_ctrl_handler_setup() call after ov2680_mode_restore() since
    ov2680_mode_restore() calls ov2680_mode_set().
    
    Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver")
    Reviewed-by: Daniel Scally <[email protected]>
    Acked-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: pci: cx23885: replace BUG with error return [+ + +]
Author: Hans Verkuil <[email protected]>
Date:   Fri Jul 21 10:23:42 2023 +0200

    media: pci: cx23885: replace BUG with error return
    
    [ Upstream commit 2e1796fd4904fdd6062a8e4589778ea899ea0c8d ]
    
    It was completely unnecessary to use BUG in buffer_prepare().
    Just replace it with an error return. This also fixes a smatch warning:
    
    drivers/media/pci/cx23885/cx23885-video.c:422 buffer_prepare() error: uninitialized symbol 'ret'.
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Tue Aug 1 10:14:30 2023 +0300

    media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning
    
    [ Upstream commit 9d7531be3085a8f013cf173ccc4e72e3cf493538 ]
    
    Initialise timing struct in cio2_hw_init() to zero in order to avoid a
    compiler warning. The warning was a false positive.
    
    Reported-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: tuners: qt1010: replace BUG_ON with a regular error [+ + +]
Author: Hans Verkuil <[email protected]>
Date:   Thu Jul 20 08:20:51 2023 +0200

    media: tuners: qt1010: replace BUG_ON with a regular error
    
    [ Upstream commit ee630b29ea44d1851bb6c903f400956604834463 ]
    
    BUG_ON is unnecessary here, and in addition it confuses smatch.
    Replacing this with an error return help resolve this smatch
    warning:
    
    drivers/media/tuners/qt1010.c:350 qt1010_init() error: buffer overflow 'i2c_data' 34 <= 34
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: Use of_node_name_eq for node name comparisons [+ + +]
Author: Rob Herring <[email protected]>
Date:   Thu Dec 6 14:35:19 2018 -0500

    media: Use of_node_name_eq for node name comparisons
    
    [ Upstream commit 2fc6e404117e5b921097c929ba572a00e4421b50 ]
    
    Convert string compares of DT node names to use of_node_name_eq helper
    instead. This removes direct access to the node name pointer.
    
    Cc: Kyungmin Park <[email protected]>
    Cc: Kukjin Kim <[email protected]>
    Cc: Krzysztof Kozlowski <[email protected]>
    Cc: Hyun Kwon <[email protected]>
    Cc: Michal Simek <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Laurent Pinchart <[email protected]>
    Reviewed-by: Benoit Parrot <[email protected]>
    Signed-off-by: Rob Herring <[email protected]>
    Reviewed-by: Sylwester Nawrocki <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: d7b13edd4cb4 ("media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()")
    Signed-off-by: Sasha Levin <[email protected]>

media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Wed Jun 14 20:31:05 2023 +0200

    media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()
    
    [ Upstream commit d7b13edd4cb4bfa335b6008ab867ac28582d3e5c ]
    
    If fwnode_graph_get_remote_endpoint() fails, 'fwnode' is known to be NULL,
    so fwnode_handle_put() is a no-op.
    
    Release the reference taken from a previous fwnode_graph_get_port_parent()
    call instead.
    
    Also handle fwnode_graph_get_port_parent() failures.
    
    In order to fix these issues, add an error handling path to the function
    and the needed gotos.
    
    Fixes: ca50c197bd96 ("[media] v4l: fwnode: Support generic fwnode for parsing standardised properties")
    Signed-off-by: Christophe JAILLET <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: v4l2-fwnode: fix v4l2_fwnode_parse_link handling [+ + +]
Author: Marco Felsch <[email protected]>
Date:   Thu Mar 12 11:31:39 2020 +0100

    media: v4l2-fwnode: fix v4l2_fwnode_parse_link handling
    
    [ Upstream commit 453b0c8304dcbc6eed2836de8fee90bf5bcc7006 ]
    
    Currently the driver differentiate the port number property handling for
    ACPI and DT. This is wrong as because ACPI should use the "reg" val too
    [1].
    
    [1] https://patchwork.kernel.org/patch/11421985/
    
    Fixes: ca50c197bd96 ("[media] v4l: fwnode: Support generic fwnode for parsing standardised properties")
    Signed-off-by: Marco Felsch <[email protected]>
    Acked-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: d7b13edd4cb4 ("media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()")
    Signed-off-by: Sasha Levin <[email protected]>

media: v4l2-fwnode: simplify v4l2_fwnode_parse_link [+ + +]
Author: Marco Felsch <[email protected]>
Date:   Thu Mar 12 11:31:40 2020 +0100

    media: v4l2-fwnode: simplify v4l2_fwnode_parse_link
    
    [ Upstream commit 507a0ba93aa1cf2837d2abc4ab0cbad3c29409d3 ]
    
    This helper was introduced before those helpers where awailable. Convert
    it to cleanup the code and improbe readability.
    
    Signed-off-by: Marco Felsch <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: d7b13edd4cb4 ("media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()")
    Signed-off-by: Sasha Levin <[email protected]>

 
mmc: au1xmmc: force non-modular build and remove symbol_get usage [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Tue Aug 1 19:35:41 2023 +0200

    mmc: au1xmmc: force non-modular build and remove symbol_get usage
    
    commit d4a5c59a955bba96b273ec1a5885bada24c56979 upstream.
    
    au1xmmc is split somewhat awkwardly into the main mmc subsystem driver,
    and callbacks in platform_data that sit under arch/mips/ and are
    always built in.  The latter than call mmc_detect_change through
    symbol_get.  Remove the use of symbol_get by requiring the driver
    to be built in.  In the future the interrupt handlers for card
    insert/eject detection should probably be moved into the main driver,
    and which point it can be built modular again.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Acked-by: Manuel Lauss <[email protected]>
    Reviewed-by: Arnd Bergmann <[email protected]>
    [mcgrof: squashed in depends on MMC=y suggested by Arnd]
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Tue Aug 1 19:35:44 2023 +0200

    modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules
    
    commit 9011e49d54dcc7653ebb8a1e05b5badb5ecfa9f9 upstream.
    
    It has recently come to my attention that nvidia is circumventing the
    protection added in 262e6ae7081d ("modules: inherit
    TAINT_PROPRIETARY_MODULE") by importing exports from their proprietary
    modules into an allegedly GPL licensed module and then rexporting them.
    
    Given that symbol_get was only ever intended for tightly cooperating
    modules using very internal symbols it is logical to restrict it to
    being used on EXPORT_SYMBOL_GPL and prevent nvidia from costly DMCA
    Circumvention of Access Controls law suites.
    
    All symbols except for four used through symbol_get were already exported
    as EXPORT_SYMBOL_GPL, and the remaining four ones were switched over in
    the preparation patches.
    
    Fixes: 262e6ae7081d ("modules: inherit TAINT_PROPRIETARY_MODULE")
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mtd: rawnand: brcmnand: Fix crash during the panic_write [+ + +]
Author: William Zhang <[email protected]>
Date:   Thu Jul 6 11:29:07 2023 -0700

    mtd: rawnand: brcmnand: Fix crash during the panic_write
    
    commit e66dd317194daae0475fe9e5577c80aa97f16cb9 upstream.
    
    When executing a NAND command within the panic write path, wait for any
    pending command instead of calling BUG_ON to avoid crashing while
    already crashing.
    
    Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
    Signed-off-by: William Zhang <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Reviewed-by: Kursad Oney <[email protected]>
    Reviewed-by: Kamal Dasu <[email protected]>
    Cc: [email protected]
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://lore.kernel.org/linux-mtd/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller [+ + +]
Author: William Zhang <[email protected]>
Date:   Thu Jul 6 11:29:05 2023 -0700

    mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller
    
    commit 2ec2839a9062db8a592525a3fdabd42dcd9a3a9b upstream.
    
    v7.2 controller has different ECC level field size and shift in the acc
    control register than its predecessor and successor controller. It needs
    to be set specifically.
    
    Fixes: decba6d47869 ("mtd: brcmnand: Add v7.2 controller support")
    Signed-off-by: William Zhang <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Cc: [email protected]
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://lore.kernel.org/linux-mtd/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: rawnand: brcmnand: Fix potential false time out warning [+ + +]
Author: William Zhang <[email protected]>
Date:   Thu Jul 6 11:29:06 2023 -0700

    mtd: rawnand: brcmnand: Fix potential false time out warning
    
    commit 9cc0a598b944816f2968baf2631757f22721b996 upstream.
    
    If system is busy during the command status polling function, the driver
    may not get the chance to poll the status register till the end of time
    out and return the premature status.  Do a final check after time out
    happens to ensure reading the correct status.
    
    Fixes: 9d2ee0a60b8b ("mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program")
    Signed-off-by: William Zhang <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Cc: [email protected]
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://lore.kernel.org/linux-mtd/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write [+ + +]
Author: William Zhang <[email protected]>
Date:   Thu Jul 6 11:29:08 2023 -0700

    mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write
    
    commit 5d53244186c9ac58cb88d76a0958ca55b83a15cd upstream.
    
    When the oob buffer length is not in multiple of words, the oob write
    function does out-of-bounds read on the oob source buffer at the last
    iteration. Fix that by always checking length limit on the oob buffer
    read and fill with 0xff when reaching the end of the buffer to the oob
    registers.
    
    Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
    Signed-off-by: William Zhang <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Cc: [email protected]
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://lore.kernel.org/linux-mtd/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mwifiex: drop 'set_consistent_dma_mask' log message [+ + +]
Author: Brian Norris <[email protected]>
Date:   Tue Jun 4 10:28:58 2019 -0700

    mwifiex: drop 'set_consistent_dma_mask' log message
    
    [ Upstream commit f7369179ad32000973fc7a0a76603e0b41792b52 ]
    
    This message is pointless.
    
    While we're at it, include the error code in the error message, which is
    not pointless.
    
    Signed-off-by: Brian Norris <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Stable-dep-of: 288c63d5cb46 ("wifi: mwifiex: fix error recovery in PCIE buffer descriptor management")
    Signed-off-by: Sasha Levin <[email protected]>

mwifiex: switch from 'pci_' to 'dma_' API [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Wed Aug 19 09:01:52 2020 +0200

    mwifiex: switch from 'pci_' to 'dma_' API
    
    [ Upstream commit 4cf975f640fefdfdf6168a79e882558478ce057a ]
    
    The wrappers in include/linux/pci-dma-compat.h should go away.
    
    The patch has been generated with the coccinelle script below and has been
    hand modified to replace GFP_ with a correct flag.
    It has been compile tested.
    
    When memory is allocated in 'mwifiex_pcie_alloc_buffers()' (see details in
    the call chain below) GFP_KERNEL can be used because both
    'mwifiex_register()' and 'mwifiex_reinit_sw()' already use GFP_KERNEL.
    (for 'mwifiex_reinit_sw()', it is hidden in a call to 'alloc_workqueue()')
    
    The call chain is:
      mwifiex_register
        --> mwifiex_init_pcie        (.init_if function, see mwifiex_if_ops)
       [ or ]
      mwifiex_reinit_sw
        -->mwifiex_pcie_up_dev       (.up_dev function, see mwifiex_if_ops)
    
        [ then in both case ]
          -->mwifiex_pcie_alloc_buffers
            --> mwifiex_pcie_create_txbd_ring
            --> mwifiex_pcie_create_rxbd_ring
            --> mwifiex_pcie_create_evtbd_ring
            --> mwifiex_pcie_alloc_sleep_cookie_buf
    
    @@
    @@
    -    PCI_DMA_BIDIRECTIONAL
    +    DMA_BIDIRECTIONAL
    
    @@
    @@
    -    PCI_DMA_TODEVICE
    +    DMA_TO_DEVICE
    
    @@
    @@
    -    PCI_DMA_FROMDEVICE
    +    DMA_FROM_DEVICE
    
    @@
    @@
    -    PCI_DMA_NONE
    +    DMA_NONE
    
    @@
    expression e1, e2, e3;
    @@
    -    pci_alloc_consistent(e1, e2, e3)
    +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
    
    @@
    expression e1, e2, e3;
    @@
    -    pci_zalloc_consistent(e1, e2, e3)
    +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_free_consistent(e1, e2, e3, e4)
    +    dma_free_coherent(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_map_single(e1, e2, e3, e4)
    +    dma_map_single(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_unmap_single(e1, e2, e3, e4)
    +    dma_unmap_single(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4, e5;
    @@
    -    pci_map_page(e1, e2, e3, e4, e5)
    +    dma_map_page(&e1->dev, e2, e3, e4, e5)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_unmap_page(e1, e2, e3, e4)
    +    dma_unmap_page(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_map_sg(e1, e2, e3, e4)
    +    dma_map_sg(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_unmap_sg(e1, e2, e3, e4)
    +    dma_unmap_sg(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
    +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
    +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
    +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2, e3, e4;
    @@
    -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
    +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
    
    @@
    expression e1, e2;
    @@
    -    pci_dma_mapping_error(e1, e2)
    +    dma_mapping_error(&e1->dev, e2)
    
    @@
    expression e1, e2;
    @@
    -    pci_set_dma_mask(e1, e2)
    +    dma_set_mask(&e1->dev, e2)
    
    @@
    expression e1, e2;
    @@
    -    pci_set_consistent_dma_mask(e1, e2)
    +    dma_set_coherent_mask(&e1->dev, e2)
    
    Signed-off-by: Christophe JAILLET <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 288c63d5cb46 ("wifi: mwifiex: fix error recovery in PCIE buffer descriptor management")
    Signed-off-by: Sasha Levin <[email protected]>

 
net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free [+ + +]
Author: valis <[email protected]>
Date:   Sat Jul 29 08:32:01 2023 -0400

    net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free
    
    commit 76e42ae831991c828cffa8c37736ebfb831ad5ec upstream.
    
    When fw_change() is called on an existing filter, the whole
    tcf_result struct is always copied into the new instance of the filter.
    
    This causes a problem when updating a filter bound to a class,
    as tcf_unbind_filter() is always called on the old instance in the
    success path, decreasing filter_cnt of the still referenced class
    and allowing it to be deleted, leading to a use-after-free.
    
    Fix this by no longer copying the tcf_result struct from the old filter.
    
    Fixes: e35a8ee5993b ("net: sched: fw use RCU")
    Reported-by: valis <[email protected]>
    Reported-by: Bing-Jhong Billy Jheng <[email protected]>
    Signed-off-by: valis <[email protected]>
    Signed-off-by: Jamal Hadi Salim <[email protected]>
    Reviewed-by: Victor Nogueira <[email protected]>
    Reviewed-by: Pedro Tammela <[email protected]>
    Reviewed-by: M A Ramdhan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [ Fixed small conflict as 'fnew->ifindex' assignment is not protected by
      CONFIG_NET_CLS_IND on upstream since a51486266c3 ]
    Signed-off-by: Luiz Capitulino <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net/sched: Retire rsvp classifier [+ + +]
Author: Jamal Hadi Salim <[email protected]>
Date:   Tue Feb 14 08:49:15 2023 -0500

    net/sched: Retire rsvp classifier
    
    commit 265b4da82dbf5df04bee5a5d46b7474b1aaf326a upstream.
    
    The rsvp classifier has served us well for about a quarter of a century but has
    has not been getting much maintenance attention due to lack of known users.
    
    Signed-off-by: Jamal Hadi Salim <[email protected]>
    Acked-by: Jiri Pirko <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Kyle Zeng <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net/sched: sch_hfsc: Ensure inner classes have fsc curve [+ + +]
Author: Budimir Markovic <[email protected]>
Date:   Thu Aug 24 01:49:05 2023 -0700

    net/sched: sch_hfsc: Ensure inner classes have fsc curve
    
    [ Upstream commit b3d26c5702c7d6c45456326e56d2ccf3f103e60f ]
    
    HFSC assumes that inner classes have an fsc curve, but it is currently
    possible for classes without an fsc curve to become parents. This leads
    to bugs including a use-after-free.
    
    Don't allow non-root classes without HFSC_FSC to become parents.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Budimir Markovic <[email protected]>
    Signed-off-by: Budimir Markovic <[email protected]>
    Acked-by: Jamal Hadi Salim <[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: arcnet: Do not call kfree_skb() under local_irq_disable() [+ + +]
Author: Jinjie Ruan <[email protected]>
Date:   Thu Aug 24 14:43:36 2023 +0800

    net: arcnet: Do not call kfree_skb() under local_irq_disable()
    
    [ Upstream commit 786c96e92fb9e854cb8b0cb7399bb2fb28e15c4b ]
    
    It is not allowed to call kfree_skb() from hardware interrupt
    context or with hardware interrupts being disabled.
    So replace kfree_skb() with dev_kfree_skb_irq() under
    local_irq_disable(). Compile tested only.
    
    Fixes: 05fcd31cc472 ("arcnet: add err_skb package for package status feedback")
    Signed-off-by: Jinjie Ruan <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: Avoid address overwrite in kernel_connect [+ + +]
Author: Jordan Rife <[email protected]>
Date:   Mon Aug 21 16:45:23 2023 -0500

    net: Avoid address overwrite in kernel_connect
    
    commit 0bdf399342c5acbd817c9098b6c7ed21f1974312 upstream.
    
    BPF programs that run on connect can rewrite the connect address. For
    the connect system call this isn't a problem, because a copy of the address
    is made when it is moved into kernel space. However, kernel_connect
    simply passes through the address it is given, so the caller may observe
    its address value unexpectedly change.
    
    A practical example where this is problematic is where NFS is combined
    with a system such as Cilium which implements BPF-based load balancing.
    A common pattern in software-defined storage systems is to have an NFS
    mount that connects to a persistent virtual IP which in turn maps to an
    ephemeral server IP. This is usually done to achieve high availability:
    if your server goes down you can quickly spin up a replacement and remap
    the virtual IP to that endpoint. With BPF-based load balancing, mounts
    will forget the virtual IP address when the address rewrite occurs
    because a pointer to the only copy of that address is passed down the
    stack. Server failover then breaks, because clients have forgotten the
    virtual IP address. Reconnects fail and mounts remain broken. This patch
    was tested by setting up a scenario like this and ensuring that NFS
    reconnects worked after applying the patch.
    
    Signed-off-by: Jordan Rife <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_hwlro_get_fdir_all() [+ + +]
Author: Hangyu Hua <[email protected]>
Date:   Fri Sep 8 14:19:50 2023 +0800

    net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_hwlro_get_fdir_all()
    
    [ Upstream commit e4c79810755f66c9a933ca810da2724133b1165a ]
    
    rule_locs is allocated in ethtool_get_rxnfc and the size is determined by
    rule_cnt from user space. So rule_cnt needs to be check before using
    rule_locs to avoid NULL pointer dereference.
    
    Fixes: 7aab747e5563 ("net: ethernet: mediatek: add ethtool functions to configure RX flows of HW LRO")
    Signed-off-by: Hangyu Hua <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: handle ARPHRD_PPP in dev_is_mac_header_xmit() [+ + +]
Author: Nicolas Dichtel <[email protected]>
Date:   Wed Aug 23 15:41:02 2023 +0200

    net: handle ARPHRD_PPP in dev_is_mac_header_xmit()
    
    commit a4f39c9f14a634e4cd35fcd338c239d11fcc73fc upstream.
    
    The goal is to support a bpf_redirect() from an ethernet device (ingress)
    to a ppp device (egress).
    The l2 header is added automatically by the ppp driver, thus the ethernet
    header should be removed.
    
    CC: [email protected]
    Fixes: 27b29f63058d ("bpf: add bpf_redirect() helper")
    Signed-off-by: Nicolas Dichtel <[email protected]>
    Tested-by: Siwar Zitouni <[email protected]>
    Reviewed-by: Guillaume Nault <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr [+ + +]
Author: Alex Henrie <[email protected]>
Date:   Thu Aug 31 22:41:27 2023 -0600

    net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr
    
    [ Upstream commit f31867d0d9d82af757c1e0178b659438f4c1ea3c ]
    
    The existing code incorrectly casted a negative value (the result of a
    subtraction) to an unsigned value without checking. For example, if
    /proc/sys/net/ipv6/conf/*/temp_prefered_lft was set to 1, the preferred
    lifetime would jump to 4 billion seconds. On my machine and network the
    shortest lifetime that avoided underflow was 3 seconds.
    
    Fixes: 76506a986dc3 ("IPv6: fix DESYNC_FACTOR")
    Signed-off-by: Alex Henrie <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: read sk->sk_family once in sk_mc_loop() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Wed Aug 30 10:12:44 2023 +0000

    net: read sk->sk_family once in sk_mc_loop()
    
    [ Upstream commit a3e0fdf71bbe031de845e8e08ed7fba49f9c702c ]
    
    syzbot is playing with IPV6_ADDRFORM quite a lot these days,
    and managed to hit the WARN_ON_ONCE(1) in sk_mc_loop()
    
    We have many more similar issues to fix.
    
    WARNING: CPU: 1 PID: 1593 at net/core/sock.c:782 sk_mc_loop+0x165/0x260
    Modules linked in:
    CPU: 1 PID: 1593 Comm: kworker/1:3 Not tainted 6.1.40-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
    Workqueue: events_power_efficient gc_worker
    RIP: 0010:sk_mc_loop+0x165/0x260 net/core/sock.c:782
    Code: 34 1b fd 49 81 c7 18 05 00 00 4c 89 f8 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 ff e8 25 36 6d fd 4d 8b 37 eb 13 e8 db 33 1b fd <0f> 0b b3 01 eb 34 e8 d0 33 1b fd 45 31 f6 49 83 c6 38 4c 89 f0 48
    RSP: 0018:ffffc90000388530 EFLAGS: 00010246
    RAX: ffffffff846d9b55 RBX: 0000000000000011 RCX: ffff88814f884980
    RDX: 0000000000000102 RSI: ffffffff87ae5160 RDI: 0000000000000011
    RBP: ffffc90000388550 R08: 0000000000000003 R09: ffffffff846d9a65
    R10: 0000000000000002 R11: ffff88814f884980 R12: dffffc0000000000
    R13: ffff88810dbee000 R14: 0000000000000010 R15: ffff888150084000
    FS: 0000000000000000(0000) GS:ffff8881f6b00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000020000180 CR3: 000000014ee5b000 CR4: 00000000003506e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <IRQ>
    [<ffffffff8507734f>] ip6_finish_output2+0x33f/0x1ae0 net/ipv6/ip6_output.c:83
    [<ffffffff85062766>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff85062766>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff85061f8c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff85061f8c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff852071cf>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff852071cf>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
    [<ffffffff83618fb4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
    [<ffffffff83618fb4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff83618fb4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff83618fb4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff8361ddd9>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84763fc0>] netdev_start_xmit include/linux/netdevice.h:4925 [inline]
    [<ffffffff84763fc0>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84763fc0>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff8494c650>] sch_direct_xmit+0x2a0/0x9c0 net/sched/sch_generic.c:342
    [<ffffffff8494d883>] qdisc_restart net/sched/sch_generic.c:407 [inline]
    [<ffffffff8494d883>] __qdisc_run+0xb13/0x1e70 net/sched/sch_generic.c:415
    [<ffffffff8478c426>] qdisc_run+0xd6/0x260 include/net/pkt_sched.h:125
    [<ffffffff84796eac>] net_tx_action+0x7ac/0x940 net/core/dev.c:5247
    [<ffffffff858002bd>] __do_softirq+0x2bd/0x9bd kernel/softirq.c:599
    [<ffffffff814c3fe8>] invoke_softirq kernel/softirq.c:430 [inline]
    [<ffffffff814c3fe8>] __irq_exit_rcu+0xc8/0x170 kernel/softirq.c:683
    [<ffffffff814c3f09>] irq_exit_rcu+0x9/0x20 kernel/softirq.c:695
    
    Fixes: 7ad6848c7e81 ("ip: fix mc_loop checks for tunnels with multicast outer addresses")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: sched: sch_qfq: Fix UAF in qfq_dequeue() [+ + +]
Author: valis <[email protected]>
Date:   Fri Sep 1 12:22:37 2023 -0400

    net: sched: sch_qfq: Fix UAF in qfq_dequeue()
    
    [ Upstream commit 8fc134fee27f2263988ae38920bc03da416b03d8 ]
    
    When the plug qdisc is used as a class of the qfq qdisc it could trigger a
    UAF. This issue can be reproduced with following commands:
    
      tc qdisc add dev lo root handle 1: qfq
      tc class add dev lo parent 1: classid 1:1 qfq weight 1 maxpkt 512
      tc qdisc add dev lo parent 1:1 handle 2: plug
      tc filter add dev lo parent 1: basic classid 1:1
      ping -c1 127.0.0.1
    
    and boom:
    
    [  285.353793] BUG: KASAN: slab-use-after-free in qfq_dequeue+0xa7/0x7f0
    [  285.354910] Read of size 4 at addr ffff8880bad312a8 by task ping/144
    [  285.355903]
    [  285.356165] CPU: 1 PID: 144 Comm: ping Not tainted 6.5.0-rc3+ #4
    [  285.357112] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
    [  285.358376] Call Trace:
    [  285.358773]  <IRQ>
    [  285.359109]  dump_stack_lvl+0x44/0x60
    [  285.359708]  print_address_description.constprop.0+0x2c/0x3c0
    [  285.360611]  kasan_report+0x10c/0x120
    [  285.361195]  ? qfq_dequeue+0xa7/0x7f0
    [  285.361780]  qfq_dequeue+0xa7/0x7f0
    [  285.362342]  __qdisc_run+0xf1/0x970
    [  285.362903]  net_tx_action+0x28e/0x460
    [  285.363502]  __do_softirq+0x11b/0x3de
    [  285.364097]  do_softirq.part.0+0x72/0x90
    [  285.364721]  </IRQ>
    [  285.365072]  <TASK>
    [  285.365422]  __local_bh_enable_ip+0x77/0x90
    [  285.366079]  __dev_queue_xmit+0x95f/0x1550
    [  285.366732]  ? __pfx_csum_and_copy_from_iter+0x10/0x10
    [  285.367526]  ? __pfx___dev_queue_xmit+0x10/0x10
    [  285.368259]  ? __build_skb_around+0x129/0x190
    [  285.368960]  ? ip_generic_getfrag+0x12c/0x170
    [  285.369653]  ? __pfx_ip_generic_getfrag+0x10/0x10
    [  285.370390]  ? csum_partial+0x8/0x20
    [  285.370961]  ? raw_getfrag+0xe5/0x140
    [  285.371559]  ip_finish_output2+0x539/0xa40
    [  285.372222]  ? __pfx_ip_finish_output2+0x10/0x10
    [  285.372954]  ip_output+0x113/0x1e0
    [  285.373512]  ? __pfx_ip_output+0x10/0x10
    [  285.374130]  ? icmp_out_count+0x49/0x60
    [  285.374739]  ? __pfx_ip_finish_output+0x10/0x10
    [  285.375457]  ip_push_pending_frames+0xf3/0x100
    [  285.376173]  raw_sendmsg+0xef5/0x12d0
    [  285.376760]  ? do_syscall_64+0x40/0x90
    [  285.377359]  ? __static_call_text_end+0x136578/0x136578
    [  285.378173]  ? do_syscall_64+0x40/0x90
    [  285.378772]  ? kasan_enable_current+0x11/0x20
    [  285.379469]  ? __pfx_raw_sendmsg+0x10/0x10
    [  285.380137]  ? __sock_create+0x13e/0x270
    [  285.380673]  ? __sys_socket+0xf3/0x180
    [  285.381174]  ? __x64_sys_socket+0x3d/0x50
    [  285.381725]  ? entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    [  285.382425]  ? __rcu_read_unlock+0x48/0x70
    [  285.382975]  ? ip4_datagram_release_cb+0xd8/0x380
    [  285.383608]  ? __pfx_ip4_datagram_release_cb+0x10/0x10
    [  285.384295]  ? preempt_count_sub+0x14/0xc0
    [  285.384844]  ? __list_del_entry_valid+0x76/0x140
    [  285.385467]  ? _raw_spin_lock_bh+0x87/0xe0
    [  285.386014]  ? __pfx__raw_spin_lock_bh+0x10/0x10
    [  285.386645]  ? release_sock+0xa0/0xd0
    [  285.387148]  ? preempt_count_sub+0x14/0xc0
    [  285.387712]  ? freeze_secondary_cpus+0x348/0x3c0
    [  285.388341]  ? aa_sk_perm+0x177/0x390
    [  285.388856]  ? __pfx_aa_sk_perm+0x10/0x10
    [  285.389441]  ? check_stack_object+0x22/0x70
    [  285.390032]  ? inet_send_prepare+0x2f/0x120
    [  285.390603]  ? __pfx_inet_sendmsg+0x10/0x10
    [  285.391172]  sock_sendmsg+0xcc/0xe0
    [  285.391667]  __sys_sendto+0x190/0x230
    [  285.392168]  ? __pfx___sys_sendto+0x10/0x10
    [  285.392727]  ? kvm_clock_get_cycles+0x14/0x30
    [  285.393328]  ? set_normalized_timespec64+0x57/0x70
    [  285.393980]  ? _raw_spin_unlock_irq+0x1b/0x40
    [  285.394578]  ? __x64_sys_clock_gettime+0x11c/0x160
    [  285.395225]  ? __pfx___x64_sys_clock_gettime+0x10/0x10
    [  285.395908]  ? _copy_to_user+0x3e/0x60
    [  285.396432]  ? exit_to_user_mode_prepare+0x1a/0x120
    [  285.397086]  ? syscall_exit_to_user_mode+0x22/0x50
    [  285.397734]  ? do_syscall_64+0x71/0x90
    [  285.398258]  __x64_sys_sendto+0x74/0x90
    [  285.398786]  do_syscall_64+0x64/0x90
    [  285.399273]  ? exit_to_user_mode_prepare+0x1a/0x120
    [  285.399949]  ? syscall_exit_to_user_mode+0x22/0x50
    [  285.400605]  ? do_syscall_64+0x71/0x90
    [  285.401124]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    [  285.401807] RIP: 0033:0x495726
    [  285.402233] Code: ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 11 b8 2c 00 00 00 0f 09
    [  285.404683] RSP: 002b:00007ffcc25fb618 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    [  285.405677] RAX: ffffffffffffffda RBX: 0000000000000040 RCX: 0000000000495726
    [  285.406628] RDX: 0000000000000040 RSI: 0000000002518750 RDI: 0000000000000000
    [  285.407565] RBP: 00000000005205ef R08: 00000000005f8838 R09: 000000000000001c
    [  285.408523] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000002517634
    [  285.409460] R13: 00007ffcc25fb6f0 R14: 0000000000000003 R15: 0000000000000000
    [  285.410403]  </TASK>
    [  285.410704]
    [  285.410929] Allocated by task 144:
    [  285.411402]  kasan_save_stack+0x1e/0x40
    [  285.411926]  kasan_set_track+0x21/0x30
    [  285.412442]  __kasan_slab_alloc+0x55/0x70
    [  285.412973]  kmem_cache_alloc_node+0x187/0x3d0
    [  285.413567]  __alloc_skb+0x1b4/0x230
    [  285.414060]  __ip_append_data+0x17f7/0x1b60
    [  285.414633]  ip_append_data+0x97/0xf0
    [  285.415144]  raw_sendmsg+0x5a8/0x12d0
    [  285.415640]  sock_sendmsg+0xcc/0xe0
    [  285.416117]  __sys_sendto+0x190/0x230
    [  285.416626]  __x64_sys_sendto+0x74/0x90
    [  285.417145]  do_syscall_64+0x64/0x90
    [  285.417624]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    [  285.418306]
    [  285.418531] Freed by task 144:
    [  285.418960]  kasan_save_stack+0x1e/0x40
    [  285.419469]  kasan_set_track+0x21/0x30
    [  285.419988]  kasan_save_free_info+0x27/0x40
    [  285.420556]  ____kasan_slab_free+0x109/0x1a0
    [  285.421146]  kmem_cache_free+0x1c2/0x450
    [  285.421680]  __netif_receive_skb_core+0x2ce/0x1870
    [  285.422333]  __netif_receive_skb_one_core+0x97/0x140
    [  285.423003]  process_backlog+0x100/0x2f0
    [  285.423537]  __napi_poll+0x5c/0x2d0
    [  285.424023]  net_rx_action+0x2be/0x560
    [  285.424510]  __do_softirq+0x11b/0x3de
    [  285.425034]
    [  285.425254] The buggy address belongs to the object at ffff8880bad31280
    [  285.425254]  which belongs to the cache skbuff_head_cache of size 224
    [  285.426993] The buggy address is located 40 bytes inside of
    [  285.426993]  freed 224-byte region [ffff8880bad31280, ffff8880bad31360)
    [  285.428572]
    [  285.428798] The buggy address belongs to the physical page:
    [  285.429540] page:00000000f4b77674 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xbad31
    [  285.430758] flags: 0x100000000000200(slab|node=0|zone=1)
    [  285.431447] page_type: 0xffffffff()
    [  285.431934] raw: 0100000000000200 ffff88810094a8c0 dead000000000122 0000000000000000
    [  285.432757] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
    [  285.433562] page dumped because: kasan: bad access detected
    [  285.434144]
    [  285.434320] Memory state around the buggy address:
    [  285.434828]  ffff8880bad31180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  285.435580]  ffff8880bad31200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  285.436264] >ffff8880bad31280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [  285.436777]                                   ^
    [  285.437106]  ffff8880bad31300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
    [  285.437616]  ffff8880bad31380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  285.438126] ==================================================================
    [  285.438662] Disabling lock debugging due to kernel taint
    
    Fix this by:
    1. Changing sch_plug's .peek handler to qdisc_peek_dequeued(), a
    function compatible with non-work-conserving qdiscs
    2. Checking the return value of qdisc_dequeue_peeked() in sch_qfq.
    
    Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
    Reported-by: valis <[email protected]>
    Signed-off-by: valis <[email protected]>
    Signed-off-by: Jamal Hadi Salim <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: qmi_wwan: add Quectel EM05GV2 [+ + +]
Author: Martin Kohn <[email protected]>
Date:   Thu Jul 27 20:00:43 2023 +0000

    net: usb: qmi_wwan: add Quectel EM05GV2
    
    [ Upstream commit d4480c9bb9258db9ddf2e632f6ef81e96b41089c ]
    
    Add support for Quectel EM05GV2 (G=global) with vendor ID
    0x2c7c and product ID 0x030e
    
    Enabling DTR on this modem was necessary to ensure stable operation.
    Patch for usb: serial: option: is also in progress.
    
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=030e Rev= 3.18
    S:  Manufacturer=Quectel
    S:  Product=Quectel EM05-G
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Martin Kohn <[email protected]>
    Link: https://lore.kernel.org/r/AM0PR04MB57648219DE893EE04FA6CC759701A@AM0PR04MB5764.eurprd04.prod.outlook.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c [+ + +]
Author: Kyle Zeng <[email protected]>
Date:   Tue Sep 5 15:04:09 2023 -0700

    netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
    
    commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
    
    The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can
    lead to the use of wrong `CIDR_POS(c)` for calculating array offsets,
    which can lead to integer underflow. As a result, it leads to slab
    out-of-bound access.
    This patch adds back the IP_SET_HASH_WITH_NET0 macro to
    ip_set_hash_netportnet to address the issue.
    
    Fixes: 886503f34d63 ("netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net")
    Suggested-by: Jozsef Kadlecsik <[email protected]>
    Signed-off-by: Kyle Zeng <[email protected]>
    Acked-by: Jozsef Kadlecsik <[email protected]>
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: missing NFT_TRANS_PREPARE_ERROR in flowtable deactivatation [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Mon Sep 18 14:06:56 2023 +0200

    netfilter: nf_tables: missing NFT_TRANS_PREPARE_ERROR in flowtable deactivatation
    
    commit 26b5a5712eb85e253724e56a54c17f8519bd8e4e upstream.
    
    Missing NFT_TRANS_PREPARE_ERROR in 1df28fde1270 ("netfilter: nf_tables: add
    NFT_TRANS_PREPARE_ERROR to deal with bound set/chain") in 4.19.
    
    Fixes: 1df28fde1270 ("netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain") in 4.19
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nfnetlink_osf: avoid OOB read [+ + +]
Author: Wander Lairson Costa <[email protected]>
Date:   Fri Sep 1 10:50:20 2023 -0300

    netfilter: nfnetlink_osf: avoid OOB read
    
    [ Upstream commit f4f8a7803119005e87b716874bec07c751efafec ]
    
    The opt_num field is controlled by user mode and is not currently
    validated inside the kernel. An attacker can take advantage of this to
    trigger an OOB read and potentially leak information.
    
    BUG: KASAN: slab-out-of-bounds in nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
    Read of size 2 at addr ffff88804bc64272 by task poc/6431
    
    CPU: 1 PID: 6431 Comm: poc Not tainted 6.0.0-rc4 #1
    Call Trace:
     nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
     nf_osf_find+0x186/0x2f0 net/netfilter/nfnetlink_osf.c:281
     nft_osf_eval+0x37f/0x590 net/netfilter/nft_osf.c:47
     expr_call_ops_eval net/netfilter/nf_tables_core.c:214
     nft_do_chain+0x2b0/0x1490 net/netfilter/nf_tables_core.c:264
     nft_do_chain_ipv4+0x17c/0x1f0 net/netfilter/nft_chain_filter.c:23
     [..]
    
    Also add validation to genre, subtype and version fields.
    
    Fixes: 11eeef41d5f6 ("netfilter: passive OS fingerprint xtables match")
    Reported-by: Lucas Leong <[email protected]>
    Signed-off-by: Wander Lairson Costa <[email protected]>
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nft_flow_offload: fix underflow in flowtable reference counter [+ + +]
Author: wenxu <[email protected]>
Date:   Mon Sep 18 14:06:55 2023 +0200

    netfilter: nft_flow_offload: fix underflow in flowtable reference counter
    
    commit 8ca79606cdfde2e37ee4f0707b9d1874a6f0eb38 upstream.
    
    The .deactivate and .activate interfaces already deal with the reference
    counter. Otherwise, this results in spurious "Device is busy" errors.
    
    Fixes: a3c90f7a2323 ("netfilter: nf_tables: flow offload expression")
    Signed-off-by: wenxu <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: xt_sctp: validate the flag_info count [+ + +]
Author: Wander Lairson Costa <[email protected]>
Date:   Mon Aug 28 19:12:55 2023 -0300

    netfilter: xt_sctp: validate the flag_info count
    
    commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.
    
    sctp_mt_check doesn't validate the flag_count field. An attacker can
    take advantage of that to trigger a OOB read and leak memory
    information.
    
    Add the field validation in the checkentry function.
    
    Fixes: 2e4e6a17af35 ("[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables")
    Cc: [email protected]
    Reported-by: Lucas Leong <[email protected]>
    Signed-off-by: Wander Lairson Costa <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: xt_u32: validate user space input [+ + +]
Author: Wander Lairson Costa <[email protected]>
Date:   Mon Aug 28 10:21:07 2023 -0300

    netfilter: xt_u32: validate user space input
    
    commit 69c5d284f67089b4750d28ff6ac6f52ec224b330 upstream.
    
    The xt_u32 module doesn't validate the fields in the xt_u32 structure.
    An attacker may take advantage of this to trigger an OOB read by setting
    the size fields with a value beyond the arrays boundaries.
    
    Add a checkentry function to validate the structure.
    
    This was originally reported by the ZDI project (ZDI-CAN-18408).
    
    Fixes: 1b50b8a371e9 ("[NETFILTER]: Add u32 match")
    Cc: [email protected]
    Signed-off-by: Wander Lairson Costa <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
netlabel: fix shift wrapping bug in netlbl_catmap_setlong() [+ + +]
Author: Dmitry Mastykin <[email protected]>
Date:   Thu Jun 8 16:57:54 2023 +0300

    netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
    
    [ Upstream commit b403643d154d15176b060b82f7fc605210033edd ]
    
    There is a shift wrapping bug in this code on 32-bit architectures.
    NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long.
    Every second 32-bit word of catmap becomes corrupted.
    
    Signed-off-by: Dmitry Mastykin <[email protected]>
    Acked-by: Paul Moore <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netrom: Deny concurrent connect(). [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Thu Aug 24 09:50:59 2023 -0700

    netrom: Deny concurrent connect().
    
    [ Upstream commit c2f8fd7949603efb03908e05abbf7726748c8de3 ]
    
    syzkaller reported null-ptr-deref [0] related to AF_NETROM.
    This is another self-accept issue from the strace log. [1]
    
    syz-executor creates an AF_NETROM socket and calls connect(), which
    is blocked at that time.  Then, sk->sk_state is TCP_SYN_SENT and
    sock->state is SS_CONNECTING.
    
      [pid  5059] socket(AF_NETROM, SOCK_SEQPACKET, 0) = 4
      [pid  5059] connect(4, {sa_family=AF_NETROM, sa_data="..." <unfinished ...>
    
    Another thread calls connect() concurrently, which finally fails
    with -EINVAL.  However, the problem here is the socket state is
    reset even while the first connect() is blocked.
    
      [pid  5060] connect(4, NULL, 0 <unfinished ...>
      [pid  5060] <... connect resumed>)      = -1 EINVAL (Invalid argument)
    
    As sk->state is TCP_CLOSE and sock->state is SS_UNCONNECTED, the
    following listen() succeeds.  Then, the first connect() looks up
    itself as a listener and puts skb into the queue with skb->sk itself.
    As a result, the next accept() gets another FD of itself as 3, and
    the first connect() finishes.
    
      [pid  5060] listen(4, 0 <unfinished ...>
      [pid  5060] <... listen resumed>)       = 0
      [pid  5060] accept(4, NULL, NULL <unfinished ...>
      [pid  5060] <... accept resumed>)       = 3
      [pid  5059] <... connect resumed>)      = 0
    
    Then, accept4() is called but blocked, which causes the general protection
    fault later.
    
      [pid  5059] accept4(4, NULL, 0x20000400, SOCK_NONBLOCK <unfinished ...>
    
    After that, another self-accept occurs by accept() and writev().
    
      [pid  5060] accept(4, NULL, NULL <unfinished ...>
      [pid  5061] writev(3, [{iov_base=...}] <unfinished ...>
      [pid  5061] <... writev resumed>)       = 99
      [pid  5060] <... accept resumed>)       = 6
    
    Finally, the leader thread close()s all FDs.  Since the three FDs
    reference the same socket, nr_release() does the cleanup for it
    three times, and the remaining accept4() causes the following fault.
    
      [pid  5058] close(3)                    = 0
      [pid  5058] close(4)                    = 0
      [pid  5058] close(5)                    = -1 EBADF (Bad file descriptor)
      [pid  5058] close(6)                    = 0
      [pid  5058] <... exit_group resumed>)   = ?
      [   83.456055][ T5059] general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
    
    To avoid the issue, we need to return an error for connect() if
    another connect() is in progress, as done in __inet_stream_connect().
    
    [0]:
    general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
    KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
    CPU: 0 PID: 5059 Comm: syz-executor.0 Not tainted 6.5.0-rc5-syzkaller-00194-gace0ab3a4b54 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
    RIP: 0010:__lock_acquire+0x109/0x5de0 kernel/locking/lockdep.c:5012
    Code: 45 85 c9 0f 84 cc 0e 00 00 44 8b 05 11 6e 23 0b 45 85 c0 0f 84 be 0d 00 00 48 ba 00 00 00 00 00 fc ff df 4c 89 d1 48 c1 e9 03 <80> 3c 11 00 0f 85 e8 40 00 00 49 81 3a a0 69 48 90 0f 84 96 0d 00
    RSP: 0018:ffffc90003d6f9e0 EFLAGS: 00010006
    RAX: ffff8880244c8000 RBX: 1ffff920007adf6c RCX: 0000000000000003
    RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000018
    RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001
    R10: 0000000000000018 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    FS:  00007f51d519a6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f51d5158d58 CR3: 000000002943f000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     lock_acquire kernel/locking/lockdep.c:5761 [inline]
     lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726
     __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
     _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
     prepare_to_wait+0x47/0x380 kernel/sched/wait.c:269
     nr_accept+0x20d/0x650 net/netrom/af_netrom.c:798
     do_accept+0x3a6/0x570 net/socket.c:1872
     __sys_accept4_file net/socket.c:1913 [inline]
     __sys_accept4+0x99/0x120 net/socket.c:1943
     __do_sys_accept4 net/socket.c:1954 [inline]
     __se_sys_accept4 net/socket.c:1951 [inline]
     __x64_sys_accept4+0x96/0x100 net/socket.c:1951
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f51d447cae9
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f51d519a0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000120
    RAX: ffffffffffffffda RBX: 00007f51d459bf80 RCX: 00007f51d447cae9
    RDX: 0000000020000400 RSI: 0000000000000000 RDI: 0000000000000004
    RBP: 00007f51d44c847a R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000800 R11: 0000000000000246 R12: 0000000000000000
    R13: 000000000000000b R14: 00007f51d459bf80 R15: 00007ffc25c34e48
     </TASK>
    
    Link: https://syzkaller.appspot.com/text?tag=CrashLog&x=152cdb63a80000 [1]
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=666c97e4686410e79649
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
new helper: lookup_positive_unlocked() [+ + +]
Author: Al Viro <[email protected]>
Date:   Thu Oct 31 01:21:58 2019 -0400

    new helper: lookup_positive_unlocked()
    
    [ Upstream commit 6c2d4798a8d16cf4f3a28c3cd4af4f1dcbbb4d04 ]
    
    Most of the callers of lookup_one_len_unlocked() treat negatives are
    ERR_PTR(-ENOENT).  Provide a helper that would do just that.  Note
    that a pinned positive dentry remains positive - it's ->d_inode is
    stable, etc.; a pinned _negative_ dentry can become positive at any
    point as long as you are not holding its parent at least shared.
    So using lookup_one_len_unlocked() needs to be careful;
    lookup_positive_unlocked() is safer and that's what the callers
    end up open-coding anyway.
    
    Signed-off-by: Al Viro <[email protected]>
    Stable-dep-of: 0d5a4f8f775f ("fs: Fix error checking for d_hash_and_lookup()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfs/blocklayout: Use the passed in gfp flags [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Mon Jul 24 11:08:46 2023 +0300

    nfs/blocklayout: Use the passed in gfp flags
    
    [ Upstream commit 08b45fcb2d4675f6182fe0edc0d8b1fe604051fa ]
    
    This allocation should use the passed in GFP_ flags instead of
    GFP_KERNEL.  One places where this matters is in filelayout_pg_init_write()
    which uses GFP_NOFS as the allocation flags.
    
    Fixes: 5c83746a0cf2 ("pnfs/blocklayout: in-kernel GETDEVICEINFO XDR parsing")
    Signed-off-by: Dan Carpenter <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Anna Schumaker <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
NFSD: da_addr_body field missing in some GETDEVICEINFO replies [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Wed Aug 16 10:20:52 2023 -0400

    NFSD: da_addr_body field missing in some GETDEVICEINFO replies
    
    [ Upstream commit 6372e2ee629894433fe6107d7048536a3280a284 ]
    
    The XDR specification in RFC 8881 looks like this:
    
    struct device_addr4 {
            layouttype4     da_layout_type;
            opaque          da_addr_body<>;
    };
    
    struct GETDEVICEINFO4resok {
            device_addr4    gdir_device_addr;
            bitmap4         gdir_notification;
    };
    
    union GETDEVICEINFO4res switch (nfsstat4 gdir_status) {
    case NFS4_OK:
            GETDEVICEINFO4resok gdir_resok4;
    case NFS4ERR_TOOSMALL:
            count4          gdir_mincount;
    default:
            void;
    };
    
    Looking at nfsd4_encode_getdeviceinfo() ....
    
    When the client provides a zero gd_maxcount, then the Linux NFS
    server implementation encodes the da_layout_type field and then
    skips the da_addr_body field completely, proceeding directly to
    encode gdir_notification field.
    
    There does not appear to be an option in the specification to skip
    encoding da_addr_body. Moreover, Section 18.40.3 says:
    
    > If the client wants to just update or turn off notifications, it
    > MAY send a GETDEVICEINFO operation with gdia_maxcount set to zero.
    > In that event, if the device ID is valid, the reply's da_addr_body
    > field of the gdir_device_addr field will be of zero length.
    
    Since the layout drivers are responsible for encoding the
    da_addr_body field, put this fix inside the ->encode_getdeviceinfo
    methods.
    
    Fixes: 9cf514ccfacb ("nfsd: implement pNFS operations")
    Reviewed-by: Christoph Hellwig <[email protected]>
    Cc: Tom Haynes <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nfsd: fix change_info in NFSv4 RENAME replies [+ + +]
Author: Jeff Layton <[email protected]>
Date:   Sat Sep 9 07:12:30 2023 -0400

    nfsd: fix change_info in NFSv4 RENAME replies
    
    commit fdd2630a7398191e84822612e589062063bd4f3d upstream.
    
    nfsd sends the transposed directory change info in the RENAME reply. The
    source directory is in save_fh and the target is in current_fh.
    
    Reported-by: Zhi Li <[email protected]>
    Reported-by: Benjamin Coddington <[email protected]>
    Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2218844
    Signed-off-by: Jeff Layton <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Thu Jul 20 18:37:51 2023 +0300

    NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
    
    commit 96562c45af5c31b89a197af28f79bfa838fb8391 upstream.
    
    It is an almost improbable error case but when page allocating loop in
    nfs4_get_device_info() fails then we should only free the already
    allocated pages, as __free_page() can't deal with NULL arguments.
    
    Found by Linux Verification Center (linuxtesting.org).
    
    Cc: [email protected]
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Reviewed-by: Benjamin Coddington <[email protected]>
    Signed-off-by: Anna Schumaker <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers() [+ + +]
Author: Ryusuke Konishi <[email protected]>
Date:   Sat Aug 5 22:20:38 2023 +0900

    nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers()
    
    commit f83913f8c5b882a312e72b7669762f8a5c9385e4 upstream.
    
    A syzbot stress test reported that create_empty_buffers() called from
    nilfs_lookup_dirty_data_buffers() can cause a general protection fault.
    
    Analysis using its reproducer revealed that the back reference "mapping"
    from a page/folio has been changed to NULL after dirty page/folio gang
    lookup in nilfs_lookup_dirty_data_buffers().
    
    Fix this issue by excluding pages/folios from being collected if, after
    acquiring a lock on each page/folio, its back reference "mapping" differs
    from the pointer to the address space struct that held the page/folio.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Reported-by: [email protected]
    Closes: https://lkml.kernel.org/r/[email protected]
    Tested-by: Ryusuke Konishi <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse [+ + +]
Author: Ryusuke Konishi <[email protected]>
Date:   Fri Aug 18 22:18:04 2023 +0900

    nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse
    
    commit cdaac8e7e5a059f9b5e816cda257f08d0abffacd upstream.
    
    A syzbot stress test using a corrupted disk image reported that
    mark_buffer_dirty() called from __nilfs_mark_inode_dirty() or
    nilfs_palloc_commit_alloc_entry() may output a kernel warning, and can
    panic if the kernel is booted with panic_on_warn.
    
    This is because nilfs2 keeps buffer pointers in local structures for some
    metadata and reuses them, but such buffers may be forcibly discarded by
    nilfs_clear_dirty_page() in some critical situations.
    
    This issue is reported to appear after commit 28a65b49eb53 ("nilfs2: do
    not write dirty data after degenerating to read-only"), but the issue has
    potentially existed before.
    
    Fix this issue by checking the uptodate flag when attempting to reuse an
    internally held buffer, and reloading the metadata instead of reusing the
    buffer if the flag was lost.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Reported-by: [email protected]
    Closes: https://lkml.kernel.org/r/[email protected]
    Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
    Tested-by: Ryusuke Konishi <[email protected]>
    Cc: <[email protected]> # 3.10+
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ntb: Clean up tx tail index on link down [+ + +]
Author: Dave Jiang <[email protected]>
Date:   Tue Aug 22 09:04:45 2023 -0700

    ntb: Clean up tx tail index on link down
    
    commit cc79bd2738c2d40aba58b2be6ce47dc0e471df0e upstream.
    
    The tx tail index is not reset when the link goes down. This causes the
    tail index to go out of sync when the link goes down and comes back up.
    Refactor the ntb_qp_link_down_reset() and reset the tail index as well.
    
    Fixes: 2849b5d70641 ("NTB: Reset transport QP link stats on down")
    Reported-by: Yuan Y Lu <[email protected]>
    Tested-by: Yuan Y Lu <[email protected]>
    Reviewed-by: Logan Gunthorpe <[email protected]>
    Signed-off-by: Dave Jiang <[email protected]>
    Signed-off-by: Jon Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ntb: Drop packets when qp link is down [+ + +]
Author: Dave Jiang <[email protected]>
Date:   Tue Aug 22 09:04:51 2023 -0700

    ntb: Drop packets when qp link is down
    
    commit f195a1a6fe416882984f8bd6c61afc1383171860 upstream.
    
    Currently when the transport receive packets after netdev has closed the
    transport returns error and triggers tx errors to be incremented and
    carrier to be stopped. There is no reason to return error if the device is
    already closed. Drop the packet and return 0.
    
    Fixes: e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
    Reported-by: Yuan Y Lu <[email protected]>
    Tested-by: Yuan Y Lu <[email protected]>
    Reviewed-by: Logan Gunthorpe <[email protected]>
    Signed-off-by: Dave Jiang <[email protected]>
    Signed-off-by: Jon Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ntb: Fix calculation ntb_transport_tx_free_entry() [+ + +]
Author: Dave Jiang <[email protected]>
Date:   Tue Aug 22 09:04:57 2023 -0700

    ntb: Fix calculation ntb_transport_tx_free_entry()
    
    commit 5a7693e6bbf19b22fd6c1d2c4b7beb0a03969e2c upstream.
    
    ntb_transport_tx_free_entry() never returns 0 with the current
    calculation. If head == tail, then it would return qp->tx_max_entry.
    Change compare to tail >= head and when they are equal, a 0 would be
    returned.
    
    Fixes: e74bfeedad08 ("NTB: Add flow control to the ntb_netdev")
    Reviewed-by: Logan Gunthorpe <[email protected]>
    Signed-off-by: renlonglong <[email protected]>
    Signed-off-by: Dave Jiang <[email protected]>
    Signed-off-by: Jon Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name() [+ + +]
Author: Ruan Jinjie <[email protected]>
Date:   Thu Jul 27 16:02:46 2023 +0800

    of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()
    
    [ Upstream commit d6ce4f0ea19c32f10867ed93d8386924326ab474 ]
    
    when kmalloc() fail to allocate memory in kasprintf(), name
    or full_name will be NULL, strcmp() will cause
    null pointer dereference.
    
    Fixes: 0d638a07d3a1 ("of: Convert to using %pOF instead of full_name")
    Signed-off-by: Ruan Jinjie <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Herring <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

of: unittest: Fix overlay type in apply/revert check [+ + +]
Author: Geert Uytterhoeven <[email protected]>
Date:   Fri Jul 28 10:50:29 2023 +0200

    of: unittest: Fix overlay type in apply/revert check
    
    [ Upstream commit 6becf8f845ae1f0b1cfed395bbeccbd23654162d ]
    
    The removal check in of_unittest_apply_revert_overlay_check()
    always uses the platform device overlay type, while it should use the
    actual overlay type, as passed as a parameter to the function.
    
    This has no impact on any current test, as all tests calling
    of_unittest_apply_revert_overlay_check() use the platform device overlay
    type.
    
    Fixes: d5e75500ca401d31 ("of: unitest: Add I2C overlay unit tests.")
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/r/ba0234c41ba808f10112094f88792beeb6dbaedf.1690533838.git.geert+renesas@glider.be
    Signed-off-by: Rob Herring <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
parisc: Drop loops_per_jiffy from per_cpu struct [+ + +]
Author: Helge Deller <[email protected]>
Date:   Sat Oct 24 12:43:11 2020 +0200

    parisc: Drop loops_per_jiffy from per_cpu struct
    
    commit 93346da8ff47cc00f953c7f38a2d6ba11977fc42 upstream.
    
    There is no need to keep a loops_per_jiffy value per cpu. Drop it.
    
    Signed-off-by: Helge Deller <[email protected]>
    Cc: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

parisc: Fix /proc/cpuinfo output for lscpu [+ + +]
Author: Helge Deller <[email protected]>
Date:   Fri Aug 18 22:48:04 2023 +0200

    parisc: Fix /proc/cpuinfo output for lscpu
    
    commit 9f5ba4b3e1b3c123eeca5d2d09161e8720048b5c upstream.
    
    The lscpu command is broken since commit cab56b51ec0e ("parisc: Fix
    device names in /proc/iomem") added the PA pathname to all PA
    devices, includig the CPUs.
    
    lscpu parses /proc/cpuinfo and now believes it found different CPU
    types since every CPU is listed with an unique identifier (PA
    pathname).
    
    Fix this problem by simply dropping the PA pathname when listing the
    CPUs in /proc/cpuinfo. There is no need to show the pathname in this
    procfs file.
    
    Fixes: cab56b51ec0e ("parisc: Fix device names in /proc/iomem")
    Signed-off-by: Helge Deller <[email protected]>
    Cc: <[email protected]> # v4.9+
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

parisc: led: Fix LAN receive and transmit LEDs [+ + +]
Author: Helge Deller <[email protected]>
Date:   Sun Aug 27 13:46:11 2023 +0200

    parisc: led: Fix LAN receive and transmit LEDs
    
    commit 4db89524b084f712a887256391fc19d9f66c8e55 upstream.
    
    Fix the LAN receive and LAN transmit LEDs, which where swapped
    up to now.
    
    Signed-off-by: Helge Deller <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

parisc: led: Reduce CPU overhead for disk & lan LED computation [+ + +]
Author: Helge Deller <[email protected]>
Date:   Fri Aug 25 17:46:39 2023 +0200

    parisc: led: Reduce CPU overhead for disk & lan LED computation
    
    commit 358ad816e52d4253b38c2f312e6b1cbd89e0dbf7 upstream.
    
    Older PA-RISC machines have LEDs which show the disk- and LAN-activity.
    The computation is done in software and takes quite some time, e.g. on a
    J6500 this may take up to 60% time of one CPU if the machine is loaded
    via network traffic.
    
    Since most people don't care about the LEDs, start with LEDs disabled and
    just show a CPU heartbeat LED. The disk and LAN LEDs can be turned on
    manually via /proc/pdc/led.
    
    Signed-off-by: Helge Deller <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
PCI/ASPM: Use RMW accessors for changing LNKCTL [+ + +]
Author: Ilpo Järvinen <[email protected]>
Date:   Mon Jul 17 15:04:56 2023 +0300

    PCI/ASPM: Use RMW accessors for changing LNKCTL
    
    [ Upstream commit e09060b3b6b4661278ff8e1b7b81a37d5ea86eae ]
    
    Don't assume that the device is fully under the control of ASPM and use RMW
    capability accessors which do proper locking to avoid losing concurrent
    updates to the register values.
    
    If configuration fails in pcie_aspm_configure_common_clock(), the
    function attempts to restore the old PCI_EXP_LNKCTL_CCC settings. Store
    only the old PCI_EXP_LNKCTL_CCC bit for the relevant devices rather
    than the content of the whole LNKCTL registers. It aligns better with
    how pcie_lnkctl_clear_and_set() expects its parameter and makes the
    code more obvious to understand.
    
    Suggested-by: Lukas Wunner <[email protected]>
    Fixes: 2a42d9dba784 ("PCIe: ASPM: Break out of endless loop waiting for PCI config bits to switch")
    Fixes: 7d715a6c1ae5 ("PCI: add PCI Express ASPM support")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: "Rafael J. Wysocki" <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI/ATS: Add inline to pci_prg_resp_pasid_required() [+ + +]
Author: Kuppuswamy Sathyanarayanan <[email protected]>
Date:   Wed Feb 27 11:26:46 2019 -0800

    PCI/ATS: Add inline to pci_prg_resp_pasid_required()
    
    commit fff42928ade591969836ff49888d063b829ac888 upstream.
    
    Fix unused function warning when compiled with CONFIG_PCI_PASID
    disabled.
    
    Fixes: e5567f5f6762 ("PCI/ATS: Add pci_prg_resp_pasid_required() interface.")
    Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>
    Signed-off-by: Joerg Roedel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI/ATS: Add pci_prg_resp_pasid_required() interface. [+ + +]
Author: Kuppuswamy Sathyanarayanan <[email protected]>
Date:   Tue Feb 19 11:04:51 2019 -0800

    PCI/ATS: Add pci_prg_resp_pasid_required() interface.
    
    [ Upstream commit e5567f5f67621877726f99be040af9fbedda37dc ]
    
    Return the PRG Response PASID Required bit in the Page Request
    Status Register.
    
    As per PCIe spec r4.0, sec 10.5.2.3, if this bit is Set, the device
    expects a PASID TLP Prefix on PRG Response Messages when the
    corresponding Page Requests had a PASID TLP Prefix. If Clear, the device
    does not expect PASID TLP Prefixes on any PRG Response Message, and the
    device behavior is undefined if the device receives a PRG Response Message
    with a PASID TLP Prefix. Also the device behavior is undefined if this
    bit is Set and the device receives a PRG Response Message with no PASID TLP
    Prefix when the corresponding Page Requests had a PASID TLP Prefix.
    
    This function will be used by drivers like IOMMU, if it is required to
    check the status of the PRG Response PASID Required bit before enabling
    the PASID support of the device.
    
    Cc: Ashok Raj <[email protected]>
    Cc: Jacob Pan <[email protected]>
    Cc: Keith Busch <[email protected]>
    Suggested-by: Ashok Raj <[email protected]>
    Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>
    Acked-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Joerg Roedel <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI: Add #defines for Enter Compliance, Transmit Margin [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Tue Nov 12 11:07:36 2019 -0600

    PCI: Add #defines for Enter Compliance, Transmit Margin
    
    [ Upstream commit bbdb2f5ecdf1e66b2f09710134db3c2e5c43a958 ]
    
    Add definitions for the Enter Compliance and Transmit Margin fields of the
    PCIe Link Control 2 register.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

PCI: Cleanup register definition width and whitespace [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Mon Feb 4 14:50:14 2019 -0600

    PCI: Cleanup register definition width and whitespace
    
    [ Upstream commit 35d0a06dad2220d62042fd1a91a216d17744e724 ]
    
    Follow the file conventions of:
    
      - register offsets not indented
      - fields within a register indented one space
      - field masks use same width as register
      - register field values indented an additional space
    
    No functional change intended.
    
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

PCI: Decode PCIe 32 GT/s link speed [+ + +]
Author: Gustavo Pimentel <[email protected]>
Date:   Tue Jun 4 18:24:43 2019 +0200

    PCI: Decode PCIe 32 GT/s link speed
    
    [ Upstream commit de76cda215d56256ffcda7ffa538b70f9fb301a7 ]
    
    PCIe r5.0, sec 7.5.3.18, defines a new 32.0 GT/s bit in the Supported Link
    Speeds Vector of Link Capabilities 2.  Decode this new speed.  This does
    not affect the speed of the link, which should be negotiated automatically
    by the hardware; it only adds decoding when showing the speed to the user.
    
    Previously, reading the speed of a link operating at this speed showed
    "Unknown speed" instead of "32.0 GT/s".
    
    Link: https://lore.kernel.org/lkml/92365e3caf0fc559f9ab14bcd053bfc92d4f661c.1559664969.git.gustavo.pimentel@synopsys.com
    Signed-off-by: Gustavo Pimentel <[email protected]>
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Stable-dep-of: ce7d88110b9e ("drm/amdgpu: Use RMW accessors for changing LNKCTL")
    Signed-off-by: Sasha Levin <[email protected]>

PCI: Mark NVIDIA T4 GPUs to avoid bus reset [+ + +]
Author: Wu Zongyong <[email protected]>
Date:   Mon Apr 10 20:34:11 2023 +0800

    PCI: Mark NVIDIA T4 GPUs to avoid bus reset
    
    [ Upstream commit d5af729dc2071273f14cbb94abbc60608142fd83 ]
    
    NVIDIA T4 GPUs do not work with SBR. This problem is found when the T4 card
    is direct attached to a Root Port only. Avoid bus reset by marking T4 GPUs
    PCI_DEV_FLAGS_NO_BUS_RESET.
    
    Fixes: 4c207e7121fa ("PCI: Mark some NVIDIA GPUs to avoid bus reset")
    Link: https://lore.kernel.org/r/2dcebea53a6eb9bd212ec6d8974af2e5e0333ef6.1681129861.git.wuzongyong@linux.alibaba.com
    Signed-off-by: Wu Zongyong <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

PCI: pciehp: Use RMW accessors for changing LNKCTL [+ + +]
Author: Ilpo Järvinen <[email protected]>
Date:   Mon Jul 17 15:04:55 2023 +0300

    PCI: pciehp: Use RMW accessors for changing LNKCTL
    
    [ Upstream commit 5f75f96c61039151c193775d776fde42477eace1 ]
    
    As hotplug is not the only driver touching LNKCTL, use the RMW capability
    accessor which handles concurrent changes correctly.
    
    Suggested-by: Lukas Wunner <[email protected]>
    Fixes: 7f822999e12a ("PCI: pciehp: Add Disable/enable link functions")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: "Rafael J. Wysocki" <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf hists browser: Fix hierarchy mode header [+ + +]
Author: Namhyung Kim <[email protected]>
Date:   Mon Jul 31 02:49:32 2023 -0700

    perf hists browser: Fix hierarchy mode header
    
    commit e2cabf2a44791f01c21f8d5189b946926e34142e upstream.
    
    The commit ef9ff6017e3c4593 ("perf ui browser: Move the extra title
    lines from the hists browser") introduced ui_browser__gotorc_title() to
    help moving non-title lines easily.  But it missed to update the title
    for the hierarchy mode so it won't print the header line on TUI at all.
    
      $ perf report --hierarchy
    
    Fixes: ef9ff6017e3c4593 ("perf ui browser: Move the extra title lines from the hists browser")
    Signed-off-by: Namhyung Kim <[email protected]>
    Tested-by: Arnaldo Carvalho de Melo <[email protected]>
    Cc: Adrian Hunter <[email protected]>
    Cc: Ian Rogers <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jiri Olsa <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pinctrl: amd: Don't show `Invalid config param` errors [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Mon Jul 17 15:16:52 2023 -0500

    pinctrl: amd: Don't show `Invalid config param` errors
    
    commit 87b549efcb0f7934b0916d2a00607a878b6f1e0f upstream.
    
    On some systems amd_pinconf_set() is called with parameters
    0x8 (PIN_CONFIG_DRIVE_PUSH_PULL) or 0x14 (PIN_CONFIG_PERSIST_STATE)
    which are not supported by pinctrl-amd.
    
    Don't show an err message when called with an invalid parameter,
    downgrade this to debug instead.
    
    Cc: [email protected] # 6.1
    Fixes: 635a750d958e1 ("pinctrl: amd: Use amd_pinconf_set() for all config options")
    Signed-off-by: Mario Limonciello <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
platform/x86: intel: hid: Always call BTNL ACPI method [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Sat Jul 15 20:15:16 2023 +0200

    platform/x86: intel: hid: Always call BTNL ACPI method
    
    [ Upstream commit e3ab18de2b09361d6f0e4aafb9cfd6d002ce43a1 ]
    
    On a HP Elite Dragonfly G2 the 0xcc and 0xcd events for SW_TABLET_MODE
    are only send after the BTNL ACPI method has been called.
    
    Likely more devices need this, so make the BTNL ACPI method unconditional
    instead of only doing it on devices with a 5 button array.
    
    Note this also makes the intel_button_array_enable() call in probe()
    unconditional, that function does its own priv->array check. This makes
    the intel_button_array_enable() call in probe() consistent with the calls
    done on suspend/resume which also rely on the priv->array check inside
    the function.
    
    Reported-by: Maxim Mikityanskiy <[email protected]>
    Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/
    Signed-off-by: Hans de Goede <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
PM / devfreq: Fix leak in devfreq_dev_release() [+ + +]
Author: Boris Brezillon <[email protected]>
Date:   Wed Aug 9 13:31:08 2023 +0200

    PM / devfreq: Fix leak in devfreq_dev_release()
    
    commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.
    
    srcu_init_notifier_head() allocates resources that need to be released
    with a srcu_cleanup_notifier_head() call.
    
    Reported by kmemleak.
    
    Fixes: 0fe3a66410a3 ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
    Cc: <[email protected]>
    Signed-off-by: Boris Brezillon <[email protected]>
    Reviewed-by: Dhruva Gole <[email protected]>
    Signed-off-by: Chanwoo Choi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
powerpc/32: Include .branch_lt in data section [+ + +]
Author: Joel Stanley <[email protected]>
Date:   Wed Nov 14 13:32:18 2018 +1030

    powerpc/32: Include .branch_lt in data section
    
    commit 98ecc6768e8fdba95da1fc1efa0ef2d769e7fe1c upstream.
    
    When building a 32 bit powerpc kernel with Binutils 2.31.1 this warning
    is emitted:
    
     powerpc-linux-gnu-ld: warning: orphan section `.branch_lt' from
     `arch/powerpc/kernel/head_44x.o' being placed in section `.branch_lt'
    
    As of binutils commit 2d7ad24e8726 ("Support PLT16 relocs against local
    symbols")[1], 32 bit targets can produce .branch_lt sections in their
    output.
    
    Include these symbols in the .data section as the ppc64 kernel does.
    
    [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=2d7ad24e8726ba4c45c9e67be08223a146a837ce
    Signed-off-by: Joel Stanley <[email protected]>
    Reviewed-by: Alan Modra <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Cc: Christophe Leroy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
powerpc/32s: Fix assembler warning about r0 [+ + +]
Author: Christophe Leroy <[email protected]>
Date:   Thu Aug 6 06:01:42 2020 +0000

    powerpc/32s: Fix assembler warning about r0
    
    commit b51ba4fe2e134b631f9c8f45423707aab71449b5 upstream.
    
    The assembler says:
      arch/powerpc/kernel/head_32.S:1095: Warning: invalid register expression
    
    It's objecting to the use of r0 as the RA argument. That's because
    when RA = 0 the literal value 0 is used, rather than the content of
    r0, making the use of r0 in the source potentially confusing.
    
    Fix it to use a literal 0, the generated code is identical.
    
    Signed-off-by: Christophe Leroy <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/2b69ac8e1cddff6f808fc7415907179eab4aae9e.1596693679.git.christophe.leroy@csgroup.eu
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
powerpc/iommu: Fix notifiers being shared by PCI and VIO buses [+ + +]
Author: Russell Currey <[email protected]>
Date:   Wed Mar 22 14:53:22 2023 +1100

    powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
    
    [ Upstream commit c37b6908f7b2bd24dcaaf14a180e28c9132b9c58 ]
    
    fail_iommu_setup() registers the fail_iommu_bus_notifier struct to both
    PCI and VIO buses.  struct notifier_block is a linked list node, so this
    causes any notifiers later registered to either bus type to also be
    registered to the other since they share the same node.
    
    This causes issues in (at least) the vgaarb code, which registers a
    notifier for PCI buses.  pci_notify() ends up being called on a vio
    device, converted with to_pci_dev() even though it's not a PCI device,
    and finally makes a bad access in vga_arbiter_add_pci_device() as
    discovered with KASAN:
    
     BUG: KASAN: slab-out-of-bounds in vga_arbiter_add_pci_device+0x60/0xe00
     Read of size 4 at addr c000000264c26fdc by task swapper/0/1
    
     Call Trace:
       dump_stack_lvl+0x1bc/0x2b8 (unreliable)
       print_report+0x3f4/0xc60
       kasan_report+0x244/0x698
       __asan_load4+0xe8/0x250
       vga_arbiter_add_pci_device+0x60/0xe00
       pci_notify+0x88/0x444
       notifier_call_chain+0x104/0x320
       blocking_notifier_call_chain+0xa0/0x140
       device_add+0xac8/0x1d30
       device_register+0x58/0x80
       vio_register_device_node+0x9ac/0xce0
       vio_bus_scan_register_devices+0xc4/0x13c
       __machine_initcall_pseries_vio_device_init+0x94/0xf0
       do_one_initcall+0x12c/0xaa8
       kernel_init_freeable+0xa48/0xba8
       kernel_init+0x64/0x400
       ret_from_kernel_thread+0x5c/0x64
    
    Fix this by creating separate notifier_block structs for each bus type.
    
    Fixes: d6b9a81b2a45 ("powerpc: IOMMU fault injection")
    Reported-by: Nageswara R Sastry <[email protected]>
    Signed-off-by: Russell Currey <[email protected]>
    Tested-by: Nageswara R Sastry <[email protected]>
    Reviewed-by: Andrew Donnellan <[email protected]>
    [mpe: Add #ifdef to fix CONFIG_IBMVIO=n build]
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
powerpc/pseries: fix possible memory leak in ibmebus_bus_init() [+ + +]
Author: ruanjinjie <[email protected]>
Date:   Thu Nov 10 09:19:29 2022 +0800

    powerpc/pseries: fix possible memory leak in ibmebus_bus_init()
    
    [ Upstream commit afda85b963c12947e298ad85d757e333aa40fd74 ]
    
    If device_register() returns error in ibmebus_bus_init(), name of kobject
    which is allocated in dev_set_name() called in device_add() is leaked.
    
    As comment of device_add() says, it should call put_device() to drop
    the reference count that was set in device_initialize() when it fails,
    so the name can be freed in kobject_cleanup().
    
    Signed-off-by: ruanjinjie <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
procfs: block chmod on /proc/thread-self/comm [+ + +]
Author: Aleksa Sarai <[email protected]>
Date:   Fri Jul 14 00:09:58 2023 +1000

    procfs: block chmod on /proc/thread-self/comm
    
    commit ccf61486fe1e1a48e18c638d1813cda77b3c0737 upstream.
    
    Due to an oversight in commit 1b3044e39a89 ("procfs: fix pthread
    cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD,
    chmod operations on /proc/thread-self/comm were no longer blocked as
    they are on almost all other procfs files.
    
    A very similar situation with /proc/self/environ was used to as a root
    exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a
    correctness issue.
    
    Ref: https://lwn.net/Articles/191954/
    Ref: 6d76fa58b050 ("Don't allow chmod() on the /proc/<pid>/ files")
    Fixes: 1b3044e39a89 ("procfs: fix pthread cross-thread naming if !PR_DUMPABLE")
    Cc: [email protected] # v4.7+
    Signed-off-by: Aleksa Sarai <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pstore/ram: Check start of empty przs during init [+ + +]
Author: Enlin Mu <[email protected]>
Date:   Tue Aug 1 14:04:32 2023 +0800

    pstore/ram: Check start of empty przs during init
    
    commit fe8c3623ab06603eb760444a032d426542212021 upstream.
    
    After commit 30696378f68a ("pstore/ram: Do not treat empty buffers as
    valid"), initialization would assume a prz was valid after seeing that
    the buffer_size is zero (regardless of the buffer start position). This
    unchecked start value means it could be outside the bounds of the buffer,
    leading to future access panics when written to:
    
     sysdump_panic_event+0x3b4/0x5b8
     atomic_notifier_call_chain+0x54/0x90
     panic+0x1c8/0x42c
     die+0x29c/0x2a8
     die_kernel_fault+0x68/0x78
     __do_kernel_fault+0x1c4/0x1e0
     do_bad_area+0x40/0x100
     do_translation_fault+0x68/0x80
     do_mem_abort+0x68/0xf8
     el1_da+0x1c/0xc0
     __raw_writeb+0x38/0x174
     __memcpy_toio+0x40/0xac
     persistent_ram_update+0x44/0x12c
     persistent_ram_write+0x1a8/0x1b8
     ramoops_pstore_write+0x198/0x1e8
     pstore_console_write+0x94/0xe0
     ...
    
    To avoid this, also check if the prz start is 0 during the initialization
    phase. If not, the next prz sanity check case will discover it (start >
    size) and zap the buffer back to a sane state.
    
    Fixes: 30696378f68a ("pstore/ram: Do not treat empty buffers as valid")
    Cc: Yunlong Xing <[email protected]>
    Cc: [email protected]
    Signed-off-by: Enlin Mu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [kees: update commit log with backtrace and clarifications]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pwm: lpc32xx: Remove handling of PWM channels [+ + +]
Author: Vladimir Zapolskiy <[email protected]>
Date:   Mon Jul 17 17:52:57 2023 +0200

    pwm: lpc32xx: Remove handling of PWM channels
    
    [ Upstream commit 4aae44f65827f0213a7361cf9c32cfe06114473f ]
    
    Because LPC32xx PWM controllers have only a single output which is
    registered as the only PWM device/channel per controller, it is known in
    advance that pwm->hwpwm value is always 0. On basis of this fact
    simplify the code by removing operations with pwm->hwpwm, there is no
    controls which require channel number as input.
    
    Even though I wasn't aware at the time when I forward ported that patch,
    this fixes a null pointer dereference as lpc32xx->chip.pwms is NULL
    before devm_pwmchip_add() is called.
    
    Reported-by: Dan Carpenter <[email protected]>
    Signed-off-by: Vladimir Zapolskiy <[email protected]>
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Fixes: 3d2813fb17e5 ("pwm: lpc32xx: Don't modify HW state in .probe() after the PWM chip was registered")
    Signed-off-by: Thierry Reding <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
quota: add dqi_dirty_list description to comment of Dquot List Management [+ + +]
Author: Chengguang Xu <[email protected]>
Date:   Mon May 6 09:39:03 2019 +0800

    quota: add dqi_dirty_list description to comment of Dquot List Management
    
    [ Upstream commit f44840ad1f822d9ecee6a3f91f2d17825a361307 ]
    
    Actually there are four lists for dquot management, so add
    the description of dqui_dirty_list to comment.
    
    Signed-off-by: Chengguang Xu <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
    Signed-off-by: Sasha Levin <[email protected]>

quota: add new helper dquot_active() [+ + +]
Author: Baokun Li <[email protected]>
Date:   Fri Jun 30 19:08:20 2023 +0800

    quota: add new helper dquot_active()
    
    [ Upstream commit 33bcfafc48cb186bc4bbcea247feaa396594229e ]
    
    Add new helper function dquot_active() to make the code more concise.
    
    Signed-off-by: Baokun Li <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
    Signed-off-by: Sasha Levin <[email protected]>

quota: avoid increasing DQST_LOOKUPS when iterating over dirty/inuse list [+ + +]
Author: Chengguang Xu <[email protected]>
Date:   Thu Sep 26 16:34:08 2019 +0800

    quota: avoid increasing DQST_LOOKUPS when iterating over dirty/inuse list
    
    [ Upstream commit 05848db2083d4f232e84e385845dcd98d5c511b2 ]
    
    It is meaningless to increase DQST_LOOKUPS number while iterating
    over dirty/inuse list, so just avoid it.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Chengguang Xu <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
    Signed-off-by: Sasha Levin <[email protected]>

quota: factor out dquot_write_dquot() [+ + +]
Author: Baokun Li <[email protected]>
Date:   Fri Jun 30 19:08:18 2023 +0800

    quota: factor out dquot_write_dquot()
    
    [ Upstream commit 024128477809f8073d870307c8157b8826ebfd08 ]
    
    Refactor out dquot_write_dquot() to reduce duplicate code.
    
    Signed-off-by: Baokun Li <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
    Signed-off-by: Sasha Levin <[email protected]>

quota: fix dqput() to follow the guarantees dquot_srcu should provide [+ + +]
Author: Baokun Li <[email protected]>
Date:   Fri Jun 30 19:08:21 2023 +0800

    quota: fix dqput() to follow the guarantees dquot_srcu should provide
    
    [ Upstream commit dabc8b20756601b9e1cc85a81d47d3f98ed4d13a ]
    
    The dquot_mark_dquot_dirty() using dquot references from the inode
    should be protected by dquot_srcu. quota_off code takes care to call
    synchronize_srcu(&dquot_srcu) to not drop dquot references while they
    are used by other users. But dquot_transfer() breaks this assumption.
    We call dquot_transfer() to drop the last reference of dquot and add
    it to free_dquots, but there may still be other users using the dquot
    at this time, as shown in the function graph below:
    
           cpu1              cpu2
    _________________|_________________
    wb_do_writeback         CHOWN(1)
     ...
      ext4_da_update_reserve_space
       dquot_claim_block
        ...
         dquot_mark_dquot_dirty // try to dirty old quota
          test_bit(DQ_ACTIVE_B, &dquot->dq_flags) // still ACTIVE
          if (test_bit(DQ_MOD_B, &dquot->dq_flags))
          // test no dirty, wait dq_list_lock
                        ...
                         dquot_transfer
                          __dquot_transfer
                          dqput_all(transfer_from) // rls old dquot
                           dqput // last dqput
                            dquot_release
                             clear_bit(DQ_ACTIVE_B, &dquot->dq_flags)
                            atomic_dec(&dquot->dq_count)
                            put_dquot_last(dquot)
                             list_add_tail(&dquot->dq_free, &free_dquots)
                             // add the dquot to free_dquots
          if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags))
            add dqi_dirty_list // add released dquot to dirty_list
    
    This can cause various issues, such as dquot being destroyed by
    dqcache_shrink_scan() after being added to free_dquots, which can trigger
    a UAF in dquot_mark_dquot_dirty(); or after dquot is added to free_dquots
    and then to dirty_list, it is added to free_dquots again after
    dquot_writeback_dquots() is executed, which causes the free_dquots list to
    be corrupted and triggers a UAF when dqcache_shrink_scan() is called for
    freeing dquot twice.
    
    As Honza said, we need to fix dquot_transfer() to follow the guarantees
    dquot_srcu should provide. But calling synchronize_srcu() directly from
    dquot_transfer() is too expensive (and mostly unnecessary). So we add
    dquot whose last reference should be dropped to the new global dquot
    list releasing_dquots, and then queue work item which would call
    synchronize_srcu() and after that perform the final cleanup of all the
    dquots on releasing_dquots.
    
    Fixes: 4580b30ea887 ("quota: Do not dirty bad dquots")
    Suggested-by: Jan Kara <[email protected]>
    Signed-off-by: Baokun Li <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

quota: rename dquot_active() to inode_quota_active() [+ + +]
Author: Baokun Li <[email protected]>
Date:   Fri Jun 30 19:08:19 2023 +0800

    quota: rename dquot_active() to inode_quota_active()
    
    [ Upstream commit 4b9bdfa16535de8f49bf954aeed0f525ee2fc322 ]
    
    Now we have a helper function dquot_dirty() to determine if dquot has
    DQ_MOD_B bit. dquot_active() can easily be misunderstood as a helper
    function to determine if dquot has DQ_ACTIVE_B bit. So we avoid this by
    renaming it to inode_quota_active() and later on we will add the helper
    function dquot_active() to determine if dquot has DQ_ACTIVE_B bit.
    
    Signed-off-by: Baokun Li <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
    Signed-off-by: Sasha Levin <[email protected]>

 
regmap: rbtree: Use alloc_flags for memory allocations [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Fri Jul 21 17:55:33 2023 +0300

    regmap: rbtree: Use alloc_flags for memory allocations
    
    [ Upstream commit 0c8b0bf42c8cef56f7cd9cd876fbb7ece9217064 ]
    
    The kunit tests discovered a sleeping in atomic bug.  The allocations
    in the regcache-rbtree code should use the map->alloc_flags instead of
    GFP_KERNEL.
    
    [    5.005510] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
    [    5.005960] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 117, name: kunit_try_catch
    [    5.006219] preempt_count: 1, expected: 0
    [    5.006414] 1 lock held by kunit_try_catch/117:
    [    5.006590]  #0: 833b9010 (regmap_kunit:86:(config)->lock){....}-{2:2}, at: regmap_lock_spinlock+0x14/0x1c
    [    5.007493] irq event stamp: 162
    [    5.007627] hardirqs last  enabled at (161): [<80786738>] crng_make_state+0x1a0/0x294
    [    5.007871] hardirqs last disabled at (162): [<80c531ec>] _raw_spin_lock_irqsave+0x7c/0x80
    [    5.008119] softirqs last  enabled at (0): [<801110ac>] copy_process+0x810/0x2138
    [    5.008356] softirqs last disabled at (0): [<00000000>] 0x0
    [    5.008688] CPU: 0 PID: 117 Comm: kunit_try_catch Tainted: G                 N 6.4.4-rc3-g0e8d2fdfb188 #1
    [    5.009011] Hardware name: Generic DT based system
    [    5.009277]  unwind_backtrace from show_stack+0x18/0x1c
    [    5.009497]  show_stack from dump_stack_lvl+0x38/0x5c
    [    5.009676]  dump_stack_lvl from __might_resched+0x188/0x2d0
    [    5.009860]  __might_resched from __kmem_cache_alloc_node+0x1dc/0x25c
    [    5.010061]  __kmem_cache_alloc_node from kmalloc_trace+0x30/0xc8
    [    5.010254]  kmalloc_trace from regcache_rbtree_write+0x26c/0x468
    [    5.010446]  regcache_rbtree_write from _regmap_write+0x88/0x140
    [    5.010634]  _regmap_write from regmap_write+0x44/0x68
    [    5.010803]  regmap_write from basic_read_write+0x8c/0x270
    [    5.010980]  basic_read_write from kunit_try_run_case+0x48/0xa0
    
    Fixes: 28644c809f44 ("regmap: Add the rbtree cache support")
    Reported-by: Guenter Roeck <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Dan Carpenter <[email protected]>
    Tested-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
reiserfs: Check the return value from __getblk() [+ + +]
Author: Matthew Wilcox <[email protected]>
Date:   Sun Jun 4 12:16:06 2023 +0100

    reiserfs: Check the return value from __getblk()
    
    [ Upstream commit ba38980add7ffc9e674ada5b4ded4e7d14e76581 ]
    
    __getblk() can return a NULL pointer if we run out of memory or if we
    try to access beyond the end of the device; check it and handle it
    appropriately.
    
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Link: https://lore.kernel.org/lkml/CAFcO6XOacq3hscbXevPQP7sXRoYFz34ZdKPYjmd6k5sZuhGFDw@mail.gmail.com/
    Tested-by: butt3rflyh4ck <[email protected]>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") # probably introduced in 2002
    Acked-by: Edward Shishkin <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "IB/isert: Fix incorrect release of isert connection" [+ + +]
Author: Leon Romanovsky <[email protected]>
Date:   Mon Aug 21 10:57:14 2023 +0300

    Revert "IB/isert: Fix incorrect release of isert connection"
    
    [ Upstream commit dfe261107c080709459c32695847eec96238852b ]
    
    Commit: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection") is
    causing problems on OPA when DEVICE_REMOVAL is happening.
    
     ------------[ cut here ]------------
     WARNING: CPU: 52 PID: 2117247 at drivers/infiniband/core/cq.c:359
    ib_cq_pool_cleanup+0xac/0xb0 [ib_core]
     Modules linked in: nfsd nfs_acl target_core_user uio tcm_fc libfc
    scsi_transport_fc tcm_loop target_core_pscsi target_core_iblock target_core_file
    rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs
    rfkill rpcrdma rdma_ucm ib_srpt sunrpc ib_isert iscsi_target_mod target_core_mod
    opa_vnic ib_iser libiscsi ib_umad scsi_transport_iscsi rdma_cm ib_ipoib iw_cm
    ib_cm hfi1(-) rdmavt ib_uverbs intel_rapl_msr intel_rapl_common sb_edac ib_core
    x86_pkg_temp_thermal intel_powerclamp coretemp i2c_i801 mxm_wmi rapl iTCO_wdt
    ipmi_si iTCO_vendor_support mei_me ipmi_devintf mei intel_cstate ioatdma
    intel_uncore i2c_smbus joydev pcspkr lpc_ich ipmi_msghandler acpi_power_meter
    acpi_pad xfs libcrc32c sr_mod sd_mod cdrom t10_pi sg crct10dif_pclmul
    crc32_pclmul crc32c_intel drm_kms_helper drm_shmem_helper ahci libahci
    ghash_clmulni_intel igb drm libata dca i2c_algo_bit wmi fuse
     CPU: 52 PID: 2117247 Comm: modprobe Not tainted 6.5.0-rc1+ #1
     Hardware name: Intel Corporation S2600CWR/S2600CW, BIOS
    SE5C610.86B.01.01.0014.121820151719 12/18/2015
     RIP: 0010:ib_cq_pool_cleanup+0xac/0xb0 [ib_core]
     Code: ff 48 8b 43 40 48 8d 7b 40 48 83 e8 40 4c 39 e7 75 b3 49 83
    c4 10 4d 39 fc 75 94 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b eb a1
    90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f
     RSP: 0018:ffffc10bea13fc80 EFLAGS: 00010206
     RAX: 000000000000010c RBX: ffff9bf5c7e66c00 RCX: 000000008020001d
     RDX: 000000008020001e RSI: fffff175221f9900 RDI: ffff9bf5c7e67640
     RBP: ffff9bf5c7e67600 R08: ffff9bf5c7e64400 R09: 000000008020001d
     R10: 0000000040000000 R11: 0000000000000000 R12: ffff9bee4b1e8a18
     R13: dead000000000122 R14: dead000000000100 R15: ffff9bee4b1e8a38
     FS:  00007ff1e6d38740(0000) GS:ffff9bfd9fb00000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 00005652044ecc68 CR3: 0000000889b5c005 CR4: 00000000001706e0
     Call Trace:
      <TASK>
      ? __warn+0x80/0x130
      ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core]
      ? report_bug+0x195/0x1a0
      ? handle_bug+0x3c/0x70
      ? exc_invalid_op+0x14/0x70
      ? asm_exc_invalid_op+0x16/0x20
      ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core]
      disable_device+0x9d/0x160 [ib_core]
      __ib_unregister_device+0x42/0xb0 [ib_core]
      ib_unregister_device+0x22/0x30 [ib_core]
      rvt_unregister_device+0x20/0x90 [rdmavt]
      hfi1_unregister_ib_device+0x16/0xf0 [hfi1]
      remove_one+0x55/0x1a0 [hfi1]
      pci_device_remove+0x36/0xa0
      device_release_driver_internal+0x193/0x200
      driver_detach+0x44/0x90
      bus_remove_driver+0x69/0xf0
      pci_unregister_driver+0x2a/0xb0
      hfi1_mod_cleanup+0xc/0x3c [hfi1]
      __do_sys_delete_module.constprop.0+0x17a/0x2f0
      ? exit_to_user_mode_prepare+0xc4/0xd0
      ? syscall_trace_enter.constprop.0+0x126/0x1a0
      do_syscall_64+0x5c/0x90
      ? syscall_exit_to_user_mode+0x12/0x30
      ? do_syscall_64+0x69/0x90
      ? syscall_exit_work+0x103/0x130
      ? syscall_exit_to_user_mode+0x12/0x30
      ? do_syscall_64+0x69/0x90
      ? exc_page_fault+0x65/0x150
      entry_SYSCALL_64_after_hwframe+0x6e/0xd8
     RIP: 0033:0x7ff1e643f5ab
     Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48 83 c8 ff c3
    66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0
    ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89 01 48
     RSP: 002b:00007ffec9103cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
     RAX: ffffffffffffffda RBX: 00005615267fdc50 RCX: 00007ff1e643f5ab
     RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005615267fdcb8
     RBP: 00005615267fdc50 R08: 0000000000000000 R09: 0000000000000000
     R10: 00007ff1e659eac0 R11: 0000000000000206 R12: 00005615267fdcb8
     R13: 0000000000000000 R14: 00005615267fdcb8 R15: 00007ffec9105ff8
      </TASK>
     ---[ end trace 0000000000000000 ]---
    
    And...
    
     restrack: ------------[ cut here ]------------
     infiniband hfi1_0: BUG: RESTRACK detected leak of resources
     restrack: Kernel PD object allocated by ib_isert is not freed
     restrack: Kernel CQ object allocated by ib_core is not freed
     restrack: Kernel QP object allocated by rdma_cm is not freed
     restrack: ------------[ cut here ]------------
    
    Fixes: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection")
    Reported-by: Dennis Dalessandro <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]
    Link: https://lore.kernel.org/r/a27982d3235005c58f6d321f3fad5eb6e1beaf9e.1692604607.git.leonro@nvidia.com
    Tested-by: Dennis Dalessandro <[email protected]>
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "net: macsec: preserve ingress frame ordering" [+ + +]
Author: Sabrina Dubroca <[email protected]>
Date:   Mon Sep 4 10:56:04 2023 +0200

    Revert "net: macsec: preserve ingress frame ordering"
    
    commit d3287e4038ca4f81e02067ab72d087af7224c68b upstream.
    
    This reverts commit ab046a5d4be4c90a3952a0eae75617b49c0cb01b.
    
    It was trying to work around an issue at the crypto layer by excluding
    ASYNC implementations of gcm(aes), because a bug in the AESNI version
    caused reordering when some requests bypassed the cryptd queue while
    older requests were still pending on the queue.
    
    This was fixed by commit 38b2f68b4264 ("crypto: aesni - Fix cryptd
    reordering problem on gcm"), which pre-dates ab046a5d4be4.
    
    Herbert Xu confirmed that all ASYNC implementations are expected to
    maintain the ordering of completions wrt requests, so we can use them
    in MACsec.
    
    On my test machine, this restores the performance of a single netperf
    instance, from 1.4Gbps to 4.4Gbps.
    
    Link: https://lore.kernel.org/netdev/9328d206c5d9f9239cae27e62e74de40b258471d.1692279161.git.sd@queasysnail.net/T/
    Link: https://lore.kernel.org/netdev/[email protected]/
    Link: https://lore.kernel.org/netdev/[email protected]/
    Fixes: ab046a5d4be4 ("net: macsec: preserve ingress frame ordering")
    Signed-off-by: Sabrina Dubroca <[email protected]>
    Link: https://lore.kernel.org/r/11c952469d114db6fb29242e1d9545e61f52f512.1693757159.git.sd@queasysnail.net
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset" [+ + +]
Author: Bjorn Helgaas <[email protected]>
Date:   Fri Sep 8 14:55:30 2023 -0500

    Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset"
    
    commit 5260bd6d36c83c5b269c33baaaf8c78e520908b0 upstream.
    
    This reverts commit d5af729dc2071273f14cbb94abbc60608142fd83.
    
    d5af729dc207 ("PCI: Mark NVIDIA T4 GPUs to avoid bus reset") avoided
    Secondary Bus Reset on the T4 because the reset seemed to not work when the
    T4 was directly attached to a Root Port.
    
    But NVIDIA thinks the issue is probably related to some issue with the Root
    Port, not with the T4.  The T4 provides neither PM nor FLR reset, so
    masking bus reset compromises this device for assignment scenarios.
    
    Revert d5af729dc207 as requested by Wu Zongyong.  This will leave SBR
    broken in the specific configuration Wu tested, as it was in v6.5, so Wu
    will debug that further.
    
    Link: https://lore.kernel.org/r/ZPqMCDWvITlOLHgJ@wuzongyong-alibaba
    Link: https://lore.kernel.org/r/20230908201104.GA305023@bhelgaas
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
rpmsg: glink: Add check for kstrdup [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Mon Jun 19 11:06:31 2023 +0800

    rpmsg: glink: Add check for kstrdup
    
    [ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]
    
    Add check for the return value of kstrdup() and return the error
    if it fails in order to avoid NULL pointer dereference.
    
    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Tue Aug 1 19:35:43 2023 +0200

    rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff
    
    commit 95e7ebc6823170256a8ce19fad87912805bfa001 upstream.
    
    ds1685_rtc_poweroff is only used externally via symbol_get, which was
    only ever intended for very internal symbols like this one.  Use
    EXPORT_SYMBOL_GPL for it so that symbol_get can enforce only being used
    on EXPORT_SYMBOL_GPL symbols.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Acked-by: Joshua Kinard <[email protected]>
    Reviewed-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
s390/dasd: fix hanging device after request requeue [+ + +]
Author: Stefan Haberland <[email protected]>
Date:   Fri Jul 21 21:36:46 2023 +0200

    s390/dasd: fix hanging device after request requeue
    
    [ Upstream commit 8a2278ce9c25048d999fe1a3561def75d963f471 ]
    
    The DASD device driver has a function to requeue requests to the
    blocklayer.
    This function is used in various cases when basic settings for the device
    have to be changed like High Performance Ficon related parameters or copy
    pair settings.
    
    The functions iterates over the device->ccw_queue and also removes the
    requests from the block->ccw_queue.
    In case the device is started on an alias device instead of the base
    device it might be removed from the block->ccw_queue without having it
    canceled properly before. This might lead to a hanging device since the
    request is no longer on a queue and can not be handled properly.
    
    Fix by iterating over the block->ccw_queue instead of the
    device->ccw_queue. This will take care of all blocklayer related requests
    and handle them on all associated DASD devices.
    
    Signed-off-by: Stefan Haberland <[email protected]>
    Reviewed-by: Jan Hoeppner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

s390/dasd: use correct number of retries for ERP requests [+ + +]
Author: Stefan Haberland <[email protected]>
Date:   Fri Jul 21 21:36:45 2023 +0200

    s390/dasd: use correct number of retries for ERP requests
    
    [ Upstream commit acea28a6b74f458defda7417d2217b051ba7d444 ]
    
    If a DASD request fails an error recovery procedure (ERP) request might
    be built as a copy of the original request to do error recovery.
    
    The ERP request gets a number of retries assigned.
    This number is always 256 no matter what other value might have been set
    for the original request. This is not what is expected when a user
    specifies a certain amount of retries for the device via sysfs.
    
    Correctly use the number of retries of the original request for ERP
    requests.
    
    Signed-off-by: Stefan Haberland <[email protected]>
    Reviewed-by: Jan Hoeppner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sc16is7xx: Set iobase to device index [+ + +]
Author: Daniel Mack <[email protected]>
Date:   Tue Sep 1 14:03:29 2020 +0200

    sc16is7xx: Set iobase to device index
    
    [ Upstream commit 5da6b1c079e6804a81e63ab8337224cbd2148c91 ]
    
    Some derivates of sc16is7xx devices expose more than one tty device to
    userspace. If multiple such devices exist in a system, userspace
    currently has no clean way to infer which tty maps to which physical
    line.
    
    Set the .iobase value to the relative index within the device to allow
    infering the order through sysfs.
    
    Signed-off-by: Daniel Mack <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 2861ed4d6e6d ("serial: sc16is7xx: fix broken port 0 uart init")
    Signed-off-by: Sasha Levin <[email protected]>

 
scsi: be2iscsi: Add length check when parsing nlattrs [+ + +]
Author: Lin Ma <[email protected]>
Date:   Sun Jul 23 15:59:38 2023 +0800

    scsi: be2iscsi: Add length check when parsing nlattrs
    
    [ Upstream commit ee0268f230f66cb472df3424f380ea668da2749a ]
    
    beiscsi_iface_set_param() parses nlattr with nla_for_each_attr and assumes
    every attributes can be viewed as struct iscsi_iface_param_info.
    
    This is not true because there is no any nla_policy to validate the
    attributes passed from the upper function iscsi_set_iface_params().
    
    Add the nla_len check before accessing the nlattr data and return EINVAL if
    the length check fails.
    
    Fixes: 0e43895ec1f4 ("[SCSI] be2iscsi: adding functionality to change network settings using iscsiadm")
    Signed-off-by: Lin Ma <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Chris Leech <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: core: Use 32-bit hostnum in scsi_host_lookup() [+ + +]
Author: Tony Battersby <[email protected]>
Date:   Mon Aug 14 10:03:25 2023 -0400

    scsi: core: Use 32-bit hostnum in scsi_host_lookup()
    
    [ Upstream commit 62ec2092095b678ff89ce4ba51c2938cd1e8e630 ]
    
    Change scsi_host_lookup() hostnum argument type from unsigned short to
    unsigned int to match the type used everywhere else.
    
    Fixes: 6d49f63b415c ("[SCSI] Make host_no an unsigned int")
    Signed-off-by: Tony Battersby <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Bart Van Assche <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Thu Aug 17 07:47:08 2023 +0000

    scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
    
    [ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]
    
    There is a long call chain that &fip->ctlr_lock is acquired by isr
    fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context
    code acquiring the lock should disable IRQ, otherwise deadlock could happen
    if the IRQ preempts the execution while the lock is held in process context
    on the same CPU.
    
    [ISR]
    fnic_isr_msix_wq_copy()
     -> fnic_wq_copy_cmpl_handler()
     -> fnic_fcpio_cmpl_handler()
     -> fnic_fcpio_flogi_reg_cmpl_handler()
     -> fnic_flush_tx()
     -> fnic_send_frame()
     -> fcoe_ctlr_els_send()
     -> spin_lock_bh(&fip->ctlr_lock)
    
    [Process Context]
    1. fcoe_ctlr_timer_work()
     -> fcoe_ctlr_flogi_send()
     -> spin_lock_bh(&fip->ctlr_lock)
    
    2. fcoe_ctlr_recv_work()
     -> fcoe_ctlr_recv_handler()
     -> fcoe_ctlr_recv_els()
     -> fcoe_ctlr_announce()
     -> spin_lock_bh(&fip->ctlr_lock)
    
    3. fcoe_ctlr_recv_work()
     -> fcoe_ctlr_recv_handler()
     -> fcoe_ctlr_recv_els()
     -> fcoe_ctlr_flogi_retry()
     -> spin_lock_bh(&fip->ctlr_lock)
    
    4. -> fcoe_xmit()
     -> fcoe_ctlr_els_send()
     -> spin_lock_bh(&fip->ctlr_lock)
    
    spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a
    hardirq.
    
    These flaws were found by an experimental static analysis tool I am
    developing for irq-related deadlock.
    
    The patch fix the potential deadlocks by spin_lock_irqsave() to disable
    hard irq.
    
    Fixes: 794d98e77f59 ("[SCSI] libfcoe: retry rejected FLOGI to another FCF if possible")
    Signed-off-by: Chengfeng Ye <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Davidlohr Bueso <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param() [+ + +]
Author: Lin Ma <[email protected]>
Date:   Sun Jul 23 15:58:20 2023 +0800

    scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()
    
    [ Upstream commit ce51c817008450ef4188471db31639d42d37a5e1 ]
    
    The functions iscsi_if_set_param() and iscsi_if_set_host_param() convert an
    nlattr payload to type char* and then call C string handling functions like
    sscanf and kstrdup:
    
      char *data = (char*)ev + sizeof(*ev);
      ...
      sscanf(data, "%d", &value);
    
    However, since the nlattr is provided by the user-space program and the
    nlmsg skb is allocated with GFP_KERNEL instead of GFP_ZERO flag (see
    netlink_alloc_large_skb() in netlink_sendmsg()), dirty data on the heap can
    lead to an OOB access for those string handling functions.
    
    By investigating how the bug is introduced, we find it is really
    interesting as the old version parsing code starting from commit
    fd7255f51a13 ("[SCSI] iscsi: add sysfs attrs for uspace sync up") treated
    the nlattr as integer bytes instead of string and had length check in
    iscsi_copy_param():
    
      if (ev->u.set_param.len != sizeof(uint32_t))
        BUG();
    
    But, since the commit a54a52caad4b ("[SCSI] iscsi: fixup set/get param
    functions"), the code treated the nlattr as C string while forgetting to
    add any strlen checks(), opening the possibility of an OOB access.
    
    Fix the potential OOB by adding the strlen() check before accessing the
    buf. If the data passes this check, all low-level set_param handlers can
    safely treat this buf as legal C string.
    
    Fixes: fd7255f51a13 ("[SCSI] iscsi: add sysfs attrs for uspace sync up")
    Fixes: 1d9bf13a9cf9 ("[SCSI] iscsi class: add iscsi host set param event")
    Signed-off-by: Lin Ma <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Chris Leech <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly [+ + +]
Author: Oleksandr Natalenko <[email protected]>
Date:   Mon Jul 31 10:40:34 2023 +0200

    scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly
    
    [ Upstream commit 25dbc20deab5165f847b4eb42f376f725a986ee8 ]
    
    The qedf_dbg_fp_int_cmd_read() function invokes sprintf() directly on a
    __user pointer, which may crash the kernel.
    
    Avoid doing that by vmalloc()'ating a buffer for scnprintf() and then
    calling simple_read_from_buffer() which does a proper copy_to_user() call.
    
    Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
    Link: https://lore.kernel.org/lkml/[email protected]/
    Link: https://lore.kernel.org/linux-scsi/[email protected]/
    Cc: Saurav Kashyap <[email protected]>
    Cc: Rob Evers <[email protected]>
    Cc: Johannes Thumshirn <[email protected]>
    Cc: David Laight <[email protected]>
    Cc: Jozef Bacik <[email protected]>
    Cc: Laurence Oberman <[email protected]>
    Cc: "James E.J. Bottomley" <[email protected]>
    Cc: "Martin K. Petersen" <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Laurence Oberman <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Laurence Oberman <[email protected]>
    Acked-by: Saurav Kashyap <[email protected]>
    Signed-off-by: Oleksandr Natalenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly [+ + +]
Author: Oleksandr Natalenko <[email protected]>
Date:   Mon Jul 31 10:40:32 2023 +0200

    scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly
    
    [ Upstream commit 7d3d20dee4f648ec44e9717d5f647d594d184433 ]
    
    The qedf_dbg_stop_io_on_error_cmd_read() function invokes sprintf()
    directly on a __user pointer, which may crash the kernel.
    
    Avoid doing that by using a small on-stack buffer for scnprintf() and then
    calling simple_read_from_buffer() which does a proper copy_to_user() call.
    
    Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
    Link: https://lore.kernel.org/lkml/[email protected]/
    Link: https://lore.kernel.org/linux-scsi/[email protected]/
    Cc: Saurav Kashyap <[email protected]>
    Cc: Rob Evers <[email protected]>
    Cc: Johannes Thumshirn <[email protected]>
    Cc: David Laight <[email protected]>
    Cc: Jozef Bacik <[email protected]>
    Cc: Laurence Oberman <[email protected]>
    Cc: "James E.J. Bottomley" <[email protected]>
    Cc: "Martin K. Petersen" <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Laurence Oberman <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Laurence Oberman <[email protected]>
    Acked-by: Saurav Kashyap <[email protected]>
    Signed-off-by: Oleksandr Natalenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Wed Jul 26 12:56:55 2023 +0000

    scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock
    
    [ Upstream commit dd64f80587190265ca8a0f4be6c64c2fda6d3ac2 ]
    
    As &qedi_percpu->p_work_lock is acquired by hard IRQ qedi_msix_handler(),
    other acquisitions of the same lock under process context should disable
    IRQ, otherwise deadlock could happen if the IRQ preempts the execution
    while the lock is held in process context on the same CPU.
    
    qedi_cpu_offline() is one such function which acquires the lock in process
    context.
    
    [Deadlock Scenario]
    qedi_cpu_offline()
        ->spin_lock(&p->p_work_lock)
            <irq>
            ->qedi_msix_handler()
            ->edi_process_completions()
            ->spin_lock_irqsave(&p->p_work_lock, flags); (deadlock here)
    
    This flaw was found by an experimental static analysis tool I am developing
    for IRQ-related deadlocks.
    
    The tentative patch fix the potential deadlock by spin_lock_irqsave()
    under process context.
    
    Signed-off-by: Chengfeng Ye <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Acked-by: Manish Rangankar <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qla2xxx: fix inconsistent TMF timeout [+ + +]
Author: Quinn Tran <[email protected]>
Date:   Fri Jul 14 12:31:03 2023 +0530

    scsi: qla2xxx: fix inconsistent TMF timeout
    
    commit 009e7fe4a1ed52276b332842a6b6e23b07200f2d upstream.
    
    Different behavior were experienced of session being torn down vs not when
    TMF is timed out. When FW detects the time out, the session is torn down.
    When driver detects the time out, the session is not torn down.
    
    Allow TMF error to return to upper layer without session tear down.
    
    Cc: [email protected]
    Signed-off-by: Quinn Tran <[email protected]>
    Signed-off-by: Nilesh Javali <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Himanshu Madhani <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: qla2xxx: Turn off noisy message log [+ + +]
Author: Quinn Tran <[email protected]>
Date:   Fri Jul 14 12:31:01 2023 +0530

    scsi: qla2xxx: Turn off noisy message log
    
    commit 8ebaa45163a3fedc885c1dc7d43ea987a2f00a06 upstream.
    
    Some consider noisy log as test failure.  Turn off noisy message log.
    
    Cc: [email protected]
    Signed-off-by: Quinn Tran <[email protected]>
    Signed-off-by: Nilesh Javali <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Himanshu Madhani <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: qla4xxx: Add length check when parsing nlattrs [+ + +]
Author: Lin Ma <[email protected]>
Date:   Sun Jul 23 16:00:53 2023 +0800

    scsi: qla4xxx: Add length check when parsing nlattrs
    
    [ Upstream commit 47cd3770e31df942e2bb925a9a855c79ed0662eb ]
    
    There are three places that qla4xxx parses nlattrs:
    
     - qla4xxx_set_chap_entry()
    
     - qla4xxx_iface_set_param()
    
     - qla4xxx_sysfs_ddb_set_param()
    
    and each of them directly converts the nlattr to specific pointer of
    structure without length checking. This could be dangerous as those
    attributes are not validated and a malformed nlattr (e.g., length 0) could
    result in an OOB read that leaks heap dirty data.
    
    Add the nla_len check before accessing the nlattr data and return EINVAL if
    the length check fails.
    
    Fixes: 26ffd7b45fe9 ("[SCSI] qla4xxx: Add support to set CHAP entries")
    Fixes: 1e9e2be3ee03 ("[SCSI] qla4xxx: Add flash node mgmt support")
    Fixes: 00c31889f751 ("[SCSI] qla4xxx: fix data alignment and use nl helpers")
    Signed-off-by: Lin Ma <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Chris Leech <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: target: iscsi: Fix buffer overflow in lio_target_nacl_info_show() [+ + +]
Author: Konstantin Shelekhin <[email protected]>
Date:   Sat Jul 22 18:26:37 2023 +0300

    scsi: target: iscsi: Fix buffer overflow in lio_target_nacl_info_show()
    
    [ Upstream commit 801f287c93ff95582b0a2d2163f12870a2f076d4 ]
    
    The function lio_target_nacl_info_show() uses sprintf() in a loop to print
    details for every iSCSI connection in a session without checking for the
    buffer length. With enough iSCSI connections it's possible to overflow the
    buffer provided by configfs and corrupt the memory.
    
    This patch replaces sprintf() with sysfs_emit_at() that checks for buffer
    boundries.
    
    Signed-off-by: Konstantin Shelekhin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sctp: handle invalid error codes without calling BUG() [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Fri Jun 9 14:04:43 2023 +0300

    sctp: handle invalid error codes without calling BUG()
    
    [ Upstream commit a0067dfcd9418fd3b0632bc59210d120d038a9c6 ]
    
    The sctp_sf_eat_auth() function is supposed to return enum sctp_disposition
    values but if the call to sctp_ulpevent_make_authkey() fails, it returns
    -ENOMEM.
    
    This results in calling BUG() inside the sctp_side_effects() function.
    Calling BUG() is an over reaction and not helpful.  Call WARN_ON_ONCE()
    instead.
    
    This code predates git.
    
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
security: keys: perform capable check only on privileged operations [+ + +]
Author: Christian Göttsche <[email protected]>
Date:   Thu May 11 14:32:52 2023 +0200

    security: keys: perform capable check only on privileged operations
    
    [ Upstream commit 2d7f105edbb3b2be5ffa4d833abbf9b6965e9ce7 ]
    
    If the current task fails the check for the queried capability via
    `capable(CAP_SYS_ADMIN)` LSMs like SELinux generate a denial message.
    Issuing such denial messages unnecessarily can lead to a policy author
    granting more privileges to a subject than needed to silence them.
    
    Reorder CAP_SYS_ADMIN checks after the check whether the operation is
    actually privileged.
    
    Signed-off-by: Christian Göttsche <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
serial: cpm_uart: Avoid suspicious locking [+ + +]
Author: Christophe Leroy <[email protected]>
Date:   Thu Aug 3 15:56:42 2023 +0200

    serial: cpm_uart: Avoid suspicious locking
    
    [ Upstream commit 36ef11d311f405e55ad8e848c19b212ff71ef536 ]
    
      CHECK   drivers/tty/serial/cpm_uart/cpm_uart_core.c
    drivers/tty/serial/cpm_uart/cpm_uart_core.c:1271:39: warning: context imbalance in 'cpm_uart_console_write' - unexpected unlock
    
    Allthough 'nolock' is not expected to change, sparse find the following
    form suspicious:
    
            if (unlikely(nolock)) {
                    local_irq_save(flags);
            } else {
                    spin_lock_irqsave(&pinfo->port.lock, flags);
            }
    
            cpm_uart_early_write(pinfo, s, count, true);
    
            if (unlikely(nolock)) {
                    local_irq_restore(flags);
            } else {
                    spin_unlock_irqrestore(&pinfo->port.lock, flags);
            }
    
    Rewrite it a more obvious form:
    
            if (unlikely(oops_in_progress)) {
                    local_irq_save(flags);
                    cpm_uart_early_write(pinfo, s, count, true);
                    local_irq_restore(flags);
            } else {
                    spin_lock_irqsave(&pinfo->port.lock, flags);
                    cpm_uart_early_write(pinfo, s, count, true);
                    spin_unlock_irqrestore(&pinfo->port.lock, flags);
            }
    
    Signed-off-by: Christophe Leroy <[email protected]>
    Link: https://lore.kernel.org/r/f7da5cdc9287960185829cfef681a7d8614efa1f.1691068700.git.christophe.leroy@csgroup.eu
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

serial: sc16is7xx: fix broken port 0 uart init [+ + +]
Author: Hugo Villeneuve <[email protected]>
Date:   Mon Aug 7 17:45:51 2023 -0400

    serial: sc16is7xx: fix broken port 0 uart init
    
    [ Upstream commit 2861ed4d6e6d1a2c9de9bf5b0abd996c2dc673d0 ]
    
    The sc16is7xx_config_rs485() function is called only for the second
    port (index 1, channel B), causing initialization problems for the
    first port.
    
    For the sc16is7xx driver, port->membase and port->mapbase are not set,
    and their default values are 0. And we set port->iobase to the device
    index. This means that when the first device is registered using the
    uart_add_one_port() function, the following values will be in the port
    structure:
        port->membase = 0
        port->mapbase = 0
        port->iobase  = 0
    
    Therefore, the function uart_configure_port() in serial_core.c will
    exit early because of the following check:
            /*
             * If there isn't a port here, don't do anything further.
             */
            if (!port->iobase && !port->mapbase && !port->membase)
                    return;
    
    Typically, I2C and SPI drivers do not set port->membase and
    port->mapbase.
    
    The max310x driver sets port->membase to ~0 (all ones). By
    implementing the same change in this driver, uart_configure_port() is
    now correctly executed for all ports.
    
    Fixes: dfeae619d781 ("serial: sc16is7xx")
    Cc: [email protected]
    Signed-off-by: Hugo Villeneuve <[email protected]>
    Reviewed-by: Ilpo Järvinen <[email protected]>
    Reviewed-by: Lech Perczak <[email protected]>
    Tested-by: Lech Perczak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

serial: sc16is7xx: fix bug when first setting GPIO direction [+ + +]
Author: Hugo Villeneuve <[email protected]>
Date:   Mon Aug 7 17:45:55 2023 -0400

    serial: sc16is7xx: fix bug when first setting GPIO direction
    
    commit 9baeea723c0fb9c3ba9a336369f758ed9bc6831d upstream.
    
    When configuring a pin as an output pin with a value of logic 0, we
    end up as having a value of logic 1 on the output pin. Setting a
    logic 0 a second time (or more) after that will correctly output a
    logic 0 on the output pin.
    
    By default, all GPIO pins are configured as inputs. When we enter
    sc16is7xx_gpio_direction_output() for the first time, we first set the
    desired value in IOSTATE, and then we configure the pin as an output.
    The datasheet states that writing to IOSTATE register will trigger a
    transfer of the value to the I/O pin configured as output, so if the
    pin is configured as an input, nothing will be transferred.
    
    Therefore, set the direction first in IODIR, and then set the desired
    value in IOSTATE.
    
    This is what is done in NXP application note AN10587.
    
    Fixes: dfeae619d781 ("serial: sc16is7xx")
    Cc: [email protected]
    Signed-off-by: Hugo Villeneuve <[email protected]>
    Reviewed-by: Lech Perczak <[email protected]>
    Tested-by: Lech Perczak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: tegra: handle clk prepare error in tegra_uart_hw_init() [+ + +]
Author: Yi Yang <[email protected]>
Date:   Thu Aug 17 18:54:06 2023 +0800

    serial: tegra: handle clk prepare error in tegra_uart_hw_init()
    
    [ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]
    
    In tegra_uart_hw_init(), the return value of clk_prepare_enable() should
    be checked since it might fail.
    
    Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
    Signed-off-by: Yi Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
skbuff: skb_segment, Call zero copy functions before using skbuff frags [+ + +]
Author: Mohamed Khalfella <[email protected]>
Date:   Thu Aug 31 02:17:02 2023 -0600

    skbuff: skb_segment, Call zero copy functions before using skbuff frags
    
    commit 2ea35288c83b3d501a88bc17f2df8f176b5cc96f upstream.
    
    Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions
    once per nskb") added the call to zero copy functions in skb_segment().
    The change introduced a bug in skb_segment() because skb_orphan_frags()
    may possibly change the number of fragments or allocate new fragments
    altogether leaving nrfrags and frag to point to the old values. This can
    cause a panic with stacktrace like the one below.
    
    [  193.894380] BUG: kernel NULL pointer dereference, address: 00000000000000bc
    [  193.895273] CPU: 13 PID: 18164 Comm: vh-net-17428 Kdump: loaded Tainted: G           O      5.15.123+ #26
    [  193.903919] RIP: 0010:skb_segment+0xb0e/0x12f0
    [  194.021892] Call Trace:
    [  194.027422]  <TASK>
    [  194.072861]  tcp_gso_segment+0x107/0x540
    [  194.082031]  inet_gso_segment+0x15c/0x3d0
    [  194.090783]  skb_mac_gso_segment+0x9f/0x110
    [  194.095016]  __skb_gso_segment+0xc1/0x190
    [  194.103131]  netem_enqueue+0x290/0xb10 [sch_netem]
    [  194.107071]  dev_qdisc_enqueue+0x16/0x70
    [  194.110884]  __dev_queue_xmit+0x63b/0xb30
    [  194.121670]  bond_start_xmit+0x159/0x380 [bonding]
    [  194.128506]  dev_hard_start_xmit+0xc3/0x1e0
    [  194.131787]  __dev_queue_xmit+0x8a0/0xb30
    [  194.138225]  macvlan_start_xmit+0x4f/0x100 [macvlan]
    [  194.141477]  dev_hard_start_xmit+0xc3/0x1e0
    [  194.144622]  sch_direct_xmit+0xe3/0x280
    [  194.147748]  __dev_queue_xmit+0x54a/0xb30
    [  194.154131]  tap_get_user+0x2a8/0x9c0 [tap]
    [  194.157358]  tap_sendmsg+0x52/0x8e0 [tap]
    [  194.167049]  handle_tx_zerocopy+0x14e/0x4c0 [vhost_net]
    [  194.173631]  handle_tx+0xcd/0xe0 [vhost_net]
    [  194.176959]  vhost_worker+0x76/0xb0 [vhost]
    [  194.183667]  kthread+0x118/0x140
    [  194.190358]  ret_from_fork+0x1f/0x30
    [  194.193670]  </TASK>
    
    In this case calling skb_orphan_frags() updated nr_frags leaving nrfrags
    local variable in skb_segment() stale. This resulted in the code hitting
    i >= nrfrags prematurely and trying to move to next frag_skb using
    list_skb pointer, which was NULL, and caused kernel panic. Move the call
    to zero copy functions before using frags and nr_frags.
    
    Fixes: bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb")
    Signed-off-by: Mohamed Khalfella <[email protected]>
    Reported-by: Amit Goyal <[email protected]>
    Cc: [email protected]
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smackfs: Prevent underflow in smk_set_cipso() [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Thu Jul 6 08:52:39 2023 +0300

    smackfs: Prevent underflow in smk_set_cipso()
    
    [ Upstream commit 3ad49d37cf5759c3b8b68d02e3563f633d9c1aee ]
    
    There is a upper bound to "catlen" but no lower bound to prevent
    negatives.  I don't see that this necessarily causes a problem but we
    may as well be safe.
    
    Fixes: e114e473771c ("Smack: Simplified Mandatory Access Control Kernel")
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Casey Schaufler <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
soc: qcom: qmi_encdec: Restrict string length in decode [+ + +]
Author: Chris Lew <[email protected]>
Date:   Tue Aug 1 12:17:12 2023 +0530

    soc: qcom: qmi_encdec: Restrict string length in decode
    
    commit 8d207400fd6b79c92aeb2f33bb79f62dff904ea2 upstream.
    
    The QMI TLV value for strings in a lot of qmi element info structures
    account for null terminated strings with MAX_LEN + 1. If a string is
    actually MAX_LEN + 1 length, this will cause an out of bounds access
    when the NULL character is appended in decoding.
    
    Fixes: 9b8a11e82615 ("soc: qcom: Introduce QMI encoder/decoder")
    Cc: [email protected]
    Signed-off-by: Chris Lew <[email protected]>
    Signed-off-by: Praveenkumar I <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Sat Jul 22 23:49:09 2023 +0800

    spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe()
    
    [ Upstream commit 29a449e765ff70a5bd533be94babb6d36985d096 ]
    
    The platform_get_irq might be failed and return a negative result. So
    there should have an error handling code.
    
    Fixed this by adding an error handling code.
    
    Fixes: 8528547bcc33 ("spi: tegra: add spi driver for sflash controller")
    Signed-off-by: Zhang Shurong <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tcp: tcp_enter_quickack_mode() should be static [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue Jul 18 16:20:49 2023 +0000

    tcp: tcp_enter_quickack_mode() should be static
    
    [ Upstream commit 03b123debcbc8db987bda17ed8412cc011064c22 ]
    
    After commit d2ccd7bc8acd ("tcp: avoid resetting ACK timer in DCTCP"),
    tcp_enter_quickack_mode() is only used from net/ipv4/tcp_input.c.
    
    Fixes: d2ccd7bc8acd ("tcp: avoid resetting ACK timer in DCTCP")
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Yuchung Cheng <[email protected]>
    Cc: Neal Cardwell <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tpm_tis: Resend command to recover from data transfer errors [+ + +]
Author: Alexander Steffen <[email protected]>
Date:   Tue Jun 13 20:02:59 2023 +0200

    tpm_tis: Resend command to recover from data transfer errors
    
    [ Upstream commit 280db21e153d8810ce3b93640c63ae922bcb9e8e ]
    
    Similar to the transmission of TPM responses, also the transmission of TPM
    commands may become corrupted. Instead of aborting when detecting such
    issues, try resending the command again.
    
    Signed-off-by: Alexander Steffen <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udf: Check consistency of Space Bitmap Descriptor [+ + +]
Author: Vladislav Efanov <[email protected]>
Date:   Thu Feb 2 17:04:56 2023 +0300

    udf: Check consistency of Space Bitmap Descriptor
    
    commit 1e0d4adf17e7ef03281d7b16555e7c1508c8ed2d upstream.
    
    Bits, which are related to Bitmap Descriptor logical blocks,
    are not reset when buffer headers are allocated for them. As the
    result, these logical blocks can be treated as free and
    be used for other blocks.This can cause usage of one buffer header
    for several types of data. UDF issues WARNING in this situation:
    
    WARNING: CPU: 0 PID: 2703 at fs/udf/inode.c:2014
      __udf_add_aext+0x685/0x7d0 fs/udf/inode.c:2014
    
    RIP: 0010:__udf_add_aext+0x685/0x7d0 fs/udf/inode.c:2014
    Call Trace:
     udf_setup_indirect_aext+0x573/0x880 fs/udf/inode.c:1980
     udf_add_aext+0x208/0x2e0 fs/udf/inode.c:2067
     udf_insert_aext fs/udf/inode.c:2233 [inline]
     udf_update_extents fs/udf/inode.c:1181 [inline]
     inode_getblk+0x1981/0x3b70 fs/udf/inode.c:885
    
    Found by Linux Verification Center (linuxtesting.org) with syzkaller.
    
    [JK: Somewhat cleaned up the boundary checks]
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Vladislav Efanov <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

udf: Handle error when adding extent to a file [+ + +]
Author: Jan Kara <[email protected]>
Date:   Mon Dec 19 20:10:35 2022 +0100

    udf: Handle error when adding extent to a file
    
    commit 19fd80de0a8b5170ef34704c8984cca920dffa59 upstream.
    
    When adding extent to a file fails, so far we've silently squelshed the
    error. Make sure to propagate it up properly.
    
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

udf: initialize newblock to 0 [+ + +]
Author: Tom Rix <[email protected]>
Date:   Fri Dec 30 12:53:41 2022 -0500

    udf: initialize newblock to 0
    
    commit 23970a1c9475b305770fd37bebfec7a10f263787 upstream.
    
    The clang build reports this error
    fs/udf/inode.c:805:6: error: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
            if (*err < 0)
                ^~~~~~~~
    newblock is never set before error handling jump.
    Initialize newblock to 0 and remove redundant settings.
    
    Fixes: d8b39db5fab8 ("udf: Handle error when adding extent to a file")
    Reported-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Tom Rix <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
um: Fix hostaudio build errors [+ + +]
Author: Randy Dunlap <[email protected]>
Date:   Tue Aug 1 22:15:00 2023 -0700

    um: Fix hostaudio build errors
    
    [ Upstream commit db4bfcba7bb8d10f00bba2a3da6b9a9c2a1d7b71 ]
    
    Use "select" to ensure that the required kconfig symbols are set
    as expected.
    Drop HOSTAUDIO since it is now equivalent to UML_SOUND.
    
    Set CONFIG_SOUND=m in ARCH=um defconfig files to maintain the
    status quo of the default configs.
    
    Allow SOUND with UML regardless of HAS_IOMEM. Otherwise there is a
    kconfig warning for unmet dependencies. (This was not an issue when
    SOUND was defined in arch/um/drivers/Kconfig. I have done 50 randconfig
    builds and didn't find any issues.)
    
    This fixes build errors when CONFIG_SOUND is not set:
    
    ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_cleanup_module':
    hostaudio_kern.c:(.exit.text+0xa): undefined reference to `unregister_sound_mixer'
    ld: hostaudio_kern.c:(.exit.text+0x15): undefined reference to `unregister_sound_dsp'
    ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_init_module':
    hostaudio_kern.c:(.init.text+0x19): undefined reference to `register_sound_dsp'
    ld: hostaudio_kern.c:(.init.text+0x31): undefined reference to `register_sound_mixer'
    ld: hostaudio_kern.c:(.init.text+0x49): undefined reference to `unregister_sound_dsp'
    
    and this kconfig warning:
    WARNING: unmet direct dependencies detected for SOUND
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Fixes: d886e87cb82b ("sound: make OSS sound core optional")
    Signed-off-by: Randy Dunlap <[email protected]>
    Reported-by: kernel test robot <[email protected]>
    Closes: lore.kernel.org/r/[email protected]
    Cc: Richard Weinberger <[email protected]>
    Cc: Anton Ivanov <[email protected]>
    Cc: Johannes Berg <[email protected]>
    Cc: [email protected]
    Cc: Tejun Heo <[email protected]>
    Cc: Takashi Iwai <[email protected]>
    Cc: Jaroslav Kysela <[email protected]>
    Cc: Masahiro Yamada <[email protected]>
    Cc: Nathan Chancellor <[email protected]>
    Cc: Nick Desaulniers <[email protected]>
    Cc: Nicolas Schier <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
USB: gadget: f_mass_storage: Fix unused variable warning [+ + +]
Author: Alan Stern <[email protected]>
Date:   Fri Aug 11 13:47:04 2023 -0400

    USB: gadget: f_mass_storage: Fix unused variable warning
    
    [ Upstream commit 55c3e571d2a0aabef4f1354604443f1c415d2e85 ]
    
    Fix a "variable set but not used" warning in f_mass_storage.c.  rc is
    used if verbose debugging is enabled but not otherwise.
    
    Signed-off-by: Alan Stern <[email protected]>
    Fixes: d5e2b67aae79 ("USB: g_mass_storage: template f_mass_storage.c file created")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc [+ + +]
Author: Ma Ke <[email protected]>
Date:   Wed Jun 28 16:15:11 2023 +0800

    usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc
    
    [ Upstream commit ce9daa2efc0872a9a68ea51dc8000df05893ef2e ]
    
    We should verify the bound of the array to assure that host
    may not manipulate the index to point past endpoint array.
    
    Signed-off-by: Ma Ke <[email protected]>
    Acked-by: Li Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() [+ + +]
Author: Xu Yang <[email protected]>
Date:   Tue Jun 27 19:03:52 2023 +0800

    usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()
    
    [ Upstream commit 5eda42aebb7668b4dcff025cd3ccb0d3d7c53da6 ]
    
    The function mxs_phy_is_otg_host() will return true if OTG_ID_VALUE is
    0 at USBPHY_CTRL register. However, OTG_ID_VALUE will not reflect the real
    state if the ID pin is float, such as Host-only or Type-C cases. The value
    of OTG_ID_VALUE is always 1 which means device mode.
    This patch will fix the issue by judging the current mode based on
    last_event. The controller will update last_event in time.
    
    Fixes: 7b09e67639d6 ("usb: phy: mxs: refine mxs_phy_disconnect_line")
    Signed-off-by: Xu Yang <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
USB: serial: option: add FOXCONN T99W368/T99W373 product [+ + +]
Author: Slark Xiao <[email protected]>
Date:   Wed Aug 23 15:57:51 2023 +0800

    USB: serial: option: add FOXCONN T99W368/T99W373 product
    
    commit 4d9488b294e1f8353bbcadc4c7172a7f7490199b upstream.
    
    The difference of T99W368 and T99W373 is the chip solution.
    T99W368 is designed based on Qualcomm SDX65 and T99W373 is SDX62.
    
    Test evidence as below:
    T:  Bus=01 Lev=02 Prnt=05 Port=00 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e0f0 Rev=05.04
    S:  Manufacturer=FII
    S:  Product=OLYMPIC USB WWAN Adapter
    S:  SerialNumber=78ada8c4
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    
    T:  Bus=01 Lev=02 Prnt=05 Port=00 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e0ee Rev=05.04
    S:  Manufacturer=FII
    S:  Product=OLYMPIC USB WWAN Adapter
    S:  SerialNumber=78ada8d5
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    
    Both of them share the same port configuration:
    0&1: MBIM, 2: Modem, 3:GNSS, 4:NMEA, 5:Diag
    GNSS port don't use serial driver.
    
    Signed-off-by: Slark Xiao <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Quectel EM05G variant (0x030e) [+ + +]
Author: Martin Kohn <[email protected]>
Date:   Thu Jul 27 22:23:00 2023 +0000

    USB: serial: option: add Quectel EM05G variant (0x030e)
    
    commit 873854c02364ebb991fc06f7148c14dfb5419e1b upstream.
    
    Add Quectel EM05G with product ID 0x030e.
    Interface 4 is used for qmi.
    
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=030e Rev= 3.18
    S:  Manufacturer=Quectel
    S:  Product=Quectel EM05-G
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Martin Kohn <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: typec: tcpci: clear the fault status bit [+ + +]
Author: Marco Felsch <[email protected]>
Date:   Wed Aug 16 14:25:02 2023 -0300

    usb: typec: tcpci: clear the fault status bit
    
    [ Upstream commit 23e60c8daf5ec2ab1b731310761b668745fcf6ed ]
    
    According the "USB Type-C Port Controller Interface Specification v2.0"
    the TCPC sets the fault status register bit-7
    (AllRegistersResetToDefault) once the registers have been reset to
    their default values.
    
    This triggers an alert(-irq) on PTN5110 devices albeit we do mask the
    fault-irq, which may cause a kernel hang. Fix this generically by writing
    a one to the corresponding bit-7.
    
    Cc: [email protected]
    Fixes: 74e656d6b055 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
    Reported-by: "Angus Ainslie (Purism)" <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Reported-by: Christian Bach <[email protected]>
    Closes: https://lore.kernel.org/regressions/ZR0P278MB07737E5F1D48632897D51AC3EB329@ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM/t/
    Signed-off-by: Marco Felsch <[email protected]>
    Signed-off-by: Fabio Estevam <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
veth: Fixing transmit return status for dropped packets [+ + +]
Author: Liang Chen <[email protected]>
Date:   Fri Sep 1 12:09:21 2023 +0800

    veth: Fixing transmit return status for dropped packets
    
    [ Upstream commit 151e887d8ff97e2e42110ffa1fb1e6a2128fb364 ]
    
    The veth_xmit function returns NETDEV_TX_OK even when packets are dropped.
    This behavior leads to incorrect calculations of statistics counts, as
    well as things like txq->trans_start updates.
    
    Fixes: e314dbdc1c0d ("[NET]: Virtual ethernet device driver.")
    Signed-off-by: Liang Chen <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
vxlan: generalize vxlan_parse_gpe_hdr and remove unused args [+ + +]
Author: Jiri Benc <[email protected]>
Date:   Fri Jul 21 16:30:46 2023 +0200

    vxlan: generalize vxlan_parse_gpe_hdr and remove unused args
    
    [ Upstream commit 17a0a64448b568442a101de09575f81ffdc45d15 ]
    
    The vxlan_parse_gpe_hdr function extracts the next protocol value from
    the GPE header and marks GPE bits as parsed.
    
    In order to be used in the next patch, split the function into protocol
    extraction and bit marking. The bit marking is meaningful only in
    vxlan_rcv; move it directly there.
    
    Rename the function to vxlan_parse_gpe_proto to reflect what it now
    does. Remove unused arguments skb and vxflags. Move the function earlier
    in the file to allow it to be called from more places in the next patch.
    
    Signed-off-by: Jiri Benc <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load [+ + +]
Author: Raag Jadav <[email protected]>
Date:   Fri Aug 11 17:32:20 2023 +0530

    watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load
    
    [ Upstream commit cf38e7691c85f1b09973b22a0b89bf1e1228d2f9 ]
    
    When built with CONFIG_INTEL_MID_WATCHDOG=m, currently the driver
    needs to be loaded manually, for the lack of module alias.
    This causes unintended resets in cases where watchdog timer is
    set-up by bootloader and the driver is not explicitly loaded.
    Add MODULE_ALIAS() to load the driver automatically at boot and
    avoid this issue.
    
    Fixes: 87a1ef8058d9 ("watchdog: add Intel MID watchdog driver support")
    Signed-off-by: Raag Jadav <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Wim Van Sebroeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
wifi: ath10k: Use RMW accessors for changing LNKCTL [+ + +]
Author: Ilpo Järvinen <[email protected]>
Date:   Mon Jul 17 15:05:02 2023 +0300

    wifi: ath10k: Use RMW accessors for changing LNKCTL
    
    [ Upstream commit f139492a09f15254fa261245cdbd65555cdf39e3 ]
    
    Don't assume that only the driver would be accessing LNKCTL. ASPM policy
    changes can trigger write to LNKCTL outside of driver's control.
    
    Use RMW capability accessors which does proper locking to avoid losing
    concurrent updates to the register value. On restore, clear the ASPMC field
    properly.
    
    Suggested-by: Lukas Wunner <[email protected]>
    Fixes: 76d870ed09ab ("ath10k: enable ASPM")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Acked-by: Kalle Valo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath9k: fix printk specifier [+ + +]
Author: Dongliang Mu <[email protected]>
Date:   Sun Jul 23 12:04:02 2023 +0800

    wifi: ath9k: fix printk specifier
    
    [ Upstream commit 061115fbfb2ce5870c9a004d68dc63138c07c782 ]
    
    Smatch reports:
    
    ath_pci_probe() warn: argument 4 to %lx specifier is cast from pointer
    ath_ahb_probe() warn: argument 4 to %lx specifier is cast from pointer
    
    Fix it by modifying %lx to %p in the printk format string.
    
    Note that with this change, the pointer address will be printed as a
    hashed value by default. This is appropriate because the kernel
    should not leak kernel pointers to user space in an informational
    message. If someone wants to see the real address for debugging
    purposes, this can be achieved with the no_hash_pointers kernel option.
    
    Signed-off-by: Dongliang Mu <[email protected]>
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Tue Apr 25 22:26:06 2023 +0300

    wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx
    
    [ Upstream commit b674fb513e2e7a514fcde287c0f73915d393fdb6 ]
    
    Currently, the synchronization between ath9k_wmi_cmd() and
    ath9k_wmi_ctrl_rx() is exposed to a race condition which, although being
    rather unlikely, can lead to invalid behaviour of ath9k_wmi_cmd().
    
    Consider the following scenario:
    
    CPU0                                    CPU1
    
    ath9k_wmi_cmd(...)
      mutex_lock(&wmi->op_mutex)
      ath9k_wmi_cmd_issue(...)
      wait_for_completion_timeout(...)
      ---
      timeout
      ---
                                            /* the callback is being processed
                                             * before last_seq_id became zero
                                             */
                                            ath9k_wmi_ctrl_rx(...)
                                              spin_lock_irqsave(...)
                                              /* wmi->last_seq_id check here
                                               * doesn't detect timeout yet
                                               */
                                              spin_unlock_irqrestore(...)
      /* last_seq_id is zeroed to
       * indicate there was a timeout
       */
      wmi->last_seq_id = 0
      mutex_unlock(&wmi->op_mutex)
      return -ETIMEDOUT
    
    ath9k_wmi_cmd(...)
      mutex_lock(&wmi->op_mutex)
      /* the buffer is replaced with
       * another one
       */
      wmi->cmd_rsp_buf = rsp_buf
      wmi->cmd_rsp_len = rsp_len
      ath9k_wmi_cmd_issue(...)
        spin_lock_irqsave(...)
        spin_unlock_irqrestore(...)
      wait_for_completion_timeout(...)
                                            /* the continuation of the
                                             * callback left after the first
                                             * ath9k_wmi_cmd call
                                             */
                                              ath9k_wmi_rsp_callback(...)
                                                /* copying data designated
                                                 * to already timeouted
                                                 * WMI command into an
                                                 * inappropriate wmi_cmd_buf
                                                 */
                                                memcpy(...)
                                                complete(&wmi->cmd_wait)
      /* awakened by the bogus callback
       * => invalid return result
       */
      mutex_unlock(&wmi->op_mutex)
      return 0
    
    To fix this, update last_seq_id on timeout path inside ath9k_wmi_cmd()
    under the wmi_lock. Move ath9k_wmi_rsp_callback() under wmi_lock inside
    ath9k_wmi_ctrl_rx() so that the wmi->cmd_wait can be completed only for
    initially designated wmi_cmd call, otherwise the path would be rejected
    with last_seq_id check.
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath9k: protect WMI command response buffer replacement with a lock [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Tue Apr 25 22:26:07 2023 +0300

    wifi: ath9k: protect WMI command response buffer replacement with a lock
    
    [ Upstream commit 454994cfa9e4c18b6df9f78b60db8eadc20a6c25 ]
    
    If ath9k_wmi_cmd() has exited with a timeout, it is possible that during
    next ath9k_wmi_cmd() call the wmi_rsp callback for previous wmi command
    writes to new wmi->cmd_rsp_buf and makes a completion. This results in an
    invalid ath9k_wmi_cmd() return value.
    
    Move the replacement of WMI command response buffer and length under
    wmi_lock. Note that last_seq_id value is updated there, too.
    
    Thus, the buffer cannot be written to by a belated wmi_rsp callback
    because that path is properly rejected by the last_seq_id check.
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath9k: use IS_ERR() with debugfs_create_dir() [+ + +]
Author: Wang Ming <[email protected]>
Date:   Thu Jul 13 11:03:44 2023 +0800

    wifi: ath9k: use IS_ERR() with debugfs_create_dir()
    
    [ Upstream commit 1e4134610d93271535ecf900a676e1f094e9944c ]
    
    The debugfs_create_dir() function returns error pointers,
    it never returns NULL. Most incorrect error checks were fixed,
    but the one in ath9k_htc_init_debug() was forgotten.
    
    Fix the remaining error check.
    
    Fixes: e5facc75fa91 ("ath9k_htc: Cleanup HTC debugfs")
    Signed-off-by: Wang Ming <[email protected]>
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: avoid possible NULL skb pointer dereference [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Mon Aug 14 12:49:57 2023 +0300

    wifi: mwifiex: avoid possible NULL skb pointer dereference
    
    [ Upstream commit 35a7a1ce7c7d61664ee54f5239a1f120ab95a87e ]
    
    In 'mwifiex_handle_uap_rx_forward()', always check the value
    returned by 'skb_copy()' to avoid potential NULL pointer
    dereference in 'mwifiex_uap_queue_bridged_pkt()', and drop
    original skb in case of copying failure.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 838e4f449297 ("mwifiex: improve uAP RX handling")
    Acked-by: Brian Norris <[email protected]>
    Signed-off-by: Dmitry Antipov <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: fix error recovery in PCIE buffer descriptor management [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Mon Jul 31 10:43:07 2023 +0300

    wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
    
    [ Upstream commit 288c63d5cb4667a51a04668b3e2bb0ea499bc5f4 ]
    
    Add missing 'kfree_skb()' in 'mwifiex_init_rxq_ring()' and never do
    'kfree(card->rxbd_ring_vbase)' because this area is DMAed and should
    be released with 'dma_free_coherent()'. The latter is performed in
    'mwifiex_pcie_delete_rxbd_ring()', which is now called to recover
    from possible errors in 'mwifiex_pcie_create_rxbd_ring()'. Likewise
    for 'mwifiex_pcie_init_evt_ring()', 'kfree(card->evtbd_ring_vbase)'
    'mwifiex_pcie_delete_evtbd_ring()' and 'mwifiex_pcie_create_rxbd_ring()'.
    
    Fixes: d930faee141b ("mwifiex: add support for Marvell pcie8766 chipset")
    Signed-off-by: Dmitry Antipov <[email protected]>
    Acked-by: Brian Norris <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: fix fortify warning [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Thu Jun 29 11:51:01 2023 +0300

    wifi: mwifiex: fix fortify warning
    
    [ Upstream commit dcce94b80a954a8968ff29fafcfb066d6197fa9a ]
    
    When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
    I've noticed the following:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘mwifiex_construct_tdls_action_frame’ at drivers/net/wireless/marvell/mwifiex/tdls.c:765:3,
        inlined from ‘mwifiex_send_tdls_action_frame’ at drivers/net/wireless/marvell/mwifiex/tdls.c:856:6:
    ./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
    declared with attribute warning: detected read beyond size of field (2nd parameter);
    maybe use struct_group()? [-Wattribute-warning]
      529 |                         __read_overflow2_field(q_size_field, size);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The compiler actually complains on:
    
    memmove(pos + ETH_ALEN, &mgmt->u.action.category,
            sizeof(mgmt->u.action.u.tdls_discover_resp));
    
    and it happens because the fortification logic interprets this
    as an attempt to overread 1-byte 'u.action.category' member of
    'struct ieee80211_mgmt'. To silence this warning, it's enough
    to pass an address of 'u.action' itself instead of an address
    of its first member.
    
    This also fixes an improper usage of 'sizeof()'. Since 'skb' is
    extended with 'sizeof(mgmt->u.action.u.tdls_discover_resp) + 1'
    bytes (where 1 is actually 'sizeof(mgmt->u.action.category)'),
    I assume that the same number of bytes should be copied.
    
    Suggested-by: Brian Norris <[email protected]>
    Signed-off-by: Dmitry Antipov <[email protected]>
    Reviewed-by: Brian Norris <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: fix memory leak in mwifiex_histogram_read() [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Wed Aug 2 19:07:15 2023 +0300

    wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
    
    [ Upstream commit 9c8fd72a5c2a031cbc680a2990107ecd958ffcdb ]
    
    Always free the zeroed page on return from 'mwifiex_histogram_read()'.
    
    Fixes: cbf6e05527a7 ("mwifiex: add rx histogram statistics support")
    
    Acked-by: Brian Norris <[email protected]>
    Signed-off-by: Dmitry Antipov <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: Fix missed return in oob checks failed path [+ + +]
Author: Polaris Pi <[email protected]>
Date:   Thu Aug 10 08:39:11 2023 +0000

    wifi: mwifiex: Fix missed return in oob checks failed path
    
    [ Upstream commit 2785851c627f2db05f9271f7f63661b5dbd95c4c ]
    
    Add missed return in mwifiex_uap_queue_bridged_pkt() and
    mwifiex_process_rx_packet().
    
    Fixes: 119585281617 ("wifi: mwifiex: Fix OOB and integer underflow when rx packets")
    Signed-off-by: Polaris Pi <[email protected]>
    Reported-by: Dmitry Antipov <[email protected]>
    Acked-by: Brian Norris <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: Fix OOB and integer underflow when rx packets [+ + +]
Author: Polaris Pi <[email protected]>
Date:   Sun Jul 23 07:07:41 2023 +0000

    wifi: mwifiex: Fix OOB and integer underflow when rx packets
    
    [ Upstream commit 11958528161731c58e105b501ed60b83a91ea941 ]
    
    Make sure mwifiex_process_mgmt_packet,
    mwifiex_process_sta_rx_packet and mwifiex_process_uap_rx_packet,
    mwifiex_uap_queue_bridged_pkt and mwifiex_process_rx_packet
    not out-of-bounds access the skb->data buffer.
    
    Fixes: 2dbaf751b1de ("mwifiex: report received management frames to cfg80211")
    Signed-off-by: Polaris Pi <[email protected]>
    Reviewed-by: Matthew Wang <[email protected]>
    Reviewed-by: Brian Norris <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
X.509: if signature is unsupported skip validation [+ + +]
Author: Thore Sommer <[email protected]>
Date:   Tue Aug 15 14:29:42 2023 +0300

    X.509: if signature is unsupported skip validation
    
    commit ef5b52a631f8c18353e80ccab8408b963305510c upstream.
    
    When the hash algorithm for the signature is not available the digest size
    is 0 and the signature in the certificate is marked as unsupported.
    
    When validating a self-signed certificate, this needs to be checked,
    because otherwise trying to validate the signature will fail with an
    warning:
    
    Loading compiled-in X.509 certificates
    WARNING: CPU: 0 PID: 1 at crypto/rsa-pkcs1pad.c:537 \
    pkcs1pad_verify+0x46/0x12c
    ...
    Problem loading in-kernel X.509 certificate (-22)
    
    Signed-off-by: Thore Sommer <[email protected]>
    Cc: [email protected] # v4.7+
    Fixes: 6c2dc5ae4ab7 ("X.509: Extract signature digest and make self-signed cert checks earlier")
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/APM: drop the duplicate APM_MINOR_DEV macro [+ + +]
Author: Randy Dunlap <[email protected]>
Date:   Thu Jul 27 18:11:20 2023 -0700

    x86/APM: drop the duplicate APM_MINOR_DEV macro
    
    [ Upstream commit 4ba2909638a29630a346d6c4907a3105409bee7d ]
    
    This source file already includes <linux/miscdevice.h>, which contains
    the same macro. It doesn't need to be defined here again.
    
    Fixes: 874bcd00f520 ("apm-emulation: move APM_MINOR_DEV to include/linux/miscdevice.h")
    Signed-off-by: Randy Dunlap <[email protected]>
    Cc: Jiri Kosina <[email protected]>
    Cc: [email protected]
    Cc: Sohil Mehta <[email protected]>
    Cc: Corentin Labbe <[email protected]>
    Reviewed-by: Sohil Mehta <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Jul 21 13:18:52 2023 -0700

    x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
    
    [ Upstream commit 5df8ecfe3632d5879d1f154f7aa8de441b5d1c89 ]
    
    Drop the explicit check on the extended CPUID level in cpu_has_svm(), the
    kernel's cached CPUID info will leave the entire SVM leaf unset if said
    leaf is not supported by hardware.  Prior to using cached information,
    the check was needed to avoid false positives due to Intel's rather crazy
    CPUID behavior of returning the values of the maximum supported leaf if
    the specified leaf is unsupported.
    
    Fixes: 682a8108872f ("x86/kvm/svm: Simplify cpu_has_svm()")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sean Christopherson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>