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

 
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]>

ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Fri Aug 18 14:40:03 2023 -0500

    ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects
    
    [ Upstream commit 883cf0d4cf288313b71146ddebdf5d647b76c78b ]
    
    If a badly constructed firmware includes multiple `ACPI_TYPE_PACKAGE`
    objects while evaluating the AMD LPS0 _DSM, there will be a memory
    leak.  Explicitly guard against this.
    
    Suggested-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Mario Limonciello <[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]>

 
ALSA: hda: intel-dsp-cfg: add LunarLake support [+ + +]
Author: Pierre-Louis Bossart <[email protected]>
Date:   Wed Aug 2 10:01:04 2023 -0500

    ALSA: hda: intel-dsp-cfg: add LunarLake support
    
    [ Upstream commit d2852b8c045ebd31d753b06f2810df5be30ed56a ]
    
    One more PCI ID for the road.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    Reviewed-by: Ranjani Sridharan <[email protected]>
    Reviewed-by: Bard Liao <[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]>

 
arm64: dts: qcom: sm6125-pdx201: correct ramoops pmsg-size [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Jun 18 13:44:38 2023 +0200

    arm64: dts: qcom: sm6125-pdx201: correct ramoops pmsg-size
    
    [ Upstream commit c42f5452de6ad2599c6e5e2a64c180a4ac835d27 ]
    
    There is no 'msg-size' property in ramoops, so assume intention was for
    'pmsg-size':
    
      sm6125-sony-xperia-seine-pdx201.dtb: ramoops@ffc00000: Unevaluated properties are not allowed ('msg-size' was unexpected)
    
    Signed-off-by: Krzysztof Kozlowski <[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: Sasha Levin <[email protected]>

arm64: dts: qcom: sm6350: correct ramoops pmsg-size [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Jun 18 13:44:40 2023 +0200

    arm64: dts: qcom: sm6350: correct ramoops pmsg-size
    
    [ Upstream commit c86b97a72065e06eacb993dc71fa9febc93422af ]
    
    There is no 'msg-size' property in ramoops, so assume intention was for
    'pmsg-size':
    
      sm6350-sony-xperia-lena-pdx213.dtb: ramoops@ffc00000: Unevaluated properties are not allowed ('msg-size' was unexpected)
    
    Signed-off-by: Krzysztof Kozlowski <[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: Sasha Levin <[email protected]>

arm64: dts: qcom: sm8150-kumano: correct ramoops pmsg-size [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Jun 18 13:44:41 2023 +0200

    arm64: dts: qcom: sm8150-kumano: correct ramoops pmsg-size
    
    [ Upstream commit 4e6b942f092653ebcdbbc0819b2d1f08ab415bdc ]
    
    There is no 'msg-size' property in ramoops, so assume intention was for
    'pmsg-size':
    
      sm8150-sony-xperia-kumano-griffin.dtb: ramoops@ffc00000: Unevaluated properties are not allowed ('msg-size' was unexpected)
    
    Signed-off-by: Krzysztof Kozlowski <[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: Sasha Levin <[email protected]>

arm64: dts: qcom: sm8250-edo: correct ramoops pmsg-size [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Jun 18 13:44:42 2023 +0200

    arm64: dts: qcom: sm8250-edo: correct ramoops pmsg-size
    
    [ Upstream commit 7dc3606f91427414d00a2fb09e6e0e32c14c2093 ]
    
    There is no 'msg-size' property in ramoops, so assume intention was for
    'pmsg-size':
    
      sm8250-sony-xperia-edo-pdx206.dtb: ramoops@ffc00000: Unevaluated properties are not allowed ('msg-size' was unexpected)
    
    Signed-off-by: Krzysztof Kozlowski <[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: Sasha Levin <[email protected]>

 
ARM: 9317/1: kexec: Make smp stop calls asynchronous [+ + +]
Author: MÃ¥rten Lindahl <[email protected]>
Date:   Tue Aug 8 09:37:32 2023 +0100

    ARM: 9317/1: kexec: Make smp stop calls asynchronous
    
    [ Upstream commit 8922ba71c969d2a0c01a94372a71477d879470de ]
    
    If a panic is triggered by a hrtimer interrupt all online cpus will be
    notified and set offline. But as highlighted by commit 19dbdcb8039c
    ("smp: Warn on function calls from softirq context") this call should
    not be made synchronous with disabled interrupts:
    
     softdog: Initiating panic
     Kernel panic - not syncing: Software Watchdog Timer expired
     WARNING: CPU: 1 PID: 0 at kernel/smp.c:753 smp_call_function_many_cond
       unwind_backtrace:
         show_stack
         dump_stack_lvl
         __warn
         warn_slowpath_fmt
         smp_call_function_many_cond
         smp_call_function
         crash_smp_send_stop.part.0
         machine_crash_shutdown
         __crash_kexec
         panic
         softdog_fire
         __hrtimer_run_queues
         hrtimer_interrupt
    
    Make the smp call for machine_crash_nonpanic_core() asynchronous.
    
    Signed-off-by: MÃ¥rten Lindahl <[email protected]>
    Signed-off-by: Russell King (Oracle) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoC: Intel: sof_sdw: Update BT offload config for soundwire config [+ + +]
Author: Uday M Bhat <[email protected]>
Date:   Mon Jul 31 16:42:38 2023 -0500

    ASoC: Intel: sof_sdw: Update BT offload config for soundwire config
    
    [ Upstream commit a14aded9299187bb17ef90700eb2cf1120ef5885 ]
    
    For soundwire config, SSP1 is used for BT offload. This is enabled
    in sof_sdw_quirk_table
    
    Reviewed-by: Kai Vehmanen <[email protected]>
    Reviewed-by: Ranjani Sridharan <[email protected]>
    Reviewed-by: Bard Liao <[email protected]>
    Signed-off-by: Uday M Bhat <[email protected]>
    Signed-off-by: Jairaj Arava <[email protected]>
    Signed-off-by: Pierre-Louis Bossart <[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: SOF: topology: simplify code to prevent static analysis warnings [+ + +]
Author: Pierre-Louis Bossart <[email protected]>
Date:   Mon Jul 31 16:37:43 2023 -0500

    ASoC: SOF: topology: simplify code to prevent static analysis warnings
    
    [ Upstream commit 55cb3dc271d81f1982c949a2ac483a6daf613b92 ]
    
    make KCFLAGS='-fanalyzer' sound/soc/sof/intel/ reports a possible NULL
    pointer dereference.
    
    sound/soc/sof/topology.c:1136:21: error: dereference of NULL ‘w’
    [CWE-476] [-Werror=analyzer-null-dereference]
    
     1136 |     strcmp(w->sname, rtd->dai_link->stream_name))
    
    The code is rather confusing and can be simplified to make static
    analysis happy. No functionality change.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    Reviewed-by: Rander Wang <[email protected]>
    Reviewed-by: Daniel Baluta <[email protected]>
    Reviewed-by: Yaochun Hung <[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: libahci: clear pending interrupt status [+ + +]
Author: Szuying Chen <[email protected]>
Date:   Thu Sep 7 16:17:10 2023 +0800

    ata: libahci: clear pending interrupt status
    
    commit 737dd811a3dbfd7edd4ad2ba5152e93d99074f83 upstream.
    
    When a CRC error occurs, the HBA asserts an interrupt to indicate an
    interface fatal error (PxIS.IFS). The ISR clears PxIE and PxIS, then
    does error recovery. If the adapter receives another SDB FIS
    with an error (PxIS.TFES) from the device before the start of the EH
    recovery process, the interrupt signaling the new SDB cannot be
    serviced as PxIE was cleared already. This in turn results in the HBA
    inability to issue any command during the error recovery process after
    setting PxCMD.ST to 1 because PxIS.TFES is still set.
    
    According to AHCI 1.3.1 specifications section 6.2.2, fatal errors
    notified by setting PxIS.HBFS, PxIS.HBDS, PxIS.IFS or PxIS.TFES will
    cause the HBA to enter the ERR:Fatal state. In this state, the HBA
    shall not issue any new commands.
    
    To avoid this situation, introduce the function
    ahci_port_clear_pending_irq() to clear pending interrupts before
    executing a COMRESET. This follows the AHCI 1.3.1 - section 6.2.2.2
    specification.
    
    Signed-off-by: Szuying Chen <[email protected]>
    Fixes: e0bfd149973d ("[PATCH] ahci: stop engine during hard reset")
    Cc: [email protected]
    Reviewed-by: Niklas Cassel <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ata: libata: disallow dev-initiated LPM transitions to unsupported states [+ + +]
Author: Niklas Cassel <[email protected]>
Date:   Mon Sep 4 22:42:56 2023 +0200

    ata: libata: disallow dev-initiated LPM transitions to unsupported states
    
    commit 24e0e61db3cb86a66824531989f1df80e0939f26 upstream.
    
    In AHCI 1.3.1, the register description for CAP.SSC:
    "When cleared to ‘0’, software must not allow the HBA to initiate
    transitions to the Slumber state via agressive link power management nor
    the PxCMD.ICC field in each port, and the PxSCTL.IPM field in each port
    must be programmed to disallow device initiated Slumber requests."
    
    In AHCI 1.3.1, the register description for CAP.PSC:
    "When cleared to ‘0’, software must not allow the HBA to initiate
    transitions to the Partial state via agressive link power management nor
    the PxCMD.ICC field in each port, and the PxSCTL.IPM field in each port
    must be programmed to disallow device initiated Partial requests."
    
    Ensure that we always set the corresponding bits in PxSCTL.IPM, such that
    a device is not allowed to initiate transitions to power states which are
    unsupported by the HBA.
    
    DevSleep is always initiated by the HBA, however, for completeness, set the
    corresponding bit in PxSCTL.IPM such that agressive link power management
    cannot transition to DevSleep if DevSleep is not supported.
    
    sata_link_scr_lpm() is used by libahci, ata_piix and libata-pmp.
    However, only libahci has the ability to read the CAP/CAP2 register to see
    if these features are supported. Therefore, in order to not introduce any
    regressions on ata_piix or libata-pmp, create flags that indicate that the
    respective feature is NOT supported. This way, the behavior for ata_piix
    and libata-pmp should remain unchanged.
    
    This change is based on a patch originally submitted by Runa Guo-oc.
    
    Signed-off-by: Niklas Cassel <[email protected]>
    Fixes: 1152b2617a6e ("libata: implement sata_link_scr_lpm() and make ata_dev_set_feature() global")
    Cc: [email protected]
    Signed-off-by: Damien Le Moal <[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]>

 
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]>
 
block: factor out a bvec_set_page helper [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Fri Feb 3 16:06:12 2023 +0100

    block: factor out a bvec_set_page helper
    
    [ Upstream commit d58cdfae6a22e5079656c487aad669597a0635c8 ]
    
    Add a helper to initialize a bvec based of a page pointer.  This will help
    removing various open code bvec initializations.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Chaitanya Kulkarni <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Stable-dep-of: 1f0bbf28940c ("nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()")
    Signed-off-by: Sasha Levin <[email protected]>

 
Bluetooth: Fix hci_suspend_sync crash [+ + +]
Author: Ying Hsu <[email protected]>
Date:   Wed Jul 5 21:06:47 2023 +0000

    Bluetooth: Fix hci_suspend_sync crash
    
    [ Upstream commit 573ebae162111063eedc6c838a659ba628f66a0f ]
    
    If hci_unregister_dev() frees the hci_dev object but hci_suspend_notifier
    may still be accessing it, it can cause the program to crash.
    Here's the call trace:
      <4>[102152.653246] Call Trace:
      <4>[102152.653254]  hci_suspend_sync+0x109/0x301 [bluetooth]
      <4>[102152.653259]  hci_suspend_dev+0x78/0xcd [bluetooth]
      <4>[102152.653263]  hci_suspend_notifier+0x42/0x7a [bluetooth]
      <4>[102152.653268]  notifier_call_chain+0x43/0x6b
      <4>[102152.653271]  __blocking_notifier_call_chain+0x48/0x69
      <4>[102152.653273]  __pm_notifier_call_chain+0x22/0x39
      <4>[102152.653276]  pm_suspend+0x287/0x57c
      <4>[102152.653278]  state_store+0xae/0xe5
      <4>[102152.653281]  kernfs_fop_write+0x109/0x173
      <4>[102152.653284]  __vfs_write+0x16f/0x1a2
      <4>[102152.653287]  ? selinux_file_permission+0xca/0x16f
      <4>[102152.653289]  ? security_file_permission+0x36/0x109
      <4>[102152.653291]  vfs_write+0x114/0x21d
      <4>[102152.653293]  __x64_sys_write+0x7b/0xdb
      <4>[102152.653296]  do_syscall_64+0x59/0x194
      <4>[102152.653299]  entry_SYSCALL_64_after_hwframe+0x5c/0xc1
    
    This patch holds the reference count of the hci_dev object while
    processing it in hci_suspend_notifier to avoid potential crash
    caused by the race condition.
    
    Signed-off-by: Ying Hsu <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
btrfs: add a helper to read the superblock metadata_uuid [+ + +]
Author: Anand Jain <[email protected]>
Date:   Mon Jul 31 19:16:32 2023 +0800

    btrfs: add a helper to read the superblock metadata_uuid
    
    [ Upstream commit 4844c3664a72d36cc79752cb651c78860b14c240 ]
    
    In some cases, we need to read the FSID from the superblock when the
    metadata_uuid is not set, and otherwise, read the metadata_uuid. So,
    add a helper.
    
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Guilherme G. Piccoli <[email protected]>
    Signed-off-by: Anand Jain <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Stable-dep-of: 6bfe3959b0e7 ("btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super")
    Signed-off-by: Sasha Levin <[email protected]>

btrfs: check for BTRFS_FS_ERROR in pending ordered assert [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Thu Aug 24 16:59:04 2023 -0400

    btrfs: check for BTRFS_FS_ERROR in pending ordered assert
    
    commit 4ca8e03cf2bfaeef7c85939fa1ea0c749cd116ab upstream.
    
    If we do fast tree logging we increment a counter on the current
    transaction for every ordered extent we need to wait for.  This means we
    expect the transaction to still be there when we clear pending on the
    ordered extent.  However if we happen to abort the transaction and clean
    it up, there could be no running transaction, and thus we'll trip the
    "ASSERT(trans)" check.  This is obviously incorrect, and the code
    properly deals with the case that the transaction doesn't exist.  Fix
    this ASSERT() to only fire if there's no trans and we don't have
    BTRFS_FS_ERROR() set on the file system.
    
    CC: [email protected] # 4.14+
    Reviewed-by: Filipe Manana <[email protected]>
    Signed-off-by: Josef Bacik <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super [+ + +]
Author: Anand Jain <[email protected]>
Date:   Mon Jul 31 19:16:35 2023 +0800

    btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
    
    [ Upstream commit 6bfe3959b0e7a526f5c64747801a8613f002f05a ]
    
    The function btrfs_validate_super() should verify the metadata_uuid in
    the provided superblock argument. Because, all its callers expect it to
    do that.
    
    Such as in the following stacks:
    
      write_all_supers()
       sb = fs_info->super_for_commit;
       btrfs_validate_write_super(.., sb)
         btrfs_validate_super(.., sb, ..)
    
      scrub_one_super()
            btrfs_validate_super(.., sb, ..)
    
    And
       check_dev_super()
            btrfs_validate_super(.., sb, ..)
    
    However, it currently verifies the fs_info::super_copy::metadata_uuid
    instead.  Fix this using the correct metadata_uuid in the superblock
    argument.
    
    CC: [email protected] # 5.4+
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Guilherme G. Piccoli <[email protected]>
    Signed-off-by: Anand Jain <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

btrfs: fix a compilation error if DEBUG is defined in btree_dirty_folio [+ + +]
Author: Qu Wenruo <[email protected]>
Date:   Tue Aug 22 13:50:51 2023 +0800

    btrfs: fix a compilation error if DEBUG is defined in btree_dirty_folio
    
    commit 5e0e879926c1ce7e1f5e0dfaacaf2d105f7d8a05 upstream.
    
    [BUG]
    After commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps
    into a larger bitmap"), the DEBUG section of btree_dirty_folio() would
    no longer compile.
    
    [CAUSE]
    If DEBUG is defined, we would do extra checks for btree_dirty_folio(),
    mostly to make sure the range we marked dirty has an extent buffer and
    that extent buffer is dirty.
    
    For subpage, we need to iterate through all the extent buffers covered
    by that page range, and make sure they all matches the criteria.
    
    However commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps
    into a larger bitmap") changes how we store the bitmap, we pack all the
    16 bits bitmaps into a larger bitmap, which would save some space.
    
    This means we no longer have btrfs_subpage::dirty_bitmap, instead the
    dirty bitmap is starting at btrfs_subpage_info::dirty_offset, and has a
    length of btrfs_subpage_info::bitmap_nr_bits.
    
    [FIX]
    Although I'm not sure if it still makes sense to maintain such code, at
    least let it compile.
    
    This patch would let us test the bits one by one through the bitmaps.
    
    CC: [email protected] # 6.1+
    Signed-off-by: Qu Wenruo <[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]>

btrfs: release path before inode lookup during the ino lookup ioctl [+ + +]
Author: Filipe Manana <[email protected]>
Date:   Sat Aug 26 11:28:20 2023 +0100

    btrfs: release path before inode lookup during the ino lookup ioctl
    
    commit ee34a82e890a7babb5585daf1a6dd7d4d1cf142a upstream.
    
    During the ino lookup ioctl we can end up calling btrfs_iget() to get an
    inode reference while we are holding on a root's btree. If btrfs_iget()
    needs to lookup the inode from the root's btree, because it's not
    currently loaded in memory, then it will need to lock another or the
    same path in the same root btree. This may result in a deadlock and
    trigger the following lockdep splat:
    
      WARNING: possible circular locking dependency detected
      6.5.0-rc7-syzkaller-00004-gf7757129e3de #0 Not tainted
      ------------------------------------------------------
      syz-executor277/5012 is trying to acquire lock:
      ffff88802df41710 (btrfs-tree-01){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
    
      but task is already holding lock:
      ffff88802df418e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
    
      which lock already depends on the new lock.
    
      the existing dependency chain (in reverse order) is:
    
      -> #1 (btrfs-tree-00){++++}-{3:3}:
             down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645
             __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
             btrfs_search_slot+0x13a4/0x2f80 fs/btrfs/ctree.c:2302
             btrfs_init_root_free_objectid+0x148/0x320 fs/btrfs/disk-io.c:4955
             btrfs_init_fs_root fs/btrfs/disk-io.c:1128 [inline]
             btrfs_get_root_ref+0x5ae/0xae0 fs/btrfs/disk-io.c:1338
             btrfs_get_fs_root fs/btrfs/disk-io.c:1390 [inline]
             open_ctree+0x29c8/0x3030 fs/btrfs/disk-io.c:3494
             btrfs_fill_super+0x1c7/0x2f0 fs/btrfs/super.c:1154
             btrfs_mount_root+0x7e0/0x910 fs/btrfs/super.c:1519
             legacy_get_tree+0xef/0x190 fs/fs_context.c:611
             vfs_get_tree+0x8c/0x270 fs/super.c:1519
             fc_mount fs/namespace.c:1112 [inline]
             vfs_kern_mount+0xbc/0x150 fs/namespace.c:1142
             btrfs_mount+0x39f/0xb50 fs/btrfs/super.c:1579
             legacy_get_tree+0xef/0x190 fs/fs_context.c:611
             vfs_get_tree+0x8c/0x270 fs/super.c:1519
             do_new_mount+0x28f/0xae0 fs/namespace.c:3335
             do_mount fs/namespace.c:3675 [inline]
             __do_sys_mount fs/namespace.c:3884 [inline]
             __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861
             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
    
      -> #0 (btrfs-tree-01){++++}-{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
             down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645
             __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
             btrfs_tree_read_lock fs/btrfs/locking.c:142 [inline]
             btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:281
             btrfs_search_slot_get_root fs/btrfs/ctree.c:1832 [inline]
             btrfs_search_slot+0x4ff/0x2f80 fs/btrfs/ctree.c:2154
             btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412
             btrfs_read_locked_inode fs/btrfs/inode.c:3892 [inline]
             btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5716
             btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1961 [inline]
             btrfs_ioctl_ino_lookup_user+0x77a/0xf50 fs/btrfs/ioctl.c:2105
             btrfs_ioctl+0xb0b/0xd40 fs/btrfs/ioctl.c:4683
             vfs_ioctl fs/ioctl.c:51 [inline]
             __do_sys_ioctl fs/ioctl.c:870 [inline]
             __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856
             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
             ----                    ----
        rlock(btrfs-tree-00);
                                     lock(btrfs-tree-01);
                                     lock(btrfs-tree-00);
        rlock(btrfs-tree-01);
    
       *** DEADLOCK ***
    
      1 lock held by syz-executor277/5012:
       #0: ffff88802df418e8 (btrfs-tree-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
    
      stack backtrace:
      CPU: 1 PID: 5012 Comm: syz-executor277 Not tainted 6.5.0-rc7-syzkaller-00004-gf7757129e3de #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
       down_read_nested+0x49/0x2f0 kernel/locking/rwsem.c:1645
       __btrfs_tree_read_lock+0x2f/0x220 fs/btrfs/locking.c:136
       btrfs_tree_read_lock fs/btrfs/locking.c:142 [inline]
       btrfs_read_lock_root_node+0x292/0x3c0 fs/btrfs/locking.c:281
       btrfs_search_slot_get_root fs/btrfs/ctree.c:1832 [inline]
       btrfs_search_slot+0x4ff/0x2f80 fs/btrfs/ctree.c:2154
       btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:412
       btrfs_read_locked_inode fs/btrfs/inode.c:3892 [inline]
       btrfs_iget_path+0x2d9/0x1520 fs/btrfs/inode.c:5716
       btrfs_search_path_in_tree_user fs/btrfs/ioctl.c:1961 [inline]
       btrfs_ioctl_ino_lookup_user+0x77a/0xf50 fs/btrfs/ioctl.c:2105
       btrfs_ioctl+0xb0b/0xd40 fs/btrfs/ioctl.c:4683
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856
       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:0x7f0bec94ea39
    
    Fix this simply by releasing the path before calling btrfs_iget() as at
    point we don't need the path anymore.
    
    Reported-by: [email protected]
    Link: https://lore.kernel.org/linux-btrfs/[email protected]/
    Fixes: 23d0b79dfaed ("btrfs: Add unprivileged version of ino_lookup ioctl")
    CC: [email protected] # 4.19+
    Reviewed-by: Josef Bacik <[email protected]>
    Signed-off-by: Filipe Manana <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bus: ti-sysc: Configure uart quirks for k3 SoC [+ + +]
Author: Tony Lindgren <[email protected]>
Date:   Fri Aug 4 13:38:01 2023 +0300

    bus: ti-sysc: Configure uart quirks for k3 SoC
    
    [ Upstream commit 03a711d3cb83692733f865312f49e665c49de6de ]
    
    Enable the uart quirks similar to the earlier SoCs. Let's assume we are
    likely going to need a k3 specific quirk mask separate from the earlier
    SoCs, so let's not start changing the revision register mask at this point.
    
    Note that SYSC_QUIRK_LEGACY_IDLE will be needed until we can remove the
    need for pm_runtime_irq_safe() from 8250_omap driver.
    
    Reviewed-by: Nishanth Menon <[email protected]>
    Signed-off-by: Tony Lindgren <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
can: sun4i_can: Add acceptance register quirk [+ + +]
Author: John Watts <[email protected]>
Date:   Sat Jul 22 08:15:52 2023 +1000

    can: sun4i_can: Add acceptance register quirk
    
    [ Upstream commit 8cda0c6dfd42ee6f2586e7dffb553aaf1fcb62ca ]
    
    The Allwinner D1's CAN controllers have the ACPC and ACPM registers
    moved down. Compensate for this by adding an offset quirk for the
    acceptance registers.
    
    Signed-off-by: John Watts <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

can: sun4i_can: Add support for the Allwinner D1 [+ + +]
Author: John Watts <[email protected]>
Date:   Sat Jul 22 08:15:53 2023 +1000

    can: sun4i_can: Add support for the Allwinner D1
    
    [ Upstream commit 8abb95250ae6af2d51993da8fcae18da2ce24cc4 ]
    
    The controllers present in the D1 are extremely similar to the R40
    and require the same reset quirks, but An extra quirk is needed to support
    receiving packets.
    
    Signed-off-by: John Watts <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Marc Kleine-Budde <[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: lrw,xts - Replace strlcpy with strscpy [+ + +]
Author: Azeem Shaikh <[email protected]>
Date:   Tue Jun 20 20:08:32 2023 +0000

    crypto: lrw,xts - Replace strlcpy with strscpy
    
    [ Upstream commit babb80b3ecc6f40c962e13c654ebcd27f25ee327 ]
    
    strlcpy() reads the entire source buffer first.
    This read may exceed the destination size limit.
    This is both inefficient and can lead to linear read
    overflows if a source string is not NUL-terminated [1].
    In an effort to remove strlcpy() completely [2], replace
    strlcpy() here with strscpy().
    
    Direct replacement is safe here since return value of -errno
    is used to check for truncation instead of sizeof(dest).
    
    [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
    [2] https://github.com/KSPP/linux/issues/89
    
    Signed-off-by: Azeem Shaikh <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
devlink: remove reload failed checks in params get/set callbacks [+ + +]
Author: Jiri Pirko <[email protected]>
Date:   Thu Jul 13 11:44:19 2023 +0200

    devlink: remove reload failed checks in params get/set callbacks
    
    [ Upstream commit 633d76ad01ad0321a1ace3e5cc4fed06753d7ac4 ]
    
    The checks in question were introduced by:
    commit 6b4db2e528f6 ("devlink: Fix use-after-free after a failed reload").
    That fixed an issue of reload with mlxsw driver.
    
    Back then, that was a valid fix, because there was a limitation
    in place that prevented drivers from registering/unregistering params
    when devlink instance was registered.
    
    It was possible to do the fix differently by changing drivers to
    register/unregister params in appropriate places making sure the ops
    operate only on memory which is allocated and initialized. But that,
    as a dependency, would require to remove the limitation mentioned above.
    
    Eventually, this limitation was lifted by:
    commit 1d18bb1a4ddd ("devlink: allow registering parameters after the instance")
    
    Also, the alternative fix (which also fixed another issue) was done by:
    commit 74cbc3c03c82 ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").
    
    Therefore, the checks are no longer relevant. Each driver should make
    sure to have the params registered only when the memory the ops
    are working with is allocated and initialized.
    
    So remove the checks.
    
    Signed-off-by: Jiri Pirko <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Reviewed-by: Jakub Kicinski <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
dm: don't attempt to queue IO under RCU protection [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Fri Sep 15 13:14:23 2023 -0600

    dm: don't attempt to queue IO under RCU protection
    
    commit a9ce385344f916cd1c36a33905e564f5581beae9 upstream.
    
    dm looks up the table for IO based on the request type, with an
    assumption that if the request is marked REQ_NOWAIT, it's fine to
    attempt to submit that IO while under RCU read lock protection. This
    is not OK, as REQ_NOWAIT just means that we should not be sleeping
    waiting on other IO, it does not mean that we can't potentially
    schedule.
    
    A simple test case demonstrates this quite nicely:
    
    int main(int argc, char *argv[])
    {
            struct iovec iov;
            int fd;
    
            fd = open("/dev/dm-0", O_RDONLY | O_DIRECT);
            posix_memalign(&iov.iov_base, 4096, 4096);
            iov.iov_len = 4096;
            preadv2(fd, &iov, 1, 0, RWF_NOWAIT);
            return 0;
    }
    
    which will instantly spew:
    
    BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
    in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5580, name: dm-nowait
    preempt_count: 0, expected: 0
    RCU nest depth: 1, expected: 0
    INFO: lockdep is turned off.
    CPU: 7 PID: 5580 Comm: dm-nowait Not tainted 6.6.0-rc1-g39956d2dcd81 #132
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x11d/0x1b0
     __might_resched+0x3c3/0x5e0
     ? preempt_count_sub+0x150/0x150
     mempool_alloc+0x1e2/0x390
     ? mempool_resize+0x7d0/0x7d0
     ? lock_sync+0x190/0x190
     ? lock_release+0x4b7/0x670
     ? internal_get_user_pages_fast+0x868/0x2d40
     bio_alloc_bioset+0x417/0x8c0
     ? bvec_alloc+0x200/0x200
     ? internal_get_user_pages_fast+0xb8c/0x2d40
     bio_alloc_clone+0x53/0x100
     dm_submit_bio+0x27f/0x1a20
     ? lock_release+0x4b7/0x670
     ? blk_try_enter_queue+0x1a0/0x4d0
     ? dm_dax_direct_access+0x260/0x260
     ? rcu_is_watching+0x12/0xb0
     ? blk_try_enter_queue+0x1cc/0x4d0
     __submit_bio+0x239/0x310
     ? __bio_queue_enter+0x700/0x700
     ? kvm_clock_get_cycles+0x40/0x60
     ? ktime_get+0x285/0x470
     submit_bio_noacct_nocheck+0x4d9/0xb80
     ? should_fail_request+0x80/0x80
     ? preempt_count_sub+0x150/0x150
     ? lock_release+0x4b7/0x670
     ? __bio_add_page+0x143/0x2d0
     ? iov_iter_revert+0x27/0x360
     submit_bio_noacct+0x53e/0x1b30
     submit_bio_wait+0x10a/0x230
     ? submit_bio_wait_endio+0x40/0x40
     __blkdev_direct_IO_simple+0x4f8/0x780
     ? blkdev_bio_end_io+0x4c0/0x4c0
     ? stack_trace_save+0x90/0xc0
     ? __bio_clone+0x3c0/0x3c0
     ? lock_release+0x4b7/0x670
     ? lock_sync+0x190/0x190
     ? atime_needs_update+0x3bf/0x7e0
     ? timestamp_truncate+0x21b/0x2d0
     ? inode_owner_or_capable+0x240/0x240
     blkdev_direct_IO.part.0+0x84a/0x1810
     ? rcu_is_watching+0x12/0xb0
     ? lock_release+0x4b7/0x670
     ? blkdev_read_iter+0x40d/0x530
     ? reacquire_held_locks+0x4e0/0x4e0
     ? __blkdev_direct_IO_simple+0x780/0x780
     ? rcu_is_watching+0x12/0xb0
     ? __mark_inode_dirty+0x297/0xd50
     ? preempt_count_add+0x72/0x140
     blkdev_read_iter+0x2a4/0x530
     do_iter_readv_writev+0x2f2/0x3c0
     ? generic_copy_file_range+0x1d0/0x1d0
     ? fsnotify_perm.part.0+0x25d/0x630
     ? security_file_permission+0xd8/0x100
     do_iter_read+0x31b/0x880
     ? import_iovec+0x10b/0x140
     vfs_readv+0x12d/0x1a0
     ? vfs_iter_read+0xb0/0xb0
     ? rcu_is_watching+0x12/0xb0
     ? rcu_is_watching+0x12/0xb0
     ? lock_release+0x4b7/0x670
     do_preadv+0x1b3/0x260
     ? do_readv+0x370/0x370
     __x64_sys_preadv2+0xef/0x150
     do_syscall_64+0x39/0xb0
     entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f5af41ad806
    Code: 41 54 41 89 fc 55 44 89 c5 53 48 89 cb 48 83 ec 18 80 3d e4 dd 0d 00 00 74 7a 45 89 c1 49 89 ca 45 31 c0 b8 47 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 be 00 00 00 48 85 c0 79 4a 48 8b 0d da 55
    RSP: 002b:00007ffd3145c7f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000147
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5af41ad806
    RDX: 0000000000000001 RSI: 00007ffd3145c850 RDI: 0000000000000003
    RBP: 0000000000000008 R08: 0000000000000000 R09: 0000000000000008
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
    R13: 00007ffd3145c850 R14: 000055f5f0431dd8 R15: 0000000000000001
     </TASK>
    
    where in fact it is dm itself that attempts to allocate a bio clone with
    GFP_NOIO under the rcu read lock, regardless of the request type.
    
    Fix this by getting rid of the special casing for REQ_NOWAIT, and just
    use the normal SRCU protected table lookup. Get rid of the bio based
    table locking helpers at the same time, as they are now unused.
    
    Cc: [email protected]
    Fixes: 563a225c9fd2 ("dm: introduce dm_{get,put}_live_table_bio called from dm_submit_bio")
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dma-buf: Add unlocked variant of attachment-mapping functions [+ + +]
Author: Dmitry Osipenko <[email protected]>
Date:   Mon Oct 17 20:22:10 2022 +0300

    dma-buf: Add unlocked variant of attachment-mapping functions
    
    [ Upstream commit 19d6634d8789573a9212ce78dbb4348ffd4f7f78 ]
    
    Add unlocked variant of dma_buf_map/unmap_attachment() that will
    be used by drivers that don't take the reservation lock explicitly.
    
    Acked-by: Sumit Semwal <[email protected]>
    Acked-by: Christian König <[email protected]>
    Signed-off-by: Dmitry Osipenko <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: a2cb9cd6a394 ("misc: fastrpc: Fix incorrect DMA mapping unmap request")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN31 [+ + +]
Author: Leo Chen <[email protected]>
Date:   Mon Jul 24 16:57:36 2023 -0400

    drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN31
    
    [ Upstream commit 026a71babf48efb6b9884a3a66fa31aec9e1ea54 ]
    
    [Why & How]
    HDMI TMDS does not have ODM support. Filtering 420 modes that
    exceed the 4096 FMT limitation on DCN31 will resolve
    intermittent corruptions issues.
    
    Reviewed-by: Nicholas Kazlauskas <[email protected]>
    Acked-by: Tom Chung <[email protected]>
    Signed-off-by: Leo Chen <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN314 [+ + +]
Author: Leo Chen <[email protected]>
Date:   Wed Jul 26 22:44:13 2023 -0400

    drm/amd/display: Blocking invalid 420 modes on HDMI TMDS for DCN314
    
    [ Upstream commit 4c6107a653ccf361cb1b6ba35d558a1a5e6e57ac ]
    
    [Why & How]
    HDMI TMDS does not have ODM support. Filtering 420 modes that
    exceed the 4096 FMT limitation on DCN314 will resolve
    intermittent corruptions issues.
    
    Reviewed-by: Nicholas Kazlauskas <[email protected]>
    Acked-by: Tom Chung <[email protected]>
    Signed-off-by: Leo Chen <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amd/display: fix the white screen issue when >= 64GB DRAM [+ + +]
Author: Yifan Zhang <[email protected]>
Date:   Fri Sep 8 16:46:39 2023 +0800

    drm/amd/display: fix the white screen issue when >= 64GB DRAM
    
    commit ef064187a9709393a981a56cce1e31880fd97107 upstream.
    
    Dropping bit 31:4 of page table base is wrong, it makes page table
    base points to wrong address if phys addr is beyond 64GB; dropping
    page_table_start/end bit 31:4 is unnecessary since dcn20_vmid_setup
    will do that. Also, while we are at it, cleanup the assignments using
    upper_32_bits()/lower_32_bits() and AMDGPU_GPU_PAGE_SHIFT.
    
    Cc: [email protected]
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2354
    Fixes: 81d0bcf99009 ("drm/amdgpu: make display pinning more flexible (v2)")
    Acked-by: Harry Wentland <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Yifan Zhang <[email protected]>
    Co-developed-by: Hamza Mahfooz <[email protected]>
    Signed-off-by: Hamza Mahfooz <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: Fix underflow issue on 175hz timing [+ + +]
Author: Leo Ma <[email protected]>
Date:   Thu Jul 6 16:17:03 2023 -0400

    drm/amd/display: Fix underflow issue on 175hz timing
    
    [ Upstream commit 735688eb905db529efea0c78466fccc1461c3fde ]
    
    [Why]
    Screen underflows happen on 175hz timing for 3 plane overlay case.
    
    [How]
    Based on dst y prefetch value clamp to equ or oto for bandwidth
    calculation.
    
    Reviewed-by: Dillon Varone <[email protected]>
    Acked-by: Alex Hung <[email protected]>
    Signed-off-by: Leo Ma <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amd/display: Use DTBCLK as refclk instead of DPREFCLK [+ + +]
Author: Austin Zheng <[email protected]>
Date:   Wed Jul 26 10:40:48 2023 -0400

    drm/amd/display: Use DTBCLK as refclk instead of DPREFCLK
    
    [ Upstream commit 4a30cc2bd281fa176a68b5305cd3695d636152ad ]
    
    [Why]
    Flash of corruption observed when UCLK switching after transitioning
    from DTBCLK to DPREFCLK on subVP(DP) + subVP(HDMI) config
    Scenario where DPREFCLK is required instead of DTBCLK is not expected
    
    [How]
    Always set the DTBCLK source as DTBCLK0
    
    Reviewed-by: Alvin Lee <[email protected]>
    Acked-by: Tom Chung <[email protected]>
    Signed-off-by: Austin Zheng <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amdgpu: fix amdgpu_cs_p1_user_fence [+ + +]
Author: Christian König <[email protected]>
Date:   Fri Aug 25 15:28:00 2023 +0200

    drm/amdgpu: fix amdgpu_cs_p1_user_fence
    
    commit 35588314e963938dfdcdb792c9170108399377d6 upstream.
    
    The offset is just 32bits here so this can potentially overflow if
    somebody specifies a large value. Instead reduce the size to calculate
    the last possible offset.
    
    The error handling path incorrectly drops the reference to the user
    fence BO resulting in potential reference count underflow.
    
    Signed-off-by: Christian König <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/bridge: tc358762: Instruct DSI host to generate HSE packets [+ + +]
Author: Marek Vasut <[email protected]>
Date:   Thu Jun 15 22:19:00 2023 +0200

    drm/bridge: tc358762: Instruct DSI host to generate HSE packets
    
    [ Upstream commit 362fa8f6e6a05089872809f4465bab9d011d05b3 ]
    
    This bridge seems to need the HSE packet, otherwise the image is
    shifted up and corrupted at the bottom. This makes the bridge
    work with Samsung DSIM on i.MX8MM and i.MX8MP.
    
    Signed-off-by: Marek Vasut <[email protected]>
    Reviewed-by: Sam Ravnborg <[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]>

 
drm/edid: Add quirk for OSVR HDK 2.0 [+ + +]
Author: Ralph Campbell <[email protected]>
Date:   Tue Jun 20 23:19:03 2023 -0700

    drm/edid: Add quirk for OSVR HDK 2.0
    
    [ Upstream commit 98d4cb705bc00afd4a9a71cc1e84f7111682639a ]
    
    The OSVR virtual reality headset HDK 2.0 uses a different EDID
    vendor and device identifier than the HDK 1.1 - 1.4 headsets.
    Add the HDK 2.0 vendor and device identifier to the quirks table so
    that window managers do not try to display the desktop screen on the
    headset display.
    
    Closes: https://gitlab.freedesktop.org/drm/misc/-/issues/30
    Signed-off-by: Ralph Campbell <[email protected]>
    Tested-by: Ralph Campbell <[email protected]>
    Signed-off-by: Jani Nikula <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[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/mediatek: dp: Change logging to dev for mtk_dp_aux_transfer() [+ + +]
Author: AngeloGioacchino Del Regno <[email protected]>
Date:   Tue Jul 25 09:32:26 2023 +0200

    drm/mediatek: dp: Change logging to dev for mtk_dp_aux_transfer()
    
    [ Upstream commit fd70e2019bfbcb0ed90c5e23839bf510ce6acf8f ]
    
    Change logging from drm_{err,info}() to dev_{err,info}() in functions
    mtk_dp_aux_transfer() and mtk_dp_aux_do_transfer(): this will be
    essential to avoid getting NULL pointer kernel panics if any kind
    of error happens during AUX transfers happening before the bridge
    is attached.
    
    This may potentially start happening in a later commit implementing
    aux-bus support, as AUX transfers will be triggered from the panel
    driver (for EDID) before the mtk-dp bridge gets attached, and it's
    done in preparation for the same.
    
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Tested-by: Chen-Yu Tsai <[email protected]>
    Reviewed-by: CK Hu <[email protected]>
    Reviewed-by: Alexandre Mergnat <[email protected]>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/
    Signed-off-by: Chun-Kuang Hu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm: gm12u320: Fix the timeout usage for usb_bulk_msg() [+ + +]
Author: Jinjie Ruan <[email protected]>
Date:   Mon Sep 4 10:14:20 2023 +0800

    drm: gm12u320: Fix the timeout usage for usb_bulk_msg()
    
    [ Upstream commit 7583028d359db3cd0072badcc576b4f9455fd27a ]
    
    The timeout arg of usb_bulk_msg() is ms already, which has been converted
    to jiffies by msecs_to_jiffies() in usb_start_wait_urb(). So fix the usage
    by removing the redundant msecs_to_jiffies() in the macros.
    
    And as Hans suggested, also remove msecs_to_jiffies() for the IDLE_TIMEOUT
    macro to make it consistent here and so change IDLE_TIMEOUT to
    msecs_to_jiffies(IDLE_TIMEOUT) where it is used.
    
    Fixes: e4f86e437164 ("drm: Add Grain Media GM12U320 driver v2")
    Signed-off-by: Jinjie Ruan <[email protected]>
    Suggested-by: Hans de Goede <[email protected]>
    Reviewed-by: Hans de Goede <[email protected]>
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[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]>

 
ext4: fix rec_len verify error [+ + +]
Author: Shida Zhang <[email protected]>
Date:   Thu Aug 3 14:09:38 2023 +0800

    ext4: fix rec_len verify error
    
    commit 7fda67e8c3ab6069f75888f67958a6d30454a9f6 upstream.
    
    With the configuration PAGE_SIZE 64k and filesystem blocksize 64k,
    a problem occurred when more than 13 million files were directly created
    under a directory:
    
    EXT4-fs error (device xx): ext4_dx_csum_set:492: inode #xxxx: comm xxxxx: dir seems corrupt?  Run e2fsck -D.
    EXT4-fs error (device xx): ext4_dx_csum_verify:463: inode #xxxx: comm xxxxx: dir seems corrupt?  Run e2fsck -D.
    EXT4-fs error (device xx): dx_probe:856: inode #xxxx: block 8188: comm xxxxx: Directory index failed checksum
    
    When enough files are created, the fake_dirent->reclen will be 0xffff.
    it doesn't equal to the blocksize 65536, i.e. 0x10000.
    
    But it is not the same condition when blocksize equals to 4k.
    when enough files are created, the fake_dirent->reclen will be 0x1000.
    it equals to the blocksize 4k, i.e. 0x1000.
    
    The problem seems to be related to the limitation of the 16-bit field
    when the blocksize is set to 64k.
    To address this, helpers like ext4_rec_len_{from,to}_disk has already
    been introduced to complete the conversion between the encoded and the
    plain form of rec_len.
    
    So fix this one by using the helper, and all the other in this file too.
    
    Cc: [email protected]
    Fixes: dbe89444042a ("ext4: Calculate and verify checksums for htree nodes")
    Suggested-by: Andreas Dilger <[email protected]>
    Suggested-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Shida Zhang <[email protected]>
    Reviewed-by: Andreas Dilger <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[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]>

 
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]>

 
i2c: aspeed: Reset the i2c controller when timeout occurs [+ + +]
Author: Tommy Huang <[email protected]>
Date:   Wed Sep 6 08:49:10 2023 +0800

    i2c: aspeed: Reset the i2c controller when timeout occurs
    
    commit fee465150b458351b6d9b9f66084f3cc3022b88b upstream.
    
    Reset the i2c controller when an i2c transfer timeout occurs.
    The remaining interrupts and device should be reset to avoid
    unpredictable controller behavior.
    
    Fixes: 2e57b7cebb98 ("i2c: aspeed: Add multi-master use case support")
    Cc: <[email protected]> # v5.1+
    Signed-off-by: Tommy Huang <[email protected]>
    Reviewed-by: Andi Shyti <[email protected]>
    Signed-off-by: Wolfram Sang <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ice: Don't tx before switchdev is fully configured [+ + +]
Author: Wojciech Drewek <[email protected]>
Date:   Wed Jul 12 13:03:28 2023 +0200

    ice: Don't tx before switchdev is fully configured
    
    [ Upstream commit 7aa529a69e92b9aff585e569d5003f7c15d8d60b ]
    
    There is possibility that ice_eswitch_port_start_xmit might be
    called while some resources are still not allocated which might
    cause NULL pointer dereference. Fix this by checking if switchdev
    configuration was finished.
    
    Reviewed-by: Paul Menzel <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Wojciech Drewek <[email protected]>
    Tested-by: Sujai Buvaneswaran <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
interconnect: Fix locking for runpm vs reclaim [+ + +]
Author: Rob Clark <[email protected]>
Date:   Mon Aug 7 10:11:40 2023 -0700

    interconnect: Fix locking for runpm vs reclaim
    
    [ Upstream commit af42269c3523492d71ebbe11fefae2653e9cdc78 ]
    
    For cases where icc_bw_set() can be called in callbaths that could
    deadlock against shrinker/reclaim, such as runpm resume, we need to
    decouple the icc locking.  Introduce a new icc_bw_lock for cases where
    we need to serialize bw aggregation and update to decouple that from
    paths that require memory allocation such as node/link creation/
    destruction.
    
    Fixes this lockdep splat:
    
       ======================================================
       WARNING: possible circular locking dependency detected
       6.2.0-rc8-debug+ #554 Not tainted
       ------------------------------------------------------
       ring0/132 is trying to acquire lock:
       ffffff80871916d0 (&gmu->lock){+.+.}-{3:3}, at: a6xx_pm_resume+0xf0/0x234
    
       but task is already holding lock:
       ffffffdb5aee57e8 (dma_fence_map){++++}-{0:0}, at: msm_job_run+0x68/0x150
    
       which lock already depends on the new lock.
    
       the existing dependency chain (in reverse order) is:
    
       -> #4 (dma_fence_map){++++}-{0:0}:
              __dma_fence_might_wait+0x74/0xc0
              dma_resv_lockdep+0x1f4/0x2f4
              do_one_initcall+0x104/0x2bc
              kernel_init_freeable+0x344/0x34c
              kernel_init+0x30/0x134
              ret_from_fork+0x10/0x20
    
       -> #3 (mmu_notifier_invalidate_range_start){+.+.}-{0:0}:
              fs_reclaim_acquire+0x80/0xa8
              slab_pre_alloc_hook.constprop.0+0x40/0x25c
              __kmem_cache_alloc_node+0x60/0x1cc
              __kmalloc+0xd8/0x100
              topology_parse_cpu_capacity+0x8c/0x178
              get_cpu_for_node+0x88/0xc4
              parse_cluster+0x1b0/0x28c
              parse_cluster+0x8c/0x28c
              init_cpu_topology+0x168/0x188
              smp_prepare_cpus+0x24/0xf8
              kernel_init_freeable+0x18c/0x34c
              kernel_init+0x30/0x134
              ret_from_fork+0x10/0x20
    
       -> #2 (fs_reclaim){+.+.}-{0:0}:
              __fs_reclaim_acquire+0x3c/0x48
              fs_reclaim_acquire+0x54/0xa8
              slab_pre_alloc_hook.constprop.0+0x40/0x25c
              __kmem_cache_alloc_node+0x60/0x1cc
              __kmalloc+0xd8/0x100
              kzalloc.constprop.0+0x14/0x20
              icc_node_create_nolock+0x4c/0xc4
              icc_node_create+0x38/0x58
              qcom_icc_rpmh_probe+0x1b8/0x248
              platform_probe+0x70/0xc4
              really_probe+0x158/0x290
              __driver_probe_device+0xc8/0xe0
              driver_probe_device+0x44/0x100
              __driver_attach+0xf8/0x108
              bus_for_each_dev+0x78/0xc4
              driver_attach+0x2c/0x38
              bus_add_driver+0xd0/0x1d8
              driver_register+0xbc/0xf8
              __platform_driver_register+0x30/0x3c
              qnoc_driver_init+0x24/0x30
              do_one_initcall+0x104/0x2bc
              kernel_init_freeable+0x344/0x34c
              kernel_init+0x30/0x134
              ret_from_fork+0x10/0x20
    
       -> #1 (icc_lock){+.+.}-{3:3}:
              __mutex_lock+0xcc/0x3c8
              mutex_lock_nested+0x30/0x44
              icc_set_bw+0x88/0x2b4
              _set_opp_bw+0x8c/0xd8
              _set_opp+0x19c/0x300
              dev_pm_opp_set_opp+0x84/0x94
              a6xx_gmu_resume+0x18c/0x804
              a6xx_pm_resume+0xf8/0x234
              adreno_runtime_resume+0x2c/0x38
              pm_generic_runtime_resume+0x30/0x44
              __rpm_callback+0x15c/0x174
              rpm_callback+0x78/0x7c
              rpm_resume+0x318/0x524
              __pm_runtime_resume+0x78/0xbc
              adreno_load_gpu+0xc4/0x17c
              msm_open+0x50/0x120
              drm_file_alloc+0x17c/0x228
              drm_open_helper+0x74/0x118
              drm_open+0xa0/0x144
              drm_stub_open+0xd4/0xe4
              chrdev_open+0x1b8/0x1e4
              do_dentry_open+0x2f8/0x38c
              vfs_open+0x34/0x40
              path_openat+0x64c/0x7b4
              do_filp_open+0x54/0xc4
              do_sys_openat2+0x9c/0x100
              do_sys_open+0x50/0x7c
              __arm64_sys_openat+0x28/0x34
              invoke_syscall+0x8c/0x128
              el0_svc_common.constprop.0+0xa0/0x11c
              do_el0_svc+0xac/0xbc
              el0_svc+0x48/0xa0
              el0t_64_sync_handler+0xac/0x13c
              el0t_64_sync+0x190/0x194
    
       -> #0 (&gmu->lock){+.+.}-{3:3}:
              __lock_acquire+0xe00/0x1060
              lock_acquire+0x1e0/0x2f8
              __mutex_lock+0xcc/0x3c8
              mutex_lock_nested+0x30/0x44
              a6xx_pm_resume+0xf0/0x234
              adreno_runtime_resume+0x2c/0x38
              pm_generic_runtime_resume+0x30/0x44
              __rpm_callback+0x15c/0x174
              rpm_callback+0x78/0x7c
              rpm_resume+0x318/0x524
              __pm_runtime_resume+0x78/0xbc
              pm_runtime_get_sync.isra.0+0x14/0x20
              msm_gpu_submit+0x58/0x178
              msm_job_run+0x78/0x150
              drm_sched_main+0x290/0x370
              kthread+0xf0/0x100
              ret_from_fork+0x10/0x20
    
       other info that might help us debug this:
    
       Chain exists of:
         &gmu->lock --> mmu_notifier_invalidate_range_start --> dma_fence_map
    
        Possible unsafe locking scenario:
    
              CPU0                    CPU1
              ----                    ----
         lock(dma_fence_map);
                                      lock(mmu_notifier_invalidate_range_start);
                                      lock(dma_fence_map);
         lock(&gmu->lock);
    
        *** DEADLOCK ***
    
       2 locks held by ring0/132:
        #0: ffffff8087191170 (&gpu->lock){+.+.}-{3:3}, at: msm_job_run+0x64/0x150
        #1: ffffffdb5aee57e8 (dma_fence_map){++++}-{0:0}, at: msm_job_run+0x68/0x150
    
       stack backtrace:
       CPU: 7 PID: 132 Comm: ring0 Not tainted 6.2.0-rc8-debug+ #554
       Hardware name: Google Lazor (rev1 - 2) with LTE (DT)
       Call trace:
        dump_backtrace.part.0+0xb4/0xf8
        show_stack+0x20/0x38
        dump_stack_lvl+0x9c/0xd0
        dump_stack+0x18/0x34
        print_circular_bug+0x1b4/0x1f0
        check_noncircular+0x78/0xac
        __lock_acquire+0xe00/0x1060
        lock_acquire+0x1e0/0x2f8
        __mutex_lock+0xcc/0x3c8
        mutex_lock_nested+0x30/0x44
        a6xx_pm_resume+0xf0/0x234
        adreno_runtime_resume+0x2c/0x38
        pm_generic_runtime_resume+0x30/0x44
        __rpm_callback+0x15c/0x174
        rpm_callback+0x78/0x7c
        rpm_resume+0x318/0x524
        __pm_runtime_resume+0x78/0xbc
        pm_runtime_get_sync.isra.0+0x14/0x20
        msm_gpu_submit+0x58/0x178
        msm_job_run+0x78/0x150
        drm_sched_main+0x290/0x370
        kthread+0xf0/0x100
        ret_from_fork+0x10/0x20
    
    Signed-off-by: Rob Clark <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Georgi Djakov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

interconnect: Teach lockdep about icc_bw_lock order [+ + +]
Author: Rob Clark <[email protected]>
Date:   Mon Aug 7 10:11:41 2023 -0700

    interconnect: Teach lockdep about icc_bw_lock order
    
    commit 13619170303878e1dae86d9a58b039475c957fcf upstream.
    
    Teach lockdep that icc_bw_lock is needed in code paths that could
    deadlock if they trigger reclaim.
    
    Signed-off-by: Rob Clark <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Georgi Djakov <[email protected]>
    Cc: Guenter Roeck <[email protected]>
    Cc: Jon Hunter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/net: fix iter retargeting for selected buf [+ + +]
Author: Pavel Begunkov <[email protected]>
Date:   Thu Sep 14 16:51:09 2023 +0100

    io_uring/net: fix iter retargeting for selected buf
    
    commit c21a8027ad8a68c340d0d58bf1cc61dcb0bc4d2f upstream.
    
    When using selected buffer feature, io_uring delays data iter setup
    until later. If io_setup_async_msg() is called before that it might see
    not correctly setup iterator. Pre-init nr_segs and judge from its state
    whether we repointing.
    
    Cc: [email protected]
    Reported-by: [email protected]
    Fixes: 0455d4ccec548 ("io_uring: add POLL_FIRST support for send/sendmsg and recv/recvmsg")
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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]>

 
kernel/fork: beware of __put_task_struct() calling context [+ + +]
Author: Wander Lairson Costa <[email protected]>
Date:   Wed Jun 14 09:23:21 2023 -0300

    kernel/fork: beware of __put_task_struct() calling context
    
    [ Upstream commit d243b34459cea30cfe5f3a9b2feb44e7daff9938 ]
    
    Under PREEMPT_RT, __put_task_struct() indirectly acquires sleeping
    locks. Therefore, it can't be called from an non-preemptible context.
    
    One practical example is splat inside inactive_task_timer(), which is
    called in a interrupt context:
    
      CPU: 1 PID: 2848 Comm: life Kdump: loaded Tainted: G W ---------
       Hardware name: HP ProLiant DL388p Gen8, BIOS P70 07/15/2012
       Call Trace:
       dump_stack_lvl+0x57/0x7d
       mark_lock_irq.cold+0x33/0xba
       mark_lock+0x1e7/0x400
       mark_usage+0x11d/0x140
       __lock_acquire+0x30d/0x930
       lock_acquire.part.0+0x9c/0x210
       rt_spin_lock+0x27/0xe0
       refill_obj_stock+0x3d/0x3a0
       kmem_cache_free+0x357/0x560
       inactive_task_timer+0x1ad/0x340
       __run_hrtimer+0x8a/0x1a0
       __hrtimer_run_queues+0x91/0x130
       hrtimer_interrupt+0x10f/0x220
       __sysvec_apic_timer_interrupt+0x7b/0xd0
       sysvec_apic_timer_interrupt+0x4f/0xd0
       asm_sysvec_apic_timer_interrupt+0x12/0x20
       RIP: 0033:0x7fff196bf6f5
    
    Instead of calling __put_task_struct() directly, we defer it using
    call_rcu(). A more natural approach would use a workqueue, but since
    in PREEMPT_RT, we can't allocate dynamic memory from atomic context,
    the code would become more complex because we would need to put the
    work_struct instance in the task_struct and initialize it when we
    allocate a new task_struct.
    
    The issue is reproducible with stress-ng:
    
      while true; do
          stress-ng --sched deadline --sched-period 1000000000 \
                  --sched-runtime 800000000 --sched-deadline \
                  1000000000 --mmapfork 23 -t 20
      done
    
    Reported-by: Hu Chunyu <[email protected]>
    Suggested-by: Oleg Nesterov <[email protected]>
    Suggested-by: Valentin Schneider <[email protected]>
    Suggested-by: Peter Zijlstra <[email protected]>
    Signed-off-by: Wander Lairson Costa <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Link: https://lore.kernel.org/r/[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]>

 
libbpf: Free btf_vmlinux when closing bpf_object [+ + +]
Author: Hao Luo <[email protected]>
Date:   Tue Aug 22 12:38:40 2023 -0700

    libbpf: Free btf_vmlinux when closing bpf_object
    
    [ Upstream commit 29d67fdebc42af6466d1909c60fdd1ef4f3e5240 ]
    
    I hit a memory leak when testing bpf_program__set_attach_target().
    Basically, set_attach_target() may allocate btf_vmlinux, for example,
    when setting attach target for bpf_iter programs. But btf_vmlinux
    is freed only in bpf_object_load(), which means if we only open
    bpf object but not load it, setting attach target may leak
    btf_vmlinux.
    
    So let's free btf_vmlinux in bpf_object__close() anyway.
    
    Signed-off-by: Hao Luo <[email protected]>
    Signed-off-by: Andrii Nakryiko <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Linux 6.1.55 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat Sep 23 11:11:13 2023 +0200

    Linux 6.1.55
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: SeongJae Park <[email protected]>
    Tested-by: Salvatore Bonaccorso <[email protected]>
    Tested-by: Florian Fainelli <[email protected]>
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Bagas Sanjaya <[email protected]>
    Tested-by: Takeshi Ogasawara <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Joel Fernandes (Google) <[email protected]>
    Tested-by: Conor Dooley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock [+ + +]
Author: Will Shiu <[email protected]>
Date:   Fri Jul 21 13:19:04 2023 +0800

    locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock
    
    [ Upstream commit 74f6f5912693ce454384eaeec48705646a21c74f ]
    
    As following backtrace, the struct file_lock request , in posix_lock_inode
    is free before ftrace function using.
    Replace the ftrace function ahead free flow could fix the use-after-free
    issue.
    
    [name:report&]===============================================
    BUG:KASAN: use-after-free in trace_event_raw_event_filelock_lock+0x80/0x12c
    [name:report&]Read at addr f6ffff8025622620 by task NativeThread/16753
    [name:report_hw_tags&]Pointer tag: [f6], memory tag: [fe]
    [name:report&]
    BT:
    Hardware name: MT6897 (DT)
    Call trace:
     dump_backtrace+0xf8/0x148
     show_stack+0x18/0x24
     dump_stack_lvl+0x60/0x7c
     print_report+0x2c8/0xa08
     kasan_report+0xb0/0x120
     __do_kernel_fault+0xc8/0x248
     do_bad_area+0x30/0xdc
     do_tag_check_fault+0x1c/0x30
     do_mem_abort+0x58/0xbc
     el1_abort+0x3c/0x5c
     el1h_64_sync_handler+0x54/0x90
     el1h_64_sync+0x68/0x6c
     trace_event_raw_event_filelock_lock+0x80/0x12c
     posix_lock_inode+0xd0c/0xd60
     do_lock_file_wait+0xb8/0x190
     fcntl_setlk+0x2d8/0x440
    ...
    [name:report&]
    [name:report&]Allocated by task 16752:
    ...
     slab_post_alloc_hook+0x74/0x340
     kmem_cache_alloc+0x1b0/0x2f0
     posix_lock_inode+0xb0/0xd60
    ...
     [name:report&]
     [name:report&]Freed by task 16752:
    ...
      kmem_cache_free+0x274/0x5b0
      locks_dispose_list+0x3c/0x148
      posix_lock_inode+0xc40/0xd60
      do_lock_file_wait+0xb8/0x190
      fcntl_setlk+0x2d8/0x440
      do_fcntl+0x150/0xc18
    ...
    
    Signed-off-by: Will Shiu <[email protected]>
    Signed-off-by: Jeff Layton <[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: Put the right device in md_seq_next [+ + +]
Author: Mariusz Tkaczyk <[email protected]>
Date:   Thu Sep 14 17:24:16 2023 +0200

    md: Put the right device in md_seq_next
    
    commit c8870379a21fbd9ad14ca36204ccfbe9d25def43 upstream.
    
    If there are multiple arrays in system and one mddevice is marked
    with MD_DELETED and md_seq_next() is called in the middle of removal
    then it _get()s proper device but it may _put() deleted one. As a result,
    active counter may never be zeroed for mddevice and it cannot
    be removed.
    
    Put the device which has been _get with previous md_seq_next() call.
    
    Cc: [email protected]
    Fixes: 12a6caf27324 ("md: only delete entries from all_mddevs when the disk is freed")
    Reported-by: AceLan Kao <[email protected]>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217798
    Cc: Yu Kuai <[email protected]>
    Signed-off-by: Mariusz Tkaczyk <[email protected]>
    Signed-off-by: Song Liu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[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: 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-v2: gl861: Fix null-ptr-deref in gl861_i2c_master_xfer [+ + +]
Author: Zhang Shurong <[email protected]>
Date:   Mon Jul 10 13:32:13 2023 +0800

    media: dvb-usb-v2: gl861: Fix null-ptr-deref in gl861_i2c_master_xfer
    
    [ Upstream commit b97719a66970601cd3151a3e2020f4454a1c4ff6 ]
    
    In gl861_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 gl861_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]>

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: mdp3: Fix resource leaks in of_find_device_by_node [+ + +]
Author: Lu Hongfei <[email protected]>
Date:   Tue May 30 18:17:18 2023 +0800

    media: mdp3: Fix resource leaks in of_find_device_by_node
    
    [ Upstream commit 35ca8ce495366909b4c2e701d1356570dd40c4e2 ]
    
    Use put_device to release the object get through of_find_device_by_node,
    avoiding resource leaks.
    
    Signed-off-by: Lu Hongfei <[email protected]>
    Signed-off-by: Hans Verkuil <[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]>

 
MIPS: Use "grep -E" instead of "egrep" [+ + +]
Author: Tiezhu Yang <[email protected]>
Date:   Fri Nov 18 16:28:11 2022 +0800

    MIPS: Use "grep -E" instead of "egrep"
    
    [ Upstream commit d42f0c6ad502c9f612410e125ebdf290cce8bdc3 ]
    
    The latest version of grep claims the egrep is now obsolete so the build
    now contains warnings that look like:
            egrep: warning: egrep is obsolescent; using grep -E
    fix this up by moving the related file to use "grep -E" instead.
    
    Here are the steps to install the latest grep:
    
      wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz
      tar xf grep-3.8.tar.gz
      cd grep-3.8 && ./configure && make
      sudo make install
      export PATH=/usr/local/bin:$PATH
    
    Signed-off-by: Tiezhu Yang <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Stable-dep-of: 4fe4a6374c4d ("MIPS: Only fiddle with CHECKFLAGS if `need-compiler'")
    Signed-off-by: Sasha Levin <[email protected]>

 
misc: fastrpc: Fix incorrect DMA mapping unmap request [+ + +]
Author: Ekansh Gupta <[email protected]>
Date:   Fri Aug 11 12:56:42 2023 +0100

    misc: fastrpc: Fix incorrect DMA mapping unmap request
    
    [ Upstream commit a2cb9cd6a3949a3804ad9fd7da234892ce6719ec ]
    
    Scatterlist table is obtained during map create request and the same
    table is used for DMA mapping unmap. In case there is any failure
    while getting the sg_table, ERR_PTR is returned instead of sg_table.
    
    When the map is getting freed, there is only a non-NULL check of
    sg_table which will also be true in case failure was returned instead
    of sg_table. This would result in improper unmap request. Add proper
    check before setting map table to avoid bad unmap request.
    
    Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
    Cc: stable <[email protected]>
    Signed-off-by: Ekansh Gupta <[email protected]>
    Signed-off-by: Srinivas Kandagatla <[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]>

misc: fastrpc: Prepare to dynamic dma-buf locking specification [+ + +]
Author: Dmitry Osipenko <[email protected]>
Date:   Mon Oct 17 20:22:19 2022 +0300

    misc: fastrpc: Prepare to dynamic dma-buf locking specification
    
    [ Upstream commit 791da5c7fedbc1d662445ec030d8f86872f6184c ]
    
    Prepare fastrpc to the common dynamic dma-buf locking convention by
    starting to use the unlocked versions of dma-buf API functions.
    
    Acked-by: Christian König <[email protected]>
    Acked-by: Srinivas Kandagatla <[email protected]>
    Signed-off-by: Dmitry Osipenko <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: a2cb9cd6a394 ("misc: fastrpc: Fix incorrect DMA mapping unmap request")
    Signed-off-by: Sasha Levin <[email protected]>

misc: open-dice: make OPEN_DICE depend on HAS_IOMEM [+ + +]
Author: Baoquan He <[email protected]>
Date:   Fri Jul 7 21:58:47 2023 +0800

    misc: open-dice: make OPEN_DICE depend on HAS_IOMEM
    
    [ Upstream commit aefc8b57af7787c80686e49a5841e9289cb11f53 ]
    
    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 OPEN_DICE depend on HAS_IOMEM so that it won't be built
    to cause below compiling error if PCI is unset:
    
    ------
    ERROR: modpost: "devm_memremap" [drivers/misc/open-dice.ko] undefined!
    ERROR: modpost: "devm_memunmap" [drivers/misc/open-dice.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: Derek Kiernan <[email protected]>
    Cc: Dragan Cvetic <[email protected]>
    Cc: Arnd Bergmann <[email protected]>
    Cc: Greg Kroah-Hartman <[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]>

 
mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 [+ + +]
Author: Giulio Benetti <[email protected]>
Date:   Fri Aug 11 23:48:53 2023 +0200

    mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450
    
    [ Upstream commit 5ae4b0d8875caa44946e579420c7fd5740d58653 ]
    
    Errata ERR010450 only shows up if voltage is 1.8V, but if the device is
    supplied by 3v3 the errata can be ignored. So let's check for if quirk
    SDHCI_QUIRK2_NO_1_8_V is defined or not before limiting the frequency.
    
    Cc: Jim Reinhart <[email protected]>
    Cc: James Autry <[email protected]>
    Cc: Matthew Maron <[email protected]>
    Signed-off-by: Giulio Benetti <[email protected]>
    Acked-by: Haibo Chen <[email protected]>
    Acked-by: Adrian Hunter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mt76: mt7921: don't assume adequate headroom for SDIO headers [+ + +]
Author: Matt Whitlock <[email protected]>
Date:   Thu Apr 20 15:24:51 2023 -0400

    mt76: mt7921: don't assume adequate headroom for SDIO headers
    
    [ Upstream commit 98c4d0abf5c478db1ad126ff0c187dbb84c0803c ]
    
    mt7921_usb_sdio_tx_prepare_skb() calls mt7921_usb_sdio_write_txwi() and
    mt7921_skb_add_usb_sdio_hdr(), both of which blindly assume that
    adequate headroom will be available in the passed skb. This assumption
    typically is satisfied when the skb was allocated in the net core for
    transmission via the mt7921 netdev (although even that is only an
    optimization and is not strictly guaranteed), but the assumption is
    sometimes not satisfied when the skb originated in the receive path of
    another netdev and was passed through to the mt7921, such as by the
    bridge layer. Blindly prepending bytes to an skb is always wrong.
    
    This commit introduces a call to skb_cow_head() before the call to
    mt7921_usb_sdio_write_txwi() in mt7921_usb_sdio_tx_prepare_skb() to
    ensure that at least MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE bytes can be
    pushed onto the skb.
    
    Without this fix, I can trivially cause kernel panics by bridging an
    MT7921AU-based USB 802.11ax interface with an Ethernet interface on an
    Intel Atom-based x86 system using its onboard RTL8169 PCI Ethernet
    adapter and also on an ARM-based Raspberry Pi 1 using its onboard
    SMSC9512 USB Ethernet adapter. Note that the panics do not occur in
    every system configuration, as they occur only if the receiving netdev
    leaves less headroom in its received skbs than the mt7921 needs for its
    SDIO headers.
    
    Here is an example stack trace of this panic on Raspberry Pi OS Lite
    2023-02-21 running kernel 6.1.24+ [1]:
    
     skb_panic from skb_push+0x44/0x48
     skb_push from mt7921_usb_sdio_tx_prepare_skb+0xd4/0x190 [mt7921_common]
     mt7921_usb_sdio_tx_prepare_skb [mt7921_common] from mt76u_tx_queue_skb+0x94/0x1d0 [mt76_usb]
     mt76u_tx_queue_skb [mt76_usb] from __mt76_tx_queue_skb+0x4c/0xc8 [mt76]
     __mt76_tx_queue_skb [mt76] from mt76_txq_schedule.part.0+0x13c/0x398 [mt76]
     mt76_txq_schedule.part.0 [mt76] from mt76_txq_schedule_all+0x24/0x30 [mt76]
     mt76_txq_schedule_all [mt76] from mt7921_tx_worker+0x58/0xf4 [mt7921_common]
     mt7921_tx_worker [mt7921_common] from __mt76_worker_fn+0x9c/0xec [mt76]
     __mt76_worker_fn [mt76] from kthread+0xbc/0xe0
     kthread from ret_from_fork+0x14/0x34
    
    After this fix, bridging the mt7921 interface works fine on both of my
    previously problematic systems.
    
    [1] https://github.com/raspberrypi/firmware/tree/5c276f55a4b21345cd4d6200a504ee991851ff7a
    
    Link: https://github.com/openwrt/openwrt/issues/11796
    Signed-off-by: Matt Whitlock <[email protected]>
    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/ipv4: return the real errno instead of -EINVAL [+ + +]
Author: xu xin <[email protected]>
Date:   Mon Aug 7 01:54:08 2023 +0000

    net/ipv4: return the real errno instead of -EINVAL
    
    [ Upstream commit c67180efc507e04a87f22aa68bd7dd832db006b7 ]
    
    For now, No matter what error pointer ip_neigh_for_gw() returns,
    ip_finish_output2() always return -EINVAL, which may mislead the upper
    users.
    
    For exemple, an application uses sendto to send an UDP packet, but when the
    neighbor table overflows, sendto() will get a value of -EINVAL, and it will
    cause users to waste a lot of time checking parameters for errors.
    
    Return the real errno instead of -EINVAL.
    
    Signed-off-by: xu xin <[email protected]>
    Reviewed-by: Yang Yang <[email protected]>
    Cc: Si Hao <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Vadim Fedorenko <[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/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: Use sockaddr_storage for getsockopt(SO_PEERNAME). [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Fri Jul 28 17:48:13 2023 -0700

    net: Use sockaddr_storage for getsockopt(SO_PEERNAME).
    
    [ Upstream commit 8936bf53a091ad6a34b480c22002f1cb2422ab38 ]
    
    Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") started
    applying strict rules to standard string functions.
    
    It does not work well with conventional socket code around each protocol-
    specific sockaddr_XXX struct, which is cast from sockaddr_storage and has
    a bigger size than fortified functions expect.  See these commits:
    
     commit 06d4c8a80836 ("af_unix: Fix fortify_panic() in unix_bind_bsd().")
     commit ecb4534b6a1c ("af_unix: Terminate sun_path when bind()ing pathname socket.")
     commit a0ade8404c3b ("af_packet: Fix warning of fortified memcpy() in packet_getname().")
    
    We must cast the protocol-specific address back to sockaddr_storage
    to call such functions.
    
    However, in the case of getsockaddr(SO_PEERNAME), the rationale is a bit
    unclear as the buffer is defined by char[128] which is the same size as
    sockaddr_storage.
    
    Let's use sockaddr_storage explicitly.
    
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfilter: ebtables: fix fortify warnings in size_entry_mwt() [+ + +]
Author: GONG, Ruiqi <[email protected]>
Date:   Wed Aug 9 15:45:03 2023 +0800

    netfilter: ebtables: fix fortify warnings in size_entry_mwt()
    
    [ Upstream commit a7ed3465daa240bdf01a5420f64336fee879c09d ]
    
    When compiling with gcc 13 and CONFIG_FORTIFY_SOURCE=y, the following
    warning appears:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘size_entry_mwt’ at net/bridge/netfilter/ebtables.c:2118:2:
    ./include/linux/fortify-string.h:592:25: 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);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The compiler is complaining:
    
    memcpy(&offsets[1], &entry->watchers_offset,
                           sizeof(offsets) - sizeof(offsets[0]));
    
    where memcpy reads beyong &entry->watchers_offset to copy
    {watchers,target,next}_offset altogether into offsets[]. Silence the
    warning by wrapping these three up via struct_group().
    
    Signed-off-by: GONG, Ruiqi <[email protected]>
    Reviewed-by: Gustavo A. R. Silva <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netlink: convert nlk->flags to atomic flags [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Aug 11 07:22:26 2023 +0000

    netlink: convert nlk->flags to atomic flags
    
    [ Upstream commit 8fe08d70a2b61b35a0a1235c78cf321e7528351f ]
    
    sk_diag_put_flags(), netlink_setsockopt(), netlink_getsockopt()
    and others use nlk->flags without correct locking.
    
    Use set_bit(), clear_bit(), test_bit(), assign_bit() to remove
    data-races.
    
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[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]>

 
nvme: avoid bogus CRTO values [+ + +]
Author: Keith Busch <[email protected]>
Date:   Tue Sep 12 14:38:58 2023 -0700

    nvme: avoid bogus CRTO values
    
    commit 6cc834ba62998c65c42d0c63499bdd35067151ec upstream.
    
    Some devices are reporting controller ready mode support, but return 0
    for CRTO. These devices require a much higher time to ready than that,
    so they are failing to initialize after the driver starter preferring
    that value over CAP.TO.
    
    The spec requires that CAP.TO match the appropritate CRTO value, or be
    set to 0xff if CRTO is larger than that. This means that CAP.TO can be
    used to validate if CRTO is reliable, and provides an appropriate
    fallback for setting the timeout value if not. Use whichever is larger.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217863
    Reported-by: Cláudio Sampaio <[email protected]>
    Reported-by: Felix Yan <[email protected]>
    Tested-by: Felix Yan <[email protected]>
    Based-on-a-patch-by: Felix Yan <[email protected]>
    Cc: [email protected]
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() [+ + +]
Author: Varun Prakash <[email protected]>
Date:   Wed Aug 9 15:56:45 2023 +0530

    nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
    
    [ Upstream commit 1f0bbf28940cf5edad90ab57b62aa8197bf5e836 ]
    
    iov_len is the valid data length, so pass iov_len instead of sg->length to
    bvec_set_page().
    
    Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM")
    Signed-off-by: Rakshana Sridhar <[email protected]>
    Signed-off-by: Varun Prakash <[email protected]>
    Reviewed-by: Sagi Grimberg <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nvmet: use bvec_set_page to initialize bvecs [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Fri Feb 3 16:06:17 2023 +0100

    nvmet: use bvec_set_page to initialize bvecs
    
    [ Upstream commit fc41c97a3a7b08131e6998bc7692f95729f9d359 ]
    
    Use the bvec_set_page helper to initialize bvecs.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Chaitanya Kulkarni <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Stable-dep-of: 1f0bbf28940c ("nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()")
    Signed-off-by: Sasha Levin <[email protected]>

 
ovl: fix failed copyup of fileattr on a symlink [+ + +]
Author: Amir Goldstein <[email protected]>
Date:   Mon Sep 4 14:17:56 2023 +0300

    ovl: fix failed copyup of fileattr on a symlink
    
    commit ab048302026d7701e7fbd718917e0dbcff0c4223 upstream.
    
    Some local filesystems support setting persistent fileattr flags
    (e.g. FS_NOATIME_FL) on directories and regular files via ioctl.
    Some of those persistent fileattr flags are reflected to vfs as
    in-memory inode flags (e.g. S_NOATIME).
    
    Overlayfs uses the in-memory inode flags (e.g. S_NOATIME) on a lower file
    as an indication that a the lower file may have persistent inode fileattr
    flags (e.g. FS_NOATIME_FL) that need to be copied to upper file.
    
    However, in some cases, the S_NOATIME in-memory flag could be a false
    indication for persistent FS_NOATIME_FL fileattr. For example, with NFS
    and FUSE lower fs, as was the case in the two bug reports, the S_NOATIME
    flag is set unconditionally for all inodes.
    
    Users cannot set persistent fileattr flags on symlinks and special files,
    but in some local fs, such as ext4/btrfs/tmpfs, the FS_NOATIME_FL fileattr
    flag are inheritted to symlinks and special files from parent directory.
    
    In both cases described above, when lower symlink has the S_NOATIME flag,
    overlayfs will try to copy the symlink's fileattrs and fail with error
    ENOXIO, because it could not open the symlink for the ioctl security hook.
    
    To solve this failure, do not attempt to copyup fileattrs for anything
    other than directories and regular files.
    
    Reported-by: Ruiwen Zhao <[email protected]>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217850
    Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
    Cc: <[email protected]> # v5.15
    Reviewed-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Amir Goldstein <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ovl: fix incorrect fdput() on aio completion [+ + +]
Author: Amir Goldstein <[email protected]>
Date:   Tue Aug 22 20:50:59 2023 +0300

    ovl: fix incorrect fdput() on aio completion
    
    commit 724768a39374d35b70eaeae8dd87048a2ec7ae8e upstream.
    
    ovl_{read,write}_iter() always call fdput(real) to put one or zero
    refcounts of the real file, but for aio, whether it was submitted or not,
    ovl_aio_put() also calls fdput(), which is not balanced.  This is only a
    problem in the less common case when FDPUT_FPUT flag is set.
    
    To fix the problem use get_file() to take file refcount and use fput()
    instead of fdput() in ovl_aio_put().
    
    Fixes: 2406a307ac7d ("ovl: implement async IO routines")
    Cc: <[email protected]> # v5.6
    Reviewed-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Amir Goldstein <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
panic: Reenable preemption in WARN slowpath [+ + +]
Author: Lukas Wunner <[email protected]>
Date:   Fri Sep 15 09:55:39 2023 +0200

    panic: Reenable preemption in WARN slowpath
    
    [ Upstream commit cccd32816506cbac3a4c65d9dff51b3125ef1a03 ]
    
    Commit:
    
      5a5d7e9badd2 ("cpuidle: lib/bug: Disable rcu_is_watching() during WARN/BUG")
    
    amended warn_slowpath_fmt() to disable preemption until the WARN splat
    has been emitted.
    
    However the commit neglected to reenable preemption in the !fmt codepath,
    i.e. when a WARN splat is emitted without additional format string.
    
    One consequence is that users may see more splats than intended.  E.g. a
    WARN splat emitted in a work item results in at least two extra splats:
    
      BUG: workqueue leaked lock or atomic
      (emitted by process_one_work())
    
      BUG: scheduling while atomic
      (emitted by worker_thread() -> schedule())
    
    Ironically the point of the commit was to *avoid* extra splats. ;)
    
    Fix it.
    
    Fixes: 5a5d7e9badd2 ("cpuidle: lib/bug: Disable rcu_is_watching() during WARN/BUG")
    Signed-off-by: Lukas Wunner <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: Paul E. McKenney <[email protected]>
    Link: https://lore.kernel.org/r/3ec48fde01e4ee6505f77908ba351bad200ae3d1.1694763684.git.lukas@wunner.de
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI: dwc: Provide deinit callback for i.MX [+ + +]
Author: Mark Brown <[email protected]>
Date:   Mon Jul 31 12:55:01 2023 +0100

    PCI: dwc: Provide deinit callback for i.MX
    
    [ Upstream commit fc8b24c28bec19fc0621d108b9ee81ddfdedb25a ]
    
    The i.MX integration for the DesignWare PCI controller has a _host_exit()
    operation which undoes everything that the _host_init() operation does but
    does not wire this up as the host_deinit callback for the core, or call it
    in any path other than suspend. This means that if we ever unwind the
    initial probe of the device, for example because it fails, the regulator
    core complains that the regulators for the device were left enabled:
    
    imx6q-pcie 33800000.pcie: iATU: unroll T, 4 ob, 4 ib, align 64K, limit 16G
    imx6q-pcie 33800000.pcie: Phy link never came up
    imx6q-pcie 33800000.pcie: Phy link never came up
    imx6q-pcie: probe of 33800000.pcie failed with error -110
    ------------[ cut here ]------------
    WARNING: CPU: 2 PID: 46 at drivers/regulator/core.c:2396 _regulator_put+0x110/0x128
    
    Wire up the callback so that the core can clean up after itself.
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Fabio Estevam <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Lorenzo Pieralisi <[email protected]>
    Reviewed-by: Richard Zhu <[email protected]>
    Acked-by: Manivannan Sadhasivam <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

PCI: fu740: Set the number of MSI vectors [+ + +]
Author: Yong-Xuan Wang <[email protected]>
Date:   Mon Aug 7 05:56:21 2023 +0000

    PCI: fu740: Set the number of MSI vectors
    
    [ Upstream commit 551a60e1225e71fff8efd9390204c505b0870e0f ]
    
    The iMSI-RX module of the DW PCIe controller provides multiple sets of
    MSI_CTRL_INT_i_* registers, and each set is capable of handling 32 MSI
    interrupts. However, the fu740 PCIe controller driver only enabled one set
    of MSI_CTRL_INT_i_* registers, as the total number of supported interrupts
    was not specified.
    
    Set the supported number of MSI vectors to enable all the MSI_CTRL_INT_i_*
    registers on the fu740 PCIe core, allowing the system to fully utilize the
    available MSI interrupts.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Yong-Xuan Wang <[email protected]>
    Signed-off-by: Lorenzo Pieralisi <[email protected]>
    Reviewed-by: Serge Semin <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

PCI: vmd: Disable bridge window for domain reset [+ + +]
Author: Nirmal Patel <[email protected]>
Date:   Thu Aug 10 17:50:29 2023 -0400

    PCI: vmd: Disable bridge window for domain reset
    
    [ Upstream commit f73eedc90bf73d48e8368e6b0b4ad76a7fffaef7 ]
    
    During domain reset process vmd_domain_reset() clears PCI
    configuration space of VMD root ports. But certain platform
    has observed following errors and failed to boot.
      ...
      DMAR: VT-d detected Invalidation Queue Error: Reason f
      DMAR: VT-d detected Invalidation Time-out Error: SID ffff
      DMAR: VT-d detected Invalidation Completion Error: SID ffff
      DMAR: QI HEAD: UNKNOWN qw0 = 0x0, qw1 = 0x0
      DMAR: QI PRIOR: UNKNOWN qw0 = 0x0, qw1 = 0x0
      DMAR: Invalidation Time-out Error (ITE) cleared
    
    The root cause is that memset_io() clears prefetchable memory base/limit
    registers and prefetchable base/limit 32 bits registers sequentially.
    This seems to be enabling prefetchable memory if the device disabled
    prefetchable memory originally.
    
    Here is an example (before memset_io()):
    
      PCI configuration space for 10000:00:00.0:
      86 80 30 20 06 00 10 00 04 00 04 06 00 00 01 00
      00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 20
      00 00 00 00 01 00 01 00 ff ff ff ff 75 05 00 00
      ...
    
    So, prefetchable memory is ffffffff00000000-575000fffff, which is
    disabled. When memset_io() clears prefetchable base 32 bits register,
    the prefetchable memory becomes 0000000000000000-575000fffff, which is
    enabled and incorrect.
    
    Here is the quote from section 7.5.1.3.9 of PCI Express Base 6.0 spec:
    
      The Prefetchable Memory Limit register must be programmed to a smaller
      value than the Prefetchable Memory Base register if there is no
      prefetchable memory on the secondary side of the bridge.
    
    This is believed to be the reason for the failure and in addition the
    sequence of operation in vmd_domain_reset() is not following the PCIe
    specs.
    
    Disable the bridge window by executing a sequence of operations
    borrowed from pci_disable_bridge_window() and pci_setup_bridge_io(),
    that comply with the PCI specifications.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Nirmal Patel <[email protected]>
    Signed-off-by: Lorenzo Pieralisi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf/imx_ddr: speed up overflow frequency of cycle [+ + +]
Author: Xu Yang <[email protected]>
Date:   Fri Aug 11 09:54:37 2023 +0800

    perf/imx_ddr: speed up overflow frequency of cycle
    
    [ Upstream commit e89ecd8368860bf05437eabd07d292c316221cfc ]
    
    For i.MX8MP, we cannot ensure that cycle counter overflow occurs at least
    4 times as often as other events. Due to byte counters will count for any
    event configured, it will overflow more often. And if byte counters
    overflow that related counters would stop since they share the
    COUNTER_CNTL. We can speed up cycle counter overflow frequency by setting
    counter parameter (CP) field of cycle counter. In this way, we can avoid
    stop counting byte counters when interrupt didn't come and the byte
    counters can be fetched or updated from each cycle counter overflow
    interrupt.
    
    Because we initialize CP filed to shorten counter0 overflow time, the cycle
    counter will start couting from a fixed/base value each time. We need to
    remove the base from the result too. Therefore, we could get precise result
    from cycle counter.
    
    Signed-off-by: Xu Yang <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09 [+ + +]
Author: Yicong Yang <[email protected]>
Date:   Mon Aug 14 20:40:12 2023 +0800

    perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09
    
    [ Upstream commit 0242737dc4eb9f6e9a5ea594b3f93efa0b12f28d ]
    
    Some HiSilicon SMMU PMCG suffers the erratum 162001900 that the PMU
    disable control sometimes fail to disable the counters. This will lead
    to error or inaccurate data since before we enable the counters the
    counter's still counting for the event used in last perf session.
    
    This patch tries to fix this by hardening the global disable process.
    Before disable the PMU, writing an invalid event type (0xffff) to
    focibly stop the counters. Correspondingly restore each events on
    pmu::pmu_enable().
    
    Signed-off-by: Yicong Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[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]>

 
printk: Consolidate console deferred printing [+ + +]
Author: John Ogness <[email protected]>
Date:   Mon Jul 17 21:52:05 2023 +0206

    printk: Consolidate console deferred printing
    
    [ Upstream commit 696ffaf50e1f8dbc66223ff614473f945f5fb8d8 ]
    
    Printing to consoles can be deferred for several reasons:
    
    - explicitly with printk_deferred()
    - printk() in NMI context
    - recursive printk() calls
    
    The current implementation is not consistent. For printk_deferred(),
    irq work is scheduled twice. For NMI und recursive, panic CPU
    suppression and caller delays are not properly enforced.
    
    Correct these inconsistencies by consolidating the deferred printing
    code so that vprintk_deferred() is the top-level function for
    deferred printing and vprintk_emit() will perform whichever irq_work
    queueing is appropriate.
    
    Also add kerneldoc for wake_up_klogd() and defer_console_output() to
    clarify their differences and appropriate usage.
    
    Signed-off-by: John Ogness <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Reviewed-by: Petr Mladek <[email protected]>
    Signed-off-by: Petr Mladek <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

printk: Keep non-panic-CPUs out of console lock [+ + +]
Author: John Ogness <[email protected]>
Date:   Mon Jul 17 21:52:03 2023 +0206

    printk: Keep non-panic-CPUs out of console lock
    
    [ Upstream commit 51a1d258e50e03a0216bf42b6af9ff34ec402ac1 ]
    
    When in a panic situation, non-panic CPUs should avoid holding the
    console lock so as not to contend with the panic CPU. This is already
    implemented with abandon_console_lock_in_panic(), which is checked
    after each printed line. However, non-panic CPUs should also avoid
    trying to acquire the console lock during a panic.
    
    Modify console_trylock() to fail and console_lock() to block() when
    called from a non-panic CPU during a panic.
    
    Signed-off-by: John Ogness <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Reviewed-by: Petr Mladek <[email protected]>
    Signed-off-by: Petr Mladek <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
rcuscale: Move rcu_scale_writer() schedule_timeout_uninterruptible() to _idle() [+ + +]
Author: Zqiang <[email protected]>
Date:   Fri Jun 16 15:39:26 2023 +0800

    rcuscale: Move rcu_scale_writer() schedule_timeout_uninterruptible() to _idle()
    
    [ Upstream commit e60c122a1614b4f65b29a7bef9d83b9fd30e937a ]
    
    The rcuscale.holdoff module parameter can be used to delay the start
    of rcu_scale_writer() kthread.  However, the hung-task timeout will
    trigger when the timeout specified by rcuscale.holdoff is greater than
    hung_task_timeout_secs:
    
    runqemu kvm nographic slirp qemuparams="-smp 4 -m 2048M"
    bootparams="rcuscale.shutdown=0 rcuscale.holdoff=300"
    
    [  247.071753] INFO: task rcu_scale_write:59 blocked for more than 122 seconds.
    [  247.072529]       Not tainted 6.4.0-rc1-00134-gb9ed6de8d4ff #7
    [  247.073400] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    [  247.074331] task:rcu_scale_write state:D stack:30144 pid:59    ppid:2      flags:0x00004000
    [  247.075346] Call Trace:
    [  247.075660]  <TASK>
    [  247.075965]  __schedule+0x635/0x1280
    [  247.076448]  ? __pfx___schedule+0x10/0x10
    [  247.076967]  ? schedule_timeout+0x2dc/0x4d0
    [  247.077471]  ? __pfx_lock_release+0x10/0x10
    [  247.078018]  ? enqueue_timer+0xe2/0x220
    [  247.078522]  schedule+0x84/0x120
    [  247.078957]  schedule_timeout+0x2e1/0x4d0
    [  247.079447]  ? __pfx_schedule_timeout+0x10/0x10
    [  247.080032]  ? __pfx_rcu_scale_writer+0x10/0x10
    [  247.080591]  ? __pfx_process_timeout+0x10/0x10
    [  247.081163]  ? __pfx_sched_set_fifo_low+0x10/0x10
    [  247.081760]  ? __pfx_rcu_scale_writer+0x10/0x10
    [  247.082287]  rcu_scale_writer+0x6b1/0x7f0
    [  247.082773]  ? mark_held_locks+0x29/0xa0
    [  247.083252]  ? __pfx_rcu_scale_writer+0x10/0x10
    [  247.083865]  ? __pfx_rcu_scale_writer+0x10/0x10
    [  247.084412]  kthread+0x179/0x1c0
    [  247.084759]  ? __pfx_kthread+0x10/0x10
    [  247.085098]  ret_from_fork+0x2c/0x50
    [  247.085433]  </TASK>
    
    This commit therefore replaces schedule_timeout_uninterruptible() with
    schedule_timeout_idle().
    
    Signed-off-by: Zqiang <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "drm/amd: Disable S/G for APUs when 64GB or more host memory" [+ + +]
Author: Hamza Mahfooz <[email protected]>
Date:   Fri Sep 8 10:36:44 2023 -0400

    Revert "drm/amd: Disable S/G for APUs when 64GB or more host memory"
    
    commit 169ed4ece8373f02f10642eae5240e3d1ef5c038 upstream.
    
    This reverts commit 70e64c4d522b732e31c6475a3be2349de337d321.
    
    Since, we now have an actual fix for this issue, we can get rid of this
    workaround as it can cause pin failures if enough VRAM isn't carved out
    by the BIOS.
    
    Cc: [email protected] # 6.1+
    Acked-by: Harry Wentland <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Hamza Mahfooz <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "memcg: drop kmem.limit_in_bytes" [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Wed Sep 20 12:57:00 2023 +0200

    Revert "memcg: drop kmem.limit_in_bytes"
    
    This reverts commit 21ef9e11205fca43785eecf7d4a99528d4de5701 which is
    commit 86327e8eb94c52eca4f93cfece2e29d1bf52acbf upstream.
    
    It breaks existing runc systems, as the tool always thinks the file
    should be present.
    
    Reported-by: Jeremi Piotrowski <[email protected]>
    Link: https://lore.kernel.org/r/20230920081101.GA12096@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net
    Cc: Michal Hocko <[email protected]>
    Cc: Shakeel Butt <[email protected]>
    Cc: Johannes Weiner <[email protected]>
    Cc: Roman Gushchin <[email protected]>
    Cc: Muchun Song <[email protected]>
    Cc: Tejun Heo <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "SUNRPC: Fail faster on bad verifier" [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Tue Sep 5 21:03:28 2023 -0400

    Revert "SUNRPC: Fail faster on bad verifier"
    
    commit e86fcf0820d914389b46658a5a7e8969c3af2d53 upstream.
    
    This reverts commit 0701214cd6e66585a999b132eb72ae0489beb724.
    
    The premise of this commit was incorrect. There are exactly 2 cases
    where rpcauth_checkverf() will return an error:
    
    1) If there was an XDR decode problem (i.e. garbage data).
    2) If gss_validate() had a problem verifying the RPCSEC_GSS MIC.
    
    In the second case, there are again 2 subcases:
    
    a) The GSS context expires, in which case gss_validate() will force a
       new context negotiation on retry by invalidating the cred.
    b) The sequence number check failed because an RPC call timed out, and
       the client retransmitted the request using a new sequence number,
       as required by RFC2203.
    
    In neither subcase is this a fatal error.
    
    Reported-by: Russell Cattelan <[email protected]>
    Fixes: 0701214cd6e6 ("SUNRPC: Fail faster on bad verifier")
    Cc: [email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Anna Schumaker <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
riscv: kexec: Align the kexeced kernel entry [+ + +]
Author: Song Shuai <[email protected]>
Date:   Wed Sep 6 17:58:17 2023 +0800

    riscv: kexec: Align the kexeced kernel entry
    
    [ Upstream commit 1bfb2b618d52e59a4ef1896b46c4698ad2be66b7 ]
    
    The current riscv boot protocol requires 2MB alignment for RV64
    and 4MB alignment for RV32.
    
    In KEXEC_FILE path, the elf_find_pbase() function should align
    the kexeced kernel entry according to the requirement, otherwise
    the kexeced kernel would silently BUG at the setup_vm().
    
    Fixes: 8acea455fafa ("RISC-V: Support for kexec_file on panic")
    Signed-off-by: Song Shuai <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
samples/hw_breakpoint: fix building without module unloading [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Tue Jul 25 10:25:36 2023 +0200

    samples/hw_breakpoint: fix building without module unloading
    
    [ Upstream commit b9080468caeddc58a91edd1c3a7d212ea82b0d1d ]
    
    __symbol_put() is really meant as an internal helper and is not available
    when module unloading is disabled, unlike the previously used symbol_put():
    
    samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit':
    samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration]
    
    The hw_break_module_exit() function is not actually used when module
    unloading is disabled, but it still causes the build failure for an
    undefined identifier. Enclose this one call in an appropriate #ifdef to
    clarify what the requirement is. Leaving out the entire exit function
    would also work but feels less clar in this case.
    
    Fixes: 910e230d5f1bb ("samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'")
    Fixes: d8a84d33a4954 ("samples/hw_breakpoint: drop use of kallsyms_lookup_name()")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Petr Mladek <[email protected]>
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000' [+ + +]
Author: Rong Tao <[email protected]>
Date:   Sun Apr 16 23:05:17 2023 +0800

    samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'
    
    [ Upstream commit 910e230d5f1bb72c54532e94fbb1705095c7bab6 ]
    
    Macro symbol_put() is defined as __symbol_put(__stringify(x))
    
        ksym_name = "jiffies"
        symbol_put(ksym_name)
    
    will be resolved as
    
        __symbol_put("ksym_name")
    
    which is clearly wrong. So symbol_put must be replaced with __symbol_put.
    
    When we uninstall hw_breakpoint.ko (rmmod), a kernel bug occurs with the
    following error:
    
    [11381.854152] kernel BUG at kernel/module/main.c:779!
    [11381.854159] invalid opcode: 0000 [#2] PREEMPT SMP PTI
    [11381.854163] CPU: 8 PID: 59623 Comm: rmmod Tainted: G      D    OE      6.2.9-200.fc37.x86_64 #1
    [11381.854167] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./B360M-HDV, BIOS P3.20 10/23/2018
    [11381.854169] RIP: 0010:__symbol_put+0xa2/0xb0
    [11381.854175] Code: 00 e8 92 d2 f7 ff 65 8b 05 c3 2f e6 78 85 c0 74 1b 48 8b 44 24 30 65 48 2b 04 25 28 00 00 00 75 12 48 83 c4 38 c3 cc cc cc cc <0f> 0b 0f 1f 44 00 00 eb de e8 c0 df d8 00 90 90 90 90 90 90 90 90
    [11381.854178] RSP: 0018:ffffad8ec6ae7dd0 EFLAGS: 00010246
    [11381.854181] RAX: 0000000000000000 RBX: ffffffffc1fd1240 RCX: 000000000000000c
    [11381.854184] RDX: 000000000000006b RSI: ffffffffc02bf7c7 RDI: ffffffffc1fd001c
    [11381.854186] RBP: 000055a38b76e7c8 R08: ffffffff871ccfe0 R09: 0000000000000000
    [11381.854188] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    [11381.854190] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    [11381.854192] FS:  00007fbf7c62c740(0000) GS:ffff8c5badc00000(0000) knlGS:0000000000000000
    [11381.854195] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [11381.854197] CR2: 000055a38b7793f8 CR3: 0000000363e1e001 CR4: 00000000003726e0
    [11381.854200] DR0: ffffffffb3407980 DR1: 0000000000000000 DR2: 0000000000000000
    [11381.854202] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    [11381.854204] Call Trace:
    [11381.854207]  <TASK>
    [11381.854212]  s_module_exit+0xc/0xff0 [symbol_getput]
    [11381.854219]  __do_sys_delete_module.constprop.0+0x198/0x2f0
    [11381.854225]  do_syscall_64+0x58/0x80
    [11381.854231]  ? exit_to_user_mode_prepare+0x180/0x1f0
    [11381.854237]  ? syscall_exit_to_user_mode+0x17/0x40
    [11381.854241]  ? do_syscall_64+0x67/0x80
    [11381.854245]  ? syscall_exit_to_user_mode+0x17/0x40
    [11381.854248]  ? do_syscall_64+0x67/0x80
    [11381.854252]  ? exc_page_fault+0x70/0x170
    [11381.854256]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    Signed-off-by: Rong Tao <[email protected]>
    Reviewed-by: Petr Mladek <[email protected]>
    Signed-off-by: Luis Chamberlain <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
scftorture: Forgive memory-allocation failure if KASAN [+ + +]
Author: Paul E. McKenney <[email protected]>
Date:   Mon May 15 19:00:10 2023 -0700

    scftorture: Forgive memory-allocation failure if KASAN
    
    [ Upstream commit 013608cd0812bdb21fc26d39ed8fdd2fc76e8b9b ]
    
    Kernels built with CONFIG_KASAN=y quarantine newly freed memory in order
    to better detect use-after-free errors.  However, this can exhaust memory
    more quickly in allocator-heavy tests, which can result in spurious
    scftorture failure.  This commit therefore forgives memory-allocation
    failure in kernels built with CONFIG_KASAN=y, but continues counting
    the errors for use in detailed test-result analyses.
    
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
scsi: lpfc: Abort outstanding ELS cmds when mailbox timeout error is detected [+ + +]
Author: Justin Tee <[email protected]>
Date:   Wed Jul 12 11:05:18 2023 -0700

    scsi: lpfc: Abort outstanding ELS cmds when mailbox timeout error is detected
    
    [ Upstream commit 089ea22e374aa20043e72243c47b5867d5419d38 ]
    
    A mailbox timeout error usually indicates something has gone wrong, and a
    follow up reset of the HBA is a typical recovery mechanism.  Introduce a
    MBX_TMO_ERR flag to detect such cases and have lpfc_els_flush_cmd abort ELS
    commands if the MBX_TMO_ERR flag condition was set.  This ensures all of
    the registered SGL resources meant for ELS traffic are not leaked after an
    HBA reset.
    
    Signed-off-by: Justin Tee <[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: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file() [+ + +]
Author: Jinjie Ruan <[email protected]>
Date:   Wed Sep 6 11:08:09 2023 +0800

    scsi: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
    
    [ Upstream commit 7dcc683db3639eadd11bf0d59a09088a43de5e22 ]
    
    Since debugfs_create_file() returns ERR_PTR and never NULL, use IS_ERR() to
    check the return value.
    
    Fixes: 2fcbc569b9f5 ("scsi: lpfc: Make debugfs ktime stats generic for NVME and SCSI")
    Fixes: 4c47efc140fa ("scsi: lpfc: Move SCSI and NVME Stats to hardware queue structures")
    Fixes: 6a828b0f6192 ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
    Fixes: 95bfc6d8ad86 ("scsi: lpfc: Make FW logging dynamically configurable")
    Fixes: 9f77870870d8 ("scsi: lpfc: Add debugfs support for cm framework buffers")
    Fixes: c490850a0947 ("scsi: lpfc: Adapt partitioned XRI lists to efficient sharing")
    Signed-off-by: Jinjie Ruan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Justin Tee <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: megaraid_sas: Fix deadlock on firmware crashdump [+ + +]
Author: Junxiao Bi <[email protected]>
Date:   Mon Aug 28 15:10:18 2023 -0700

    scsi: megaraid_sas: Fix deadlock on firmware crashdump
    
    commit 0b0747d507bffb827e40fc0f9fb5883fffc23477 upstream.
    
    The following processes run into a deadlock. CPU 41 was waiting for CPU 29
    to handle a CSD request while holding spinlock "crashdump_lock", but CPU 29
    was hung by that spinlock with IRQs disabled.
    
      PID: 17360    TASK: ffff95c1090c5c40  CPU: 41  COMMAND: "mrdiagd"
      !# 0 [ffffb80edbf37b58] __read_once_size at ffffffff9b871a40 include/linux/compiler.h:185:0
      !# 1 [ffffb80edbf37b58] atomic_read at ffffffff9b871a40 arch/x86/include/asm/atomic.h:27:0
      !# 2 [ffffb80edbf37b58] dump_stack at ffffffff9b871a40 lib/dump_stack.c:54:0
       # 3 [ffffb80edbf37b78] csd_lock_wait_toolong at ffffffff9b131ad5 kernel/smp.c:364:0
       # 4 [ffffb80edbf37b78] __csd_lock_wait at ffffffff9b131ad5 kernel/smp.c:384:0
       # 5 [ffffb80edbf37bf8] csd_lock_wait at ffffffff9b13267a kernel/smp.c:394:0
       # 6 [ffffb80edbf37bf8] smp_call_function_many at ffffffff9b13267a kernel/smp.c:843:0
       # 7 [ffffb80edbf37c50] smp_call_function at ffffffff9b13279d kernel/smp.c:867:0
       # 8 [ffffb80edbf37c50] on_each_cpu at ffffffff9b13279d kernel/smp.c:976:0
       # 9 [ffffb80edbf37c78] flush_tlb_kernel_range at ffffffff9b085c4b arch/x86/mm/tlb.c:742:0
       #10 [ffffb80edbf37cb8] __purge_vmap_area_lazy at ffffffff9b23a1e0 mm/vmalloc.c:701:0
       #11 [ffffb80edbf37ce0] try_purge_vmap_area_lazy at ffffffff9b23a2cc mm/vmalloc.c:722:0
       #12 [ffffb80edbf37ce0] free_vmap_area_noflush at ffffffff9b23a2cc mm/vmalloc.c:754:0
       #13 [ffffb80edbf37cf8] free_unmap_vmap_area at ffffffff9b23bb3b mm/vmalloc.c:764:0
       #14 [ffffb80edbf37cf8] remove_vm_area at ffffffff9b23bb3b mm/vmalloc.c:1509:0
       #15 [ffffb80edbf37d18] __vunmap at ffffffff9b23bb8a mm/vmalloc.c:1537:0
       #16 [ffffb80edbf37d40] vfree at ffffffff9b23bc85 mm/vmalloc.c:1612:0
       #17 [ffffb80edbf37d58] megasas_free_host_crash_buffer [megaraid_sas] at ffffffffc020b7f2 drivers/scsi/megaraid/megaraid_sas_fusion.c:3932:0
       #18 [ffffb80edbf37d80] fw_crash_state_store [megaraid_sas] at ffffffffc01f804d drivers/scsi/megaraid/megaraid_sas_base.c:3291:0
       #19 [ffffb80edbf37dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
       #20 [ffffb80edbf37dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
       #21 [ffffb80edbf37de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
       #22 [ffffb80edbf37e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
       #23 [ffffb80edbf37ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
       #24 [ffffb80edbf37ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
       #25 [ffffb80edbf37ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
       #26 [ffffb80edbf37f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
       #27 [ffffb80edbf37f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0
    
      PID: 17355    TASK: ffff95c1090c3d80  CPU: 29  COMMAND: "mrdiagd"
      !# 0 [ffffb80f2d3c7d30] __read_once_size at ffffffff9b0f2ab0 include/linux/compiler.h:185:0
      !# 1 [ffffb80f2d3c7d30] native_queued_spin_lock_slowpath at ffffffff9b0f2ab0 kernel/locking/qspinlock.c:368:0
       # 2 [ffffb80f2d3c7d58] pv_queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/paravirt.h:674:0
       # 3 [ffffb80f2d3c7d58] queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/qspinlock.h:53:0
       # 4 [ffffb80f2d3c7d68] queued_spin_lock at ffffffff9b8961a6 include/asm-generic/qspinlock.h:90:0
       # 5 [ffffb80f2d3c7d68] do_raw_spin_lock_flags at ffffffff9b8961a6 include/linux/spinlock.h:173:0
       # 6 [ffffb80f2d3c7d68] __raw_spin_lock_irqsave at ffffffff9b8961a6 include/linux/spinlock_api_smp.h:122:0
       # 7 [ffffb80f2d3c7d68] _raw_spin_lock_irqsave at ffffffff9b8961a6 kernel/locking/spinlock.c:160:0
       # 8 [ffffb80f2d3c7d88] fw_crash_buffer_store [megaraid_sas] at ffffffffc01f8129 drivers/scsi/megaraid/megaraid_sas_base.c:3205:0
       # 9 [ffffb80f2d3c7dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
       #10 [ffffb80f2d3c7dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
       #11 [ffffb80f2d3c7de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
       #12 [ffffb80f2d3c7e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
       #13 [ffffb80f2d3c7ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
       #14 [ffffb80f2d3c7ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
       #15 [ffffb80f2d3c7ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
       #16 [ffffb80f2d3c7f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
       #17 [ffffb80f2d3c7f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0
    
    The lock is used to synchronize different sysfs operations, it doesn't
    protect any resource that will be touched by an interrupt. Consequently
    it's not required to disable IRQs. Replace the spinlock with a mutex to fix
    the deadlock.
    
    Signed-off-by: Junxiao Bi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Mike Christie <[email protected]>
    Cc: [email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: pm8001: Setup IRQs on resume [+ + +]
Author: Damien Le Moal <[email protected]>
Date:   Tue Sep 12 08:27:36 2023 +0900

    scsi: pm8001: Setup IRQs on resume
    
    commit c91774818b041ed290df29fb1dc0725be9b12e83 upstream.
    
    The function pm8001_pci_resume() only calls pm8001_request_irq() without
    calling pm8001_setup_irq(). This causes the IRQ allocation to fail, which
    leads all drives being removed from the system.
    
    Fix this issue by integrating the code for pm8001_setup_irq() directly
    inside pm8001_request_irq() so that MSI-X setup is performed both during
    normal initialization and resume operations.
    
    Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver")
    Cc: [email protected]
    Signed-off-by: Damien Le Moal <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Acked-by: Jack Wang <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: qla2xxx: Fix NULL vs IS_ERR() bug for debugfs_create_dir() [+ + +]
Author: Jinjie Ruan <[email protected]>
Date:   Thu Aug 31 22:09:29 2023 +0800

    scsi: qla2xxx: Fix NULL vs IS_ERR() bug for debugfs_create_dir()
    
    [ Upstream commit d0b0822e32dbae80bbcb3cc86f34d28539d913df ]
    
    Since both debugfs_create_dir() and debugfs_create_file() return ERR_PTR
    and never NULL, use IS_ERR() instead of checking for NULL.
    
    Fixes: 1e98fb0f9208 ("scsi: qla2xxx: Setup debugfs entries for remote ports")
    Signed-off-by: Jinjie Ruan <[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: target: core: Fix target_cmd_counter leak [+ + +]
Author: David Disseldorp <[email protected]>
Date:   Thu Aug 31 20:34:59 2023 +0200

    scsi: target: core: Fix target_cmd_counter leak
    
    [ Upstream commit d14e3e553e05cb763964c991fe6acb0a6a1c6f9c ]
    
    The target_cmd_counter struct allocated via target_alloc_cmd_counter() is
    never freed, resulting in leaks across various transport types, e.g.:
    
     unreferenced object 0xffff88801f920120 (size 96):
      comm "sh", pid 102, jiffies 4294892535 (age 713.412s)
      hex dump (first 32 bytes):
        07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 38 01 92 1f 80 88 ff ff  ........8.......
      backtrace:
        [<00000000e58a6252>] kmalloc_trace+0x11/0x20
        [<0000000043af4b2f>] target_alloc_cmd_counter+0x17/0x90 [target_core_mod]
        [<000000007da2dfa7>] target_setup_session+0x2d/0x140 [target_core_mod]
        [<0000000068feef86>] tcm_loop_tpg_nexus_store+0x19b/0x350 [tcm_loop]
        [<000000006a80e021>] configfs_write_iter+0xb1/0x120
        [<00000000e9f4d860>] vfs_write+0x2e4/0x3c0
        [<000000008143433b>] ksys_write+0x80/0xb0
        [<00000000a7df29b2>] do_syscall_64+0x42/0x90
        [<0000000053f45fb8>] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
    Free the structure alongside the corresponding iscsit_conn / se_sess
    parent.
    
    Signed-off-by: David Disseldorp <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: becd9be6069e ("scsi: target: Move sess cmd counter to new struct")
    Reviewed-by: Mike Christie <[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]>

 
selftests/nolibc: fix up kernel parameters support [+ + +]
Author: Zhangjin Wu <[email protected]>
Date:   Sat Jul 8 02:32:05 2023 +0800

    selftests/nolibc: fix up kernel parameters support
    
    [ Upstream commit c388c9920da2679f62bec48d00ca9e80e9d0a364 ]
    
    kernel parameters allow pass two types of strings, one type is like
    'noapic', another type is like 'panic=5', the first type is passed as
    arguments of the init program, the second type is passed as environment
    variables of the init program.
    
    when users pass kernel parameters like this:
    
        noapic NOLIBC_TEST=syscall
    
    our nolibc-test program will use the test setting from argv[1] and
    ignore the one from NOLIBC_TEST environment variable, and at last, it
    will print the following line and ignore the whole test setting.
    
        Ignoring unknown test name 'noapic'
    
    reversing the parsing order does solve the above issue:
    
        test = getenv("NOLIBC_TEST");
        if (test)
            test = argv[1];
    
    but it still doesn't work with such kernel parameters (without
    NOLIBC_TEST environment variable):
    
        noapic FOO=bar
    
    To support all of the potential kernel parameters, let's verify the test
    setting from both of argv[1] and NOLIBC_TEST environment variable.
    
    Reviewed-by: Thomas Weißschuh <[email protected]>
    Signed-off-by: Zhangjin Wu <[email protected]>
    Signed-off-by: Willy Tarreau <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests: tracing: Fix to unmount tracefs for recovering environment [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Tue Sep 12 10:10:39 2023 +0900

    selftests: tracing: Fix to unmount tracefs for recovering environment
    
    [ Upstream commit 7e021da80f48582171029714f8a487347f29dddb ]
    
    Fix to unmount the tracefs if the ftracetest mounted it for recovering
    system environment. If the tracefs is already mounted, this does nothing.
    
    Suggested-by: Mark Brown <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]/
    Fixes: cbd965bde74c ("ftrace/selftests: Return the skip code when tracing directory not configured in kernel")
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Reviewed-by: Steven Rostedt (Google) <[email protected]>
    Reviewed-by: Mark Brown <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selinux: fix handling of empty opts in selinux_fs_context_submount() [+ + +]
Author: Ondrej Mosnacek <[email protected]>
Date:   Mon Sep 11 16:23:58 2023 +0200

    selinux: fix handling of empty opts in selinux_fs_context_submount()
    
    commit ccf1dab96be4caed7c5235b1cfdb606ac161b996 upstream.
    
    selinux_set_mnt_opts() relies on the fact that the mount options pointer
    is always NULL when all options are unset (specifically in its
    !selinux_initialized() branch. However, the new
    selinux_fs_context_submount() hook breaks this rule by allocating a new
    structure even if no options are set. That causes any submount created
    before a SELinux policy is loaded to be rejected in
    selinux_set_mnt_opts().
    
    Fix this by making selinux_fs_context_submount() leave fc->security
    set to NULL when there are no options to be copied from the reference
    superblock.
    
    Cc: <[email protected]>
    Reported-by: Adam Williamson <[email protected]>
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=2236345
    Fixes: d80a8f1b58c2 ("vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing")
    Signed-off-by: Ondrej Mosnacek <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Paul Moore <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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]>

 
tools: iio: iio_generic_buffer: Fix some integer type and calculation [+ + +]
Author: Chenyuan Mi <[email protected]>
Date:   Tue Jul 25 09:24:07 2023 +0000

    tools: iio: iio_generic_buffer: Fix some integer type and calculation
    
    [ Upstream commit 49d736313d0975ddeb156f4f59801da833f78b30 ]
    
    In function size_from_channelarray(), the return value 'bytes' is defined
    as int type. However, the calcution of 'bytes' in this function is designed
    to use the unsigned int type. So it is necessary to change 'bytes' type to
    unsigned int to avoid integer overflow.
    
    The size_from_channelarray() is called in main() function, its return value
    is directly multipled by 'buf_len' and then used as the malloc() parameter.
    The 'buf_len' is completely controllable by user, thus a multiplication
    overflow may occur here. This could allocate an unexpected small area.
    
    Signed-off-by: Chenyuan Mi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jonathan Cameron <[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]>

 
tracefs: Add missing lockdown check to tracefs_create_dir() [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Tue Sep 5 14:26:08 2023 -0400

    tracefs: Add missing lockdown check to tracefs_create_dir()
    
    commit 51aab5ffceb43e05119eb059048fd75765d2bc21 upstream.
    
    The function tracefs_create_dir() was missing a lockdown check and was
    called by the RV code. This gave an inconsistent behavior of this function
    returning success while other tracefs functions failed. This caused the
    inode being freed by the wrong kmem_cache.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Ajay Kaher <[email protected]>
    Cc: Ching-lin Yu <[email protected]>
    Fixes: bf8e602186ec4 ("tracing: Do not create tracefs files if tracefs lockdown is in effect")
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing: Have current_trace inc the trace array ref count [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Wed Sep 6 22:47:14 2023 -0400

    tracing: Have current_trace inc the trace array ref count
    
    commit 9b37febc578b2e1ad76a105aab11d00af5ec3d27 upstream.
    
    The current_trace updates the trace array tracer. For an instance, if the
    file is opened and the instance is deleted, reading or writing to the file
    will cause a use after free.
    
    Up the ref count of the trace array when current_trace is opened.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Zheng Yejian <[email protected]>
    Fixes: 8530dec63e7b4 ("tracing: Add tracing_check_open_get_tr()")
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Have event inject files inc the trace array ref count [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Wed Sep 6 22:47:16 2023 -0400

    tracing: Have event inject files inc the trace array ref count
    
    commit e5c624f027ac74f97e97c8f36c69228ac9f1102d upstream.
    
    The event inject files add events for a specific trace array. For an
    instance, if the file is opened and the instance is deleted, reading or
    writing to the file will cause a use after free.
    
    Up the ref count of the trace_array when a event inject file is opened.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Zheng Yejian <[email protected]>
    Fixes: 6c3edaf9fd6a ("tracing: Introduce trace event injection")
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Have option files inc the trace array ref count [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Wed Sep 6 22:47:15 2023 -0400

    tracing: Have option files inc the trace array ref count
    
    commit 7e2cfbd2d3c86afcd5c26b5c4b1dd251f63c5838 upstream.
    
    The option files update the options for a given trace array. For an
    instance, if the file is opened and the instance is deleted, reading or
    writing to the file will cause a use after free.
    
    Up the ref count of the trace_array when an option file is opened.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Zheng Yejian <[email protected]>
    Fixes: 8530dec63e7b4 ("tracing: Add tracing_check_open_get_tr()")
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Have tracing_max_latency inc the trace array ref count [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Wed Sep 6 22:47:13 2023 -0400

    tracing: Have tracing_max_latency inc the trace array ref count
    
    commit 7d660c9b2bc95107f90a9f4c4759be85309a6550 upstream.
    
    The tracing_max_latency file points to the trace_array max_latency field.
    For an instance, if the file is opened and the instance is deleted,
    reading or writing to the file will cause a use after free.
    
    Up the ref count of the trace_array when tracing_max_latency is opened.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Zheng Yejian <[email protected]>
    Fixes: 8530dec63e7b4 ("tracing: Add tracing_check_open_get_tr()")
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Increase trace array ref count on enable and filter files [+ + +]
Author: Steven Rostedt (Google) <[email protected]>
Date:   Wed Sep 6 22:47:12 2023 -0400

    tracing: Increase trace array ref count on enable and filter files
    
    commit f5ca233e2e66dc1c249bf07eefa37e34a6c9346a upstream.
    
    When the trace event enable and filter files are opened, increment the
    trace array ref counter, otherwise they can be accessed when the trace
    array is being deleted. The ref counter keeps the trace array from being
    deleted while those files are opened.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Fixes: 8530dec63e7b4 ("tracing: Add tracing_check_open_get_tr()")
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Reported-by: Zheng Yejian <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: cdns3: Put the cdns set active part outside the spin lock [+ + +]
Author: Xiaolei Wang <[email protected]>
Date:   Fri Jun 16 10:19:51 2023 +0800

    usb: cdns3: Put the cdns set active part outside the spin lock
    
    [ Upstream commit 2319b9c87fe243327285f2fefd7374ffd75a65fc ]
    
    The device may be scheduled during the resume process,
    so this cannot appear in atomic operations. Since
    pm_runtime_set_active will resume suppliers, put set
    active outside the spin lock, which is only used to
    protect the struct cdns data structure, otherwise the
    kernel will report the following warning:
    
      BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1163
      in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 651, name: sh
      preempt_count: 1, expected: 0
      RCU nest depth: 0, expected: 0
      CPU: 0 PID: 651 Comm: sh Tainted: G        WC         6.1.20 #1
      Hardware name: Freescale i.MX8QM MEK (DT)
      Call trace:
        dump_backtrace.part.0+0xe0/0xf0
        show_stack+0x18/0x30
        dump_stack_lvl+0x64/0x80
        dump_stack+0x1c/0x38
        __might_resched+0x1fc/0x240
        __might_sleep+0x68/0xc0
        __pm_runtime_resume+0x9c/0xe0
        rpm_get_suppliers+0x68/0x1b0
        __pm_runtime_set_status+0x298/0x560
        cdns_resume+0xb0/0x1c0
        cdns3_controller_resume.isra.0+0x1e0/0x250
        cdns3_plat_resume+0x28/0x40
    
    Signed-off-by: Xiaolei Wang <[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: chipidea: add workaround for chipidea PEC bug [+ + +]
Author: Xu Yang <[email protected]>
Date:   Wed Aug 9 10:44:32 2023 +0800

    usb: chipidea: add workaround for chipidea PEC bug
    
    [ Upstream commit 12e6ac69cc7e7d3367599ae26a92a0f9a18bc728 ]
    
    Some NXP processors using ChipIdea USB IP have a bug when frame babble is
    detected.
    
    Issue description:
    In USB camera test, our controller is host in HS mode. In ISOC IN, when
    device sends data across the micro frame, it causes the babble in host
    controller. This will clear the PE bit. In spec, it also requires to set
    the PEC bit and then set the PCI bit. Without the PCI interrupt, the
    software does not know the PE is cleared.
    
    This will add a flag CI_HDRC_HAS_PORTSC_PEC_MISSED to some impacted
    platform datas. And the ehci host driver will assert PEC by SW when
    specific conditions are satisfied.
    
    Signed-off-by: Xu 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: ehci: add workaround for chipidea PORTSC.PEC bug [+ + +]
Author: Xu Yang <[email protected]>
Date:   Wed Aug 9 10:44:31 2023 +0800

    usb: ehci: add workaround for chipidea PORTSC.PEC bug
    
    [ Upstream commit dda4b60ed70bd670eefda081f70c0cb20bbeb1fa ]
    
    Some NXP processor using chipidea IP has a bug when frame babble is
    detected.
    
    As per 4.15.1.1.1 Serial Bus Babble:
      A babble condition also exists if IN transaction is in progress at
    High-speed SOF2 point. This is called frame babble. The host controller
    must disable the port to which the frame babble is detected.
    
    The USB controller has disabled the port (PE cleared) and has asserted
    USBERRINT when frame babble is detected, but PEC is not asserted.
    Therefore, the SW isn't aware that port has been disabled. Then the
    SW keeps sending packets to this port, but all of the transfers will
    fail.
    
    This workaround will firstly assert PCD by SW when USBERRINT is detected
    and then judge whether port change has really occurred or not by polling
    roothub status. Because the PEC doesn't get asserted in our case, this
    patch will also assert it by SW when specific conditions are satisfied.
    
    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: 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]>

 
wifi: ath9k: fix fortify warnings [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Mon Jul 24 13:11:07 2023 +0300

    wifi: ath9k: fix fortify warnings
    
    [ Upstream commit 810e41cebb6c6e394f2068f839e1a3fc745a5dcc ]
    
    When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
    I've noticed the following:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘ath_tx_complete_aggr’ at drivers/net/wireless/ath/ath9k/xmit.c:556:4,
        inlined from ‘ath_tx_process_buffer’ at drivers/net/wireless/ath/ath9k/xmit.c:773:3:
    ./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);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘ath_tx_count_frames’ at drivers/net/wireless/ath/ath9k/xmit.c:473:3,
        inlined from ‘ath_tx_complete_aggr’ at drivers/net/wireless/ath/ath9k/xmit.c:572:2,
        inlined from ‘ath_tx_process_buffer’ at drivers/net/wireless/ath/ath9k/xmit.c:773:3:
    ./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);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In both cases, the compiler complains on:
    
    memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
    
    which is the legal way to copy both 'ba_low' and following 'ba_high'
    members of 'struct ath_tx_status' at once (that is, issue one 8-byte
    'memcpy()' for two 4-byte fields). Since the fortification logic seems
    interprets this trick as an attempt to overread 4-byte 'ba_low', silence
    relevant warnings by using the convenient 'struct_group()' quirk.
    
    Suggested-by: Johannes Berg <[email protected]>
    Signed-off-by: Dmitry Antipov <[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 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: cfg80211: ocb: don't leave if not joined [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Tue Aug 15 18:32:03 2023 +0200

    wifi: cfg80211: ocb: don't leave if not joined
    
    [ Upstream commit abc76cf552e13cfa88a204b362a86b0e08e95228 ]
    
    If there's no OCB state, don't ask the driver/mac80211 to
    leave, since that's just confusing. Since set/clear the
    chandef state, that's a simple check.
    
    Reported-by: [email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: cfg80211: reject auth/assoc to AP with our address [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Tue Aug 15 18:09:00 2023 +0200

    wifi: cfg80211: reject auth/assoc to AP with our address
    
    [ Upstream commit 5d4e04bf3a0f098bd9033de3a5291810fa14c7a6 ]
    
    If the AP uses our own address as its MLD address or BSSID, then
    clearly something's wrong. Reject such connections so we don't
    try and fail later.
    
    Reported-by: [email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211: check for station first in client probe [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Tue Aug 15 18:41:32 2023 +0200

    wifi: mac80211: check for station first in client probe
    
    [ Upstream commit 67dfa589aa8806c7959cbca2f4613b8d41c75a06 ]
    
    When probing a client, first check if we have it, and then
    check for the channel context, otherwise you can trigger
    the warning there easily by probing when the AP isn't even
    started yet. Since a client existing means the AP is also
    operating, we can then keep the warning.
    
    Also simplify the moved code a bit.
    
    Reported-by: [email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211: check S1G action frame size [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Tue Aug 15 17:51:05 2023 +0200

    wifi: mac80211: check S1G action frame size
    
    [ Upstream commit 19e4a47ee74718a22e963e8a647c8c3bfe8bb05c ]
    
    Before checking the action code, check that it even
    exists in the frame.
    
    Reported-by: [email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211_hwsim: drop short frames [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Tue Aug 15 21:28:01 2023 +0200

    wifi: mac80211_hwsim: drop short frames
    
    [ Upstream commit fba360a047d5eeeb9d4b7c3a9b1c8308980ce9a6 ]
    
    While technically some control frames like ACK are shorter and
    end after Address 1, such frames shouldn't be forwarded through
    wmediumd or similar userspace, so require the full 3-address
    header to avoid accessing invalid memory if shorter frames are
    passed in.
    
    Reported-by: [email protected]
    Reviewed-by: Jeff Johnson <[email protected]>
    Signed-off-by: Johannes Berg <[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: wil6210: fix fortify warnings [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Wed Jun 21 12:36:55 2023 +0300

    wifi: wil6210: fix fortify warnings
    
    [ Upstream commit 1ad8237e971630c66a1a6194491e0837b64d00e0 ]
    
    When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
    I've noticed the following:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘wil_rx_crypto_check_edma’ at drivers/net/wireless/ath/wil6210/txrx_edma.c:566:2:
    ./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);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    where the compiler complains on:
    
    const u8 *pn;
    ...
    pn = (u8 *)&st->ext.pn_15_0;
    ...
    memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);
    
    and:
    
    In function ‘fortify_memcpy_chk’,
        inlined from ‘wil_rx_crypto_check’ at drivers/net/wireless/ath/wil6210/txrx.c:684:2:
    ./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);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    where the compiler complains on:
    
    const u8 *pn = (u8 *)&d->mac.pn_15_0;
    ...
    memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);
    
    In both cases, the fortification logic interprets 'memcpy()' as 6-byte
    overread of 2-byte field 'pn_15_0' of 'struct wil_rx_status_extension'
    and 'pn_15_0' of 'struct vring_rx_mac', respectively. To silence
    these warnings, last two fields of the aforementioned structures
    are grouped using 'struct_group_attr(pn, __packed' quirk.
    
    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]>

 
x86/boot/compressed: Reserve more memory for page tables [+ + +]
Author: Kirill A. Shutemov <[email protected]>
Date:   Fri Sep 15 10:02:21 2023 +0300

    x86/boot/compressed: Reserve more memory for page tables
    
    [ Upstream commit f530ee95b72e77b09c141c4b1a4b94d1199ffbd9 ]
    
    The decompressor has a hard limit on the number of page tables it can
    allocate. This limit is defined at compile-time and will cause boot
    failure if it is reached.
    
    The kernel is very strict and calculates the limit precisely for the
    worst-case scenario based on the current configuration. However, it is
    easy to forget to adjust the limit when a new use-case arises. The
    worst-case scenario is rarely encountered during sanity checks.
    
    In the case of enabling 5-level paging, a use-case was overlooked. The
    limit needs to be increased by one to accommodate the additional level.
    This oversight went unnoticed until Aaron attempted to run the kernel
    via kexec with 5-level paging and unaccepted memory enabled.
    
    Update wost-case calculations to include 5-level paging.
    
    To address this issue, let's allocate some extra space for page tables.
    128K should be sufficient for any use-case. The logic can be simplified
    by using a single value for all kernel configurations.
    
    [ Also add a warning, should this memory run low - by Dave Hansen. ]
    
    Fixes: 34bbb0009f3b ("x86/boot/compressed: Enable 5-level paging during decompression stage")
    Reported-by: Aaron Lu <[email protected]>
    Signed-off-by: Kirill A. Shutemov <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/ibt: Suppress spurious ENDBR [+ + +]
Author: Peter Zijlstra <[email protected]>
Date:   Wed Aug 2 12:55:46 2023 +0200

    x86/ibt: Suppress spurious ENDBR
    
    [ Upstream commit 25e73b7e3f72a25aa30cbb2eecb49036e0acf066 ]
    
    It was reported that under certain circumstances GCC emits ENDBR
    instructions for _THIS_IP_ usage. Specifically, when it appears at the
    start of a basic block -- but not elsewhere.
    
    Since _THIS_IP_ is never used for control flow, these ENDBR
    instructions are completely superfluous. Override the _THIS_IP_
    definition for x86_64 to avoid this.
    
    Less ENDBR instructions is better.
    
    Fixes: 156ff4a544ae ("x86/ibt: Base IBT bits")
    Reported-by: David Kaplan <[email protected]>
    Reviewed-by: Andrew Cooper <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/purgatory: Remove LTO flags [+ + +]
Author: Song Liu <[email protected]>
Date:   Thu Sep 14 10:01:38 2023 -0700

    x86/purgatory: Remove LTO flags
    
    [ Upstream commit 75b2f7e4c9e0fd750a5a27ca9736d1daa7a3762a ]
    
    -flto* implies -ffunction-sections. With LTO enabled, ld.lld generates
    multiple .text sections for purgatory.ro:
    
      $ readelf -S purgatory.ro  | grep " .text"
        [ 1] .text             PROGBITS         0000000000000000  00000040
        [ 7] .text.purgatory   PROGBITS         0000000000000000  000020e0
        [ 9] .text.warn        PROGBITS         0000000000000000  000021c0
        [13] .text.sha256_upda PROGBITS         0000000000000000  000022f0
        [15] .text.sha224_upda PROGBITS         0000000000000000  00002be0
        [17] .text.sha256_fina PROGBITS         0000000000000000  00002bf0
        [19] .text.sha224_fina PROGBITS         0000000000000000  00002cc0
    
    This causes WARNING from kexec_purgatory_setup_sechdrs():
    
      WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919
      kexec_load_purgatory+0x37f/0x390
    
    Fix this by disabling LTO for purgatory.
    
    [ AFAICT, x86 is the only arch that supports LTO and purgatory. ]
    
    We could also fix this with an explicit linker script to rejoin .text.*
    sections back into .text. However, given the benefit of LTOing purgatory
    is small, simply disable the production of more .text.* sections for now.
    
    Fixes: b33fff07e3e3 ("x86, build: allow LTO to be selected")
    Signed-off-by: Song Liu <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Nick Desaulniers <[email protected]>
    Reviewed-by: Sami Tolvanen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>