Changelog in Linux kernel 6.6.88

 
ACPI: platform-profile: Fix CFI violation when accessing sysfs files [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Feb 10 21:28:25 2025 -0500

    ACPI: platform-profile: Fix CFI violation when accessing sysfs files
    
    commit dd4f730b557ce701a2cd4f604bf1e57667bd8b6e upstream.
    
    When an attribute group is created with sysfs_create_group(), the
    ->sysfs_ops() callback is set to kobj_sysfs_ops, which sets the ->show()
    and ->store() callbacks to kobj_attr_show() and kobj_attr_store()
    respectively. These functions use container_of() to get the respective
    callback from the passed attribute, meaning that these callbacks need to
    be of the same type as the callbacks in 'struct kobj_attribute'.
    
    However, ->show() and ->store() in the platform_profile driver are
    defined for struct device_attribute with the help of DEVICE_ATTR_RO()
    and DEVICE_ATTR_RW(), which results in a CFI violation when accessing
    platform_profile or platform_profile_choices under /sys/firmware/acpi
    because the types do not match:
    
      CFI failure at kobj_attr_show+0x19/0x30 (target: platform_profile_choices_show+0x0/0x140; expected type: 0x7a69590c)
    
    There is no functional issue from the type mismatch because the layout
    of 'struct kobj_attribute' and 'struct device_attribute' are the same,
    so the container_of() cast does not break anything aside from CFI.
    
    Change the type of platform_profile_choices_show() and
    platform_profile_{show,store}() to match the callbacks in
    'struct kobj_attribute' and update the attribute variables to
    match, which resolves the CFI violation.
    
    Cc: All applicable <[email protected]>
    Fixes: a2ff95e018f1 ("ACPI: platform: Add platform profile support")
    Reported-by: John Rowley <[email protected]>
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2047
    Tested-by: John Rowley <[email protected]>
    Reviewed-by: Sami Tolvanen <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Acked-by: Greg Kroah-Hartman <[email protected]>
    Reviewed-by: Mark Pearson <[email protected]>
    Tested-by: Mark Pearson <[email protected]>
    Link: https://patch.msgid.link/20250210-acpi-platform_profile-fix-cfi-violation-v3-1-ed9e9901c33a@kernel.org
    [ rjw: Changelog edits ]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    [nathan: Fix conflicts in older stable branches]
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ahci: add PCI ID for Marvell 88SE9215 SATA Controller [+ + +]
Author: Daniel Kral <[email protected]>
Date:   Tue Mar 4 10:20:30 2025 +0100

    ahci: add PCI ID for Marvell 88SE9215 SATA Controller
    
    [ Upstream commit 885251dc35767b1c992f6909532ca366c830814a ]
    
    Add support for Marvell Technology Group Ltd. 88SE9215 SATA 6 Gb/s
    controller, which is e.g. used in the DAWICONTROL DC-614e RAID bus
    controller and was not automatically recognized before.
    
    Tested with a DAWICONTROL DC-614e RAID bus controller.
    
    Signed-off-by: Daniel Kral <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Niklas Cassel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ALSA: hda/realtek: Fix built-in mic on another ASUS VivoBook model [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Wed Apr 2 09:42:07 2025 +0200

    ALSA: hda/realtek: Fix built-in mic on another ASUS VivoBook model
    
    commit 8983dc1b66c0e1928a263b8af0bb06f6cb9229c4 upstream.
    
    There is another VivoBook model which built-in mic got broken recently
    by the fix of the pin sort.  Apply the correct quirk
    ALC256_FIXUP_ASUS_MIC_NO_PRESENCE to this model for addressing the
    regression, too.
    
    Fixes: 3b4309546b48 ("ALSA: hda: Fix headset detection failure due to unstable sort")
    Closes: https://lore.kernel.org/[email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    [ Salvatore Bonaccorso: Update for context change due to missing other
      quirk entries in the struct snd_pci_quirk alc269_fixup_tbl ]
    Signed-off-by: Salvatore Bonaccorso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: hda: intel: Add Lenovo IdeaPad Z570 to probe denylist [+ + +]
Author: Maxim Mikityanskiy <[email protected]>
Date:   Sat Feb 8 23:46:02 2025 +0200

    ALSA: hda: intel: Add Lenovo IdeaPad Z570 to probe denylist
    
    [ Upstream commit becc794c5e46f4dfca59f2385f78d83fc9e84700 ]
    
    Lenovo IdeaPad Z570 with NVIDIA GeForce Ge 540M doesn't have sound on
    the discrete GPU. The HDA controller in DGPU is disabled by BIOS, but
    then reenabled by quirk_nvidia_hda(). The probe fails and ends up with
    the "GPU sound probed, but not operational" error.
    
    Add this laptop to DMI-based denylist to prevent probe early. DMI is
    used, because the audio device has zero subsystem IDs, and this entry
    would be too much, blocking all 540M chips:
        PCI_DEVICE_SUB(0x10de, 0x0bea, 0x0000, 0x0000)
    Also, this laptop comes in a variety of modifications with different
    NVIDIA GPUs, so the DMI check will cover them all.
    
    Signed-off-by: Maxim Mikityanskiy <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: hda: intel: Fix Optimus when GPU has no sound [+ + +]
Author: Maxim Mikityanskiy <[email protected]>
Date:   Sat Feb 8 23:46:01 2025 +0200

    ALSA: hda: intel: Fix Optimus when GPU has no sound
    
    [ Upstream commit 2b360ba9a4936486380bc30d1eabceb40a714d98 ]
    
    quirk_nvidia_hda() forcefully enables HDA controller on all NVIDIA GPUs,
    because some buggy BIOSes leave it disabled. However, some dual-GPU
    laptops do not have a functional HDA controller in DGPU, and BIOS
    disables it on purpose. After quirk_nvidia_hda() reenables this dummy
    HDA controller, attempting to probe it fails at azx_first_init(), which
    is too late to cancel the probe, as it happens in azx_probe_continue().
    
    The sna_hda_intel driver calls azx_free() and stops the chip, however,
    it stays probed, and from the runtime PM point of view, the device
    remains active (it was set as active by the PCI subsystem on probe). It
    prevents vga_switcheroo from turning off the DGPU, because
    pci_create_device_link() syncs power management for video and audio
    devices.
    
    Affected devices should be added to driver_denylist to prevent them from
    probing early. This patch helps identify such devices by printing a
    warning, and also forces the device to the suspended state to allow
    vga_switcheroo turn off DGPU.
    
    Signed-off-by: Maxim Mikityanskiy <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: usb-audio: Fix CME quirk for UF series keyboards [+ + +]
Author: Ricard Wanderlof <[email protected]>
Date:   Thu Mar 13 23:16:17 2025 +0100

    ALSA: usb-audio: Fix CME quirk for UF series keyboards
    
    [ Upstream commit c2820405ba55a38932aa2177f026b70064296663 ]
    
    Fix quirk for CME master keyboards so it not only handles
    sysex but also song position pointer, MIDI timing clock, start
    and stop messages, and active sensing. All of these can be
    output by the CME UF series master keyboards.
    
    Tested with a CME UF6 in a desktop Linux environment as
    well as on the Zynthian Raspberry Pi based platform.
    
    Signed-off-by: Ricard Wanderlof <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
arm64: cputype: Add MIDR_CORTEX_A76AE [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Tue Jan 7 12:06:01 2025 -0800

    arm64: cputype: Add MIDR_CORTEX_A76AE
    
    commit a9b5bd81b294d30a747edd125e9f6aef2def7c79 upstream.
    
    >From the TRM, MIDR_CORTEX_A76AE has a partnum of 0xDOE and an
    implementor of 0x41 (ARM). Add the values.
    
    Cc: [email protected] # dependency of the next fix in the series
    Signed-off-by: Douglas Anderson <[email protected]>
    Link: https://lore.kernel.org/r/20250107120555.v4.4.I151f3b7ee323bcc3082179b8c60c3cd03308aa94@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Thu Dec 19 13:11:09 2024 -0800

    arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD
    
    [ Upstream commit 401c3333bb2396aa52e4121887a6f6a6e2f040bc ]
    
    Add a definition for the Qualcomm Kryo 300-series Gold cores.
    
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Douglas Anderson <[email protected]>
    Acked-by: Trilok Soni <[email protected]>
    Link: https://lore.kernel.org/r/20241219131107.v3.1.I18e0288742871393228249a768e5d56ea65d93dc@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

arm64: dts: mediatek: mt8173: Fix disp-pwm compatible string [+ + +]
Author: Chen-Yu Tsai <[email protected]>
Date:   Wed Jan 8 16:34:22 2025 +0800

    arm64: dts: mediatek: mt8173: Fix disp-pwm compatible string
    
    commit 46ad36002088eff8fc5cae200aa42ae9f9310ddd upstream.
    
    The MT8173 disp-pwm device should have only one compatible string, based
    on the following DT validation error:
    
        arch/arm64/boot/dts/mediatek/mt8173-elm.dtb: pwm@1401e000: compatible: 'oneOf' conditional failed, one must be fixed:
                ['mediatek,mt8173-disp-pwm', 'mediatek,mt6595-disp-pwm'] is too long
                'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt6795-disp-pwm', 'mediatek,mt8167-disp-pwm']
                'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt8186-disp-pwm', 'mediatek,mt8188-disp-pwm', 'mediatek,mt8192-disp-pwm', 'mediatek,mt8195-disp-pwm', 'mediatek,mt8365-disp-pwm']
                'mediatek,mt8173-disp-pwm' was expected
                'mediatek,mt8183-disp-pwm' was expected
                from schema $id: http://devicetree.org/schemas/pwm/mediatek,pwm-disp.yaml#
        arch/arm64/boot/dts/mediatek/mt8173-elm.dtb: pwm@1401f000: compatible: 'oneOf' conditional failed, one must be fixed:
                ['mediatek,mt8173-disp-pwm', 'mediatek,mt6595-disp-pwm'] is too long
                'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt6795-disp-pwm', 'mediatek,mt8167-disp-pwm']
                'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt8186-disp-pwm', 'mediatek,mt8188-disp-pwm', 'mediatek,mt8192-disp-pwm', 'mediatek,mt8195-disp-pwm', 'mediatek,mt8365-disp-pwm']
                'mediatek,mt8173-disp-pwm' was expected
                'mediatek,mt8183-disp-pwm' was expected
                from schema $id: http://devicetree.org/schemas/pwm/mediatek,pwm-disp.yaml#
    
    Drop the extra "mediatek,mt6595-disp-pwm" compatible string.
    
    Fixes: 61aee9342514 ("arm64: dts: mt8173: add MT8173 display PWM driver support node")
    Cc: YH Huang <[email protected]>
    Cc: [email protected] # v4.5+
    Signed-off-by: Chen-Yu Tsai <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Tue Jan 7 12:06:00 2025 -0800

    arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list
    
    commit 0c9fc6e652cd5aed48c5f700c32b7642bea7f453 upstream.
    
    Qualcomm has confirmed that, much like Cortex A53 and A55, KRYO
    2XX/3XX/4XX silver cores are unaffected by Spectre BHB. Add them to
    the safe list.
    
    Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels")
    Cc: [email protected]
    Cc: Scott Bauer <[email protected]>
    Signed-off-by: Douglas Anderson <[email protected]>
    Acked-by: Trilok Soni <[email protected]>
    Link: https://lore.kernel.org/r/20250107120555.v4.3.Iab8dbfb5c9b1e143e7a29f410bce5f9525a0ba32@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Tue Jan 7 12:06:02 2025 -0800

    arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists
    
    commit a5951389e58d2e816eed3dbec5877de9327fd881 upstream.
    
    When comparing to the ARM list [1], it appears that several ARM cores
    were missing from the lists in spectre_bhb_loop_affected(). Add them.
    
    NOTE: for some of these cores it may not matter since other ways of
    clearing the BHB may be used (like the CLRBHB instruction or ECBHB),
    but it still seems good to have all the info from ARM's whitepaper
    included.
    
    [1] https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
    
    Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels")
    Cc: [email protected]
    Signed-off-by: Douglas Anderson <[email protected]>
    Reviewed-by: James Morse <[email protected]>
    Link: https://lore.kernel.org/r/20250107120555.v4.5.I4a9a527e03f663040721c5401c41de587d015c82@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Tue Jan 7 12:05:58 2025 -0800

    arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list
    
    commit ed1ce841245d8febe3badf51c57e81c3619d0a1d upstream.
    
    Qualcomm Kryo 400-series Gold cores have a derivative of an ARM Cortex
    A76 in them. Since A76 needs Spectre mitigation via looping then the
    Kyro 400-series Gold cores also need Spectre mitigation via looping.
    
    Qualcomm has confirmed that the proper "k" value for Kryo 400-series
    Gold cores is 24.
    
    Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels")
    Cc: [email protected]
    Cc: Scott Bauer <[email protected]>
    Signed-off-by: Douglas Anderson <[email protected]>
    Acked-by: Trilok Soni <[email protected]>
    Link: https://lore.kernel.org/r/20250107120555.v4.1.Ie4ef54abe02e7eb0eee50f830575719bf23bda48@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB [+ + +]
Author: Douglas Anderson <[email protected]>
Date:   Tue Jan 7 12:05:59 2025 -0800

    arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB
    
    commit e403e8538359d8580cbee1976ff71813e947101e upstream.
    
    The code for detecting CPUs that are vulnerable to Spectre BHB was
    based on a hardcoded list of CPU IDs that were known to be affected.
    Unfortunately, the list mostly only contained the IDs of standard ARM
    cores. The IDs for many cores that are minor variants of the standard
    ARM cores (like many Qualcomm Kyro CPUs) weren't listed. This led the
    code to assume that those variants were not affected.
    
    Flip the code on its head and instead assume that a core is vulnerable
    if it doesn't have CSV2_3 but is unrecognized as being safe. This
    involves creating a "Spectre BHB safe" list.
    
    As of right now, the only CPU IDs added to the "Spectre BHB safe" list
    are ARM Cortex A35, A53, A55, A510, and A520. This list was created by
    looking for cores that weren't listed in ARM's list [1] as per review
    feedback on v2 of this patch [2]. Additionally Brahma A53 is added as
    per mailing list feedback [3].
    
    NOTE: this patch will not actually _mitigate_ anyone, it will simply
    cause them to report themselves as vulnerable. If any cores in the
    system are reported as vulnerable but not mitigated then the whole
    system will be reported as vulnerable though the system will attempt
    to mitigate with the information it has about the known cores.
    
    [1] https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
    [2] https://lore.kernel.org/r/20241219175128.GA25477@willie-the-truck
    [3] https://lore.kernel.org/r/[email protected]
    
    Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels")
    Cc: [email protected]
    Reviewed-by: Julius Werner <[email protected]>
    Signed-off-by: Douglas Anderson <[email protected]>
    Link: https://lore.kernel.org/r/20250107120555.v4.2.I2040fa004dafe196243f67ebcc647cbedbb516e6@changeid
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: mm: Correct the update of max_pfn [+ + +]
Author: Zhenhua Huang <[email protected]>
Date:   Fri Mar 21 15:00:19 2025 +0800

    arm64: mm: Correct the update of max_pfn
    
    commit 89f43e1ce6f60d4f44399059595ac47f7a90a393 upstream.
    
    Hotplugged memory can be smaller than the original memory. For example,
    on my target:
    
    root@genericarmv8:~# cat /sys/kernel/debug/memblock/memory
       0: 0x0000000064005000..0x0000000064023fff    0 NOMAP
       1: 0x0000000064400000..0x00000000647fffff    0 NOMAP
       2: 0x0000000068000000..0x000000006fffffff    0 DRV_MNG
       3: 0x0000000088800000..0x0000000094ffefff    0 NONE
       4: 0x0000000094fff000..0x0000000094ffffff    0 NOMAP
    max_pfn will affect read_page_owner. Therefore, it should first compare and
    then select the larger value for max_pfn.
    
    Fixes: 8fac67ca236b ("arm64: mm: update max_pfn after memory hotplug")
    Cc: <[email protected]> # 6.1.x
    Signed-off-by: Zhenhua Huang <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Reviewed-by: Anshuman Khandual <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ASoC: amd: Add DMI quirk for ACP6X mic support [+ + +]
Author: keenplify <[email protected]>
Date:   Sat Mar 15 19:16:17 2025 +0800

    ASoC: amd: Add DMI quirk for ACP6X mic support
    
    [ Upstream commit 309b367eafc8e162603cd29189da6db770411fea ]
    
    Some AMD laptops with ACP6X do not expose the DMIC properly on Linux.
    Adding a DMI quirk enables mic functionality.
    
    Similar to Bugzilla #218402, this issue affects multiple users.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219853
    Signed-off-by: keenplify <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: amd: yc: update quirk data for new Lenovo model [+ + +]
Author: Syed Saba kareem <[email protected]>
Date:   Fri Mar 21 17:55:03 2025 +0530

    ASoC: amd: yc: update quirk data for new Lenovo model
    
    [ Upstream commit 5a4dd520ef8a94ecf81ac77b90d6a03e91c100a9 ]
    
    Update Quirk data for new Lenovo model 83J2 for YC platform.
    
    Signed-off-by: Syed Saba kareem <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Reported-by: Reiner <[email protected]>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219887
    Tested-by: Reiner <[email protected]>
    Reviewed-by: Mario Limonciello <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: codecs:lpass-wsa-macro: Fix logic of enabling vi channels [+ + +]
Author: Srinivas Kandagatla <[email protected]>
Date:   Thu Apr 3 17:02:09 2025 +0100

    ASoC: codecs:lpass-wsa-macro: Fix logic of enabling vi channels
    
    commit 7648beb65600220996ebb2da207610b1ff9b735e upstream.
    
    Existing code only configures one of WSA_MACRO_TX0 or WSA_MACRO_TX1
    paths eventhough we enable both of them. Fix this bug by adding proper
    checks and rearranging some of the common code to able to allow setting
    both TX0 and TX1 paths
    
    Without this patch only one channel gets enabled in VI path instead of 2
    channels. End result would be 1 channel recording instead of 2.
    
    Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route")
    Cc: [email protected]
    Co-developed-by: Manikantan R <[email protected]>
    Signed-off-by: Manikantan R <[email protected]>
    Signed-off-by: Srinivas Kandagatla <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: codecs:lpass-wsa-macro: Fix vi feedback rate [+ + +]
Author: Srinivas Kandagatla <[email protected]>
Date:   Thu Apr 3 17:02:08 2025 +0100

    ASoC: codecs:lpass-wsa-macro: Fix vi feedback rate
    
    commit d7bff1415e85b889dc8908be6aedba8807ae5e37 upstream.
    
    Currently the VI feedback rate is set to fixed 8K, fix this by getting
    the correct rate from params_rate.
    
    Without this patch incorrect rate will be set on the VI feedback
    recording resulting in rate miss match and audio artifacts.
    
    Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route")
    Cc: [email protected]
    Signed-off-by: Srinivas Kandagatla <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: cs42l43: Reset clamp override on jack removal [+ + +]
Author: Charles Keepax <[email protected]>
Date:   Wed Apr 9 13:07:17 2025 +0100

    ASoC: cs42l43: Reset clamp override on jack removal
    
    [ Upstream commit 5fc7d2b5cab47f2ac712f689140b1fed978fb91c ]
    
    Some of the manually selected jack configurations will disable the
    headphone clamp override. Restore this on jack removal, such that
    the state is consistent for a new insert.
    
    Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43")
    Signed-off-by: Charles Keepax <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: dwc: always enable/disable i2s irqs [+ + +]
Author: Brady Norander <[email protected]>
Date:   Sun Mar 30 09:08:54 2025 -0400

    ASoC: dwc: always enable/disable i2s irqs
    
    [ Upstream commit 2b727b3f8a04fe52f55316ccb8792cfd9b2dd05d ]
    
    Commit a42e988 ("ASoC: dwc: add DMA handshake control") changed the
    behavior of the driver to not enable or disable i2s irqs if using DMA. This
    breaks platforms such as AMD ACP. Audio playback appears to work but no
    audio can be heard. Revert to the old behavior by always enabling and
    disabling i2s irqs while keeping DMA handshake control.
    
    Fixes: a42e988b626 ("ASoC: dwc: add DMA handshake control")
    Signed-off-by: Brady Norander <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: fsl_audmix: register card device depends on 'dais' property [+ + +]
Author: Shengjiu Wang <[email protected]>
Date:   Wed Feb 26 18:05:08 2025 +0800

    ASoC: fsl_audmix: register card device depends on 'dais' property
    
    [ Upstream commit 294a60e5e9830045c161181286d44ce669f88833 ]
    
    In order to make the audmix device linked by audio graph card, make
    'dais' property to be optional.
    
    If 'dais' property exists, then register the imx-audmix card driver.
    otherwise, it should be linked by audio graph card.
    
    Signed-off-by: Shengjiu Wang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: Intel: avs: Fix null-ptr-deref in avs_component_probe() [+ + +]
Author: Henry Martin <[email protected]>
Date:   Wed Apr 2 22:14:11 2025 +0800

    ASoC: Intel: avs: Fix null-ptr-deref in avs_component_probe()
    
    [ Upstream commit 95f723cf141b95e3b3a5b92cf2ea98a863fe7275 ]
    
    devm_kasprintf() returns NULL when memory allocation fails. Currently,
    avs_component_probe() does not check for this case, which results in a
    NULL pointer dereference.
    
    Fixes: 739c031110da ("ASoC: Intel: avs: Provide support for fallback topology")
    Reviewed-by: Cezary Rojewski <[email protected]>
    Reviewed-by: Ethan Carter Edwards <[email protected]>
    Signed-off-by: Henry Martin <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: q6apm: add q6apm_get_hw_pointer helper [+ + +]
Author: Srinivas Kandagatla <[email protected]>
Date:   Fri Mar 14 17:47:57 2025 +0000

    ASoC: q6apm: add q6apm_get_hw_pointer helper
    
    commit 0badb5432fd525a00db5630c459b635e9d47f445 upstream.
    
    Implement an helper function in q6apm to be able to read the current
    hardware pointer for both read and write buffers.
    
    This should help q6apm-dai to get the hardware pointer consistently
    without it doing manual calculation, which could go wrong in some race
    conditions.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: [email protected]
    Signed-off-by: Srinivas Kandagatla <[email protected]>
    Tested-by: Krzysztof Kozlowski <[email protected]>
    Tested-by: Johan Hovold <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: qcom: Fix sc7280 lpass potential buffer overflow [+ + +]
Author: Evgeny Pimenov <[email protected]>
Date:   Tue Apr 1 23:40:58 2025 +0300

    ASoC: qcom: Fix sc7280 lpass potential buffer overflow
    
    commit a31a4934b31faea76e735bab17e63d02fcd8e029 upstream.
    
    Case values introduced in commit
    5f78e1fb7a3e ("ASoC: qcom: Add driver support for audioreach solution")
    cause out of bounds access in arrays of sc7280 driver data (e.g. in case
    of RX_CODEC_DMA_RX_0 in sc7280_snd_hw_params()).
    
    Redefine LPASS_MAX_PORTS to consider the maximum possible port id for
    q6dsp as sc7280 driver utilizes some of those values.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 77d0ffef793d ("ASoC: qcom: Add macro for lpass DAI id's max limit")
    Cc: [email protected] # v6.0+
    Suggested-by: Mikhail Kobuk <[email protected]>
    Suggested-by: Alexey Khoroshilov <[email protected]>
    Signed-off-by: Evgeny Pimenov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. [+ + +]
Author: Srinivas Kandagatla <[email protected]>
Date:   Fri Mar 14 17:48:00 2025 +0000

    ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns.
    
    commit 5d01ed9b9939b4c726be74db291a982bc984c584 upstream.
    
    Period sizes less than 6k for capture path triggers overruns in the
    dsp capture pipeline.
    
    Change the period size and number of periods to value which DSP is happy with.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: [email protected]
    Signed-off-by: Srinivas Kandagatla <[email protected]>
    Tested-by: Krzysztof Kozlowski <[email protected]>
    Tested-by: Johan Hovold <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: qdsp6: q6apm-dai: set 10 ms period and buffer alignment. [+ + +]
Author: Srinivas Kandagatla <[email protected]>
Date:   Fri Mar 14 17:47:59 2025 +0000

    ASoC: qdsp6: q6apm-dai: set 10 ms period and buffer alignment.
    
    commit 3107019501842c27334554ba9d6583b1f200f61f upstream.
    
    DSP expects the periods to be aligned to fragment sizes, currently
    setting up to hw constriants on periods bytes is not going to work
    correctly as we can endup with periods sizes aligned to 32 bytes however
    not aligned to fragment size.
    
    Update the constriants to use fragment size, and also set at step of
    10ms for period size to accommodate DSP requirements of 10ms latency.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: [email protected]
    Signed-off-by: Srinivas Kandagatla <[email protected]>
    Tested-by: Johan Hovold <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path [+ + +]
Author: Alexey Klimov <[email protected]>
Date:   Thu Mar 27 15:46:50 2025 +0000

    ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path
    
    commit 7eccc86e90f04a0d758d16c08627a620ac59604d upstream.
    
    In case of attempts to compress playback something, for instance,
    when audio routing is not set up correctly, the audio DSP is left in
    inconsistent state because we are not doing the correct things in
    the error path of q6asm_dai_compr_set_params().
    
    So, when routing is not set up and compress playback is attempted
    the following errors are present (simplified log):
    
    q6routing routing: Routing not setup for MultiMedia-1 Session
    q6asm-dai dais: Stream reg failed ret:-22
    q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params()
    on 17300000.remoteproc:glink-edge:apr:service@7:dais
    
    After setting the correct routing the compress playback will always fail:
    
    q6asm-dai dais: cmd = 0x10db3 returned error = 0x9
    q6asm-dai dais: DSP returned error[9]
    q6asm-dai dais: q6asm_open_write failed
    q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params()
    on 17300000.remoteproc:glink-edge:apr:service@7:dais
    
    0x9 here means "Operation is already processed". The CMD_OPEN here was
    sent the second time hence DSP responds that it was already done.
    
    Turns out the CMD_CLOSE should be sent after the q6asm_open_write()
    succeeded but something failed after that, for instance, routing
    setup.
    
    Fix this by slightly reworking the error path in
    q6asm_dai_compr_set_params().
    
    Tested on QRB5165 RB5 and SDM845 RB3 boards.
    
    Cc: [email protected]
    Fixes: 5b39363e54cc ("ASoC: q6asm-dai: prepare set params to accept profile change")
    Cc: Srinivas Kandagatla <[email protected]>
    Cc: Vinod Koul <[email protected]>
    Cc: Pierre-Louis Bossart <[email protected]>
    Signed-off-by: Alexey Klimov <[email protected]>
    Reviewed-by: Srinivas Kandagatla <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: SOF: topology: Use krealloc_array() to replace krealloc() [+ + +]
Author: Zhang Heng <[email protected]>
Date:   Fri Jan 17 09:43:43 2025 +0800

    ASoC: SOF: topology: Use krealloc_array() to replace krealloc()
    
    [ Upstream commit a05143a8f713d9ae6abc41141dac52c66fca8b06 ]
    
    Use krealloc_array() to replace krealloc() with multiplication.
    krealloc_array() has multiply overflow check, which will be safer.
    
    Signed-off-by: Zhang Heng <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
asus-laptop: Fix an uninitialized variable [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Thu Apr 3 15:26:01 2025 +0300

    asus-laptop: Fix an uninitialized variable
    
    commit 6c683c6887e4addcd6bd1ddce08cafccb0a21e32 upstream.
    
    The value returned by acpi_evaluate_integer() is not checked,
    but the result is not always successful, so it is necessary to
    add a check of the returned value.
    
    If the result remains negative during three iterations of the loop,
    then the uninitialized variable 'val' will be used in the clamp_val()
    macro, so it must be initialized with the current value of the 'curr'
    variable.
    
    In this case, the algorithm should be less noisy.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: b23910c2194e ("asus-laptop: Pegatron Lucid accelerometer")
    Cc: [email protected]
    Signed-off-by: Denis Arefev <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode [+ + +]
Author: Niklas Cassel <[email protected]>
Date:   Fri Feb 21 02:54:23 2025 +0100

    ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
    
    [ Upstream commit 91ec84f8eaddbc93d7c62e363d68aeb7b89879c7 ]
    
    atapi_eh_request_sense() currently uses ATAPI DMA if the SATA controller
    has ATA_FLAG_PIO_DMA (PIO cmds via DMA) set.
    
    However, ATA_FLAG_PIO_DMA is a flag that can be set by a low-level driver
    on a port at initialization time, before any devices are scanned.
    
    If a controller detects a connected device that only supports PIO, we set
    the flag ATA_DFLAG_PIO.
    
    Modify atapi_eh_request_sense() to not use ATAPI DMA if the connected
    device only supports PIO.
    
    Reported-by: Philip Pemberton <[email protected]>
    Closes: https://lore.kernel.org/linux-ide/[email protected]/
    Tested-by: Philip Pemberton <[email protected]>
    Reviewed-by: Damien Le Moal <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Niklas Cassel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ata: libata-sata: Save all fields from sense data descriptor [+ + +]
Author: Niklas Cassel <[email protected]>
Date:   Tue Apr 15 09:30:15 2025 +0200

    ata: libata-sata: Save all fields from sense data descriptor
    
    [ Upstream commit 399eab7f92fb73ffe621294a2d6bec8fc9f3b36b ]
    
    When filling the taskfile result for a successful NCQ command, we use
    the SDB FIS from the FIS Receive Area, see e.g. ahci_qc_ncq_fill_rtf().
    
    However, the SDB FIS only has fields STATUS and ERROR.
    
    For a successful NCQ command that has sense data, we will have a
    successful sense data descriptor, in the Sense Data for Successful NCQ
    Commands log.
    
    Since we have access to additional taskfile result fields, fill in these
    additional fields in qc->result_tf.
    
    This matches how for failing/aborted NCQ commands, we will use e.g.
    ahci_qc_fill_rtf() to fill in some fields, but then for the command that
    actually caused the NCQ error, we will use ata_eh_read_log_10h(), which
    provides additional fields, saving additional fields/overriding the
    qc->result_tf that was fetched using ahci_qc_fill_rtf().
    
    Fixes: 18bd7718b5c4 ("scsi: ata: libata: Handle completion of CDL commands using policy 0xD")
    Signed-off-by: Niklas Cassel <[email protected]>
    Reviewed-by: Igor Pylypiv <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe() [+ + +]
Author: Henry Martin <[email protected]>
Date:   Fri Apr 4 14:14:38 2025 +0800

    ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe()
    
    [ Upstream commit ad320e408a8c95a282ab9c05cdf0c9b95e317985 ]
    
    devm_ioremap() returns NULL on error. Currently, pxa_ata_probe() does
    not check for this case, which can result in a NULL pointer dereference.
    
    Add NULL check after devm_ioremap() to prevent this issue.
    
    Fixes: 2dc6c6f15da9 ("[ARM] pata_pxa: DMA-capable PATA driver")
    Signed-off-by: Henry Martin <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ata: sata_sx4: Add error handling in pdc20621_i2c_read() [+ + +]
Author: Wentao Liang <[email protected]>
Date:   Tue Apr 8 15:30:01 2025 +0800

    ata: sata_sx4: Add error handling in pdc20621_i2c_read()
    
    [ Upstream commit 8d46a27085039158eb5e253ab8a35a0e33b5e864 ]
    
    The function pdc20621_prog_dimm0() calls the function pdc20621_i2c_read()
    but does not handle the error if the read fails. This could lead to
    process with invalid data. A proper implementation can be found in
    /source/drivers/ata/sata_sx4.c, pdc20621_prog_dimm_global(). As mentioned
    in its commit: bb44e154e25125bef31fa956785e90fccd24610b, the variable spd0
    might be used uninitialized when pdc20621_i2c_read() fails.
    
    Add error handling to pdc20621_i2c_read(). If a read operation fails,
    an error message is logged via dev_err(), and return a negative error
    code.
    
    Add error handling to pdc20621_prog_dimm0() in pdc20621_dimm_init(), and
    return a negative error code if pdc20621_prog_dimm0() fails.
    
    Fixes: 4447d3515616 ("libata: convert the remaining SATA drivers to new init model")
    Signed-off-by: Wentao Liang <[email protected]>
    Reviewed-by: Niklas Cassel <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
backlight: led_bl: Hold led_access lock when calling led_sysfs_disable() [+ + +]
Author: Herve Codina <[email protected]>
Date:   Wed Jan 22 10:19:14 2025 +0100

    backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
    
    commit 276822a00db3c1061382b41e72cafc09d6a0ec30 upstream.
    
    Lockdep detects the following issue on led-backlight removal:
      [  142.315935] ------------[ cut here ]------------
      [  142.315954] WARNING: CPU: 2 PID: 292 at drivers/leds/led-core.c:455 led_sysfs_enable+0x54/0x80
      ...
      [  142.500725] Call trace:
      [  142.503176]  led_sysfs_enable+0x54/0x80 (P)
      [  142.507370]  led_bl_remove+0x80/0xa8 [led_bl]
      [  142.511742]  platform_remove+0x30/0x58
      [  142.515501]  device_remove+0x54/0x90
      ...
    
    Indeed, led_sysfs_enable() has to be called with the led_access
    lock held.
    
    Hold the lock when calling led_sysfs_disable().
    
    Fixes: ae232e45acf9 ("backlight: add led-backlight driver")
    Cc: [email protected]
    Signed-off-by: Herve Codina <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
block: fix resource leak in blk_register_queue() error path [+ + +]
Author: Zheng Qixing <[email protected]>
Date:   Sat Apr 12 17:25:54 2025 +0800

    block: fix resource leak in blk_register_queue() error path
    
    [ Upstream commit 40f2eb9b531475dd01b683fdaf61ca3cfd03a51e ]
    
    When registering a queue fails after blk_mq_sysfs_register() is
    successful but the function later encounters an error, we need
    to clean up the blk_mq_sysfs resources.
    
    Add the missing blk_mq_sysfs_unregister() call in the error path
    to properly clean up these resources and prevent a memory leak.
    
    Fixes: 320ae51feed5 ("blk-mq: new multi-queue block IO queueing mechanism")
    Signed-off-by: Zheng Qixing <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Yu Kuai <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Bluetooth: btrtl: Prevent potential NULL dereference [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Wed Apr 2 14:01:41 2025 +0300

    Bluetooth: btrtl: Prevent potential NULL dereference
    
    [ Upstream commit 324dddea321078a6eeb535c2bff5257be74c9799 ]
    
    The btrtl_initialize() function checks that rtl_load_file() either
    had an error or it loaded a zero length file.  However, if it loaded
    a zero length file then the error code is not set correctly.  It
    results in an error pointer vs NULL bug, followed by a NULL pointer
    dereference.  This was detected by Smatch:
    
    drivers/bluetooth/btrtl.c:592 btrtl_initialize() warn: passing zero to 'ERR_PTR'
    
    Fixes: 26503ad25de8 ("Bluetooth: btrtl: split the device initialization into smaller parts")
    Signed-off-by: Dan Carpenter <[email protected]>
    Reviewed-by: Hans de Goede <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Tue Apr 1 13:02:08 2025 -0400

    Bluetooth: hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address
    
    [ Upstream commit eb73b5a9157221f405b4fe32751da84ee46b7a25 ]
    
    This fixes sending MGMT_EV_DEVICE_FOUND for invalid address
    (00:00:00:00:00:00) which is a regression introduced by
    a2ec905d1e16 ("Bluetooth: fix kernel oops in store_pending_adv_report")
    since in the attempt to skip storing data for extended advertisement it
    actually made the code to skip the entire if statement supposed to send
    MGMT_EV_DEVICE_FOUND without attempting to use the last_addr_adv which
    is garanteed to be invalid for extended advertisement since we never
    store anything on it.
    
    Link: https://github.com/bluez/bluez/issues/1157
    Link: https://github.com/bluez/bluez/issues/1149#issuecomment-2767215658
    Fixes: a2ec905d1e16 ("Bluetooth: fix kernel oops in store_pending_adv_report")
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: hci_uart: Fix another race during initialization [+ + +]
Author: Arseniy Krasnov <[email protected]>
Date:   Wed Feb 12 18:59:46 2025 +0300

    Bluetooth: hci_uart: Fix another race during initialization
    
    commit 5df5dafc171b90d0b8d51547a82657cd5a1986c7 upstream.
    
    Do not set 'HCI_UART_PROTO_READY' before call 'hci_uart_register_dev()'.
    Possible race is when someone calls 'hci_tty_uart_close()' after this bit
    is set, but 'hci_uart_register_dev()' wasn't done. This leads to access
    to uninitialized fields. To fix it let's set this bit after device was
    registered (as before patch c411c62cc133) and to fix previous problem let's
    add one more bit in addition to 'HCI_UART_PROTO_READY' which allows to
    perform power up without original bit set (pls see commit c411c62cc133).
    
    Crash backtrace from syzbot report:
    
    RIP: 0010:skb_queue_empty_lockless include/linux/skbuff.h:1887 [inline]
    RIP: 0010:skb_queue_purge_reason+0x6d/0x140 net/core/skbuff.c:3936
    
    Call Trace:
     <TASK>
     skb_queue_purge include/linux/skbuff.h:3364 [inline]
     mrvl_close+0x2f/0x90 drivers/bluetooth/hci_mrvl.c:100
     hci_uart_tty_close+0xb6/0x120 drivers/bluetooth/hci_ldisc.c:557
     tty_ldisc_close drivers/tty/tty_ldisc.c:455 [inline]
     tty_ldisc_kill+0x66/0xc0 drivers/tty/tty_ldisc.c:613
     tty_ldisc_release+0xc9/0x120 drivers/tty/tty_ldisc.c:781
     tty_release_struct+0x10/0x80 drivers/tty/tty_io.c:1690
     tty_release+0x4ef/0x640 drivers/tty/tty_io.c:1861
     __fput+0x86/0x2a0 fs/file_table.c:450
     task_work_run+0x82/0xb0 kernel/task_work.c:239
     resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
     exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
     __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
     syscall_exit_to_user_mode+0xa3/0x1b0 kernel/entry/common.c:218
     do_syscall_64+0x9a/0x190 arch/x86/entry/common.c:89
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Signed-off-by: Arseniy Krasnov <[email protected]>
    Reported-by: [email protected]
    Tested-by: [email protected]
    Closes: https://lore.kernel.org/linux-bluetooth/[email protected]/
    Fixes: 366ceff495f9 ("Bluetooth: hci_uart: fix race during initialization")
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: hci_uart: fix race during initialization [+ + +]
Author: Arseniy Krasnov <[email protected]>
Date:   Thu Jan 30 21:43:26 2025 +0300

    Bluetooth: hci_uart: fix race during initialization
    
    [ Upstream commit 366ceff495f902182d42b6f41525c2474caf3f9a ]
    
    'hci_register_dev()' calls power up function, which is executed by
    kworker - 'hci_power_on()'. This function does access to bluetooth chip
    using callbacks from 'hci_ldisc.c', for example 'hci_uart_send_frame()'.
    Now 'hci_uart_send_frame()' checks 'HCI_UART_PROTO_READY' bit set, and
    if not - it fails. Problem is that 'HCI_UART_PROTO_READY' is set after
    'hci_register_dev()', and there is tiny chance that 'hci_power_on()' will
    be executed before setting this bit. In that case HCI init logic fails.
    
    Patch moves setting of 'HCI_UART_PROTO_READY' before calling function
    'hci_uart_register_dev()'.
    
    Signed-off-by: Arseniy Krasnov <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: l2cap: Check encryption key size on incoming connection [+ + +]
Author: Frédéric Danis <[email protected]>
Date:   Wed Apr 9 10:53:06 2025 +0200

    Bluetooth: l2cap: Check encryption key size on incoming connection
    
    [ Upstream commit 522e9ed157e3c21b4dd623c79967f72c21e45b78 ]
    
    This is required for passing GAP/SEC/SEM/BI-04-C PTS test case:
      Security Mode 4 Level 4, Responder - Invalid Encryption Key Size
      - 128 bit
    
    This tests the security key with size from 1 to 15 bytes while the
    Security Mode 4 Level 4 requests 16 bytes key size.
    
    Currently PTS fails with the following logs:
    - expected:Connection Response:
        Code: [3 (0x03)] Code
        Identifier: (lt)WildCard: Exists(gt)
        Length: [8 (0x0008)]
        Destination CID: (lt)WildCard: Exists(gt)
        Source CID: [64 (0x0040)]
        Result: [3 (0x0003)] Connection refused - Security block
        Status: (lt)WildCard: Exists(gt),
    but received:Connection Response:
        Code: [3 (0x03)] Code
        Identifier: [1 (0x01)]
        Length: [8 (0x0008)]
        Destination CID: [64 (0x0040)]
        Source CID: [64 (0x0040)]
        Result: [0 (0x0000)] Connection Successful
        Status: [0 (0x0000)] No further information available
    
    And HCI logs:
    < HCI Command: Read Encrypti.. (0x05|0x0008) plen 2
            Handle: 14 Address: 00:1B:DC:F2:24:10 (Vencer Co., Ltd.)
    > HCI Event: Command Complete (0x0e) plen 7
          Read Encryption Key Size (0x05|0x0008) ncmd 1
            Status: Success (0x00)
            Handle: 14 Address: 00:1B:DC:F2:24:10 (Vencer Co., Ltd.)
            Key size: 7
    > ACL Data RX: Handle 14 flags 0x02 dlen 12
          L2CAP: Connection Request (0x02) ident 1 len 4
            PSM: 4097 (0x1001)
            Source CID: 64
    < ACL Data TX: Handle 14 flags 0x00 dlen 16
          L2CAP: Connection Response (0x03) ident 1 len 8
            Destination CID: 64
            Source CID: 64
            Result: Connection successful (0x0000)
            Status: No further information available (0x0000)
    
    Fixes: 288c06973daa ("Bluetooth: Enforce key size of 16 bytes on FIPS level")
    Signed-off-by: Frédéric Danis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: l2cap: Process valid commands in too long frame [+ + +]
Author: Frédéric Danis <[email protected]>
Date:   Mon Apr 14 11:08:15 2025 +0200

    Bluetooth: l2cap: Process valid commands in too long frame
    
    commit e2e49e214145a8f6ece6ecd52fec63ebc2b27ce9 upstream.
    
    This is required for passing PTS test cases:
    - L2CAP/COS/CED/BI-14-C
      Multiple Signaling Command in one PDU, Data Truncated, BR/EDR,
      Connection Request
    - L2CAP/COS/CED/BI-15-C
      Multiple Signaling Command in one PDU, Data Truncated, BR/EDR,
      Disconnection Request
    
    The test procedure defined in L2CAP.TS.p39 for both tests is:
    1. The Lower Tester sends a C-frame to the IUT with PDU Length set
       to 8 and Channel ID set to the correct signaling channel for the
       logical link. The Information payload contains one L2CAP_ECHO_REQ
       packet with Data Length set to 0 with 0 octets of echo data and
       one command packet and Data Length set as specified in Table 4.6
       and the correct command data.
    2. The IUT sends an L2CAP_ECHO_RSP PDU to the Lower Tester.
    3. Perform alternative 3A, 3B, 3C, or 3D depending on the IUT’s
       response.
       Alternative 3A (IUT terminates the link):
         3A.1 The IUT terminates the link.
         3A.2 The test ends with a Pass verdict.
       Alternative 3B (IUT discards the frame):
         3B.1 The IUT does not send a reply to the Lower Tester.
       Alternative 3C (IUT rejects PDU):
         3C.1 The IUT sends an L2CAP_COMMAND_REJECT_RSP PDU to the
              Lower Tester.
       Alternative 3D (Any other IUT response):
         3D.1 The Upper Tester issues a warning and the test ends.
    4. The Lower Tester sends a C-frame to the IUT with PDU Length set
       to 4 and Channel ID set to the correct signaling channel for the
       logical link. The Information payload contains Data Length set to
       0 with an L2CAP_ECHO_REQ packet with 0 octets of echo data.
    5. The IUT sends an L2CAP_ECHO_RSP PDU to the Lower Tester.
    
    With expected outcome:
      In Steps 2 and 5, the IUT responds with an L2CAP_ECHO_RSP.
      In Step 3A.1, the IUT terminates the link.
      In Step 3B.1, the IUT does not send a reply to the Lower Tester.
      In Step 3C.1, the IUT rejects the PDU.
      In Step 3D.1, the IUT sends any valid response.
    
    Currently PTS fails with the following logs:
      Failed to receive ECHO RESPONSE.
    
    And HCI logs:
    > ACL Data RX: Handle 11 flags 0x02 dlen 20
          L2CAP: Information Response (0x0b) ident 2 len 12
            Type: Fixed channels supported (0x0003)
            Result: Success (0x0000)
            Channels: 0x000000000000002e
              L2CAP Signaling (BR/EDR)
              Connectionless reception
              AMP Manager Protocol
              L2CAP Signaling (LE)
    > ACL Data RX: Handle 11 flags 0x02 dlen 13
            frame too long
            08 01 00 00 08 02 01 00 aa                       .........
    
    Cc: [email protected]
    Signed-off-by: Frédéric Danis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: qca: simplify WCN399x NVM loading [+ + +]
Author: Dmitry Baryshkov <[email protected]>
Date:   Fri Feb 7 22:41:16 2025 +0200

    Bluetooth: qca: simplify WCN399x NVM loading
    
    [ Upstream commit 1cc41b5092e3aa511454ec882c525af311bee631 ]
    
    The WCN399x code has two separate cases for loading the NVM data. In
    preparation to adding support for WCN3950, which also requires similar
    quirk, split the "variant" to be specified explicitly and merge two
    snprintfs into a single one.
    
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: vhci: Avoid needless snprintf() calls [+ + +]
Author: Kees Cook <[email protected]>
Date:   Tue Apr 15 09:15:19 2025 -0700

    Bluetooth: vhci: Avoid needless snprintf() calls
    
    commit 875db86e1ec75fe633f1e85ed2f92c731cdbf760 upstream.
    
    Avoid double-copying of string literals. Use a "const char *" for each
    string instead of copying from .rodata into stack and then into the skb.
    We can go directly from .rodata to the skb.
    
    This also works around a Clang bug (that has since been fixed[1]).
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Fixes: ab4e4380d4e1 ("Bluetooth: Add vhci devcoredump support")
    Link: https://github.com/llvm/llvm-project/commit/ea2e66aa8b6e363b89df66dc44275a0d7ecd70ce [1]
    Cc: [email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Reviewed-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags [+ + +]
Author: Willem de Bruijn <[email protected]>
Date:   Tue Apr 8 09:27:48 2025 -0400

    bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags
    
    [ Upstream commit d4bac0288a2b444e468e6df9cb4ed69479ddf14a ]
    
    Classic BPF socket filters with SKB_NET_OFF and SKB_LL_OFF fail to
    read when these offsets extend into frags.
    
    This has been observed with iwlwifi and reproduced with tun with
    IFF_NAPI_FRAGS. The below straightforward socket filter on UDP port,
    applied to a RAW socket, will silently miss matching packets.
    
        const int offset_proto = offsetof(struct ip6_hdr, ip6_nxt);
        const int offset_dport = sizeof(struct ip6_hdr) + offsetof(struct udphdr, dest);
        struct sock_filter filter_code[] = {
                BPF_STMT(BPF_LD  + BPF_B   + BPF_ABS, SKF_AD_OFF + SKF_AD_PKTTYPE),
                BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, PACKET_HOST, 0, 4),
                BPF_STMT(BPF_LD  + BPF_B   + BPF_ABS, SKF_NET_OFF + offset_proto),
                BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 2),
                BPF_STMT(BPF_LD  + BPF_H   + BPF_ABS, SKF_NET_OFF + offset_dport),
    
    This is unexpected behavior. Socket filter programs should be
    consistent regardless of environment. Silent misses are
    particularly concerning as hard to detect.
    
    Use skb_copy_bits for offsets outside linear, same as done for
    non-SKF_(LL|NET) offsets.
    
    Offset is always positive after subtracting the reference threshold
    SKB_(LL|NET)_OFF, so is always >= skb_(mac|network)_offset. The sum of
    the two is an offset against skb->data, and may be negative, but it
    cannot point before skb->head, as skb_(mac|network)_offset would too.
    
    This appears to go back to when frag support was introduced to
    sk_run_filter in linux-2.4.4, before the introduction of git.
    
    The amount of code change and 8/16/32 bit duplication are unfortunate.
    But any attempt I made to be smarter saved very few LoC while
    complicating the code.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Link: https://lore.kernel.org/netdev/[email protected]/
    Link: https://elixir.bootlin.com/linux/2.4.4/source/net/core/filter.c#L244
    Reported-by: Matt Moeller <[email protected]>
    Co-developed-by: Maciej Żenczykowski <[email protected]>
    Signed-off-by: Maciej Żenczykowski <[email protected]>
    Signed-off-by: Willem de Bruijn <[email protected]>
    Acked-by: Stanislav Fomichev <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
btrfs: correctly escape subvol in btrfs_show_options() [+ + +]
Author: Johannes Kimmel <[email protected]>
Date:   Wed Mar 19 22:49:00 2025 +0100

    btrfs: correctly escape subvol in btrfs_show_options()
    
    commit dc08c58696f8555e4a802f1f23c894a330d80ab7 upstream.
    
    Currently, displaying the btrfs subvol mount option doesn't escape ','.
    This makes parsing /proc/self/mounts and /proc/self/mountinfo
    ambiguous for subvolume names that contain commas. The text after the
    comma could be mistaken for another option (think "subvol=foo,ro", where
    ro is actually part of the subvolumes name).
    
    Replace the manual escape characters list with a call to
    seq_show_option(). Thanks to Calvin Walton for suggesting this approach.
    
    Fixes: c8d3fe028f64 ("Btrfs: show subvol= and subvolid= in /proc/mounts")
    CC: [email protected] # 5.4+
    Suggested-by: Calvin Walton <[email protected]>
    Signed-off-by: Johannes Kimmel <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: fix non-empty delayed iputs list on unmount due to compressed write workers [+ + +]
Author: Filipe Manana <[email protected]>
Date:   Wed Mar 5 16:52:26 2025 +0000

    btrfs: fix non-empty delayed iputs list on unmount due to compressed write workers
    
    commit 4c782247b89376a83fa132f7d45d6977edae0629 upstream.
    
    At close_ctree() after we have ran delayed iputs either through explicitly
    calling btrfs_run_delayed_iputs() or later during the call to
    btrfs_commit_super() or btrfs_error_commit_super(), we assert that the
    delayed iputs list is empty.
    
    When we have compressed writes this assertion may fail because delayed
    iputs may have been added to the list after we last ran delayed iputs.
    This happens like this:
    
    1) We have a compressed write bio executing;
    
    2) We enter close_ctree() and flush the fs_info->endio_write_workers
       queue which is the queue used for running ordered extent completion;
    
    3) The compressed write bio finishes and enters
       btrfs_finish_compressed_write_work(), where it calls
       btrfs_finish_ordered_extent() which in turn calls
       btrfs_queue_ordered_fn(), which queues a work item in the
       fs_info->endio_write_workers queue that we have flushed before;
    
    4) At close_ctree() we proceed, run all existing delayed iputs and
       call btrfs_commit_super() (which also runs delayed iputs), but before
       we run the following assertion below:
    
          ASSERT(list_empty(&fs_info->delayed_iputs))
    
       A delayed iput is added by the step below...
    
    5) The ordered extent completion job queued in step 3 runs and results in
       creating a delayed iput when dropping the last reference of the ordered
       extent (a call to btrfs_put_ordered_extent() made from
       btrfs_finish_one_ordered());
    
    6) At this point the delayed iputs list is not empty, so the assertion at
       close_ctree() fails.
    
    Fix this by flushing the fs_info->compressed_write_workers queue at
    close_ctree() before flushing the fs_info->endio_write_workers queue,
    respecting the queue dependency as the later is responsible for the
    execution of ordered extent completion.
    
    CC: [email protected] # 5.15+
    Reviewed-by: Qu Wenruo <[email protected]>
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: fix qgroup reserve leaks in cow_file_range [+ + +]
Author: Boris Burkov <[email protected]>
Date:   Fri Jul 19 16:49:08 2024 -0700

    btrfs: fix qgroup reserve leaks in cow_file_range
    
    commit 30479f31d44d47ed00ae0c7453d9b253537005b2 upstream.
    
    In the buffered write path, the dirty page owns the qgroup reserve until
    it creates an ordered_extent.
    
    Therefore, any errors that occur before the ordered_extent is created
    must free that reservation, or else the space is leaked. The fstest
    generic/475 exercises various IO error paths, and is able to trigger
    errors in cow_file_range where we fail to get to allocating the ordered
    extent. Note that because we *do* clear delalloc, we are likely to
    remove the inode from the delalloc list, so the inodes/pages to not have
    invalidate/launder called on them in the commit abort path.
    
    This results in failures at the unmount stage of the test that look like:
    
      BTRFS: error (device dm-8 state EA) in cleanup_transaction:2018: errno=-5 IO failure
      BTRFS: error (device dm-8 state EA) in btrfs_replace_file_extents:2416: errno=-5 IO failure
      BTRFS warning (device dm-8 state EA): qgroup 0/5 has unreleased space, type 0 rsv 28672
      ------------[ cut here ]------------
      WARNING: CPU: 3 PID: 22588 at fs/btrfs/disk-io.c:4333 close_ctree+0x222/0x4d0 [btrfs]
      Modules linked in: btrfs blake2b_generic libcrc32c xor zstd_compress raid6_pq
      CPU: 3 PID: 22588 Comm: umount Kdump: loaded Tainted: G W          6.10.0-rc7-gab56fde445b8 #21
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
      RIP: 0010:close_ctree+0x222/0x4d0 [btrfs]
      RSP: 0018:ffffb4465283be00 EFLAGS: 00010202
      RAX: 0000000000000001 RBX: ffffa1a1818e1000 RCX: 0000000000000001
      RDX: 0000000000000000 RSI: ffffb4465283bbe0 RDI: ffffa1a19374fcb8
      RBP: ffffa1a1818e13c0 R08: 0000000100028b16 R09: 0000000000000000
      R10: 0000000000000003 R11: 0000000000000003 R12: ffffa1a18ad7972c
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007f9168312b80(0000) GS:ffffa1a4afcc0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f91683c9140 CR3: 000000010acaa000 CR4: 00000000000006f0
      Call Trace:
       <TASK>
       ? close_ctree+0x222/0x4d0 [btrfs]
       ? __warn.cold+0x8e/0xea
       ? close_ctree+0x222/0x4d0 [btrfs]
       ? report_bug+0xff/0x140
       ? handle_bug+0x3b/0x70
       ? exc_invalid_op+0x17/0x70
       ? asm_exc_invalid_op+0x1a/0x20
       ? close_ctree+0x222/0x4d0 [btrfs]
       generic_shutdown_super+0x70/0x160
       kill_anon_super+0x11/0x40
       btrfs_kill_super+0x11/0x20 [btrfs]
       deactivate_locked_super+0x2e/0xa0
       cleanup_mnt+0xb5/0x150
       task_work_run+0x57/0x80
       syscall_exit_to_user_mode+0x121/0x130
       do_syscall_64+0xab/0x1a0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7f916847a887
      ---[ end trace 0000000000000000 ]---
      BTRFS error (device dm-8 state EA): qgroup reserved space leaked
    
    Cases 2 and 3 in the out_reserve path both pertain to this type of leak
    and must free the reserved qgroup data. Because it is already an error
    path, I opted not to handle the possible errors in
    btrfs_free_qgroup_data.
    
    Reviewed-by: Qu Wenruo <[email protected]>
    Signed-off-by: Boris Burkov <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    [Minor conflict resolved due to code context change.]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: fix the length of reserved qgroup to free [+ + +]
Author: Haisu Wang <[email protected]>
Date:   Fri Oct 25 14:54:40 2024 +0800

    btrfs: fix the length of reserved qgroup to free
    
    commit 2b084d8205949dd804e279df8e68531da78be1e8 upstream.
    
    The dealloc flag may be cleared and the extent won't reach the disk in
    cow_file_range when errors path. The reserved qgroup space is freed in
    commit 30479f31d44d ("btrfs: fix qgroup reserve leaks in
    cow_file_range"). However, the length of untouched region to free needs
    to be adjusted with the correct remaining region size.
    
    Fixes: 30479f31d44d ("btrfs: fix qgroup reserve leaks in cow_file_range")
    CC: [email protected] # 6.11+
    Reviewed-by: Qu Wenruo <[email protected]>
    Reviewed-by: Boris Burkov <[email protected]>
    Signed-off-by: Haisu Wang <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: zoned: fix zone activation with missing devices [+ + +]
Author: Johannes Thumshirn <[email protected]>
Date:   Mon Mar 17 12:24:58 2025 +0100

    btrfs: zoned: fix zone activation with missing devices
    
    commit 2bbc4a45e5eb6b868357c1045bf6f38f6ba576e0 upstream.
    
    If btrfs_zone_activate() is called with a filesystem that has missing
    devices (e.g. a RAID file system mounted in degraded mode) it is accessing
    the btrfs_device::zone_info pointer, which will not be set if the device in
    question is missing.
    
    Check if the device is present (by checking if it has a valid block
    device pointer associated) and if not, skip zone activation for it.
    
    Fixes: f9a912a3c45f ("btrfs: zoned: make zone activation multi stripe capable")
    CC: [email protected] # 6.1+
    Reviewed-by: Naohiro Aota <[email protected]>
    Reviewed-by: Anand Jain <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: zoned: fix zone finishing with missing devices [+ + +]
Author: Johannes Thumshirn <[email protected]>
Date:   Mon Mar 17 12:24:59 2025 +0100

    btrfs: zoned: fix zone finishing with missing devices
    
    commit 35fec1089ebb5617f85884d3fa6a699ce6337a75 upstream.
    
    If do_zone_finish() is called with a filesystem that has missing devices
    (e.g. a RAID file system mounted in degraded mode) it is accessing the
    btrfs_device::zone_info pointer, which will not be set if the device
    in question is missing.
    
    Check if the device is present (by checking if it has a valid block device
    pointer associated) and if not, skip zone finishing for it.
    
    Fixes: 4dcbb8ab31c1 ("btrfs: zoned: make zone finishing multi stripe capable")
    CC: [email protected] # 6.1+
    Reviewed-by: Naohiro Aota <[email protected]>
    Reviewed-by: Anand Jain <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bus: mhi: host: Fix race between unprepare and queue_buf [+ + +]
Author: Jeff Hugo <[email protected]>
Date:   Thu Mar 6 10:29:13 2025 -0700

    bus: mhi: host: Fix race between unprepare and queue_buf
    
    commit 0686a818d77a431fc3ba2fab4b46bbb04e8c9380 upstream.
    
    A client driver may use mhi_unprepare_from_transfer() to quiesce
    incoming data during the client driver's tear down. The client driver
    might also be processing data at the same time, resulting in a call to
    mhi_queue_buf() which will invoke mhi_gen_tre(). If mhi_gen_tre() runs
    after mhi_unprepare_from_transfer() has torn down the channel, a panic
    will occur due to an invalid dereference leading to a page fault.
    
    This occurs because mhi_gen_tre() does not verify the channel state
    after locking it. Fix this by having mhi_gen_tre() confirm the channel
    state is valid, or return error to avoid accessing deinitialized data.
    
    Cc: [email protected] # 6.8
    Fixes: b89b6a863dd5 ("bus: mhi: host: Add spinlock to protect WP access when queueing TREs")
    Signed-off-by: Jeffrey Hugo <[email protected]>
    Signed-off-by: Jeff Hugo <[email protected]>
    Reviewed-by: Krishna Chaitanya Chundru <[email protected]>
    Reviewed-by: Youssef Samir <[email protected]>
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Reviewed-by: Troy Hanson <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [mani: added stable tag]
    Signed-off-by: Manivannan Sadhasivam <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk [+ + +]
Author: Philipp Hahn <[email protected]>
Date:   Mon Mar 10 11:17:35 2025 +0100

    cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk
    
    [ Upstream commit a07f23ad9baf716cbf7746e452c92960536ceae6 ]
    
    Lenovo ThinkPad Hybrid USB-C with USB-A Dock (17ef:a359) is affected by
    the same problem as the Lenovo Powered USB-C Travel Hub (17ef:721e):
    Both are based on the Realtek RTL8153B chip used to use the cdc_ether
    driver. However, using this driver, with the system suspended the device
    constantly sends pause-frames as soon as the receive buffer fills up.
    This causes issues with other devices, where some Ethernet switches stop
    forwarding packets altogether.
    
    Using the Realtek driver (r8152) fixes this issue. Pause frames are no
    longer sent while the host system is suspended.
    
    Cc: Leon Schuermann <[email protected]>
    Cc: Jakub Kicinski <[email protected]>
    Cc: Oliver Neukum <[email protected]> (maintainer:USB CDC ETHERNET DRIVER)
    Cc: [email protected] (open list:NETWORKING DRIVERS)
    Link: https://git.kernel.org/netdev/net/c/cb82a54904a9
    Link: https://git.kernel.org/netdev/net/c/2284bbd0cf39
    Link: https://www.lenovo.com/de/de/p/accessories-and-software/docking/docking-usb-docks/40af0135eu
    Signed-off-by: Philipp Hahn <[email protected]>
    Reviewed-by: Kory Maincent <[email protected]>
    Link: https://patch.msgid.link/484336aad52d14ccf061b535bc19ef6396ef5120.1741601523.git.p.hahn@avm.de
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cifs: avoid NULL pointer dereference in dbg call [+ + +]
Author: Alexandra Diupina <[email protected]>
Date:   Wed Mar 19 17:28:58 2025 +0300

    cifs: avoid NULL pointer dereference in dbg call
    
    commit b4885bd5935bb26f0a414ad55679a372e53f9b9b upstream.
    
    cifs_server_dbg() implies server to be non-NULL so
    move call under condition to avoid NULL pointer dereference.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: e79b0332ae06 ("cifs: ignore cached share root handle closing errors")
    Cc: [email protected]
    Signed-off-by: Alexandra Diupina <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cifs: Ensure that all non-client-specific reparse points are processed by the server [+ + +]
Author: Pali Rohár <[email protected]>
Date:   Sat Apr 5 19:51:07 2025 +0200

    cifs: Ensure that all non-client-specific reparse points are processed by the server
    
    commit 6f8a394aa952257575910d57cf0a63627fa949a2 upstream.
    
    Fix regression in mounts to e.g. onedrive shares.
    
    Generally, reparse points are processed by the SMB server during the
    SMB OPEN request, but there are few reparse points which do not have
    OPEN-like meaning for the SMB server and has to be processed by the SMB
    client. Those are symlinks and special files (fifo, socket, block, char).
    
    For Linux SMB client, it is required to process also name surrogate reparse
    points as they represent another entity on the SMB server system. Linux
    client will mark them as separate mount points. Examples of name surrogate
    reparse points are NTFS junction points (e.g. created by the "mklink" tool
    on Windows servers).
    
    So after processing the name surrogate reparse points, clear the
    -EOPNOTSUPP error code returned from the parse_reparse_point() to let SMB
    server to process reparse points.
    
    And remove printing misleading error message "unhandled reparse tag:" as
    reparse points are handled by SMB server and hence unhandled fact is normal
    operation.
    
    Fixes: cad3fc0a4c8c ("cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point()")
    Fixes: b587fd128660 ("cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes")
    Cc: [email protected]
    Reported-by: Junwen Sun <[email protected]>
    Tested-by: Junwen Sun <[email protected]>
    Signed-off-by: Pali Rohár <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cifs: fix integer overflow in match_server() [+ + +]
Author: Roman Smirnov <[email protected]>
Date:   Mon Mar 31 11:22:49 2025 +0300

    cifs: fix integer overflow in match_server()
    
    commit 2510859475d7f46ed7940db0853f3342bf1b65ee upstream.
    
    The echo_interval is not limited in any way during mounting,
    which makes it possible to write a large number to it. This can
    cause an overflow when multiplying ctx->echo_interval by HZ in
    match_server().
    
    Add constraints for echo_interval to smb3_fs_context_parse_param().
    
    Found by Linux Verification Center (linuxtesting.org) with Svace.
    
    Fixes: adfeb3e00e8e1 ("cifs: Make echo interval tunable")
    Cc: [email protected]
    Signed-off-by: Roman Smirnov <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
clk: qcom: clk-branch: Fix invert halt status bit check for votable clocks [+ + +]
Author: Ajit Pandey <[email protected]>
Date:   Tue Jan 28 17:08:35 2025 +0530

    clk: qcom: clk-branch: Fix invert halt status bit check for votable clocks
    
    commit 5eac348182d2b5ed1066459abedb7bc6b5466f81 upstream.
    
    BRANCH_HALT_ENABLE and BRANCH_HALT_ENABLE_VOTED flags are used to check
    halt status of branch clocks, which have an inverted logic for the halt
    bit in CBCR register. However, the current logic in the _check_halt()
    method only compares the BRANCH_HALT_ENABLE flags, ignoring the votable
    branch clocks.
    
    Update the logic to correctly handle the invert logic for votable clocks
    using the BRANCH_HALT_ENABLE_VOTED flags.
    
    Fixes: 9092d1083a62 ("clk: qcom: branch: Extend the invert logic for branch2 clocks")
    Cc: [email protected]
    Signed-off-by: Ajit Pandey <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code [+ + +]
Author: Bryan O'Donoghue <[email protected]>
Date:   Fri Jan 17 13:54:08 2025 +0000

    clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code
    
    commit 65a733464553ea192797b889d1533a1a37216f32 upstream.
    
    Adding a new clause to this if/else I noticed the existing usage of
    pm_genpd_add_subdomain() wasn't capturing and returning the result code.
    
    pm_genpd_add_subdomain() returns an int and can fail. Capture that result
    code and throw it up the call stack if something goes wrong.
    
    Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
    Cc: [email protected]
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Link: https://lore.kernel.org/r/20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-2-13f2bb656dad@linaro.org
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

clk: qcom: gdsc: Release pm subdomains in reverse add order [+ + +]
Author: Bryan O'Donoghue <[email protected]>
Date:   Fri Jan 17 13:54:07 2025 +0000

    clk: qcom: gdsc: Release pm subdomains in reverse add order
    
    commit 0e6dfde439df0bb977cddd3cf7fff150a084a9bf upstream.
    
    gdsc_unregister() should release subdomains in the reverse order to the
    order in which those subdomains were added.
    
    I've made this patch a standalone patch because it facilitates a subsequent
    fix to stable.
    
    Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
    Cc: [email protected]
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Link: https://lore.kernel.org/r/20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-1-13f2bb656dad@linaro.org
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

clk: qcom: gdsc: Set retain_ff before moving to HW CTRL [+ + +]
Author: Taniya Das <[email protected]>
Date:   Fri Feb 14 09:56:59 2025 +0530

    clk: qcom: gdsc: Set retain_ff before moving to HW CTRL
    
    commit 25708f73ff171bb4171950c9f4be5aa8504b8459 upstream.
    
    Enable the retain_ff_enable bit of GDSCR only if the GDSC is already ON.
    Once the GDSCR moves to HW control, SW no longer can determine the state
    of the GDSCR and setting the retain_ff bit could destroy all the register
    contents we intended to save.
    Therefore, move the retain_ff configuration before switching the GDSC to
    HW trigger mode.
    
    Cc: [email protected]
    Fixes: 173722995cdb ("clk: qcom: gdsc: Add support to enable retention of GSDCR")
    Signed-off-by: Taniya Das <[email protected]>
    Reviewed-by: Imran Shaik <[email protected]>
    Tested-by: Imran Shaik <[email protected]> # on QCS8300
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup [+ + +]
Author: Alexandre Torgue <[email protected]>
Date:   Thu Mar 6 11:25:01 2025 +0100

    clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup
    
    commit 96bf4b89a6ab22426ad83ef76e66c72a5a8daca0 upstream.
    
    "wakeup-source" property describes a device which has wakeup capability
    but should not force this device as a wakeup source.
    
    Fixes: 48b41c5e2de6 ("clocksource: Add Low Power STM32 timers driver")
    Cc: [email protected]
    Signed-off-by: Alexandre Torgue <[email protected]>
    Signed-off-by: Fabrice Gasnier <[email protected]>
    Rule: add
    Link: https://lore.kernel.org/stable/20250306083407.2374894-1-fabrice.gasnier%40foss.st.com
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Daniel Lezcano <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog() [+ + +]
Author: Cong Wang <[email protected]>
Date:   Thu Apr 3 14:16:31 2025 -0700

    codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()
    
    [ Upstream commit 342debc12183b51773b3345ba267e9263bdfaaef ]
    
    After making all ->qlen_notify() callbacks idempotent, now it is safe to
    remove the check of qlen!=0 from both fq_codel_dequeue() and
    codel_qdisc_dequeue().
    
    Reported-by: Gerrard Tai <[email protected]>
    Fixes: 4b549a2ef4be ("fq_codel: Fair Queue Codel AQM")
    Fixes: 76e3cc126bb2 ("codel: Controlled Delay AQM")
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cpufreq/sched: Fix the usage of CPUFREQ_NEED_UPDATE_LIMITS [+ + +]
Author: Rafael J. Wysocki <[email protected]>
Date:   Tue Apr 15 11:58:08 2025 +0200

    cpufreq/sched: Fix the usage of CPUFREQ_NEED_UPDATE_LIMITS
    
    [ Upstream commit cfde542df7dd51d26cf667f4af497878ddffd85a ]
    
    Commit 8e461a1cb43d ("cpufreq: schedutil: Fix superfluous updates caused
    by need_freq_update") modified sugov_should_update_freq() to set the
    need_freq_update flag only for drivers with CPUFREQ_NEED_UPDATE_LIMITS
    set, but that flag generally needs to be set when the policy limits
    change because the driver callback may need to be invoked for the new
    limits to take effect.
    
    However, if the return value of cpufreq_driver_resolve_freq() after
    applying the new limits is still equal to the previously selected
    frequency, the driver callback needs to be invoked only in the case
    when CPUFREQ_NEED_UPDATE_LIMITS is set (which means that the driver
    specifically wants its callback to be invoked every time the policy
    limits change).
    
    Update the code accordingly to avoid missing policy limits changes for
    drivers without CPUFREQ_NEED_UPDATE_LIMITS.
    
    Fixes: 8e461a1cb43d ("cpufreq: schedutil: Fix superfluous updates caused by need_freq_update")
    Closes: https://lore.kernel.org/lkml/[email protected]/
    Reported-by: Stephan Gerhold <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Reviewed-by: Christian Loehle <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
cpufreq: Reference count policy in cpufreq_update_limits() [+ + +]
Author: Rafael J. Wysocki <[email protected]>
Date:   Fri Mar 28 21:39:08 2025 +0100

    cpufreq: Reference count policy in cpufreq_update_limits()
    
    commit 9e4e249018d208678888bdf22f6b652728106528 upstream.
    
    Since acpi_processor_notify() can be called before registering a cpufreq
    driver or even in cases when a cpufreq driver is not registered at all,
    cpufreq_update_limits() needs to check if a cpufreq driver is present
    and prevent it from being unregistered.
    
    For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
    policy pointer for the given CPU and reference count the corresponding
    policy object, if present.
    
    Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
    Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
    Reported-by: Marek Marczykowski-Górecki <[email protected]>
    Cc: All applicable <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Acked-by: Viresh Kumar <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [do not use __free(cpufreq_cpu_put) in a backport]
    Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
crypto: caam/qi - Fix drv_ctx refcount bug [+ + +]
Author: Herbert Xu <[email protected]>
Date:   Tue Apr 8 13:17:20 2025 +0800

    crypto: caam/qi - Fix drv_ctx refcount bug
    
    commit b7b39df7e710b0068356e4c696af07aa10e2cd3d upstream.
    
    Ensure refcount is raised before request is enqueued since it could
    be dequeued before the call returns.
    
    Reported-by: Sean Anderson <[email protected]>
    Cc: <[email protected]>
    Fixes: 11144416a755 ("crypto: caam/qi - optimize frame queue cleanup")
    Signed-off-by: Herbert Xu <[email protected]>
    Reviewed-by: Horia Geantă <[email protected]>
    Tested-by: Sean Anderson <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

crypto: ccp - Fix check for the primary ASP device [+ + +]
Author: Tom Lendacky <[email protected]>
Date:   Fri Jan 17 17:05:47 2025 -0600

    crypto: ccp - Fix check for the primary ASP device
    
    commit 07bb097b92b987db518e72525b515d77904e966e upstream.
    
    Currently, the ASP primary device check does not have support for PCI
    domains, and, as a result, when the system is configured with PCI domains
    (PCI segments) the wrong device can be selected as primary. This results
    in commands submitted to the device timing out and failing. The device
    check also relies on specific device and function assignments that may
    not hold in the future.
    
    Fix the primary ASP device check to include support for PCI domains and
    to perform proper checking of the Bus/Device/Function positions.
    
    Fixes: 2a6170dfe755 ("crypto: ccp: Add Platform Security Processor (PSP) device support")
    Cc: [email protected]
    Signed-off-by: Tom Lendacky <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cxgb4: fix memory leak in cxgb4_init_ethtool_filters() error path [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Mon Apr 14 22:36:46 2025 +0530

    cxgb4: fix memory leak in cxgb4_init_ethtool_filters() error path
    
    [ Upstream commit 00ffb3724ce743578163f5ade2884374554ca021 ]
    
    In the for loop used to allocate the loc_array and bmap for each port, a
    memory leak is possible when the allocation for loc_array succeeds,
    but the allocation for bmap fails. This is because when the control flow
    goes to the label free_eth_finfo, only the allocations starting from
    (i-1)th iteration are freed.
    
    Fix that by freeing the loc_array in the bmap allocation error path.
    
    Fixes: d915c299f1da ("cxgb4: add skeleton for ethtool n-tuple filters")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
dm-ebs: fix prefetch-vs-suspend race [+ + +]
Author: Mikulas Patocka <[email protected]>
Date:   Fri Mar 28 16:19:07 2025 +0100

    dm-ebs: fix prefetch-vs-suspend race
    
    commit 9c565428788fb9b49066f94ab7b10efc686a0a4c upstream.
    
    There's a possible race condition in dm-ebs - dm bufio prefetch may be in
    progress while the device is suspended. Fix this by calling
    dm_bufio_client_reset in the postsuspend hook.
    
    Signed-off-by: Mikulas Patocka <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dm-integrity: set ti->error on memory allocation failure [+ + +]
Author: Mikulas Patocka <[email protected]>
Date:   Mon Feb 10 16:14:22 2025 +0100

    dm-integrity: set ti->error on memory allocation failure
    
    commit 00204ae3d6712ee053353920e3ce2b00c35ef75b upstream.
    
    The dm-integrity target didn't set the error string when memory
    allocation failed. This patch fixes it.
    
    Signed-off-by: Mikulas Patocka <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dm-verity: fix prefetch-vs-suspend race [+ + +]
Author: Mikulas Patocka <[email protected]>
Date:   Fri Mar 28 16:17:45 2025 +0100

    dm-verity: fix prefetch-vs-suspend race
    
    commit 2de510fccbca3d1906b55f4be5f1de83fa2424ef upstream.
    
    There's a possible race condition in dm-verity - the prefetch work item
    may race with suspend and it is possible that prefetch continues to run
    while the device is suspended. Fix this by calling flush_workqueue and
    dm_bufio_client_reset in the postsuspend hook.
    
    Signed-off-by: Mikulas Patocka <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drivers: base: devres: Allow to release group on device release [+ + +]
Author: Lucas De Marchi <[email protected]>
Date:   Fri Feb 21 16:10:41 2025 -0800

    drivers: base: devres: Allow to release group on device release
    
    [ Upstream commit 8e1ddfada4530939a8cb64ee9251aef780474274 ]
    
    When releasing a device, if the release action causes a group to be
    released, a warning is emitted because it can't find the group. This
    happens because devres_release_all() moves the entire list to a todo
    list and also move the group markers. Considering r* normal resource
    nodes and g1 a group resource node:
    
                        g1 -----------.
                        v             v
            r1 -> r2 -> g1[0] -> r3-> g[1] -> r4
    
    After devres_release_all(), dev->devres_head becomes empty and the todo
    list it iterates on becomes:
    
                                   g1
                                   v
            r1 -> r2 -> r3-> r4 -> g1[0]
    
    When a call to component_del() is made and takes down the aggregate
    device, a warning like this happen:
    
            RIP: 0010:devres_release_group+0x362/0x530
            ...
            Call Trace:
             <TASK>
             component_unbind+0x156/0x380
             component_unbind_all+0x1d0/0x270
             mei_component_master_unbind+0x28/0x80 [mei_hdcp]
             take_down_aggregate_device+0xc1/0x160
             component_del+0x1c6/0x3e0
             intel_hdcp_component_fini+0xf1/0x170 [xe]
             xe_display_fini+0x1e/0x40 [xe]
    
    Because the devres group corresponding to the hdcp component cannot be
    found. Just ignore this corner case: if the dev->devres_head is empty
    and the caller is trying to remove a group, it's likely in the process
    of device cleanup so just ignore it instead of warning.
    
    Acked-by: Greg Kroah-Hartman <[email protected]>
    Reviewed-by: Rodrigo Vivi <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Lucas De Marchi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/display: add workaround flag to link to force FFE preset [+ + +]
Author: Brendan Tam <[email protected]>
Date:   Thu Jan 23 11:25:16 2025 -0500

    drm/amd/display: add workaround flag to link to force FFE preset
    
    [ Upstream commit 51d1b338541dea83fec8e6f95d3e46fa469a73a8 ]
    
    [Why]
    There have been instances of some monitors being unable to link train on
    their reported link speed using their selected FFE preset. If a different
    FFE preset is found that has a higher rate of success during link training
    this workaround can be used to force its FFE preset.
    
    [How]
    A new link workaround flag is made called force_dp_ffe_preset. The flag is
    checked in override_training_settings and will set lt_settings->ffe_preset
    which is null if the flag is not set. The flag is then set in
    override_lane_settings.
    
    Reviewed-by: Wenjing Liu <[email protected]>
    Signed-off-by: Brendan Tam <[email protected]>
    Signed-off-by: Aurabindo Pillai <[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: Stop amdgpu_dm initialize when link nums greater than max_links [+ + +]
Author: Hersen Wu <[email protected]>
Date:   Wed Apr 24 16:15:15 2024 -0400

    drm/amd/display: Stop amdgpu_dm initialize when link nums greater than max_links
    
    commit cf8b16857db702ceb8d52f9219a4613363e2b1cf upstream.
    
    [Why]
    Coverity report OVERRUN warning. There are
    only max_links elements within dc->links. link
    count could up to AMDGPU_DM_MAX_DISPLAY_INDEX 31.
    
    [How]
    Make sure link count less than max_links.
    
    Reviewed-by: Harry Wentland <[email protected]>
    Acked-by: Tom Chung <[email protected]>
    Signed-off-by: Hersen Wu <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    [Minor conflict resolved due to code context change. And the macro MAX_LINKS
     is introduced by Commit 60df5628144b ("drm/amd/display: handle invalid
     connector indices") after 6.10. So here we still use the original array
     length MAX_PIPES * 2]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: Update Cursor request mode to the beginning prefetch always [+ + +]
Author: Zhikai Zhai <[email protected]>
Date:   Thu Jan 9 16:11:48 2025 +0800

    drm/amd/display: Update Cursor request mode to the beginning prefetch always
    
    [ Upstream commit 4a4077b4b63a8404efd6d37fc2926f03fb25bace ]
    
    [Why]
    The double buffer cursor registers is updated by the cursor
    vupdate event. There is a gap between vupdate and cursor data
    fetch if cursor fetch data reletive to cursor position.
    Cursor corruption will happen if we update the cursor surface
    in this gap.
    
    [How]
    Modify the cursor request mode to the beginning prefetch always
    and avoid wraparound calculation issues.
    
    Reviewed-by: Nicholas Kazlauskas <[email protected]>
    Signed-off-by: Zhikai Zhai <[email protected]>
    Signed-off-by: Zaeem Mohamed <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/pm/powerplay/hwmgr/smu7_thermal: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Fri Mar 21 14:08:16 2025 +0300

    drm/amd/pm/powerplay/hwmgr/smu7_thermal: Prevent division by zero
    
    commit 7c246a05df51c52fe0852ce56ba10c41e6ed1f39 upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: c52dcf49195d ("drm/amd/pp: Avoid divide-by-zero in fan_ctrl_set_fan_speed_rpm")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm/powerplay/hwmgr/vega20_thermal: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Fri Mar 21 13:52:33 2025 +0300

    drm/amd/pm/powerplay/hwmgr/vega20_thermal: Prevent division by zero
    
    commit 4e3d9508c056d7e0a56b58d5c81253e2a0d22b6c upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 031db09017da ("drm/amd/powerplay/vega20: enable fan RPM and pwm settings V2")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm/powerplay: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Fri Mar 21 14:08:15 2025 +0300

    drm/amd/pm/powerplay: Prevent division by zero
    
    commit 4b8c3c0d17c07f301011e2908fecd2ebdcfe3d1c upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: c52dcf49195d ("drm/amd/pp: Avoid divide-by-zero in fan_ctrl_set_fan_speed_rpm")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm/smu11: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Thu Mar 20 12:35:02 2025 +0300

    drm/amd/pm/smu11: Prevent division by zero
    
    commit 7ba88b5cccc1a99c1afb96e31e7eedac9907704c upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 1e866f1fe528 ("drm/amd/pm: Prevent divide by zero")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit da7dc714a8f8e1c9fc33c57cd63583779a3bef71)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm/swsmu/smu13/smu_v13_0: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Fri Mar 21 13:52:31 2025 +0300

    drm/amd/pm/swsmu/smu13/smu_v13_0: Prevent division by zero
    
    commit f23e9116ebb71b63fe9cec0dcac792aa9af30b0c upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: c05d1c401572 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm: Prevent division by zero [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Fri Mar 21 13:52:32 2025 +0300

    drm/amd/pm: Prevent division by zero
    
    commit 7d641c2b83275d3b0424127b2e0d2d0f7dd82aef upstream.
    
    The user can set any speed value.
    If speed is greater than UINT_MAX/8, division by zero is possible.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: b64625a303de ("drm/amd/pm: correct the address of Arcturus fan related registers")
    Signed-off-by: Denis Arefev <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd: Handle being compiled without SI or CIK support better [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Wed Mar 19 11:58:31 2025 -0500

    drm/amd: Handle being compiled without SI or CIK support better
    
    commit 5f054ddead33c1622ea9c0c0aaf07c6843fc7ab0 upstream.
    
    If compiled without SI or CIK support but amdgpu tries to load it
    will run into failures with uninitialized callbacks.
    
    Show a nicer message in this case and fail probe instead.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4050
    Signed-off-by: Mario Limonciello <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu/dma_buf: fix page_link check [+ + +]
Author: Matthew Auld <[email protected]>
Date:   Mon Apr 7 15:18:25 2025 +0100

    drm/amdgpu/dma_buf: fix page_link check
    
    commit c0dd8a9253fadfb8e5357217d085f1989da4ef0a upstream.
    
    The page_link lower bits of the first sg could contain something like
    SG_END, if we are mapping a single VRAM page or contiguous blob which
    fits into one sg entry. Rather pull out the struct page, and use that in
    our check to know if we mapped struct pages vs VRAM.
    
    Fixes: f44ffd677fb3 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3")
    Signed-off-by: Matthew Auld <[email protected]>
    Cc: Christian König <[email protected]>
    Cc: [email protected]
    Cc: <[email protected]> # v5.8+
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu: grab an additional reference on the gang fence v2 [+ + +]
Author: Christian König <[email protected]>
Date:   Tue Jan 14 13:51:39 2025 +0100

    drm/amdgpu: grab an additional reference on the gang fence v2
    
    [ Upstream commit 0d9a95099dcb05b5f4719c830d15bf4fdcad0dc2 ]
    
    We keep the gang submission fence around in adev, make sure that it
    stays alive.
    
    v2: fix memory leak on retry
    
    Signed-off-by: Christian König <[email protected]>
    Acked-by: Srinivasan Shanmugam <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create() [+ + +]
Author: Wentao Liang <[email protected]>
Date:   Thu Mar 6 15:51:48 2025 +0800

    drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
    
    [ Upstream commit 1435e895d4fc967d64e9f5bf81e992ac32f5ac76 ]
    
    Add error handling to propagate amdgpu_cgs_create_device() failures
    to the caller. When amdgpu_cgs_create_device() fails, release hwmgr
    and return -ENOMEM to prevent null pointer dereference.
    
    [v1]->[v2]: Change error code from -EINVAL to -ENOMEM. Free hwmgr.
    
    Signed-off-by: Wentao Liang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amdkfd: clamp queue size to minimum [+ + +]
Author: David Yat Sin <[email protected]>
Date:   Tue Feb 25 18:08:02 2025 -0500

    drm/amdkfd: clamp queue size to minimum
    
    [ Upstream commit e90711946b53590371ecce32e8fcc381a99d6333 ]
    
    If queue size is less than minimum, clamp it to minimum to prevent
    underflow when writing queue mqd.
    
    Signed-off-by: David Yat Sin <[email protected]>
    Reviewed-by: Jay Cornwall <[email protected]>
    Reviewed-by: Harish Kasiviswanathan <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdkfd: debugfs hang_hws skip GPU with MES [+ + +]
Author: Philip Yang <[email protected]>
Date:   Mon Feb 10 09:42:31 2025 -0500

    drm/amdkfd: debugfs hang_hws skip GPU with MES
    
    [ Upstream commit fe9d0061c413f8fb8c529b18b592b04170850ded ]
    
    debugfs hang_hws is used by GPU reset test with HWS, for MES this crash
    the kernel with NULL pointer access because dqm->packet_mgr is not setup
    for MES path.
    
    Skip GPU with MES for now, MES hang_hws debugfs interface will be
    supported later.
    
    Signed-off-by: Philip Yang <[email protected]>
    Reviewed-by: Kent Russell <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdkfd: Fix mode1 reset crash issue [+ + +]
Author: Philip Yang <[email protected]>
Date:   Thu Feb 6 17:50:13 2025 -0500

    drm/amdkfd: Fix mode1 reset crash issue
    
    [ Upstream commit f0b4440cdc1807bb6ec3dce0d6de81170803569b ]
    
    If HW scheduler hangs and mode1 reset is used to recover GPU, KFD signal
    user space to abort the processes. After process abort exit, user queues
    still use the GPU to access system memory before h/w is reset while KFD
    cleanup worker free system memory and free VRAM.
    
    There is use-after-free race bug that KFD allocate and reuse the freed
    system memory, and user queue write to the same system memory to corrupt
    the data structure and cause driver crash.
    
    To fix this race, KFD cleanup worker terminate user queues, then flush
    reset_domain wq to wait for any GPU ongoing reset complete, and then
    free outstanding BOs.
    
    Signed-off-by: Philip Yang <[email protected]>
    Reviewed-by: Lijo Lazar <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/amdkfd: Fix pqm_destroy_queue race with GPU reset [+ + +]
Author: Philip Yang <[email protected]>
Date:   Thu Feb 20 16:02:13 2025 -0500

    drm/amdkfd: Fix pqm_destroy_queue race with GPU reset
    
    [ Upstream commit 7919b4cad5545ed93778f11881ceee72e4dbed66 ]
    
    If GPU in reset, destroy_queue return -EIO, pqm_destroy_queue should
    delete the queue from process_queue_list and free the resource.
    
    Signed-off-by: Philip Yang <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/bridge: panel: forbid initializing a panel with unknown connector type [+ + +]
Author: Luca Ceresoli <[email protected]>
Date:   Fri Feb 14 13:57:44 2025 +0100

    drm/bridge: panel: forbid initializing a panel with unknown connector type
    
    [ Upstream commit b296955b3a740ecc8b3b08e34fd64f1ceabb8fb4 ]
    
    Having an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and
    drm_panel_bridge_add_typed() and derivatives are deprecated for this.
    
    drm_panel_init() won't prevent initializing a panel with a
    DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree
    users doing it, so take this as an opportinuty to document a valid
    connector type must be passed.
    
    Returning an error if this rule is violated is not possible because
    drm_panel_init() is a void function. Add at least a warning to make any
    violations noticeable, especially to non-upstream drivers.
    
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Luca Ceresoli <[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/i915/dg2: wait for HuC load completion before running selftests [+ + +]
Author: Daniele Ceraolo Spurio <[email protected]>
Date:   Wed Apr 10 13:15:05 2024 -0700

    drm/i915/dg2: wait for HuC load completion before running selftests
    
    [ Upstream commit c3015eb6e25a735ab77591573236169eab8e2e3a ]
    
    On DG2, submissions to VCS engines tied to a gem context are blocked
    until the HuC is loaded. Since some selftests do use a gem context,
    wait for the HuC load to complete before running the tests to avoid
    contamination.
    
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10564
    Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
    Cc: John Harrison <[email protected]>
    Reviewed-by: John Harrison <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: 9d3d9776bd3b ("drm/i915: Disable RPG during live selftest")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/gvt: fix unterminated-string-initialization warning [+ + +]
Author: Jani Nikula <[email protected]>
Date:   Thu Mar 27 14:47:39 2025 +0200

    drm/i915/gvt: fix unterminated-string-initialization warning
    
    commit 2e43ae7dd71cd9bb0d1bce1d3306bf77523feb81 upstream.
    
    Initializing const char opregion_signature[16] = OPREGION_SIGNATURE
    (which is "IntelGraphicsMem") drops the NUL termination of the
    string. This is intentional, but the compiler doesn't know this.
    
    Switch to initializing header->signature directly from the string
    litaral, with sizeof destination rather than source. We don't treat the
    signature as a string other than for initialization; it's really just a
    blob of binary data.
    
    Add a static assert for good measure to cross-check the sizes.
    
    Reported-by: Kees Cook <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]
    Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13934
    Tested-by: Nicolas Chauvet <[email protected]>
    Tested-by: Damian Tometzki <[email protected]>
    Cc: [email protected]
    Reviewed-by: Zhenyu Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jani Nikula <[email protected]>
    (cherry picked from commit 4f8207469094bd04aad952258ceb9ff4c77b6bfa)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/i915/huc: Fix fence not released on early probe errors [+ + +]
Author: Janusz Krzysztofik <[email protected]>
Date:   Wed Apr 2 19:20:57 2025 +0200

    drm/i915/huc: Fix fence not released on early probe errors
    
    [ Upstream commit e3ea2eae70692a455e256787e4f54153fb739b90 ]
    
    HuC delayed loading fence, introduced with commit 27536e03271da
    ("drm/i915/huc: track delayed HuC load with a fence"), is registered with
    object tracker early on driver probe but unregistered only from driver
    remove, which is not called on early probe errors.  Since its memory is
    allocated under devres, then released anyway, it may happen to be
    allocated again to the fence and reused on future driver probes, resulting
    in kernel warnings that taint the kernel:
    
    <4> [309.731371] ------------[ cut here ]------------
    <3> [309.731373] ODEBUG: init destroyed (active state 0) object: ffff88813d7dd2e0 object type: i915_sw_fence hint: sw_fence_dummy_notify+0x0/0x20 [i915]
    <4> [309.731575] WARNING: CPU: 2 PID: 3161 at lib/debugobjects.c:612 debug_print_object+0x93/0xf0
    ...
    <4> [309.731693] CPU: 2 UID: 0 PID: 3161 Comm: i915_module_loa Tainted: G     U             6.14.0-CI_DRM_16362-gf0fd77956987+ #1
    ...
    <4> [309.731700] RIP: 0010:debug_print_object+0x93/0xf0
    ...
    <4> [309.731728] Call Trace:
    <4> [309.731730]  <TASK>
    ...
    <4> [309.731949]  __debug_object_init+0x17b/0x1c0
    <4> [309.731957]  debug_object_init+0x34/0x50
    <4> [309.732126]  __i915_sw_fence_init+0x34/0x60 [i915]
    <4> [309.732256]  intel_huc_init_early+0x4b/0x1d0 [i915]
    <4> [309.732468]  intel_uc_init_early+0x61/0x680 [i915]
    <4> [309.732667]  intel_gt_common_init_early+0x105/0x130 [i915]
    <4> [309.732804]  intel_root_gt_init_early+0x63/0x80 [i915]
    <4> [309.732938]  i915_driver_probe+0x1fa/0xeb0 [i915]
    <4> [309.733075]  i915_pci_probe+0xe6/0x220 [i915]
    <4> [309.733198]  local_pci_probe+0x44/0xb0
    <4> [309.733203]  pci_device_probe+0xf4/0x270
    <4> [309.733209]  really_probe+0xee/0x3c0
    <4> [309.733215]  __driver_probe_device+0x8c/0x180
    <4> [309.733219]  driver_probe_device+0x24/0xd0
    <4> [309.733223]  __driver_attach+0x10f/0x220
    <4> [309.733230]  bus_for_each_dev+0x7d/0xe0
    <4> [309.733236]  driver_attach+0x1e/0x30
    <4> [309.733239]  bus_add_driver+0x151/0x290
    <4> [309.733244]  driver_register+0x5e/0x130
    <4> [309.733247]  __pci_register_driver+0x7d/0x90
    <4> [309.733251]  i915_pci_register_driver+0x23/0x30 [i915]
    <4> [309.733413]  i915_init+0x34/0x120 [i915]
    <4> [309.733655]  do_one_initcall+0x62/0x3f0
    <4> [309.733667]  do_init_module+0x97/0x2a0
    <4> [309.733671]  load_module+0x25ff/0x2890
    <4> [309.733688]  init_module_from_file+0x97/0xe0
    <4> [309.733701]  idempotent_init_module+0x118/0x330
    <4> [309.733711]  __x64_sys_finit_module+0x77/0x100
    <4> [309.733715]  x64_sys_call+0x1f37/0x2650
    <4> [309.733719]  do_syscall_64+0x91/0x180
    <4> [309.733763]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
    <4> [309.733792]  </TASK>
    ...
    <4> [309.733806] ---[ end trace 0000000000000000 ]---
    
    That scenario is most easily reproducible with
    igt@i915_module_load@reload-with-fault-injection.
    
    Fix the issue by moving the cleanup step to driver release path.
    
    Fixes: 27536e03271da ("drm/i915/huc: track delayed HuC load with a fence")
    Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13592
    Cc: Daniele Ceraolo Spurio <[email protected]>
    Cc: Alan Previn <[email protected]>
    Signed-off-by: Janusz Krzysztofik <[email protected]>
    Reviewed-by: Daniele Ceraolo Spurio <[email protected]>
    Reviewed-by: Krzysztof Karas <[email protected]>
    Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    (cherry picked from commit 795dbde92fe5c6996a02a5b579481de73035e7bf)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/mocs: use to_gt() instead of direct &i915->gt [+ + +]
Author: Jani Nikula <[email protected]>
Date:   Mon Oct 2 11:47:02 2023 +0300

    drm/i915/mocs: use to_gt() instead of direct &i915->gt
    
    [ Upstream commit 5ed8c7bcf9a58372d3be3d9cd167e45497efaae2 ]
    
    Have to give up the const on i915 pointer, but it's not big of a deal
    considering non-const i915 gets passed all over the place.
    
    Signed-off-by: Jani Nikula <[email protected]>
    Reviewed-by: Gustavo Sousa <[email protected]>
    Reviewed-by: Andi Shyti <[email protected]>
    Acked-by: Michał Winiarski <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/63e644f056c7745eb0e8e165c990c392a38ec85c.1696236329.git.jani.nikula@intel.com
    Stable-dep-of: 9d3d9776bd3b ("drm/i915: Disable RPG during live selftest")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/xelpg: Extend driver code of Xe_LPG to Xe_LPG+ [+ + +]
Author: Harish Chegondi <[email protected]>
Date:   Mon Jan 8 17:57:37 2024 +0530

    drm/i915/xelpg: Extend driver code of Xe_LPG to Xe_LPG+
    
    [ Upstream commit 84bf82f4f8661930a134a1d86bde16f7d8bcd699 ]
    
    Xe_LPG+ (IP version 12.74) should take the same general code
    paths as Xe_LPG (versions 12.70 and 12.71).
    
    Xe_LPG+'s workaround list will be handled by the next patch.
    
    Signed-off-by: Harish Chegondi <[email protected]>
    Signed-off-by: Haridhar Kalvala <[email protected]>
    Reviewed-by: Matt Roper <[email protected]>
    Signed-off-by: Matt Roper <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: 9d3d9776bd3b ("drm/i915: Disable RPG during live selftest")
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915: Disable RPG during live selftest [+ + +]
Author: Badal Nilawar <[email protected]>
Date:   Mon Mar 10 20:58:21 2025 +0530

    drm/i915: Disable RPG during live selftest
    
    [ Upstream commit 9d3d9776bd3bd9c32d460dfe6c3363134de578bc ]
    
    The Forcewake timeout issue has been observed on Gen 12.0 and above.
    To address this, disable Render Power-Gating (RPG) during live self-tests
    for these generations. The temporary workaround 'drm/i915/mtl: do not
    enable render power-gating on MTL' disables RPG globally, which is
    unnecessary since the issues were only seen during self-tests.
    
    v2: take runtime pm wakeref
    
    Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9413
    Fixes: 25e7976db86b ("drm/i915/mtl: do not enable render power-gating on MTL")
    Cc: Rodrigo Vivi <[email protected]>
    Cc: Andi Shyti <[email protected]>
    Cc: Andrzej Hajda <[email protected]>
    Signed-off-by: Badal Nilawar <[email protected]>
    Signed-off-by: Sk Anirban <[email protected]>
    Reviewed-by: Karthik Poosa <[email protected]>
    Signed-off-by: Anshuman Gupta <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit 0a4ae87706c6d15d14648e428c3a76351f823e48)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off [+ + +]
Author: AngeloGioacchino Del Regno <[email protected]>
Date:   Mon Feb 17 16:48:02 2025 +0100

    drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
    
    [ Upstream commit 473c33f5ce651365468503c76f33158aaa1c7dd2 ]
    
    In preparation for adding support for MT8195's HDMI reserved
    DPI, add calls to clk_prepare_enable() / clk_disable_unprepare()
    for the TVD clock: in this particular case, the aforementioned
    clock is not (and cannot be) parented to neither pixel or engine
    clocks hence it won't get enabled automatically by the clock
    framework.
    
    Please note that on all of the currently supported MediaTek
    platforms, the TVD clock is always a parent of either pixel or
    engine clocks, and this means that the common clock framework
    is already enabling this clock before the children.
    On such platforms, this commit will only increase the refcount
    of the TVD clock without any functional change.
    
    Reviewed-by: CK Hu <[email protected]>
    Signed-off-by: AngeloGioacchino Del Regno <[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/mediatek: mtk_dpi: Move the input_2p_en bit to platform data [+ + +]
Author: AngeloGioacchino Del Regno <[email protected]>
Date:   Mon Feb 17 16:47:59 2025 +0100

    drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
    
    [ Upstream commit c90876a695dd83e76680b88b40067275a5982811 ]
    
    In preparation for adding support for MT8195's HDMI reserved DPI
    instance, move the input_2p_en bit for DP_INTF to platform data.
    
    While at it, remove the input_2pixel member from platform data as
    having this bit implies that the 2pixel feature must be enabled.
    
    Reviewed-by: CK Hu <[email protected]>
    Signed-off-by: AngeloGioacchino Del Regno <[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/msm/a6xx: Fix stale rpmh votes from GPU [+ + +]
Author: Akhil P Oommen <[email protected]>
Date:   Wed Feb 26 01:22:14 2025 +0530

    drm/msm/a6xx: Fix stale rpmh votes from GPU
    
    commit f561db72a663f8a73c2250bf3244ce1ce221bed7 upstream.
    
    It was observed on sc7180 (A618 gpu) that GPU votes for GX rail and CNOC
    BCM nodes were not removed after GPU suspend. This was because we
    skipped sending 'prepare-slumber' request to gmu during suspend sequence
    in some cases. So, make sure we always call prepare-slumber hfi during
    suspend. Also, calling prepare-slumber without a prior oob-gpu handshake
    messes up gmu firmware's internal state. So, do that when required.
    
    Fixes: 4b565ca5a2cb ("drm/msm: Add A6XX device support")
    Cc: [email protected]
    Signed-off-by: Akhil P Oommen <[email protected]>
    Patchwork: https://patchwork.freedesktop.org/patch/639569/
    Signed-off-by: Rob Clark <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/nouveau: prime: fix ttm_bo_delayed_delete oops [+ + +]
Author: Chris Bainbridge <[email protected]>
Date:   Wed Mar 26 12:52:10 2025 +0000

    drm/nouveau: prime: fix ttm_bo_delayed_delete oops
    
    commit 8ec0fbb28d049273bfd4f1e7a5ae4c74884beed3 upstream.
    
    Fix an oops in ttm_bo_delayed_delete which results from dererencing a
    dangling pointer:
    
    Oops: general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6b7b: 0000 [#1] PREEMPT SMP
    CPU: 4 UID: 0 PID: 1082 Comm: kworker/u65:2 Not tainted 6.14.0-rc4-00267-g505460b44513-dirty #216
    Hardware name: LENOVO 82N6/LNVNB161216, BIOS GKCN65WW 01/16/2024
    Workqueue: ttm ttm_bo_delayed_delete [ttm]
    RIP: 0010:dma_resv_iter_first_unlocked+0x55/0x290
    Code: 31 f6 48 c7 c7 00 2b fa aa e8 97 bd 52 ff e8 a2 c1 53 00 5a 85 c0 74 48 e9 88 01 00 00 4c 89 63 20 4d 85 e4 0f 84 30 01 00 00 <41> 8b 44 24 10 c6 43 2c 01 48 89 df 89 43 28 e8 97 fd ff ff 4c 8b
    RSP: 0018:ffffbf9383473d60 EFLAGS: 00010202
    RAX: 0000000000000001 RBX: ffffbf9383473d88 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
    RBP: ffffbf9383473d78 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: 6b6b6b6b6b6b6b6b
    R13: ffffa003bbf78580 R14: ffffa003a6728040 R15: 00000000000383cc
    FS:  0000000000000000(0000) GS:ffffa00991c00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000758348024dd0 CR3: 000000012c259000 CR4: 0000000000f50ef0
    PKRU: 55555554
    Call Trace:
     <TASK>
     ? __die_body.cold+0x19/0x26
     ? die_addr+0x3d/0x70
     ? exc_general_protection+0x159/0x460
     ? asm_exc_general_protection+0x27/0x30
     ? dma_resv_iter_first_unlocked+0x55/0x290
     dma_resv_wait_timeout+0x56/0x100
     ttm_bo_delayed_delete+0x69/0xb0 [ttm]
     process_one_work+0x217/0x5c0
     worker_thread+0x1c8/0x3d0
     ? apply_wqattrs_cleanup.part.0+0xc0/0xc0
     kthread+0x10b/0x240
     ? kthreads_online_cpu+0x140/0x140
     ret_from_fork+0x40/0x70
     ? kthreads_online_cpu+0x140/0x140
     ret_from_fork_asm+0x11/0x20
     </TASK>
    
    The cause of this is:
    
    - drm_prime_gem_destroy calls dma_buf_put(dma_buf) which releases the
      reference to the shared dma_buf. The reference count is 0, so the
      dma_buf is destroyed, which in turn decrements the corresponding
      amdgpu_bo reference count to 0, and the amdgpu_bo is destroyed -
      calling drm_gem_object_release then dma_resv_fini (which destroys the
      reservation object), then finally freeing the amdgpu_bo.
    
    - nouveau_bo obj->bo.base.resv is now a dangling pointer to the memory
      formerly allocated to the amdgpu_bo.
    
    - nouveau_gem_object_del calls ttm_bo_put(&nvbo->bo) which calls
      ttm_bo_release, which schedules ttm_bo_delayed_delete.
    
    - ttm_bo_delayed_delete runs and dereferences the dangling resv pointer,
      resulting in a general protection fault.
    
    Fix this by moving the drm_prime_gem_destroy call from
    nouveau_gem_object_del to nouveau_bo_del_ttm. This ensures that it will
    be run after ttm_bo_delayed_delete.
    
    Signed-off-by: Chris Bainbridge <[email protected]>
    Suggested-by: Christian König <[email protected]>
    Fixes: 22b33e8ed0e3 ("nouveau: add PRIME support")
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3937
    Cc: [email protected]
    Signed-off-by: Danilo Krummrich <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/repaper: fix integer overflows in repeat functions [+ + +]
Author: Nikita Zhandarovich <[email protected]>
Date:   Thu Jan 16 05:48:01 2025 -0800

    drm/repaper: fix integer overflows in repeat functions
    
    commit 4d098000ac193f359e6b8ca4801dbdbd6a27b41f upstream.
    
    There are conditions, albeit somewhat unlikely, under which right hand
    expressions, calculating the end of time period in functions like
    repaper_frame_fixed_repeat(), may overflow.
    
    For instance, if 'factor10x' in repaper_get_temperature() is high
    enough (170), as is 'epd->stage_time' in repaper_probe(), then the
    resulting value of 'end' will not fit in unsigned int expression.
    
    Mitigate this by casting 'epd->factored_stage_time' to wider type before
    any multiplication is done.
    
    Found by Linux Verification Center (linuxtesting.org) with static
    analysis tool SVACE.
    
    Fixes: 3589211e9b03 ("drm/tinydrm: Add RePaper e-ink driver")
    Cc: [email protected]
    Signed-off-by: Nikita Zhandarovich <[email protected]>
    Signed-off-by: Alex Lanzano <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/sti: remove duplicate object names [+ + +]
Author: Rolf Eike Beer <[email protected]>
Date:   Wed Jan 15 09:58:59 2025 +0100

    drm/sti: remove duplicate object names
    
    commit 7fb6afa9125fc111478615e24231943c4f76cc2e upstream.
    
    When merging 2 drivers common object files were not deduplicated.
    
    Fixes: dcec16efd677 ("drm/sti: Build monolithic driver")
    Cc: [email protected]
    Signed-off-by: Rolf Eike Beer <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Raphael Gallais-Pou <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/tests: Add helper to create mock crtc [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Thu Feb 22 19:13:50 2024 +0100

    drm/tests: Add helper to create mock crtc
    
    [ Upstream commit 51f90720381dea79208513d059e0eb426dee511e ]
    
    We're going to need a full-blown, functional, KMS device to test more
    components of the atomic modesetting infrastructure.
    
    Let's add a new helper to create a dumb, mocked, CRTC. By default it
    will create a CRTC relying only on the default helpers, but drivers are
    free to deviate from that.
    
    Reviewed-by: Maíra Canal <[email protected]>
    Signed-off-by: Maxime Ripard <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: Add helper to create mock plane [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Thu Feb 22 19:13:49 2024 +0100

    drm/tests: Add helper to create mock plane
    
    [ Upstream commit 7a48da0febd5113d9de6f51592a09825ebd8415c ]
    
    We're going to need a full-blown, functional, KMS device to test more
    components of the atomic modesetting infrastructure.
    
    Let's add a new helper to create a dumb, mocked, primary plane. By
    default, it will create a linear XRGB8888 plane, using the default
    helpers.
    
    Reviewed-by: Maíra Canal <[email protected]>
    Signed-off-by: Maxime Ripard <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: Build KMS helpers when DRM_KUNIT_TEST_HELPERS is enabled [+ + +]
Author: Karolina Stolarek <[email protected]>
Date:   Wed Mar 13 15:21:42 2024 +0100

    drm/tests: Build KMS helpers when DRM_KUNIT_TEST_HELPERS is enabled
    
    commit f1a785101d50f5844ed29341142e7224b87f705d upstream.
    
    Commit 66671944e176 ("drm/tests: helpers: Add atomic helpers")
    introduced a dependency on CRTC helpers in KUnit test helpers.
    Select the former when building KUnit test helpers to avoid
    linker errors.
    
    Fixes: 66671944e176 ("drm/tests: helpers: Add atomic helpers")
    Cc: Maxime Ripard <[email protected]>
    Cc: Maíra Canal <[email protected]>
    Signed-off-by: Karolina Stolarek <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Maxime Ripard <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/tests: cmdline: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Tue Apr 8 09:34:10 2025 +0200

    drm/tests: cmdline: Fix drm_display_mode memory leak
    
    [ Upstream commit 70f29ca3117a8796cd6bde7612a3ded96d0f2dde ]
    
    drm_analog_tv_mode() and its variants return a drm_display_mode that
    needs to be destroyed later one. The drm_test_cmdline_tv_options() test
    never does however, which leads to a memory leak.
    
    Let's make sure it's freed.
    
    Reported-by: Philipp Stanner <[email protected]>
    Closes: https://lore.kernel.org/dri-devel/[email protected]/
    Fixes: e691c9992ae1 ("drm/modes: Introduce the tv_mode property as a command-line option")
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://lore.kernel.org/r/20250408-drm-kunit-drm-display-mode-memleak-v1-4-996305a2e75a@kernel.org
    Signed-off-by: Maxime Ripard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: helpers: Add atomic helpers [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Thu Feb 22 19:13:48 2024 +0100

    drm/tests: helpers: Add atomic helpers
    
    [ Upstream commit 66671944e17644804cb0886489e1b8fde924e9b9 ]
    
    The mock device we were creating was missing any of the driver-wide
    helpers. That was fine before since we weren't testing the atomic state
    path, but we're going to start, so let's use the default
    implementations.
    
    Reviewed-by: Maíra Canal <[email protected]>
    Signed-off-by: Maxime Ripard <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: helpers: Add helper for drm_display_mode_from_cea_vic() [+ + +]
Author: Jinjie Ruan <[email protected]>
Date:   Wed Oct 30 10:35:02 2024 +0800

    drm/tests: helpers: Add helper for drm_display_mode_from_cea_vic()
    
    [ Upstream commit caa714f86699bcfb01aa2d698db12d91af7d0d81 ]
    
    As Maxime suggested, add a new helper
    drm_kunit_display_mode_from_cea_vic(), it can replace the direct call
    of drm_display_mode_from_cea_vic(), and it will help solving
    the `mode` memory leaks.
    
    Acked-by: Maxime Ripard <[email protected]>
    Suggested-by: Maxime Ripard <[email protected]>
    Signed-off-by: Jinjie Ruan <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Maxime Ripard <[email protected]>
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: helpers: Create kunit helper to destroy a drm_display_mode [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Tue Apr 8 09:34:07 2025 +0200

    drm/tests: helpers: Create kunit helper to destroy a drm_display_mode
    
    [ Upstream commit 13c1d5f3a7fa7b55a26e73bb9e95342374a489b2 ]
    
    A number of test suites call functions that expect the returned
    drm_display_mode to be destroyed eventually.
    
    However, none of the tests called drm_mode_destroy, which results in a
    memory leak.
    
    Since drm_mode_destroy takes two pointers as argument, we can't use a
    kunit wrapper. Let's just create a helper every test suite can use.
    
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://lore.kernel.org/r/20250408-drm-kunit-drm-display-mode-memleak-v1-1-996305a2e75a@kernel.org
    Signed-off-by: Maxime Ripard <[email protected]>
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: helpers: Fix compiler warning [+ + +]
Author: Yu-Chun Lin <[email protected]>
Date:   Sun Jan 5 00:51:33 2025 +0800

    drm/tests: helpers: Fix compiler warning
    
    [ Upstream commit b9097e4c8bf3934e4e07e6f9b88741957fef351e ]
    
    Delete one line break to make the format correct, resolving the
    following warning during a W=1 build:
    
    >> drivers/gpu/drm/tests/drm_kunit_helpers.c:324: warning: bad line: for a KUnit test
    
    Fixes: caa714f86699 ("drm/tests: helpers: Add helper for drm_display_mode_from_cea_vic()")
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Reviewed-by: Kuan-Wei Chiu <[email protected]>
    Tested-by: Kuan-Wei Chiu <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Yu-Chun Lin <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Maxime Ripard <[email protected]>
    Stable-dep-of: 70f29ca3117a ("drm/tests: cmdline: Fix drm_display_mode memory leak")
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: modes: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Tue Apr 8 09:34:11 2025 +0200

    drm/tests: modes: Fix drm_display_mode memory leak
    
    [ Upstream commit d34146340f95cd9bf06d4ce71cca72127dc0b7cd ]
    
    drm_analog_tv_mode() and its variants return a drm_display_mode that
    needs to be destroyed later one. The drm_modes_analog_tv tests never
    do however, which leads to a memory leak.
    
    Let's make sure it's freed.
    
    Reported-by: Philipp Stanner <[email protected]>
    Closes: https://lore.kernel.org/dri-devel/[email protected]/
    Fixes: 4fcd238560ee ("drm/modes: Add a function to generate analog display modes")
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://lore.kernel.org/r/20250408-drm-kunit-drm-display-mode-memleak-v1-5-996305a2e75a@kernel.org
    Signed-off-by: Maxime Ripard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: modeset: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Tue Apr 8 09:34:08 2025 +0200

    drm/tests: modeset: Fix drm_display_mode memory leak
    
    [ Upstream commit dacafdcc7789cfeb0f0552716db56f210238225d ]
    
    drm_mode_find_dmt() returns a drm_display_mode that needs to be
    destroyed later one. The drm_test_pick_cmdline_res_1920_1080_60() test
    never does however, which leads to a memory leak.
    
    Let's make sure it's freed.
    
    Reported-by: Philipp Stanner <[email protected]>
    Closes: https://lore.kernel.org/dri-devel/[email protected]/
    Fixes: 8fc0380f6ba7 ("drm/client: Add some tests for drm_connector_pick_cmdline_mode()")
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://lore.kernel.org/r/20250408-drm-kunit-drm-display-mode-memleak-v1-2-996305a2e75a@kernel.org
    Signed-off-by: Maxime Ripard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/tests: probe-helper: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <[email protected]>
Date:   Tue Apr 8 09:34:13 2025 +0200

    drm/tests: probe-helper: Fix drm_display_mode memory leak
    
    [ Upstream commit 8b6f2e28431b2f9f84073bff50353aeaf25559d0 ]
    
    drm_analog_tv_mode() and its variants return a drm_display_mode that
    needs to be destroyed later one. The
    drm_test_connector_helper_tv_get_modes_check() test never does however,
    which leads to a memory leak.
    
    Let's make sure it's freed.
    
    Reported-by: Philipp Stanner <[email protected]>
    Closes: https://lore.kernel.org/dri-devel/[email protected]/
    Fixes: 1e4a91db109f ("drm/probe-helper: Provide a TV get_modes helper")
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://lore.kernel.org/r/20250408-drm-kunit-drm-display-mode-memleak-v1-7-996305a2e75a@kernel.org
    Signed-off-by: Maxime Ripard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm: allow encoder mode_set even when connectors change for crtc [+ + +]
Author: Abhinav Kumar <[email protected]>
Date:   Wed Dec 11 13:18:42 2024 -0800

    drm: allow encoder mode_set even when connectors change for crtc
    
    [ Upstream commit 7e182cb4f5567f53417b762ec0d679f0b6f0039d ]
    
    In certain use-cases, a CRTC could switch between two encoders
    and because the mode being programmed on the CRTC remains
    the same during this switch, the CRTC's mode_changed remains false.
    In such cases, the encoder's mode_set also gets skipped.
    
    Skipping mode_set on the encoder for such cases could cause an issue
    because even though the same CRTC mode was being used, the encoder
    type could have changed like the CRTC could have switched from a
    real time encoder to a writeback encoder OR vice-versa.
    
    Allow encoder's mode_set to happen even when connectors changed on a
    CRTC and not just when the mode changed.
    
    Signed-off-by: Abhinav Kumar <[email protected]>
    Signed-off-by: Jessica Zhang <[email protected]>
    Reviewed-by: Maxime Ripard <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm: panel-orientation-quirks: Add new quirk for GPD Win 2 [+ + +]
Author: Andrew Wyatt <[email protected]>
Date:   Thu Feb 13 22:24:52 2025 +0000

    drm: panel-orientation-quirks: Add new quirk for GPD Win 2
    
    [ Upstream commit a860eb9c6ba6cdbf32e3e01a606556e5a90a2931 ]
    
    Some GPD Win 2 units shipped with the correct DMI strings.
    
    Add a DMI match to correctly rotate the panel on these units.
    
    Signed-off-by: Andrew Wyatt <[email protected]>
    Signed-off-by: John Edwards <[email protected]>
    Tested-by: Paco Avelar <[email protected]>
    Reviewed-by: Thomas Zimmermann <[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]>

drm: panel-orientation-quirks: Add quirk for AYA NEO Slide [+ + +]
Author: Andrew Wyatt <[email protected]>
Date:   Thu Feb 13 22:24:51 2025 +0000

    drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
    
    [ Upstream commit 132c89ef8872e602cfb909377815111d121fe8d7 ]
    
    The AYANEO Slide uses a 1080x1920 portrait LCD panel.  This is the same
    panel used on the AYANEO Air Plus, but the DMI data is too different to
    match both with one entry.
    
    Add a DMI match to correctly rotate the panel on the AYANEO Slide.
    
    This also covers the Antec Core HS, which is a rebranded AYANEO Slide with
    the exact same hardware and DMI strings.
    
    Signed-off-by: Andrew Wyatt <[email protected]>
    Signed-off-by: John Edwards <[email protected]>
    Tested-by: John Edwards <[email protected]>
    Reviewed-by: Thomas Zimmermann <[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]>

drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel) [+ + +]
Author: Andrew Wyatt <[email protected]>
Date:   Thu Feb 13 22:24:53 2025 +0000

    drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
    
    [ Upstream commit b24dcc183583fc360ae0f0899e286a68f46abbd0 ]
    
    The Intel model of the OneXPlayer Mini uses a 1200x1920 portrait LCD panel.
    The DMI strings are the same as the OneXPlayer, which already has a DMI
    quirk, but the panel is different.
    
    Add a DMI match to correctly rotate this panel.
    
    Signed-off-by: Andrew Wyatt <[email protected]>
    Co-developed-by: John Edwards <[email protected]>
    Signed-off-by: John Edwards <[email protected]>
    Tested-by: João Pedro Kurtz <[email protected]>
    Reviewed-by: Thomas Zimmermann <[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]>

drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB [+ + +]
Author: Andrew Wyatt <[email protected]>
Date:   Thu Feb 13 22:24:50 2025 +0000

    drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
    
    [ Upstream commit 529741c331da1fbf54f86c6ec3a4558b9b0b16dc ]
    
    The AYA NEO Flip DS and KB both use a 1080x1920 portrait LCD panel.  The
    Flip DS additionally uses a 640x960 portrait LCD panel as a second display.
    
    Add DMI matches to correctly rotate these panels.
    
    Signed-off-by: Andrew Wyatt <[email protected]>
    Co-developed-by: John Edwards <[email protected]>
    Signed-off-by: John Edwards <[email protected]>
    Tested-by: Paco Avelar <[email protected]>
    Reviewed-by: Thomas Zimmermann <[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]>

drm: panel-orientation-quirks: Add support for AYANEO 2S [+ + +]
Author: Andrew Wyatt <[email protected]>
Date:   Thu Feb 13 22:24:49 2025 +0000

    drm: panel-orientation-quirks: Add support for AYANEO 2S
    
    [ Upstream commit eb8f1e3e8ee10cff591d4a47437dfd34d850d454 ]
    
    AYANEO 2S uses the same panel and orientation as the AYANEO 2.
    
    Update the AYANEO 2 DMI match to also match AYANEO 2S.
    
    Signed-off-by: Andrew Wyatt <[email protected]>
    Signed-off-by: John Edwards <[email protected]>
    Tested-by: John Edwards <[email protected]>
    Reviewed-by: Thomas Zimmermann <[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]>

 
dt-bindings: coresight: qcom,coresight-tpda: Fix too many 'reg' [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Wed Feb 26 12:29:13 2025 +0100

    dt-bindings: coresight: qcom,coresight-tpda: Fix too many 'reg'
    
    commit d72deaf05ac18e421d7e52a6be8966fd6ee185f4 upstream.
    
    Binding listed variable number of IO addresses without defining them,
    however example DTS code, all in-tree DTS and Linux kernel driver
    mention only one address space, so drop the second to make binding
    precise and correctly describe the hardware.
    
    Fixes: a8fbe1442c2b ("dt-bindings: arm: Adds CoreSight TPDA hardware definitions")
    Cc: [email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Suzuki K Poulose <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

dt-bindings: coresight: qcom,coresight-tpdm: Fix too many 'reg' [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Wed Feb 26 12:29:14 2025 +0100

    dt-bindings: coresight: qcom,coresight-tpdm: Fix too many 'reg'
    
    commit 1e4e454223f770748775f211455513c79cb3121e upstream.
    
    Binding listed variable number of IO addresses without defining them,
    however example DTS code, all in-tree DTS and Linux kernel driver
    mention only one address space, so drop the second to make binding
    precise and correctly describe the hardware.
    
    Fixes: 6c781a35133d ("dt-bindings: arm: Add CoreSight TPDM hardware")
    Cc: [email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Suzuki K Poulose <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

dt-bindings: media: st,stmipid02: correct lane-polarities maxItems [+ + +]
Author: Alain Volmat <[email protected]>
Date:   Mon Feb 10 11:04:31 2025 +0100

    dt-bindings: media: st,stmipid02: correct lane-polarities maxItems
    
    commit 3a544a39e0a4c492e3026dfbed018321d2bd6caa upstream.
    
    The MIPID02 can use up to 2 data lanes which leads to having a maximum
    item number of 3 for the lane-polarities since this also contains the
    clock lane.
    
    CC: [email protected]
    Fixes: c2741cbe7f8a ("dt-bindings: media: st,stmipid02: Convert the text bindings to YAML")
    Signed-off-by: Alain Volmat <[email protected]>
    Acked-by: Conor Dooley <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
efi/libstub: Bump up EFI_MMAP_NR_SLACK_SLOTS to 32 [+ + +]
Author: Hamza Mahfooz <[email protected]>
Date:   Mon Dec 9 13:20:39 2024 -0500

    efi/libstub: Bump up EFI_MMAP_NR_SLACK_SLOTS to 32
    
    commit ec4696925da6b9baec38345184403ce9e29a2e48 upstream.
    
    Recent platforms require more slack slots than the current value of
    EFI_MMAP_NR_SLACK_SLOTS, otherwise they fail to boot. The current
    workaround is to append `efi=disable_early_pci_dma` to the kernel's
    cmdline. So, bump up EFI_MMAP_NR_SLACK_SLOTS to 32 to allow those
    platforms to boot with the aforementioned workaround.
    
    Signed-off-by: Hamza Mahfooz <[email protected]>
    Acked-by: Ard Biesheuvel <[email protected]>
    Reviewed-by: Allen Pais <[email protected]>
    Signed-off-by: Ard Biesheuvel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ext4: don't treat fhandle lookup of ea_inode as FS corruption [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Nov 29 21:20:53 2024 +0100

    ext4: don't treat fhandle lookup of ea_inode as FS corruption
    
    [ Upstream commit 642335f3ea2b3fd6dba03e57e01fa9587843a497 ]
    
    A file handle that userspace provides to open_by_handle_at() can
    legitimately contain an outdated inode number that has since been reused
    for another purpose - that's why the file handle also contains a generation
    number.
    
    But if the inode number has been reused for an ea_inode, check_igot_inode()
    will notice, __ext4_iget() will go through ext4_error_inode(), and if the
    inode was newly created, it will also be marked as bad by iget_failed().
    This all happens before the point where the inode generation is checked.
    
    ext4_error_inode() is supposed to only be used on filesystem corruption; it
    should not be used when userspace just got unlucky with a stale file
    handle. So when this happens, let __ext4_iget() just return an error.
    
    Fixes: b3e6bcb94590 ("ext4: add EA_INODE checking to ext4_iget()")
    Signed-off-by: Jann Horn <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ext4: fix off-by-one error in do_split [+ + +]
Author: Artem Sadovnikov <[email protected]>
Date:   Fri Apr 4 08:28:05 2025 +0000

    ext4: fix off-by-one error in do_split
    
    commit 94824ac9a8aaf2fb3c54b4bdde842db80ffa555d upstream.
    
    Syzkaller detected a use-after-free issue in ext4_insert_dentry that was
    caused by out-of-bounds access due to incorrect splitting in do_split.
    
    BUG: KASAN: use-after-free in ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2109
    Write of size 251 at addr ffff888074572f14 by task syz-executor335/5847
    
    CPU: 0 UID: 0 PID: 5847 Comm: syz-executor335 Not tainted 6.12.0-rc6-syzkaller-00318-ga9cda7c0ffed #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:377 [inline]
     print_report+0x169/0x550 mm/kasan/report.c:488
     kasan_report+0x143/0x180 mm/kasan/report.c:601
     kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
     __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106
     ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2109
     add_dirent_to_buf+0x3d9/0x750 fs/ext4/namei.c:2154
     make_indexed_dir+0xf98/0x1600 fs/ext4/namei.c:2351
     ext4_add_entry+0x222a/0x25d0 fs/ext4/namei.c:2455
     ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2796
     ext4_symlink+0x920/0xb50 fs/ext4/namei.c:3431
     vfs_symlink+0x137/0x2e0 fs/namei.c:4615
     do_symlinkat+0x222/0x3a0 fs/namei.c:4641
     __do_sys_symlink fs/namei.c:4662 [inline]
     __se_sys_symlink fs/namei.c:4660 [inline]
     __x64_sys_symlink+0x7a/0x90 fs/namei.c:4660
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
     </TASK>
    
    The following loop is located right above 'if' statement.
    
    for (i = count-1; i >= 0; i--) {
            /* is more than half of this entry in 2nd half of the block? */
            if (size + map[i].size/2 > blocksize/2)
                    break;
            size += map[i].size;
            move++;
    }
    
    'i' in this case could go down to -1, in which case sum of active entries
    wouldn't exceed half the block size, but previous behaviour would also do
    split in half if sum would exceed at the very last block, which in case of
    having too many long name files in a single block could lead to
    out-of-bounds access and following use-after-free.
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Cc: [email protected]
    Fixes: 5872331b3d91 ("ext4: fix potential negative array index in do_split()")
    Signed-off-by: Artem Sadovnikov <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: ignore xattrs past end [+ + +]
Author: Bhupesh <[email protected]>
Date:   Tue Jan 28 13:57:50 2025 +0530

    ext4: ignore xattrs past end
    
    [ Upstream commit c8e008b60492cf6fd31ef127aea6d02fd3d314cd ]
    
    Once inside 'ext4_xattr_inode_dec_ref_all' we should
    ignore xattrs entries past the 'end' entry.
    
    This fixes the following KASAN reported issue:
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in ext4_xattr_inode_dec_ref_all+0xb8c/0xe90
    Read of size 4 at addr ffff888012c120c4 by task repro/2065
    
    CPU: 1 UID: 0 PID: 2065 Comm: repro Not tainted 6.13.0-rc2+ #11
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x1fd/0x300
     ? tcp_gro_dev_warn+0x260/0x260
     ? _printk+0xc0/0x100
     ? read_lock_is_recursive+0x10/0x10
     ? irq_work_queue+0x72/0xf0
     ? __virt_addr_valid+0x17b/0x4b0
     print_address_description+0x78/0x390
     print_report+0x107/0x1f0
     ? __virt_addr_valid+0x17b/0x4b0
     ? __virt_addr_valid+0x3ff/0x4b0
     ? __phys_addr+0xb5/0x160
     ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90
     kasan_report+0xcc/0x100
     ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90
     ext4_xattr_inode_dec_ref_all+0xb8c/0xe90
     ? ext4_xattr_delete_inode+0xd30/0xd30
     ? __ext4_journal_ensure_credits+0x5f0/0x5f0
     ? __ext4_journal_ensure_credits+0x2b/0x5f0
     ? inode_update_timestamps+0x410/0x410
     ext4_xattr_delete_inode+0xb64/0xd30
     ? ext4_truncate+0xb70/0xdc0
     ? ext4_expand_extra_isize_ea+0x1d20/0x1d20
     ? __ext4_mark_inode_dirty+0x670/0x670
     ? ext4_journal_check_start+0x16f/0x240
     ? ext4_inode_is_fast_symlink+0x2f2/0x3a0
     ext4_evict_inode+0xc8c/0xff0
     ? ext4_inode_is_fast_symlink+0x3a0/0x3a0
     ? do_raw_spin_unlock+0x53/0x8a0
     ? ext4_inode_is_fast_symlink+0x3a0/0x3a0
     evict+0x4ac/0x950
     ? proc_nr_inodes+0x310/0x310
     ? trace_ext4_drop_inode+0xa2/0x220
     ? _raw_spin_unlock+0x1a/0x30
     ? iput+0x4cb/0x7e0
     do_unlinkat+0x495/0x7c0
     ? try_break_deleg+0x120/0x120
     ? 0xffffffff81000000
     ? __check_object_size+0x15a/0x210
     ? strncpy_from_user+0x13e/0x250
     ? getname_flags+0x1dc/0x530
     __x64_sys_unlinkat+0xc8/0xf0
     do_syscall_64+0x65/0x110
     entry_SYSCALL_64_after_hwframe+0x67/0x6f
    RIP: 0033:0x434ffd
    Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 8
    RSP: 002b:00007ffc50fa7b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000107
    RAX: ffffffffffffffda RBX: 00007ffc50fa7e18 RCX: 0000000000434ffd
    RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005
    RBP: 00007ffc50fa7be0 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
    R13: 00007ffc50fa7e08 R14: 00000000004bbf30 R15: 0000000000000001
     </TASK>
    
    The buggy address belongs to the object at ffff888012c12000
     which belongs to the cache filp of size 360
    The buggy address is located 196 bytes inside of
     freed 360-byte region [ffff888012c12000, ffff888012c12168)
    
    The buggy address belongs to the physical page:
    page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c12
    head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
    flags: 0x40(head|node=0|zone=0)
    page_type: f5(slab)
    raw: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
    raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
    head: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
    head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
    head: 0000000000000001 ffffea00004b0481 ffffffffffffffff 0000000000000000
    head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
     ffff888012c11f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffff888012c12000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    > ffff888012c12080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                               ^
     ffff888012c12100: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
     ffff888012c12180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    ==================================================================
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=b244bda78289b00204ed
    Suggested-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Signed-off-by: Bhupesh <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ext4: protect ext4_release_dquot against freezing [+ + +]
Author: Ojaswin Mujoo <[email protected]>
Date:   Thu Nov 21 18:08:55 2024 +0530

    ext4: protect ext4_release_dquot against freezing
    
    [ Upstream commit 530fea29ef82e169cd7fe048c2b7baaeb85a0028 ]
    
    Protect ext4_release_dquot against freezing so that we
    don't try to start a transaction when FS is frozen, leading
    to warnings.
    
    Further, avoid taking the freeze protection if a transaction
    is already running so that we don't need end up in a deadlock
    as described in
    
      46e294efc355 ext4: fix deadlock with fs freezing and EA inodes
    
    Suggested-by: Jan Kara <[email protected]>
    Signed-off-by: Ojaswin Mujoo <[email protected]>
    Reviewed-by: Baokun Li <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
f2fs: don't retry IO for corrupted data scenario [+ + +]
Author: Chao Yu <[email protected]>
Date:   Mon Feb 10 15:36:32 2025 +0800

    f2fs: don't retry IO for corrupted data scenario
    
    [ Upstream commit 1534747d3170646ddeb9ea5f7caaac90359707cf ]
    
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
    
    If node block is loaded successfully, but its content is inconsistent, it
    doesn't need to retry IO.
    
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

f2fs: fix to avoid atomicity corruption of atomic file [+ + +]
Author: Yeongjin Gil <[email protected]>
Date:   Fri Mar 14 21:06:51 2025 +0900

    f2fs: fix to avoid atomicity corruption of atomic file
    
    commit f098aeba04c9328571567dca45159358a250240c upstream.
    
    In the case of the following call stack for an atomic file,
    FI_DIRTY_INODE is set, but FI_ATOMIC_DIRTIED is not subsequently set.
    
    f2fs_file_write_iter
      f2fs_map_blocks
        f2fs_reserve_new_blocks
          inc_valid_block_count
            __mark_inode_dirty(dquot)
              f2fs_dirty_inode
    
    If FI_ATOMIC_DIRTIED is not set, atomic file can encounter corruption
    due to a mismatch between old file size and new data.
    
    To resolve this issue, I changed to set FI_ATOMIC_DIRTIED when
    FI_DIRTY_INODE is set. This ensures that FI_DIRTY_INODE, which was
    previously cleared by the Writeback thread during the commit atomic, is
    set and i_size is updated.
    
    Cc: <[email protected]>
    Fixes: fccaa81de87e ("f2fs: prevent atomic file from being dirtied before commit")
    Reviewed-by: Sungjong Seo <[email protected]>
    Reviewed-by: Sunmin Jeong <[email protected]>
    Signed-off-by: Yeongjin Gil <[email protected]>
    Reviewed-by: Daeho Jeong <[email protected]>
    Reviewed-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks() [+ + +]
Author: Chao Yu <[email protected]>
Date:   Mon Mar 3 11:47:38 2025 +0800

    f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks()
    
    [ Upstream commit e6494977bd4a83862118a05f57a8df40256951c0 ]
    
    syzbot reports an UBSAN issue as below:
    
    ------------[ cut here ]------------
    UBSAN: array-index-out-of-bounds in fs/f2fs/node.h:381:10
    index 18446744073709550692 is out of range for type '__le32[5]' (aka 'unsigned int[5]')
    CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.14.0-rc3-syzkaller-00060-g6537cfb395f3 #0
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
     ubsan_epilogue lib/ubsan.c:231 [inline]
     __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429
     get_nid fs/f2fs/node.h:381 [inline]
     f2fs_truncate_inode_blocks+0xa5e/0xf60 fs/f2fs/node.c:1181
     f2fs_do_truncate_blocks+0x782/0x1030 fs/f2fs/file.c:808
     f2fs_truncate_blocks+0x10d/0x300 fs/f2fs/file.c:836
     f2fs_truncate+0x417/0x720 fs/f2fs/file.c:886
     f2fs_file_write_iter+0x1bdb/0x2550 fs/f2fs/file.c:5093
     aio_write+0x56b/0x7c0 fs/aio.c:1633
     io_submit_one+0x8a7/0x18a0 fs/aio.c:2052
     __do_sys_io_submit fs/aio.c:2111 [inline]
     __se_sys_io_submit+0x171/0x2e0 fs/aio.c:2081
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7f238798cde9
    
    index 18446744073709550692 (decimal, unsigned long long)
    = 0xfffffffffffffc64 (hexadecimal, unsigned long long)
    = -924 (decimal, long long)
    
    In f2fs_truncate_inode_blocks(), UBSAN detects that get_nid() tries to
    access .i_nid[-924], it means both offset[0] and level should zero.
    
    The possible case should be in f2fs_do_truncate_blocks(), we try to
    truncate inode size to zero, however, dn.ofs_in_node is zero and
    dn.node_page is not an inode page, so it fails to truncate inode page,
    and then pass zeroed free_from to f2fs_truncate_inode_blocks(), result
    in this issue.
    
            if (dn.ofs_in_node || IS_INODE(dn.node_page)) {
                    f2fs_truncate_data_blocks_range(&dn, count);
                    free_from += count;
            }
    
    I guess the reason why dn.node_page is not an inode page could be: there
    are multiple nat entries share the same node block address, once the node
    block address was reused, f2fs_get_node_page() may load a non-inode block.
    
    Let's add a sanity check for such condition to avoid out-of-bounds access
    issue.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fbdev: omapfb: Add 'plane' value check [+ + +]
Author: Leonid Arapov <[email protected]>
Date:   Tue Mar 18 21:19:52 2025 +0000

    fbdev: omapfb: Add 'plane' value check
    
    [ Upstream commit 3e411827f31db7f938a30a3c7a7599839401ec30 ]
    
    Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB
    of the enum parameter plane.
    
    The value of this parameter is initialized in dss_init_overlays and in the
    current state of the code it cannot take this value so it's not a real
    problem.
    
    For the purposes of defensive coding it wouldn't be superfluous to check
    the parameter value, because some functions down the call stack process
    this value correctly and some not.
    
    For example, in dispc_ovl_setup_global_alpha it may lead to buffer
    overflow.
    
    Add check for this value.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE static
    analysis tool.
    
    Signed-off-by: Leonid Arapov <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Fix mmu notifiers for range-based invalidates [+ + +]
Author: Piotr Jaroszynski <[email protected]>
Date:   Tue Mar 4 00:51:27 2025 -0800

    Fix mmu notifiers for range-based invalidates
    
    commit f7edb07ad7c66eab3dce57384f33b9799d579133 upstream.
    
    Update the __flush_tlb_range_op macro not to modify its parameters as
    these are unexepcted semantics. In practice, this fixes the call to
    mmu_notifier_arch_invalidate_secondary_tlbs() in
    __flush_tlb_range_nosync() to use the correct range instead of an empty
    range with start=end. The empty range was (un)lucky as it results in
    taking the invalidate-all path that doesn't cause correctness issues,
    but can certainly result in suboptimal perf.
    
    This has been broken since commit 6bbd42e2df8f ("mmu_notifiers: call
    invalidate_range() when invalidating TLBs") when the call to the
    notifiers was added to __flush_tlb_range(). It predates the addition of
    the __flush_tlb_range_op() macro from commit 360839027a6e ("arm64: tlb:
    Refactor the core flush algorithm of __flush_tlb_range") that made the
    bug hard to spot.
    
    Fixes: 6bbd42e2df8f ("mmu_notifiers: call invalidate_range() when invalidating TLBs")
    
    Signed-off-by: Piotr Jaroszynski <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Will Deacon <[email protected]>
    Cc: Robin Murphy <[email protected]>
    Cc: Alistair Popple <[email protected]>
    Cc: Raghavendra Rao Ananta <[email protected]>
    Cc: SeongJae Park <[email protected]>
    Cc: Jason Gunthorpe <[email protected]>
    Cc: John Hubbard <[email protected]>
    Cc: Nicolin Chen <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Catalin Marinas <[email protected]>
    Reviewed-by: Alistair Popple <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    [will: Resolve conflicts due to lack of LPA2 support]
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fs/jfs: cast inactags to s64 to prevent potential overflow [+ + +]
Author: Rand Deeb <[email protected]>
Date:   Thu Feb 20 12:43:49 2025 +0300

    fs/jfs: cast inactags to s64 to prevent potential overflow
    
    [ Upstream commit 70ca3246ad201b53a9f09380b3f29d8bac320383 ]
    
    The expression "inactags << bmp->db_agl2size" in the function
    dbFinalizeBmap() is computed using int operands. Although the
    values (inactags and db_agl2size) are derived from filesystem
    parameters and are usually small, there is a theoretical risk that
    the shift could overflow a 32-bit int if extreme values occur.
    
    According to the C standard, shifting a signed 32-bit int can lead
    to undefined behavior if the result exceeds its range. In our
    case, an overflow could miscalculate free blocks, potentially
    leading to erroneous filesystem accounting.
    
    To ensure the arithmetic is performed in 64-bit space, we cast
    "inactags" to s64 before shifting. This defensive fix prevents any
    risk of overflow and complies with kernel coding best practices.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Rand Deeb <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

fs/jfs: Prevent integer overflow in AG size calculation [+ + +]
Author: Rand Deeb <[email protected]>
Date:   Thu Feb 20 12:52:31 2025 +0300

    fs/jfs: Prevent integer overflow in AG size calculation
    
    [ Upstream commit 7fcbf789629cdb9fbf4e2172ce31136cfed11e5e ]
    
    The JFS filesystem calculates allocation group (AG) size using 1 <<
    l2agsize in dbExtendFS(). When l2agsize exceeds 31 (possible with >2TB
    aggregates on 32-bit systems), this 32-bit shift operation causes undefined
    behavior and improper AG sizing.
    
    On 32-bit architectures:
    - Left-shifting 1 by 32+ bits results in 0 due to integer overflow
    - This creates invalid AG sizes (0 or garbage values) in
    sbi->bmap->db_agsize
    - Subsequent block allocations would reference invalid AG structures
    - Could lead to:
      - Filesystem corruption during extend operations
      - Kernel crashes due to invalid memory accesses
      - Security vulnerabilities via malformed on-disk structures
    
    Fix by casting to s64 before shifting:
    bmp->db_agsize = (s64)1 << l2agsize;
    
    This ensures 64-bit arithmetic even on 32-bit architectures. The cast
    matches the data type of db_agsize (s64) and follows similar patterns in
    JFS block calculation code.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Rand Deeb <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs: consistently deref the files table with rcu_dereference_raw() [+ + +]
Author: Mateusz Guzik <[email protected]>
Date:   Thu Mar 13 14:57:25 2025 +0100

    fs: consistently deref the files table with rcu_dereference_raw()
    
    [ Upstream commit f381640e1bd4f2de7ccafbfe8703d33c3718aad9 ]
    
    ... except when the table is known to be only used by one thread.
    
    A file pointer can get installed at any moment despite the ->file_lock
    being held since the following:
    8a81252b774b53e6 ("fs/file.c: don't acquire files->file_lock in fd_install()")
    
    Accesses subject to such a race can in principle suffer load tearing.
    
    While here redo the comment in dup_fd -- it only covered a race against
    files showing up, still assuming fd_install() takes the lock.
    
    Signed-off-by: Mateusz Guzik <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ftrace: Add cond_resched() to ftrace_graph_set_hash() [+ + +]
Author: zhoumin <[email protected]>
Date:   Tue Apr 1 01:00:34 2025 +0800

    ftrace: Add cond_resched() to ftrace_graph_set_hash()
    
    commit 42ea22e754ba4f2b86f8760ca27f6f71da2d982c upstream.
    
    When the kernel contains a large number of functions that can be traced,
    the loop in ftrace_graph_set_hash() may take a lot of time to execute.
    This may trigger the softlockup watchdog.
    
    Add cond_resched() within the loop to allow the kernel to remain
    responsive even when processing a large number of functions.
    
    This matches the cond_resched() that is used in other locations of the
    code that iterates over all functions that can be traced.
    
    Cc: [email protected]
    Fixes: b9b0c831bed26 ("ftrace: Convert graph filter to use hash tables")
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: zhoumin <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ftrace: fix incorrect hash size in register_ftrace_direct() [+ + +]
Author: Menglong Dong <[email protected]>
Date:   Sun Apr 13 09:44:44 2025 +0800

    ftrace: fix incorrect hash size in register_ftrace_direct()
    
    [ Upstream commit 92f1d3b40179b15630d72e2c6e4e25a899b67ba9 ]
    
    The maximum of the ftrace hash bits is made fls(32) in
    register_ftrace_direct(), which seems illogical. So, we fix it by making
    the max hash bits FTRACE_HASH_MAX_BITS instead.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: d05cb470663a ("ftrace: Fix modification of direct_function hash while in use")
    Signed-off-by: Menglong Dong <[email protected]>
    Acked-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
gpio: tegra186: fix resource handling in ACPI probe path [+ + +]
Author: Guixin Liu <[email protected]>
Date:   Thu Mar 27 11:23:49 2025 +0800

    gpio: tegra186: fix resource handling in ACPI probe path
    
    commit 8323f3a69de6f6e96bf22f32dd8e2920766050c2 upstream.
    
    When the Tegra186 GPIO controller is probed through ACPI matching,
    the driver emits two error messages during probing:
      "tegra186-gpio NVDA0508:00: invalid resource (null)"
      "tegra186-gpio NVDA0508:00: invalid resource (null)"
    
    Fix this by getting resource first and then do the ioremap.
    
    Fixes: 2606e7c9f5fc ("gpio: tegra186: Add ACPI support")
    Cc: [email protected]
    Signed-off-by: Guixin Liu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

gpio: zynq: Fix wakeup source leaks on device unbind [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Apr 6 22:22:45 2025 +0200

    gpio: zynq: Fix wakeup source leaks on device unbind
    
    commit c5672e310ad971d408752fce7596ed27adc6008f upstream.
    
    Device can be unbound, so driver must also release memory for the wakeup
    source.
    
    Cc: [email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
gve: handle overflow when reporting TX consumed descriptors [+ + +]
Author: Joshua Washington <[email protected]>
Date:   Wed Apr 2 00:10:37 2025 +0000

    gve: handle overflow when reporting TX consumed descriptors
    
    commit 15970e1b23f5c25db88c613fddf9131de086f28e upstream.
    
    When the tx tail is less than the head (in cases of wraparound), the TX
    consumed descriptor statistic in DQ will be reported as
    UINT32_MAX - head + tail, which is incorrect. Mask the difference of
    head and tail according to the ring size when reporting the statistic.
    
    Cc: [email protected]
    Fixes: 2c9198356d56 ("gve: Add consumed counts to ethtool stats")
    Signed-off-by: Joshua Washington <[email protected]>
    Signed-off-by: Harshitha Ramamurthy <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
hfs/hfsplus: fix slab-out-of-bounds in hfs_bnode_read_key [+ + +]
Author: Vasiliy Kovalev <[email protected]>
Date:   Sat Oct 19 22:13:03 2024 +0300

    hfs/hfsplus: fix slab-out-of-bounds in hfs_bnode_read_key
    
    commit bb5e07cb927724e0b47be371fa081141cfb14414 upstream.
    
    Syzbot reported an issue in hfs subsystem:
    
    BUG: KASAN: slab-out-of-bounds in memcpy_from_page include/linux/highmem.h:423 [inline]
    BUG: KASAN: slab-out-of-bounds in hfs_bnode_read fs/hfs/bnode.c:35 [inline]
    BUG: KASAN: slab-out-of-bounds in hfs_bnode_read_key+0x314/0x450 fs/hfs/bnode.c:70
    Write of size 94 at addr ffff8880123cd100 by task syz-executor237/5102
    
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:377 [inline]
     print_report+0x169/0x550 mm/kasan/report.c:488
     kasan_report+0x143/0x180 mm/kasan/report.c:601
     kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
     __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106
     memcpy_from_page include/linux/highmem.h:423 [inline]
     hfs_bnode_read fs/hfs/bnode.c:35 [inline]
     hfs_bnode_read_key+0x314/0x450 fs/hfs/bnode.c:70
     hfs_brec_insert+0x7f3/0xbd0 fs/hfs/brec.c:159
     hfs_cat_create+0x41d/0xa50 fs/hfs/catalog.c:118
     hfs_mkdir+0x6c/0xe0 fs/hfs/dir.c:232
     vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
     do_mkdirat+0x264/0x3a0 fs/namei.c:4280
     __do_sys_mkdir fs/namei.c:4300 [inline]
     __se_sys_mkdir fs/namei.c:4298 [inline]
     __x64_sys_mkdir+0x6c/0x80 fs/namei.c:4298
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7fbdd6057a99
    
    Add a check for key length in hfs_bnode_read_key to prevent
    out-of-bounds memory access. If the key length is invalid, the
    key buffer is cleared, improving stability and reliability.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=5f3a973ed3dfb85a6683
    Cc: [email protected]
    Signed-off-by: Vasiliy Kovalev <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Reviewed-by: Cengiz Can <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
HID: Add hid-universal-pidff driver and supported device ids [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:54 2025 +0100

    HID: Add hid-universal-pidff driver and supported device ids
    
    [ Upstream commit f06bf8d94fffbb544b1cb5402c92e0a075f0d420 ]
    
    Extend pidff compatibility, usable button range, manage pidff quirks and
    set improved fuzz/flat default for high precision devices. Possibility
    of fixing device descriptors in the future if such needs arises.
    
    As many of PID devices are quite similar and not dependent on
    custom drivers, this one can handle all of PID devices which
    need special care.
    
    Numerous sim racing/sim flight bases report a lot of buttons
    in excess of 100. Moza Racing exposes 128 of them and thus
    the need to extend the available range.
    
    All the included devices were tested and confirmed working
    with the help of the sim racing community.
    
    Changes in v6:
    - Support "split" devices with a separate "input device" for buttons
    - Fixed comment styling
    
    Co-developed-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add FIX_WHEEL_DIRECTION quirk [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:52 2025 +0100

    HID: pidff: Add FIX_WHEEL_DIRECTION quirk
    
    [ Upstream commit 3051bf5ec773b803c474ea556b57d678a8885be3 ]
    
    Most steering wheels simply ignore DIRECTION field, but some try to be
    compliant with the PID standard and use it in force calculations. Games
    often ignore setting this field properly and/or there can be issues with
    dinput8 -> wine -> SDL -> Linux API translation, and this value can be
    incorrect. This can lead to partial/complete loss of Force Feedback or
    even unexpected force reversal.
    
    Sadly, this quirk can't be detected automatically without sending out
    effects that would move an axis.
    
    This fixes FFB on Moza Racing devices and others where effect direction
    is not simply ignored.
    
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:51 2025 +0100

    HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol
    
    [ Upstream commit 36de0164bbaff1484288e84ac5df5cff00580263 ]
    
    This lays out a way to provide an initial set of quirks to enable before
    device initialization takes place. GPL symbol export needed for the
    possibility of building HID drivers which use this function as modules.
    
    Adding a wrapper function to ensure compatibility with the old behavior
    of hid_pidff_init.
    
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add MISSING_DELAY quirk and its detection [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:48 2025 +0100

    HID: pidff: Add MISSING_DELAY quirk and its detection
    
    [ Upstream commit 2d5c7ce5bf4cc27db41632f357f682d0ee4518e7 ]
    
    A lot of devices do not include this field, and it's seldom used in force
    feedback implementations. I tested about three dozen applications and
    none of them make use of the delay.
    
    This fixes initialization of a lot of PID wheels like Cammus, VRS, FFBeast
    
    This change has no effect on fully compliant devices
    
    Co-developed-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add MISSING_PBO quirk and its detection [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:49 2025 +0100

    HID: pidff: Add MISSING_PBO quirk and its detection
    
    [ Upstream commit fc7c154e9bb3c2b98875cfc565406f4787e3b7a4 ]
    
    Some devices with only one axis are missing PARAMETER_BLOCK_OFFSET field
    for conditional effects. They can only have one axis, so we're limiting
    the max_axis when setting the report for those effects.
    
    Automatic detection ensures compatibility even if such device won't be
    explicitly defined in the kernel.
    
    Fixes initialization of VRS DirectForce PRO and possibly other devices.
    
    Changes in v6:
    - Fixed NULL pointer dereference. When PBO is missing, make sure not
      to set it anyway
    
    Co-developed-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add PERIODIC_SINE_ONLY quirk [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:56 2025 +0100

    HID: pidff: Add PERIODIC_SINE_ONLY quirk
    
    [ Upstream commit abdbf8764f4962af2a910abb3a213ecf304a73d3 ]
    
    Some devices only support SINE periodic effect although they advertise
    support for all PERIODIC effect in their HID descriptor. Some just do
    nothing when trying to play such an effect (upload goes fine), some express
    undefined behavior like turning to one side.
    
    This quirk forces all the periodic effects to be uploaded as SINE. This is
    acceptable as all these effects are similar in nature and are mostly used as
    rumble. SINE is the most popular with others seldom used (especially SAW_UP
    and SAW_DOWN).
    
    Fixes periodic effects for PXN and LITE STAR wheels
    
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Add PERMISSIVE_CONTROL quirk [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:50 2025 +0100

    HID: pidff: Add PERMISSIVE_CONTROL quirk
    
    [ Upstream commit a4119108d2530747e61c7cbf52e2affd089cb1f6 ]
    
    With this quirk, a PID device isn't required to have a strict
    logical_minimum of 1 for the the PID_DEVICE_CONTROL usage page.
    
    Some devices come with weird values in their device descriptors and
    this quirk enables their initialization even if the logical minimum
    of the DEVICE_CONTROL page is not 1.
    
    Fixes initialization of VRS Direct Force Pro
    
    Changes in v6:
    - Change quirk name to better reflect it's intention
    
    Co-developed-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Convert infinite length from Linux API to PID standard [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:45 2025 +0100

    HID: pidff: Convert infinite length from Linux API to PID standard
    
    [ Upstream commit 37e0591fe44dce39d1ebc7a82d5b6e4dba1582eb ]
    
    Software uses 0 as de-facto infinite lenght on Linux FF apis (SDL),
    Linux doesn't actually define anythi as of now, while USB PID defines
    NULL (0xffff). Most PID devices do not expect a 0-length effect and
    can't interpret it as infinite. This change fixes Force Feedback for
    most PID compliant devices.
    
    As most games depend on updating the values of already playing infinite
    effects, this is crucial to ensure they will actually work.
    
    Previously, users had to rely on third-party software to do this conversion
    and make their PID devices usable.
    
    Co-developed-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Makarenko Oleg <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Do not send effect envelope if it's empty [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:38:46 2025 +0100

    HID: pidff: Do not send effect envelope if it's empty
    
    [ Upstream commit 8876fc1884f5b39550c8387ff3176396c988541d ]
    
    Envelope struct is always initialized, but the envelope itself is
    optional as described in USB PID Device class definition 1.0.
    
    5.1.1.1 Type Specific Block Offsets
    ...
    4) Effects that do not use Condition Blocks use 1 Parameter Block and
    an *optional* Envelope Block.
    
    Sending out "empty" envelope breaks force feedback on some devices with
    games that use SINE effect + offset to emulate constant force effect, as
    well as generally breaking Constant/Periodic effects. One of the affected
    brands is Moza Racing.
    
    This change prevents the envelope from being sent if it contains all
    0 values while keeping the old behavior of only sending it, if it differs
    from the old one.
    
    Changes in v6:
    - Simplify the checks to make them clearer
    - Fix possible null pointer dereference while calling
      pidff_needs_set_envelope
    
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: pidff: Fix null pointer dereference in pidff_find_fields [+ + +]
Author: Tomasz Pakuła <[email protected]>
Date:   Sat Feb 1 12:39:02 2025 +0100

    HID: pidff: Fix null pointer dereference in pidff_find_fields
    
    [ Upstream commit 22a05462c3d0eee15154faf8d13c49e6295270a5 ]
    
    This function triggered a null pointer dereference if used to search for
    a report that isn't implemented on the device. This happened both for
    optional and required reports alike.
    
    The same logic was applied to pidff_find_special_field and although
    pidff_init_fields should return an error earlier if one of the required
    reports is missing, future modifications could change this logic and
    resurface this possible null pointer dereference again.
    
    LKML bug report:
    https://lore.kernel.org/all/CAL-gK7f5=R0nrrQdPtaZZr1fd-cdAMbDMuZ_NLA8vM0SX+nGSw@mail.gmail.com
    
    Reported-by: Nolan Nicholson <[email protected]>
    Signed-off-by: Tomasz Pakuła <[email protected]>
    Reviewed-by: Michał Kopeć <[email protected]>
    Reviewed-by: Paul Dino Jones <[email protected]>
    Tested-by: Paul Dino Jones <[email protected]>
    Tested-by: Cristóferson Bueno <[email protected]>
    Tested-by: Pablo Cisneros <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HSI: ssi_protocol: Fix use after free vulnerability in ssi_protocol Driver Due to Race Condition [+ + +]
Author: Kaixin Wang <[email protected]>
Date:   Wed Sep 18 20:07:50 2024 +0800

    HSI: ssi_protocol: Fix use after free vulnerability in ssi_protocol Driver Due to Race Condition
    
    commit e3f88665a78045fe35c7669d2926b8d97b892c11 upstream.
    
    In the ssi_protocol_probe() function, &ssi->work is bound with
    ssip_xmit_work(), In ssip_pn_setup(), the ssip_pn_xmit() function
    within the ssip_pn_ops structure is capable of starting the
    work.
    
    If we remove the module which will call ssi_protocol_remove()
    to make a cleanup, it will free ssi through kfree(ssi),
    while the work mentioned above will be used. The sequence
    of operations that may lead to a UAF bug is as follows:
    
    CPU0                                    CPU1
    
                            | ssip_xmit_work
    ssi_protocol_remove     |
    kfree(ssi);             |
                            | struct hsi_client *cl = ssi->cl;
                            | // use ssi
    
    Fix it by ensuring that the work is canceled before proceeding
    with the cleanup in ssi_protocol_remove().
    
    Signed-off-by: Kaixin Wang <[email protected]>
    Acked-by: Andy Shevchenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
i2c: atr: Fix wrong include [+ + +]
Author: Andy Shevchenko <[email protected]>
Date:   Mon Mar 31 10:16:46 2025 +0300

    i2c: atr: Fix wrong include
    
    [ Upstream commit 75caec0c2aa3a7ec84348d438c74cb8a2eb4de97 ]
    
    The fwnode.h is not supposed to be used by the drivers as it
    has the definitions for the core parts for different device
    property provider implementations. Drop it.
    
    Note, that fwnode API for drivers is provided in property.h
    which is included here.
    
    Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
    Signed-off-by: Andy Shevchenko <[email protected]>
    Acked-by: Mukesh Kumar Savaliya <[email protected]>
    Reviewed-by: Luca Ceresoli <[email protected]>
    Reviewed-by: Tomi Valkeinen <[email protected]>
    [wsa: reworded subject]
    Signed-off-by: Wolfram Sang <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

i2c: cros-ec-tunnel: defer probe if parent EC is not present [+ + +]
Author: Thadeu Lima de Souza Cascardo <[email protected]>
Date:   Mon Apr 7 17:33:34 2025 -0300

    i2c: cros-ec-tunnel: defer probe if parent EC is not present
    
    commit 424eafe65647a8d6c690284536e711977153195a upstream.
    
    When i2c-cros-ec-tunnel and the EC driver are built-in, the EC parent
    device will not be found, leading to NULL pointer dereference.
    
    That can also be reproduced by unbinding the controller driver and then
    loading i2c-cros-ec-tunnel module (or binding the device).
    
    [  271.991245] BUG: kernel NULL pointer dereference, address: 0000000000000058
    [  271.998215] #PF: supervisor read access in kernel mode
    [  272.003351] #PF: error_code(0x0000) - not-present page
    [  272.008485] PGD 0 P4D 0
    [  272.011022] Oops: Oops: 0000 [#1] SMP NOPTI
    [  272.015207] CPU: 0 UID: 0 PID: 3859 Comm: insmod Tainted: G S                  6.15.0-rc1-00004-g44722359ed83 #30 PREEMPT(full)  3c7fb39a552e7d949de2ad921a7d6588d3a4fdc5
    [  272.030312] Tainted: [S]=CPU_OUT_OF_SPEC
    [  272.034233] Hardware name: HP Berknip/Berknip, BIOS Google_Berknip.13434.356.0 05/17/2021
    [  272.042400] RIP: 0010:ec_i2c_probe+0x2b/0x1c0 [i2c_cros_ec_tunnel]
    [  272.048577] Code: 1f 44 00 00 41 57 41 56 41 55 41 54 53 48 83 ec 10 65 48 8b 05 06 a0 6c e7 48 89 44 24 08 4c 8d 7f 10 48 8b 47 50 4c 8b 60 78 <49> 83 7c 24 58 00 0f 84 2f 01 00 00 48 89 fb be 30 06 00 00 4c 9
    [  272.067317] RSP: 0018:ffffa32082a03940 EFLAGS: 00010282
    [  272.072541] RAX: ffff969580b6a810 RBX: ffff969580b68c10 RCX: 0000000000000000
    [  272.079672] RDX: 0000000000000000 RSI: 0000000000000282 RDI: ffff969580b68c00
    [  272.086804] RBP: 00000000fffffdfb R08: 0000000000000000 R09: 0000000000000000
    [  272.093936] R10: 0000000000000000 R11: ffffffffc0600000 R12: 0000000000000000
    [  272.101067] R13: ffffffffa666fbb8 R14: ffffffffc05b5528 R15: ffff969580b68c10
    [  272.108198] FS:  00007b930906fc40(0000) GS:ffff969603149000(0000) knlGS:0000000000000000
    [  272.116282] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  272.122024] CR2: 0000000000000058 CR3: 000000012631c000 CR4: 00000000003506f0
    [  272.129155] Call Trace:
    [  272.131606]  <TASK>
    [  272.133709]  ? acpi_dev_pm_attach+0xdd/0x110
    [  272.137985]  platform_probe+0x69/0xa0
    [  272.141652]  really_probe+0x152/0x310
    [  272.145318]  __driver_probe_device+0x77/0x110
    [  272.149678]  driver_probe_device+0x1e/0x190
    [  272.153864]  __driver_attach+0x10b/0x1e0
    [  272.157790]  ? driver_attach+0x20/0x20
    [  272.161542]  bus_for_each_dev+0x107/0x150
    [  272.165553]  bus_add_driver+0x15d/0x270
    [  272.169392]  driver_register+0x65/0x110
    [  272.173232]  ? cleanup_module+0xa80/0xa80 [i2c_cros_ec_tunnel 3a00532f3f4af4a9eade753f86b0f8dd4e4e5698]
    [  272.182617]  do_one_initcall+0x110/0x350
    [  272.186543]  ? security_kernfs_init_security+0x49/0xd0
    [  272.191682]  ? __kernfs_new_node+0x1b9/0x240
    [  272.195954]  ? security_kernfs_init_security+0x49/0xd0
    [  272.201093]  ? __kernfs_new_node+0x1b9/0x240
    [  272.205365]  ? kernfs_link_sibling+0x105/0x130
    [  272.209810]  ? kernfs_next_descendant_post+0x1c/0xa0
    [  272.214773]  ? kernfs_activate+0x57/0x70
    [  272.218699]  ? kernfs_add_one+0x118/0x160
    [  272.222710]  ? __kernfs_create_file+0x71/0xa0
    [  272.227069]  ? sysfs_add_bin_file_mode_ns+0xd6/0x110
    [  272.232033]  ? internal_create_group+0x453/0x4a0
    [  272.236651]  ? __vunmap_range_noflush+0x214/0x2d0
    [  272.241355]  ? __free_frozen_pages+0x1dc/0x420
    [  272.245799]  ? free_vmap_area_noflush+0x10a/0x1c0
    [  272.250505]  ? load_module+0x1509/0x16f0
    [  272.254431]  do_init_module+0x60/0x230
    [  272.258181]  __se_sys_finit_module+0x27a/0x370
    [  272.262627]  do_syscall_64+0x6a/0xf0
    [  272.266206]  ? do_syscall_64+0x76/0xf0
    [  272.269956]  ? irqentry_exit_to_user_mode+0x79/0x90
    [  272.274836]  entry_SYSCALL_64_after_hwframe+0x55/0x5d
    [  272.279887] RIP: 0033:0x7b9309168d39
    [  272.283466] Code: 5b 41 5c 5d c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d af 40 0c 00 f7 d8 64 89 01 8
    [  272.302210] RSP: 002b:00007fff50f1a288 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [  272.309774] RAX: ffffffffffffffda RBX: 000058bf9b50f6d0 RCX: 00007b9309168d39
    [  272.316905] RDX: 0000000000000000 RSI: 000058bf6c103a77 RDI: 0000000000000003
    [  272.324036] RBP: 00007fff50f1a2e0 R08: 00007fff50f19218 R09: 0000000021ec4150
    [  272.331166] R10: 000058bf9b50f7f0 R11: 0000000000000246 R12: 0000000000000000
    [  272.338296] R13: 00000000fffffffe R14: 0000000000000000 R15: 000058bf6c103a77
    [  272.345428]  </TASK>
    [  272.347617] Modules linked in: i2c_cros_ec_tunnel(+)
    [  272.364585] gsmi: Log Shutdown Reason 0x03
    
    Returning -EPROBE_DEFER will allow the device to be bound once the
    controller is bound, in the case of built-in drivers.
    
    Fixes: 9d230c9e4f4e ("i2c: ChromeOS EC tunnel driver")
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Cc: <[email protected]> # v3.16+
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
i3c: Add NULL pointer check in i3c_master_queue_ibi() [+ + +]
Author: Manjunatha Venkatesh <[email protected]>
Date:   Wed Mar 26 18:00:46 2025 +0530

    i3c: Add NULL pointer check in i3c_master_queue_ibi()
    
    commit bd496a44f041da9ef3afe14d1d6193d460424e91 upstream.
    
    The I3C master driver may receive an IBI from a target device that has not
    been probed yet. In such cases, the master calls `i3c_master_queue_ibi()`
    to queue an IBI work task, leading to "Unable to handle kernel read from
    unreadable memory" and resulting in a kernel panic.
    
    Typical IBI handling flow:
    1. The I3C master scans target devices and probes their respective drivers.
    2. The target device driver calls `i3c_device_request_ibi()` to enable IBI
       and assigns `dev->ibi = ibi`.
    3. The I3C master receives an IBI from the target device and calls
       `i3c_master_queue_ibi()` to queue the target device driver’s IBI
       handler task.
    
    However, since target device events are asynchronous to the I3C probe
    sequence, step 3 may occur before step 2, causing `dev->ibi` to be `NULL`,
    leading to a kernel panic.
    
    Add a NULL pointer check in `i3c_master_queue_ibi()` to prevent accessing
    an uninitialized `dev->ibi`, ensuring stability.
    
    Fixes: 3a379bbcea0af ("i3c: Add core I3C infrastructure")
    Cc: [email protected]
    Link: https://lore.kernel.org/lkml/Z9gjGYudiYyl3bSe@lizhi-Precision-Tower-5810/
    Signed-off-by: Manjunatha Venkatesh <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i3c: master: svc: Use readsb helper for reading MDB [+ + +]
Author: Stanley Chu <[email protected]>
Date:   Tue Mar 18 13:36:05 2025 +0800

    i3c: master: svc: Use readsb helper for reading MDB
    
    commit c06acf7143bddaa3c0f7bedd8b99e48f6acb85c3 upstream.
    
    The target can send the MDB byte followed by additional data bytes.
    The readl on MRDATAB reads one actual byte, but the readsl advances
    the destination pointer by 4 bytes. This causes the subsequent payload
    to be copied to wrong position in the destination buffer.
    
    Cc: [email protected]
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Signed-off-by: Stanley Chu <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
igc: add lock preventing multiple simultaneous PTM transactions [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:34 2025 -0700

    igc: add lock preventing multiple simultaneous PTM transactions
    
    [ Upstream commit 1a931c4f5e6862e61a4b130cb76b422e1415f644 ]
    
    Add a mutex around the PTM transaction to prevent multiple transactors
    
    Multiple processes try to initiate a PTM transaction, one or all may
    fail. This can be reproduced by running two instances of the
    following:
    
    $ sudo phc2sys -O 0 -i tsn0 -m
    
    PHC2SYS exits with:
    
    "ioctl PTP_OFFSET_PRECISE: Connection timed out" when the PTM transaction
     fails
    
    Note: Normally two instance of PHC2SYS will not run, but one process
     should not break another.
    
    Fixes: a90ec8483732 ("igc: Add support for PTP getcrosststamp()")
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igc: cleanup PTP module if probe fails [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:33 2025 -0700

    igc: cleanup PTP module if probe fails
    
    [ Upstream commit 1f025759ba394dd53e434d2668cb0597886d9b69 ]
    
    Make sure that the PTP module is cleaned up if the igc_probe() fails by
    calling igc_ptp_stop() on exit.
    
    Fixes: d89f88419f99 ("igc: Add skeletal frame for Intel(R) 2.5G Ethernet Controller support")
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igc: fix PTM cycle trigger logic [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:29 2025 -0700

    igc: fix PTM cycle trigger logic
    
    [ Upstream commit 8e404ad95d2c10c261e2ef6992c7c12dde03df0e ]
    
    Writing to clear the PTM status 'valid' bit while the PTM cycle is
    triggered results in unreliable PTM operation. To fix this, clear the
    PTM 'trigger' and status after each PTM transaction.
    
    The issue can be reproduced with the following:
    
    $ sudo phc2sys -R 1000 -O 0 -i tsn0 -m
    
    Note: 1000 Hz (-R 1000) is unrealistically large, but provides a way to
    quickly reproduce the issue.
    
    PHC2SYS exits with:
    
    "ioctl PTP_OFFSET_PRECISE: Connection timed out" when the PTM transaction
      fails
    
    This patch also fixes a hang in igc_probe() when loading the igc
    driver in the kdump kernel on systems supporting PTM.
    
    The igc driver running in the base kernel enables PTM trigger in
    igc_probe().  Therefore the driver is always in PTM trigger mode,
    except in brief periods when manually triggering a PTM cycle.
    
    When a crash occurs, the NIC is reset while PTM trigger is enabled.
    Due to a hardware problem, the NIC is subsequently in a bad busmaster
    state and doesn't handle register reads/writes.  When running
    igc_probe() in the kdump kernel, the first register access to a NIC
    register hangs driver probing and ultimately breaks kdump.
    
    With this patch, igc has PTM trigger disabled most of the time,
    and the trigger is only enabled for very brief (10 - 100 us) periods
    when manually triggering a PTM cycle.  Chances that a crash occurs
    during a PTM trigger are not 0, but extremely reduced.
    
    Fixes: a90ec8483732 ("igc: Add support for PTP getcrosststamp()")
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Tested-by: Avigail Dahan <[email protected]>
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Tested-by: Corinna Vinschen <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igc: handle the IGC_PTP_ENABLED flag correctly [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:32 2025 -0700

    igc: handle the IGC_PTP_ENABLED flag correctly
    
    [ Upstream commit 26a3910afd111f7c1a96dace6dc02f3225063896 ]
    
    All functions in igc_ptp.c called from igc_main.c should check the
    IGC_PTP_ENABLED flag. Adding check for this flag to stop and reset
    functions.
    
    Fixes: 5f2958052c58 ("igc: Add basic skeleton for PTP")
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igc: increase wait time before retrying PTM [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:30 2025 -0700

    igc: increase wait time before retrying PTM
    
    [ Upstream commit 714cd033da6fea4cf54a11b3cfd070afde3f31df ]
    
    The i225/i226 hardware retries if it receives an inappropriate response
    from the upstream device. If the device retries too quickly, the root
    port does not respond.
    
    The wait between attempts was reduced from 10us to 1us in commit
    6b8aa753a9f9 ("igc: Decrease PTM short interval from 10 us to 1 us"), which
    said:
    
      With the 10us interval, we were seeing PTM transactions take around
      12us. Hardware team suggested this interval could be lowered to 1us
      which was confirmed with PCIe sniffer. With the 1us interval, PTM
      dialogs took around 2us.
    
    While a 1us short cycle time was thought to be theoretically sufficient, it
    turns out in practice it is not quite long enough. It is unclear if the
    problem is in the root port or an issue in i225/i226.
    
    Increase the wait from 1us to 4us. Increasing to 2us appeared to work in
    practice on the setups we have available. A value of 4us was chosen due to
    the limited hardware available for testing, with a goal of ensuring we wait
    long enough without overly penalizing the response time when unnecessary.
    
    The issue can be reproduced with the following:
    
    $ sudo phc2sys -R 1000 -O 0 -i tsn0 -m
    
    Note: 1000 Hz (-R 1000) is unrealistically large, but provides a way to
    quickly reproduce the issue.
    
    PHC2SYS exits with:
    
    "ioctl PTP_OFFSET_PRECISE: Connection timed out" when the PTM transaction
      fails
    
    Fixes: 6b8aa753a9f9 ("igc: Decrease PTM short interval from 10 us to 1 us")
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Tested-by: Avigail Dahan <[email protected]>
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

igc: move ktime snapshot into PTM retry loop [+ + +]
Author: Christopher S M Hall <[email protected]>
Date:   Tue Apr 1 16:35:31 2025 -0700

    igc: move ktime snapshot into PTM retry loop
    
    [ Upstream commit cd7f7328d691937102732f39f97ead35b15bf803 ]
    
    Move ktime_get_snapshot() into the loop. If a retry does occur, a more
    recent snapshot will result in a more accurate cross-timestamp.
    
    Fixes: a90ec8483732 ("igc: Add support for PTP getcrosststamp()")
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Tested-by: Mor Bar-Gabay <[email protected]>
    Tested-by: Avigail Dahan <[email protected]>
    Signed-off-by: Christopher S M Hall <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jacob Keller <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
io_uring/kbuf: reject zero sized provided buffers [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Mon Apr 7 07:51:23 2025 -0600

    io_uring/kbuf: reject zero sized provided buffers
    
    commit cf960726eb65e8d0bfecbcce6cf95f47b1ffa6cc upstream.
    
    This isn't fixing a real issue, but there's also zero point in going
    through group and buffer setup, when the buffers are going to be
    rejected once attempted to get used.
    
    Cc: [email protected]
    Reported-by: [email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/net: fix accept multishot handling [+ + +]
Author: Pavel Begunkov <[email protected]>
Date:   Sun Feb 23 17:22:29 2025 +0000

    io_uring/net: fix accept multishot handling
    
    Commit f6a89bf5278d6e15016a736db67043560d1b50d5 upstream.
    
    REQ_F_APOLL_MULTISHOT doesn't guarantee it's executed from the multishot
    context, so a multishot accept may get executed inline, fail
    io_req_post_cqe(), and ask the core code to kill the request with
    -ECANCELED by returning IOU_STOP_MULTISHOT even when a socket has been
    accepted and installed.
    
    Cc: [email protected]
    Fixes: 390ed29b5e425 ("io_uring: add IORING_ACCEPT_MULTISHOT for accept")
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/51c6deb01feaa78b08565ca8f24843c017f5bc80.1740331076.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommu/mediatek: Fix NULL pointer deference in mtk_iommu_device_group [+ + +]
Author: Louis-Alexis Eyraud <[email protected]>
Date:   Thu Apr 3 12:22:12 2025 +0200

    iommu/mediatek: Fix NULL pointer deference in mtk_iommu_device_group
    
    [ Upstream commit 38e8844005e6068f336a3ad45451a562a0040ca1 ]
    
    Currently, mtk_iommu calls during probe iommu_device_register before
    the hw_list from driver data is initialized. Since iommu probing issue
    fix, it leads to NULL pointer dereference in mtk_iommu_device_group when
    hw_list is accessed with list_first_entry (not null safe).
    
    So, change the call order to ensure iommu_device_register is called
    after the driver data are initialized.
    
    Fixes: 9e3a2a643653 ("iommu/mediatek: Adapt sharing and non-sharing pgtable case")
    Fixes: bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe path")
    Reviewed-by: Yong Wu <[email protected]>
    Tested-by: Chen-Yu Tsai <[email protected]> # MT8183 Juniper, MT8186 Tentacruel
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Tested-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Louis-Alexis Eyraud <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Joerg Roedel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
iommufd: Fail replace if device has not been attached [+ + +]
Author: Yi Liu <[email protected]>
Date:   Wed Mar 5 19:48:42 2025 -0800

    iommufd: Fail replace if device has not been attached
    
    commit 55c85fa7579dc2e3f5399ef5bad67a44257c1a48 upstream.
    
    The current implementation of iommufd_device_do_replace() implicitly
    assumes that the input device has already been attached. However, there
    is no explicit check to verify this assumption. If another device within
    the same group has been attached, the replace operation might succeed,
    but the input device itself may not have been attached yet.
    
    As a result, the input device might not be tracked in the
    igroup->device_list, and its reserved IOVA might not be added. Despite
    this, the caller might incorrectly assume that the device has been
    successfully replaced, which could lead to unexpected behavior or errors.
    
    To address this issue, add a check to ensure that the input device has
    been attached before proceeding with the replace operation. This check
    will help maintain the integrity of the device tracking system and prevent
    potential issues arising from incorrect assumptions about the device's
    attachment status.
    
    Fixes: e88d4ec154a8 ("iommufd: Add iommufd_device_replace()")
    Link: https://patch.msgid.link/r/[email protected]
    Cc: [email protected]
    Reviewed-by: Kevin Tian <[email protected]>
    Signed-off-by: Yi Liu <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iommufd: Fix uninitialized rc in iommufd_access_rw() [+ + +]
Author: Nicolin Chen <[email protected]>
Date:   Thu Feb 27 12:07:29 2025 -0800

    iommufd: Fix uninitialized rc in iommufd_access_rw()
    
    commit a05df03a88bc1088be8e9d958f208d6484691e43 upstream.
    
    Reported by smatch:
    drivers/iommu/iommufd/device.c:1392 iommufd_access_rw() error: uninitialized symbol 'rc'.
    
    Fixes: 8d40205f6093 ("iommufd: Add kAPI toward external drivers for kernel access")
    Link: https://patch.msgid.link/r/[email protected]
    Cc: [email protected]
    Reported-by: kernel test robot <[email protected]>
    Reported-by: Dan Carpenter <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]/
    [nicolinc: can't find an original report but only in "old smatch warnings"]
    Signed-off-by: Nicolin Chen <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipv6: Align behavior across nexthops during path selection [+ + +]
Author: Ido Schimmel <[email protected]>
Date:   Tue Apr 8 11:43:16 2025 +0300

    ipv6: Align behavior across nexthops during path selection
    
    [ Upstream commit 6933cd4714861eea6848f18396a119d741f25fc3 ]
    
    A nexthop is only chosen when the calculated multipath hash falls in the
    nexthop's hash region (i.e., the hash is smaller than the nexthop's hash
    threshold) and when the nexthop is assigned a non-negative score by
    rt6_score_route().
    
    Commit 4d0ab3a6885e ("ipv6: Start path selection from the first
    nexthop") introduced an unintentional difference between the first
    nexthop and the rest when the score is negative.
    
    When the first nexthop matches, but has a negative score, the code will
    currently evaluate subsequent nexthops until one is found with a
    non-negative score. On the other hand, when a different nexthop matches,
    but has a negative score, the code will fallback to the nexthop with
    which the selection started ('match').
    
    Align the behavior across all nexthops and fallback to 'match' when the
    first nexthop matches, but has a negative score.
    
    Fixes: 3d709f69a3e7 ("ipv6: Use hash-threshold instead of modulo-N")
    Fixes: 4d0ab3a6885e ("ipv6: Start path selection from the first nexthop")
    Reported-by: Willem de Bruijn <[email protected]>
    Closes: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Ido Schimmel <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
isofs: Prevent the use of too small fid [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Fri Apr 4 13:31:29 2025 +0800

    isofs: Prevent the use of too small fid
    
    commit 0405d4b63d082861f4eaff9d39c78ee9dc34f845 upstream.
    
    syzbot reported a slab-out-of-bounds Read in isofs_fh_to_parent. [1]
    
    The handle_bytes value passed in by the reproducing program is equal to 12.
    In handle_to_path(), only 12 bytes of memory are allocated for the structure
    file_handle->f_handle member, which causes an out-of-bounds access when
    accessing the member parent_block of the structure isofs_fid in isofs,
    because accessing parent_block requires at least 16 bytes of f_handle.
    Here, fh_len is used to indirectly confirm that the value of handle_bytes
    is greater than 3 before accessing parent_block.
    
    [1]
    BUG: KASAN: slab-out-of-bounds in isofs_fh_to_parent+0x1b8/0x210 fs/isofs/export.c:183
    Read of size 4 at addr ffff0000cc030d94 by task syz-executor215/6466
    CPU: 1 UID: 0 PID: 6466 Comm: syz-executor215 Not tainted 6.14.0-rc7-syzkaller-ga2392f333575 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    Call trace:
     show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C)
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:408 [inline]
     print_report+0x198/0x550 mm/kasan/report.c:521
     kasan_report+0xd8/0x138 mm/kasan/report.c:634
     __asan_report_load4_noabort+0x20/0x2c mm/kasan/report_generic.c:380
     isofs_fh_to_parent+0x1b8/0x210 fs/isofs/export.c:183
     exportfs_decode_fh_raw+0x2dc/0x608 fs/exportfs/expfs.c:523
     do_handle_to_path+0xa0/0x198 fs/fhandle.c:257
     handle_to_path fs/fhandle.c:385 [inline]
     do_handle_open+0x8cc/0xb8c fs/fhandle.c:403
     __do_sys_open_by_handle_at fs/fhandle.c:443 [inline]
     __se_sys_open_by_handle_at fs/fhandle.c:434 [inline]
     __arm64_sys_open_by_handle_at+0x80/0x94 fs/fhandle.c:434
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
     el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
     el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744
     el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762
     el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600
    
    Allocated by task 6466:
     kasan_save_stack mm/kasan/common.c:47 [inline]
     kasan_save_track+0x40/0x78 mm/kasan/common.c:68
     kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:562
     poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
     __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394
     kasan_kmalloc include/linux/kasan.h:260 [inline]
     __do_kmalloc_node mm/slub.c:4294 [inline]
     __kmalloc_noprof+0x32c/0x54c mm/slub.c:4306
     kmalloc_noprof include/linux/slab.h:905 [inline]
     handle_to_path fs/fhandle.c:357 [inline]
     do_handle_open+0x5a4/0xb8c fs/fhandle.c:403
     __do_sys_open_by_handle_at fs/fhandle.c:443 [inline]
     __se_sys_open_by_handle_at fs/fhandle.c:434 [inline]
     __arm64_sys_open_by_handle_at+0x80/0x94 fs/fhandle.c:434
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
     el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
     el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744
     el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762
     el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=4d7cd7dd0ce1aa8d5c65
    Tested-by: [email protected]
    CC: [email protected]
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
jbd2: remove wrong sb->s_sequence check [+ + +]
Author: Jan Kara <[email protected]>
Date:   Thu Feb 6 10:46:58 2025 +0100

    jbd2: remove wrong sb->s_sequence check
    
    commit e6eff39dd0fe4190c6146069cc16d160e71d1148 upstream.
    
    Journal emptiness is not determined by sb->s_sequence == 0 but rather by
    sb->s_start == 0 (which is set a few lines above). Furthermore 0 is a
    valid transaction ID so the check can spuriously trigger. Remove the
    invalid WARN_ON.
    
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Reviewed-by: Zhang Yi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
jfs: add sanity check for agwidth in dbMount [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Thu Feb 20 19:24:19 2025 +0800

    jfs: add sanity check for agwidth in dbMount
    
    [ Upstream commit ddf2846f22e8575d6b4b6a66f2100f168b8cd73d ]
    
    The width in dmapctl of the AG is zero, it trigger a divide error when
    calculating the control page level in dbAllocAG.
    
    To avoid this issue, add a check for agwidth in dbAllocAG.
    
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=7c808908291a569281a9
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: Fix uninit-value access of imap allocated in the diMount() function [+ + +]
Author: Zhongqiu Han <[email protected]>
Date:   Wed Feb 19 22:02:11 2025 +0800

    jfs: Fix uninit-value access of imap allocated in the diMount() function
    
    [ Upstream commit 9629d7d66c621671d9a47afe27ca9336bfc8a9ea ]
    
    syzbot reports that hex_dump_to_buffer is using uninit-value:
    
    =====================================================
    BUG: KMSAN: uninit-value in hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171
    hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171
    print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276
    diFree+0x5ba/0x4350 fs/jfs/jfs_imap.c:876
    jfs_evict_inode+0x510/0x550 fs/jfs/inode.c:156
    evict+0x723/0xd10 fs/inode.c:796
    iput_final fs/inode.c:1946 [inline]
    iput+0x97b/0xdb0 fs/inode.c:1972
    txUpdateMap+0xf3e/0x1150 fs/jfs/jfs_txnmgr.c:2367
    txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline]
    jfs_lazycommit+0x627/0x11d0 fs/jfs/jfs_txnmgr.c:2733
    kthread+0x6b9/0xef0 kernel/kthread.c:464
    ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:148
    ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
    
    Uninit was created at:
    slab_post_alloc_hook mm/slub.c:4121 [inline]
    slab_alloc_node mm/slub.c:4164 [inline]
    __kmalloc_cache_noprof+0x8e3/0xdf0 mm/slub.c:4320
    kmalloc_noprof include/linux/slab.h:901 [inline]
    diMount+0x61/0x7f0 fs/jfs/jfs_imap.c:105
    jfs_mount+0xa8e/0x11d0 fs/jfs/jfs_mount.c:176
    jfs_fill_super+0xa47/0x17c0 fs/jfs/super.c:523
    get_tree_bdev_flags+0x6ec/0x910 fs/super.c:1636
    get_tree_bdev+0x37/0x50 fs/super.c:1659
    jfs_get_tree+0x34/0x40 fs/jfs/super.c:635
    vfs_get_tree+0xb1/0x5a0 fs/super.c:1814
    do_new_mount+0x71f/0x15e0 fs/namespace.c:3560
    path_mount+0x742/0x1f10 fs/namespace.c:3887
    do_mount fs/namespace.c:3900 [inline]
    __do_sys_mount fs/namespace.c:4111 [inline]
    __se_sys_mount+0x71f/0x800 fs/namespace.c:4088
    __x64_sys_mount+0xe4/0x150 fs/namespace.c:4088
    x64_sys_call+0x39bf/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:166
    do_syscall_x64 arch/x86/entry/common.c:52 [inline]
    do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
    entry_SYSCALL_64_after_hwframe+0x77/0x7f
    =====================================================
    
    The reason is that imap is not properly initialized after memory
    allocation. It will cause the snprintf() function to write uninitialized
    data into linebuf within hex_dump_to_buffer().
    
    Fix this by using kzalloc instead of kmalloc to clear its content at the
    beginning in diMount().
    
    Signed-off-by: Zhongqiu Han <[email protected]>
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/lkml/[email protected]/
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: Prevent copying of nlink with value 0 from disk inode [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Thu Feb 20 19:13:21 2025 +0800

    jfs: Prevent copying of nlink with value 0 from disk inode
    
    [ Upstream commit b61e69bb1c049cf507e3c654fa3dc1568231bd07 ]
    
    syzbot report a deadlock in diFree. [1]
    
    When calling "ioctl$LOOP_SET_STATUS64", the offset value passed in is 4,
    which does not match the mounted loop device, causing the mapping of the
    mounted loop device to be invalidated.
    
    When creating the directory and creating the inode of iag in diReadSpecial(),
    read the page of fixed disk inode (AIT) in raw mode in read_metapage(), the
    metapage data it returns is corrupted, which causes the nlink value of 0 to be
    assigned to the iag inode when executing copy_from_dinode(), which ultimately
    causes a deadlock when entering diFree().
    
    To avoid this, first check the nlink value of dinode before setting iag inode.
    
    [1]
    WARNING: possible recursive locking detected
    6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Not tainted
    --------------------------------------------
    syz-executor301/5309 is trying to acquire lock:
    ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889
    
    but task is already holding lock:
    ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
    
    other info that might help us debug this:
     Possible unsafe locking scenario:
    
           CPU0
           ----
      lock(&(imap->im_aglock[index]));
      lock(&(imap->im_aglock[index]));
    
     *** DEADLOCK ***
    
     May be due to missing lock nesting notation
    
    5 locks held by syz-executor301/5309:
     #0: ffff8880422a4420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
     #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:850 [inline]
     #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: filename_create+0x260/0x540 fs/namei.c:4026
     #2: ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
     #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2460 [inline]
     #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline]
     #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocAG+0x4b7/0x1e50 fs/jfs/jfs_imap.c:1669
     #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2477 [inline]
     #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline]
     #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocAG+0x869/0x1e50 fs/jfs/jfs_imap.c:1669
    
    stack backtrace:
    CPU: 0 UID: 0 PID: 5309 Comm: syz-executor301 Not tainted 6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
     print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037
     check_deadlock kernel/locking/lockdep.c:3089 [inline]
     validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891
     __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
     lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
     __mutex_lock_common kernel/locking/mutex.c:608 [inline]
     __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
     diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889
     jfs_evict_inode+0x32d/0x440 fs/jfs/inode.c:156
     evict+0x4e8/0x9b0 fs/inode.c:725
     diFreeSpecial fs/jfs/jfs_imap.c:552 [inline]
     duplicateIXtree+0x3c6/0x550 fs/jfs/jfs_imap.c:3022
     diNewIAG fs/jfs/jfs_imap.c:2597 [inline]
     diAllocExt fs/jfs/jfs_imap.c:1905 [inline]
     diAllocAG+0x17dc/0x1e50 fs/jfs/jfs_imap.c:1669
     diAlloc+0x1d2/0x1630 fs/jfs/jfs_imap.c:1590
     ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56
     jfs_mkdir+0x1c5/0xba0 fs/jfs/namei.c:225
     vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
     do_mkdirat+0x264/0x3a0 fs/namei.c:4280
     __do_sys_mkdirat fs/namei.c:4295 [inline]
     __se_sys_mkdirat fs/namei.c:4293 [inline]
     __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=355da3b3a74881008e8f
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
kbuild: Add '-fno-builtin-wcslen' [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Apr 7 16:22:12 2025 -0700

    kbuild: Add '-fno-builtin-wcslen'
    
    commit 84ffc79bfbf70c779e60218563f2f3ad45288671 upstream.
    
    A recent optimization change in LLVM [1] aims to transform certain loop
    idioms into calls to strlen() or wcslen(). This change transforms the
    first while loop in UniStrcat() into a call to wcslen(), breaking the
    build when UniStrcat() gets inlined into alloc_path_with_tree_prefix():
    
      ld.lld: error: undefined symbol: wcslen
      >>> referenced by nls_ucs2_utils.h:54 (fs/smb/client/../../nls/nls_ucs2_utils.h:54)
      >>>               vmlinux.o:(alloc_path_with_tree_prefix)
      >>> referenced by nls_ucs2_utils.h:54 (fs/smb/client/../../nls/nls_ucs2_utils.h:54)
      >>>               vmlinux.o:(alloc_path_with_tree_prefix)
    
    Disable this optimization with '-fno-builtin-wcslen', which prevents the
    compiler from assuming that wcslen() is available in the kernel's C
    library.
    
    [ More to the point - it's not that we couldn't implement wcslen(), it's
      that this isn't an optimization at all in the context of the kernel.
    
      Replacing a simple inlined loop with a function call to the same loop
      is just stupid and pointless if you don't have long strings and fancy
      libraries with vectorization support etc.
    
      For the regular 'strlen()' cases, we want the compiler to do this in
      order to handle the trivial case of constant strings. And we do have
      optimized versions of 'strlen()' on some architectures. But for
      wcslen? Just no.    - Linus ]
    
    Cc: [email protected]
    Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    [nathan: Resolve small conflict in older trees]
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ksmbd: Fix dangling pointer in krb_authenticate [+ + +]
Author: Sean Heelan <[email protected]>
Date:   Mon Apr 7 11:26:50 2025 +0000

    ksmbd: Fix dangling pointer in krb_authenticate
    
    commit 1e440d5b25b7efccb3defe542a73c51005799a5f upstream.
    
    krb_authenticate frees sess->user and does not set the pointer
    to NULL. It calls ksmbd_krb5_authenticate to reinitialise
    sess->user but that function may return without doing so. If
    that happens then smb2_sess_setup, which calls krb_authenticate,
    will be accessing free'd memory when it later uses sess->user.
    
    Cc: [email protected]
    Signed-off-by: Sean Heelan <[email protected]>
    Acked-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: fix the warning from __kernel_write_iter [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Tue Apr 15 09:31:08 2025 +0900

    ksmbd: fix the warning from __kernel_write_iter
    
    commit b37f2f332b40ad1c27f18682a495850f2f04db0a upstream.
    
    [ 2110.972290] ------------[ cut here ]------------
    [ 2110.972301] WARNING: CPU: 3 PID: 735 at fs/read_write.c:599 __kernel_write_iter+0x21b/0x280
    
    This patch doesn't allow writing to directory.
    
    Cc: [email protected]
    Reported-by: Norbert Szetei <[email protected]>
    Tested-by: Norbert Szetei <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: fix use-after-free in smb_break_all_levII_oplock() [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Tue Apr 15 09:30:21 2025 +0900

    ksmbd: fix use-after-free in smb_break_all_levII_oplock()
    
    commit 18b4fac5ef17f77fed9417d22210ceafd6525fc7 upstream.
    
    There is a room in smb_break_all_levII_oplock that can cause racy issues
    when unlocking in the middle of the loop. This patch use read lock
    to protect whole loop.
    
    Cc: [email protected]
    Reported-by: Norbert Szetei <[email protected]>
    Tested-by: Norbert Szetei <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: Prevent integer overflow in calculation of deadtime [+ + +]
Author: Denis Arefev <[email protected]>
Date:   Wed Apr 9 12:04:49 2025 +0300

    ksmbd: Prevent integer overflow in calculation of deadtime
    
    commit a93ff742820f75bf8bb3fcf21d9f25ca6eb3d4c6 upstream.
    
    The user can set any value for 'deadtime'. This affects the arithmetic
    expression 'req->deadtime * SMB_ECHO_INTERVAL', which is subject to
    overflow. The added check makes the server behavior more predictable.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
    Cc: [email protected]
    Signed-off-by: Denis Arefev <[email protected]>
    Acked-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ktest: Fix Test Failures Due to Missing LOG_FILE Directories [+ + +]
Author: Ayush Jain <[email protected]>
Date:   Fri Mar 7 04:38:54 2025 +0000

    ktest: Fix Test Failures Due to Missing LOG_FILE Directories
    
    [ Upstream commit 5a1bed232781d356f842576daacc260f0d0c8d2e ]
    
    Handle missing parent directories for LOG_FILE path to prevent test
    failures. If the parent directories don't exist, create them to ensure
    the tests proceed successfully.
    
    Cc: <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Ayush Jain <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
kunit: qemu_configs: SH: Respect kunit cmdline [+ + +]
Author: Thomas Weißschuh <[email protected]>
Date:   Mon Apr 7 10:58:03 2025 +0200

    kunit: qemu_configs: SH: Respect kunit cmdline
    
    [ Upstream commit b26c1a85f3fc3cc749380ff94199377fc2d0c203 ]
    
    The default SH kunit configuration sets CONFIG_CMDLINE_OVERWRITE which
    completely disregards the cmdline passed from the bootloader/QEMU in favor
    of the builtin CONFIG_CMDLINE.
    However the kunit tool needs to pass arguments to the in-kernel kunit core,
    for filters and other runtime parameters.
    
    Enable CONFIG_CMDLINE_EXTEND instead, so kunit arguments are respected.
    
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 8110a3cab05e ("kunit: tool: Add support for SH under QEMU")
    Signed-off-by: Thomas Weißschuh <[email protected]>
    Reviewed-by: David Gow <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
KVM: arm64: Tear down vGIC on failed vCPU creation [+ + +]
Author: Will Deacon <[email protected]>
Date:   Fri Mar 14 13:34:09 2025 +0000

    KVM: arm64: Tear down vGIC on failed vCPU creation
    
    commit 250f25367b58d8c65a1b060a2dda037eea09a672 upstream.
    
    If kvm_arch_vcpu_create() fails to share the vCPU page with the
    hypervisor, we propagate the error back to the ioctl but leave the
    vGIC vCPU data initialised. Note only does this leak the corresponding
    memory when the vCPU is destroyed but it can also lead to use-after-free
    if the redistributor device handling tries to walk into the vCPU.
    
    Add the missing cleanup to kvm_arch_vcpu_create(), ensuring that the
    vGIC vCPU structures are destroyed on error.
    
    Cc: <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Cc: Quentin Perret <[email protected]>
    Signed-off-by: Will Deacon <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Oliver Upton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: x86: Acquire SRCU in KVM_GET_MP_STATE to protect guest memory accesses [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Tue Apr 1 08:05:04 2025 -0700

    KVM: x86: Acquire SRCU in KVM_GET_MP_STATE to protect guest memory accesses
    
    commit ef01cac401f18647d62720cf773d7bb0541827da upstream.
    
    Acquire a lock on kvm->srcu when userspace is getting MP state to handle a
    rather extreme edge case where "accepting" APIC events, i.e. processing
    pending INIT or SIPI, can trigger accesses to guest memory.  If the vCPU
    is in L2 with INIT *and* a TRIPLE_FAULT request pending, then getting MP
    state will trigger a nested VM-Exit by way of ->check_nested_events(), and
    emuating the nested VM-Exit can access guest memory.
    
    The splat was originally hit by syzkaller on a Google-internal kernel, and
    reproduced on an upstream kernel by hacking the triple_fault_event_test
    selftest to stuff a pending INIT, store an MSR on VM-Exit (to generate a
    memory access on VMX), and do vcpu_mp_state_get() to trigger the scenario.
    
      =============================
      WARNING: suspicious RCU usage
      6.14.0-rc3-b112d356288b-vmx/pi_lockdep_false_pos-lock #3 Not tainted
      -----------------------------
      include/linux/kvm_host.h:1058 suspicious rcu_dereference_check() usage!
    
      other info that might help us debug this:
    
      rcu_scheduler_active = 2, debug_locks = 1
      1 lock held by triple_fault_ev/1256:
       #0: ffff88810df5a330 (&vcpu->mutex){+.+.}-{4:4}, at: kvm_vcpu_ioctl+0x8b/0x9a0 [kvm]
    
      stack backtrace:
      CPU: 11 UID: 1000 PID: 1256 Comm: triple_fault_ev Not tainted 6.14.0-rc3-b112d356288b-vmx #3
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      Call Trace:
       <TASK>
       dump_stack_lvl+0x7f/0x90
       lockdep_rcu_suspicious+0x144/0x190
       kvm_vcpu_gfn_to_memslot+0x156/0x180 [kvm]
       kvm_vcpu_read_guest+0x3e/0x90 [kvm]
       read_and_check_msr_entry+0x2e/0x180 [kvm_intel]
       __nested_vmx_vmexit+0x550/0xde0 [kvm_intel]
       kvm_check_nested_events+0x1b/0x30 [kvm]
       kvm_apic_accept_events+0x33/0x100 [kvm]
       kvm_arch_vcpu_ioctl_get_mpstate+0x30/0x1d0 [kvm]
       kvm_vcpu_ioctl+0x33e/0x9a0 [kvm]
       __x64_sys_ioctl+0x8b/0xb0
       do_syscall_64+0x6c/0x170
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
       </TASK>
    
    Cc: [email protected]
    Signed-off-by: Sean Christopherson <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: x86: Explicitly zero-initialize on-stack CPUID unions [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Mar 14 19:41:02 2025 -0700

    KVM: x86: Explicitly zero-initialize on-stack CPUID unions
    
    commit bc52ae0a708cb6fa3926d11c88e3c55e1171b4a1 upstream.
    
    Explicitly zero/empty-initialize the unions used for PMU related CPUID
    entries, instead of manually zeroing all fields (hopefully), or in the
    case of 0x80000022, relying on the compiler to clobber the uninitialized
    bitfields.
    
    Signed-off-by: Sean Christopherson <[email protected]>
    Reviewed-by: Jim Mattson <[email protected]>
    Message-ID: <[email protected]>
    Cc: [email protected]
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
landlock: Add the errata interface [+ + +]
Author: Mickaël Salaün <[email protected]>
Date:   Tue Mar 18 17:14:37 2025 +0100

    landlock: Add the errata interface
    
    commit 15383a0d63dbcd63dc7e8d9ec1bf3a0f7ebf64ac upstream.
    
    Some fixes may require user space to check if they are applied on the
    running kernel before using a specific feature.  For instance, this
    applies when a restriction was previously too restrictive and is now
    getting relaxed (e.g. for compatibility reasons).  However, non-visible
    changes for legitimate use (e.g. security fixes) do not require an
    erratum.
    
    Because fixes are backported down to a specific Landlock ABI, we need a
    way to avoid cherry-pick conflicts.  The solution is to only update a
    file related to the lower ABI impacted by this issue.  All the ABI files
    are then used to create a bitmask of fixes.
    
    The new errata interface is similar to the one used to get the supported
    Landlock ABI version, but it returns a bitmask instead because the order
    of fixes may not match the order of versions, and not all fixes may
    apply to all versions.
    
    The actual errata will come with dedicated commits.  The description is
    not actually used in the code but serves as documentation.
    
    Create the landlock_abi_version symbol and use its value to check errata
    consistency.
    
    Update test_base's create_ruleset_checks_ordering tests and add errata
    tests.
    
    This commit is backportable down to the first version of Landlock.
    
    Fixes: 3532b0b4352c ("landlock: Enable user space to infer supported features")
    Cc: Günther Noack <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mickaël Salaün <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs [+ + +]
Author: Abel Vesa <[email protected]>
Date:   Wed Mar 5 15:09:06 2025 +0200

    leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs
    
    commit 2528eec7da0ec58fcae6d12cfa79a622c933d86b upstream.
    
    When determining the actual best period by looping through all
    possible PWM configs, the resolution currently used is based on
    bit shift value which is off-by-one above the possible maximum
    PWM value allowed.
    
    So subtract one from the resolution before determining the best
    period so that the maximum duty cycle requested by the PWM user
    won't result in a value above the maximum allowed by the selected
    resolution.
    
    Cc: [email protected]    # 6.4
    Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
    Signed-off-by: Abel Vesa <[email protected]>
    Reviewed-by: Sebastian Reichel <[email protected]>
    Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-3-bfe124a53a9f@linaro.org
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

leds: rgb: leds-qcom-lpg: Fix pwm resolution max for Hi-Res PWMs [+ + +]
Author: Abel Vesa <[email protected]>
Date:   Wed Mar 5 15:09:05 2025 +0200

    leds: rgb: leds-qcom-lpg: Fix pwm resolution max for Hi-Res PWMs
    
    commit b7881eacc07fdf50be3f33c662997541bb59366d upstream.
    
    Ideally, the requested duty cycle should never translate to a PWM
    value higher than the selected resolution (PWM size), but currently the
    best matched period is never reported back to the PWM consumer, so the
    consumer will still be using the requested period which is higher than
    the best matched one. This will result in PWM consumer requesting
    duty cycle values higher than the allowed PWM value.
    
    For example, a consumer might request a period of 5ms while the best
    (closest) period the PWM hardware will do is 4.26ms. For this best
    matched resolution, if the selected resolution is 8-bit wide, when
    the consumer asks for a duty cycle of 5ms, the PWM value will be 300,
    which is outside of what the resolution allows. This will happen with
    all possible resolutions when selected.
    
    Since for these Hi-Res PWMs, the current implementation is capping the PWM
    value at a 15-bit resolution, even when lower resolutions are selected,
    the value will be wrapped around by the HW internal logic to the selected
    resolution.
    
    Fix the issue by capping the PWM value to the maximum value allowed by
    the selected resolution.
    
    Cc: [email protected]    # 6.4
    Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
    Signed-off-by: Abel Vesa <[email protected]>
    Reviewed-by: Bjorn Andersson <[email protected]>
    Reviewed-by: Sebastian Reichel <[email protected]>
    Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-2-bfe124a53a9f@linaro.org
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets [+ + +]
Author: T Pratham <[email protected]>
Date:   Wed Mar 19 16:44:38 2025 +0530

    lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets
    
    commit 8b46fdaea819a679da176b879e7b0674a1161a5e upstream.
    
    The split_sg_phys function was incorrectly setting the offsets of all
    scatterlist entries (except the first) to 0.  Only the first scatterlist
    entry's offset and length needs to be modified to account for the skip.
    Setting the rest entries' offsets to 0 could lead to incorrect data
    access.
    
    I am using this function in a crypto driver that I'm currently developing
    (not yet sent to mailing list).  During testing, it was observed that the
    output scatterlists (except the first one) contained incorrect garbage
    data.
    
    I narrowed this issue down to the call of sg_split().  Upon debugging
    inside this function, I found that this resetting of offset is the cause
    of the problem, causing the subsequent scatterlists to point to incorrect
    memory locations in a page.  By removing this code, I am obtaining
    expected data in all the split output scatterlists.  Thus, this was indeed
    causing observable runtime effects!
    
    This patch removes the offending code, ensuring that the page offsets in
    the input scatterlist are preserved in the output scatterlist.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: f8bcbe62acd0 ("lib: scatterlist: add sg splitting function")
    Signed-off-by: T Pratham <[email protected]>
    Cc: Robert Jarzmik <[email protected]>
    Cc: Jens Axboe <[email protected]>
    Cc: Kamlesh Gurudasani <[email protected]>
    Cc: Praneeth Bajjuri <[email protected]>
    Cc: Vignesh Raghavendra <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: Linux 6.6.88 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Fri Apr 25 10:45:59 2025 +0200

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

 
locking/lockdep: Decrease nr_unused_locks if lock unused in zap_class() [+ + +]
Author: Boqun Feng <[email protected]>
Date:   Wed Mar 26 11:08:30 2025 -0700

    locking/lockdep: Decrease nr_unused_locks if lock unused in zap_class()
    
    commit 495f53d5cca0f939eaed9dca90b67e7e6fb0e30c upstream.
    
    Currently, when a lock class is allocated, nr_unused_locks will be
    increased by 1, until it gets used: nr_unused_locks will be decreased by
    1 in mark_lock(). However, one scenario is missed: a lock class may be
    zapped without even being used once. This could result into a situation
    that nr_unused_locks != 0 but no unused lock class is active in the
    system, and when `cat /proc/lockdep_stats`, a WARN_ON() will
    be triggered in a CONFIG_DEBUG_LOCKDEP=y kernel:
    
      [...] DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused)
      [...] WARNING: CPU: 41 PID: 1121 at kernel/locking/lockdep_proc.c:283 lockdep_stats_show+0xba9/0xbd0
    
    And as a result, lockdep will be disabled after this.
    
    Therefore, nr_unused_locks needs to be accounted correctly at
    zap_class() time.
    
    Signed-off-by: Boqun Feng <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Waiman Long <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
LoongArch: Eliminate superfluous get_numa_distances_cnt() [+ + +]
Author: Yuli Wang <[email protected]>
Date:   Sat Mar 8 13:51:32 2025 +0800

    LoongArch: Eliminate superfluous get_numa_distances_cnt()
    
    commit a0d3c8bcb9206ac207c7ad3182027c6b0a1319bb upstream.
    
    In LoongArch, get_numa_distances_cnt() isn't in use, resulting in a
    compiler warning.
    
    Fix follow errors with clang-18 when W=1e:
    
    arch/loongarch/kernel/acpi.c:259:28: error: unused function 'get_numa_distances_cnt' [-Werror,-Wunused-function]
      259 | static inline unsigned int get_numa_distances_cnt(struct acpi_table_slit *slit)
          |                            ^~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    
    Link: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Yuli Wang <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
loop: LOOP_SET_FD: send uevents for partitions [+ + +]
Author: Thomas Weißschuh <[email protected]>
Date:   Tue Apr 15 16:55:06 2025 +0200

    loop: LOOP_SET_FD: send uevents for partitions
    
    commit 0dba7a05b9e47d8b546399117b0ddf2426dc6042 upstream.
    
    Remove the suppression of the uevents before scanning for partitions.
    The partitions inherit their suppression settings from their parent device,
    which lead to the uevents being dropped.
    
    This is similar to the same changes for LOOP_CONFIGURE done in
    commit bb430b694226 ("loop: LOOP_CONFIGURE: send uevents for partitions").
    
    Fixes: 498ef5c777d9 ("loop: suppress uevents while reconfiguring the device")
    Cc: [email protected]
    Signed-off-by: Thomas Weißschuh <[email protected]>
    Reviewed-by: Jan Kara <[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]>

loop: properly send KOBJ_CHANGED uevent for disk device [+ + +]
Author: Thomas Weißschuh <[email protected]>
Date:   Tue Apr 15 10:51:47 2025 +0200

    loop: properly send KOBJ_CHANGED uevent for disk device
    
    commit e7bc0010ceb403d025100698586c8e760921d471 upstream.
    
    The original commit message and the wording "uncork" in the code comment
    indicate that it is expected that the suppressed event instances are
    automatically sent after unsuppressing.
    This is not the case, instead they are discarded.
    In effect this means that no "changed" events are emitted on the device
    itself by default.
    While each discovered partition does trigger a changed event on the
    device, devices without partitions don't have any event emitted.
    
    This makes udev miss the device creation and prompted workarounds in
    userspace. See the linked util-linux/losetup bug.
    
    Explicitly emit the events and drop the confusingly worded comments.
    
    Link: https://github.com/util-linux/util-linux/issues/2434
    Fixes: 498ef5c777d9 ("loop: suppress uevents while reconfiguring the device")
    Cc: [email protected]
    Signed-off-by: Thomas Weißschuh <[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]>

 
mailbox: tegra-hsp: Define dimensioning masks in SoC data [+ + +]
Author: Kartik Rajput <[email protected]>
Date:   Thu Jan 23 18:16:32 2025 +0530

    mailbox: tegra-hsp: Define dimensioning masks in SoC data
    
    commit bf0c9fb462038815f5f502653fb6dba06e6af415 upstream.
    
    Tegra264 has updated HSP_INT_DIMENSIONING register as follows:
            * nSI is now BIT17:BIT21.
            * nDB is now BIT12:BIT16.
    
    Currently, we are using a static macro HSP_nINT_MASK to get the values
    from HSP_INT_DIMENSIONING register. This results in wrong values for nSI
    for HSP instances that supports 16 shared interrupts.
    
    Define dimensioning masks in soc data and use them to parse nSI, nDB,
    nAS, nSS & nSM values.
    
    Fixes: 602dbbacc3ef ("mailbox: tegra: add support for Tegra264")
    Cc: [email protected]
    Signed-off-by: Kartik Rajput <[email protected]>
    Acked-by: Thierry Reding <[email protected]>
    Acked-by: Jon Hunter <[email protected]>
    Signed-off-by: Jassi Brar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
md/md-bitmap: fix stats collection for external bitmaps [+ + +]
Author: Zheng Qixing <[email protected]>
Date:   Thu Apr 3 09:53:22 2025 +0800

    md/md-bitmap: fix stats collection for external bitmaps
    
    [ Upstream commit 6ec1f0239485028445d213d91cfee5242f3211ba ]
    
    The bitmap_get_stats() function incorrectly returns -ENOENT for external
    bitmaps.
    
    Remove the external bitmap check as the statistics should be available
    regardless of bitmap storage location.
    
    Return -EINVAL only for invalid bitmap with no storage (neither in
    superblock nor in external file).
    
    Note: "bitmap_info.external" here refers to a bitmap stored in a separate
    file (bitmap_file), not to external metadata.
    
    Fixes: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
    Signed-off-by: Zheng Qixing <[email protected]>
    Link: https://lore.kernel.org/linux-raid/[email protected]
    Signed-off-by: Yu Kuai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
md/raid10: fix missing discard IO accounting [+ + +]
Author: Yu Kuai <[email protected]>
Date:   Tue Mar 25 09:57:46 2025 +0800

    md/raid10: fix missing discard IO accounting
    
    [ Upstream commit d05af90d6218e9c8f1c2026990c3f53c1b41bfb0 ]
    
    md_account_bio() is not called from raid10_handle_discard(), now that we
    handle bitmap inside md_account_bio(), also fix missing
    bitmap_startwrite for discard.
    
    Test whole disk discard for 20G raid10:
    
    Before:
    Device   d/s     dMB/s   drqm/s  %drqm d_await dareq-sz
    md0    48.00     16.00     0.00   0.00    5.42   341.33
    
    After:
    Device   d/s     dMB/s   drqm/s  %drqm d_await dareq-sz
    md0    68.00  20462.00     0.00   0.00    2.65 308133.65
    
    Link: https://lore.kernel.org/linux-raid/[email protected]
    Fixes: 528bc2cf2fcc ("md/raid10: enable io accounting")
    Signed-off-by: Yu Kuai <[email protected]>
    Acked-by: Coly Li <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
md: fix mddev uaf while iterating all_mddevs list [+ + +]
Author: Yu Kuai <[email protected]>
Date:   Thu Feb 20 20:43:48 2025 +0800

    md: fix mddev uaf while iterating all_mddevs list
    
    commit 8542870237c3a48ff049b6c5df5f50c8728284fa upstream.
    
    While iterating all_mddevs list from md_notify_reboot() and md_exit(),
    list_for_each_entry_safe is used, and this can race with deletint the
    next mddev, causing UAF:
    
    t1:
    spin_lock
    //list_for_each_entry_safe(mddev, n, ...)
     mddev_get(mddev1)
     // assume mddev2 is the next entry
     spin_unlock
                t2:
                //remove mddev2
                ...
                mddev_free
                spin_lock
                list_del
                spin_unlock
                kfree(mddev2)
     mddev_put(mddev1)
     spin_lock
     //continue dereference mddev2->all_mddevs
    
    The old helper for_each_mddev() actually grab the reference of mddev2
    while holding the lock, to prevent from being freed. This problem can be
    fixed the same way, however, the code will be complex.
    
    Hence switch to use list_for_each_entry, in this case mddev_put() can free
    the mddev1 and it's not safe as well. Refer to md_seq_show(), also factor
    out a helper mddev_put_locked() to fix this problem.
    
    Cc: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/linux-raid/[email protected]
    Fixes: f26514342255 ("md: stop using for_each_mddev in md_notify_reboot")
    Fixes: 16648bac862f ("md: stop using for_each_mddev in md_exit")
    Reported-and-tested-by: Guillaume Morin <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Yu Kuai <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Cc: Salvatore Bonaccorso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
media: i2c: adv748x: Fix test pattern selection mask [+ + +]
Author: Niklas Söderlund <[email protected]>
Date:   Tue Jan 21 21:44:00 2025 +0100

    media: i2c: adv748x: Fix test pattern selection mask
    
    commit 9e38acacb9d809b97a0bdc5c76e725355a47158a upstream.
    
    The mask to select the test-pattern in register ADV748X_SDP_FRP is
    incorrect, it's the lower 3 bits which controls the pattern. The
    GENMASK() macro is used incorrectly and the generated mask is 0x0e
    instead of 0x07.
    
    The result is that not all test patterns are selectable, and that in
    some cases the wrong test pattern is activated. Fix this by correcting
    the GENMASK().
    
    Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")
    Cc: [email protected]
    Signed-off-by: Niklas Söderlund <[email protected]>
    Reviewed-by: Kieran Bingham <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [hverkuil: fixed tiny typo in commit log: my -> by]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: i2c: ccs: Set the device's runtime PM status correctly in probe [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Jan 10 15:54:22 2025 +0200

    media: i2c: ccs: Set the device's runtime PM status correctly in probe
    
    commit 80704d14f1bd3628f578510e0a88b66824990ef6 upstream.
    
    Set the device's runtime PM status to suspended in probe error paths where
    it was previously set to active.
    
    Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM")
    Cc: [email protected] # for >= v5.15
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: i2c: ccs: Set the device's runtime PM status correctly in remove [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Jan 10 14:50:27 2025 +0200

    media: i2c: ccs: Set the device's runtime PM status correctly in remove
    
    commit e04604583095faf455b3490b004254a225fd60d4 upstream.
    
    Set the device's runtime PM status to suspended in device removal only if
    it wasn't suspended already.
    
    Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM")
    Cc: [email protected] # for >= v5.15
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: i2c: imx219: Rectify runtime PM handling in probe and remove [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Jan 10 14:53:20 2025 +0200

    media: i2c: imx219: Rectify runtime PM handling in probe and remove
    
    commit 42eceae9793566d0df53d509be3e416465c347f5 upstream.
    
    Set the device's runtime PM status and enable runtime PM before
    registering the async sub-device. This is needed to avoid the case where
    the device is runtime PM resumed while runtime PM has not been enabled
    yet.
    
    Also set the device's runtime PM status to suspended in remove only if it
    wasn't so already.
    
    Fixes: 1283b3b8f82b ("media: i2c: Add driver for Sony IMX219 sensor")
    Cc: [email protected] # for >= v6.6
    Reviewed-by: Bingbu Cao <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Jan 17 16:04:02 2025 +0200

    media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO
    
    commit 3d391292cdd53984ec1b9a1f6182a62a62751e03 upstream.
    
    Lift the xshutdown (enable) GPIO 1 ms after enabling the regulators, as
    required by the sensor's power-up sequence.
    
    Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
    Cc: [email protected]
    Signed-off-by: Sakari Ailus <[email protected]>
    Reviewed-by: Dave Stevenson <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: i2c: ov7251: Set enable GPIO low in probe [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Jan 17 15:38:13 2025 +0200

    media: i2c: ov7251: Set enable GPIO low in probe
    
    commit a1963698d59cec83df640ded343af08b76c8e9c5 upstream.
    
    Set the enable GPIO low when acquiring it.
    
    Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
    Cc: [email protected]
    Signed-off-by: Sakari Ailus <[email protected]>
    Reviewed-by: Dave Stevenson <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Tue Feb 18 18:58:09 2025 +0000

    media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization
    
    commit 4936cd5817af35d23e4d283f48fa59a18ef481e4 upstream.
    
    On Mediatek devices with a system companion processor (SCP) the mtk_scp
    structure has to be removed explicitly to avoid a resource leak.
    Free the structure in case the allocation of the firmware structure fails
    during the firmware initialization.
    
    Fixes: 53dbe0850444 ("media: mtk-vcodec: potential null pointer deference in SCP")
    Cc: [email protected]
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: mediatek: vcodec: mark vdec_vp9_slice_map_counts_eob_coef noinline [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Oct 18 15:14:42 2024 +0000

    media: mediatek: vcodec: mark vdec_vp9_slice_map_counts_eob_coef noinline
    
    commit 8b55f8818900c99dd4f55a59a103f5b29e41eb2c upstream.
    
    With KASAN enabled, clang fails to optimize the inline version of
    vdec_vp9_slice_map_counts_eob_coef() properly, leading to kilobytes
    of temporary values spilled to the stack:
    
    drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c:1526:12: error: stack frame size (2160) exceeds limit (2048) in 'vdec_vp9_slice_update_prob' [-Werror,-Wframe-larger-than]
    
    This seems to affect all versions of clang including the latest (clang-20),
    but the degree of stack overhead is different per release.
    
    Marking the function as noinline_for_stack is harmless here and avoids
    the problem completely.
    
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Sebastian Fricke <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Oct 18 15:21:10 2024 +0000

    media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
    
    commit 07df4f23ef3ffe6fee697cd2e03623ad27108843 upstream.
    
    This is one of three clang warnings about incompatible enum types
    in a conditional expression:
    
    drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
      597 |         inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
          |                                    ^ ~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~
    
    The code is correct, so just rework it to avoid the warning.
    
    Fixes: 0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
    Cc: [email protected]
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Alexandre Courbot <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: platform: stm32: Add check for clk_enable() [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Fri Nov 22 20:46:03 2024 +0000

    media: platform: stm32: Add check for clk_enable()
    
    commit f883f34b6a46b1a09d44d7f94c3cd72fe0e8f93b upstream.
    
    Add check for the return value of clk_enable() to gurantee the success.
    
    Fixes: 002e8f0d5927 ("media: stm32-dma2d: STM32 DMA2D driver")
    Cc: [email protected]
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: siano: Fix error handling in smsdvb_module_init() [+ + +]
Author: Yuan Can <[email protected]>
Date:   Tue Oct 22 14:50:37 2024 +0800

    media: siano: Fix error handling in smsdvb_module_init()
    
    commit 734ac57e47b3bdd140a1119e2c4e8e6f8ef8b33d upstream.
    
    The smsdvb_module_init() returns without checking the retval from
    smscore_register_hotplug().
    If the smscore_register_hotplug() failed, the module failed to install,
    leaving the smsdvb_debugfs not unregistered.
    
    Fixes: 3f6b87cff66b ("[media] siano: allow showing the complete statistics via debugfs")
    Cc: [email protected]
    Signed-off-by: Yuan Can <[email protected]>
    Acked-by: Ricardo Ribalda <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: streamzap: prevent processing IR data on URB failure [+ + +]
Author: Murad Masimov <[email protected]>
Date:   Mon Jan 13 13:51:31 2025 +0300

    media: streamzap: prevent processing IR data on URB failure
    
    commit 549f6d348167fb2f7800ed7c8d4bce9630c74498 upstream.
    
    If streamzap_callback() receives an urb with any non-critical error
    status, i.e. any error code other than -ECONNRESET, -ENOENT or -ESHUTDOWN,
    it will try to process IR data, ignoring a possible transfer failure.
    
    Make streamzap_callback() process IR data only when urb->status is 0.
    Move processing logic to a separate function to make code cleaner and
    more similar to the URB completion handlers in other RC drivers.
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Fixes: 19770693c354 ("V4L/DVB: staging/lirc: add lirc_streamzap driver")
    Cc: [email protected]
    Signed-off-by: Murad Masimov <[email protected]>
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: uvcvideo: Add quirk for Actions UVC05 [+ + +]
Author: Ricardo Ribalda <[email protected]>
Date:   Tue Dec 10 10:48:14 2024 +0000

    media: uvcvideo: Add quirk for Actions UVC05
    
    [ Upstream commit 8c54e58f94ed3ff28643aefd2c0c2c98313ee770 ]
    
    Actions UVC05 is a HDMI to USB dongle that implements the UVC protocol.
    
    When the device suspends, its firmware seems to enter a weird mode when it
    does not produce more frames.
    
    Add the device to the quirk list to disable autosuspend.
    
    Bus 001 Device 007: ID 1de1:f105 Actions Microelectronics Co. Display
     capture-UVC05
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass          239 Miscellaneous Device
      bDeviceSubClass         2 [unknown]
      bDeviceProtocol         1 Interface Association
      bMaxPacketSize0        64
      idVendor           0x1de1 Actions Microelectronics Co.
      idProduct          0xf105 Display capture-UVC05
      bcdDevice            4.09
      iManufacturer           1 Actions Micro
      iProduct                2 Display capture-UVC05
      iSerial                 3 -1005308387
      bNumConfigurations      1
    
    Signed-off-by: Ricardo Ribalda <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf() [+ + +]
Author: Karina Yankevich <[email protected]>
Date:   Wed Aug 21 14:31:34 2024 +0300

    media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
    
    commit 3edd1fc48d2c045e8259561797c89fe78f01717e upstream.
    
    In v4l2_detect_gtf(), it seems safer to cast the 32-bit image_width
    variable to the 64-bit type u64 before multiplying to avoid
    a possible overflow. The resulting object code even seems to
    look better, at least on x86_64.
    
    Found by Linux Verification Center (linuxtesting.org) with Svace.
    
    [Sergey: rewrote the patch subject/descripition]
    
    Fixes: c9bc9f50753d ("[media] v4l2-dv-timings: fix overflow in gtf timings calculation")
    Cc: [email protected]
    Signed-off-by: Karina Yankevich <[email protected]>
    Signed-off-by: Sergey Shtylyov <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: hfi: add a check to handle OOB in sfr region [+ + +]
Author: Vikash Garodia <[email protected]>
Date:   Thu Feb 20 22:50:11 2025 +0530

    media: venus: hfi: add a check to handle OOB in sfr region
    
    commit f4b211714bcc70effa60c34d9fa613d182e3ef1e upstream.
    
    sfr->buf_size is in shared memory and can be modified by malicious user.
    OOB write is possible when the size is made higher than actual sfr data
    buffer. Cap the size to allocated size for such cases.
    
    Cc: [email protected]
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Vikash Garodia <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: hfi: add check to handle incorrect queue size [+ + +]
Author: Vikash Garodia <[email protected]>
Date:   Thu Feb 20 22:50:10 2025 +0530

    media: venus: hfi: add check to handle incorrect queue size
    
    commit 69baf245b23e20efda0079238b27fc63ecf13de1 upstream.
    
    qsize represents size of shared queued between driver and video
    firmware. Firmware can modify this value to an invalid large value. In
    such situation, empty_space will be bigger than the space actually
    available. Since new_wr_idx is not checked, so the following code will
    result in an OOB write.
    ...
    qsize = qhdr->q_size
    
    if (wr_idx >= rd_idx)
     empty_space = qsize - (wr_idx - rd_idx)
    ....
    if (new_wr_idx < qsize) {
     memcpy(wr_ptr, packet, dwords << 2) --> OOB write
    
    Add check to ensure qsize is within the allocated size while
    reading and writing packets into the queue.
    
    Cc: [email protected]
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Vikash Garodia <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: hfi_parser: add check to avoid out of bound access [+ + +]
Author: Vikash Garodia <[email protected]>
Date:   Thu Feb 20 22:50:08 2025 +0530

    media: venus: hfi_parser: add check to avoid out of bound access
    
    commit 172bf5a9ef70a399bb227809db78442dc01d9e48 upstream.
    
    There is a possibility that init_codecs is invoked multiple times during
    manipulated payload from video firmware. In such case, if codecs_count
    can get incremented to value more than MAX_CODEC_NUM, there can be OOB
    access. Reset the count so that it always starts from beginning.
    
    Cc: [email protected]
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Vikash Garodia <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: hfi_parser: refactor hfi packet parsing logic [+ + +]
Author: Vikash Garodia <[email protected]>
Date:   Thu Feb 20 22:50:09 2025 +0530

    media: venus: hfi_parser: refactor hfi packet parsing logic
    
    commit 9edaaa8e3e15aab1ca413ab50556de1975bcb329 upstream.
    
    words_count denotes the number of words in total payload, while data
    points to payload of various property within it. When words_count
    reaches last word, data can access memory beyond the total payload. This
    can lead to OOB access. With this patch, the utility api for handling
    individual properties now returns the size of data consumed. Accordingly
    remaining bytes are calculated before parsing the payload, thereby
    eliminates the OOB access possibilities.
    
    Cc: [email protected]
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Signed-off-by: Vikash Garodia <[email protected]>
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: vim2m: print device name after registering device [+ + +]
Author: Matthew Majewski <[email protected]>
Date:   Wed Feb 19 14:05:01 2025 -0500

    media: vim2m: print device name after registering device
    
    commit 143d75583f2427f3a97dba62413c4f0604867ebf upstream.
    
    Move the v4l2_info() call displaying the video device name after the
    device is actually registered.
    
    This fixes a bug where the driver was always displaying "/dev/video0"
    since it was reading from the vfd before it was registered.
    
    Fixes: cf7f34777a5b ("media: vim2m: Register video device after setting up internals")
    Cc: [email protected]
    Signed-off-by: Matthew Majewski <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: visl: Fix ERANGE error when setting enum controls [+ + +]
Author: Nicolas Dufresne <[email protected]>
Date:   Tue Dec 10 16:02:53 2024 -0500

    media: visl: Fix ERANGE error when setting enum controls
    
    commit d98e9213a768a3cc3a99f5e1abe09ad3baff2104 upstream.
    
    The visl driver supports both frame and slice mode, with and without a
    start-code. But, the range and default for these enum controls was not
    set, which currently limits the decoder to enums with a value of 0. Fix
    this by setting the decoder mode and start code controls for both the
    H.264 and HEVC codecs.
    
    Fixes: 0c078e310b6d ("media: visl: add virtual stateless decoder driver")
    Cc: [email protected]
    Signed-off-by: Nicolas Dufresne <[email protected]>
    Signed-off-by: Sebastian Fricke <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mfd: ene-kb3930: Fix a potential NULL pointer dereference [+ + +]
Author: Chenyuan Yang <[email protected]>
Date:   Mon Feb 24 17:37:36 2025 -0600

    mfd: ene-kb3930: Fix a potential NULL pointer dereference
    
    commit 4cdf1d2a816a93fa02f7b6b5492dc7f55af2a199 upstream.
    
    The off_gpios could be NULL. Add missing check in the kb3930_probe().
    This is similar to the issue fixed in commit b1ba8bcb2d1f
    ("backlight: hx8357: Fix potential NULL pointer dereference").
    
    This was detected by our static analysis tool.
    
    Cc: [email protected]
    Fixes: ede6b2d1dfc0 ("mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller")
    Suggested-by: Lee Jones <[email protected]>
    Signed-off-by: Chenyuan Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
MIPS: cevt-ds1287: Add missing ds1287.h include [+ + +]
Author: WangYuli <[email protected]>
Date:   Tue Feb 18 20:57:23 2025 +0800

    MIPS: cevt-ds1287: Add missing ds1287.h include
    
    commit f3be225f338a578851a7b607a409f476354a8deb upstream.
    
    Address the issue of cevt-ds1287.c not including the ds1287.h header
    file.
    
    Fix follow errors with gcc-14 when -Werror:
    
    arch/mips/kernel/cevt-ds1287.c:15:5: error: no previous prototype for ‘ds1287_timer_state’ [-Werror=missing-prototypes]
       15 | int ds1287_timer_state(void)
          |     ^~~~~~~~~~~~~~~~~~
    arch/mips/kernel/cevt-ds1287.c:20:5: error: no previous prototype for ‘ds1287_set_base_clock’ [-Werror=missing-prototypes]
       20 | int ds1287_set_base_clock(unsigned int hz)
          |     ^~~~~~~~~~~~~~~~~~~~~
    arch/mips/kernel/cevt-ds1287.c:103:12: error: no previous prototype for ‘ds1287_clockevent_init’ [-Werror=missing-prototypes]
      103 | int __init ds1287_clockevent_init(int irq)
          |            ^~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[7]: *** [scripts/Makefile.build:207: arch/mips/kernel/cevt-ds1287.o] Error 1
    make[7]: *** Waiting for unfinished jobs....
    make[6]: *** [scripts/Makefile.build:465: arch/mips/kernel] Error 2
    make[6]: *** Waiting for unfinished jobs....
    
    Signed-off-by: WangYuli <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

MIPS: dec: Declare which_prom() as static [+ + +]
Author: WangYuli <[email protected]>
Date:   Tue Feb 18 20:54:31 2025 +0800

    MIPS: dec: Declare which_prom() as static
    
    commit 55fa5868519bc48a7344a4c070efa2f4468f2167 upstream.
    
    Declare which_prom() as static to suppress gcc compiler warning that
    'missing-prototypes'. This function is not intended to be called
    from other parts.
    
    Fix follow error with gcc-14 when -Werror:
    
    arch/mips/dec/prom/init.c:45:13: error: no previous prototype for ‘which_prom’ [-Werror=missing-prototypes]
       45 | void __init which_prom(s32 magic, s32 *prom_vec)
          |             ^~~~~~~~~~
    cc1: all warnings being treated as errors
    make[6]: *** [scripts/Makefile.build:207: arch/mips/dec/prom/init.o] Error 1
    make[5]: *** [scripts/Makefile.build:465: arch/mips/dec/prom] Error 2
    make[5]: *** Waiting for unfinished jobs....
    
    Signed-off-by: WangYuli <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

MIPS: ds1287: Match ds1287_set_base_clock() function types [+ + +]
Author: WangYuli <[email protected]>
Date:   Tue Feb 18 20:57:55 2025 +0800

    MIPS: ds1287: Match ds1287_set_base_clock() function types
    
    commit a759109b234385b74d2f5f4c86b5f59b3201ec12 upstream.
    
    Synchronize the declaration of ds1287_set_base_clock() between
    cevt-ds1287.c and ds1287.h.
    
    Fix follow error with gcc-14 when -Werror:
    
    arch/mips/kernel/cevt-ds1287.c:21:5: error: conflicting types for ‘ds1287_set_base_clock’; have ‘int(unsigned int)’
       21 | int ds1287_set_base_clock(unsigned int hz)
          |     ^~~~~~~~~~~~~~~~~~~~~
    In file included from arch/mips/kernel/cevt-ds1287.c:13:
    ./arch/mips/include/asm/ds1287.h:11:13: note: previous declaration of ‘ds1287_set_base_clock’ with type ‘void(unsigned int)’
       11 | extern void ds1287_set_base_clock(unsigned int clock);
          |             ^~~~~~~~~~~~~~~~~~~~~
    make[7]: *** [scripts/Makefile.build:207: arch/mips/kernel/cevt-ds1287.o] Error 1
    make[6]: *** [scripts/Makefile.build:465: arch/mips/kernel] Error 2
    make[6]: *** Waiting for unfinished jobs....
    
    Signed-off-by: WangYuli <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error [+ + +]
Author: Kunihiko Hayashi <[email protected]>
Date:   Tue Feb 25 20:02:48 2025 +0900

    misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error
    
    commit f6cb7828c8e17520d4f5afb416515d3fae1af9a9 upstream.
    
    After devm_request_irq() fails with error in pci_endpoint_test_request_irq(),
    the pci_endpoint_test_free_irq_vectors() is called assuming that all IRQs
    have been released.
    
    However, some requested IRQs remain unreleased, so there are still
    /proc/irq/* entries remaining, and this results in WARN() with the
    following message:
    
      remove_proc_entry: removing non-empty directory 'irq/30', leaking at least 'pci-endpoint-test.0'
      WARNING: CPU: 0 PID: 202 at fs/proc/generic.c:719 remove_proc_entry +0x190/0x19c
    
    To solve this issue, set the number of remaining IRQs to test->num_irqs,
    and release IRQs in advance by calling pci_endpoint_test_release_irq().
    
    Cc: [email protected]
    Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <[email protected]>
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

misc: pci_endpoint_test: Fix 'irq_type' to convey the correct type [+ + +]
Author: Kunihiko Hayashi <[email protected]>
Date:   Tue Feb 25 20:02:50 2025 +0900

    misc: pci_endpoint_test: Fix 'irq_type' to convey the correct type
    
    commit baaef0a274cfb75f9b50eab3ef93205e604f662c upstream.
    
    There are two variables that indicate the interrupt type to be used
    in the next test execution, "irq_type" as global and "test->irq_type".
    
    The global is referenced from pci_endpoint_test_get_irq() to preserve
    the current type for ioctl(PCITEST_GET_IRQTYPE).
    
    The type set in this function isn't reflected in the global "irq_type",
    so ioctl(PCITEST_GET_IRQTYPE) returns the previous type.
    
    As a result, the wrong type is displayed in old version of "pcitest"
    as follows:
    
      - Result of running "pcitest -i 0"
    
          SET IRQ TYPE TO LEGACY:         OKAY
    
      - Result of running "pcitest -I"
    
          GET IRQ TYPE:           MSI
    
    Whereas running the new version of "pcitest" in kselftest results in an
    error as follows:
    
      #  RUN           pci_ep_basic.LEGACY_IRQ_TEST ...
      # pci_endpoint_test.c:104:LEGACY_IRQ_TEST:Expected 0 (0) == ret (1)
      # pci_endpoint_test.c:104:LEGACY_IRQ_TEST:Can't get Legacy IRQ type
    
    Fix this issue by propagating the current type to the global "irq_type".
    
    Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype")
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <[email protected]>
    Reviewed-by: Niklas Cassel <[email protected]>
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

misc: pci_endpoint_test: Fix displaying 'irq_type' after 'request_irq' error [+ + +]
Author: Kunihiko Hayashi <[email protected]>
Date:   Tue Feb 25 20:02:49 2025 +0900

    misc: pci_endpoint_test: Fix displaying 'irq_type' after 'request_irq' error
    
    commit 919d14603dab6a9cf03ebbeb2cfa556df48737c8 upstream.
    
    There are two variables that indicate the interrupt type to be used
    in the next test execution, global "irq_type" and "test->irq_type".
    
    The former is referenced from pci_endpoint_test_get_irq() to preserve
    the current type for ioctl(PCITEST_GET_IRQTYPE).
    
    In the pci_endpoint_test_request_irq(), since this global variable
    is referenced when an error occurs, the unintended error message is
    displayed.
    
    For example, after running "pcitest -i 2", the following message
    shows "MSI 3" even if the current IRQ type becomes "MSI-X":
    
      pci-endpoint-test 0000:01:00.0: Failed to request IRQ 30 for MSI 3
      SET IRQ TYPE TO MSI-X:          NOT OKAY
    
    Fix this issue by using "test->irq_type" instead of global "irq_type".
    
    Cc: [email protected]
    Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype")
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <[email protected]>
    Signed-off-by: Kunihiko Hayashi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable() [+ + +]
Author: Baoquan He <[email protected]>
Date:   Thu Apr 10 11:57:14 2025 +0800

    mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable()
    
    commit 8c03ebd7cdc06bd0d2fecb4d1a609ef1dbb7d0aa upstream.
    
    Not like fault_in_readable() or fault_in_writeable(), in
    fault_in_safe_writeable() local variable 'start' is increased page by page
    to loop till the whole address range is handled.  However, it mistakenly
    calculates the size of the handled range with 'uaddr - start'.
    
    Fix it here.
    
    Andreas said:
    
    : In gfs2, fault_in_iov_iter_writeable() is used in
    : gfs2_file_direct_read() and gfs2_file_read_iter(), so this potentially
    : affects buffered as well as direct reads.  This bug could cause those
    : gfs2 functions to spin in a loop.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Baoquan He <[email protected]>
    Fixes: fe673d3f5bf1 ("mm: gup: make fault_in_safe_writeable() use fixup_user_fault()")
    Reviewed-by: Oscar Salvador <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Cc: Andreas Gruenbacher <[email protected]>
    Cc: Yanjun.Zhu <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/hugetlb: move hugetlb_sysctl_init() to the __init section [+ + +]
Author: Marc Herbert <[email protected]>
Date:   Wed Mar 19 06:00:30 2025 +0000

    mm/hugetlb: move hugetlb_sysctl_init() to the __init section
    
    commit 1ca77ff1837249701053a7fcbdedabc41f4ae67c upstream.
    
    hugetlb_sysctl_init() is only invoked once by an __init function and is
    merely a wrapper around another __init function so there is not reason to
    keep it.
    
    Fixes the following warning when toning down some GCC inline options:
    
     WARNING: modpost: vmlinux: section mismatch in reference:
       hugetlb_sysctl_init+0x1b (section: .text) ->
         __register_sysctl_init (section: .init.text)
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Marc Herbert <[email protected]>
    Reviewed-by: Anshuman Khandual <[email protected]>
    Reviewed-by: Muchun Song <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/hwpoison: do not send SIGBUS to processes with recovered clean pages [+ + +]
Author: Shuai Xue <[email protected]>
Date:   Wed Mar 12 19:28:51 2025 +0800

    mm/hwpoison: do not send SIGBUS to processes with recovered clean pages
    
    commit aaf99ac2ceb7c974f758a635723eeaf48596388e upstream.
    
    When an uncorrected memory error is consumed there is a race between the
    CMCI from the memory controller reporting an uncorrected error with a UCNA
    signature, and the core reporting and SRAR signature machine check when
    the data is about to be consumed.
    
    - Background: why *UN*corrected errors tied to *C*MCI in Intel platform [1]
    
    Prior to Icelake memory controllers reported patrol scrub events that
    detected a previously unseen uncorrected error in memory by signaling a
    broadcast machine check with an SRAO (Software Recoverable Action
    Optional) signature in the machine check bank.  This was overkill because
    it's not an urgent problem that no core is on the verge of consuming that
    bad data.  It's also found that multi SRAO UCE may cause nested MCE
    interrupts and finally become an IERR.
    
    Hence, Intel downgrades the machine check bank signature of patrol scrub
    from SRAO to UCNA (Uncorrected, No Action required), and signal changed to
    #CMCI.  Just to add to the confusion, Linux does take an action (in
    uc_decode_notifier()) to try to offline the page despite the UC*NA*
    signature name.
    
    - Background: why #CMCI and #MCE race when poison is consuming in Intel platform [1]
    
    Having decided that CMCI/UCNA is the best action for patrol scrub errors,
    the memory controller uses it for reads too.  But the memory controller is
    executing asynchronously from the core, and can't tell the difference
    between a "real" read and a speculative read.  So it will do CMCI/UCNA if
    an error is found in any read.
    
    Thus:
    
    1) Core is clever and thinks address A is needed soon, issues a speculative read.
    2) Core finds it is going to use address A soon after sending the read request
    3) The CMCI from the memory controller is in a race with MCE from the core
       that will soon try to retire the load from address A.
    
    Quite often (because speculation has got better) the CMCI from the memory
    controller is delivered before the core is committed to the instruction
    reading address A, so the interrupt is taken, and Linux offlines the page
    (marking it as poison).
    
    - Why user process is killed for instr case
    
    Commit 046545a661af ("mm/hwpoison: fix error page recovered but reported
    "not recovered"") tries to fix noise message "Memory error not recovered"
    and skips duplicate SIGBUSs due to the race.  But it also introduced a bug
    that kill_accessing_process() return -EHWPOISON for instr case, as result,
    kill_me_maybe() send a SIGBUS to user process.
    
    If the CMCI wins that race, the page is marked poisoned when
    uc_decode_notifier() calls memory_failure().  For dirty pages,
    memory_failure() invokes try_to_unmap() with the TTU_HWPOISON flag,
    converting the PTE to a hwpoison entry.  As a result,
    kill_accessing_process():
    
    - call walk_page_range() and return 1 regardless of whether
      try_to_unmap() succeeds or fails,
    - call kill_proc() to make sure a SIGBUS is sent
    - return -EHWPOISON to indicate that SIGBUS is already sent to the
      process and kill_me_maybe() doesn't have to send it again.
    
    However, for clean pages, the TTU_HWPOISON flag is cleared, leaving the
    PTE unchanged and not converted to a hwpoison entry.  Conversely, for
    clean pages where PTE entries are not marked as hwpoison,
    kill_accessing_process() returns -EFAULT, causing kill_me_maybe() to send
    a SIGBUS.
    
    Console log looks like this:
    
        Memory failure: 0x827ca68: corrupted page was clean: dropped without side effects
        Memory failure: 0x827ca68: recovery action for clean LRU page: Recovered
        Memory failure: 0x827ca68: already hardware poisoned
        mce: Memory error not recovered
    
    To fix it, return 0 for "corrupted page was clean", preventing an
    unnecessary SIGBUS to user process.
    
    [1] https://lore.kernel.org/lkml/[email protected]/T/#mba94f1305b3009dd340ce4114d3221fe810d1871
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 046545a661af ("mm/hwpoison: fix error page recovered but reported "not recovered"")
    Signed-off-by: Shuai Xue <[email protected]>
    Tested-by: Tony Luck <[email protected]>
    Acked-by: Miaohe Lin <[email protected]>
    Cc: Baolin Wang <[email protected]>
    Cc: Borislav Betkov <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jane Chu <[email protected]>
    Cc: Jarkko Sakkinen <[email protected]>
    Cc: Jonathan Cameron <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Naoya Horiguchi <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Ruidong Tian <[email protected]>
    Cc: Thomas Gleinxer <[email protected]>
    Cc: Yazen Ghannam <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/mremap: correctly handle partial mremap() of VMA starting at 0 [+ + +]
Author: Lorenzo Stoakes <[email protected]>
Date:   Mon Mar 10 20:50:34 2025 +0000

    mm/mremap: correctly handle partial mremap() of VMA starting at 0
    
    commit 937582ee8e8d227c30ec147629a0179131feaa80 upstream.
    
    Patch series "refactor mremap and fix bug", v3.
    
    The existing mremap() logic has grown organically over a very long period
    of time, resulting in code that is in many parts, very difficult to follow
    and full of subtleties and sources of confusion.
    
    In addition, it is difficult to thread state through the operation
    correctly, as function arguments have expanded, some parameters are
    expected to be temporarily altered during the operation, others are
    intended to remain static and some can be overridden.
    
    This series completely refactors the mremap implementation, sensibly
    separating functions, adding comments to explain the more subtle aspects
    of the implementation and making use of small structs to thread state
    through everything.
    
    The reason for doing so is to lay the groundwork for planned future
    changes to the mremap logic, changes which require the ability to easily
    pass around state.
    
    Additionally, it would be unhelpful to add yet more logic to code that is
    already difficult to follow without first refactoring it like this.
    
    The first patch in this series additionally fixes a bug when a VMA with
    start address zero is partially remapped.
    
    Tested on real hardware under heavy workload and all self tests are
    passing.
    
    
    This patch (of 3):
    
    Consider the case of a partial mremap() (that results in a VMA split) of
    an accountable VMA (i.e.  which has the VM_ACCOUNT flag set) whose start
    address is zero, with the MREMAP_MAYMOVE flag specified and a scenario
    where a move does in fact occur:
    
           addr  end
            |     |
            v     v
        |-------------|
        |     vma     |
        |-------------|
        0
    
    This move is affected by unmapping the range [addr, end).  In order to
    prevent an incorrect decrement of accounted memory which has already been
    determined, the mremap() code in move_vma() clears VM_ACCOUNT from the VMA
    prior to doing so, before reestablishing it in each of the VMAs
    post-split:
    
        addr  end
         |     |
         v     v
     |---|     |---|
     | A |     | B |
     |---|     |---|
    
    Commit 6b73cff239e5 ("mm: change munmap splitting order and move_vma()")
    changed this logic such as to determine whether there is a need to do so
    by establishing account_start and account_end and, in the instance where
    such an operation is required, assigning them to vma->vm_start and
    vma->vm_end.
    
    Later the code checks if the operation is required for 'A' referenced
    above thusly:
    
            if (account_start) {
                    ...
            }
    
    However, if the VMA described above has vma->vm_start == 0, which is now
    assigned to account_start, this branch will not be executed.
    
    As a result, the VMA 'A' above will remain stripped of its VM_ACCOUNT
    flag, incorrectly.
    
    The fix is to simply convert these variables to booleans and set them as
    required.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/dc55cb6db25d97c3d9e460de4986a323fa959676.1741639347.git.lorenzo.stoakes@oracle.com
    Fixes: 6b73cff239e5 ("mm: change munmap splitting order and move_vma()")
    Signed-off-by: Lorenzo Stoakes <[email protected]>
    Reviewed-by: Harry Yoo <[email protected]>
    Reviewed-by: Liam R. Howlett <[email protected]>
    Reviewed-by: Vlastimil Babka <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/rmap: reject hugetlb folios in folio_make_device_exclusive() [+ + +]
Author: David Hildenbrand <[email protected]>
Date:   Mon Feb 10 20:37:44 2025 +0100

    mm/rmap: reject hugetlb folios in folio_make_device_exclusive()
    
    commit bc3fe6805cf09a25a086573a17d40e525208c5d8 upstream.
    
    Even though FOLL_SPLIT_PMD on hugetlb now always fails with -EOPNOTSUPP,
    let's add a safety net in case FOLL_SPLIT_PMD usage would ever be
    reworked.
    
    In particular, before commit 9cb28da54643 ("mm/gup: handle hugetlb in the
    generic follow_page_mask code"), GUP(FOLL_SPLIT_PMD) would just have
    returned a page.  In particular, hugetlb folios that are not PMD-sized
    would never have been prone to FOLL_SPLIT_PMD.
    
    hugetlb folios can be anonymous, and page_make_device_exclusive_one() is
    not really prepared for handling them at all.  So let's spell that out.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: b756a3b5e7ea ("mm: device exclusive memory access")
    Signed-off-by: David Hildenbrand <[email protected]>
    Reviewed-by: Alistair Popple <[email protected]>
    Tested-by: Alistair Popple <[email protected]>
    Cc: Alex Shi <[email protected]>
    Cc: Danilo Krummrich <[email protected]>
    Cc: Dave Airlie <[email protected]>
    Cc: Jann Horn <[email protected]>
    Cc: Jason Gunthorpe <[email protected]>
    Cc: Jerome Glisse <[email protected]>
    Cc: John Hubbard <[email protected]>
    Cc: Jonathan Corbet <[email protected]>
    Cc: Karol Herbst <[email protected]>
    Cc: Liam Howlett <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Lyude <[email protected]>
    Cc: "Masami Hiramatsu (Google)" <[email protected]>
    Cc: Oleg Nesterov <[email protected]>
    Cc: Pasha Tatashin <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: Peter Zijlstra (Intel) <[email protected]>
    Cc: SeongJae Park <[email protected]>
    Cc: Simona Vetter <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: Yanteng Si <[email protected]>
    Cc: Barry Song <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/userfaultfd: fix release hang over concurrent GUP [+ + +]
Author: Peter Xu <[email protected]>
Date:   Wed Mar 12 10:51:31 2025 -0400

    mm/userfaultfd: fix release hang over concurrent GUP
    
    commit fe4cdc2c4e248f48de23bc778870fd71e772a274 upstream.
    
    This patch should fix a possible userfaultfd release() hang during
    concurrent GUP.
    
    This problem was initially reported by Dimitris Siakavaras in July 2023
    [1] in a firecracker use case.  Firecracker has a separate process
    handling page faults remotely, and when the process releases the
    userfaultfd it can race with a concurrent GUP from KVM trying to fault in
    a guest page during the secondary MMU page fault process.
    
    A similar problem was reported recently again by Jinjiang Tu in March 2025
    [2], even though the race happened this time with a mlockall() operation,
    which does GUP in a similar fashion.
    
    In 2017, commit 656710a60e36 ("userfaultfd: non-cooperative: closing the
    uffd without triggering SIGBUS") was trying to fix this issue.  AFAIU,
    that fixes well the fault paths but may not work yet for GUP.  In GUP, the
    issue is NOPAGE will be almost treated the same as "page fault resolved"
    in faultin_page(), then the GUP will follow page again, seeing page
    missing, and it'll keep going into a live lock situation as reported.
    
    This change makes core mm return RETRY instead of NOPAGE for both the GUP
    and fault paths, proactively releasing the mmap read lock.  This should
    guarantee the other release thread make progress on taking the write lock
    and avoid the live lock even for GUP.
    
    When at it, rearrange the comments to make sure it's uptodate.
    
    [1] https://lore.kernel.org/r/[email protected]
    [2] https://lore.kernel.org/r/[email protected]
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Peter Xu <[email protected]>
    Cc: Andrea Arcangeli <[email protected]>
    Cc: Mike Rapoport (IBM) <[email protected]>
    Cc: Axel Rasmussen <[email protected]>
    Cc: Jinjiang Tu <[email protected]>
    Cc: Dimitris Siakavaras <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock [+ + +]
Author: Mathieu Desnoyers <[email protected]>
Date:   Wed Mar 12 10:10:13 2025 -0400

    mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock
    
    commit c0ebbb3841e07c4493e6fe351698806b09a87a37 upstream.
    
    The PGDAT_RECLAIM_LOCKED bit is used to provide mutual exclusion of node
    reclaim for struct pglist_data using a single bit.
    
    It is "locked" with a test_and_set_bit (similarly to a try lock) which
    provides full ordering with respect to loads and stores done within
    __node_reclaim().
    
    It is "unlocked" with clear_bit(), which does not provide any ordering
    with respect to loads and stores done before clearing the bit.
    
    The lack of clear_bit() memory ordering with respect to stores within
    __node_reclaim() can cause a subsequent CPU to fail to observe stores from
    a prior node reclaim.  This is not an issue in practice on TSO (e.g.
    x86), but it is an issue on weakly-ordered architectures (e.g.  arm64).
    
    Fix this by using clear_bit_unlock rather than clear_bit to clear
    PGDAT_RECLAIM_LOCKED with a release memory ordering semantic.
    
    This provides stronger memory ordering (release rather than relaxed).
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: d773ed6b856a ("mm: test and set zone reclaim lock before starting reclaim")
    Signed-off-by: Mathieu Desnoyers <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Matthew Wilcox <[email protected]>
    Cc: Alan Stern <[email protected]>
    Cc: Andrea Parri <[email protected]>
    Cc: Will Deacon <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Boqun Feng <[email protected]>
    Cc: Nicholas Piggin <[email protected]>
    Cc: David Howells <[email protected]>
    Cc: Jade Alglave <[email protected]>
    Cc: Luc Maranget <[email protected]>
    Cc: "Paul E. McKenney" <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: fix apply_to_existing_page_range() [+ + +]
Author: Kirill A. Shutemov <[email protected]>
Date:   Wed Apr 9 12:40:43 2025 +0300

    mm: fix apply_to_existing_page_range()
    
    commit a995199384347261bb3f21b2e171fa7f988bd2f8 upstream.
    
    In the case of apply_to_existing_page_range(), apply_to_pte_range() is
    reached with 'create' set to false.  When !create, the loop over the PTE
    page table is broken.
    
    apply_to_pte_range() will only move to the next PTE entry if 'create' is
    true or if the current entry is not pte_none().
    
    This means that the user of apply_to_existing_page_range() will not have
    'fn' called for any entries after the first pte_none() in the PTE page
    table.
    
    Fix the loop logic in apply_to_pte_range().
    
    There are no known runtime issues from this, but the fix is trivial enough
    for stable@ even without a known buggy user.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Kirill A. Shutemov <[email protected]>
    Fixes: be1db4753ee6 ("mm/memory.c: add apply_to_existing_page_range() helper")
    Cc: Daniel Axtens <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: fix filemap_get_folios_contig returning batches of identical folios [+ + +]
Author: Vishal Moola (Oracle) <[email protected]>
Date:   Thu Apr 3 16:54:17 2025 -0700

    mm: fix filemap_get_folios_contig returning batches of identical folios
    
    commit 8ab1b16023961dc640023b10436d282f905835ad upstream.
    
    filemap_get_folios_contig() is supposed to return distinct folios found
    within [start, end].  Large folios in the Xarray become multi-index
    entries.  xas_next() can iterate through the sub-indexes before finding a
    sibling entry and breaking out of the loop.
    
    This can result in a returned folio_batch containing an indeterminate
    number of duplicate folios, which forces the callers to skeptically handle
    the returned batch.  This is inefficient and incurs a large maintenance
    overhead.
    
    We can fix this by calling xas_advance() after we have successfully adding
    a folio to the batch to ensure our Xarray is positioned such that it will
    correctly find the next folio - similar to filemap_get_read_batch().
    
    Link: https://lkml.kernel.org/r/Z-8s1-kiIDkzgRbc@fedora
    Fixes: 35b471467f88 ("filemap: add filemap_get_folios_contig()")
    Signed-off-by: Vishal Moola (Oracle) <[email protected]>
    Reported-by: Qu Wenruo <[email protected]>
    Closes: https://lkml.kernel.org/r/[email protected]
    Tested-by: Qu Wenruo <[email protected]>
    Cc: Matthew Wilcox (Oracle) <[email protected]>
    Cc: Vivek Kasireddy <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: fix lazy mmu docs and usage [+ + +]
Author: Ryan Roberts <[email protected]>
Date:   Mon Mar 3 14:15:35 2025 +0000

    mm: fix lazy mmu docs and usage
    
    commit 691ee97e1a9de0cdb3efb893c1f180e3f4a35e32 upstream.
    
    Patch series "Fix lazy mmu mode", v2.
    
    I'm planning to implement lazy mmu mode for arm64 to optimize vmalloc.  As
    part of that, I will extend lazy mmu mode to cover kernel mappings in
    vmalloc table walkers.  While lazy mmu mode is already used for kernel
    mappings in a few places, this will extend it's use significantly.
    
    Having reviewed the existing lazy mmu implementations in powerpc, sparc
    and x86, it looks like there are a bunch of bugs, some of which may be
    more likely to trigger once I extend the use of lazy mmu.  So this series
    attempts to clarify the requirements and fix all the bugs in advance of
    that series.  See patch #1 commit log for all the details.
    
    
    This patch (of 5):
    
    The docs, implementations and use of arch_[enter|leave]_lazy_mmu_mode() is
    a bit of a mess (to put it politely).  There are a number of issues
    related to nesting of lazy mmu regions and confusion over whether the
    task, when in a lazy mmu region, is preemptible or not.  Fix all the
    issues relating to the core-mm.  Follow up commits will fix the
    arch-specific implementations.  3 arches implement lazy mmu; powerpc,
    sparc and x86.
    
    When arch_[enter|leave]_lazy_mmu_mode() was first introduced by commit
    6606c3e0da53 ("[PATCH] paravirt: lazy mmu mode hooks.patch"), it was
    expected that lazy mmu regions would never nest and that the appropriate
    page table lock(s) would be held while in the region, thus ensuring the
    region is non-preemptible.  Additionally lazy mmu regions were only used
    during manipulation of user mappings.
    
    Commit 38e0edb15bd0 ("mm/apply_to_range: call pte function with lazy
    updates") started invoking the lazy mmu mode in apply_to_pte_range(),
    which is used for both user and kernel mappings.  For kernel mappings the
    region is no longer protected by any lock so there is no longer any
    guarantee about non-preemptibility.  Additionally, for RT configs, the
    holding the PTL only implies no CPU migration, it doesn't prevent
    preemption.
    
    Commit bcc6cc832573 ("mm: add default definition of set_ptes()") added
    arch_[enter|leave]_lazy_mmu_mode() to the default implementation of
    set_ptes(), used by x86.  So after this commit, lazy mmu regions can be
    nested.  Additionally commit 1a10a44dfc1d ("sparc64: implement the new
    page table range API") and commit 9fee28baa601 ("powerpc: implement the
    new page table range API") did the same for the sparc and powerpc
    set_ptes() overrides.
    
    powerpc couldn't deal with preemption so avoids it in commit b9ef323ea168
    ("powerpc/64s: Disable preemption in hash lazy mmu mode"), which
    explicitly disables preemption for the whole region in its implementation.
    x86 can support preemption (or at least it could until it tried to add
    support nesting; more on this below).  Sparc looks to be totally broken in
    the face of preemption, as far as I can tell.
    
    powerpc can't deal with nesting, so avoids it in commit 47b8def9358c
    ("powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes"),
    which removes the lazy mmu calls from its implementation of set_ptes().
    x86 attempted to support nesting in commit 49147beb0ccb ("x86/xen: allow
    nesting of same lazy mode") but as far as I can tell, this breaks its
    support for preemption.
    
    In short, it's all a mess; the semantics for
    arch_[enter|leave]_lazy_mmu_mode() are not clearly defined and as a result
    the implementations all have different expectations, sticking plasters and
    bugs.
    
    arm64 is aiming to start using these hooks, so let's clean everything up
    before adding an arm64 implementation.  Update the documentation to state
    that lazy mmu regions can never be nested, must not be called in interrupt
    context and preemption may or may not be enabled for the duration of the
    region.  And fix the generic implementation of set_ptes() to avoid
    nesting.
    
    arch-specific fixes to conform to the new spec will proceed this one.
    
    These issues were spotted by code review and I have no evidence of issues
    being reported in the wild.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: bcc6cc832573 ("mm: add default definition of set_ptes()")
    Signed-off-by: Ryan Roberts <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Acked-by: Juergen Gross <[email protected]>
    Cc: Andreas Larsson <[email protected]>
    Cc: Borislav Betkov <[email protected]>
    Cc: Boris Ostrovsky <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: David S. Miller <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Juegren Gross <[email protected]>
    Cc: Matthew Wilcow (Oracle) <[email protected]>
    Cc: Thomas Gleinxer <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: make page_mapped_in_vma() hugetlb walk aware [+ + +]
Author: Jane Chu <[email protected]>
Date:   Mon Feb 24 14:14:45 2025 -0700

    mm: make page_mapped_in_vma() hugetlb walk aware
    
    commit 442b1eca223b4860cc85ef970ae602d125aec5a4 upstream.
    
    When a process consumes a UE in a page, the memory failure handler
    attempts to collect information for a potential SIGBUS.  If the page is an
    anonymous page, page_mapped_in_vma(page, vma) is invoked in order to
    
      1. retrieve the vaddr from the process' address space,
    
      2. verify that the vaddr is indeed mapped to the poisoned page,
         where 'page' is the precise small page with UE.
    
    It's been observed that when injecting poison to a non-head subpage of an
    anonymous hugetlb page, no SIGBUS shows up, while injecting to the head
    page produces a SIGBUS.  The cause is that, though hugetlb_walk() returns
    a valid pmd entry (on x86), but check_pte() detects mismatch between the
    head page per the pmd and the input subpage.  Thus the vaddr is considered
    not mapped to the subpage and the process is not collected for SIGBUS
    purpose.  This is the calling stack:
    
          collect_procs_anon
            page_mapped_in_vma
              page_vma_mapped_walk
                hugetlb_walk
                  huge_pte_lock
                    check_pte
    
    check_pte() header says that it
    "check if [pvmw->pfn, @pvmw->pfn + @pvmw->nr_pages) is mapped at the @pvmw->pte"
    but practically works only if pvmw->pfn is the head page pfn at pvmw->pte.
    Hindsight acknowledging that some pvmw->pte could point to a hugepage of
    some sort such that it makes sense to make check_pte() work for hugepage.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Jane Chu <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Cc: Kirill A. Shuemov <[email protected]>
    Cc: linmiaohe <[email protected]>
    Cc: Matthew Wilcow (Oracle) <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mmc: dw_mmc: add a quirk for accessing 64-bit FIFOs in two halves [+ + +]
Author: Kaustabh Chakraborty <[email protected]>
Date:   Wed Feb 19 00:17:48 2025 +0530

    mmc: dw_mmc: add a quirk for accessing 64-bit FIFOs in two halves
    
    [ Upstream commit 57c0902f8bec51add5a1eb908d8b876592725d81 ]
    
    In certain DW MMC implementations (such as in some Exynos7870
    controllers), 64-bit read/write is not allowed from a 64-bit FIFO.
    Add a quirk which facilitates accessing the 64-bit FIFO registers in two
    32-bit halves.
    
    Signed-off-by: Kaustabh Chakraborty <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mptcp: fix NULL pointer in can_accept_new_subflow [+ + +]
Author: Gang Yan <[email protected]>
Date:   Fri Mar 28 15:27:16 2025 +0100

    mptcp: fix NULL pointer in can_accept_new_subflow
    
    commit 443041deb5ef6a1289a99ed95015ec7442f141dc upstream.
    
    When testing valkey benchmark tool with MPTCP, the kernel panics in
    'mptcp_can_accept_new_subflow' because subflow_req->msk is NULL.
    
    Call trace:
    
      mptcp_can_accept_new_subflow (./net/mptcp/subflow.c:63 (discriminator 4)) (P)
      subflow_syn_recv_sock (./net/mptcp/subflow.c:854)
      tcp_check_req (./net/ipv4/tcp_minisocks.c:863)
      tcp_v4_rcv (./net/ipv4/tcp_ipv4.c:2268)
      ip_protocol_deliver_rcu (./net/ipv4/ip_input.c:207)
      ip_local_deliver_finish (./net/ipv4/ip_input.c:234)
      ip_local_deliver (./net/ipv4/ip_input.c:254)
      ip_rcv_finish (./net/ipv4/ip_input.c:449)
      ...
    
    According to the debug log, the same req received two SYN-ACK in a very
    short time, very likely because the client retransmits the syn ack due
    to multiple reasons.
    
    Even if the packets are transmitted with a relevant time interval, they
    can be processed by the server on different CPUs concurrently). The
    'subflow_req->msk' ownership is transferred to the subflow the first,
    and there will be a risk of a null pointer dereference here.
    
    This patch fixes this issue by moving the 'subflow_req->msk' under the
    `own_req == true` conditional.
    
    Note that the !msk check in subflow_hmac_valid() can be dropped, because
    the same check already exists under the own_req mpj branch where the
    code has been moved to.
    
    Fixes: 9466a1ccebbe ("mptcp: enable JOIN requests even if cookies are in use")
    Cc: [email protected]
    Suggested-by: Paolo Abeni <[email protected]>
    Signed-off-by: Gang Yan <[email protected]>
    Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mptcp: only inc MPJoinAckHMacFailure for HMAC failures [+ + +]
Author: Matthieu Baerts (NGI0) <[email protected]>
Date:   Mon Apr 7 20:26:32 2025 +0200

    mptcp: only inc MPJoinAckHMacFailure for HMAC failures
    
    commit 21c02e8272bc95ba0dd44943665c669029b42760 upstream.
    
    Recently, during a debugging session using local MPTCP connections, I
    noticed MPJoinAckHMacFailure was not zero on the server side. The
    counter was in fact incremented when the PM rejected new subflows,
    because the 'subflow' limit was reached.
    
    The fix is easy, simply dissociating the two cases: only the HMAC
    validation check should increase MPTCP_MIB_JOINACKMAC counter.
    
    Fixes: 4cf8b7e48a09 ("subflow: introduce and use mptcp_can_accept_new_subflow()")
    Cc: [email protected]
    Reviewed-by: Geliang Tang <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mptcp: sockopt: fix getting freebind & transparent [+ + +]
Author: Matthieu Baerts (NGI0) <[email protected]>
Date:   Fri Mar 14 21:11:33 2025 +0100

    mptcp: sockopt: fix getting freebind & transparent
    
    commit e2f4ac7bab2205d3c4dd9464e6ffd82502177c51 upstream.
    
    When adding a socket option support in MPTCP, both the get and set parts
    are supposed to be implemented.
    
    IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part
    has been added a while ago, but it looks like the get part got
    forgotten. It should have been present as a way to verify a setting has
    been set as expected, and not to act differently from TCP or any other
    socket types.
    
    Everything was in place to expose it, just the last step was missing.
    Only new code is added to cover these specific getsockopt(), that seems
    safe.
    
    Fixes: c9406a23c116 ("mptcp: sockopt: add SOL_IP freebind & transparent options")
    Cc: [email protected]
    Reviewed-by: Mat Martineau <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-3-122dbb249db3@kernel.org
    Signed-off-by: Paolo Abeni <[email protected]>
    [ Conflict in sockopt.c due to commit e08d0b3d1723 ("inet: implement
      lockless IP_TOS") not being in this version. The conflict is in the
      context and the modification can still be applied in
      mptcp_getsockopt_v4() after the IP_TOS case. ]
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mptcp: sockopt: fix getting IPV6_V6ONLY [+ + +]
Author: Matthieu Baerts (NGI0) <[email protected]>
Date:   Fri Mar 14 21:11:32 2025 +0100

    mptcp: sockopt: fix getting IPV6_V6ONLY
    
    commit 8c39633759885b6ff85f6d96cf445560e74df5e8 upstream.
    
    When adding a socket option support in MPTCP, both the get and set parts
    are supposed to be implemented.
    
    IPV6_V6ONLY support for the setsockopt part has been added a while ago,
    but it looks like the get part got forgotten. It should have been
    present as a way to verify a setting has been set as expected, and not
    to act differently from TCP or any other socket types.
    
    Not supporting this getsockopt(IPV6_V6ONLY) blocks some apps which want
    to check the default value, before doing extra actions. On Linux, the
    default value is 0, but this can be changed with the net.ipv6.bindv6only
    sysctl knob. On Windows, it is set to 1 by default. So supporting the
    get part, like for all other socket options, is important.
    
    Everything was in place to expose it, just the last step was missing.
    Only new code is added to cover this specific getsockopt(), that seems
    safe.
    
    Fixes: c9b95a135987 ("mptcp: support IPV6_V6ONLY setsockopt")
    Cc: [email protected]
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/550
    Reviewed-by: Mat Martineau <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-2-122dbb249db3@kernel.org
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mtd: Add check for devm_kcalloc() [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Wed Feb 5 02:31:41 2025 +0000

    mtd: Add check for devm_kcalloc()
    
    commit 2aee30bb10d7bad0a60255059c9ce1b84cf0130e upstream.
    
    Add a check for devm_kcalloc() to ensure successful allocation.
    
    Fixes: 78c08247b9d3 ("mtd: Support kmsg dumper based on pstore/blk")
    Cc: [email protected] # v5.10+
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: inftlcore: Add error check for inftl_read_oob() [+ + +]
Author: Wentao Liang <[email protected]>
Date:   Wed Apr 2 11:16:43 2025 +0800

    mtd: inftlcore: Add error check for inftl_read_oob()
    
    commit d027951dc85cb2e15924c980dc22a6754d100c7c upstream.
    
    In INFTL_findwriteunit(), the return value of inftl_read_oob()
    need to be checked. A proper implementation can be
    found in INFTL_deleteblock(). The status will be set as
    SECTOR_IGNORE to break from the while-loop correctly
    if the inftl_read_oob() fails.
    
    Fixes: 8593fbc68b0d ("[MTD] Rework the out of band handling completely")
    Cc: [email protected] # v2.6+
    Signed-off-by: Wentao Liang <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: rawnand: Add status chack in r852_ready() [+ + +]
Author: Wentao Liang <[email protected]>
Date:   Wed Apr 2 15:56:23 2025 +0800

    mtd: rawnand: Add status chack in r852_ready()
    
    commit b79fe1829975556854665258cf4d2476784a89db upstream.
    
    In r852_ready(), the dev get from r852_get_dev() need to be checked.
    An unstable device should not be ready. A proper implementation can
    be found in r852_read_byte(). Add a status check and return 0 when it is
    unstable.
    
    Fixes: 50a487e7719c ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()")
    Cc: [email protected] # v4.20+
    Signed-off-by: Wentao Liang <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: rawnand: brcmnand: fix PM resume warning [+ + +]
Author: Kamal Dasu <[email protected]>
Date:   Thu Feb 27 12:46:08 2025 -0500

    mtd: rawnand: brcmnand: fix PM resume warning
    
    commit ddc210cf8b8a8be68051ad958bf3e2cef6b681c2 upstream.
    
    Fixed warning on PM resume as shown below caused due to uninitialized
    struct nand_operation that checks chip select field :
    WARN_ON(op->cs >= nanddev_ntargets(&chip->base)
    
    [   14.588522] ------------[ cut here ]------------
    [   14.588529] WARNING: CPU: 0 PID: 1392 at drivers/mtd/nand/raw/internals.h:139 nand_reset_op+0x1e0/0x1f8
    [   14.588553] Modules linked in: bdc udc_core
    [   14.588579] CPU: 0 UID: 0 PID: 1392 Comm: rtcwake Tainted: G        W          6.14.0-rc4-g5394eea10651 #16
    [   14.588590] Tainted: [W]=WARN
    [   14.588593] Hardware name: Broadcom STB (Flattened Device Tree)
    [   14.588598] Call trace:
    [   14.588604]  dump_backtrace from show_stack+0x18/0x1c
    [   14.588622]  r7:00000009 r6:0000008b r5:60000153 r4:c0fa558c
    [   14.588625]  show_stack from dump_stack_lvl+0x70/0x7c
    [   14.588639]  dump_stack_lvl from dump_stack+0x18/0x1c
    [   14.588653]  r5:c08d40b0 r4:c1003cb0
    [   14.588656]  dump_stack from __warn+0x84/0xe4
    [   14.588668]  __warn from warn_slowpath_fmt+0x18c/0x194
    [   14.588678]  r7:c08d40b0 r6:c1003cb0 r5:00000000 r4:00000000
    [   14.588681]  warn_slowpath_fmt from nand_reset_op+0x1e0/0x1f8
    [   14.588695]  r8:70c40dff r7:89705f41 r6:36b4a597 r5:c26c9444 r4:c26b0048
    [   14.588697]  nand_reset_op from brcmnand_resume+0x13c/0x150
    [   14.588714]  r9:00000000 r8:00000000 r7:c24f8010 r6:c228a3f8 r5:c26c94bc r4:c26b0040
    [   14.588717]  brcmnand_resume from platform_pm_resume+0x34/0x54
    [   14.588735]  r5:00000010 r4:c0840a50
    [   14.588738]  platform_pm_resume from dpm_run_callback+0x5c/0x14c
    [   14.588757]  dpm_run_callback from device_resume+0xc0/0x324
    [   14.588776]  r9:c24f8054 r8:c24f80a0 r7:00000000 r6:00000000 r5:00000010 r4:c24f8010
    [   14.588779]  device_resume from dpm_resume+0x130/0x160
    [   14.588799]  r9:c22539e4 r8:00000010 r7:c22bebb0 r6:c24f8010 r5:c22539dc r4:c22539b0
    [   14.588802]  dpm_resume from dpm_resume_end+0x14/0x20
    [   14.588822]  r10:c2204e40 r9:00000000 r8:c228a3fc r7:00000000 r6:00000003 r5:c228a414
    [   14.588826]  r4:00000010
    [   14.588828]  dpm_resume_end from suspend_devices_and_enter+0x274/0x6f8
    [   14.588848]  r5:c228a414 r4:00000000
    [   14.588851]  suspend_devices_and_enter from pm_suspend+0x228/0x2bc
    [   14.588868]  r10:c3502910 r9:c3501f40 r8:00000004 r7:c228a438 r6:c0f95e18 r5:00000000
    [   14.588871]  r4:00000003
    [   14.588874]  pm_suspend from state_store+0x74/0xd0
    [   14.588889]  r7:c228a438 r6:c0f934c8 r5:00000003 r4:00000003
    [   14.588892]  state_store from kobj_attr_store+0x1c/0x28
    [   14.588913]  r9:00000000 r8:00000000 r7:f09f9f08 r6:00000004 r5:c3502900 r4:c0283250
    [   14.588916]  kobj_attr_store from sysfs_kf_write+0x40/0x4c
    [   14.588936]  r5:c3502900 r4:c0d92a48
    [   14.588939]  sysfs_kf_write from kernfs_fop_write_iter+0x104/0x1f0
    [   14.588956]  r5:c3502900 r4:c3501f40
    [   14.588960]  kernfs_fop_write_iter from vfs_write+0x250/0x420
    [   14.588980]  r10:c0e14b48 r9:00000000 r8:c25f5780 r7:00443398 r6:f09f9f68 r5:c34f7f00
    [   14.588983]  r4:c042a88c
    [   14.588987]  vfs_write from ksys_write+0x74/0xe4
    [   14.589005]  r10:00000004 r9:c25f5780 r8:c02002fA0 r7:00000000 r6:00000000 r5:c34f7f00
    [   14.589008]  r4:c34f7f00
    [   14.589011]  ksys_write from sys_write+0x10/0x14
    [   14.589029]  r7:00000004 r6:004421c0 r5:00443398 r4:00000004
    [   14.589032]  sys_write from ret_fast_syscall+0x0/0x5c
    [   14.589044] Exception stack(0xf09f9fa8 to 0xf09f9ff0)
    [   14.589050] 9fa0:                   00000004 00443398 00000004 00443398 00000004 00000001
    [   14.589056] 9fc0: 00000004 00443398 004421c0 00000004 b6ecbd58 00000008 bebfbc38 0043eb78
    [   14.589062] 9fe0: 00440eb0 bebfbaf8 b6de18a0 b6e579e8
    [   14.589065] ---[ end trace 0000000000000000 ]---
    
    The fix uses the higher level nand_reset(chip, chipnr); where chipnr = 0, when
    doing PM resume operation in compliance with the controller support for single
    die nand chip. Switching from nand_reset_op() to nand_reset() implies more
    than just setting the cs field op->cs, it also reconfigures the data interface
    (ie. the timings). Tested and confirmed the NAND chip is in sync timing wise
    with host after the fix.
    
    Fixes: 97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    Cc: [email protected]
    Signed-off-by: Kamal Dasu <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mtd: Replace kcalloc() with devm_kcalloc() [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Wed Feb 5 02:31:40 2025 +0000

    mtd: Replace kcalloc() with devm_kcalloc()
    
    commit 1b61a59876f0eafc19b23007c522ee407f55dbec upstream.
    
    Replace kcalloc() with devm_kcalloc() to prevent memory leaks in case of
    errors.
    
    Fixes: 78c08247b9d3 ("mtd: Support kmsg dumper based on pstore/blk")
    Cc: [email protected] # v5.10+
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net/sched: cls_api: conditional notification of events [+ + +]
Author: Pedro Tammela <[email protected]>
Date:   Fri Dec 8 16:28:47 2023 -0300

    net/sched: cls_api: conditional notification of events
    
    [ Upstream commit 93775590b1ee98bf2976b1f4a1ed24e9ff76170f ]
    
    As of today tc-filter/chain events are unconditionally built and sent to
    RTNLGRP_TC. As with the introduction of rtnl_notify_needed we can check
    before-hand if they are really needed. This will help to alleviate
    system pressure when filters are concurrently added without the rtnl
    lock as in tc-flower.
    
    Reviewed-by: Jiri Pirko <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Pedro Tammela <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
    Signed-off-by: Sasha Levin <[email protected]>

 
net: b53: enable BPDU reception for management port [+ + +]
Author: Jonas Gorski <[email protected]>
Date:   Mon Apr 14 22:04:34 2025 +0200

    net: b53: enable BPDU reception for management port
    
    [ Upstream commit 36355ddfe8955f226a88a543ed354b9f6b84cd70 ]
    
    For STP to work, receiving BPDUs is essential, but the appropriate bit
    was never set. Without GC_RX_BPDU_EN, the switch chip will filter all
    BPDUs, even if an appropriate PVID VLAN was setup.
    
    Fixes: ff39c2d68679 ("net: dsa: b53: Add bridge support")
    Signed-off-by: Jonas Gorski <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: bridge: switchdev: do not notify new brentries as changed [+ + +]
Author: Jonas Gorski <[email protected]>
Date:   Mon Apr 14 22:00:20 2025 +0200

    net: bridge: switchdev: do not notify new brentries as changed
    
    [ Upstream commit eb25de13bd9cf025413a04f25e715d0e99847e30 ]
    
    When adding a bridge vlan that is pvid or untagged after the vlan has
    already been added to any other switchdev backed port, the vlan change
    will be propagated as changed, since the flags change.
    
    This causes the vlan to not be added to the hardware for DSA switches,
    since the DSA handler ignores any vlans for the CPU or DSA ports that
    are changed.
    
    E.g. the following order of operations would work:
    
    $ ip link add swbridge type bridge vlan_filtering 1 vlan_default_pvid 0
    $ ip link set lan1 master swbridge
    $ bridge vlan add dev swbridge vid 1 pvid untagged self
    $ bridge vlan add dev lan1 vid 1 pvid untagged
    
    but this order would break:
    
    $ ip link add swbridge type bridge vlan_filtering 1 vlan_default_pvid 0
    $ ip link set lan1 master swbridge
    $ bridge vlan add dev lan1 vid 1 pvid untagged
    $ bridge vlan add dev swbridge vid 1 pvid untagged self
    
    Additionally, the vlan on the bridge itself would become undeletable:
    
    $ bridge vlan
    port              vlan-id
    lan1              1 PVID Egress Untagged
    swbridge          1 PVID Egress Untagged
    $ bridge vlan del dev swbridge vid 1 self
    $ bridge vlan
    port              vlan-id
    lan1              1 PVID Egress Untagged
    swbridge          1 Egress Untagged
    
    since the vlan was never added to DSA's vlan list, so deleting it will
    cause an error, causing the bridge code to not remove it.
    
    Fix this by checking if flags changed only for vlans that are already
    brentry and pass changed as false for those that become brentries, as
    these are a new vlan (member) from the switchdev point of view.
    
    Since *changed is set to true for becomes_brentry = true regardless of
    would_change's value, this will not change any rtnetlink notification
    delivery, just the value passed on to switchdev in vlan->changed.
    
    Fixes: 8d23a54f5bee ("net: bridge: switchdev: differentiate new VLANs from changed ones")
    Reviewed-by: Vladimir Oltean <[email protected]>
    Signed-off-by: Jonas Gorski <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Acked-by: Nikolay Aleksandrov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: avoid refcount warnings when ds->ops->tag_8021q_vlan_del() fails [+ + +]
Author: Vladimir Oltean <[email protected]>
Date:   Tue Apr 15 00:30:20 2025 +0300

    net: dsa: avoid refcount warnings when ds->ops->tag_8021q_vlan_del() fails
    
    [ Upstream commit 514eff7b0aa1c5eb645ddbb8676ef3e2d88a8b99 ]
    
    This is very similar to the problem and solution from commit
    232deb3f9567 ("net: dsa: avoid refcount warnings when
    ->port_{fdb,mdb}_del returns error"), except for the
    dsa_port_do_tag_8021q_vlan_del() operation.
    
    Fixes: c64b9c05045a ("net: dsa: tag_8021q: add proper cross-chip notifier support")
    Signed-off-by: Vladimir Oltean <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: clean up FDB, MDB, VLAN entries on unbind [+ + +]
Author: Vladimir Oltean <[email protected]>
Date:   Tue Apr 15 00:29:30 2025 +0300

    net: dsa: clean up FDB, MDB, VLAN entries on unbind
    
    [ Upstream commit 7afb5fb42d4950f33af2732b8147c552659f79b7 ]
    
    As explained in many places such as commit b117e1e8a86d ("net: dsa:
    delete dsa_legacy_fdb_add and dsa_legacy_fdb_del"), DSA is written given
    the assumption that higher layers have balanced additions/deletions.
    As such, it only makes sense to be extremely vocal when those
    assumptions are violated and the driver unbinds with entries still
    present.
    
    But Ido Schimmel points out a very simple situation where that is wrong:
    https://lore.kernel.org/netdev/ZDazSM5UsPPjQuKr@shredder/
    (also briefly discussed by me in the aforementioned commit).
    
    Basically, while the bridge bypass operations are not something that DSA
    explicitly documents, and for the majority of DSA drivers this API
    simply causes them to go to promiscuous mode, that isn't the case for
    all drivers. Some have the necessary requirements for bridge bypass
    operations to do something useful - see dsa_switch_supports_uc_filtering().
    
    Although in tools/testing/selftests/net/forwarding/local_termination.sh,
    we made an effort to popularize better mechanisms to manage address
    filters on DSA interfaces from user space - namely macvlan for unicast,
    and setsockopt(IP_ADD_MEMBERSHIP) - through mtools - for multicast, the
    fact is that 'bridge fdb add ... self static local' also exists as
    kernel UAPI, and might be useful to someone, even if only for a quick
    hack.
    
    It seems counter-productive to block that path by implementing shim
    .ndo_fdb_add and .ndo_fdb_del operations which just return -EOPNOTSUPP
    in order to prevent the ndo_dflt_fdb_add() and ndo_dflt_fdb_del() from
    running, although we could do that.
    
    Accepting that cleanup is necessary seems to be the only option.
    Especially since we appear to be coming back at this from a different
    angle as well. Russell King is noticing that the WARN_ON() triggers even
    for VLANs:
    https://lore.kernel.org/netdev/[email protected]/
    
    What happens in the bug report above is that dsa_port_do_vlan_del() fails,
    then the VLAN entry lingers on, and then we warn on unbind and leak it.
    
    This is not a straight revert of the blamed commit, but we now add an
    informational print to the kernel log (to still have a way to see
    that bugs exist), and some extra comments gathered from past years'
    experience, to justify the logic.
    
    Fixes: 0832cd9f1f02 ("net: dsa: warn if port lists aren't empty in dsa_port_teardown")
    Signed-off-by: Vladimir Oltean <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: free routing table on probe failure [+ + +]
Author: Vladimir Oltean <[email protected]>
Date:   Tue Apr 15 00:30:01 2025 +0300

    net: dsa: free routing table on probe failure
    
    [ Upstream commit 8bf108d7161ffc6880ad13a0cc109de3cf631727 ]
    
    If complete = true in dsa_tree_setup(), it means that we are the last
    switch of the tree which is successfully probing, and we should be
    setting up all switches from our probe path.
    
    After "complete" becomes true, dsa_tree_setup_cpu_ports() or any
    subsequent function may fail. If that happens, the entire tree setup is
    in limbo: the first N-1 switches have successfully finished probing
    (doing nothing but having allocated persistent memory in the tree's
    dst->ports, and maybe dst->rtable), and switch N failed to probe, ending
    the tree setup process before anything is tangible from the user's PoV.
    
    If switch N fails to probe, its memory (ports) will be freed and removed
    from dst->ports. However, the dst->rtable elements pointing to its ports,
    as created by dsa_link_touch(), will remain there, and will lead to
    use-after-free if dereferenced.
    
    If dsa_tree_setup_switches() returns -EPROBE_DEFER, which is entirely
    possible because that is where ds->ops->setup() is, we get a kasan
    report like this:
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in mv88e6xxx_setup_upstream_port+0x240/0x568
    Read of size 8 at addr ffff000004f56020 by task kworker/u8:3/42
    
    Call trace:
     __asan_report_load8_noabort+0x20/0x30
     mv88e6xxx_setup_upstream_port+0x240/0x568
     mv88e6xxx_setup+0xebc/0x1eb0
     dsa_register_switch+0x1af4/0x2ae0
     mv88e6xxx_register_switch+0x1b8/0x2a8
     mv88e6xxx_probe+0xc4c/0xf60
     mdio_probe+0x78/0xb8
     really_probe+0x2b8/0x5a8
     __driver_probe_device+0x164/0x298
     driver_probe_device+0x78/0x258
     __device_attach_driver+0x274/0x350
    
    Allocated by task 42:
     __kasan_kmalloc+0x84/0xa0
     __kmalloc_cache_noprof+0x298/0x490
     dsa_switch_touch_ports+0x174/0x3d8
     dsa_register_switch+0x800/0x2ae0
     mv88e6xxx_register_switch+0x1b8/0x2a8
     mv88e6xxx_probe+0xc4c/0xf60
     mdio_probe+0x78/0xb8
     really_probe+0x2b8/0x5a8
     __driver_probe_device+0x164/0x298
     driver_probe_device+0x78/0x258
     __device_attach_driver+0x274/0x350
    
    Freed by task 42:
     __kasan_slab_free+0x48/0x68
     kfree+0x138/0x418
     dsa_register_switch+0x2694/0x2ae0
     mv88e6xxx_register_switch+0x1b8/0x2a8
     mv88e6xxx_probe+0xc4c/0xf60
     mdio_probe+0x78/0xb8
     really_probe+0x2b8/0x5a8
     __driver_probe_device+0x164/0x298
     driver_probe_device+0x78/0x258
     __device_attach_driver+0x274/0x350
    
    The simplest way to fix the bug is to delete the routing table in its
    entirety. dsa_tree_setup_routing_table() has no problem in regenerating
    it even if we deleted links between ports other than those of switch N,
    because dsa_link_touch() first checks whether the port pair already
    exists in dst->rtable, allocating if not.
    
    The deletion of the routing table in its entirety already exists in
    dsa_tree_teardown(), so refactor that into a function that can also be
    called from the tree setup error path.
    
    In my analysis of the commit to blame, it is the one which added
    dsa_link elements to dst->rtable. Prior to that, each switch had its own
    ds->rtable which is freed when the switch fails to probe. But the tree
    is potentially persistent memory.
    
    Fixes: c5f51765a1f6 ("net: dsa: list DSA links in the fabric")
    Signed-off-by: Vladimir Oltean <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mv88e6xxx: avoid unregistering devlink regions which were never registered [+ + +]
Author: Vladimir Oltean <[email protected]>
Date:   Tue Apr 15 00:28:50 2025 +0300

    net: dsa: mv88e6xxx: avoid unregistering devlink regions which were never registered
    
    [ Upstream commit c84f6ce918a9e6f4996597cbc62536bbf2247c96 ]
    
    Russell King reports that a system with mv88e6xxx dereferences a NULL
    pointer when unbinding this driver:
    https://lore.kernel.org/netdev/[email protected]/
    
    The crash seems to be in devlink_region_destroy(), which is not NULL
    tolerant but is given a NULL devlink global region pointer.
    
    At least on some chips, some devlink regions are conditionally registered
    since the blamed commit, see mv88e6xxx_setup_devlink_regions_global():
    
                    if (cond && !cond(chip))
                            continue;
    
    These are MV88E6XXX_REGION_STU and MV88E6XXX_REGION_PVT. If the chip
    does not have an STU or PVT, it should crash like this.
    
    To fix the issue, avoid unregistering those regions which are NULL, i.e.
    were skipped at mv88e6xxx_setup_devlink_regions_global() time.
    
    Fixes: 836021a2d0e0 ("net: dsa: mv88e6xxx: Export cross-chip PVT as devlink region")
    Tested-by: Russell King (Oracle) <[email protected]>
    Signed-off-by: Vladimir Oltean <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mv88e6xxx: fix -ENOENT when deleting VLANs and MST is unsupported [+ + +]
Author: Vladimir Oltean <[email protected]>
Date:   Tue Apr 15 00:29:13 2025 +0300

    net: dsa: mv88e6xxx: fix -ENOENT when deleting VLANs and MST is unsupported
    
    [ Upstream commit ea08dfc35f83cfc73493c52f63ae4f2e29edfe8d ]
    
    Russell King reports that on the ZII dev rev B, deleting a bridge VLAN
    from a user port fails with -ENOENT:
    https://lore.kernel.org/netdev/[email protected]/
    
    This comes from mv88e6xxx_port_vlan_leave() -> mv88e6xxx_mst_put(),
    which tries to find an MST entry in &chip->msts associated with the SID,
    but fails and returns -ENOENT as such.
    
    But we know that this chip does not support MST at all, so that is not
    surprising. The question is why does the guard in mv88e6xxx_mst_put()
    not exit early:
    
            if (!sid)
                    return 0;
    
    And the answer seems to be simple: the sid comes from vlan.sid which
    supposedly was previously populated by mv88e6xxx_vtu_get().
    But some chip->info->ops->vtu_getnext() implementations do not populate
    vlan.sid, for example see mv88e6185_g1_vtu_getnext(). In that case,
    later in mv88e6xxx_port_vlan_leave() we are using a garbage sid which is
    just residual stack memory.
    
    Testing for sid == 0 covers all cases of a non-bridge VLAN or a bridge
    VLAN mapped to the default MSTI. For some chips, SID 0 is valid and
    installed by mv88e6xxx_stu_setup(). A chip which does not support the
    STU would implicitly only support mapping all VLANs to the default MSTI,
    so although SID 0 is not valid, it would be sufficient, if we were to
    zero-initialize the vlan structure, to fix the bug, due to the
    coincidence that a test for vlan.sid == 0 already exists and leads to
    the same (correct) behavior.
    
    Another option which would be sufficient would be to add a test for
    mv88e6xxx_has_stu() inside mv88e6xxx_mst_put(), symmetric to the one
    which already exists in mv88e6xxx_mst_get(). But that placement means
    the caller will have to dereference vlan.sid, which means it will access
    uninitialized memory, which is not nice even if it ignores it later.
    
    So we end up making both modifications, in order to not rely just on the
    sid == 0 coincidence, but also to avoid having uninitialized structure
    fields which might get temporarily accessed.
    
    Fixes: acaf4d2e36b3 ("net: dsa: mv88e6xxx: MST Offloading")
    Signed-off-by: Vladimir Oltean <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family [+ + +]
Author: Marek Behún <[email protected]>
Date:   Mon Mar 17 18:32:50 2025 +0100

    net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family
    
    commit 1ebc8e1ef906db9c08e9abe9776d85ddec837725 upstream.
    
    Implement the workaround for erratum
      3.3 RGMII timing may be out of spec when transmit delay is enabled
    for the 6320 family, which says:
    
      When transmit delay is enabled via Port register 1 bit 14 = 1, duty
      cycle may be out of spec. Under very rare conditions this may cause
      the attached device receive CRC errors.
    
    Signed-off-by: Marek Behún <[email protected]>
    Cc: <[email protected]> # 5.4.x
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: ethernet: mtk_eth_soc: correct the max weight of the queue limit for 100Mbps [+ + +]
Author: Bo-Cun Chen <[email protected]>
Date:   Wed Apr 16 01:51:07 2025 +0100

    net: ethernet: mtk_eth_soc: correct the max weight of the queue limit for 100Mbps
    
    [ Upstream commit 6b02eb372c6776c9abb8bc81cf63f96039c24664 ]
    
    Without this patch, the maximum weight of the queue limit will be
    incorrect when linked at 100Mbps due to an apparent typo.
    
    Fixes: f63959c7eec31 ("net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues")
    Signed-off-by: Bo-Cun Chen <[email protected]>
    Signed-off-by: Daniel Golle <[email protected]>
    Link: https://patch.msgid.link/74111ba0bdb13743313999ed467ce564e8189006.1744764277.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ethernet: mtk_eth_soc: revise QDMA packet scheduler settings [+ + +]
Author: Bo-Cun Chen <[email protected]>
Date:   Wed Apr 16 01:51:25 2025 +0100

    net: ethernet: mtk_eth_soc: revise QDMA packet scheduler settings
    
    [ Upstream commit 1b66124135f5f8640bd540fadda4b20cdd23114b ]
    
    The QDMA packet scheduler suffers from a performance issue.
    Fix this by picking up changes from MediaTek's SDK which change to use
    Token Bucket instead of Leaky Bucket and fix the SPEED_1000 configuration.
    
    Fixes: 160d3a9b1929 ("net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support")
    Signed-off-by: Bo-Cun Chen <[email protected]>
    Signed-off-by: Daniel Golle <[email protected]>
    Link: https://patch.msgid.link/18040f60f9e2f5855036b75b28c4332a2d2ebdd8.1744764277.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ethernet: ti: am65-cpsw-nuss: rename phy_node -> port_np [+ + +]
Author: Alexander Sverdlin <[email protected]>
Date:   Tue May 28 09:59:49 2024 +0200

    net: ethernet: ti: am65-cpsw-nuss: rename phy_node -> port_np
    
    [ Upstream commit 78269025e192ec8122ddd87a1ec2805598d8a1ab ]
    
    Rename phy_node to port_np to better reflect what it actually is,
    because the new phylink API takes netdev node (or DSA port node),
    and resolves the phandle internally.
    
    Signed-off-by: Alexander Sverdlin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 903d2b9f9efc ("net: ethernet: ti: am65-cpsw: fix port_np reference counting")
    Signed-off-by: Sasha Levin <[email protected]>

net: ethernet: ti: am65-cpsw: fix port_np reference counting [+ + +]
Author: Michael Walle <[email protected]>
Date:   Mon Apr 14 10:39:42 2025 +0200

    net: ethernet: ti: am65-cpsw: fix port_np reference counting
    
    [ Upstream commit 903d2b9f9efc5b3339d74015fcfc0d9fff276c4c ]
    
    A reference to the device tree node is stored in a private struct, thus
    the reference count has to be incremented. Also, decrement the count on
    device removal and in the error path.
    
    Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
    Signed-off-by: Michael Walle <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ethtool: Don't call .cleanup_data when prepare_data fails [+ + +]
Author: Maxime Chevallier <[email protected]>
Date:   Mon Apr 7 15:05:10 2025 +0200

    net: ethtool: Don't call .cleanup_data when prepare_data fails
    
    [ Upstream commit 4f038a6a02d20859a3479293cbf172b0f14cbdd6 ]
    
    There's a consistent pattern where the .cleanup_data() callback is
    called when .prepare_data() fails, when it should really be called to
    clean after a successful .prepare_data() as per the documentation.
    
    Rewrite the error-handling paths to make sure we don't cleanup
    un-prepared data.
    
    Fixes: c781ff12a2f3 ("ethtool: Allow network drivers to dump arbitrary EEPROM data")
    Reviewed-by: Kory Maincent <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Reviewed-by: Michal Kubecek <[email protected]>
    Signed-off-by: Maxime Chevallier <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: libwx: handle page_pool_dev_alloc_pages error [+ + +]
Author: Chenyuan Yang <[email protected]>
Date:   Mon Apr 7 13:49:52 2025 -0500

    net: libwx: handle page_pool_dev_alloc_pages error
    
    [ Upstream commit 7f1ff1b38a7c8b872382b796023419d87d78c47e ]
    
    page_pool_dev_alloc_pages could return NULL. There was a WARN_ON(!page)
    but it would still proceed to use the NULL pointer and then crash.
    
    This is similar to commit 001ba0902046
    ("net: fec: handle page_pool_dev_alloc_pages error").
    
    This is found by our static analysis tool KNighter.
    
    Signed-off-by: Chenyuan Yang <[email protected]>
    Fixes: 3c47e8ae113a ("net: libwx: Support to receive packets in NAPI")
    Reviewed-by: Joe Damato <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: mctp: Set SOCK_RCU_FREE [+ + +]
Author: Matt Johnston <[email protected]>
Date:   Thu Apr 10 11:53:19 2025 +0800

    net: mctp: Set SOCK_RCU_FREE
    
    [ Upstream commit 52024cd6ec71a6ca934d0cc12452bd8d49850679 ]
    
    Bind lookup runs under RCU, so ensure that a socket doesn't go away in
    the middle of a lookup.
    
    Fixes: 833ef3b91de6 ("mctp: Populate socket implementation")
    Signed-off-by: Matt Johnston <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ngbe: fix memory leak in ngbe_probe() error path [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Sat Apr 12 21:19:24 2025 +0530

    net: ngbe: fix memory leak in ngbe_probe() error path
    
    [ Upstream commit 88fa80021b77732bc98f73fb69d69c7cc37b9f0d ]
    
    When ngbe_sw_init() is called, memory is allocated for wx->rss_key
    in wx_init_rss_key(). However, in ngbe_probe() function, the subsequent
    error paths after ngbe_sw_init() don't free the rss_key. Fix that by
    freeing it in error path along with wx->mac_table.
    
    Also change the label to which execution jumps when ngbe_sw_init()
    fails, because otherwise, it could lead to a double free for rss_key,
    when the mac_table allocation fails in wx_sw_init().
    
    Fixes: 02338c484ab6 ("net: ngbe: Initialize sw info and register netdev")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Reviewed-by: Kory Maincent <[email protected]>
    Reviewed-by: Jiawen Wu <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: openvswitch: fix nested key length validation in the set() action [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Sat Apr 12 12:40:18 2025 +0200

    net: openvswitch: fix nested key length validation in the set() action
    
    [ Upstream commit 65d91192aa66f05710cfddf6a14b5a25ee554dba ]
    
    It's not safe to access nla_len(ovs_key) if the data is smaller than
    the netlink header.  Check that the attribute is OK first.
    
    Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=b07a9da40df1576b8048
    Tested-by: [email protected]
    Signed-off-by: Ilya Maximets <[email protected]>
    Reviewed-by: Eelco Chaudron <[email protected]>
    Acked-by: Aaron Conole <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ppp: Add bound checking for skb data on ppp_sync_txmung [+ + +]
Author: Arnaud Lecomte <[email protected]>
Date:   Tue Apr 8 17:55:08 2025 +0200

    net: ppp: Add bound checking for skb data on ppp_sync_txmung
    
    [ Upstream commit aabc6596ffb377c4c9c8f335124b92ea282c9821 ]
    
    Ensure we have enough data in linear buffer from skb before accessing
    initial bytes. This prevents potential out-of-bounds accesses
    when processing short packets.
    
    When ppp_sync_txmung receives an incoming package with an empty
    payload:
    (remote) gef➤  p *(struct pppoe_hdr *) (skb->head + skb->network_header)
    $18 = {
            type = 0x1,
            ver = 0x1,
            code = 0x0,
            sid = 0x2,
            length = 0x0,
            tag = 0xffff8880371cdb96
    }
    
    from the skb struct (trimmed)
          tail = 0x16,
          end = 0x140,
          head = 0xffff88803346f400 "4",
          data = 0xffff88803346f416 ":\377",
          truesize = 0x380,
          len = 0x0,
          data_len = 0x0,
          mac_len = 0xe,
          hdr_len = 0x0,
    
    it is not safe to access data[2].
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=29fc8991b0ecb186cf40
    Tested-by: [email protected]
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Arnaud Lecomte <[email protected]>
    Link: https://patch.msgid.link/20250408-bound-checking-ppp_txmung-v2-1-94bb6e1b92d0@arnaud-lcm.com
    [[email protected]: fixed subj typo]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: sfp: add quirk for 2.5G OEM BX SFP [+ + +]
Author: Birger Koblitz <[email protected]>
Date:   Tue Feb 18 18:59:40 2025 +0100

    net: sfp: add quirk for 2.5G OEM BX SFP
    
    [ Upstream commit a85035561025063125f81090e4f2bd65da368c83 ]
    
    The OEM SFP-2.5G-BX10-D/U SFP module pair is meant to operate with
    2500Base-X. However, in their EEPROM they incorrectly specify:
    Transceiver codes   : 0x00 0x12 0x00 0x00 0x12 0x00 0x01 0x05 0x00
    BR, Nominal         : 2500MBd
    
    Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway.
    Tested on BananaPi R3.
    
    Signed-off-by: Birger Koblitz <[email protected]>
    Reviewed-by: Daniel Golle <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ti: icss-iep: Add phase offset configuration for perout signal [+ + +]
Author: Meghana Malladi <[email protected]>
Date:   Tue Mar 4 16:27:53 2025 +0530

    net: ti: icss-iep: Add phase offset configuration for perout signal
    
    [ Upstream commit 220cb1be647a7ca4e60241405c66f8f612c9b046 ]
    
    icss_iep_perout_enable_hw() is a common function for generating
    both pps and perout signals. When enabling pps, the application needs
    to only pass enable/disable argument, whereas for perout it supports
    different flags to configure the signal.
    
    In case the app passes a valid phase offset value, the signal should
    start toggling after that phase offset, else start immediately or
    as soon as possible. ICSS_IEP_SYNC_START_REG register take number of
    clock cycles to wait before starting the signal after activation time.
    Set appropriate value to this register to support phase offset.
    
    Signed-off-by: Meghana Malladi <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Reviewed-by: Kory Maincent <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 7349c9e99793 ("net: ti: icss-iep: Fix possible NULL pointer dereference for perout request")
    Signed-off-by: Sasha Levin <[email protected]>

net: ti: icss-iep: Add pwidth configuration for perout signal [+ + +]
Author: Meghana Malladi <[email protected]>
Date:   Tue Mar 4 16:27:52 2025 +0530

    net: ti: icss-iep: Add pwidth configuration for perout signal
    
    [ Upstream commit e5b456a14215e3c0e84844c2926861b972e03632 ]
    
    icss_iep_perout_enable_hw() is a common function for generating
    both pps and perout signals. When enabling pps, the application needs
    to only pass enable/disable argument, whereas for perout it supports
    different flags to configure the signal.
    
    But icss_iep_perout_enable_hw() function is missing to hook the
    configuration params passed by the app, causing perout to behave
    same a pps (except being able to configure the period). As duty cycle
    is also one feature which can configured for perout, incorporate this
    in the function to get the expected signal.
    
    Signed-off-by: Meghana Malladi <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Reviewed-by: Kory Maincent <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 7349c9e99793 ("net: ti: icss-iep: Fix possible NULL pointer dereference for perout request")
    Signed-off-by: Sasha Levin <[email protected]>

net: ti: icss-iep: Fix possible NULL pointer dereference for perout request [+ + +]
Author: Meghana Malladi <[email protected]>
Date:   Tue Apr 15 14:35:43 2025 +0530

    net: ti: icss-iep: Fix possible NULL pointer dereference for perout request
    
    [ Upstream commit 7349c9e9979333abfce42da5f9025598083b59c9 ]
    
    The ICSS IEP driver tracks perout and pps enable state with flags.
    Currently when disabling pps and perout signals during icss_iep_exit(),
    results in NULL pointer dereference for perout.
    
    To fix the null pointer dereference issue, the icss_iep_perout_enable_hw
    function can be modified to directly clear the IEP CMP registers when
    disabling PPS or PEROUT, without referencing the ptp_perout_request
    structure, as its contents are irrelevant in this case.
    
    Fixes: 9b115361248d ("net: ti: icssg-prueth: Fix clearing of IEP_CMP_CFG registers during iep_init")
    Reported-by: Dan Carpenter <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Meghana Malladi <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: tls: explicitly disallow disconnect [+ + +]
Author: Jakub Kicinski <[email protected]>
Date:   Fri Apr 4 11:03:33 2025 -0700

    net: tls: explicitly disallow disconnect
    
    [ Upstream commit 5071a1e606b30c0c11278d3c6620cd6a24724cf6 ]
    
    syzbot discovered that it can disconnect a TLS socket and then
    run into all sort of unexpected corner cases. I have a vague
    recollection of Eric pointing this out to us a long time ago.
    Supporting disconnect is really hard, for one thing if offload
    is enabled we'd need to wait for all packets to be _acked_.
    Disconnect is not commonly used, disallow it.
    
    The immediate problem syzbot run into is the warning in the strp,
    but that's just the easiest bug to trigger:
    
      WARNING: CPU: 0 PID: 5834 at net/tls/tls_strp.c:486 tls_strp_msg_load+0x72e/0xa80 net/tls/tls_strp.c:486
      RIP: 0010:tls_strp_msg_load+0x72e/0xa80 net/tls/tls_strp.c:486
      Call Trace:
       <TASK>
       tls_rx_rec_wait+0x280/0xa60 net/tls/tls_sw.c:1363
       tls_sw_recvmsg+0x85c/0x1c30 net/tls/tls_sw.c:2043
       inet6_recvmsg+0x2c9/0x730 net/ipv6/af_inet6.c:678
       sock_recvmsg_nosec net/socket.c:1023 [inline]
       sock_recvmsg+0x109/0x280 net/socket.c:1045
       __sys_recvfrom+0x202/0x380 net/socket.c:2237
    
    Fixes: 3c4d7559159b ("tls: kernel TLS support")
    Reported-by: [email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Sabrina Dubroca <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: asix_devices: add FiberGecko DeviceID [+ + +]
Author: Max Schulze <[email protected]>
Date:   Wed Feb 12 16:09:51 2025 +0100

    net: usb: asix_devices: add FiberGecko DeviceID
    
    [ Upstream commit 4079918ae720e842ed7dff65fedeb9980b374995 ]
    
    The FiberGecko is a small USB module that connects a 100 Mbit/s SFP
    
    Signed-off-by: Max Schulze <[email protected]>
    Tested-by: Max Schulze <[email protected]>
    Suggested-by: David Hollis <[email protected]>
    Reported-by: Sven Kreiensen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: vlan: don't propagate flags on open [+ + +]
Author: Stanislav Fomichev <[email protected]>
Date:   Thu Mar 13 03:06:57 2025 -0700

    net: vlan: don't propagate flags on open
    
    [ Upstream commit 27b918007d96402aba10ed52a6af8015230f1793 ]
    
    With the device instance lock, there is now a possibility of a deadlock:
    
    [    1.211455] ============================================
    [    1.211571] WARNING: possible recursive locking detected
    [    1.211687] 6.14.0-rc5-01215-g032756b4ca7a-dirty #5 Not tainted
    [    1.211823] --------------------------------------------
    [    1.211936] ip/184 is trying to acquire lock:
    [    1.212032] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_set_allmulti+0x4e/0xb0
    [    1.212207]
    [    1.212207] but task is already holding lock:
    [    1.212332] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
    [    1.212487]
    [    1.212487] other info that might help us debug this:
    [    1.212626]  Possible unsafe locking scenario:
    [    1.212626]
    [    1.212751]        CPU0
    [    1.212815]        ----
    [    1.212871]   lock(&dev->lock);
    [    1.212944]   lock(&dev->lock);
    [    1.213016]
    [    1.213016]  *** DEADLOCK ***
    [    1.213016]
    [    1.213143]  May be due to missing lock nesting notation
    [    1.213143]
    [    1.213294] 3 locks held by ip/184:
    [    1.213371]  #0: ffffffff838b53e0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x1b/0xa0
    [    1.213543]  #1: ffffffff84e5fc70 (&net->rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x37/0xa0
    [    1.213727]  #2: ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
    [    1.213895]
    [    1.213895] stack backtrace:
    [    1.213991] CPU: 0 UID: 0 PID: 184 Comm: ip Not tainted 6.14.0-rc5-01215-g032756b4ca7a-dirty #5
    [    1.213993] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
    [    1.213994] Call Trace:
    [    1.213995]  <TASK>
    [    1.213996]  dump_stack_lvl+0x8e/0xd0
    [    1.214000]  print_deadlock_bug+0x28b/0x2a0
    [    1.214020]  lock_acquire+0xea/0x2a0
    [    1.214027]  __mutex_lock+0xbf/0xd40
    [    1.214038]  dev_set_allmulti+0x4e/0xb0 # real_dev->flags & IFF_ALLMULTI
    [    1.214040]  vlan_dev_open+0xa5/0x170 # ndo_open on vlandev
    [    1.214042]  __dev_open+0x145/0x270
    [    1.214046]  __dev_change_flags+0xb0/0x1e0
    [    1.214051]  netif_change_flags+0x22/0x60 # IFF_UP vlandev
    [    1.214053]  dev_change_flags+0x61/0xb0 # for each device in group from dev->vlan_info
    [    1.214055]  vlan_device_event+0x766/0x7c0 # on netdevsim0
    [    1.214058]  notifier_call_chain+0x78/0x120
    [    1.214062]  netif_open+0x6d/0x90
    [    1.214064]  dev_open+0x5b/0xb0 # locks netdevsim0
    [    1.214066]  bond_enslave+0x64c/0x1230
    [    1.214075]  do_set_master+0x175/0x1e0 # on netdevsim0
    [    1.214077]  do_setlink+0x516/0x13b0
    [    1.214094]  rtnl_newlink+0xaba/0xb80
    [    1.214132]  rtnetlink_rcv_msg+0x440/0x490
    [    1.214144]  netlink_rcv_skb+0xeb/0x120
    [    1.214150]  netlink_unicast+0x1f9/0x320
    [    1.214153]  netlink_sendmsg+0x346/0x3f0
    [    1.214157]  __sock_sendmsg+0x86/0xb0
    [    1.214160]  ____sys_sendmsg+0x1c8/0x220
    [    1.214164]  ___sys_sendmsg+0x28f/0x2d0
    [    1.214179]  __x64_sys_sendmsg+0xef/0x140
    [    1.214184]  do_syscall_64+0xec/0x1d0
    [    1.214190]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [    1.214191] RIP: 0033:0x7f2d1b4a7e56
    
    Device setup:
    
         netdevsim0 (down)
         ^        ^
      bond        netdevsim1.100@netdevsim1 allmulticast=on (down)
    
    When we enslave the lower device (netdevsim0) which has a vlan, we
    propagate vlan's allmuti/promisc flags during ndo_open. This causes
    (re)locking on of the real_dev.
    
    Propagate allmulti/promisc on flags change, not on the open. There
    is a slight semantics change that vlans that are down now propagate
    the flags, but this seems unlikely to result in the real issues.
    
    Reproducer:
    
      echo 0 1 > /sys/bus/netdevsim/new_device
    
      dev_path=$(ls -d /sys/bus/netdevsim/devices/netdevsim0/net/*)
      dev=$(echo $dev_path | rev | cut -d/ -f1 | rev)
    
      ip link set dev $dev name netdevsim0
      ip link set dev netdevsim0 up
    
      ip link add link netdevsim0 name netdevsim0.100 type vlan id 100
      ip link set dev netdevsim0.100 allmulticast on down
      ip link add name bond1 type bond mode 802.3ad
      ip link set dev netdevsim0 down
      ip link set dev netdevsim0 master bond1
      ip link set dev bond1 up
      ip link show
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/netdev/Z9CfXjLMKn6VLG5d@mini-arch/T/#m15ba130f53227c883e79fb969687d69d670337a0
    Signed-off-by: Stanislav Fomichev <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net_sched: sch_sfq: move the limit validation [+ + +]
Author: Octavian Purdila <[email protected]>
Date:   Mon Apr 7 13:24:08 2025 -0700

    net_sched: sch_sfq: move the limit validation
    
    [ Upstream commit b3bf8f63e6179076b57c9de660c9f80b5abefe70 ]
    
    It is not sufficient to directly validate the limit on the data that
    the user passes as it can be updated based on how the other parameters
    are changed.
    
    Move the check at the end of the configuration update process to also
    catch scenarios where the limit is indirectly updated, for example
    with the following configurations:
    
    tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 depth 1
    tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 divisor 1
    
    This fixes the following syzkaller reported crash:
    
    ------------[ cut here ]------------
    UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:203:6
    index 65535 is out of range for type 'struct sfq_head[128]'
    CPU: 1 UID: 0 PID: 3037 Comm: syz.2.16 Not tainted 6.14.0-rc2-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x201/0x300 lib/dump_stack.c:120
     ubsan_epilogue lib/ubsan.c:231 [inline]
     __ubsan_handle_out_of_bounds+0xf5/0x120 lib/ubsan.c:429
     sfq_link net/sched/sch_sfq.c:203 [inline]
     sfq_dec+0x53c/0x610 net/sched/sch_sfq.c:231
     sfq_dequeue+0x34e/0x8c0 net/sched/sch_sfq.c:493
     sfq_reset+0x17/0x60 net/sched/sch_sfq.c:518
     qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035
     tbf_reset+0x41/0x110 net/sched/sch_tbf.c:339
     qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035
     dev_reset_queue+0x100/0x1b0 net/sched/sch_generic.c:1311
     netdev_for_each_tx_queue include/linux/netdevice.h:2590 [inline]
     dev_deactivate_many+0x7e5/0xe70 net/sched/sch_generic.c:1375
    
    Reported-by: syzbot <[email protected]>
    Fixes: 10685681bafc ("net_sched: sch_sfq: don't allow 1 packet limit")
    Signed-off-by: Octavian Purdila <[email protected]>
    Acked-by: Cong Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net_sched: sch_sfq: use a temporary work area for validating configuration [+ + +]
Author: Octavian Purdila <[email protected]>
Date:   Mon Apr 7 13:24:07 2025 -0700

    net_sched: sch_sfq: use a temporary work area for validating configuration
    
    [ Upstream commit 8c0cea59d40cf6dd13c2950437631dd614fbade6 ]
    
    Many configuration parameters have influence on others (e.g. divisor
    -> flows -> limit, depth -> limit) and so it is difficult to correctly
    do all of the validation before applying the configuration. And if a
    validation error is detected late it is difficult to roll back a
    partially applied configuration.
    
    To avoid these issues use a temporary work area to update and validate
    the configuration and only then apply the configuration to the
    internal state.
    
    Signed-off-by: Octavian Purdila <[email protected]>
    Acked-by: Cong Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: b3bf8f63e617 ("net_sched: sch_sfq: move the limit validation")
    Signed-off-by: Sasha Levin <[email protected]>

 
netlink: specs: rt-link: add an attr layer around alt-ifname [+ + +]
Author: Jakub Kicinski <[email protected]>
Date:   Mon Apr 14 14:18:48 2025 -0700

    netlink: specs: rt-link: add an attr layer around alt-ifname
    
    [ Upstream commit acf4da17deada7f8b120e051aa6c9cac40dbd83b ]
    
    alt-ifname attr is directly placed in requests (as an alternative
    to ifname) but in responses its wrapped up in IFLA_PROP_LIST
    and only there is may be multi-attr. See rtnl_fill_prop_list().
    
    Fixes: b2f63d904e72 ("doc/netlink: Add spec for rt link messages")
    Reviewed-by: Donald Hunter <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netlink: specs: rt-link: adjust mctp attribute naming [+ + +]
Author: Jakub Kicinski <[email protected]>
Date:   Mon Apr 14 14:18:50 2025 -0700

    netlink: specs: rt-link: adjust mctp attribute naming
    
    [ Upstream commit beb3c5ad8829b52057f48a776a9d9558b98c157f ]
    
    MCTP attribute naming is inconsistent. In C we have:
        IFLA_MCTP_NET,
        IFLA_MCTP_PHYS_BINDING,
             ^^^^
    
    but in YAML:
        - mctp-net
        - phys-binding
          ^
           no "mctp"
    
    It's unclear whether the "mctp" part of the name is supposed
    to be a prefix or part of attribute name. Make it a prefix,
    seems cleaner, even tho technically phys-binding was added later.
    
    Fixes: b2f63d904e72 ("doc/netlink: Add spec for rt link messages")
    Reviewed-by: Donald Hunter <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nfs: add missing selections of CONFIG_CRC32 [+ + +]
Author: Eric Biggers <[email protected]>
Date:   Tue Apr 1 15:02:21 2025 -0700

    nfs: add missing selections of CONFIG_CRC32
    
    [ Upstream commit cd35b6cb46649750b7dbd0df0e2d767415d8917b ]
    
    nfs.ko, nfsd.ko, and lockd.ko all use crc32_le(), which is available
    only when CONFIG_CRC32 is enabled.  But the only NFS kconfig option that
    selected CONFIG_CRC32 was CONFIG_NFS_DEBUG, which is client-specific and
    did not actually guard the use of crc32_le() even on the client.
    
    The code worked around this bug by only actually calling crc32_le() when
    CONFIG_CRC32 is built-in, instead hard-coding '0' in other cases.  This
    avoided randconfig build errors, and in real kernels the fallback code
    was unlikely to be reached since CONFIG_CRC32 is 'default y'.  But, this
    really needs to just be done properly, especially now that I'm planning
    to update CONFIG_CRC32 to not be 'default y'.
    
    Therefore, make CONFIG_NFS_FS, CONFIG_NFSD, and CONFIG_LOCKD select
    CONFIG_CRC32.  Then remove the fallback code that becomes unnecessary,
    as well as the selection of CONFIG_CRC32 from CONFIG_NFS_DEBUG.
    
    Fixes: 1264a2f053a3 ("NFS: refactor code for calculating the crc32 hash of a filehandle")
    Signed-off-by: Eric Biggers <[email protected]>
    Acked-by: Anna Schumaker <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nfsd: decrease sc_count directly if fail to queue dl_recall [+ + +]
Author: Li Lingfeng <[email protected]>
Date:   Thu Apr 10 09:57:08 2025 +0800

    nfsd: decrease sc_count directly if fail to queue dl_recall
    
    [ Upstream commit a1d14d931bf700c1025db8c46d6731aa5cf440f9 ]
    
    A deadlock warning occurred when invoking nfs4_put_stid following a failed
    dl_recall queue operation:
                T1                            T2
                                    nfs4_laundromat
                                     nfs4_get_client_reaplist
                                      nfs4_anylock_blockers
    __break_lease
     spin_lock // ctx->flc_lock
                                       spin_lock // clp->cl_lock
                                       nfs4_lockowner_has_blockers
                                        locks_owner_has_blockers
                                         spin_lock // flctx->flc_lock
     nfsd_break_deleg_cb
      nfsd_break_one_deleg
       nfs4_put_stid
        refcount_dec_and_lock
         spin_lock // clp->cl_lock
    
    When a file is opened, an nfs4_delegation is allocated with sc_count
    initialized to 1, and the file_lease holds a reference to the delegation.
    The file_lease is then associated with the file through kernel_setlease.
    
    The disassociation is performed in nfsd4_delegreturn via the following
    call chain:
    nfsd4_delegreturn --> destroy_delegation --> destroy_unhashed_deleg -->
    nfs4_unlock_deleg_lease --> kernel_setlease --> generic_delete_lease
    The corresponding sc_count reference will be released after this
    disassociation.
    
    Since nfsd_break_one_deleg executes while holding the flc_lock, the
    disassociation process becomes blocked when attempting to acquire flc_lock
    in generic_delete_lease. This means:
    1) sc_count in nfsd_break_one_deleg will not be decremented to 0;
    2) The nfs4_put_stid called by nfsd_break_one_deleg will not attempt to
    acquire cl_lock;
    3) Consequently, no deadlock condition is created.
    
    Given that sc_count in nfsd_break_one_deleg remains non-zero, we can
    safely perform refcount_dec on sc_count directly. This approach
    effectively avoids triggering deadlock warnings.
    
    Fixes: 230ca758453c ("nfsd: put dl_stid if fail to queue dl_recall")
    Signed-off-by: Li Lingfeng <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nft_set_pipapo: fix incorrect avx2 match of 5th field octet [+ + +]
Author: Florian Westphal <[email protected]>
Date:   Mon Apr 7 19:40:18 2025 +0200

    nft_set_pipapo: fix incorrect avx2 match of 5th field octet
    
    [ Upstream commit e042ed950d4e176379ba4c0722146cd96fb38aa2 ]
    
    Given a set element like:
    
            icmpv6 . dead:beef:00ff::1
    
    The value of 'ff' is irrelevant, any address will be matched
    as long as the other octets are the same.
    
    This is because of too-early register clobbering:
    ymm7 is reloaded with new packet data (pkt[9])  but it still holds data
    of an earlier load that wasn't processed yet.
    
    The existing tests in nft_concat_range.sh selftests do exercise this code
    path, but do not trigger incorrect matching due to the network prefix
    limitation.
    
    Fixes: 7400b063969b ("nft_set_pipapo: Introduce AVX2-based lookup implementation")
    Reported-by: sontu mazumdar <[email protected]>
    Closes: https://lore.kernel.org/netfilter/CANgxkqwnMH7fXra+VUfODT-8+qFLgskq3set1cAzqqJaV4iEZg@mail.gmail.com/T/#t
    Reviewed-by: Stefano Brivio <[email protected]>
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ntb: use 64-bit arithmetic for the MSI doorbell mask [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Wed Jan 15 21:28:17 2025 +0300

    ntb: use 64-bit arithmetic for the MSI doorbell mask
    
    commit fd5625fc86922f36bedee5846fefd647b7e72751 upstream.
    
    msi_db_mask is of type 'u64', still the standard 'int' arithmetic is
    performed to compute its value.
    
    While most of the ntb_hw drivers actually don't utilize the higher 32
    bits of the doorbell mask now, this may be the case for Switchtec - see
    switchtec_ntb_init_db().
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE static
    analysis tool.
    
    Fixes: 2b0569b3b7e6 ("NTB: Add MSI interrupt support to ntb_transport")
    Cc: [email protected]
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Reviewed-by: Dave Jiang <[email protected]>
    Signed-off-by: Jon Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvme-rdma: unquiesce admin_q before destroy it [+ + +]
Author: Chunguang.xu <[email protected]>
Date:   Tue Dec 3 11:34:41 2024 +0800

    nvme-rdma: unquiesce admin_q before destroy it
    
    commit 5858b687559809f05393af745cbadf06dee61295 upstream.
    
    Kernel will hang on destroy admin_q while we create ctrl failed, such
    as following calltrace:
    
    PID: 23644    TASK: ff2d52b40f439fc0  CPU: 2    COMMAND: "nvme"
     #0 [ff61d23de260fb78] __schedule at ffffffff8323bc15
     #1 [ff61d23de260fc08] schedule at ffffffff8323c014
     #2 [ff61d23de260fc28] blk_mq_freeze_queue_wait at ffffffff82a3dba1
     #3 [ff61d23de260fc78] blk_freeze_queue at ffffffff82a4113a
     #4 [ff61d23de260fc90] blk_cleanup_queue at ffffffff82a33006
     #5 [ff61d23de260fcb0] nvme_rdma_destroy_admin_queue at ffffffffc12686ce
     #6 [ff61d23de260fcc8] nvme_rdma_setup_ctrl at ffffffffc1268ced
     #7 [ff61d23de260fd28] nvme_rdma_create_ctrl at ffffffffc126919b
     #8 [ff61d23de260fd68] nvmf_dev_write at ffffffffc024f362
     #9 [ff61d23de260fe38] vfs_write at ffffffff827d5f25
        RIP: 00007fda7891d574  RSP: 00007ffe2ef06958  RFLAGS: 00000202
        RAX: ffffffffffffffda  RBX: 000055e8122a4d90  RCX: 00007fda7891d574
        RDX: 000000000000012b  RSI: 000055e8122a4d90  RDI: 0000000000000004
        RBP: 00007ffe2ef079c0   R8: 000000000000012b   R9: 000055e8122a4d90
        R10: 0000000000000000  R11: 0000000000000202  R12: 0000000000000004
        R13: 000055e8122923c0  R14: 000000000000012b  R15: 00007fda78a54500
        ORIG_RAX: 0000000000000001  CS: 0033  SS: 002b
    
    This due to we have quiesced admi_q before cancel requests, but forgot
    to unquiesce before destroy it, as a result we fail to drain the
    pending requests, and hang on blk_mq_freeze_queue_wait() forever. Here
    try to reuse nvme_rdma_teardown_admin_queue() to fix this issue and
    simplify the code.
    
    Fixes: 958dc1d32c80 ("nvme-rdma: add clean action for failed reconnection")
    Reported-by: Yingfu.zhou <[email protected]>
    Signed-off-by: Chunguang.xu <[email protected]>
    Signed-off-by: Yue.zhao <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    [Minor context change fixed]
    Signed-off-by: Feng Liu <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-fc: Remove unused functions [+ + +]
Author: WangYuli <[email protected]>
Date:   Wed Mar 12 13:06:50 2025 +0800

    nvmet-fc: Remove unused functions
    
    commit 1b304c006b0fb4f0517a8c4ba8c46e88f48a069c upstream.
    
    The functions nvmet_fc_iodnum() and nvmet_fc_fodnum() are currently
    unutilized.
    
    Following commit c53432030d86 ("nvme-fabrics: Add target support for FC
    transport"), which introduced these two functions, they have not been
    used at all in practice.
    
    Remove them to resolve the compiler warnings.
    
    Fix follow errors with clang-19 when W=1e:
      drivers/nvme/target/fc.c:177:1: error: unused function 'nvmet_fc_iodnum' [-Werror,-Wunused-function]
        177 | nvmet_fc_iodnum(struct nvmet_fc_ls_iod *iodptr)
            | ^~~~~~~~~~~~~~~
      drivers/nvme/target/fc.c:183:1: error: unused function 'nvmet_fc_fodnum' [-Werror,-Wunused-function]
        183 | nvmet_fc_fodnum(struct nvmet_fc_fcp_iod *fodptr)
            | ^~~~~~~~~~~~~~~
      2 errors generated.
      make[8]: *** [scripts/Makefile.build:207: drivers/nvme/target/fc.o] Error 1
      make[7]: *** [scripts/Makefile.build:465: drivers/nvme/target] Error 2
      make[6]: *** [scripts/Makefile.build:465: drivers/nvme] Error 2
      make[6]: *** Waiting for unfinished jobs....
    
    Fixes: c53432030d86 ("nvme-fabrics: Add target support for FC transport")
    Signed-off-by: WangYuli <[email protected]>
    Reviewed-by: Chaitanya Kulkarni <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-fcloop: swap list_add_tail arguments [+ + +]
Author: Daniel Wagner <[email protected]>
Date:   Tue Apr 8 17:29:03 2025 +0200

    nvmet-fcloop: swap list_add_tail arguments
    
    [ Upstream commit 2b5f0c5bc819af2b0759a8fcddc1b39102735c0f ]
    
    The newly element to be added to the list is the first argument of
    list_add_tail. This fix is missing dcfad4ab4d67 ("nvmet-fcloop: swap
    the list_add_tail arguments").
    
    Fixes: 437c0b824dbd ("nvme-fcloop: add target to host LS request support")
    Signed-off-by: Daniel Wagner <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret() [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 8 00:02:13 2025 -0700

    objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret()
    
    [ Upstream commit a8df7d0ef92eca28c610206c6748daf537ac0586 ]
    
    The !CONFIG_IA32_EMULATION version of xen_entry_SYSCALL_compat() ends
    with a SYSCALL instruction which is classified by objtool as
    INSN_CONTEXT_SWITCH.
    
    Unlike validate_branch(), validate_unret() doesn't consider
    INSN_CONTEXT_SWITCH in a non-function to be a dead end, so it keeps
    going past the end of xen_entry_SYSCALL_compat(), resulting in the
    following warning:
    
      vmlinux.o: warning: objtool: xen_reschedule_interrupt+0x2a: RET before UNTRAIN
    
    Fix that by adding INSN_CONTEXT_SWITCH handling to validate_unret() to
    match what validate_branch() is already doing.
    
    Fixes: a09a6e2399ba ("objtool: Add entry UNRET validation")
    Reported-by: Andrew Cooper <[email protected]>
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Link: https://lore.kernel.org/r/f5eda46fd09f15b1f5cde3d9ae3b92b958342add.1744095216.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <[email protected]>

 
octeontx2-pf: qos: fix VF root node parent queue index [+ + +]
Author: Hariprasad Kelam <[email protected]>
Date:   Mon Apr 7 12:33:41 2025 +0530

    octeontx2-pf: qos: fix VF root node parent queue index
    
    [ Upstream commit b7db94734e785e380b0db0f9295e07024f4d42a0 ]
    
    The current code configures the Physical Function (PF) root node at TL1
    and the Virtual Function (VF) root node at TL2.
    
    This ensure at any given point of time PF traffic gets more priority.
    
                        PF root node
                          TL1
                         /  \
                        TL2  TL2 VF root node
                        /     \
                       TL3    TL3
                       /       \
                      TL4      TL4
                      /         \
                     SMQ        SMQ
    
    Due to a bug in the current code, the TL2 parent queue index on the
    VF interface is not being configured, leading to 'SMQ Flush' errors
    
    Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
    Signed-off-by: Hariprasad Kelam <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
of/irq: Fix device node refcount leakage in API irq_of_parse_and_map() [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sun Feb 9 20:58:59 2025 +0800

    of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()
    
    commit 962a2805e47b933876ba0e4c488d9e89ced2dd29 upstream.
    
    In irq_of_parse_and_map(), refcount of device node @oirq.np was got
    by successful of_irq_parse_one() invocation, but it does not put the
    refcount before return, so causes @oirq.np refcount leakage.
    
    Fix by putting @oirq.np refcount before return.
    
    Fixes: e3873444990d ("of/irq: Move irq_of_parse_and_map() to common code")
    Cc: [email protected]
    Signed-off-by: Zijun Hu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

of/irq: Fix device node refcount leakage in API of_irq_parse_one() [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sun Feb 9 20:58:55 2025 +0800

    of/irq: Fix device node refcount leakage in API of_irq_parse_one()
    
    commit 0cb58d6c7b558a69957fabe159bfb184196e1e8d upstream.
    
    of_irq_parse_one(@int_gen_dev, i, ...) will leak refcount of @i_th_phandle
    
    int_gen_dev {
        ...
        interrupts-extended = ..., <&i_th_phandle ...>, ...;
        ...
    };
    
    Refcount of @i_th_phandle is increased by of_parse_phandle_with_args()
    but is not decreased by API of_irq_parse_one() before return, so causes
    refcount leakage.
    
    Rework the refcounting to use __free() cleanup and simplify the code to
    have a single call to of_irq_parse_raw().
    
    Also add comments about refcount of node @out_irq->np got by the API.
    
    Fixes: 79d9701559a9 ("of/irq: create interrupts-extended property")
    Cc: [email protected]
    Signed-off-by: Zijun Hu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [robh: Use __free() to do puts]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

of/irq: Fix device node refcount leakage in API of_irq_parse_raw() [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sun Feb 9 20:58:57 2025 +0800

    of/irq: Fix device node refcount leakage in API of_irq_parse_raw()
    
    commit ff93e7213d6cc8d9a7b0bc64f70ed26094e168f3 upstream.
    
    if the node @out_irq->np got by of_irq_parse_raw() is a combo node which
    consists of both controller and nexus, namely, of_irq_parse_raw() returns
    due to condition (@ipar == @newpar), then the node's refcount was increased
    twice, hence causes refcount leakage.
    
    Fix by putting @out_irq->np refcount before returning due to the condition.
    Also add comments about refcount of node @out_irq->np got by the API.
    
    Fixes: 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
    Cc: [email protected]
    Signed-off-by: Zijun Hu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

of/irq: Fix device node refcount leakages in of_irq_count() [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sun Feb 9 20:58:58 2025 +0800

    of/irq: Fix device node refcount leakages in of_irq_count()
    
    commit bbf71f44aaf241d853759a71de7e7ebcdb89be3d upstream.
    
    of_irq_count() invokes of_irq_parse_one() to count IRQs, and successful
    invocation of the later will get device node @irq.np refcount, but the
    former does not put the refcount before next iteration invocation, hence
    causes device node refcount leakages.
    
    Fix by putting @irq.np refcount before the next iteration invocation.
    
    Fixes: 3da5278727a8 ("of/irq: Rework of_irq_count()")
    Cc: [email protected]
    Signed-off-by: Zijun Hu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

of/irq: Fix device node refcount leakages in of_irq_init() [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sun Feb 9 20:59:00 2025 +0800

    of/irq: Fix device node refcount leakages in of_irq_init()
    
    commit 708124d9e6e7ac5ebf927830760679136b23fdf0 upstream.
    
    of_irq_init() will leak interrupt controller device node refcounts
    in two places as explained below:
    
    1) Leak refcounts of both @desc->dev and @desc->interrupt_parent when
       suffers @desc->irq_init_cb() failure.
    2) Leak refcount of @desc->interrupt_parent when cleans up list
       @intc_desc_list in the end.
    
    Refcounts of both @desc->dev and @desc->interrupt_parent were got in
    the first loop, but of_irq_init() does not put them before kfree(@desc)
    in places mentioned above, so causes refcount leakages.
    
    Fix by putting refcounts involved before kfree(@desc).
    
    Fixes: 8363ccb917c6 ("of/irq: add missing of_node_put")
    Fixes: c71a54b08201 ("of/irq: introduce of_irq_init")
    Cc: [email protected]
    Signed-off-by: Zijun Hu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ovl: don't allow datadir only [+ + +]
Author: Miklos Szeredi <[email protected]>
Date:   Mon Feb 10 15:11:22 2025 +0100

    ovl: don't allow datadir only
    
    commit eb3a04a8516ee9b5174379306f94279fc90424c4 upstream.
    
    In theory overlayfs could support upper layer directly referring to a data
    layer, but there's no current use case for this.
    
    Originally, when data-only layers were introduced, this wasn't allowed,
    only introduced by the "datadir+" feature, but without actually handling
    this case, resulting in an Oops.
    
    Fix by disallowing datadir without lowerdir.
    
    Reported-by: Giuseppe Scrivano <[email protected]>
    Fixes: 24e16e385f22 ("ovl: add support for appending lowerdirs one by one")
    Cc: <[email protected]> # v6.7
    Reviewed-by: Amir Goldstein <[email protected]>
    Reviewed-by: Alexander Larsson <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ovl: remove unused forward declaration [+ + +]
Author: Giuseppe Scrivano <[email protected]>
Date:   Mon Feb 10 13:07:55 2025 +0100

    ovl: remove unused forward declaration
    
    [ Upstream commit a6eb9a4a69cc360b930dad9dc8513f8fd9b3577f ]
    
    The ovl_get_verity_xattr() function was never added, only its declaration.
    
    Signed-off-by: Giuseppe Scrivano <[email protected]>
    Fixes: 184996e92e86 ("ovl: Validate verity xattr when resolving lowerdata")
    Reviewed-by: Amir Goldstein <[email protected]>
    Reviewed-by: Alexander Larsson <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
page_pool: avoid infinite loop to schedule delayed worker [+ + +]
Author: Jason Xing <[email protected]>
Date:   Fri Feb 14 14:42:50 2025 +0800

    page_pool: avoid infinite loop to schedule delayed worker
    
    [ Upstream commit 43130d02baa137033c25297aaae95fd0edc41654 ]
    
    We noticed the kworker in page_pool_release_retry() was waken
    up repeatedly and infinitely in production because of the
    buggy driver causing the inflight less than 0 and warning
    us in page_pool_inflight()[1].
    
    Since the inflight value goes negative, it means we should
    not expect the whole page_pool to get back to work normally.
    
    This patch mitigates the adverse effect by not rescheduling
    the kworker when detecting the inflight negative in
    page_pool_release_retry().
    
    [1]
    [Mon Feb 10 20:36:11 2025] ------------[ cut here ]------------
    [Mon Feb 10 20:36:11 2025] Negative(-51446) inflight packet-pages
    ...
    [Mon Feb 10 20:36:11 2025] Call Trace:
    [Mon Feb 10 20:36:11 2025]  page_pool_release_retry+0x23/0x70
    [Mon Feb 10 20:36:11 2025]  process_one_work+0x1b1/0x370
    [Mon Feb 10 20:36:11 2025]  worker_thread+0x37/0x3a0
    [Mon Feb 10 20:36:11 2025]  kthread+0x11a/0x140
    [Mon Feb 10 20:36:11 2025]  ? process_one_work+0x370/0x370
    [Mon Feb 10 20:36:11 2025]  ? __kthread_cancel_work+0x40/0x40
    [Mon Feb 10 20:36:11 2025]  ret_from_fork+0x35/0x40
    [Mon Feb 10 20:36:11 2025] ---[ end trace ebffe800f33e7e34 ]---
    Note: before this patch, the above calltrace would flood the
    dmesg due to repeated reschedule of release_dw kworker.
    
    Signed-off-by: Jason Xing <[email protected]>
    Reviewed-by: Mina Almasry <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe() [+ + +]
Author: Stanimir Varbanov <[email protected]>
Date:   Thu Jan 23 00:29:55 2025 +0200

    PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe()
    
    commit 2df181e1aea4628a8fd257f866026625d0519627 upstream.
    
    A call to of_parse_phandle() is incrementing the refcount, and as such,
    the of_node_put() must be called when the reference is no longer needed.
    
    Thus, refactor the existing code and add a missing of_node_put() call
    following the check to ensure that "msi_np" matches "pcie->np" and after
    MSI initialization, but only if the MSI support is enabled system-wide.
    
    Cc: [email protected] # v5.10+
    Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: Fix reference leak in pci_alloc_child_bus() [+ + +]
Author: Ma Ke <[email protected]>
Date:   Sun Feb 2 14:23:57 2025 +0800

    PCI: Fix reference leak in pci_alloc_child_bus()
    
    commit 1f2768b6a3ee77a295106e3a5d68458064923ede upstream.
    
    If device_register(&child->dev) fails, call put_device() to explicitly
    release child->dev, per the comment at device_register().
    
    Found by code review.
    
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 4f535093cf8f ("PCI: Put pci_dev in device tree as early as possible")
    Signed-off-by: Ma Ke <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Ilpo Järvinen <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type [+ + +]
Author: Ryo Takakura <[email protected]>
Date:   Tue Feb 18 09:08:30 2025 +0100

    PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type
    
    [ Upstream commit 18056a48669a040bef491e63b25896561ee14d90 ]
    
    The access to the PCI config space via pci_ops::read and pci_ops::write is
    a low-level hardware access. The functions can be accessed with disabled
    interrupts even on PREEMPT_RT. The pci_lock is a raw_spinlock_t for this
    purpose.
    
    A spinlock_t becomes a sleeping lock on PREEMPT_RT, so it cannot be
    acquired with disabled interrupts. The vmd_dev::cfg_lock is accessed in
    the same context as the pci_lock.
    
    Make vmd_dev::cfg_lock a raw_spinlock_t type so it can be used with
    interrupts disabled.
    
    This was reported as:
    
      BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
      Call Trace:
       rt_spin_lock+0x4e/0x130
       vmd_pci_read+0x8d/0x100 [vmd]
       pci_user_read_config_byte+0x6f/0xe0
       pci_read_config+0xfe/0x290
       sysfs_kf_bin_read+0x68/0x90
    
    Signed-off-by: Ryo Takakura <[email protected]>
    Tested-by: Luis Claudio R. Goncalves <[email protected]>
    Acked-by: Luis Claudio R. Goncalves <[email protected]>
    [bigeasy: reword commit message]
    Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
    Tested-off-by: Luis Claudio R. Goncalves <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <[email protected]>
    [bhelgaas: add back report info from
    https://lore.kernel.org/lkml/[email protected]/]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pds_core: fix memory leak in pdsc_debugfs_add_qcq() [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Wed Apr 9 11:14:48 2025 +0530

    pds_core: fix memory leak in pdsc_debugfs_add_qcq()
    
    [ Upstream commit 8b82f656826c741d032490b089a5638c33f2c91d ]
    
    The memory allocated for intr_ctrl_regset, which is passed to
    debugfs_create_regset32() may not be cleaned up when the driver is
    removed. Fix that by using device managed allocation for it.
    
    Fixes: 45d76f492938 ("pds_core: set up device and adminq")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf/x86/intel/uncore: Fix the scale of IIO free running counters on ICX [+ + +]
Author: Kan Liang <[email protected]>
Date:   Wed Apr 16 07:24:25 2025 -0700

    perf/x86/intel/uncore: Fix the scale of IIO free running counters on ICX
    
    commit 32c7f1150225694d95a51110a93be25db03bb5db upstream.
    
    There was a mistake in the ICX uncore spec too. The counter increments
    for every 32 bytes rather than 4 bytes.
    
    The same as SNR, there are 1 ioclk and 8 IIO bandwidth in free running
    counters. Reuse the snr_uncore_iio_freerunning_events().
    
    Fixes: 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")
    Reported-by: Tang Jun <[email protected]>
    Signed-off-by: Kan Liang <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

perf/x86/intel/uncore: Fix the scale of IIO free running counters on SNR [+ + +]
Author: Kan Liang <[email protected]>
Date:   Wed Apr 16 07:24:24 2025 -0700

    perf/x86/intel/uncore: Fix the scale of IIO free running counters on SNR
    
    commit 96a720db59ab330c8562b2437153faa45dac705f upstream.
    
    There was a mistake in the SNR uncore spec. The counter increments for
    every 32 bytes of data sent from the IO agent to the SOC, not 4 bytes
    which was documented in the spec.
    
    The event list has been updated:
    
      "EventName": "UNC_IIO_BANDWIDTH_IN.PART0_FREERUN",
      "BriefDescription": "Free running counter that increments for every 32
                           bytes of data sent from the IO agent to the SOC",
    
    Update the scale of the IIO bandwidth in free running counters as well.
    
    Fixes: 210cc5f9db7a ("perf/x86/intel/uncore: Add uncore support for Snow Ridge server")
    Signed-off-by: Kan Liang <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

perf/x86/intel/uncore: Fix the scale of IIO free running counters on SPR [+ + +]
Author: Kan Liang <[email protected]>
Date:   Wed Apr 16 07:24:26 2025 -0700

    perf/x86/intel/uncore: Fix the scale of IIO free running counters on SPR
    
    commit 506f981ab40f0b03a11a640cfd77f48b09aff330 upstream.
    
    The scale of IIO bandwidth in free running counters is inherited from
    the ICX. The counter increments for every 32 bytes rather than 4 bytes.
    
    The IIO bandwidth out free running counters don't increment with a
    consistent size. The increment depends on the requested size. It's
    impossible to find a fixed increment. Remove it from the event_descs.
    
    Fixes: 0378c93a92e2 ("perf/x86/intel/uncore: Support IIO free-running counters on Sapphire Rapids server")
    Reported-by: Tang Jun <[email protected]>
    Signed-off-by: Kan Liang <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
perf/x86/intel: Allow to update user space GPRs from PEBS records [+ + +]
Author: Dapeng Mi <[email protected]>
Date:   Tue Apr 15 10:41:35 2025 +0000

    perf/x86/intel: Allow to update user space GPRs from PEBS records
    
    commit 71dcc11c2cd9e434c34a63154ecadca21c135ddd upstream.
    
    Currently when a user samples user space GPRs (--user-regs option) with
    PEBS, the user space GPRs actually always come from software PMI
    instead of from PEBS hardware. This leads to the sampled GPRs to
    possibly be inaccurate for single PEBS record case because of the
    skid between counter overflow and GPRs sampling on PMI.
    
    For the large PEBS case, it is even worse. If user sets the
    exclude_kernel attribute, large PEBS would be used to sample user space
    GPRs, but since PEBS GPRs group is not really enabled, it leads to all
    samples in the large PEBS record to share the same piece of user space
    GPRs, like this reproducer shows:
    
      $ perf record -e branches:pu --user-regs=ip,ax -c 100000 ./foo
      $ perf report -D | grep "AX"
    
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
      .... AX    0x000000003a0d4ead
    
    So enable GPRs group for user space GPRs sampling and prioritize reading
    GPRs from PEBS. If the PEBS sampled GPRs is not user space GPRs (single
    PEBS record case), perf_sample_regs_user() modifies them to user space
    GPRs.
    
    [ mingo: Clarified the changelog. ]
    
    Fixes: c22497f5838c ("perf/x86/intel: Support adaptive PEBS v4")
    Signed-off-by: Dapeng Mi <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
perf: arm_pmu: Don't disable counter in armpmu_add() [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Tue Feb 18 14:39:57 2025 -0600

    perf: arm_pmu: Don't disable counter in armpmu_add()
    
    [ Upstream commit dcca27bc1eccb9abc2552aab950b18a9742fb8e7 ]
    
    Currently armpmu_add() tries to handle a newly-allocated counter having
    a stale associated event, but this should not be possible, and if this
    were to happen the current mitigation is insufficient and potentially
    expensive. It would be better to warn if we encounter the impossible
    case.
    
    Calls to pmu::add() and pmu::del() are serialized by the core perf code,
    and armpmu_del() clears the relevant slot in pmu_hw_events::events[]
    before clearing the bit in pmu_hw_events::used_mask such that the
    counter can be reallocated. Thus when armpmu_add() allocates a counter
    index from pmu_hw_events::used_mask, it should not be possible to observe
    a stale even in pmu_hw_events::events[] unless either
    pmu_hw_events::used_mask or pmu_hw_events::events[] have been corrupted.
    
    If this were to happen, we'd end up with two events with the same
    event->hw.idx, which would clash with each other during reprogramming,
    deletion, etc, and produce bogus results. Add a WARN_ON_ONCE() for this
    case so that we can detect if this ever occurs in practice.
    
    That possiblity aside, there's no need to call arm_pmu::disable(event)
    for the new event. The PMU reset code initialises the counter in a
    disabled state, and armpmu_del() will disable the counter before it can
    be reused. Remove the redundant disable.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Reviewed-by: Anshuman Khandual <[email protected]>
    Tested-by: James Clark <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
phy: freescale: imx8m-pcie: assert phy reset and perst in power off [+ + +]
Author: Stefan Eichenberger <[email protected]>
Date:   Wed Mar 5 15:43:16 2025 +0100

    phy: freescale: imx8m-pcie: assert phy reset and perst in power off
    
    commit aecb63e88c5e5fb9afb782a1577264c76f179af9 upstream.
    
    Ensure the PHY reset and perst is asserted during power-off to
    guarantee it is in a reset state upon repeated power-on calls. This
    resolves an issue where the PHY may not properly initialize during
    subsequent power-on cycles. Power-on will deassert the reset at the
    appropriate time after tuning the PHY parameters.
    
    During suspend/resume cycles, we observed that the PHY PLL failed to
    lock during resume when the CPU temperature increased from 65C to 75C.
    The observed errors were:
      phy phy-32f00000.pcie-phy.3: phy poweron failed --> -110
      imx6q-pcie 33800000.pcie: waiting for PHY ready timeout!
      imx6q-pcie 33800000.pcie: PM: dpm_run_callback(): genpd_resume_noirq+0x0/0x80 returns -110
      imx6q-pcie 33800000.pcie: PM: failed to resume noirq: error -110
    
    This resulted in a complete CPU freeze, which is resolved by ensuring
    the PHY is in reset during power-on, thus preventing PHY PLL failures.
    
    Cc: [email protected]
    Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver")
    Signed-off-by: Stefan Eichenberger <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pinctrl: qcom: Clear latched interrupt status when changing IRQ type [+ + +]
Author: Stephan Gerhold <[email protected]>
Date:   Wed Mar 12 14:19:27 2025 +0100

    pinctrl: qcom: Clear latched interrupt status when changing IRQ type
    
    commit e225128c3f8be879e7d4eb71a25949e188b420ae upstream.
    
    When submitting the TLMM test driver, Bjorn reported that some of the test
    cases are failing for GPIOs that not are backed by PDC (i.e. "non-wakeup"
    GPIOs that are handled directly in pinctrl-msm). Basically, lingering
    latched interrupt state is still being delivered at IRQ request time, e.g.:
    
      ok 1 tlmm_test_silent_rising
      tlmm_test_silent_falling: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
      Expected atomic_read(&priv->intr_count) == 0, but
          atomic_read(&priv->intr_count) == 1 (0x1)
      not ok 2 tlmm_test_silent_falling
      tlmm_test_silent_low: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
      Expected atomic_read(&priv->intr_count) == 0, but
          atomic_read(&priv->intr_count) == 1 (0x1)
      not ok 3 tlmm_test_silent_low
      ok 4 tlmm_test_silent_high
    
    Whether to report interrupts that came in while the IRQ was unclaimed
    doesn't seem to be well-defined in the Linux IRQ API. However, looking
    closer at these specific cases, we're actually reporting events that do not
    match the interrupt type requested by the driver:
    
     1. After "ok 1 tlmm_test_silent_rising", the GPIO is in low state and
        configured for IRQF_TRIGGER_RISING.
    
     2. (a) In preparation for "tlmm_test_silent_falling", the GPIO is switched
            to high state. The rising interrupt gets latched.
        (b) The GPIO is re-configured for IRQF_TRIGGER_FALLING, but the latched
            interrupt isn't cleared.
        (c) The IRQ handler is called for the latched interrupt, but there
            wasn't any falling edge.
    
     3. (a) For "tlmm_test_silent_low", the GPIO remains in high state.
        (b) The GPIO is re-configured for IRQF_TRIGGER_LOW. This seems to
            result in a phantom interrupt that gets latched.
        (c) The IRQ handler is called for the latched interrupt, but the GPIO
            isn't in low state.
    
     4. (a) For "tlmm_test_silent_high", the GPIO is switched to low state.
        (b) This doesn't result in a latched interrupt, because RAW_STATUS_EN
            was cleared when masking the level-triggered interrupt.
    
    Fix this by clearing the interrupt state whenever making any changes to the
    interrupt configuration. This includes previously disabled interrupts, but
    also any changes to interrupt polarity or detection type.
    
    With this change, all 16 test cases are now passing for the non-wakeup
    GPIOs in the TLMM.
    
    Cc: [email protected]
    Fixes: cf9d052aa600 ("pinctrl: qcom: Don't clear pending interrupts when enabling")
    Reported-by: Bjorn Andersson <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]/
    Signed-off-by: Stephan Gerhold <[email protected]>
    Tested-by: Bjorn Andersson <[email protected]>
    Reviewed-by: Bjorn Andersson <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pm: cpupower: bench: Prevent NULL dereference on malloc failure [+ + +]
Author: Zhongqiu Han <[email protected]>
Date:   Wed Feb 19 20:27:15 2025 +0800

    pm: cpupower: bench: Prevent NULL dereference on malloc failure
    
    [ Upstream commit 208baa3ec9043a664d9acfb8174b332e6b17fb69 ]
    
    If malloc returns NULL due to low memory, 'config' pointer can be NULL.
    Add a check to prevent NULL dereference.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Zhongqiu Han <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas() [+ + +]
Author: Nathan Lynch <[email protected]>
Date:   Thu May 30 19:44:12 2024 -0500

    powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()
    
    commit 0974d03eb479384466d828d65637814bee6b26d7 upstream.
    
    Smatch warns:
    
      arch/powerpc/kernel/rtas.c:1932 __do_sys_rtas() warn: potential
      spectre issue 'args.args' [r] (local cap)
    
    The 'nargs' and 'nret' locals come directly from a user-supplied
    buffer and are used as indexes into a small stack-based array and as
    inputs to copy_to_user() after they are subject to bounds checks.
    
    Use array_index_nospec() after the bounds checks to clamp these values
    for speculative execution.
    
    Signed-off-by: Nathan Lynch <[email protected]>
    Reported-by: Breno Leitao <[email protected]>
    Reviewed-by: Breno Leitao <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://msgid.link/[email protected]
    [Minor context change fixed]
    Signed-off-by: Cliff Liu <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ptp: ocp: fix start time alignment in ptp_ocp_signal_set [+ + +]
Author: Sagi Maimon <[email protected]>
Date:   Tue Apr 15 08:31:31 2025 +0300

    ptp: ocp: fix start time alignment in ptp_ocp_signal_set
    
    [ Upstream commit 2a5970d5aaff8f3e33ce3bfaa403ae88c40de40d ]
    
    In ptp_ocp_signal_set, the start time for periodic signals is not
    aligned to the next period boundary. The current code rounds up the
    start time and divides by the period but fails to multiply back by
    the period, causing misaligned signal starts. Fix this by multiplying
    the rounded-up value by the period to ensure the start time is the
    closest next period.
    
    Fixes: 4bd46bb037f8e ("ptp: ocp: Use DIV64_U64_ROUND_UP for rounding.")
    Signed-off-by: Sagi Maimon <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pwm: fsl-ftm: Handle clk_get_rate() returning 0 [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Tue Apr 1 12:29:01 2025 +0200

    pwm: fsl-ftm: Handle clk_get_rate() returning 0
    
    [ Upstream commit 928446a5302eee30ebb32075c0db5dda5a138fb7 ]
    
    Considering that the driver doesn't enable the used clocks (and also
    that clk_get_rate() returns 0 if CONFIG_HAVE_CLK is unset) better check
    the return value of clk_get_rate() for being non-zero before dividing by
    it.
    
    Fixes: 3479bbd1e1f8 ("pwm: fsl-ftm: More relaxed permissions for updating period")
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Link: https://lore.kernel.org/r/b68351a51017035651bc62ad3146afcb706874f0.1743501688.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config() [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 1 12:28:59 2025 +0200

    pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config()
    
    [ Upstream commit 7ca59947b5fcf94e7ea4029d1bd0f7c41500a161 ]
    
    With CONFIG_COMPILE_TEST && !CONFIG_HAVE_CLK, pwm_mediatek_config() has a
    divide-by-zero in the following line:
    
            do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm]));
    
    due to the fact that the !CONFIG_HAVE_CLK version of clk_get_rate()
    returns zero.
    
    This is presumably just a theoretical problem: COMPILE_TEST overrides
    the dependency on RALINK which would select COMMON_CLK.  Regardless it's
    a good idea to check for the error explicitly to avoid divide-by-zero.
    
    Fixes the following warning:
    
      drivers/pwm/pwm-mediatek.o: warning: objtool: .text: unexpected end of section
    
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Link: https://lore.kernel.org/r/fb56444939325cc173e752ba199abd7aeae3bf12.1742852847.git.jpoimboe@kernel.org
    [ukleinek: s/CONFIG_CLK/CONFIG_HAVE_CLK/]
    Fixes: caf065f8fd58 ("pwm: Add MediaTek PWM support")
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Link: https://lore.kernel.org/r/9e78a0796acba3435553ed7db1c7965dcffa6215.1743501688.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pwm: rcar: Improve register calculation [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Tue Apr 1 12:29:00 2025 +0200

    pwm: rcar: Improve register calculation
    
    [ Upstream commit e7327c193014a4d8666e9c1cda09cf2c060518e8 ]
    
    There were several issues in the function rcar_pwm_set_counter():
    
     - The u64 values period_ns and duty_ns were cast to int on function
       call which might loose bits on 32 bit architectures.
       Fix: Make parameters to rcar_pwm_set_counter() u64
     - The algorithm divided by the result of a division which looses
       precision.
       Fix: Make use of mul_u64_u64_div_u64()
     - The calculated values were just masked to fit the respective register
       fields which again might loose bits.
       Fix: Explicitly check for overlow
    
    Implement the respective fixes.
    
    A side effect of fixing the 2nd issue is that there is no division by 0
    if clk_get_rate() returns 0.
    
    Fixes: ed6c1476bf7f ("pwm: Add support for R-Car PWM Timer")
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Link: https://lore.kernel.org/r/ab3dac794b2216cc1cc56d65c93dd164f8bd461b.1743501688.git.u.kleine-koenig@baylibre.com
    [ukleinek: Added an explicit #include <linux/bitfield.h> to please the
    0day build bot]
    Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/cma: Fix workqueue crash in cma_netevent_work_handler [+ + +]
Author: Sharath Srinivasan <[email protected]>
Date:   Wed Mar 26 14:05:32 2025 -0700

    RDMA/cma: Fix workqueue crash in cma_netevent_work_handler
    
    commit 45f5dcdd049719fb999393b30679605f16ebce14 upstream.
    
    struct rdma_cm_id has member "struct work_struct net_work"
    that is reused for enqueuing cma_netevent_work_handler()s
    onto cma_wq.
    
    Below crash[1] can occur if more than one call to
    cma_netevent_callback() occurs in quick succession,
    which further enqueues cma_netevent_work_handler()s for the
    same rdma_cm_id, overwriting any previously queued work-item(s)
    that was just scheduled to run i.e. there is no guarantee
    the queued work item may run between two successive calls
    to cma_netevent_callback() and the 2nd INIT_WORK would overwrite
    the 1st work item (for the same rdma_cm_id), despite grabbing
    id_table_lock during enqueue.
    
    Also drgn analysis [2] indicates the work item was likely overwritten.
    
    Fix this by moving the INIT_WORK() to __rdma_create_id(),
    so that it doesn't race with any existing queue_work() or
    its worker thread.
    
    [1] Trimmed crash stack:
    =============================================
    BUG: kernel NULL pointer dereference, address: 0000000000000008
    kworker/u256:6 ... 6.12.0-0...
    Workqueue:  cma_netevent_work_handler [rdma_cm] (rdma_cm)
    RIP: 0010:process_one_work+0xba/0x31a
    Call Trace:
     worker_thread+0x266/0x3a0
     kthread+0xcf/0x100
     ret_from_fork+0x31/0x50
     ret_from_fork_asm+0x1a/0x30
    =============================================
    
    [2] drgn crash analysis:
    
    >>> trace = prog.crashed_thread().stack_trace()
    >>> trace
    (0)  crash_setup_regs (./arch/x86/include/asm/kexec.h:111:15)
    (1)  __crash_kexec (kernel/crash_core.c:122:4)
    (2)  panic (kernel/panic.c:399:3)
    (3)  oops_end (arch/x86/kernel/dumpstack.c:382:3)
    ...
    (8)  process_one_work (kernel/workqueue.c:3168:2)
    (9)  process_scheduled_works (kernel/workqueue.c:3310:3)
    (10) worker_thread (kernel/workqueue.c:3391:4)
    (11) kthread (kernel/kthread.c:389:9)
    
    Line workqueue.c:3168 for this kernel version is in process_one_work():
    3168    strscpy(worker->desc, pwq->wq->name, WORKER_DESC_LEN);
    
    >>> trace[8]["work"]
    *(struct work_struct *)0xffff92577d0a21d8 = {
            .data = (atomic_long_t){
                    .counter = (s64)536870912,    <=== Note
            },
            .entry = (struct list_head){
                    .next = (struct list_head *)0xffff924d075924c0,
                    .prev = (struct list_head *)0xffff924d075924c0,
            },
            .func = (work_func_t)cma_netevent_work_handler+0x0 = 0xffffffffc2cec280,
    }
    
    Suspicion is that pwq is NULL:
    >>> trace[8]["pwq"]
    (struct pool_workqueue *)<absent>
    
    In process_one_work(), pwq is assigned from:
    struct pool_workqueue *pwq = get_work_pwq(work);
    
    and get_work_pwq() is:
    static struct pool_workqueue *get_work_pwq(struct work_struct *work)
    {
            unsigned long data = atomic_long_read(&work->data);
    
            if (data & WORK_STRUCT_PWQ)
                    return work_struct_pwq(data);
            else
                    return NULL;
    }
    
    WORK_STRUCT_PWQ is 0x4:
    >>> print(repr(prog['WORK_STRUCT_PWQ']))
    Object(prog, 'enum work_flags', value=4)
    
    But work->data is 536870912 which is 0x20000000.
    So, get_work_pwq() returns NULL and we crash in process_one_work():
    3168    strscpy(worker->desc, pwq->wq->name, WORKER_DESC_LEN);
    =============================================
    
    Fixes: 925d046e7e52 ("RDMA/core: Add a netevent notifier to cma")
    Cc: [email protected]
    Co-developed-by: Håkon Bugge <[email protected]>
    Signed-off-by: Håkon Bugge <[email protected]>
    Signed-off-by: Sharath Srinivasan <[email protected]>
    Reviewed-by: Patrisious Haddad <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
RDMA/core: Silence oversized kvmalloc() warning [+ + +]
Author: Shay Drory <[email protected]>
Date:   Wed Mar 19 14:42:21 2025 +0200

    RDMA/core: Silence oversized kvmalloc() warning
    
    [ Upstream commit 9a0e6f15029e1a8a21e40f06fd05aa52b7f063de ]
    
    syzkaller triggered an oversized kvmalloc() warning.
    Silence it by adding __GFP_NOWARN.
    
    syzkaller log:
     WARNING: CPU: 7 PID: 518 at mm/util.c:665 __kvmalloc_node_noprof+0x175/0x180
     CPU: 7 UID: 0 PID: 518 Comm: c_repro Not tainted 6.11.0-rc6+ #6
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
     RIP: 0010:__kvmalloc_node_noprof+0x175/0x180
     RSP: 0018:ffffc90001e67c10 EFLAGS: 00010246
     RAX: 0000000000000100 RBX: 0000000000000400 RCX: ffffffff8149d46b
     RDX: 0000000000000000 RSI: ffff8881030fae80 RDI: 0000000000000002
     RBP: 000000712c800000 R08: 0000000000000100 R09: 0000000000000000
     R10: ffffc90001e67c10 R11: 0030ae0601000000 R12: 0000000000000000
     R13: 0000000000000000 R14: 00000000ffffffff R15: 0000000000000000
     FS:  00007fde79159740(0000) GS:ffff88813bdc0000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 0000000020000180 CR3: 0000000105eb4005 CR4: 00000000003706b0
     DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
     Call Trace:
      <TASK>
      ib_umem_odp_get+0x1f6/0x390
      mlx5_ib_reg_user_mr+0x1e8/0x450
      ib_uverbs_reg_mr+0x28b/0x440
      ib_uverbs_write+0x7d3/0xa30
      vfs_write+0x1ac/0x6c0
      ksys_write+0x134/0x170
      ? __sanitizer_cov_trace_pc+0x1c/0x50
      do_syscall_64+0x50/0x110
      entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    Fixes: 37824952dc8f ("RDMA/odp: Use kvcalloc for the dma_list and page_list")
    Signed-off-by: Shay Drory <[email protected]>
    Link: https://patch.msgid.link/c6cb92379de668be94894f49c2cfa40e73f94d56.1742388096.git.leonro@nvidia.com
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/hns: Fix wrong maximum DMA segment size [+ + +]
Author: Chengchang Tang <[email protected]>
Date:   Thu Mar 27 19:47:24 2025 +0800

    RDMA/hns: Fix wrong maximum DMA segment size
    
    [ Upstream commit 9beb2c91fb86e0be70a5833c6730441fa3c9efa8 ]
    
    Set maximum DMA segment size to 2G instead of UINT_MAX due to HW limit.
    
    Fixes: e0477b34d9d1 ("RDMA: Explicitly pass in the dma_device to ib_register_device")
    Link: https://patch.msgid.link/r/[email protected]
    Signed-off-by: Chengchang Tang <[email protected]>
    Signed-off-by: Junxian Huang <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() [+ + +]
Author: Yue Haibing <[email protected]>
Date:   Mon Mar 24 20:31:32 2025 +0800

    RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
    
    [ Upstream commit 95ba3850fed03e01b422ab5d7943aeba130c9723 ]
    
    drivers/infiniband/hw/usnic/usnic_ib_main.c:590
     usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
    
    Make usnic_ib_device_add() return NULL on fail path, also remove
    useless NULL check for usnic_ib_discover_pf()
    
    Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
    Link: https://patch.msgid.link/r/[email protected]
    Signed-off-by: Yue Haibing <[email protected]>
    Reviewed-by: Zhu Yanjun <[email protected]>
    Reviewed-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "f2fs: rebuild nat_bits during umount" [+ + +]
Author: Chao Yu <[email protected]>
Date:   Wed Mar 5 19:07:12 2025 +0800

    Revert "f2fs: rebuild nat_bits during umount"
    
    [ Upstream commit 19426c4988aa85298c1b4caf2889d37ec5c80fea ]
    
    This reverts commit 94c821fb286b545d37549ff30a0c341e066f0d6c.
    
    It reports that there is potential corruption in node footer,
    the most suspious feature is nat_bits, let's revert recovery
    related code.
    
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "PCI: Avoid reset when disabled via sysfs" [+ + +]
Author: Alex Williamson <[email protected]>
Date:   Mon Apr 14 15:18:23 2025 -0600

    Revert "PCI: Avoid reset when disabled via sysfs"
    
    commit bc0b828ef6e561081ebc4c758d0c4d166bb9829c upstream.
    
    This reverts commit 479380efe1625e251008d24b2810283db60d6fcd.
    
    The reset_method attribute on a PCI device is only intended to manage the
    availability of function scoped resets for a device.  It was never intended
    to restrict resets targeting the bus or slot.
    
    In introducing a restriction that each device must support function level
    reset by testing pci_reset_supported(), we essentially create a catch-22,
    that a device must have a function scope reset in order to support bus/slot
    reset, when we use bus/slot reset to effect a reset of a device that does
    not support a function scoped reset, especially multi-function devices.
    
    This breaks the majority of uses cases where vfio-pci uses bus/slot resets
    to manage multifunction devices that do not support function scoped resets.
    
    Fixes: 479380efe162 ("PCI: Avoid reset when disabled via sysfs")
    Reported-by: Cal Peake <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]
    Reported-by: Athul Krishna <[email protected]>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220010
    Signed-off-by: Alex Williamson <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Kevin Tian <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "smb: client: Fix netns refcount imbalance causing leaks and use-after-free" [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Wed Apr 2 13:26:47 2025 -0700

    Revert "smb: client: Fix netns refcount imbalance causing leaks and use-after-free"
    
    commit c707193a17128fae2802d10cbad7239cc57f0c95 upstream.
    
    This reverts commit 4e7f1644f2ac6d01dc584f6301c3b1d5aac4eaef.
    
    The commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after
    rmmod") is not only a bogus fix for LOCKDEP null-ptr-deref but also
    introduces a real issue, TCP sockets leak, which will be explained in
    detail in the next revert.
    
    Also, CNA assigned CVE-2024-54680 to it but is rejecting it. [0]
    
    Thus, we are reverting the commit and its follow-up commit 4e7f1644f2ac
    ("smb: client: Fix netns refcount imbalance causing leaks and
    use-after-free").
    
    Link: https://lore.kernel.org/all/2025040248-tummy-smilingly-4240@gregkh/ #[0]
    Fixes: 4e7f1644f2ac ("smb: client: Fix netns refcount imbalance causing leaks and use-after-free")
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Cc: [email protected]
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "smb: client: fix TCP timers deadlock after rmmod" [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Wed Apr 2 13:26:48 2025 -0700

    Revert "smb: client: fix TCP timers deadlock after rmmod"
    
    commit 95d2b9f693ff2a1180a23d7d59acc0c4e72f4c41 upstream.
    
    This reverts commit e9f2517a3e18a54a3943c098d2226b245d488801.
    
    Commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after
    rmmod") is intended to fix a null-ptr-deref in LOCKDEP, which is
    mentioned as CVE-2024-54680, but is actually did not fix anything;
    The issue can be reproduced on top of it. [0]
    
    Also, it reverted the change by commit ef7134c7fc48 ("smb: client:
    Fix use-after-free of network namespace.") and introduced a real
    issue by reviving the kernel TCP socket.
    
    When a reconnect happens for a CIFS connection, the socket state
    transitions to FIN_WAIT_1.  Then, inet_csk_clear_xmit_timers_sync()
    in tcp_close() stops all timers for the socket.
    
    If an incoming FIN packet is lost, the socket will stay at FIN_WAIT_1
    forever, and such sockets could be leaked up to net.ipv4.tcp_max_orphans.
    
    Usually, FIN can be retransmitted by the peer, but if the peer aborts
    the connection, the issue comes into reality.
    
    I warned about this privately by pointing out the exact report [1],
    but the bogus fix was finally merged.
    
    So, we should not stop the timers to finally kill the connection on
    our side in that case, meaning we must not use a kernel socket for
    TCP whose sk->sk_net_refcnt is 0.
    
    The kernel socket does not have a reference to its netns to make it
    possible to tear down netns without cleaning up every resource in it.
    
    For example, tunnel devices use a UDP socket internally, but we can
    destroy netns without removing such devices and let it complete
    during exit.  Otherwise, netns would be leaked when the last application
    died.
    
    However, this is problematic for TCP sockets because TCP has timers to
    close the connection gracefully even after the socket is close()d.  The
    lifetime of the socket and its netns is different from the lifetime of
    the underlying connection.
    
    If the socket user does not maintain the netns lifetime, the timer could
    be fired after the socket is close()d and its netns is freed up, resulting
    in use-after-free.
    
    Actually, we have seen so many similar issues and converted such sockets
    to have a reference to netns.
    
    That's why I converted the CIFS client socket to have a reference to
    netns (sk->sk_net_refcnt == 1), which is somehow mentioned as out-of-scope
    of CIFS and technically wrong in e9f2517a3e18, but **is in-scope and right
    fix**.
    
    Regarding the LOCKDEP issue, we can prevent the module unload by
    bumping the module refcount when switching the LOCKDDEP key in
    sock_lock_init_class_and_name(). [2]
    
    For a while, let's revert the bogus fix.
    
    Note that now we can use sk_net_refcnt_upgrade() for the socket
    conversion, but I'll do so later separately to make backport easy.
    
    Link: https://lore.kernel.org/all/[email protected]/ #[0]
    Link: https://lore.kernel.org/netdev/[email protected]/ #[1]
    Link: https://lore.kernel.org/lkml/[email protected]/ #[2]
    Fixes: e9f2517a3e18 ("smb: client: fix TCP timers deadlock after rmmod")
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Cc: [email protected]
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()" [+ + +]
Author: Johannes Berg <[email protected]>
Date:   Fri Apr 11 16:13:34 2025 +0200

    Revert "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()"
    
    [ Upstream commit 0937cb5f345c79d702b4d0d744e2a2529b551cb2 ]
    
    This reverts commit a104042e2bf6528199adb6ca901efe7b60c2c27f.
    
    Since the original bug seems to have been around for years,
    but a new issue was report with the fix, revert the fix for
    now. We have a couple of weeks to figure it out for this
    release, if needed.
    
    Reported-by: Bert Karwatzki <[email protected]>
    Closes: https://lore.kernel.org/linux-wireless/[email protected]
    Fixes: a104042e2bf6 ("wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()")
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
riscv: Avoid fortify warning in syscall_get_arguments() [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Wed Apr 9 14:24:46 2025 -0700

    riscv: Avoid fortify warning in syscall_get_arguments()
    
    commit adf53771a3123df99ca26e38818760fbcf5c05d0 upstream.
    
    When building with CONFIG_FORTIFY_SOURCE=y and W=1, there is a warning
    because of the memcpy() in syscall_get_arguments():
    
      In file included from include/linux/string.h:392,
                       from include/linux/bitmap.h:13,
                       from include/linux/cpumask.h:12,
                       from arch/riscv/include/asm/processor.h:55,
                       from include/linux/sched.h:13,
                       from kernel/ptrace.c:13:
      In function 'fortify_memcpy_chk',
          inlined from 'syscall_get_arguments.isra' at arch/riscv/include/asm/syscall.h:66:2:
      include/linux/fortify-string.h:580: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]
        580 |                         __read_overflow2_field(q_size_field, size);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      cc1: all warnings being treated as errors
    
    The fortified memcpy() routine enforces that the source is not overread
    and the destination is not overwritten if the size of either field and
    the size of the copy are known at compile time. The memcpy() in
    syscall_get_arguments() intentionally overreads from a1 to a5 in
    'struct pt_regs' but this is bigger than the size of a1.
    
    Normally, this could be solved by wrapping a1 through a5 with
    struct_group() but there was already a struct_group() applied to these
    members in commit bba547810c66 ("riscv: tracing: Fix
    __write_overflow_field in ftrace_partial_regs()").
    
    Just avoid memcpy() altogether and write the copying of args from regs
    manually, which clears up the warning at the expense of three extra
    lines of code.
    
    Signed-off-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Dmitry V. Levin <[email protected]>
    Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API")
    Cc: [email protected]
    Link: https://lore.kernel.org/r/20250409-riscv-avoid-fortify-warning-syscall_get_arguments-v1-1-7853436d4755@kernel.org
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

riscv: KGDB: Do not inline arch_kgdb_breakpoint() [+ + +]
Author: WangYuli <[email protected]>
Date:   Fri Apr 11 15:32:21 2025 +0800

    riscv: KGDB: Do not inline arch_kgdb_breakpoint()
    
    [ Upstream commit 3af4bec9c1db3f003be4d5ae09b6a737e4be1612 ]
    
    The arch_kgdb_breakpoint() function defines the kgdb_compiled_break
    symbol using inline assembly.
    
    There's a potential issue where the compiler might inline
    arch_kgdb_breakpoint(), which would then define the kgdb_compiled_break
    symbol multiple times, leading to fail to link vmlinux.o.
    
    This isn't merely a potential compilation problem. The intent here
    is to determine the global symbol address of kgdb_compiled_break,
    and if this function is inlined multiple times, it would logically
    be a grave error.
    
    Link: https://lore.kernel.org/all/[email protected]/
    Link: https://lore.kernel.org/all/[email protected]/
    Link: https://lore.kernel.org/all/[email protected]/
    Fixes: fe89bd2be866 ("riscv: Add KGDB support")
    Co-developed-by: Huacai Chen <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: WangYuli <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

riscv: KGDB: Remove ".option norvc/.option rvc" for kgdb_compiled_break [+ + +]
Author: WangYuli <[email protected]>
Date:   Fri Apr 11 15:32:22 2025 +0800

    riscv: KGDB: Remove ".option norvc/.option rvc" for kgdb_compiled_break
    
    [ Upstream commit 550c2aa787d1b06efcb11de1877354502a1237f2 ]
    
    [ Quoting Samuel Holland: ]
    
      This is a separate issue, but using ".option rvc" here is a bug.
      It will unconditionally enable the C extension for the rest of
      the file, even if the kernel is being built with CONFIG_RISCV_ISA_C=n.
    
    [ Quoting Palmer Dabbelt: ]
    
      We're just looking at the address of kgdb_compiled_break, so it's
      fine if it ends up as a c.ebreak.
    
    [ Quoting Alexandre Ghiti: ]
    
      .option norvc is used to prevent the assembler from using compressed
      instructions, but it's generally used when we need to ensure the
      size of the instructions that are used, which is not the case here
      as noted by Palmer since we only care about the address. So yes
      it will work fine with C enabled :)
    
    So let's just remove them all.
    
    Link: https://lore.kernel.org/all/[email protected]/
    Link: https://lore.kernel.org/all/mhng-69513841-5068-441d-be8f-2aeebdc56a08@palmer-ri-x1c9a/
    Link: https://lore.kernel.org/all/[email protected]/
    Fixes: fe89bd2be866 ("riscv: Add KGDB support")
    Cc: Samuel Holland <[email protected]>
    Cc: Palmer Dabbelt <[email protected]>
    Cc: Alexandre Ghiti <[email protected]>
    Signed-off-by: WangYuli <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

riscv: Properly export reserved regions in /proc/iomem [+ + +]
Author: Björn Töpel <[email protected]>
Date:   Wed Apr 9 20:21:27 2025 +0200

    riscv: Properly export reserved regions in /proc/iomem
    
    [ Upstream commit e94eb7ea6f206e229791761a5fdf9389f8dbd183 ]
    
    The /proc/iomem represents the kernel's memory map. Regions marked
    with "Reserved" tells the user that the range should not be tampered
    with. Kexec-tools, when using the older kexec_load syscall relies on
    the "Reserved" regions to build the memory segments, that will be the
    target of the new kexec'd kernel.
    
    The RISC-V port tries to expose all reserved regions to userland, but
    some regions were not properly exposed: Regions that resided in both
    the "regular" and reserved memory block, e.g. the EFI Memory Map. A
    missing entry could result in reserved memory being overwritten.
    
    It turns out, that arm64, and loongarch had a similar issue a while
    back:
    
      commit d91680e687f4 ("arm64: Fix /proc/iomem for reserved but not memory regions")
      commit 50d7ba36b916 ("arm64: export memblock_reserve()d regions via /proc/iomem")
    
    Similar to the other ports, resolve the issue by splitting the regions
    in an arch initcall, since we need a working allocator.
    
    Fixes: ffe0e5261268 ("RISC-V: Improve init_resources()")
    Signed-off-by: Björn Töpel <[email protected]>
    Reviewed-by: Alexandre Ghiti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Ghiti <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
rtnl: add helper to check if a notification is needed [+ + +]
Author: Victor Nogueira <[email protected]>
Date:   Fri Dec 8 16:28:42 2023 -0300

    rtnl: add helper to check if a notification is needed
    
    [ Upstream commit 8439109b76a3c405808383bf9dd532fc4b9c2dbd ]
    
    Building on the rtnl_has_listeners helper, add the rtnl_notify_needed
    helper to check if we can bail out early in the notification routines.
    
    Reviewed-by: Jiri Pirko <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Victor Nogueira <[email protected]>
    Signed-off-by: Pedro Tammela <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
    Signed-off-by: Sasha Levin <[email protected]>

rtnl: add helper to check if rtnl group has listeners [+ + +]
Author: Jamal Hadi Salim <[email protected]>
Date:   Fri Dec 8 16:28:41 2023 -0300

    rtnl: add helper to check if rtnl group has listeners
    
    [ Upstream commit c5e2a973448d958feb7881e4d875eac59fdeff3d ]
    
    As of today, rtnl code creates a new skb and unconditionally fills and
    broadcasts it to the relevant group. For most operations this is okay
    and doesn't waste resources in general.
    
    When operations are done without the rtnl_lock, as in tc-flower, such
    skb allocation, message fill and no-op broadcasting can happen in all
    cores of the system, which contributes to system pressure and wastes
    precious cpu cycles when no one will receive the built message.
    
    Introduce this helper so rtnetlink operations can simply check if someone
    is listening and then proceed if necessary.
    
    Reviewed-by: Jiri Pirko <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Victor Nogueira <[email protected]>
    Signed-off-by: Pedro Tammela <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
    Signed-off-by: Sasha Levin <[email protected]>

 
scsi: hisi_sas: Enable force phy when SATA disk directly connected [+ + +]
Author: Xingui Yang <[email protected]>
Date:   Wed Mar 12 17:51:34 2025 +0800

    scsi: hisi_sas: Enable force phy when SATA disk directly connected
    
    [ Upstream commit 8aa580cd92843b60d4d6331f3b0a9e8409bb70eb ]
    
    when a SATA disk is directly connected the SAS controller determines the
    disk to which I/Os are delivered based on the port ID in the DQ entry.
    
    When many phys are disconnected and reconnect, the port ID of phys were
    changed and used by other link, resulting in I/O being sent to incorrect
    disk. Data inconsistency on the SATA disk may occur during I/O retries
    using the old port ID. So enable force phy, then force the command to be
    executed in a certain phy, and if the actual phy ID of the port does not
    match the phy configured in the command, the chip will stop delivering the
    I/O to disk.
    
    Fixes: ce60689e12dd ("scsi: hisi_sas: add v3 code to send ATA frame")
    Signed-off-by: Xingui Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Yihang Li <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: iscsi: Fix missing scsi_host_put() in error path [+ + +]
Author: Miaoqian Lin <[email protected]>
Date:   Tue Mar 18 17:43:43 2025 +0800

    scsi: iscsi: Fix missing scsi_host_put() in error path
    
    [ Upstream commit 72eea84a1092b50a10eeecfeba4b28ac9f1312ab ]
    
    Add goto to ensure scsi_host_put() is called in all error paths of
    iscsi_set_host_param() function. This fixes a potential memory leak when
    strlen() check fails.
    
    Fixes: ce51c8170084 ("scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()")
    Signed-off-by: Miaoqian Lin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Mike Christie <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: megaraid_sas: Block zero-length ATA VPD inquiry [+ + +]
Author: Chandrakanth Patil <[email protected]>
Date:   Thu Apr 3 01:07:34 2025 +0530

    scsi: megaraid_sas: Block zero-length ATA VPD inquiry
    
    commit aad9945623ab4029ae7789609fb6166c97976c62 upstream.
    
    A firmware bug was observed where ATA VPD inquiry commands with a
    zero-length data payload were not handled and failed with a non-standard
    status code of 0xf0.
    
    Avoid sending ATA VPD inquiry commands without data payload by setting
    the device no_vpd_size flag to 1. In addition, if the firmware returns a
    status code of 0xf0, set scsi_cmnd->result to CHECK_CONDITION to
    facilitate proper error handling.
    
    Suggested-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Chandrakanth Patil <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Ryan Lahfa <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: st: Fix array overflow in st_setup() [+ + +]
Author: Kai Mäkisara <[email protected]>
Date:   Tue Mar 11 13:25:14 2025 +0200

    scsi: st: Fix array overflow in st_setup()
    
    [ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
    
    Change the array size to follow parms size instead of a fixed value.
    
    Reported-by: Chenyuan Yang <[email protected]>
    Closes: https://lore.kernel.org/linux-scsi/CALGdzuoubbra4xKOJcsyThdk5Y1BrAmZs==wbqjbkAgmKS39Aw@mail.gmail.com/
    Signed-off-by: Kai Mäkisara <[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: spc: Fix RSOC parameter data header size [+ + +]
Author: Chaohai Chen <[email protected]>
Date:   Wed Jan 15 15:07:39 2025 +0800

    scsi: target: spc: Fix RSOC parameter data header size
    
    [ Upstream commit b50532318793d28a7628c1ffc129a2226e83e495 ]
    
    The SPC document states that "The COMMAND DATA LENGTH field indicates the
    length in bytes of the command descriptor list".
    
    The length should be subtracted by 4 to represent the length of the
    description list, not 3.
    
    Signed-off-by: Chaohai Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Dmitry Bogdanov <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ufs: exynos: Ensure consistent phy reference counts [+ + +]
Author: Peter Griffin <[email protected]>
Date:   Wed Mar 19 15:30:21 2025 +0000

    scsi: ufs: exynos: Ensure consistent phy reference counts
    
    commit 7f05fd9a3b6fb3a9abc5a748307d11831c03175f upstream.
    
    ufshcd_link_startup() can call ufshcd_vops_link_startup_notify()
    multiple times when retrying. This causes the phy reference count to
    keep increasing and the phy to not properly re-initialize.
    
    If the phy has already been previously powered on, first issue a
    phy_power_off() and phy_exit(), before re-initializing and powering on
    again.
    
    Signed-off-by: Peter Griffin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 3d73b200f989 ("scsi: ufs: ufs-exynos: Change ufs phy control sequence")
    Cc: [email protected]
    Reviewed-by: Bart Van Assche <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sctp: detect and prevent references to a freed transport in sendmsg [+ + +]
Author: Ricardo Cañuelo Navarro <[email protected]>
Date:   Fri Apr 4 16:53:21 2025 +0200

    sctp: detect and prevent references to a freed transport in sendmsg
    
    commit f1a69a940de58b16e8249dff26f74c8cc59b32be upstream.
    
    sctp_sendmsg() re-uses associations and transports when possible by
    doing a lookup based on the socket endpoint and the message destination
    address, and then sctp_sendmsg_to_asoc() sets the selected transport in
    all the message chunks to be sent.
    
    There's a possible race condition if another thread triggers the removal
    of that selected transport, for instance, by explicitly unbinding an
    address with setsockopt(SCTP_SOCKOPT_BINDX_REM), after the chunks have
    been set up and before the message is sent. This can happen if the send
    buffer is full, during the period when the sender thread temporarily
    releases the socket lock in sctp_wait_for_sndbuf().
    
    This causes the access to the transport data in
    sctp_outq_select_transport(), when the association outqueue is flushed,
    to result in a use-after-free read.
    
    This change avoids this scenario by having sctp_transport_free() signal
    the freeing of the transport, tagging it as "dead". In order to do this,
    the patch restores the "dead" bit in struct sctp_transport, which was
    removed in
    commit 47faa1e4c50e ("sctp: remove the dead field of sctp_transport").
    
    Then, in the scenario where the sender thread has released the socket
    lock in sctp_wait_for_sndbuf(), the bit is checked again after
    re-acquiring the socket lock to detect the deletion. This is done while
    holding a reference to the transport to prevent it from being freed in
    the process.
    
    If the transport was deleted while the socket lock was relinquished,
    sctp_sendmsg_to_asoc() will return -EAGAIN to let userspace retry the
    send.
    
    The bug was found by a private syzbot instance (see the error report [1]
    and the C reproducer that triggers it [2]).
    
    Link: https://people.igalia.com/rcn/kernel_logs/20250402__KASAN_slab-use-after-free_Read_in_sctp_outq_select_transport.txt [1]
    Link: https://people.igalia.com/rcn/kernel_logs/20250402__KASAN_slab-use-after-free_Read_in_sctp_outq_select_transport__repro.c [2]
    Cc: [email protected]
    Fixes: df132eff4638 ("sctp: clear the transport of some out_chunk_list chunks in sctp_assoc_rm_peer")
    Suggested-by: Xin Long <[email protected]>
    Signed-off-by: Ricardo Cañuelo Navarro <[email protected]>
    Acked-by: Xin Long <[email protected]>
    Link: https://patch.msgid.link/20250404-kasan_slab-use-after-free_read_in_sctp_outq_select_transport__20250404-v1-1-5ce4a0b78ef2@igalia.com
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests/futex: futex_waitv wouldblock test should fail [+ + +]
Author: Edward Liaw <[email protected]>
Date:   Fri Apr 4 22:12:20 2025 +0000

    selftests/futex: futex_waitv wouldblock test should fail
    
    [ Upstream commit 7d50e00fef2832e98d7e06bbfc85c1d66ee110ca ]
    
    Testcase should fail if -EWOULDBLOCK is not returned when expected value
    differs from actual value from the waiter.
    
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 9d57f7c79748920636f8293d2f01192d702fe390 ("selftests: futex: Test sys_futex_waitv() wouldblock")
    Signed-off-by: Edward Liaw <[email protected]>
    Reviewed-by: Thomas Gleixner <[email protected]>
    Reviewed-by: André Almeida <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
 
selftests/mm: generate a temporary mountpoint for cgroup filesystem [+ + +]
Author: Mark Brown <[email protected]>
Date:   Fri Apr 4 17:42:32 2025 +0100

    selftests/mm: generate a temporary mountpoint for cgroup filesystem
    
    commit 9c02223e2d9df5cb37c51aedb78f3960294e09b5 upstream.
    
    Currently if the filesystem for the cgroups version it wants to use is not
    mounted charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh tests
    will attempt to mount it on the hard coded path /dev/cgroup/memory,
    deleting that directory when the test finishes.  This will fail if there
    is not a preexisting directory at that path, and since the directory is
    deleted subsequent runs of the test will fail.  Instead of relying on this
    hard coded directory name use mktemp to generate a temporary directory to
    use as a mountpoint, fixing both the assumption and the disruption caused
    by deleting a preexisting directory.
    
    This means that if the relevant cgroup filesystem is not already mounted
    then we rely on having coreutils (which provides mktemp) installed.  I
    suspect that many current users are relying on having things automounted
    by default, and given that the script relies on bash it's probably not an
    unreasonable requirement.
    
    Link: https://lkml.kernel.org/r/20250404-kselftest-mm-cgroup2-detection-v1-1-3dba6d32ba8c@kernel.org
    Fixes: 209376ed2a84 ("selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting")
    Signed-off-by: Mark Brown <[email protected]>
    Cc: Aishwarya TCV <[email protected]>
    Cc: Mark Brown <[email protected]>
    Cc: Mina Almasry <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Waiman Long <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests: mptcp: add mptcp_lib_wait_local_port_listen [+ + +]
Author: Geliang Tang <[email protected]>
Date:   Tue Nov 28 15:18:59 2023 -0800

    selftests: mptcp: add mptcp_lib_wait_local_port_listen
    
    commit 9369777c29395730cec967e7d0f48aed872b7110 upstream.
    
    To avoid duplicated code in different MPTCP selftests, we can add
    and use helpers defined in mptcp_lib.sh.
    
    wait_local_port_listen() helper is defined in diag.sh, mptcp_connect.sh,
    mptcp_join.sh and simult_flows.sh, export it into mptcp_lib.sh and
    rename it with mptcp_lib_ prefix. Use this new helper in all these
    scripts.
    
    Note: We only have IPv4 connections in this helper, not looking at IPv6
    (tcp6) but that's OK because we only have IPv4 connections here in diag.sh.
    
    Reviewed-by: Matthieu Baerts <[email protected]>
    Signed-off-by: Geliang Tang <[email protected]>
    Signed-off-by: Mat Martineau <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
    [ Conflict in diag.sh, because commit 1f24ba67ba49 ("selftests: mptcp:
      diag: check CURRESTAB counters") that is more recent that the one
      here, has been backported in this kernel version before, introducing
      chk_msk_cestab() helper in the same context. wait_local_port_listen()
      was still the same as in the original, and can then be simply removed
      from diag.sh. ]
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

selftests: mptcp: close fd_in before returning in main_loop [+ + +]
Author: Geliang Tang <[email protected]>
Date:   Fri Mar 28 15:27:18 2025 +0100

    selftests: mptcp: close fd_in before returning in main_loop
    
    commit c183165f87a486d5879f782c05a23c179c3794ab upstream.
    
    The file descriptor 'fd_in' is opened when cfg_input is configured, but
    not closed in main_loop(), this patch fixes it.
    
    Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
    Cc: [email protected]
    Co-developed-by: Cong Liu <[email protected]>
    Signed-off-by: Cong Liu <[email protected]>
    Signed-off-by: Geliang Tang <[email protected]>
    Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

selftests: mptcp: fix incorrect fd checks in main_loop [+ + +]
Author: Cong Liu <[email protected]>
Date:   Fri Mar 28 15:27:17 2025 +0100

    selftests: mptcp: fix incorrect fd checks in main_loop
    
    commit 7335d4ac812917c16e04958775826d12d481c92d upstream.
    
    Fix a bug where the code was checking the wrong file descriptors
    when opening the input files. The code was checking 'fd' instead
    of 'fd_in', which could lead to incorrect error handling.
    
    Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
    Cc: [email protected]
    Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")
    Co-developed-by: Geliang Tang <[email protected]>
    Signed-off-by: Geliang Tang <[email protected]>
    Signed-off-by: Cong Liu <[email protected]>
    Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sign-file,extract-cert: avoid using deprecated ERR_get_error_line() [+ + +]
Author: Jan Stancek <[email protected]>
Date:   Fri Jul 12 09:11:15 2024 +0200

    sign-file,extract-cert: avoid using deprecated ERR_get_error_line()
    
    commit 467d60eddf55588add232feda325da7215ddaf30 upstream.
    
    ERR_get_error_line() is deprecated since OpenSSL 3.0.
    
    Use ERR_peek_error_line() instead, and combine display_openssl_errors()
    and drain_openssl_errors() to a single function where parameter decides
    if it should consume errors silently.
    
    Signed-off-by: Jan Stancek <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: R Nageswara Sastry <[email protected]>
    Reviewed-by: Neal Gompa <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sign-file,extract-cert: move common SSL helper functions to a header [+ + +]
Author: Jan Stancek <[email protected]>
Date:   Fri Jul 12 09:11:14 2024 +0200

    sign-file,extract-cert: move common SSL helper functions to a header
    
    commit 300e6d4116f956b035281ec94297dc4dc8d4e1d3 upstream.
    
    Couple error handling helpers are repeated in both tools, so
    move them to a common header.
    
    Signed-off-by: Jan Stancek <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: R Nageswara Sastry <[email protected]>
    Reviewed-by: Neal Gompa <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3 [+ + +]
Author: Jan Stancek <[email protected]>
Date:   Fri Sep 20 19:52:48 2024 +0300

    sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3
    
    commit 558bdc45dfb2669e1741384a0c80be9c82fa052c upstream.
    
    ENGINE API has been deprecated since OpenSSL version 3.0 [1].
    Distros have started dropping support from headers and in future
    it will likely disappear also from library.
    
    It has been superseded by the PROVIDER API, so use it instead
    for OPENSSL MAJOR >= 3.
    
    [1] https://github.com/openssl/openssl/blob/master/README-ENGINES.md
    
    [jarkko: fixed up alignment issues reported by checkpatch.pl --strict]
    
    Signed-off-by: Jan Stancek <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: R Nageswara Sastry <[email protected]>
    Reviewed-by: Neal Gompa <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smb3 client: fix open hardlink on deferred close file error [+ + +]
Author: Chunjie Zhu <[email protected]>
Date:   Sat Apr 12 21:15:55 2025 -0500

    smb3 client: fix open hardlink on deferred close file error
    
    commit 262b73ef442e68e53220b9d6fc5a0d08b557fa42 upstream.
    
    The following Python script results in unexpected behaviour when run on
    a CIFS filesystem against a Windows Server:
    
        # Create file
        fd = os.open('test', os.O_WRONLY|os.O_CREAT)
        os.write(fd, b'foo')
        os.close(fd)
    
        # Open and close the file to leave a pending deferred close
        fd = os.open('test', os.O_RDONLY|os.O_DIRECT)
        os.close(fd)
    
        # Try to open the file via a hard link
        os.link('test', 'new')
        newfd = os.open('new', os.O_RDONLY|os.O_DIRECT)
    
    The final open returns EINVAL due to the server returning
    STATUS_INVALID_PARAMETER. The root cause of this is that the client
    caches lease keys per inode, but the spec requires them to be related to
    the filename which causes problems when hard links are involved:
    
    From MS-SMB2 section 3.3.5.9.11:
    
    "The server MUST attempt to locate a Lease by performing a lookup in the
    LeaseTable.LeaseList using the LeaseKey in the
    SMB2_CREATE_REQUEST_LEASE_V2 as the lookup key. If a lease is found,
    Lease.FileDeleteOnClose is FALSE, and Lease.Filename does not match the
    file name for the incoming request, the request MUST be failed with
    STATUS_INVALID_PARAMETER"
    
    On client side, we first check the context of file open, if it hits above
    conditions, we first close all opening files which are belong to the same
    inode, then we do open the hard link file.
    
    Cc: [email protected]
    Signed-off-by: Chunjie Zhu <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smb311 client: fix missing tcon check when mounting with linux/posix extensions [+ + +]
Author: Steve French <[email protected]>
Date:   Sun Apr 6 14:09:19 2025 -0500

    smb311 client: fix missing tcon check when mounting with linux/posix extensions
    
    commit b365b9d404b7376c60c91cd079218bfef11b7822 upstream.
    
    When mounting the same share twice, once with the "linux" mount parameter
    (or equivalently "posix") and then once without (or e.g. with "nolinux"),
    we were incorrectly reusing the same tree connection for both mounts.
    This meant that the first mount of the share on the client, would
    cause subsequent mounts of that same share on the same client to
    ignore that mount parm ("linux" vs. "nolinux") and incorrectly reuse
    the same tcon.
    
    Cc: [email protected]
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe() [+ + +]
Author: Chenyuan Yang <[email protected]>
Date:   Wed Feb 12 15:35:18 2025 -0600

    soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
    
    commit c8222ef6cf29dd7cad21643228f96535cc02b327 upstream.
    
    soc_dev_attr->revision could be NULL, thus,
    a pointer check is added to prevent potential NULL pointer dereference.
    This is similar to the fix in commit 3027e7b15b02
    ("ice: Fix some null pointer dereference issues in ice_ptp.c").
    
    This issue is found by our static analysis tool.
    
    Signed-off-by: Chenyuan Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 3253b7b7cd44 ("soc: samsung: Add exynos chipid driver support")
    Cc: <[email protected]>
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sparc/mm: avoid calling arch_enter/leave_lazy_mmu() in set_ptes [+ + +]
Author: Ryan Roberts <[email protected]>
Date:   Mon Mar 3 14:15:38 2025 +0000

    sparc/mm: avoid calling arch_enter/leave_lazy_mmu() in set_ptes
    
    commit eb61ad14c459b54f71f76331ca35d12fa3eb8f98 upstream.
    
    With commit 1a10a44dfc1d ("sparc64: implement the new page table range
    API") set_ptes was added to the sparc architecture.  The implementation
    included calling arch_enter/leave_lazy_mmu() calls.
    
    The patch removes the usage of arch_enter/leave_lazy_mmu() since this
    implies nesting of lazy mmu regions which is not supported.  Without this
    fix, lazy mmu mode is effectively disabled because we exit the mode after
    the first set_ptes:
    
    remap_pte_range()
      -> arch_enter_lazy_mmu()
      -> set_ptes()
          -> arch_enter_lazy_mmu()
          -> arch_leave_lazy_mmu()
      -> arch_leave_lazy_mmu()
    
    Powerpc suffered the same problem and fixed it in a corresponding way with
    commit 47b8def9358c ("powerpc/mm: Avoid calling
    arch_enter/leave_lazy_mmu() in set_ptes").
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 1a10a44dfc1d ("sparc64: implement the new page table range API")
    Signed-off-by: Ryan Roberts <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Acked-by: Andreas Larsson <[email protected]>
    Acked-by: Juergen Gross <[email protected]>
    Cc: Borislav Betkov <[email protected]>
    Cc: Boris Ostrovsky <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: David S. Miller <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Juegren Gross <[email protected]>
    Cc: Matthew Wilcow (Oracle) <[email protected]>
    Cc: Thomas Gleinxer <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sparc/mm: disable preemption in lazy mmu mode [+ + +]
Author: Ryan Roberts <[email protected]>
Date:   Mon Mar 3 14:15:37 2025 +0000

    sparc/mm: disable preemption in lazy mmu mode
    
    commit a1d416bf9faf4f4871cb5a943614a07f80a7d70f upstream.
    
    Since commit 38e0edb15bd0 ("mm/apply_to_range: call pte function with lazy
    updates") it's been possible for arch_[enter|leave]_lazy_mmu_mode() to be
    called without holding a page table lock (for the kernel mappings case),
    and therefore it is possible that preemption may occur while in the lazy
    mmu mode.  The Sparc lazy mmu implementation is not robust to preemption
    since it stores the lazy mode state in a per-cpu structure and does not
    attempt to manage that state on task switch.
    
    Powerpc had the same issue and fixed it by explicitly disabling preemption
    in arch_enter_lazy_mmu_mode() and re-enabling in
    arch_leave_lazy_mmu_mode().  See commit b9ef323ea168 ("powerpc/64s:
    Disable preemption in hash lazy mmu mode").
    
    Given Sparc's lazy mmu mode is based on powerpc's, let's fix it in the
    same way here.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 38e0edb15bd0 ("mm/apply_to_range: call pte function with lazy updates")
    Signed-off-by: Ryan Roberts <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Acked-by: Andreas Larsson <[email protected]>
    Acked-by: Juergen Gross <[email protected]>
    Cc: Borislav Betkov <[email protected]>
    Cc: Boris Ostrovsky <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: David S. Miller <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Juegren Gross <[email protected]>
    Cc: Matthew Wilcow (Oracle) <[email protected]>
    Cc: Thomas Gleinxer <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
spi: cadence-qspi: Fix probe on AM62A LP SK [+ + +]
Author: Miquel Raynal <[email protected]>
Date:   Wed Mar 5 21:09:32 2025 +0100

    spi: cadence-qspi: Fix probe on AM62A LP SK
    
    commit b8665a1b49f5498edb7b21d730030c06b7348a3c upstream.
    
    In 2020, there's been an unnoticed change which rightfully attempted to
    report probe deferrals upon DMA absence by checking the return value of
    dma_request_chan_by_mask(). By doing so, it also reported errors which
    were simply ignored otherwise, likely on purpose.
    
    This change actually turned a void return into an error code. Hence, not
    only the -EPROBE_DEFER error codes but all error codes got reported to
    the callers, now failing to probe in the absence of Rx DMA channel,
    despite the fact that DMA seems to not be supported natively by many
    implementations.
    
    Looking at the history, this change probably led to:
    ad2775dc3fc5 ("spi: cadence-quadspi: Disable the DAC for Intel LGM SoC")
    f724c296f2f2 ("spi: cadence-quadspi: fix Direct Access Mode disable for SoCFPGA")
    
    In my case, the AM62A LP SK core octo-SPI node from TI does not
    advertise any DMA channel, hinting that there is likely no support for
    it, but yet when the support for the am654 compatible was added, DMA
    seemed to be used, so just discarding its use with the
    CQSPI_DISABLE_DAC_MODE quirk for this compatible does not seem the
    correct approach.
    
    Let's get change the return condition back to:
    - return a probe deferral error if we get one
    - ignore the return value otherwise
    The "error" log level was however likely too high for something that is
    expected to fail, so let's lower it arbitrarily to the info level.
    
    Fixes: 935da5e5100f ("mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel")
    Cc: [email protected]
    Signed-off-by: Miquel Raynal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
string: Add load_unaligned_zeropad() code path to sized_strscpy() [+ + +]
Author: Peter Collingbourne <[email protected]>
Date:   Wed Apr 2 17:06:59 2025 -0700

    string: Add load_unaligned_zeropad() code path to sized_strscpy()
    
    commit d94c12bd97d567de342fd32599e7cd9e50bfa140 upstream.
    
    The call to read_word_at_a_time() in sized_strscpy() is problematic
    with MTE because it may trigger a tag check fault when reading
    across a tag granule (16 bytes) boundary. To make this code
    MTE compatible, let's start using load_unaligned_zeropad()
    on architectures where it is available (i.e. architectures that
    define CONFIG_DCACHE_WORD_ACCESS). Because load_unaligned_zeropad()
    takes care of page boundaries as well as tag granule boundaries,
    also disable the code preventing crossing page boundaries when using
    load_unaligned_zeropad().
    
    Signed-off-by: Peter Collingbourne <[email protected]>
    Link: https://linux-review.googlesource.com/id/If4b22e43b5a4ca49726b4bf98ada827fdf755548
    Fixes: 94ab5b61ee16 ("kasan, arm64: enable CONFIG_KASAN_HW_TAGS")
    Cc: [email protected]
    Reviewed-by: Catalin Marinas <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tc: Ensure we have enough buffer space when sending filter netlink notifications [+ + +]
Author: Toke Høiland-Jørgensen <[email protected]>
Date:   Mon Apr 7 12:55:34 2025 +0200

    tc: Ensure we have enough buffer space when sending filter netlink notifications
    
    [ Upstream commit 369609fc6272c2f6ad666ba4fd913f3baf32908f ]
    
    The tfilter_notify() and tfilter_del_notify() functions assume that
    NLMSG_GOODSIZE is always enough to dump the filter chain. This is not
    always the case, which can lead to silent notify failures (because the
    return code of tfilter_notify() is not always checked). In particular,
    this can lead to NLM_F_ECHO not being honoured even though an action
    succeeds, which forces userspace to create workarounds[0].
    
    Fix this by increasing the message size if dumping the filter chain into
    the allocated skb fails. Use the size of the incoming skb as a size hint
    if set, so we can start at a larger value when appropriate.
    
    To trigger this, run the following commands:
    
     # ip link add type veth
     # tc qdisc replace dev veth0 root handle 1: fq_codel
     # tc -echo filter add dev veth0 parent 1: u32 match u32 0 0 $(for i in $(seq 32); do echo action pedit munge ip dport set 22; done)
    
    Before this fix, tc just returns:
    
    Not a filter(cmd 2)
    
    After the fix, we get the correct echo:
    
    added filter dev veth0 parent 1: protocol all pref 49152 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 terminal flowid not_in_hw
      match 00000000/00000000 at 0
            action order 1:  pedit action pass keys 1
            index 1 ref 1 bind 1
            key #0  at 20: val 00000016 mask ffff0000
    [repeated 32 times]
    
    [0] https://github.com/openvswitch/ovs/commit/106ef21860c935e5e0017a88bf42b94025c4e511
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Frode Nordahl <[email protected]>
    Closes: https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/2018500
    Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
    Reviewed-by: Jiri Pirko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
test suite: use %zu to print size_t [+ + +]
Author: Matthew Wilcox (Oracle) <[email protected]>
Date:   Wed Apr 2 20:33:11 2025 -0400

    test suite: use %zu to print size_t
    
    [ Upstream commit a30951d09c33c899f0e4aca80eb87fad5f10ecfa ]
    
    On 32-bit, we can't use %lu to print a size_t variable and gcc warns us
    about it.  Shame it doesn't warn about it on 64-bit.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: cc86e0c2f306 ("radix tree test suite: add support for slab bulk APIs")
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Signed-off-by: Liam R. Howlett <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
thermal/drivers/rockchip: Add missing rk3328 mapping entry [+ + +]
Author: Trevor Woerner <[email protected]>
Date:   Fri Feb 7 12:50:47 2025 -0500

    thermal/drivers/rockchip: Add missing rk3328 mapping entry
    
    commit ee022e5cae052e0c67ca7c5fec0f2e7bc897c70e upstream.
    
    The mapping table for the rk3328 is missing the entry for -25C which is
    found in the TRM section 9.5.2 "Temperature-to-code mapping".
    
    NOTE: the kernel uses the tsadc_q_sel=1'b1 mode which is defined as:
          4096-<code in table>. Whereas the table in the TRM gives the code
          "3774" for -25C, the kernel uses 4096-3774=322.
    
    [Dragan Simic] : "After going through the RK3308 and RK3328 TRMs, as
      well as through the downstream kernel code, it seems we may have
      some troubles at our hands.  Let me explain, please.
    
      To sum it up, part 1 of the RK3308 TRM v1.1 says on page 538 that
      the equation for the output when tsadc_q_sel equals 1 is (4096 -
      tsadc_q), while part 1 of the RK3328 TRM v1.2 says that the output
      equation is (1024 - tsadc_q) in that case.
    
      The downstream kernel code, however, treats the RK3308 and RK3328
      tables and their values as being the same.  It even mentions 1024 as
      the "offset" value in a comment block for the rk_tsadcv3_control()
      function, just like the upstream code does, which is obviously wrong
      "offset" value when correlated with the table on page 544 of part 1
      of the RK3308 TRM v1.1.
    
      With all this in mind, it's obvious that more work is needed to make
      it clear where's the actual mistake (it could be that the TRM is
      wrong), which I'll volunteer for as part of the SoC binning project.
      In the meantime, this patch looks fine as-is to me, by offering
      what's a clear improvement to the current state of the upstream
      code"
    
    Link: https://opensource.rock-chips.com/images/9/97/Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf
    Cc: [email protected]
    Fixes: eda519d5f73e ("thermal: rockchip: Support the RK3328 SOC in thermal driver")
    Signed-off-by: Trevor Woerner <[email protected]>
    Reviewed-by: Dragan Simic <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Daniel Lezcano <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tipc: fix memory leak in tipc_link_xmit [+ + +]
Author: Tung Nguyen <[email protected]>
Date:   Thu Apr 3 09:24:31 2025 +0000

    tipc: fix memory leak in tipc_link_xmit
    
    [ Upstream commit 69ae94725f4fc9e75219d2d69022029c5b24bc9a ]
    
    In case the backlog transmit queue for system-importance messages is overloaded,
    tipc_link_xmit() returns -ENOBUFS but the skb list is not purged. This leads to
    memory leak and failure when a skb is allocated.
    
    This commit fixes this issue by purging the skb list before tipc_link_xmit()
    returns.
    
    Fixes: 365ad353c256 ("tipc: reduce risk of user starvation during link congestion")
    Signed-off-by: Tung Nguyen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tpm, tpm_tis: Fix timeout handling when waiting for TPM status [+ + +]
Author: Jonathan McDowell <[email protected]>
Date:   Wed Mar 12 07:31:57 2025 +0200

    tpm, tpm_tis: Fix timeout handling when waiting for TPM status
    
    commit 7146dffa875cd00e7a7f918e1fce79c7593ac1fa upstream.
    
    The change to only use interrupts to handle supported status changes
    introduced an issue when it is necessary to poll for the status. Rather
    than checking for the status after sleeping the code now sleeps after
    the check. This means a correct, but slower, status change on the part
    of the TPM can be missed, resulting in a spurious timeout error,
    especially on a more loaded system. Switch back to sleeping *then*
    checking. An up front check of the status has been done at the start of
    the function, so this does not cause an additional delay when the status
    is already what we're looking for.
    
    Cc: [email protected] # v6.4+
    Fixes: e87fcf0dc2b4 ("tpm, tpm_tis: Only handle supported interrupts")
    Signed-off-by: Jonathan McDowell <[email protected]>
    Reviewed-by: Michal Suchánek <[email protected]>
    Reviewed-by: Lino Sanfilippo <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tpm, tpm_tis: Workaround failed command reception on Infineon devices [+ + +]
Author: Jonathan McDowell <[email protected]>
Date:   Wed Mar 12 07:26:18 2025 +0200

    tpm, tpm_tis: Workaround failed command reception on Infineon devices
    
    [ Upstream commit de9e33df7762abbfc2a1568291f2c3a3154c6a9d ]
    
    Some Infineon devices have a issue where the status register will get
    stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not
    simply a matter of requiring a longer timeout; the work around is to
    retry the command submission. Add appropriate logic to do this in the
    send path.
    
    This is fixed in later firmware revisions, but those are not always
    available, and cannot generally be easily updated from outside a
    firmware environment.
    
    Testing has been performed with a simple repeated loop of doing a
    TPM2_CC_GET_CAPABILITY for TPM_CAP_PROP_MANUFACTURER using the Go code
    at:
    
      https://the.earth.li/~noodles/tpm-stuff/timeout-reproducer-simple.go
    
    It can take several hours to reproduce, and several million operations.
    
    Signed-off-by: Jonathan McDowell <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tpm: do not start chip while suspended [+ + +]
Author: Thadeu Lima de Souza Cascardo <[email protected]>
Date:   Fri Feb 7 15:07:46 2025 -0300

    tpm: do not start chip while suspended
    
    commit 17d253af4c2c8a2acf84bb55a0c2045f150b7dfd upstream.
    
    Checking TPM_CHIP_FLAG_SUSPENDED after the call to tpm_find_get_ops() can
    lead to a spurious tpm_chip_start() call:
    
    [35985.503771] i2c i2c-1: Transfer while suspended
    [35985.503796] WARNING: CPU: 0 PID: 74 at drivers/i2c/i2c-core.h:56 __i2c_transfer+0xbe/0x810
    [35985.503802] Modules linked in:
    [35985.503808] CPU: 0 UID: 0 PID: 74 Comm: hwrng Tainted: G        W          6.13.0-next-20250203-00005-gfa0cb5642941 #19 9c3d7f78192f2d38e32010ac9c90fdc71109ef6f
    [35985.503814] Tainted: [W]=WARN
    [35985.503817] Hardware name: Google Morphius/Morphius, BIOS Google_Morphius.13434.858.0 10/26/2023
    [35985.503819] RIP: 0010:__i2c_transfer+0xbe/0x810
    [35985.503825] Code: 30 01 00 00 4c 89 f7 e8 40 fe d8 ff 48 8b 93 80 01 00 00 48 85 d2 75 03 49 8b 16 48 c7 c7 0a fb 7c a7 48 89 c6 e8 32 ad b0 fe <0f> 0b b8 94 ff ff ff e9 33 04 00 00 be 02 00 00 00 83 fd 02 0f 5
    [35985.503828] RSP: 0018:ffffa106c0333d30 EFLAGS: 00010246
    [35985.503833] RAX: 074ba64aa20f7000 RBX: ffff8aa4c1167120 RCX: 0000000000000000
    [35985.503836] RDX: 0000000000000000 RSI: ffffffffa77ab0e4 RDI: 0000000000000001
    [35985.503838] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
    [35985.503841] R10: 0000000000000004 R11: 00000001000313d5 R12: ffff8aa4c10f1820
    [35985.503843] R13: ffff8aa4c0e243c0 R14: ffff8aa4c1167250 R15: ffff8aa4c1167120
    [35985.503846] FS:  0000000000000000(0000) GS:ffff8aa4eae00000(0000) knlGS:0000000000000000
    [35985.503849] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [35985.503852] CR2: 00007fab0aaf1000 CR3: 0000000105328000 CR4: 00000000003506f0
    [35985.503855] Call Trace:
    [35985.503859]  <TASK>
    [35985.503863]  ? __warn+0xd4/0x260
    [35985.503868]  ? __i2c_transfer+0xbe/0x810
    [35985.503874]  ? report_bug+0xf3/0x210
    [35985.503882]  ? handle_bug+0x63/0xb0
    [35985.503887]  ? exc_invalid_op+0x16/0x50
    [35985.503892]  ? asm_exc_invalid_op+0x16/0x20
    [35985.503904]  ? __i2c_transfer+0xbe/0x810
    [35985.503913]  tpm_cr50_i2c_transfer_message+0x24/0xf0
    [35985.503920]  tpm_cr50_i2c_read+0x8e/0x120
    [35985.503928]  tpm_cr50_request_locality+0x75/0x170
    [35985.503935]  tpm_chip_start+0x116/0x160
    [35985.503942]  tpm_try_get_ops+0x57/0x90
    [35985.503948]  tpm_find_get_ops+0x26/0xd0
    [35985.503955]  tpm_get_random+0x2d/0x80
    
    Don't move forward with tpm_chip_start() inside tpm_try_get_ops(), unless
    TPM_CHIP_FLAG_SUSPENDED is not set. tpm_find_get_ops() will return NULL in
    such a failure case.
    
    Fixes: 9265fed6db60 ("tpm: Lock TPM chip in tpm_pm_suspend() first")
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Cc: [email protected]
    Cc: Jerry Snitselaar <[email protected]>
    Cc: Mike Seo <[email protected]>
    Cc: Jarkko Sakkinen <[email protected]>
    Reviewed-by: Jerry Snitselaar <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing: Do not add length to print format in synthetic events [+ + +]
Author: Steven Rostedt <[email protected]>
Date:   Mon Apr 7 15:41:39 2025 -0400

    tracing: Do not add length to print format in synthetic events
    
    commit e1a453a57bc76be678bd746f84e3d73f378a9511 upstream.
    
    The following causes a vsnprintf fault:
    
      # echo 's:wake_lat char[] wakee; u64 delta;' >> /sys/kernel/tracing/dynamic_events
      # echo 'hist:keys=pid:ts=common_timestamp.usecs if !(common_flags & 0x18)' > /sys/kernel/tracing/events/sched/sched_waking/trigger
      # echo 'hist:keys=next_pid:delta=common_timestamp.usecs-$ts:onmatch(sched.sched_waking).trace(wake_lat,next_comm,$delta)' > /sys/kernel/tracing/events/sched/sched_switch/trigger
    
    Because the synthetic event's "wakee" field is created as a dynamic string
    (even though the string copied is not). The print format to print the
    dynamic string changed from "%*s" to "%s" because another location
    (__set_synth_event_print_fmt()) exported this to user space, and user
    space did not need that. But it is still used in print_synth_event(), and
    the output looks like:
    
              <idle>-0       [001] d..5.   193.428167: wake_lat: wakee=(efault)sshd-sessiondelta=155
        sshd-session-879     [001] d..5.   193.811080: wake_lat: wakee=(efault)kworker/u34:5delta=58
              <idle>-0       [002] d..5.   193.811198: wake_lat: wakee=(efault)bashdelta=91
                bash-880     [002] d..5.   193.811371: wake_lat: wakee=(efault)kworker/u35:2delta=21
              <idle>-0       [001] d..5.   193.811516: wake_lat: wakee=(efault)sshd-sessiondelta=129
        sshd-session-879     [001] d..5.   193.967576: wake_lat: wakee=(efault)kworker/u34:5delta=50
    
    The length isn't needed as the string is always nul terminated. Just print
    the string and not add the length (which was hard coded to the max string
    length anyway).
    
    Cc: [email protected]
    Cc: Mathieu Desnoyers <[email protected]>
    Cc: Tom Zanussi <[email protected]>
    Cc: Douglas Raillard <[email protected]>
    Acked-by: Masami Hiramatsu (Google) <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Fixes: 4d38328eb442d ("tracing: Fix synth event printk format for str fields");
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Fix filter string testing [+ + +]
Author: Steven Rostedt <[email protected]>
Date:   Thu Apr 17 18:30:03 2025 -0400

    tracing: Fix filter string testing
    
    commit a8c5b0ed89a3f2c81c6ae0b041394e6eea0e7024 upstream.
    
    The filter string testing uses strncpy_from_kernel/user_nofault() to
    retrieve the string to test the filter against. The if() statement was
    incorrect as it considered 0 as a fault, when it is only negative that it
    faulted.
    
    Running the following commands:
    
      # cd /sys/kernel/tracing
      # echo "filename.ustring ~ \"/proc*\"" > events/syscalls/sys_enter_openat/filter
      # echo 1 > events/syscalls/sys_enter_openat/enable
      # ls /proc/$$/maps
      # cat trace
    
    Would produce nothing, but with the fix it will produce something like:
    
          ls-1192    [007] .....  8169.828333: sys_openat(dfd: ffffffffffffff9c, filename: 7efc18359904, flags: 80000, mode: 0)
    
    Link: https://lore.kernel.org/all/CAEf4BzbVPQ=BjWztmEwBPRKHUwNfKBkS3kce-Rzka6zvbQeVpg@mail.gmail.com/
    
    Cc: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mathieu Desnoyers <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Fixes: 77360f9bbc7e5 ("tracing: Add test for user space strings when filtering on string pointers")
    Reported-by: Andrii Nakryiko <[email protected]>
    Reported-by: Mykyta Yatsenko <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER [+ + +]
Author: Gabriele Paoloni <[email protected]>
Date:   Fri Mar 21 18:08:21 2025 +0100

    tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
    
    [ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]
    
    When __ftrace_event_enable_disable invokes the class callback to
    unregister the event, the return value is not reported up to the
    caller, hence leading to event unregister failures being silently
    ignored.
    
    This patch assigns the ret variable to the invocation of the
    event unregister callback, so that its return value is stored
    and reported to the caller, and it raises a warning in case
    of error.
    
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Gabriele Paoloni <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

tracing: probe-events: Add comments about entry data storing code [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Thu Mar 27 21:19:54 2025 +0900

    tracing: probe-events: Add comments about entry data storing code
    
    [ Upstream commit bb9c6020f4c3a07a90dc36826cb5fbe83f09efd5 ]
    
    Add comments about entry data storing code to __store_entry_arg() and
    traceprobe_get_entry_data_size(). These are a bit complicated because of
    building the entry data storing code and scanning it.
    
    This just add comments, no behavior change.
    
    Link: https://lore.kernel.org/all/174061715004.501424.333819546601401102.stgit@devnote2/
    
    Reported-by: Steven Rostedt <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Reviewed-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udf: Fix inode_getblk() return value [+ + +]
Author: Jan Kara <[email protected]>
Date:   Wed Mar 12 16:18:39 2025 +0100

    udf: Fix inode_getblk() return value
    
    commit 6afdc60ec30b0a9390d11b7cebed79c857ce82aa upstream.
    
    Smatch noticed that inode_getblk() can return 1 on successful mapping of
    a block instead of expected 0 after commit b405c1e58b73 ("udf: refactor
    udf_next_aext() to handle error"). This could confuse some of the
    callers and lead to strange failures (although the one reported by
    Smatch in udf_mkdir() is impossible to trigger in practice). Fix the
    return value of inode_getblk().
    
    Link: https://lore.kernel.org/all/[email protected]
    Reported-by: Dan Carpenter <[email protected]>
    Reviewed-by: Carlos Maiolino <[email protected]>
    Fixes: b405c1e58b73 ("udf: refactor udf_next_aext() to handle error")
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
umount: Allow superblock owners to force umount [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Tue Mar 18 12:29:21 2025 -0400

    umount: Allow superblock owners to force umount
    
    [ Upstream commit e1ff7aa34dec7e650159fd7ca8ec6af7cc428d9f ]
    
    Loosen the permission check on forced umount to allow users holding
    CAP_SYS_ADMIN privileges in namespaces that are privileged with respect
    to the userns that originally mounted the filesystem.
    
    Signed-off-by: Trond Myklebust <[email protected]>
    Link: https://lore.kernel.org/r/12f212d4ef983714d065a6bb372fbb378753bf4c.1742315194.git.trond.myklebust@hammerspace.com
    Acked-by: "Eric W. Biederman" <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control() [+ + +]
Author: GONG Ruiqi <[email protected]>
Date:   Tue Jan 7 09:57:50 2025 +0800

    usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
    
    commit b0e525d7a22ea350e75e2aec22e47fcfafa4cacd upstream.
    
    The error handling for the case `con_index == 0` should involve dropping
    the pm usage counter, as ucsi_ccg_sync_control() gets it at the
    beginning. Fix it.
    
    Cc: stable <[email protected]>
    Fixes: e56aac6e5a25 ("usb: typec: fix potential array underflow in ucsi_ccg_sync_control()")
    Signed-off-by: GONG Ruiqi <[email protected]>
    Reviewed-by: Dan Carpenter <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [Minor context change fixed]
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: typec: fix potential array underflow in ucsi_ccg_sync_control() [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Mon Nov 11 14:08:06 2024 +0300

    usb: typec: fix potential array underflow in ucsi_ccg_sync_control()
    
    commit e56aac6e5a25630645607b6856d4b2a17b2311a5 upstream.
    
    The "command" variable can be controlled by the user via debugfs.  The
    worry is that if con_index is zero then "&uc->ucsi->connector[con_index
    - 1]" would be an array underflow.
    
    Fixes: 170a6726d0e2 ("usb: typec: ucsi: add support for separate DP altmode devices")
    Signed-off-by: Dan Carpenter <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [Minor context change fixed.
     13f2ec3115c8 ("usb: typec: ucsi: simplify command sending API") rename
     ucsi_ccg_sync_write to ucsi_ccg_sync_control in v6.11, so this patch is
     applied in ucsi_ccg_sync_write in v6.6.]
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vdpa/mlx5: Fix oversized null mkey longer than 32bit [+ + +]
Author: Si-Wei Liu <[email protected]>
Date:   Thu Feb 20 21:37:33 2025 +0200

    vdpa/mlx5: Fix oversized null mkey longer than 32bit
    
    commit a6097e0a54a5c24f8d577ffecbc35289ae281c2e upstream.
    
    create_user_mr() has correct code to count the number of null keys
    used to fill in a hole for the memory map. However, fill_indir()
    does not follow the same to cap the range up to the 1GB limit
    correspondingly. Fill in more null keys for the gaps in between,
    so that null keys are correctly populated.
    
    Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
    Cc: [email protected]
    Reported-by: Cong Meng <[email protected]>
    Signed-off-by: Si-Wei Liu <[email protected]>
    Signed-off-by: Dragos Tatulea <[email protected]>
    Acked-by: Eugenio Pérez <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Michael S. Tsirkin <[email protected]>
    Acked-by: Jason Wang <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
virtiofs: add filesystem context source name check [+ + +]
Author: Xiangsheng Hou <[email protected]>
Date:   Mon Apr 7 19:50:49 2025 +0800

    virtiofs: add filesystem context source name check
    
    commit a94fd938df2b1628da66b498aa0eeb89593bc7a2 upstream.
    
    In certain scenarios, for example, during fuzz testing, the source
    name may be NULL, which could lead to a kernel panic. Therefore, an
    extra check for the source name should be added.
    
    Fixes: a62a8ef9d97d ("virtio-fs: add virtiofs filesystem")
    Cc: <[email protected]> # all LTS kernels
    Signed-off-by: Xiangsheng Hou <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
wifi: at76c50x: fix use after free access in at76_disconnect [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Sun Mar 30 16:01:10 2025 +0530

    wifi: at76c50x: fix use after free access in at76_disconnect
    
    [ Upstream commit 27c7e63b3cb1a20bb78ed4a36c561ea4579fd7da ]
    
    The memory pointed to by priv is freed at the end of at76_delete_device
    function (using ieee80211_free_hw). But the code then accesses the udev
    field of the freed object to put the USB device. This may also lead to a
    memory leak of the usb device. Fix this by using udev from interface.
    
    Fixes: 29e20aa6c6af ("at76c50x-usb: fix use after free on failure path in at76_probe()")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi [+ + +]
Author: Manish Dharanenthiran <[email protected]>
Date:   Tue Feb 11 14:33:02 2025 +0530

    wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi
    
    [ Upstream commit 9a0dddfb30f120db3851627935851d262e4e7acb ]
    
    In certain cases, hardware might provide packets with a
    length greater than the maximum native Wi-Fi header length.
    This can lead to accessing and modifying fields in the header
    within the ath12k_dp_rx_h_undecap_nwifi function for
    DP_RX_DECAP_TYPE_NATIVE_WIFI decap type and
    potentially resulting in invalid data access and memory corruption.
    
    Add a sanity check before processing the SKB to prevent invalid
    data access in the undecap native Wi-Fi function for the
    DP_RX_DECAP_TYPE_NATIVE_WIFI decap type.
    
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
    
    Signed-off-by: Manish Dharanenthiran <[email protected]>
    Signed-off-by: Tamizh Chelvam Raja <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jeff Johnson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process [+ + +]
Author: P Praneesh <[email protected]>
Date:   Mon Dec 23 11:31:24 2024 +0530

    wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process
    
    [ Upstream commit 63fdc4509bcf483e79548de6bc08bf3c8e504bb3 ]
    
    Currently, ath12k_dp_mon_srng_process uses ath12k_hal_srng_src_get_next_entry
    to fetch the next entry from the destination ring. This is incorrect because
    ath12k_hal_srng_src_get_next_entry is intended for source rings, not destination
    rings. This leads to invalid entry fetches, causing potential data corruption or
    crashes due to accessing incorrect memory locations. This happens because the
    source ring and destination ring have different handling mechanisms and using
    the wrong function results in incorrect pointer arithmetic and ring management.
    
    To fix this issue, replace the call to ath12k_hal_srng_src_get_next_entry with
    ath12k_hal_srng_dst_get_next_entry in ath12k_dp_mon_srng_process. This ensures
    that the correct function is used for fetching entries from the destination
    ring, preventing invalid memory accesses.
    
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
    Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
    
    Signed-off-by: P Praneesh <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jeff Johnson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211: fix integer overflow in hwmp_route_info_get() [+ + +]
Author: Gavrilov Ilia <[email protected]>
Date:   Wed Feb 12 08:21:25 2025 +0000

    wifi: mac80211: fix integer overflow in hwmp_route_info_get()
    
    commit d00c0c4105e5ab8a6a13ed23d701cceb285761fa upstream.
    
    Since the new_metric and last_hop_metric variables can reach
    the MAX_METRIC(0xffffffff) value, an integer overflow may occur
    when multiplying them by 10/9. It can lead to incorrect behavior.
    
    Found by InfoTeCS on behalf of Linux Verification Center
    (linuxtesting.org) with SVACE.
    
    Fixes: a8d418d9ac25 ("mac80211: mesh: only switch path when new metric is at least 10% better")
    Cc: [email protected]
    Signed-off-by: Ilia Gavrilov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: mac80211: Purge vif txq in ieee80211_do_stop() [+ + +]
Author: Remi Pommarel <[email protected]>
Date:   Mon Mar 24 17:28:21 2025 +0100

    wifi: mac80211: Purge vif txq in ieee80211_do_stop()
    
    [ Upstream commit 378677eb8f44621ecc9ce659f7af61e5baa94d81 ]
    
    After ieee80211_do_stop() SKB from vif's txq could still be processed.
    Indeed another concurrent vif schedule_and_wake_txq call could cause
    those packets to be dequeued (see ieee80211_handle_wake_tx_queue())
    without checking the sdata current state.
    
    Because vif.drv_priv is now cleared in this function, this could lead to
    driver crash.
    
    For example in ath12k, ahvif is store in vif.drv_priv. Thus if
    ath12k_mac_op_tx() is called after ieee80211_do_stop(), ahvif->ah can be
    NULL, leading the ath12k_warn(ahvif->ah,...) call in this function to
    trigger the NULL deref below.
    
      Unable to handle kernel paging request at virtual address dfffffc000000001
      KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
      batman_adv: bat0: Interface deactivated: brbh1337
      Mem abort info:
        ESR = 0x0000000096000004
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x04: level 0 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
        CM = 0, WnR = 0, TnD = 0, TagAccess = 0
        GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
      [dfffffc000000001] address between user and kernel address ranges
      Internal error: Oops: 0000000096000004 [#1] SMP
      CPU: 1 UID: 0 PID: 978 Comm: lbd Not tainted 6.13.0-g633f875b8f1e #114
      Hardware name: HW (DT)
      pstate: 10000005 (nzcV daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : ath12k_mac_op_tx+0x6cc/0x29b8 [ath12k]
      lr : ath12k_mac_op_tx+0x174/0x29b8 [ath12k]
      sp : ffffffc086ace450
      x29: ffffffc086ace450 x28: 0000000000000000 x27: 1ffffff810d59ca4
      x26: ffffff801d05f7c0 x25: 0000000000000000 x24: 000000004000001e
      x23: ffffff8009ce4926 x22: ffffff801f9c0800 x21: ffffff801d05f7f0
      x20: ffffff8034a19f40 x19: 0000000000000000 x18: ffffff801f9c0958
      x17: ffffff800bc0a504 x16: dfffffc000000000 x15: ffffffc086ace4f8
      x14: ffffff801d05f83c x13: 0000000000000000 x12: ffffffb003a0bf03
      x11: 0000000000000000 x10: ffffffb003a0bf02 x9 : ffffff8034a19f40
      x8 : ffffff801d05f818 x7 : 1ffffff0069433dc x6 : ffffff8034a19ee0
      x5 : ffffff801d05f7f0 x4 : 0000000000000000 x3 : 0000000000000001
      x2 : 0000000000000000 x1 : dfffffc000000000 x0 : 0000000000000008
      Call trace:
       ath12k_mac_op_tx+0x6cc/0x29b8 [ath12k] (P)
       ieee80211_handle_wake_tx_queue+0x16c/0x260
       ieee80211_queue_skb+0xeec/0x1d20
       ieee80211_tx+0x200/0x2c8
       ieee80211_xmit+0x22c/0x338
       __ieee80211_subif_start_xmit+0x7e8/0xc60
       ieee80211_subif_start_xmit+0xc4/0xee0
       __ieee80211_subif_start_xmit_8023.isra.0+0x854/0x17a0
       ieee80211_subif_start_xmit_8023+0x124/0x488
       dev_hard_start_xmit+0x160/0x5a8
       __dev_queue_xmit+0x6f8/0x3120
       br_dev_queue_push_xmit+0x120/0x4a8
       __br_forward+0xe4/0x2b0
       deliver_clone+0x5c/0xd0
       br_flood+0x398/0x580
       br_dev_xmit+0x454/0x9f8
       dev_hard_start_xmit+0x160/0x5a8
       __dev_queue_xmit+0x6f8/0x3120
       ip6_finish_output2+0xc28/0x1b60
       __ip6_finish_output+0x38c/0x638
       ip6_output+0x1b4/0x338
       ip6_local_out+0x7c/0xa8
       ip6_send_skb+0x7c/0x1b0
       ip6_push_pending_frames+0x94/0xd0
       rawv6_sendmsg+0x1a98/0x2898
       inet_sendmsg+0x94/0xe0
       __sys_sendto+0x1e4/0x308
       __arm64_sys_sendto+0xc4/0x140
       do_el0_svc+0x110/0x280
       el0_svc+0x20/0x60
       el0t_64_sync_handler+0x104/0x138
       el0t_64_sync+0x154/0x158
    
    To avoid that, empty vif's txq at ieee80211_do_stop() so no packet could
    be dequeued after ieee80211_do_stop() (new packets cannot be queued
    because SDATA_STATE_RUNNING is cleared at this point).
    
    Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
    Signed-off-by: Remi Pommarel <[email protected]>
    Link: https://patch.msgid.link/ff7849e268562456274213c0476e09481a48f489.1742833382.git.repk@triplefau.lt
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue() [+ + +]
Author: Remi Pommarel <[email protected]>
Date:   Mon Mar 24 17:28:20 2025 +0100

    wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()
    
    [ Upstream commit a104042e2bf6528199adb6ca901efe7b60c2c27f ]
    
    The ieee80211 skb control block key (set when skb was queued) could have
    been removed before ieee80211_tx_dequeue() call. ieee80211_tx_dequeue()
    already called ieee80211_tx_h_select_key() to get the current key, but
    the latter do not update the key in skb control block in case it is
    NULL. Because some drivers actually use this key in their TX callbacks
    (e.g. ath1{1,2}k_mac_op_tx()) this could lead to the use after free
    below:
    
      BUG: KASAN: slab-use-after-free in ath11k_mac_op_tx+0x590/0x61c
      Read of size 4 at addr ffffff803083c248 by task kworker/u16:4/1440
    
      CPU: 3 UID: 0 PID: 1440 Comm: kworker/u16:4 Not tainted 6.13.0-ge128f627f404 #2
      Hardware name: HW (DT)
      Workqueue: bat_events batadv_send_outstanding_bcast_packet
      Call trace:
       show_stack+0x14/0x1c (C)
       dump_stack_lvl+0x58/0x74
       print_report+0x164/0x4c0
       kasan_report+0xac/0xe8
       __asan_report_load4_noabort+0x1c/0x24
       ath11k_mac_op_tx+0x590/0x61c
       ieee80211_handle_wake_tx_queue+0x12c/0x1c8
       ieee80211_queue_skb+0xdcc/0x1b4c
       ieee80211_tx+0x1ec/0x2bc
       ieee80211_xmit+0x224/0x324
       __ieee80211_subif_start_xmit+0x85c/0xcf8
       ieee80211_subif_start_xmit+0xc0/0xec4
       dev_hard_start_xmit+0xf4/0x28c
       __dev_queue_xmit+0x6ac/0x318c
       batadv_send_skb_packet+0x38c/0x4b0
       batadv_send_outstanding_bcast_packet+0x110/0x328
       process_one_work+0x578/0xc10
       worker_thread+0x4bc/0xc7c
       kthread+0x2f8/0x380
       ret_from_fork+0x10/0x20
    
      Allocated by task 1906:
       kasan_save_stack+0x28/0x4c
       kasan_save_track+0x1c/0x40
       kasan_save_alloc_info+0x3c/0x4c
       __kasan_kmalloc+0xac/0xb0
       __kmalloc_noprof+0x1b4/0x380
       ieee80211_key_alloc+0x3c/0xb64
       ieee80211_add_key+0x1b4/0x71c
       nl80211_new_key+0x2b4/0x5d8
       genl_family_rcv_msg_doit+0x198/0x240
      <...>
    
      Freed by task 1494:
       kasan_save_stack+0x28/0x4c
       kasan_save_track+0x1c/0x40
       kasan_save_free_info+0x48/0x94
       __kasan_slab_free+0x48/0x60
       kfree+0xc8/0x31c
       kfree_sensitive+0x70/0x80
       ieee80211_key_free_common+0x10c/0x174
       ieee80211_free_keys+0x188/0x46c
       ieee80211_stop_mesh+0x70/0x2cc
       ieee80211_leave_mesh+0x1c/0x60
       cfg80211_leave_mesh+0xe0/0x280
       cfg80211_leave+0x1e0/0x244
      <...>
    
    Reset SKB control block key before calling ieee80211_tx_h_select_key()
    to avoid that.
    
    Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue")
    Signed-off-by: Remi Pommarel <[email protected]>
    Link: https://patch.msgid.link/06aa507b853ca385ceded81c18b0a6dd0f081bc8.1742833382.git.repk@triplefau.lt
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mt76: Add check for devm_kstrdup() [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Wed Feb 19 11:36:45 2025 +0800

    wifi: mt76: Add check for devm_kstrdup()
    
    commit 4bc1da524b502999da28d287de4286c986a1af57 upstream.
    
    Add check for the return value of devm_kstrdup() in
    mt76_get_of_data_from_mtd() to catch potential exception.
    
    Fixes: e7a6a044f9b9 ("mt76: testmode: move mtd part to mt76_dev")
    Cc: [email protected]
    Signed-off-by: Haoxiang Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table [+ + +]
Author: Icenowy Zheng <[email protected]>
Date:   Mon Mar 17 18:22:35 2025 +0800

    wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
    
    [ Upstream commit 06cccc2ebbe6c8a20f714f3a0ff3ff489d3004bb ]
    
    The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.
    
    Add the USB ID to mt76x2u driver.
    
    Signed-off-by: Icenowy Zheng <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: rtw89: pci: add pre_deinit to be called after probe complete [+ + +]
Author: Ping-Ke Shih <[email protected]>
Date:   Fri Nov 10 09:23:15 2023 +0800

    wifi: rtw89: pci: add pre_deinit to be called after probe complete
    
    commit 9e1aff437a560cd72cb6a60ee33fe162b0afdaf1 upstream.
    
    At probe stage, we only do partial initialization to enable ability to
    download firmware and read capabilities. After that, we use this pre_deinit
    to disable HCI to save power.
    
    Signed-off-by: Ping-Ke Shih <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ Zenm: The rtw89 driver in recent kernel versions supports both Wi-Fi 6/6E
            and Wi-Fi 7, however the rtw89 driver in kernel 6.6 supports
            Wi-Fi 6/6E only, so remove the unnecessary code for Wi-Fi 7 from
            the upstream patch to make it apply on 6.6.y. ]
    Signed-off-by: Zenm Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit [+ + +]
Author: Ping-Ke Shih <[email protected]>
Date:   Mon Nov 11 14:38:35 2024 +0800

    wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit
    
    commit 9c1df813e08832c3836c254bc8a2f83ff22dbc06 upstream.
    
    The PCIE wake bit is to control PCIE wake signal to host. When PCIE is
    going down, clear this bit to prevent waking up host unexpectedly.
    
    Signed-off-by: Ping-Ke Shih <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [ Zenm: The rtw89 driver in recent kernel versions supports both Wi-Fi 6/6E
            and Wi-Fi 7, however the rtw89 driver in kernel 6.6 supports
            Wi-Fi 6/6E only, so remove the unnecessary code for Wi-Fi 7 from
            the upstream patch to make it apply on 6.6.y. ]
    Signed-off-by: Zenm Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: wl1251: fix memory leak in wl1251_tx_work [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Sun Mar 30 16:15:32 2025 +0530

    wifi: wl1251: fix memory leak in wl1251_tx_work
    
    [ Upstream commit a0f0dc96de03ffeefc2a177b7f8acde565cb77f4 ]
    
    The skb dequeued from tx_queue is lost when wl1251_ps_elp_wakeup fails
    with a -ETIMEDOUT error. Fix that by queueing the skb back to tx_queue.
    
    Fixes: c5483b719363 ("wl12xx: check if elp wakeup failed")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Reviewed-by: Michael Nemanov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
writeback: fix false warning in inode_to_wb() [+ + +]
Author: Andreas Gruenbacher <[email protected]>
Date:   Sat Apr 12 18:39:12 2025 +0200

    writeback: fix false warning in inode_to_wb()
    
    commit 9e888998ea4d22257b07ce911576509486fa0667 upstream.
    
    inode_to_wb() is used also for filesystems that don't support cgroup
    writeback.  For these filesystems inode->i_wb is stable during the
    lifetime of the inode (it points to bdi->wb) and there's no need to hold
    locks protecting the inode->i_wb dereference.  Improve the warning in
    inode_to_wb() to not trigger for these filesystems.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: aaa2cacf8184 ("writeback: add lockdep annotation to inode_to_wb()")
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Reviewed-by: Andreas Gruenbacher <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/boot/sev: Avoid shared GHCB page for early memory acceptance [+ + +]
Author: Ard Biesheuvel <[email protected]>
Date:   Thu Apr 17 22:21:21 2025 +0200

    x86/boot/sev: Avoid shared GHCB page for early memory acceptance
    
    commit d54d610243a4508183978871e5faff5502786cd4 upstream.
    
    Communicating with the hypervisor using the shared GHCB page requires
    clearing the C bit in the mapping of that page. When executing in the
    context of the EFI boot services, the page tables are owned by the
    firmware, and this manipulation is not possible.
    
    So switch to a different API for accepting memory in SEV-SNP guests, one
    which is actually supported at the point during boot where the EFI stub
    may need to accept memory, but the SEV-SNP init code has not executed
    yet.
    
    For simplicity, also switch the memory acceptance carried out by the
    decompressor when not booting via EFI - this only involves the
    allocation for the decompressed kernel, and is generally only called
    after kexec, as normal boot will jump straight into the kernel from the
    EFI stub.
    
    Fixes: 6c3211796326 ("x86/sev: Add SNP-specific unaccepted memory support")
    Tested-by: Tom Lendacky <[email protected]>
    Co-developed-by: Tom Lendacky <[email protected]>
    Signed-off-by: Tom Lendacky <[email protected]>
    Signed-off-by: Ard Biesheuvel <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: <[email protected]>
    Cc: Dionna Amalie Glaze <[email protected]>
    Cc: Kevin Loughlin <[email protected]>
    Cc: Kirill A. Shutemov <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected] # discussion thread #1
    Link: https://lore.kernel.org/r/[email protected] # discussion thread #2
    Link: https://lore.kernel.org/r/[email protected] # final submission
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/cpu/amd: Fix workaround for erratum 1054 [+ + +]
Author: Sandipan Das <[email protected]>
Date:   Fri Apr 18 11:49:40 2025 +0530

    x86/cpu/amd: Fix workaround for erratum 1054
    
    commit 263e55949d8902a6a09bdb92a1ab6a3f67231abe upstream.
    
    Erratum 1054 affects AMD Zen processors that are a part of Family 17h
    Models 00-2Fh and the workaround is to not set HWCR[IRPerfEn]. However,
    when X86_FEATURE_ZEN1 was introduced, the condition to detect unaffected
    processors was incorrectly changed in a way that the IRPerfEn bit gets
    set only for unaffected Zen 1 processors.
    
    Ensure that HWCR[IRPerfEn] is set for all unaffected processors. This
    includes a subset of Zen 1 (Family 17h Models 30h and above) and all
    later processors. Also clear X86_FEATURE_IRPERF on affected processors
    so that the IRPerfCount register is not used by other entities like the
    MSR PMU driver.
    
    Fixes: 232afb557835 ("x86/CPU/AMD: Add X86_FEATURE_ZEN1")
    Signed-off-by: Sandipan Das <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Borislav Petkov <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/caa057a9d6f8ad579e2f1abaa71efbd5bd4eaf6d.1744956467.git.sandipan.das@amd.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/cpu: Don't clear X86_FEATURE_LAHF_LM flag in init_amd_k8() on AMD when running in a virtual machine [+ + +]
Author: Max Grobecker <[email protected]>
Date:   Thu Feb 27 21:45:05 2025 +0100

    x86/cpu: Don't clear X86_FEATURE_LAHF_LM flag in init_amd_k8() on AMD when running in a virtual machine
    
    [ Upstream commit a4248ee16f411ac1ea7dfab228a6659b111e3d65 ]
    
    When running in a virtual machine, we might see the original hardware CPU
    vendor string (i.e. "AuthenticAMD"), but a model and family ID set by the
    hypervisor. In case we run on AMD hardware and the hypervisor sets a model
    ID < 0x14, the LAHF cpu feature is eliminated from the the list of CPU
    capabilities present to circumvent a bug with some BIOSes in conjunction with
    AMD K8 processors.
    
    Parsing the flags list from /proc/cpuinfo seems to be happening mostly in
    bash scripts and prebuilt Docker containers, as it does not need to have
    additionals tools present – even though more reliable ways like using "kcpuid",
    which calls the CPUID instruction instead of parsing a list, should be preferred.
    Scripts, that use /proc/cpuinfo to determine if the current CPU is
    "compliant" with defined microarchitecture levels like x86-64-v2 will falsely
    claim the CPU is incapable of modern CPU instructions when "lahf_lm" is missing
    in that flags list.
    
    This can prevent some docker containers from starting or build scripts to create
    unoptimized binaries.
    
    Admittably, this is more a small inconvenience than a severe bug in the kernel
    and the shoddy scripts that rely on parsing /proc/cpuinfo
    should be fixed instead.
    
    This patch adds an additional check to see if we're running inside a
    virtual machine (X86_FEATURE_HYPERVISOR is present), which, to my
    understanding, can't be present on a real K8 processor as it was introduced
    only with the later/other Athlon64 models.
    
    Example output with the "lahf_lm" flag missing in the flags list
    (should be shown between "hypervisor" and "abm"):
    
        $ cat /proc/cpuinfo
        processor       : 0
        vendor_id       : AuthenticAMD
        cpu family      : 15
        model           : 6
        model name      : Common KVM processor
        stepping        : 1
        microcode       : 0x1000065
        cpu MHz         : 2599.998
        cache size      : 512 KB
        physical id     : 0
        siblings        : 1
        core id         : 0
        cpu cores       : 1
        apicid          : 0
        initial apicid  : 0
        fpu             : yes
        fpu_exception   : yes
        cpuid level     : 13
        wp              : yes
        flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
                          cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp
                          lm rep_good nopl cpuid extd_apicid tsc_known_freq pni
                          pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt
                          tsc_deadline_timer aes xsave avx f16c hypervisor abm
                          3dnowprefetch vmmcall bmi1 avx2 bmi2 xsaveopt
    
    ... while kcpuid shows the feature to be present in the CPU:
    
        # kcpuid -d | grep lahf
             lahf_lm             - LAHF/SAHF available in 64-bit mode
    
    [ mingo: Updated the comment a bit, incorporated Boris's review feedback. ]
    
    Signed-off-by: Max Grobecker <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: [email protected]
    Cc: Borislav Petkov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/e820: Fix handling of subpage regions when calculating nosave ranges in e820__register_nosave_regions() [+ + +]
Author: Myrrh Periwinkle <[email protected]>
Date:   Sun Apr 6 11:45:22 2025 +0700

    x86/e820: Fix handling of subpage regions when calculating nosave ranges in e820__register_nosave_regions()
    
    commit f2f29da9f0d4367f6ff35e0d9d021257bb53e273 upstream.
    
    While debugging kexec/hibernation hangs and crashes, it turned out that
    the current implementation of e820__register_nosave_regions() suffers from
    multiple serious issues:
    
     - The end of last region is tracked by PFN, causing it to find holes
       that aren't there if two consecutive subpage regions are present
    
     - The nosave PFN ranges derived from holes are rounded out (instead of
       rounded in) which makes it inconsistent with how explicitly reserved
       regions are handled
    
    Fix this by:
    
     - Treating reserved regions as if they were holes, to ensure consistent
       handling (rounding out nosave PFN ranges is more correct as the
       kernel does not use partial pages)
    
     - Tracking the end of the last RAM region by address instead of pages
       to detect holes more precisely
    
    These bugs appear to have been introduced about ~18 years ago with the very
    first version of e820_mark_nosave_regions(), and its flawed assumptions were
    carried forward uninterrupted through various waves of rewrites and renames.
    
    [ mingo: Added Git archeology details, for kicks and giggles. ]
    
    Fixes: e8eff5ac294e ("[PATCH] Make swsusp avoid memory holes and reserved memory regions on x86_64")
    Reported-by: Roberto Ricci <[email protected]>
    Tested-by: Roberto Ricci <[email protected]>
    Signed-off-by: Myrrh Periwinkle <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Rafael J. Wysocki <[email protected]>
    Cc: Ard Biesheuvel <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Kees Cook <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: David Woodhouse <[email protected]>
    Cc: Len Brown <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Closes: https://lore.kernel.org/all/Z4WFjBVHpndct7br@desktop0a/
    Signed-off-by: Myrrh Periwinkle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/ia32: Leave NULL selector values 0~3 unchanged [+ + +]
Author: Xin Li (Intel) <[email protected]>
Date:   Tue Nov 26 10:45:28 2024 -0800

    x86/ia32: Leave NULL selector values 0~3 unchanged
    
    [ Upstream commit ad546940b5991d3e141238cd80a6d1894b767184 ]
    
    The first GDT descriptor is reserved as 'NULL descriptor'.  As bits 0
    and 1 of a segment selector, i.e., the RPL bits, are NOT used to index
    GDT, selector values 0~3 all point to the NULL descriptor, thus values
    0, 1, 2 and 3 are all valid NULL selector values.
    
    When a NULL selector value is to be loaded into a segment register,
    reload_segments() sets its RPL bits.  Later IRET zeros ES, FS, GS, and
    DS segment registers if any of them is found to have any nonzero NULL
    selector value.  The two operations offset each other to actually effect
    a nop.
    
    Besides, zeroing of RPL in NULL selector values is an information leak
    in pre-FRED systems as userspace can spot any interrupt/exception by
    loading a nonzero NULL selector, and waiting for it to become zero.
    But there is nothing software can do to prevent it before FRED.
    
    ERETU, the only legit instruction to return to userspace from kernel
    under FRED, by design does NOT zero any segment register to avoid this
    problem behavior.
    
    As such, leave NULL selector values 0~3 unchanged and close the leak.
    
    Do the same on 32-bit kernel as well.
    
    Signed-off-by: Xin Li (Intel) <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Andrew Cooper <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/microcode/AMD: Extend the SHA check to Zen5, block loading of any unreleased standalone Zen5 microcode patches [+ + +]
Author: Borislav Petkov (AMD) <[email protected]>
Date:   Thu Apr 10 13:42:22 2025 +0200

    x86/microcode/AMD: Extend the SHA check to Zen5, block loading of any unreleased standalone Zen5 microcode patches
    
    commit 805b743fc163f1abef7ce1bea8eca8dfab5b685b upstream.
    
    All Zen5 machines out there should get BIOS updates which update to the
    correct microcode patches addressing the microcode signature issue.
    However, silly people carve out random microcode blobs from BIOS
    packages and think are doing other people a service this way...
    
    Block loading of any unreleased standalone Zen5 microcode patches.
    
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: <[email protected]>
    Cc: Andrew Cooper <[email protected]>
    Cc: Boris Ostrovsky <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Maciej S. Szmigiero <[email protected]>
    Cc: Nikolay Borisov <[email protected]>
    Cc: Tom Lendacky <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/mm: Clear _PAGE_DIRTY for kernel mappings when we clear _PAGE_RW [+ + +]
Author: Matthew Wilcox (Oracle) <[email protected]>
Date:   Tue Feb 25 19:37:32 2025 +0000

    x86/mm: Clear _PAGE_DIRTY for kernel mappings when we clear _PAGE_RW
    
    [ Upstream commit c1fcf41cf37f7a3fd3bbf6f0c04aba3ea4258888 ]
    
    The bit pattern of _PAGE_DIRTY set and _PAGE_RW clear is used to mark
    shadow stacks.  This is currently checked for in mk_pte() but not
    pfn_pte().  If we add the check to pfn_pte(), it catches vfree()
    calling set_direct_map_invalid_noflush() which calls
    __change_page_attr() which loads the old protection bits from the
    PTE, clears the specified bits and uses pfn_pte() to construct the
    new PTE.
    
    We should, therefore, for kernel mappings, clear the _PAGE_DIRTY bit
    consistently whenever we clear _PAGE_RW.  I opted to do it in the
    callers in case we want to use __change_page_attr() to create shadow
    stacks inside the kernel at some point in the future.  Arguably, we
    might also want to clear _PAGE_ACCESSED here.
    
    Note that the 3 functions involved:
    
      __set_pages_np()
      kernel_map_pages_in_pgd()
      kernel_unmap_pages_in_pgd()
    
    Only ever manipulate non-swappable kernel mappings, so maintaining
    the DIRTY:1|RW:0 special pattern for shadow stacks and DIRTY:0
    pattern for non-shadow-stack entries can be maintained consistently
    and doesn't result in the unintended clearing of a live dirty bit
    that could corrupt (destroy) dirty bit information for user mappings.
    
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Linus Torvalds <[email protected]>
    Link: https://lore.kernel.org/r/174051422675.10177.13226545170101706336.tip-bot2@tip-bot2
    Closes: https://lore.kernel.org/oe-lkp/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT [+ + +]
Author: Kirill A. Shutemov <[email protected]>
Date:   Fri Feb 28 01:44:14 2025 +0000

    x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT
    
    commit 22cc5ca5de52bbfc36a7d4a55323f91fb4492264 upstream.
    
    CONFIG_PARAVIRT_XXL is mainly defined/used by XEN PV guests. For
    other VM guest types, features supported under CONFIG_PARAVIRT
    are self sufficient. CONFIG_PARAVIRT mainly provides support for
    TLB flush operations and time related operations.
    
    For TDX guest as well, paravirt calls under CONFIG_PARVIRT meets
    most of its requirement except the need of HLT and SAFE_HLT
    paravirt calls, which is currently defined under
    CONFIG_PARAVIRT_XXL.
    
    Since enabling CONFIG_PARAVIRT_XXL is too bloated for TDX guest
    like platforms, move HLT and SAFE_HLT paravirt calls under
    CONFIG_PARAVIRT.
    
    Moving HLT and SAFE_HLT paravirt calls are not fatal and should not
    break any functionality for current users of CONFIG_PARAVIRT.
    
    Fixes: bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
    Co-developed-by: Kuppuswamy Sathyanarayanan <[email protected]>
    Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>
    Signed-off-by: Kirill A. Shutemov <[email protected]>
    Signed-off-by: Vishal Annapurve <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Andi Kleen <[email protected]>
    Reviewed-by: Tony Luck <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Tested-by: Ryan Afranji <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/split_lock: Fix the delayed detection logic [+ + +]
Author: Maksim Davydov <[email protected]>
Date:   Wed Jan 15 16:17:04 2025 +0300

    x86/split_lock: Fix the delayed detection logic
    
    commit c929d08df8bee855528b9d15b853c892c54e1eee upstream.
    
    If the warning mode with disabled mitigation mode is used, then on each
    CPU where the split lock occurred detection will be disabled in order to
    make progress and delayed work will be scheduled, which then will enable
    detection back.
    
    Now it turns out that all CPUs use one global delayed work structure.
    This leads to the fact that if a split lock occurs on several CPUs
    at the same time (within 2 jiffies), only one CPU will schedule delayed
    work, but the rest will not.
    
    The return value of schedule_delayed_work_on() would have shown this,
    but it is not checked in the code.
    
    A diagram that can help to understand the bug reproduction:
    
     - sld_update_msr() enables/disables SLD on both CPUs on the same core
    
     - schedule_delayed_work_on() internally checks WORK_STRUCT_PENDING_BIT.
       If a work has the 'pending' status, then schedule_delayed_work_on()
       will return an error code and, most importantly, the work will not
       be placed in the workqueue.
    
    Let's say we have a multicore system on which split_lock_mitigate=0 and
    a multithreaded application is running that calls splitlock in multiple
    threads. Due to the fact that sld_update_msr() affects the entire core
    (both CPUs), we will consider 2 CPUs from different cores. Let the 2
    threads of this application schedule to CPU0 (core 0) and to CPU 2
    (core 1), then:
    
    |                                 ||                                   |
    |             CPU 0 (core 0)      ||          CPU 2 (core 1)           |
    |_________________________________||___________________________________|
    |                                 ||                                   |
    | 1) SPLIT LOCK occured           ||                                   |
    |                                 ||                                   |
    | 2) split_lock_warn()            ||                                   |
    |                                 ||                                   |
    | 3) sysctl_sld_mitigate == 0     ||                                   |
    |    (work = &sl_reenable)        ||                                   |
    |                                 ||                                   |
    | 4) schedule_delayed_work_on()   ||                                   |
    |    (reenable will be called     ||                                   |
    |     after 2 jiffies on CPU 0)   ||                                   |
    |                                 ||                                   |
    | 5) disable SLD for core 0       ||                                   |
    |                                 ||                                   |
    |    -------------------------    ||                                   |
    |                                 ||                                   |
    |                                 || 6) SPLIT LOCK occured             |
    |                                 ||                                   |
    |                                 || 7) split_lock_warn()              |
    |                                 ||                                   |
    |                                 || 8) sysctl_sld_mitigate == 0       |
    |                                 ||    (work = &sl_reenable,          |
    |                                 ||     the same address as in 3) )   |
    |                                 ||                                   |
    |            2 jiffies            || 9) schedule_delayed_work_on()     |
    |                                 ||    fials because the work is in   |
    |                                 ||    the pending state since 4).    |
    |                                 ||    The work wasn't placed to the  |
    |                                 ||    workqueue. reenable won't be   |
    |                                 ||    called on CPU 2                |
    |                                 ||                                   |
    |                                 || 10) disable SLD for core 0        |
    |                                 ||                                   |
    |                                 ||     From now on SLD will          |
    |                                 ||     never be reenabled on core 1  |
    |                                 ||                                   |
    |    -------------------------    ||                                   |
    |                                 ||                                   |
    |    11) enable SLD for core 0 by ||                                   |
    |        __split_lock_reenable    ||                                   |
    |                                 ||                                   |
    
    If the application threads can be scheduled to all processor cores,
    then over time there will be only one core left, on which SLD will be
    enabled and split lock will be able to be detected; and on all other
    cores SLD will be disabled all the time.
    
    Most likely, this bug has not been noticed for so long because
    sysctl_sld_mitigate default value is 1, and in this case a semaphore
    is used that does not allow 2 different cores to have SLD disabled at
    the same time, that is, strictly only one work is placed in the
    workqueue.
    
    In order to fix the warning mode with disabled mitigation mode,
    delayed work has to be per-CPU. Implement it.
    
    Fixes: 727209376f49 ("x86/split_lock: Add sysctl to control the misery mode")
    Signed-off-by: Maksim Davydov <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Tested-by: Guilherme G. Piccoli <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: Ravi Bangoria <[email protected]>
    Cc: Tom Lendacky <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/tdx: Fix arch_safe_halt() execution for TDX VMs [+ + +]
Author: Vishal Annapurve <[email protected]>
Date:   Fri Feb 28 01:44:15 2025 +0000

    x86/tdx: Fix arch_safe_halt() execution for TDX VMs
    
    commit 9f98a4f4e7216dbe366010b4cdcab6b220f229c4 upstream.
    
    Direct HLT instruction execution causes #VEs for TDX VMs which is routed
    to hypervisor via TDCALL. If HLT is executed in STI-shadow, resulting #VE
    handler will enable interrupts before TDCALL is routed to hypervisor
    leading to missed wakeup events, as current TDX spec doesn't expose
    interruptibility state information to allow #VE handler to selectively
    enable interrupts.
    
    Commit bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
    prevented the idle routines from executing HLT instruction in STI-shadow.
    But it missed the paravirt routine which can be reached via this path
    as an example:
    
            kvm_wait()       =>
            safe_halt()      =>
            raw_safe_halt()  =>
            arch_safe_halt() =>
            irq.safe_halt()  =>
            pv_native_safe_halt()
    
    To reliably handle arch_safe_halt() for TDX VMs, introduce explicit
    dependency on CONFIG_PARAVIRT and override paravirt halt()/safe_halt()
    routines with TDX-safe versions that execute direct TDCALL and needed
    interrupt flag updates. Executing direct TDCALL brings in additional
    benefit of avoiding HLT related #VEs altogether.
    
    As tested by Ryan Afranji:
    
      "Tested with the specjbb2015 benchmark. It has heavy lock contention which leads
       to many halt calls. TDX VMs suffered a poor score before this patchset.
    
       Verified the major performance improvement with this patchset applied."
    
    Fixes: bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
    Signed-off-by: Vishal Annapurve <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Kirill A. Shutemov <[email protected]>
    Tested-by: Ryan Afranji <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Juergen Gross <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/xen: fix balloon target initialization for PVH dom0 [+ + +]
Author: Roger Pau Monne <[email protected]>
Date:   Mon Apr 7 10:28:37 2025 +0200

    x86/xen: fix balloon target initialization for PVH dom0
    
    commit 87af633689ce16ddb166c80f32b120e50b1295de upstream.
    
    PVH dom0 re-uses logic from PV dom0, in which RAM ranges not assigned to
    dom0 are re-used as scratch memory to map foreign and grant pages.  Such
    logic relies on reporting those unpopulated ranges as RAM to Linux, and
    mark them as reserved.  This way Linux creates the underlying page
    structures required for metadata management.
    
    Such approach works fine on PV because the initial balloon target is
    calculated using specific Xen data, that doesn't take into account the
    memory type changes described above.  However on HVM and PVH the initial
    balloon target is calculated using get_num_physpages(), and that function
    does take into account the unpopulated RAM regions used as scratch space
    for remote domain mappings.
    
    This leads to PVH dom0 having an incorrect initial balloon target, which
    causes malfunction (excessive memory freeing) of the balloon driver if the
    dom0 memory target is later adjusted from the toolstack.
    
    Fix this by using xen_released_pages to account for any pages that are part
    of the memory map, but are already unpopulated when the balloon driver is
    initialized.  This accounts for any regions used for scratch remote
    mappings.  Note on x86 xen_released_pages definition is moved to
    enlighten.c so it's uniformly available for all Xen-enabled builds.
    
    Take the opportunity to unify PV with PVH/HVM guests regarding the usage of
    get_num_physpages(), as that avoids having to add different logic for PV vs
    PVH in both balloon_add_regions() and arch_xen_unpopulated_init().
    
    Much like a6aa4eb994ee, the code in this changeset should have been part of
    38620fc4e893.
    
    Fixes: a6aa4eb994ee ('xen/x86: add extra pages to unpopulated-alloc if available')
    Signed-off-by: Roger Pau Monné <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Cc: [email protected]
    Signed-off-by: Juergen Gross <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/xen: fix memblock_reserve() usage on PVH [+ + +]
Author: Roger Pau Monne <[email protected]>
Date:   Thu Jul 25 09:31:15 2024 +0200

    x86/xen: fix memblock_reserve() usage on PVH
    
    commit 4c006734898a113a64a528027274a571b04af95a upstream.
    
    The current usage of memblock_reserve() in init_pvh_bootparams() is done before
    the .bss is zeroed, and that used to be fine when
    memblock_reserved_init_regions implicitly ended up in the .meminit.data
    section.  However after commit 73db3abdca58c memblock_reserved_init_regions
    ends up in the .bss section, thus breaking it's usage before the .bss is
    cleared.
    
    Move and rename the call to xen_reserve_extra_memory() so it's done in the
    x86_init.oem.arch_setup hook, which gets executed after the .bss has been
    zeroed, but before calling e820__memory_setup().
    
    Fixes: 73db3abdca58c ("init/modpost: conditionally check section mismatch to __meminit*")
    Signed-off-by: Roger Pau Monné <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    [ Context fixup for hypercall_page removal ]
    Signed-off-by: Jason Andryuk <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/xen: move xen_reserve_extra_memory() [+ + +]
Author: Roger Pau Monne <[email protected]>
Date:   Thu Jul 25 09:31:14 2024 +0200

    x86/xen: move xen_reserve_extra_memory()
    
    commit fc05ea89c9ab45e70cb73e70bc0b9cdd403e0ee1 upstream.
    
    In preparation for making the function static.
    
    No functional change.
    
    Signed-off-by: Roger Pau Monné <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    [ Stable backport - move the code as it exists ]
    Signed-off-by: Jason Andryuk <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xdp: Reset bpf_redirect_info before running a xdp's BPF prog. [+ + +]
Author: Sebastian Andrzej Siewior <[email protected]>
Date:   Mon Mar 17 14:38:13 2025 +0100

    xdp: Reset bpf_redirect_info before running a xdp's BPF prog.
    
    Ricardo reported a KASAN discovered use after free in v6.6-stable.
    
    The syzbot starts a BPF program via xdp_test_run_batch() which assigns
    ri->tgt_value via dev_hash_map_redirect() and the return code isn't
    XDP_REDIRECT it looks like nonsense. So the output in
    bpf_warn_invalid_xdp_action() appears once.
    Then the TUN driver runs another BPF program (on the same CPU) which
    returns XDP_REDIRECT without setting ri->tgt_value first. It invokes
    bpf_trace_printk() to print four characters and obtain the required
    return value. This is enough to get xdp_do_redirect() invoked which
    then accesses the pointer in tgt_value which might have been already
    deallocated.
    
    This problem does not affect upstream because since commit
            401cb7dae8130 ("net: Reference bpf_redirect_info via task_struct on PREEMPT_RT.")
    
    the per-CPU variable is referenced via task's task_struct and exists on
    the stack during NAPI callback. Therefore it is cleared once before the
    first invocation and remains valid within the RCU section of the NAPI
    callback.
    
    Instead of performing the huge backport of the commit (plus its fix ups)
    here is an alternative version which only resets the variable in
    question prior invoking the BPF program.
    
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Reported-by: Ricardo Cañuelo Navarro <[email protected]>
    Closes: https://lore.kernel.org/all/20250226-20250204-kasan-slab-use-after-free-read-in-dev_map_enqueue__submit-v3-0-360efec441ba@igalia.com/
    Fixes: 97f91a7cf04ff ("bpf: add bpf_redirect_map helper routine")
    Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xen/mcelog: Add __nonstring annotations for unterminated strings [+ + +]
Author: Kees Cook <[email protected]>
Date:   Mon Mar 10 15:22:38 2025 -0700

    xen/mcelog: Add __nonstring annotations for unterminated strings
    
    [ Upstream commit 1c3dfc7c6b0f551fdca3f7c1f1e4c73be8adb17d ]
    
    When a character array without a terminating NUL character has a static
    initializer, GCC 15's -Wunterminated-string-initialization will only
    warn if the array lacks the "nonstring" attribute[1]. Mark the arrays
    with __nonstring to and correctly identify the char array as "not a C
    string" and thereby eliminate the warning.
    
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1]
    Cc: Juergen Gross <[email protected]>
    Cc: Stefano Stabellini <[email protected]>
    Cc: Oleksandr Tyshchenko <[email protected]>
    Cc: [email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Acked-by: Juergen Gross <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
xenfs/xensyms: respect hypervisor's "next" indication [+ + +]
Author: Jan Beulich <[email protected]>
Date:   Wed Mar 12 16:32:45 2025 +0100

    xenfs/xensyms: respect hypervisor's "next" indication
    
    commit 5c4e79e29a9fe4ea132118ac40c2bc97cfe23077 upstream.
    
    The interface specifies the symnum field as an input and output; the
    hypervisor sets it to the next sequential symbol's index. xensyms_next()
    incrementing the position explicitly (and xensyms_next_sym()
    decrementing it to "rewind") is only correct as long as the sequence of
    symbol indexes is non-sparse. Use the hypervisor-supplied value instead
    to update the position in xensyms_next(), and use the saved incoming
    index in xensyms_next_sym().
    
    Cc: [email protected]
    Fixes: a11f4f0a4e18 ("xen: xensyms support")
    Signed-off-by: Jan Beulich <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
zstd: Increase DYNAMIC_BMI2 GCC version cutoff from 4.8 to 11.0 to work around compiler segfault [+ + +]
Author: Ingo Molnar <[email protected]>
Date:   Fri Mar 21 08:38:43 2025 +0100

    zstd: Increase DYNAMIC_BMI2 GCC version cutoff from 4.8 to 11.0 to work around compiler segfault
    
    [ Upstream commit 1400c87e6cac47eb243f260352c854474d9a9073 ]
    
    Due to pending percpu improvements in -next, GCC9 and GCC10 are
    crashing during the build with:
    
        lib/zstd/compress/huf_compress.c:1033:1: internal compiler error: Segmentation fault
         1033 | {
              | ^
        Please submit a full bug report,
        with preprocessed source if appropriate.
        See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
    
    The DYNAMIC_BMI2 feature is a known-challenging feature of
    the ZSTD library, with an existing GCC quirk turning it off
    for GCC versions below 4.8.
    
    Increase the DYNAMIC_BMI2 version cutoff to GCC 11.0 - GCC 10.5
    is the last version known to crash.
    
    Reported-by: Michael Kelley <[email protected]>
    Debugged-by: Ard Biesheuvel <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: https://lore.kernel.org/r/SN6PR02MB415723FBCD79365E8D72CA5FD4D82@SN6PR02MB4157.namprd02.prod.outlook.com
    Cc: Linus Torvalds <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>