Changelog in Linux kernel 5.15.181

 
ACPI PPTT: Fix coding mistakes in a couple of sizeof() calls [+ + +]
Author: Jean-Marc Eurin <[email protected]>
Date:   Tue Apr 1 17:15:42 2025 -0700

    ACPI PPTT: Fix coding mistakes in a couple of sizeof() calls
    
    [ Upstream commit 7ab4f0e37a0f4207e742a8de69be03984db6ebf0 ]
    
    The end of table checks should be done with the structure size,
    but 2 of the 3 similar calls use the pointer size.
    
    Signed-off-by: Jean-Marc Eurin <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [ rjw: Subject edits ]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
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: 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/fpsimd: Have KVM explicitly say which FP registers to save [+ + +]
Author: Mark Brown <[email protected]>
Date:   Tue Apr 8 19:10:00 2025 +0100

    arm64/fpsimd: Have KVM explicitly say which FP registers to save
    
    [ Upstream commit deeb8f9a80fdae5a62525656d65c7070c28bd3a4 ]
    
    In order to avoid needlessly saving and restoring the guest registers KVM
    relies on the host FPSMID code to save the guest registers when we context
    switch away from the guest. This is done by binding the KVM guest state to
    the CPU on top of the task state that was originally there, then carefully
    managing the TIF_SVE flag for the task to cause the host to save the full
    SVE state when needed regardless of the needs of the host task. This works
    well enough but isn't terribly direct about what is going on and makes it
    much more complicated to try to optimise what we're doing with the SVE
    register state.
    
    Let's instead have KVM pass in the register state it wants saving when it
    binds to the CPU. We introduce a new FP_STATE_CURRENT for use
    during normal task binding to indicate that we should base our
    decisions on the current task. This should not be used when
    actually saving. Ideally we might want to use a separate enum for
    the type to save but this enum and the enum values would then
    need to be named which has problems with clarity and ambiguity.
    
    In order to ease any future debugging that might be required this patch
    does not actually update any of the decision making about what to save,
    it merely starts tracking the new information and warns if the requested
    state is not what we would otherwise have decided to save.
    
    Signed-off-by: Mark Brown <[email protected]>
    Reviewed-by: Catalin Marinas <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    [ Mark: trivial backport ]
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM [+ + +]
Author: Mark Brown <[email protected]>
Date:   Tue Apr 8 19:10:01 2025 +0100

    arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM
    
    [ Upstream commit 62021cc36add7b2c015b837f7893f2fb4b8c2586 ]
    
    Now that we are explicitly telling the host FP code which register state
    it needs to save we can remove the manipulation of TIF_SVE from the KVM
    code, simplifying it and allowing us to optimise our handling of normal
    tasks. Remove the manipulation of TIF_SVE from KVM and instead rely on
    to_save to ensure we save the correct data for it.
    
    There should be no functional or performance impact from this change.
    
    Signed-off-by: Mark Brown <[email protected]>
    Reviewed-by: Catalin Marinas <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    [ Mark: trivial backport ]
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE [+ + +]
Author: Mark Brown <[email protected]>
Date:   Tue Apr 8 19:09:59 2025 +0100

    arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE
    
    [ Upstream commit baa8515281b30861cff3da7db70662d2a25c6440 ]
    
    When we save the state for the floating point registers this can be done
    in the form visible through either the FPSIMD V registers or the SVE Z and
    P registers. At present we track which format is currently used based on
    TIF_SVE and the SME streaming mode state but particularly in the SVE case
    this limits our options for optimising things, especially around syscalls.
    Introduce a new enum which we place together with saved floating point
    state in both thread_struct and the KVM guest state which explicitly
    states which format is active and keep it up to date when we change it.
    
    At present we do not use this state except to verify that it has the
    expected value when loading the state, future patches will introduce
    functional changes.
    
    Signed-off-by: Mark Brown <[email protected]>
    Reviewed-by: Catalin Marinas <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    [ Mark: fix conflicts due to earlier backports ]
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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]>

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

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

ata: sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones [+ + +]
Author: Hannes Reinecke <[email protected]>
Date:   Tue Dec 21 08:20:59 2021 +0100

    ata: sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones
    
    [ Upstream commit bc21c1056d08525d9c5a5d74db4b8f14e6691991 ]
    
    Drop pointless VPRINTK() calls for setting up SG tables
    and convert the remaining calls to structured logging.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Stable-dep-of: 8d46a2708503 ("ata: sata_sx4: Add error handling in pdc20621_i2c_read()")
    Signed-off-by: Sasha Levin <[email protected]>

 
auxdisplay: hd44780: Convert to platform remove callback returning void [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Mon Mar 11 22:59:23 2024 +0100

    auxdisplay: hd44780: Convert to platform remove callback returning void
    
    [ Upstream commit 9ea02f7cc39d484d16e8a14f3713fefcd33407c0 ]
    
    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is ignored (apart
    from emitting a warning) and this typically results in resource leaks.
    
    To improve here there is a quest to make the remove callback return
    void. In the first step of this quest all drivers are converted to
    .remove_new(), which already returns void. Eventually after all drivers
    are converted, .remove_new() will be renamed to .remove().
    
    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.
    
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Andy Shevchenko <[email protected]>
    Stable-dep-of: 9b98a7d2e5f4 ("auxdisplay: hd44780: Fix an API misuse in hd44780.c")
    Signed-off-by: Sasha Levin <[email protected]>

auxdisplay: hd44780: Fix an API misuse in hd44780.c [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Mon Feb 24 18:15:27 2025 +0800

    auxdisplay: hd44780: Fix an API misuse in hd44780.c
    
    [ Upstream commit 9b98a7d2e5f4e2beeff88f6571da0cdc5883c7fb ]
    
    Variable allocated by charlcd_alloc() should be released
    by charlcd_free(). The following patch changed kfree() to
    charlcd_free() to fix an API misuse.
    
    Fixes: 718e05ed92ec ("auxdisplay: Introduce hd44780_common.[ch]")
    Cc: [email protected]
    Signed-off-by: Haoxiang Li <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Andy Shevchenko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
backlight: led_bl: Convert to platform remove callback returning void [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Wed Mar 8 08:39:38 2023 +0100

    backlight: led_bl: Convert to platform remove callback returning void
    
    [ Upstream commit c4c4fa57fd3cc00020152baa169337521f90b2ad ]
    
    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is (mostly) ignored
    and this typically results in resource leaks. To improve here there is a
    quest to make the remove callback return void. In the first step of this
    quest all drivers are converted to .remove_new() which already returns
    void.
    
    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.
    
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()")
    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()
    
    [ Upstream commit 276822a00db3c1061382b41e72cafc09d6a0ec30 ]
    
    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: Sasha Levin <[email protected]>

 
blk-cgroup: support to track if policy is online [+ + +]
Author: Yu Kuai <[email protected]>
Date:   Thu Jan 19 19:03:49 2023 +0800

    blk-cgroup: support to track if policy is online
    
    commit dfd6200a095440b663099d8d42f1efb0175a1ce3 upstream.
    
    A new field 'online' is added to blkg_policy_data to fix following
    2 problem:
    
    1) In blkcg_activate_policy(), if pd_alloc_fn() with 'GFP_NOWAIT'
       failed, 'queue_lock' will be dropped and pd_alloc_fn() will try again
       without 'GFP_NOWAIT'. In the meantime, remove cgroup can race with
       it, and pd_offline_fn() will be called without pd_init_fn() and
       pd_online_fn(). This way null-ptr-deference can be triggered.
    
    2) In order to synchronize pd_free_fn() from blkg_free_workfn() and
       blkcg_deactivate_policy(), 'list_del_init(&blkg->q_node)' will be
       delayed to blkg_free_workfn(), hence pd_offline_fn() can be called
       first in blkg_destroy(), and then blkcg_deactivate_policy() will
       call it again, we must prevent it.
    
    The new field 'online' will be set after pd_online_fn() and will be
    cleared after pd_offline_fn(), in the meantime pd_offline_fn() will only
    be called if 'online' is set.
    
    Signed-off-by: Yu Kuai <[email protected]>
    Acked-by: Tejun Heo <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
blk-iocost: do not WARN if iocg was already offlined [+ + +]
Author: Li Nan <[email protected]>
Date:   Fri Apr 19 17:32:57 2024 +0800

    blk-iocost: do not WARN if iocg was already offlined
    
    commit 01bc4fda9ea0a6b52f12326486f07a4910666cf6 upstream.
    
    In iocg_pay_debt(), warn is triggered if 'active_list' is empty, which
    is intended to confirm iocg is active when it has debt. However, warn
    can be triggered during a blkcg or disk removal, if iocg_waitq_timer_fn()
    is run at that time:
    
      WARNING: CPU: 0 PID: 2344971 at block/blk-iocost.c:1402 iocg_pay_debt+0x14c/0x190
      Call trace:
      iocg_pay_debt+0x14c/0x190
      iocg_kick_waitq+0x438/0x4c0
      iocg_waitq_timer_fn+0xd8/0x130
      __run_hrtimer+0x144/0x45c
      __hrtimer_run_queues+0x16c/0x244
      hrtimer_interrupt+0x2cc/0x7b0
    
    The warn in this situation is meaningless. Since this iocg is being
    removed, the state of the 'active_list' is irrelevant, and 'waitq_timer'
    is canceled after removing 'active_list' in ioc_pd_free(), which ensures
    iocg is freed after iocg_waitq_timer_fn() returns.
    
    Therefore, add the check if iocg was already offlined to avoid warn
    when removing a blkcg or disk.
    
    Signed-off-by: Li Nan <[email protected]>
    Reviewed-by: Yu Kuai <[email protected]>
    Acked-by: Tejun Heo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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: SCO: Fix UAF on sco_sock_timeout [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Tue Oct 22 12:31:08 2024 -0400

    Bluetooth: SCO: Fix UAF on sco_sock_timeout
    
    commit 1bf4470a3939c678fb822073e9ea77a0560bc6bb upstream.
    
    conn->sk maybe have been unlinked/freed while waiting for sco_conn_lock
    so this checks if the conn->sk is still valid by checking if it part of
    sco_sk_list.
    
    Reported-by: [email protected]
    Tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=4c0d0c4cde787116d465
    Fixes: ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bnxt_re: avoid shift undefined behavior in bnxt_qplib_alloc_init_hwq [+ + +]
Author: Michal Schmidt <[email protected]>
Date:   Mon Apr 14 11:50:19 2025 -0700

    bnxt_re: avoid shift undefined behavior in bnxt_qplib_alloc_init_hwq
    
    commit 78cfd17142ef70599d6409cbd709d94b3da58659 upstream.
    
    Undefined behavior is triggered when bnxt_qplib_alloc_init_hwq is called
    with hwq_attr->aux_depth != 0 and hwq_attr->aux_stride == 0.
    In that case, "roundup_pow_of_two(hwq_attr->aux_stride)" gets called.
    roundup_pow_of_two is documented as undefined for 0.
    
    Fix it in the one caller that had this combination.
    
    The undefined behavior was detected by UBSAN:
      UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
      shift exponent 64 is too large for 64-bit type 'long unsigned int'
      CPU: 24 PID: 1075 Comm: (udev-worker) Not tainted 6.9.0-rc6+ #4
      Hardware name: Abacus electric, s.r.o. - [email protected] Super Server/H12SSW-iN, BIOS 2.7 10/25/2023
      Call Trace:
       <TASK>
       dump_stack_lvl+0x5d/0x80
       ubsan_epilogue+0x5/0x30
       __ubsan_handle_shift_out_of_bounds.cold+0x61/0xec
       __roundup_pow_of_two+0x25/0x35 [bnxt_re]
       bnxt_qplib_alloc_init_hwq+0xa1/0x470 [bnxt_re]
       bnxt_qplib_create_qp+0x19e/0x840 [bnxt_re]
       bnxt_re_create_qp+0x9b1/0xcd0 [bnxt_re]
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? __kmalloc+0x1b6/0x4f0
       ? create_qp.part.0+0x128/0x1c0 [ib_core]
       ? __pfx_bnxt_re_create_qp+0x10/0x10 [bnxt_re]
       create_qp.part.0+0x128/0x1c0 [ib_core]
       ib_create_qp_kernel+0x50/0xd0 [ib_core]
       create_mad_qp+0x8e/0xe0 [ib_core]
       ? __pfx_qp_event_handler+0x10/0x10 [ib_core]
       ib_mad_init_device+0x2be/0x680 [ib_core]
       add_client_context+0x10d/0x1a0 [ib_core]
       enable_device_and_get+0xe0/0x1d0 [ib_core]
       ib_register_device+0x53c/0x630 [ib_core]
       ? srso_alias_return_thunk+0x5/0xfbef5
       bnxt_re_probe+0xbd8/0xe50 [bnxt_re]
       ? __pfx_bnxt_re_probe+0x10/0x10 [bnxt_re]
       auxiliary_bus_probe+0x49/0x80
       ? driver_sysfs_add+0x57/0xc0
       really_probe+0xde/0x340
       ? pm_runtime_barrier+0x54/0x90
       ? __pfx___driver_attach+0x10/0x10
       __driver_probe_device+0x78/0x110
       driver_probe_device+0x1f/0xa0
       __driver_attach+0xba/0x1c0
       bus_for_each_dev+0x8f/0xe0
       bus_add_driver+0x146/0x220
       driver_register+0x72/0xd0
       __auxiliary_driver_register+0x6e/0xd0
       ? __pfx_bnxt_re_mod_init+0x10/0x10 [bnxt_re]
       bnxt_re_mod_init+0x3e/0xff0 [bnxt_re]
       ? __pfx_bnxt_re_mod_init+0x10/0x10 [bnxt_re]
       do_one_initcall+0x5b/0x310
       do_init_module+0x90/0x250
       init_module_from_file+0x86/0xc0
       idempotent_init_module+0x121/0x2b0
       __x64_sys_finit_module+0x5e/0xb0
       do_syscall_64+0x82/0x160
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? syscall_exit_to_user_mode_prepare+0x149/0x170
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? syscall_exit_to_user_mode+0x75/0x230
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? do_syscall_64+0x8e/0x160
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? __count_memcg_events+0x69/0x100
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? count_memcg_events.constprop.0+0x1a/0x30
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? handle_mm_fault+0x1f0/0x300
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? do_user_addr_fault+0x34e/0x640
       ? srso_alias_return_thunk+0x5/0xfbef5
       ? srso_alias_return_thunk+0x5/0xfbef5
       entry_SYSCALL_64_after_hwframe+0x76/0x7e
      RIP: 0033:0x7f4e5132821d
      Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 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 e3 db 0c 00 f7 d8 64 89 01 48
      RSP: 002b:00007ffca9c906a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      RAX: ffffffffffffffda RBX: 0000563ec8a8f130 RCX: 00007f4e5132821d
      RDX: 0000000000000000 RSI: 00007f4e518fa07d RDI: 000000000000003b
      RBP: 00007ffca9c90760 R08: 00007f4e513f6b20 R09: 00007ffca9c906f0
      R10: 0000563ec8a8faa0 R11: 0000000000000246 R12: 00007f4e518fa07d
      R13: 0000000000020000 R14: 0000563ec8409e90 R15: 0000563ec8a8fa60
       </TASK>
      ---[ end trace ]---
    
    Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation")
    Signed-off-by: Michal Schmidt <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Acked-by: Selvin Xavier <[email protected]>
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [Harshit: backport to 5.15.y, this is a clean cherrypick from 6.1.y
    commit ]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bpf: Add endian modifiers to fix endian warnings [+ + +]
Author: Ben Dooks <[email protected]>
Date:   Thu Jul 14 11:51:01 2022 +0100

    bpf: Add endian modifiers to fix endian warnings
    
    [ Upstream commit 96a233e600df351bcb06e3c20efe048855552926 ]
    
    A couple of the syscalls which load values (bpf_skb_load_helper_16() and
    bpf_skb_load_helper_32()) are using u16/u32 types which are triggering
    warnings as they are then converted from big-endian to CPU-endian. Fix
    these by making the types __be instead.
    
    Fixes the following sparse warnings:
    
      net/core/filter.c:246:32: warning: cast to restricted __be16
      net/core/filter.c:246:32: warning: cast to restricted __be16
      net/core/filter.c:246:32: warning: cast to restricted __be16
      net/core/filter.c:246:32: warning: cast to restricted __be16
      net/core/filter.c:273:32: warning: cast to restricted __be32
      net/core/filter.c:273:32: warning: cast to restricted __be32
      net/core/filter.c:273:32: warning: cast to restricted __be32
      net/core/filter.c:273:32: warning: cast to restricted __be32
      net/core/filter.c:273:32: warning: cast to restricted __be32
      net/core/filter.c:273:32: warning: cast to restricted __be32
    
    Signed-off-by: Ben Dooks <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Stable-dep-of: d4bac0288a2b ("bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags")
    Signed-off-by: Sasha Levin <[email protected]>

bpf: avoid holding freeze_mutex during mmap operation [+ + +]
Author: Andrii Nakryiko <[email protected]>
Date:   Tue Jan 28 17:22:46 2025 -0800

    bpf: avoid holding freeze_mutex during mmap operation
    
    commit bc27c52eea189e8f7492d40739b7746d67b65beb upstream.
    
    We use map->freeze_mutex to prevent races between map_freeze() and
    memory mapping BPF map contents with writable permissions. The way we
    naively do this means we'll hold freeze_mutex for entire duration of all
    the mm and VMA manipulations, which is completely unnecessary. This can
    potentially also lead to deadlocks, as reported by syzbot in [0].
    
    So, instead, hold freeze_mutex only during writeability checks, bump
    (proactively) "write active" count for the map, unlock the mutex and
    proceed with mmap logic. And only if something went wrong during mmap
    logic, then undo that "write active" counter increment.
    
      [0] https://lore.kernel.org/bpf/[email protected]/
    
    Fixes: fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
    Reported-by: [email protected]
    Signed-off-by: Andrii Nakryiko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: David Sauerwein <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers [+ + +]
Author: Hou Tao <[email protected]>
Date:   Mon Dec 4 22:04:19 2023 +0800

    bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers
    
    commit 169410eba271afc9f0fb476d996795aa26770c6d upstream.
    
    These three bpf_map_{lookup,update,delete}_elem() helpers are also
    available for sleepable bpf program, so add the corresponding lock
    assertion for sleepable bpf program, otherwise the following warning
    will be reported when a sleepable bpf program manipulates bpf map under
    interpreter mode (aka bpf_jit_enable=0):
    
      WARNING: CPU: 3 PID: 4985 at kernel/bpf/helpers.c:40 ......
      CPU: 3 PID: 4985 Comm: test_progs Not tainted 6.6.0+ #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) ......
      RIP: 0010:bpf_map_lookup_elem+0x54/0x60
      ......
      Call Trace:
       <TASK>
       ? __warn+0xa5/0x240
       ? bpf_map_lookup_elem+0x54/0x60
       ? report_bug+0x1ba/0x1f0
       ? handle_bug+0x40/0x80
       ? exc_invalid_op+0x18/0x50
       ? asm_exc_invalid_op+0x1b/0x20
       ? __pfx_bpf_map_lookup_elem+0x10/0x10
       ? rcu_lockdep_current_cpu_online+0x65/0xb0
       ? rcu_is_watching+0x23/0x50
       ? bpf_map_lookup_elem+0x54/0x60
       ? __pfx_bpf_map_lookup_elem+0x10/0x10
       ___bpf_prog_run+0x513/0x3b70
       __bpf_prog_run32+0x9d/0xd0
       ? __bpf_prog_enter_sleepable_recur+0xad/0x120
       ? __bpf_prog_enter_sleepable_recur+0x3e/0x120
       bpf_trampoline_6442580665+0x4d/0x1000
       __x64_sys_getpgid+0x5/0x30
       ? do_syscall_64+0x36/0xb0
       entry_SYSCALL_64_after_hwframe+0x6e/0x76
       </TASK>
    
    Signed-off-by: Hou Tao <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Cliff Liu <[email protected]>
    Signed-off-by: He Zhe <[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]>

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

 
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
    
    [ Upstream commit b4885bd5935bb26f0a414ad55679a372e53f9b9b ]
    
    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: Sasha Levin <[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()
    
    [ Upstream commit 2510859475d7f46ed7940db0853f3342bf1b65ee ]
    
    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: Sasha Levin <[email protected]>

cifs: Fix UAF in cifs_demultiplex_thread() [+ + +]
Author: Zhang Xiaoxu <[email protected]>
Date:   Tue Sep 19 13:38:04 2023 -0500

    cifs: Fix UAF in cifs_demultiplex_thread()
    
    commit d527f51331cace562393a8038d870b3e9916686f upstream.
    
    There is a UAF when xfstests on cifs:
    
      BUG: KASAN: use-after-free in smb2_is_network_name_deleted+0x27/0x160
      Read of size 4 at addr ffff88810103fc08 by task cifsd/923
    
      CPU: 1 PID: 923 Comm: cifsd Not tainted 6.1.0-rc4+ #45
      ...
      Call Trace:
       <TASK>
       dump_stack_lvl+0x34/0x44
       print_report+0x171/0x472
       kasan_report+0xad/0x130
       kasan_check_range+0x145/0x1a0
       smb2_is_network_name_deleted+0x27/0x160
       cifs_demultiplex_thread.cold+0x172/0x5a4
       kthread+0x165/0x1a0
       ret_from_fork+0x1f/0x30
       </TASK>
    
      Allocated by task 923:
       kasan_save_stack+0x1e/0x40
       kasan_set_track+0x21/0x30
       __kasan_slab_alloc+0x54/0x60
       kmem_cache_alloc+0x147/0x320
       mempool_alloc+0xe1/0x260
       cifs_small_buf_get+0x24/0x60
       allocate_buffers+0xa1/0x1c0
       cifs_demultiplex_thread+0x199/0x10d0
       kthread+0x165/0x1a0
       ret_from_fork+0x1f/0x30
    
      Freed by task 921:
       kasan_save_stack+0x1e/0x40
       kasan_set_track+0x21/0x30
       kasan_save_free_info+0x2a/0x40
       ____kasan_slab_free+0x143/0x1b0
       kmem_cache_free+0xe3/0x4d0
       cifs_small_buf_release+0x29/0x90
       SMB2_negotiate+0x8b7/0x1c60
       smb2_negotiate+0x51/0x70
       cifs_negotiate_protocol+0xf0/0x160
       cifs_get_smb_ses+0x5fa/0x13c0
       mount_get_conns+0x7a/0x750
       cifs_mount+0x103/0xd00
       cifs_smb3_do_mount+0x1dd/0xcb0
       smb3_get_tree+0x1d5/0x300
       vfs_get_tree+0x41/0xf0
       path_mount+0x9b3/0xdd0
       __x64_sys_mount+0x190/0x1d0
       do_syscall_64+0x35/0x80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    The UAF is because:
    
     mount(pid: 921)               | cifsd(pid: 923)
    -------------------------------|-------------------------------
                                   | cifs_demultiplex_thread
    SMB2_negotiate                 |
     cifs_send_recv                |
      compound_send_recv           |
       smb_send_rqst               |
        wait_for_response          |
         wait_event_state      [1] |
                                   |  standard_receive3
                                   |   cifs_handle_standard
                                   |    handle_mid
                                   |     mid->resp_buf = buf;  [2]
                                   |     dequeue_mid           [3]
         KILL the process      [4] |
        resp_iov[i].iov_base = buf |
     free_rsp_buf              [5] |
                                   |   is_network_name_deleted [6]
                                   |   callback
    
    1. After send request to server, wait the response until
        mid->mid_state != SUBMITTED;
    2. Receive response from server, and set it to mid;
    3. Set the mid state to RECEIVED;
    4. Kill the process, the mid state already RECEIVED, get 0;
    5. Handle and release the negotiate response;
    6. UAF.
    
    It can be easily reproduce with add some delay in [3] - [6].
    
    Only sync call has the problem since async call's callback is
    executed in cifsd process.
    
    Add an extra state to mark the mid state to READY before wakeup the
    waitter, then it can get the resp safely.
    
    Fixes: ec637e3ffb6b ("[CIFS] Avoid extra large buffer allocation (and memcpy) in cifs_readpages")
    Reviewed-by: Paulo Alcantara (SUSE) <[email protected]>
    Signed-off-by: Zhang Xiaoxu <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [fs/cifs was moved to fs/smb/client since
    38c8a9a52082 ("smb: move client and server files to common directory fs/smb").
    We apply the patch to fs/cifs with some minor context changes.]
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cifs: print TIDs as hex [+ + +]
Author: Enzo Matsumiya <[email protected]>
Date:   Wed May 18 11:41:04 2022 -0300

    cifs: print TIDs as hex
    
    [ Upstream commit 71081e7ac16c93acdd18afa65daa468620bb1b64 ]
    
    Makes these debug messages easier to read
    
    Signed-off-by: Enzo Matsumiya <[email protected]>
    Reviewed-by: Paulo Alcantara (SUSE) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Stable-dep-of: b4885bd5935b ("cifs: avoid NULL pointer dereference in dbg call")
    Signed-off-by: Sasha Levin <[email protected]>

 
clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec() [+ + +]
Author: Heiko Stuebner <[email protected]>
Date:   Sat Feb 22 23:37:33 2025 +0100

    clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec()
    
    [ Upstream commit b20150d499b3ee5c2d632fbc5ac94f98dd33accf ]
    
    of_clk_get_hw_from_clkspec() checks all available clock-providers by
    comparing their of nodes to the one from the clkspec. If no matching
    clock provider is found, the function returns -EPROBE_DEFER to cause a
    re-check at a later date. If a matching clock provider is found, an
    authoritative answer can be retrieved from it whether the clock exists
    or not.
    
    This does not take into account that the clock-provider may never
    appear, because it's node is disabled. This can happen when a clock is
    optional, provided by a separate block which never gets enabled.
    
    One example of this happening is the rk3588's VOP, which has optional
    additional display clocks coming from PLLs inside the hdmiphy blocks.
    These can be used for better rates, but the system will also work
    without them.
    
    The problem around that is described in the followups to[1]. As we
    already know the of node of the presumed clock provider, add a check via
    of_device_is_available() whether this is a "valid" device node. This
    prevents eternal defer loops.
    
    Link: https://lore.kernel.org/dri-devel/[email protected]/ [1]
    Reviewed-by: Sebastian Reichel <[email protected]>
    Tested-by: Cristian Ciocaltea <[email protected]>
    Signed-off-by: Heiko Stuebner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [[email protected]: Reword commit text a bit]
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Sasha Levin <[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]>

 
comedi: jr3_pci: Fix synchronous deletion of timer [+ + +]
Author: Ian Abbott <[email protected]>
Date:   Tue Apr 15 13:39:01 2025 +0100

    comedi: jr3_pci: Fix synchronous deletion of timer
    
    commit 44d9b3f584c59a606b521e7274e658d5b866c699 upstream.
    
    When `jr3_pci_detach()` is called during device removal, it calls
    `timer_delete_sync()` to stop the timer, but the timer expiry function
    always reschedules the timer, so the synchronization is ineffective.
    
    Call `timer_shutdown_sync()` instead.  It does not matter that the timer
    expiry function pointer is cleared, because the device is being removed.
    
    Fixes: 07b509e6584a5 ("Staging: comedi: add jr3_pci driver")
    Cc: stable <[email protected]>
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[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: cppc: Fix invalid return value in .get() callback [+ + +]
Author: Marc Zyngier <[email protected]>
Date:   Sun Apr 13 11:11:42 2025 +0100

    cpufreq: cppc: Fix invalid return value in .get() callback
    
    [ Upstream commit 2b8e6b58889c672e1ae3601d9b2b070be4dc2fbc ]
    
    Returning a negative error code in a function with an unsigned
    return type is a pretty bad idea. It is probably worse when the
    justification for the change is "our static analisys tool found it".
    
    Fixes: cf7de25878a1 ("cppc_cpufreq: Fix possible null pointer dereference")
    Signed-off-by: Marc Zyngier <[email protected]>
    Cc: "Rafael J. Wysocki" <[email protected]>
    Cc: Viresh Kumar <[email protected]>
    Reviewed-by: Lifeng Zheng <[email protected]>
    Signed-off-by: Viresh Kumar <[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]>

cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate() [+ + +]
Author: Henry Martin <[email protected]>
Date:   Tue Apr 8 23:03:53 2025 +0800

    cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate()
    
    [ Upstream commit 484d3f15cc6cbaa52541d6259778e715b2c83c54 ]
    
    cpufreq_cpu_get_raw() can return NULL when the target CPU is not present
    in the policy->cpus mask. scmi_cpufreq_get_rate() does not check for
    this case, which results in a NULL pointer dereference.
    
    Add NULL check after cpufreq_cpu_get_raw() to prevent this issue.
    
    Fixes: 99d6bdf33877 ("cpufreq: add support for CPU DVFS based on SCMI message protocol")
    Signed-off-by: Henry Martin <[email protected]>
    Acked-by: Sudeep Holla <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

cpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() [+ + +]
Author: Henry Martin <[email protected]>
Date:   Tue Apr 8 23:03:54 2025 +0800

    cpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate()
    
    [ Upstream commit 73b24dc731731edf762f9454552cb3a5b7224949 ]
    
    cpufreq_cpu_get_raw() can return NULL when the target CPU is not present
    in the policy->cpus mask. scpi_cpufreq_get_rate() does not check for
    this case, which results in a NULL pointer dereference.
    
    Fixes: 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")
    Signed-off-by: Henry Martin <[email protected]>
    Acked-by: Sudeep Holla <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
crypto: atmel-sha204a - Set hwrng quality to lowest possible [+ + +]
Author: Marek Behún <[email protected]>
Date:   Tue Apr 22 11:57:18 2025 +0200

    crypto: atmel-sha204a - Set hwrng quality to lowest possible
    
    commit 8006aff15516a170640239c5a8e6696c0ba18d8e upstream.
    
    According to the review by Bill Cox [1], the Atmel SHA204A random number
    generator produces random numbers with very low entropy.
    
    Set the lowest possible entropy for this chip just to be safe.
    
    [1] https://www.metzdowd.com/pipermail/cryptography/2014-December/023858.html
    
    Fixes: da001fb651b00e1d ("crypto: atmel-i2c - add support for SHA204A random number generator")
    Cc: <[email protected]>
    Signed-off-by: Marek Behún <[email protected]>
    Acked-by: Ard Biesheuvel <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Marek Behún <[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]>

crypto: null - Use spin lock instead of mutex [+ + +]
Author: Herbert Xu <[email protected]>
Date:   Wed Feb 12 14:10:07 2025 +0800

    crypto: null - Use spin lock instead of mutex
    
    [ Upstream commit dcc47a028c24e793ce6d6efebfef1a1e92f80297 ]
    
    As the null algorithm may be freed in softirq context through
    af_alg, use spin locks instead of mutexes to protect the default
    null algorithm.
    
    Reported-by: [email protected]
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[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 cache: fix flushing uninitialized delayed_work on cache_ctr error [+ + +]
Author: Ming-Hung Tsai <[email protected]>
Date:   Tue Oct 22 15:12:49 2024 +0800

    dm cache: fix flushing uninitialized delayed_work on cache_ctr error
    
    commit 135496c208ba26fd68cdef10b64ed7a91ac9a7ff upstream.
    
    An unexpected WARN_ON from flush_work() may occur when cache creation
    fails, caused by destroying the uninitialized delayed_work waker in the
    error path of cache_create(). For example, the warning appears on the
    superblock checksum error.
    
    Reproduce steps:
    
    dmsetup create cmeta --table "0 8192 linear /dev/sdc 0"
    dmsetup create cdata --table "0 65536 linear /dev/sdc 8192"
    dmsetup create corig --table "0 524288 linear /dev/sdc 262144"
    dd if=/dev/urandom of=/dev/mapper/cmeta bs=4k count=1 oflag=direct
    dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \
    /dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0"
    
    Kernel logs:
    
    (snip)
    WARNING: CPU: 0 PID: 84 at kernel/workqueue.c:4178 __flush_work+0x5d4/0x890
    
    Fix by pulling out the cancel_delayed_work_sync() from the constructor's
    error path. This patch doesn't affect the use-after-free fix for
    concurrent dm_resume and dm_destroy (commit 6a459d8edbdb ("dm cache: Fix
    UAF in destroy()")) as cache_dtr is not changed.
    
    Signed-off-by: Ming-Hung Tsai <[email protected]>
    Fixes: 6a459d8edbdb ("dm cache: Fix UAF in destroy()")
    Cc: [email protected]
    Signed-off-by: Mikulas Patocka <[email protected]>
    Acked-by: Joe Thornber <[email protected]>
    Signed-off-by: Ilia Gavrilov <[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]>

 
dma/contiguous: avoid warning about unused size_bytes [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Wed Apr 9 17:15:42 2025 +0200

    dma/contiguous: avoid warning about unused size_bytes
    
    [ Upstream commit d7b98ae5221007d3f202746903d4c21c7caf7ea9 ]
    
    When building with W=1, this variable is unused for configs with
    CONFIG_CMA_SIZE_SEL_PERCENTAGE=y:
    
    kernel/dma/contiguous.c:67:26: error: 'size_bytes' defined but not used [-Werror=unused-const-variable=]
    
    Change this to a macro to avoid the warning.
    
    Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
dmaengine: dmatest: Fix dmatest waiting less when interrupted [+ + +]
Author: Vinicius Costa Gomes <[email protected]>
Date:   Wed Mar 5 15:00:06 2025 -0800

    dmaengine: dmatest: Fix dmatest waiting less when interrupted
    
    [ Upstream commit e87ca16e99118ab4e130a41bdf12abbf6a87656c ]
    
    Change the "wait for operation finish" logic to take interrupts into
    account.
    
    When using dmatest with idxd DMA engine, it's possible that during
    longer tests, the interrupt notifying the finish of an operation
    happens during wait_event_freezable_timeout(), which causes dmatest to
    cleanup all the resources, some of which might still be in use.
    
    This fix ensures that the wait logic correctly handles interrupts,
    preventing premature cleanup of resources.
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-lkp/[email protected]
    Signed-off-by: Vinicius Costa Gomes <[email protected]>
    Reviewed-by: Dave Jiang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drivers: 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 null checks for 'stream' and 'plane' before dereferencing [+ + +]
Author: Srinivasan Shanmugam <[email protected]>
Date:   Mon May 27 20:15:21 2024 +0530

    drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing
    
    commit 15c2990e0f0108b9c3752d7072a97d45d4283aea upstream.
    
    This commit adds null checks for the 'stream' and 'plane' variables in
    the dcn30_apply_idle_power_optimizations function. These variables were
    previously assumed to be null at line 922, but they were used later in
    the code without checking if they were null. This could potentially lead
    to a null pointer dereference, which would cause a crash.
    
    The null checks ensure that 'stream' and 'plane' are not null before
    they are used, preventing potential crashes.
    
    Fixes the below static smatch checker:
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:938 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 922)
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:940 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 922)
    
    Cc: Tom Chung <[email protected]>
    Cc: Nicholas Kazlauskas <[email protected]>
    Cc: Bhawanpreet Lakha <[email protected]>
    Cc: Rodrigo Siqueira <[email protected]>
    Cc: Roman Li <[email protected]>
    Cc: Hersen Wu <[email protected]>
    Cc: Alex Hung <[email protected]>
    Cc: Aurabindo Pillai <[email protected]>
    Cc: Harry Wentland <[email protected]>
    Signed-off-by: Srinivasan Shanmugam <[email protected]>
    Reviewed-by: Aurabindo Pillai <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Zhi Yang <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: fix double free issue during amdgpu module unload [+ + +]
Author: Tim Huang <[email protected]>
Date:   Thu Aug 15 18:45:22 2024 -0400

    drm/amd/display: fix double free issue during amdgpu module unload
    
    commit 20b5a8f9f4670a8503aa9fa95ca632e77c6bf55d upstream.
    
    Flexible endpoints use DIGs from available inflexible endpoints,
    so only the encoders of inflexible links need to be freed.
    Otherwise, a double free issue may occur when unloading the
    amdgpu module.
    
    [  279.190523] RIP: 0010:__slab_free+0x152/0x2f0
    [  279.190577] Call Trace:
    [  279.190580]  <TASK>
    [  279.190582]  ? show_regs+0x69/0x80
    [  279.190590]  ? die+0x3b/0x90
    [  279.190595]  ? do_trap+0xc8/0xe0
    [  279.190601]  ? do_error_trap+0x73/0xa0
    [  279.190605]  ? __slab_free+0x152/0x2f0
    [  279.190609]  ? exc_invalid_op+0x56/0x70
    [  279.190616]  ? __slab_free+0x152/0x2f0
    [  279.190642]  ? asm_exc_invalid_op+0x1f/0x30
    [  279.190648]  ? dcn10_link_encoder_destroy+0x19/0x30 [amdgpu]
    [  279.191096]  ? __slab_free+0x152/0x2f0
    [  279.191102]  ? dcn10_link_encoder_destroy+0x19/0x30 [amdgpu]
    [  279.191469]  kfree+0x260/0x2b0
    [  279.191474]  dcn10_link_encoder_destroy+0x19/0x30 [amdgpu]
    [  279.191821]  link_destroy+0xd7/0x130 [amdgpu]
    [  279.192248]  dc_destruct+0x90/0x270 [amdgpu]
    [  279.192666]  dc_destroy+0x19/0x40 [amdgpu]
    [  279.193020]  amdgpu_dm_fini+0x16e/0x200 [amdgpu]
    [  279.193432]  dm_hw_fini+0x26/0x40 [amdgpu]
    [  279.193795]  amdgpu_device_fini_hw+0x24c/0x400 [amdgpu]
    [  279.194108]  amdgpu_driver_unload_kms+0x4f/0x70 [amdgpu]
    [  279.194436]  amdgpu_pci_remove+0x40/0x80 [amdgpu]
    [  279.194632]  pci_device_remove+0x3a/0xa0
    [  279.194638]  device_remove+0x40/0x70
    [  279.194642]  device_release_driver_internal+0x1ad/0x210
    [  279.194647]  driver_detach+0x4e/0xa0
    [  279.194650]  bus_remove_driver+0x6f/0xf0
    [  279.194653]  driver_unregister+0x33/0x60
    [  279.194657]  pci_unregister_driver+0x44/0x90
    [  279.194662]  amdgpu_exit+0x19/0x1f0 [amdgpu]
    [  279.194939]  __do_sys_delete_module.isra.0+0x198/0x2f0
    [  279.194946]  __x64_sys_delete_module+0x16/0x20
    [  279.194950]  do_syscall_64+0x58/0x120
    [  279.194954]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
    [  279.194980]  </TASK>
    
    Reviewed-by: Rodrigo Siqueira <[email protected]>
    Signed-off-by: Tim Huang <[email protected]>
    Reviewed-by: Roman Li <[email protected]>
    Signed-off-by: Roman Li <[email protected]>
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    [ dc_link_destruct() moved from core/dc_link.c to link/link_factory.c since
    commit: 54618888d1ea ("drm/amd/display: break down dc_link.c"), so modified
    the path to apply on 5.15.y ]
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: Fix gpu reset in multidisplay config [+ + +]
Author: Roman Li <[email protected]>
Date:   Tue Apr 1 17:05:10 2025 -0400

    drm/amd/display: Fix gpu reset in multidisplay config
    
    commit 7eb287beeb60be1e4437be2b4e4e9f0da89aab97 upstream.
    
    [Why]
    The indexing of stream_status in dm_gpureset_commit_state() is incorrect.
    That leads to asserts in multi-display configuration after gpu reset.
    
    [How]
    Adjust the indexing logic to align stream_status with surface_updates.
    
    Fixes: cdaae8371aa9 ("drm/amd/display: Handle GPU reset for DC block")
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3808
    Reviewed-by: Aurabindo Pillai <[email protected]>
    Reviewed-by: Mario Limonciello <[email protected]>
    Signed-off-by: Roman Li <[email protected]>
    Signed-off-by: Zaeem Mohamed <[email protected]>
    Tested-by: Mark Broadworth <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit d91bc901398741d317d9b55c59ca949d4bc7394b)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: Fix out-of-bounds access in 'dcn21_link_encoder_create' [+ + +]
Author: Srinivasan Shanmugam <[email protected]>
Date:   Wed Sep 25 20:04:15 2024 +0530

    drm/amd/display: Fix out-of-bounds access in 'dcn21_link_encoder_create'
    
    commit 63de35a8fcfca59ae8750d469a7eb220c7557baf upstream.
    
    An issue was identified in the dcn21_link_encoder_create function where
    an out-of-bounds access could occur when the hpd_source index was used
    to reference the link_enc_hpd_regs array. This array has a fixed size
    and the index was not being checked against the array's bounds before
    accessing it.
    
    This fix adds a conditional check to ensure that the hpd_source index is
    within the valid range of the link_enc_hpd_regs array. If the index is
    out of bounds, the function now returns NULL to prevent undefined
    behavior.
    
    References:
    
    [   65.920507] ------------[ cut here ]------------
    [   65.920510] UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29
    [   65.920519] index 7 is out of range for type 'dcn10_link_enc_hpd_registers [5]'
    [   65.920523] CPU: 3 PID: 1178 Comm: modprobe Tainted: G           OE      6.8.0-cleanershaderfeatureresetasdntipmi200nv2132 #13
    [   65.920525] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS WMJ0429N_Weekly_20_04_2 04/29/2020
    [   65.920527] Call Trace:
    [   65.920529]  <TASK>
    [   65.920532]  dump_stack_lvl+0x48/0x70
    [   65.920541]  dump_stack+0x10/0x20
    [   65.920543]  __ubsan_handle_out_of_bounds+0xa2/0xe0
    [   65.920549]  dcn21_link_encoder_create+0xd9/0x140 [amdgpu]
    [   65.921009]  link_create+0x6d3/0xed0 [amdgpu]
    [   65.921355]  create_links+0x18a/0x4e0 [amdgpu]
    [   65.921679]  dc_create+0x360/0x720 [amdgpu]
    [   65.921999]  ? dmi_matches+0xa0/0x220
    [   65.922004]  amdgpu_dm_init+0x2b6/0x2c90 [amdgpu]
    [   65.922342]  ? console_unlock+0x77/0x120
    [   65.922348]  ? dev_printk_emit+0x86/0xb0
    [   65.922354]  dm_hw_init+0x15/0x40 [amdgpu]
    [   65.922686]  amdgpu_device_init+0x26a8/0x33a0 [amdgpu]
    [   65.922921]  amdgpu_driver_load_kms+0x1b/0xa0 [amdgpu]
    [   65.923087]  amdgpu_pci_probe+0x1b7/0x630 [amdgpu]
    [   65.923087]  local_pci_probe+0x4b/0xb0
    [   65.923087]  pci_device_probe+0xc8/0x280
    [   65.923087]  really_probe+0x187/0x300
    [   65.923087]  __driver_probe_device+0x85/0x130
    [   65.923087]  driver_probe_device+0x24/0x110
    [   65.923087]  __driver_attach+0xac/0x1d0
    [   65.923087]  ? __pfx___driver_attach+0x10/0x10
    [   65.923087]  bus_for_each_dev+0x7d/0xd0
    [   65.923087]  driver_attach+0x1e/0x30
    [   65.923087]  bus_add_driver+0xf2/0x200
    [   65.923087]  driver_register+0x64/0x130
    [   65.923087]  ? __pfx_amdgpu_init+0x10/0x10 [amdgpu]
    [   65.923087]  __pci_register_driver+0x61/0x70
    [   65.923087]  amdgpu_init+0x7d/0xff0 [amdgpu]
    [   65.923087]  do_one_initcall+0x49/0x310
    [   65.923087]  ? kmalloc_trace+0x136/0x360
    [   65.923087]  do_init_module+0x6a/0x270
    [   65.923087]  load_module+0x1fce/0x23a0
    [   65.923087]  init_module_from_file+0x9c/0xe0
    [   65.923087]  ? init_module_from_file+0x9c/0xe0
    [   65.923087]  idempotent_init_module+0x179/0x230
    [   65.923087]  __x64_sys_finit_module+0x5d/0xa0
    [   65.923087]  do_syscall_64+0x76/0x120
    [   65.923087]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
    [   65.923087] RIP: 0033:0x7f2d80f1e88d
    [   65.923087] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 73 b5 0f 00 f7 d8 64 89 01 48
    [   65.923087] RSP: 002b:00007ffc7bc1aa78 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [   65.923087] RAX: ffffffffffffffda RBX: 0000564c9c1db130 RCX: 00007f2d80f1e88d
    [   65.923087] RDX: 0000000000000000 RSI: 0000564c9c1e5480 RDI: 000000000000000f
    [   65.923087] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000002
    [   65.923087] R10: 000000000000000f R11: 0000000000000246 R12: 0000564c9c1e5480
    [   65.923087] R13: 0000564c9c1db260 R14: 0000000000000000 R15: 0000564c9c1e54b0
    [   65.923087]  </TASK>
    [   65.923927] ---[ end trace ]---
    
    Cc: Tom Chung <[email protected]>
    Cc: Rodrigo Siqueira <[email protected]>
    Cc: Roman Li <[email protected]>
    Cc: Alex Hung <[email protected]>
    Cc: Aurabindo Pillai <[email protected]>
    Cc: Harry Wentland <[email protected]>
    Cc: Hamza Mahfooz <[email protected]>
    Signed-off-by: Srinivasan Shanmugam <[email protected]>
    Reviewed-by: Roman Li <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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/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/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: fix usage slab after free [+ + +]
Author: Vitaly Prosyak <[email protected]>
Date:   Mon Nov 11 17:24:08 2024 -0500

    drm/amdgpu: fix usage slab after free
    
    commit b61badd20b443eabe132314669bb51a263982e5c upstream.
    
    [  +0.000021] BUG: KASAN: slab-use-after-free in drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
    [  +0.000027] Read of size 8 at addr ffff8881b8605f88 by task amd_pci_unplug/2147
    
    [  +0.000023] CPU: 6 PID: 2147 Comm: amd_pci_unplug Not tainted 6.10.0+ #1
    [  +0.000016] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020
    [  +0.000016] Call Trace:
    [  +0.000008]  <TASK>
    [  +0.000009]  dump_stack_lvl+0x76/0xa0
    [  +0.000017]  print_report+0xce/0x5f0
    [  +0.000017]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
    [  +0.000019]  ? srso_return_thunk+0x5/0x5f
    [  +0.000015]  ? kasan_complete_mode_report_info+0x72/0x200
    [  +0.000016]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
    [  +0.000019]  kasan_report+0xbe/0x110
    [  +0.000015]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
    [  +0.000023]  __asan_report_load8_noabort+0x14/0x30
    [  +0.000014]  drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
    [  +0.000020]  ? srso_return_thunk+0x5/0x5f
    [  +0.000013]  ? __kasan_check_write+0x14/0x30
    [  +0.000016]  ? __pfx_drm_sched_entity_flush+0x10/0x10 [gpu_sched]
    [  +0.000020]  ? srso_return_thunk+0x5/0x5f
    [  +0.000013]  ? __kasan_check_write+0x14/0x30
    [  +0.000013]  ? srso_return_thunk+0x5/0x5f
    [  +0.000013]  ? enable_work+0x124/0x220
    [  +0.000015]  ? __pfx_enable_work+0x10/0x10
    [  +0.000013]  ? srso_return_thunk+0x5/0x5f
    [  +0.000014]  ? free_large_kmalloc+0x85/0xf0
    [  +0.000016]  drm_sched_entity_destroy+0x18/0x30 [gpu_sched]
    [  +0.000020]  amdgpu_vce_sw_fini+0x55/0x170 [amdgpu]
    [  +0.000735]  ? __kasan_check_read+0x11/0x20
    [  +0.000016]  vce_v4_0_sw_fini+0x80/0x110 [amdgpu]
    [  +0.000726]  amdgpu_device_fini_sw+0x331/0xfc0 [amdgpu]
    [  +0.000679]  ? mutex_unlock+0x80/0xe0
    [  +0.000017]  ? __pfx_amdgpu_device_fini_sw+0x10/0x10 [amdgpu]
    [  +0.000662]  ? srso_return_thunk+0x5/0x5f
    [  +0.000014]  ? __kasan_check_write+0x14/0x30
    [  +0.000013]  ? srso_return_thunk+0x5/0x5f
    [  +0.000013]  ? mutex_unlock+0x80/0xe0
    [  +0.000016]  amdgpu_driver_release_kms+0x16/0x80 [amdgpu]
    [  +0.000663]  drm_minor_release+0xc9/0x140 [drm]
    [  +0.000081]  drm_release+0x1fd/0x390 [drm]
    [  +0.000082]  __fput+0x36c/0xad0
    [  +0.000018]  __fput_sync+0x3c/0x50
    [  +0.000014]  __x64_sys_close+0x7d/0xe0
    [  +0.000014]  x64_sys_call+0x1bc6/0x2680
    [  +0.000014]  do_syscall_64+0x70/0x130
    [  +0.000014]  ? srso_return_thunk+0x5/0x5f
    [  +0.000014]  ? irqentry_exit_to_user_mode+0x60/0x190
    [  +0.000015]  ? srso_return_thunk+0x5/0x5f
    [  +0.000014]  ? irqentry_exit+0x43/0x50
    [  +0.000012]  ? srso_return_thunk+0x5/0x5f
    [  +0.000013]  ? exc_page_fault+0x7c/0x110
    [  +0.000015]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
    [  +0.000014] RIP: 0033:0x7ffff7b14f67
    [  +0.000013] Code: ff e8 0d 16 02 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 73 ba f7 ff
    [  +0.000026] RSP: 002b:00007fffffffe378 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
    [  +0.000019] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffff7b14f67
    [  +0.000014] RDX: 0000000000000000 RSI: 00007ffff7f6f47a RDI: 0000000000000003
    [  +0.000014] RBP: 00007fffffffe3a0 R08: 0000555555569890 R09: 0000000000000000
    [  +0.000014] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffffffe5c8
    [  +0.000013] R13: 00005555555552a9 R14: 0000555555557d48 R15: 00007ffff7ffd040
    [  +0.000020]  </TASK>
    
    [  +0.000016] Allocated by task 383 on cpu 7 at 26.880319s:
    [  +0.000014]  kasan_save_stack+0x28/0x60
    [  +0.000008]  kasan_save_track+0x18/0x70
    [  +0.000007]  kasan_save_alloc_info+0x38/0x60
    [  +0.000007]  __kasan_kmalloc+0xc1/0xd0
    [  +0.000007]  kmalloc_trace_noprof+0x180/0x380
    [  +0.000007]  drm_sched_init+0x411/0xec0 [gpu_sched]
    [  +0.000012]  amdgpu_device_init+0x695f/0xa610 [amdgpu]
    [  +0.000658]  amdgpu_driver_load_kms+0x1a/0x120 [amdgpu]
    [  +0.000662]  amdgpu_pci_probe+0x361/0xf30 [amdgpu]
    [  +0.000651]  local_pci_probe+0xe7/0x1b0
    [  +0.000009]  pci_device_probe+0x248/0x890
    [  +0.000008]  really_probe+0x1fd/0x950
    [  +0.000008]  __driver_probe_device+0x307/0x410
    [  +0.000007]  driver_probe_device+0x4e/0x150
    [  +0.000007]  __driver_attach+0x223/0x510
    [  +0.000006]  bus_for_each_dev+0x102/0x1a0
    [  +0.000007]  driver_attach+0x3d/0x60
    [  +0.000006]  bus_add_driver+0x2ac/0x5f0
    [  +0.000006]  driver_register+0x13d/0x490
    [  +0.000008]  __pci_register_driver+0x1ee/0x2b0
    [  +0.000007]  llc_sap_close+0xb0/0x160 [llc]
    [  +0.000009]  do_one_initcall+0x9c/0x3e0
    [  +0.000008]  do_init_module+0x241/0x760
    [  +0.000008]  load_module+0x51ac/0x6c30
    [  +0.000006]  __do_sys_init_module+0x234/0x270
    [  +0.000007]  __x64_sys_init_module+0x73/0xc0
    [  +0.000006]  x64_sys_call+0xe3/0x2680
    [  +0.000006]  do_syscall_64+0x70/0x130
    [  +0.000007]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    [  +0.000015] Freed by task 2147 on cpu 6 at 160.507651s:
    [  +0.000013]  kasan_save_stack+0x28/0x60
    [  +0.000007]  kasan_save_track+0x18/0x70
    [  +0.000007]  kasan_save_free_info+0x3b/0x60
    [  +0.000007]  poison_slab_object+0x115/0x1c0
    [  +0.000007]  __kasan_slab_free+0x34/0x60
    [  +0.000007]  kfree+0xfa/0x2f0
    [  +0.000007]  drm_sched_fini+0x19d/0x410 [gpu_sched]
    [  +0.000012]  amdgpu_fence_driver_sw_fini+0xc4/0x2f0 [amdgpu]
    [  +0.000662]  amdgpu_device_fini_sw+0x77/0xfc0 [amdgpu]
    [  +0.000653]  amdgpu_driver_release_kms+0x16/0x80 [amdgpu]
    [  +0.000655]  drm_minor_release+0xc9/0x140 [drm]
    [  +0.000071]  drm_release+0x1fd/0x390 [drm]
    [  +0.000071]  __fput+0x36c/0xad0
    [  +0.000008]  __fput_sync+0x3c/0x50
    [  +0.000007]  __x64_sys_close+0x7d/0xe0
    [  +0.000007]  x64_sys_call+0x1bc6/0x2680
    [  +0.000007]  do_syscall_64+0x70/0x130
    [  +0.000007]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    [  +0.000014] The buggy address belongs to the object at ffff8881b8605f80
                   which belongs to the cache kmalloc-64 of size 64
    [  +0.000020] The buggy address is located 8 bytes inside of
                   freed 64-byte region [ffff8881b8605f80, ffff8881b8605fc0)
    
    [  +0.000028] The buggy address belongs to the physical page:
    [  +0.000011] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b8605
    [  +0.000008] anon flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
    [  +0.000007] page_type: 0xffffefff(slab)
    [  +0.000009] raw: 0017ffffc0000000 ffff8881000428c0 0000000000000000 dead000000000001
    [  +0.000006] raw: 0000000000000000 0000000000200020 00000001ffffefff 0000000000000000
    [  +0.000006] page dumped because: kasan: bad access detected
    
    [  +0.000012] Memory state around the buggy address:
    [  +0.000011]  ffff8881b8605e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    [  +0.000015]  ffff8881b8605f00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
    [  +0.000015] >ffff8881b8605f80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    [  +0.000013]                       ^
    [  +0.000011]  ffff8881b8606000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
    [  +0.000014]  ffff8881b8606080: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb
    [  +0.000013] ==================================================================
    
    The issue reproduced on VG20 during the IGT pci_unplug test.
    The root cause of the issue is that the function drm_sched_fini is called before drm_sched_entity_kill.
    In drm_sched_fini, the drm_sched_rq structure is freed, but this structure is later accessed by
    each entity within the run queue, leading to invalid memory access.
    To resolve this, the order of cleanup calls is updated:
    
        Before:
            amdgpu_fence_driver_sw_fini
            amdgpu_device_ip_fini
    
        After:
            amdgpu_device_ip_fini
            amdgpu_fence_driver_sw_fini
    
    This updated order ensures that all entities in the IPs are cleaned up first, followed by proper
    cleanup of the schedulers.
    
    Additional Investigation:
    
    During debugging, another issue was identified in the amdgpu_vce_sw_fini function. The vce.vcpu_bo
    buffer must be freed only as the final step in the cleanup process to prevent any premature
    access during earlier cleanup stages.
    
    v2: Using Christian suggestion call drm_sched_entity_destroy before drm_sched_fini.
    
    Cc: Christian König <[email protected]>
    Cc: Alex Deucher <[email protected]>
    Signed-off-by: Vitaly Prosyak <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [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]>

 
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: 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/gt: Cleanup partial engine discovery failures [+ + +]
Author: Chris Wilson <[email protected]>
Date:   Thu Sep 15 16:26:51 2022 -0700

    drm/i915/gt: Cleanup partial engine discovery failures
    
    commit 78a033433a5ae4fee85511ee075bc9a48312c79e upstream.
    
    If we abort driver initialisation in the middle of gt/engine discovery,
    some engines will be fully setup and some not. Those incompletely setup
    engines only have 'engine->release == NULL' and so will leak any of the
    common objects allocated.
    
    v2:
     - Drop the destroy_pinned_context() helper for now.  It's not really
       worth it with just a single callsite at the moment.  (Janusz)
    
    Signed-off-by: Chris Wilson <[email protected]>
    Cc: Janusz Krzysztofik <[email protected]>
    Signed-off-by: Matt Roper <[email protected]>
    Reviewed-by: Janusz Krzysztofik <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Zhi Yang <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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/msm/a6xx: Avoid gx gbit halt during rpm suspend [+ + +]
Author: Akhil P Oommen <[email protected]>
Date:   Fri Dec 16 22:33:14 2022 +0530

    drm/msm/a6xx: Avoid gx gbit halt during rpm suspend
    
    [ Upstream commit f4a75b5933c998e60fd812a7680e0971eb1c7cee ]
    
    As per the downstream driver, gx gbif halt is required only during
    recovery sequence. So lets avoid it during regular rpm suspend.
    
    Signed-off-by: Akhil P Oommen <[email protected]>
    Patchwork: https://patchwork.freedesktop.org/patch/515279/
    Link: https://lore.kernel.org/r/20221216223253.1.Ice9c47bfeb1fddb8dc377a3491a043a3ee7fca7d@changeid
    Signed-off-by: Rob Clark <[email protected]>
    Stable-dep-of: f561db72a663 ("drm/msm/a6xx: Fix stale rpmh votes from GPU")
    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
    
    [ Upstream commit f561db72a663f8a73c2250bf3244ce1ce221bed7 ]
    
    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: Sasha Levin <[email protected]>

drm/msm/a6xx: Handle GMU prepare-slumber hfi failure [+ + +]
Author: Akhil P Oommen <[email protected]>
Date:   Fri Aug 19 01:52:15 2022 +0530

    drm/msm/a6xx: Handle GMU prepare-slumber hfi failure
    
    [ Upstream commit d6463fd4e97545ef4f7069d13a5fa3ac0924dae2 ]
    
    When prepare-slumber hfi fails, we should follow a6xx_gmu_force_off()
    sequence.
    
    Signed-off-by: Akhil P Oommen <[email protected]>
    Patchwork: https://patchwork.freedesktop.org/patch/498401/
    Link: https://lore.kernel.org/r/20220819015030.v5.7.I54815c7c36b80d4725cd054e536365250454452f@changeid
    Signed-off-by: Rob Clark <[email protected]>
    Stable-dep-of: f561db72a663 ("drm/msm/a6xx: Fix stale rpmh votes from GPU")
    Signed-off-by: Sasha Levin <[email protected]>

drm/msm/a6xx: Improve gpu recovery sequence [+ + +]
Author: Akhil P Oommen <[email protected]>
Date:   Fri Aug 19 01:52:14 2022 +0530

    drm/msm/a6xx: Improve gpu recovery sequence
    
    [ Upstream commit 3a9dd708b902a1a646c3725151554cbef16c2c28 ]
    
    We can do a few more things to improve our chance at a successful gpu
    recovery, especially during a hangcheck timeout:
    1. Halt CP and GMU core
    2. Do RBBM GBIF HALT sequence
    3. Do a soft reset of GPU core
    
    Signed-off-by: Akhil P Oommen <[email protected]>
    Patchwork: https://patchwork.freedesktop.org/patch/498400/
    Link: https://lore.kernel.org/r/20220819015030.v5.6.Idf2ba51078e87ae7ceb75cc77a5bd4ff2bd31eab@changeid
    Signed-off-by: Rob Clark <[email protected]>
    Stable-dep-of: f561db72a663 ("drm/msm/a6xx: Fix stale rpmh votes from GPU")
    Signed-off-by: Sasha Levin <[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: 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 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]>

 
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: fix timer use-after-free on failed mount [+ + +]
Author: Xiaxi Shen <[email protected]>
Date:   Sun Jul 14 21:33:36 2024 -0700

    ext4: fix timer use-after-free on failed mount
    
    commit 0ce160c5bdb67081a62293028dc85758a8efb22a upstream.
    
    Syzbot has found an ODEBUG bug in ext4_fill_super
    
    The del_timer_sync function cancels the s_err_report timer,
    which reminds about filesystem errors daily. We should
    guarantee the timer is no longer active before kfree(sbi).
    
    When filesystem mounting fails, the flow goes to failed_mount3,
    where an error occurs when ext4_stop_mmpd is called, causing
    a read I/O failure. This triggers the ext4_handle_error function
    that ultimately re-arms the timer,
    leaving the s_err_report timer active before kfree(sbi) is called.
    
    Fix the issue by canceling the s_err_report timer after calling ext4_stop_mmpd.
    
    Signed-off-by: Xiaxi Shen <[email protected]>
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=59e0101c430934bc9a36
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Cc: [email protected]
    [Minor context change fixed]
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[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: make block validity check resistent to sb bh corruption [+ + +]
Author: Ojaswin Mujoo <[email protected]>
Date:   Fri Mar 28 11:54:52 2025 +0530

    ext4: make block validity check resistent to sb bh corruption
    
    [ Upstream commit ccad447a3d331a239477c281533bacb585b54a98 ]
    
    Block validity checks need to be skipped in case they are called
    for journal blocks since they are part of system's protected
    zone.
    
    Currently, this is done by checking inode->ino against
    sbi->s_es->s_journal_inum, which is a direct read from the ext4 sb
    buffer head. If someone modifies this underneath us then the
    s_journal_inum field might get corrupted. To prevent against this,
    change the check to directly compare the inode with journal->j_inode.
    
    **Slight change in behavior**: During journal init path,
    check_block_validity etc might be called for journal inode when
    sbi->s_journal is not set yet. In this case we now proceed with
    ext4_inode_block_valid() instead of returning early. Since systems zones
    have not been set yet, it is okay to proceed so we can perform basic
    checks on the blocks.
    
    Suggested-by: Baokun Li <[email protected]>
    Reviewed-by: Baokun Li <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Reviewed-by: Zhang Yi <[email protected]>
    Signed-off-by: Ojaswin Mujoo <[email protected]>
    Link: https://patch.msgid.link/0c06bc9ebfcd6ccfed84a36e79147bf45ff5adc1.1743142920.git.ojaswin@linux.ibm.com
    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: Add inline to f2fs_build_fault_attr() stub [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon May 13 08:40:27 2024 -0700

    f2fs: Add inline to f2fs_build_fault_attr() stub
    
    commit 0d8968287a1cf7b03d07387dc871de3861b9f6b9 upstream.
    
    When building without CONFIG_F2FS_FAULT_INJECTION, there is a warning
    from each file that includes f2fs.h because the stub for
    f2fs_build_fault_attr() is missing inline:
    
      In file included from fs/f2fs/segment.c:21:
      fs/f2fs/f2fs.h:4605:12: warning: 'f2fs_build_fault_attr' defined but not used [-Wunused-function]
       4605 | static int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,
            |            ^~~~~~~~~~~~~~~~~~~~~
    
    Add the missing inline to resolve all of the warnings for this
    configuration.
    
    Fixes: 4ed886b187f4 ("f2fs: check validation of fault attrs in f2fs_build_fault_attr()")
    Signed-off-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

f2fs: check validation of fault attrs in f2fs_build_fault_attr() [+ + +]
Author: Chao Yu <[email protected]>
Date:   Tue May 7 11:38:47 2024 +0800

    f2fs: check validation of fault attrs in f2fs_build_fault_attr()
    
    commit 4ed886b187f47447ad559619c48c086f432d2b77 upstream.
    
    - It missed to check validation of fault attrs in parse_options(),
    let's fix to add check condition in f2fs_build_fault_attr().
    - Use f2fs_build_fault_attr() in __sbi_store() to clean up code.
    
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Cliff Liu <[email protected]>
    Signed-off-by: He Zhe <[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]>

 
filemap: Fix bounds checking in filemap_read() [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Mon Apr 14 11:50:22 2025 -0700

    filemap: Fix bounds checking in filemap_read()
    
    [ Upstream commit ace149e0830c380ddfce7e466fe860ca502fe4ee ]
    
    If the caller supplies an iocb->ki_pos value that is close to the
    filesystem upper limit, and an iterator with a count that causes us to
    overflow that limit, then filemap_read() enters an infinite loop.
    
    This behaviour was discovered when testing xfstests generic/525 with the
    "localio" optimisation for loopback NFS mounts.
    
    Reported-by: Mike Snitzer <[email protected]>
    Fixes: c2a9737f45e2 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()")
    Tested-by: Mike Snitzer <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    (cherry picked from commit ace149e0830c380ddfce7e466fe860ca502fe4ee)
    [Harshit: Minor conflict resolved due to missing commit: 25d6a23e8d28
    ("filemap: Convert filemap_get_read_batch() to use a folio_batch") in
    5.15.y]
    Signed-off-by: Harshit Mogalapalli <[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/ntfs3: Fix WARNING in ntfs_extend_initialized_size [+ + +]
Author: Edward Adam Davis <[email protected]>
Date:   Mon Oct 14 20:16:38 2024 +0800

    fs/ntfs3: Fix WARNING in ntfs_extend_initialized_size
    
    [ Upstream commit ff355926445897cc9fdea3b00611e514232c213c ]
    
    Syzbot reported a WARNING in ntfs_extend_initialized_size.
    The data type of in->i_valid and to is u64 in ntfs_file_mmap().
    If their values are greater than LLONG_MAX, overflow will occur because
    the data types of the parameters valid and new_valid corresponding to
    the function ntfs_extend_initialized_size() are loff_t.
    
    Before calling ntfs_extend_initialized_size() in the ntfs_file_mmap(),
    the "ni->i_valid < to" has been determined, so the same WARN_ON determination
    is not required in ntfs_extend_initialized_size().
    Just execute the ntfs_extend_initialized_size() in ntfs_extend() to make
    a WARN_ON check.
    
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=e37dd1dfc814b10caa55
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Konstantin Komarov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats [+ + +]
Author: Oleg Nesterov <[email protected]>
Date:   Tue Jan 23 16:33:57 2024 +0100

    fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats
    
    commit 7601df8031fd67310af891897ef6cc0df4209305 upstream.
    
    lock_task_sighand() can trigger a hard lockup.  If NR_CPUS threads call
    do_task_stat() at the same time and the process has NR_THREADS, it will
    spin with irqs disabled O(NR_CPUS * NR_THREADS) time.
    
    Change do_task_stat() to use sig->stats_lock to gather the statistics
    outside of ->siglock protected section, in the likely case this code will
    run lockless.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Dylan Hatch <[email protected]>
    Cc: Eric W. Biederman <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: David Sauerwein <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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]>

 
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
    
    [ Upstream commit 8323f3a69de6f6e96bf22f32dd8e2920766050c2 ]
    
    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: Sasha Levin <[email protected]>

gpio: tegra186: Force one interrupt per bank [+ + +]
Author: Thierry Reding <[email protected]>
Date:   Fri Sep 17 12:54:11 2021 +0200

    gpio: tegra186: Force one interrupt per bank
    
    [ Upstream commit ca038748068f454d20ad1bb120cbe36599f81db6 ]
    
    Newer chips support up to 8 interrupts per bank, which can be useful to
    balance the load and decrease latency. However, it also required a very
    complicated interrupt routing to be set up. To keep things simple for
    now, ensure that a single interrupt per bank is enforced, even if all
    possible interrupts are described in device tree.
    
    Signed-off-by: Thierry Reding <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Stable-dep-of: 8323f3a69de6 ("gpio: tegra186: fix resource handling in ACPI probe path")
    Signed-off-by: Sasha Levin <[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]>

 
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: 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]>
    Signed-off-by: Greg Kroah-Hartman <[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: 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: 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: 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]>

 
iio: adc: ad7768-1: Fix conversion result sign [+ + +]
Author: Sergiu Cuciurean <[email protected]>
Date:   Thu Mar 6 18:00:29 2025 -0300

    iio: adc: ad7768-1: Fix conversion result sign
    
    [ Upstream commit 8236644f5ecb180e80ad92d691c22bc509b747bb ]
    
    The ad7768-1 ADC output code is two's complement, meaning that the voltage
    conversion result is a signed value.. Since the value is a 24 bit one,
    stored in a 32 bit variable, the sign should be extended in order to get
    the correct representation.
    
    Also the channel description has been updated to signed representation,
    to match the ADC specifications.
    
    Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
    Reviewed-by: David Lechner <[email protected]>
    Reviewed-by: Marcelo Schmitt <[email protected]>
    Signed-off-by: Sergiu Cuciurean <[email protected]>
    Signed-off-by: Jonathan Santos <[email protected]>
    Cc: <[email protected]>
    Link: https://patch.msgid.link/505994d3b71c2aa38ba714d909a68e021f12124c.1741268122.git.Jonathan.Santos@analog.com
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary return value check [+ + +]
Author: Jonathan Cameron <[email protected]>
Date:   Mon Feb 17 14:16:12 2025 +0000

    iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary return value check
    
    [ Upstream commit 0af1c801a15225304a6328258efbf2bee245c654 ]
    
    The data used is all in local variables so there is no advantage
    in setting *val = ret with the direct mode claim held.
    Move it later to after error check.
    
    Reviewed-by: Nuno Sá <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jonathan Cameron <[email protected]>
    Stable-dep-of: 8236644f5ecb ("iio: adc: ad7768-1: Fix conversion result sign")
    Signed-off-by: Sasha Levin <[email protected]>

 
iommu/amd: Return an error if vCPU affinity is set for non-vCPU IRTE [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Apr 4 12:38:20 2025 -0700

    iommu/amd: Return an error if vCPU affinity is set for non-vCPU IRTE
    
    [ Upstream commit 07172206a26dcf3f0bf7c3ecaadd4242b008ea54 ]
    
    Return -EINVAL instead of success if amd_ir_set_vcpu_affinity() is
    invoked without use_vapic; lying to KVM about whether or not the IRTE was
    configured to post IRQs is all kinds of bad.
    
    Fixes: d98de49a53e4 ("iommu/amd: Enable vAPIC interrupt remapping mode by default")
    Signed-off-by: Sean Christopherson <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv6: release nexthop on device removal [+ + +]
Author: Paolo Abeni <[email protected]>
Date:   Mon Apr 14 11:50:23 2025 -0700

    ipv6: release nexthop on device removal
    
    [ Upstream commit eb02688c5c45c3e7af7e71f036a7144f5639cbfe ]
    
    The CI is hitting some aperiodic hangup at device removal time in the
    pmtu.sh self-test:
    
    unregister_netdevice: waiting for veth_A-R1 to become free. Usage count = 6
    ref_tracker: veth_A-R1@ffff888013df15d8 has 1/5 users at
            dst_init+0x84/0x4a0
            dst_alloc+0x97/0x150
            ip6_dst_alloc+0x23/0x90
            ip6_rt_pcpu_alloc+0x1e6/0x520
            ip6_pol_route+0x56f/0x840
            fib6_rule_lookup+0x334/0x630
            ip6_route_output_flags+0x259/0x480
            ip6_dst_lookup_tail.constprop.0+0x5c2/0x940
            ip6_dst_lookup_flow+0x88/0x190
            udp_tunnel6_dst_lookup+0x2a7/0x4c0
            vxlan_xmit_one+0xbde/0x4a50 [vxlan]
            vxlan_xmit+0x9ad/0xf20 [vxlan]
            dev_hard_start_xmit+0x10e/0x360
            __dev_queue_xmit+0xf95/0x18c0
            arp_solicit+0x4a2/0xe00
            neigh_probe+0xaa/0xf0
    
    While the first suspect is the dst_cache, explicitly tracking the dst
    owing the last device reference via probes proved such dst is held by
    the nexthop in the originating fib6_info.
    
    Similar to commit f5b51fe804ec ("ipv6: route: purge exception on
    removal"), we need to explicitly release the originating fib info when
    disconnecting a to-be-removed device from a live ipv6 dst: move the
    fib6_info cleanup into ip6_dst_ifdown().
    
    Tested running:
    
    ./pmtu.sh cleanup_ipv6_exception
    
    in a tight loop for more than 400 iterations with no spat, running an
    unpatched kernel  I observed a splat every ~10 iterations.
    
    Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info")
    Signed-off-by: Paolo Abeni <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Link: https://patch.msgid.link/604c45c188c609b732286b47ac2a451a40f6cf6d.1730828007.git.pabeni@redhat.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    (cherry picked from commit eb02688c5c45c3e7af7e71f036a7144f5639cbfe)
    [Harshit: Resolved conflict due to missing commit: e5f80fcf869a ("ipv6:
    give an IPv6 dev to blackhole_netdev") and commit: b4cb4a1391dc ("net:
    use unrcu_pointer() helper") in linux-5.15.y]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipvs: properly dereference pe in ip_vs_add_service [+ + +]
Author: Chen Hanxiao <[email protected]>
Date:   Thu Jun 27 14:15:15 2024 +0800

    ipvs: properly dereference pe in ip_vs_add_service
    
    commit cbd070a4ae62f119058973f6d2c984e325bce6e7 upstream.
    
    Use pe directly to resolve sparse warning:
    
      net/netfilter/ipvs/ip_vs_ctl.c:1471:27: warning: dereference of noderef expression
    
    Fixes: 39b972231536 ("ipvs: handle connections started by real-servers")
    Signed-off-by: Chen Hanxiao <[email protected]>
    Acked-by: Julian Anastasov <[email protected]>
    Acked-by: Simon Horman <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Cliff Liu <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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: define xtree root and page independently [+ + +]
Author: Dave Kleikamp <[email protected]>
Date:   Thu Oct 5 09:16:14 2023 -0500

    jfs: define xtree root and page independently
    
    commit a779ed754e52d582b8c0e17959df063108bd0656 upstream.
    
    In order to make array bounds checking sane, provide a separate
    definition of the in-inode xtree root and the external xtree page.
    
    Signed-off-by: Dave Kleikamp <[email protected]>
    Tested-by: Manas Ghandat <[email protected]>
    Closes: https://syzkaller.appspot.com/bug?extid=ccb458b6679845ee0bae
    Reported-by: [email protected]
    Signed-off-by: Aditya Dutt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

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

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

 
kmsan: disable strscpy() optimization under KMSAN [+ + +]
Author: Alexander Potapenko <[email protected]>
Date:   Thu Sep 15 17:03:59 2022 +0200

    kmsan: disable strscpy() optimization under KMSAN
    
    [ Upstream commit 2de6f3bf75058e35eff04e6fab7ca41533bdb027 ]
    
    Disable the efficient 8-byte reading under KMSAN to avoid false positives.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Alexander Potapenko <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Alexei Starovoitov <[email protected]>
    Cc: Andrey Konovalov <[email protected]>
    Cc: Andrey Konovalov <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Arnd Bergmann <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Christoph Lameter <[email protected]>
    Cc: David Rientjes <[email protected]>
    Cc: Dmitry Vyukov <[email protected]>
    Cc: Eric Biggers <[email protected]>
    Cc: Eric Biggers <[email protected]>
    Cc: Eric Dumazet <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Herbert Xu <[email protected]>
    Cc: Ilya Leoshkevich <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jens Axboe <[email protected]>
    Cc: Joonsoo Kim <[email protected]>
    Cc: Kees Cook <[email protected]>
    Cc: Marco Elver <[email protected]>
    Cc: Mark Rutland <[email protected]>
    Cc: Matthew Wilcox <[email protected]>
    Cc: Michael S. Tsirkin <[email protected]>
    Cc: Pekka Enberg <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Petr Mladek <[email protected]>
    Cc: Stephen Rothwell <[email protected]>
    Cc: Steven Rostedt <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: Vasily Gorbik <[email protected]>
    Cc: Vegard Nossum <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Stable-dep-of: d94c12bd97d5 ("string: Add load_unaligned_zeropad() code path to sized_strscpy()")
    Signed-off-by: Sasha Levin <[email protected]>

 
ksmbd: fix potencial out-of-bounds when buffer offset is invalid [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Tue Mar 19 08:40:48 2024 +0900

    ksmbd: fix potencial out-of-bounds when buffer offset is invalid
    
    commit c6cd2e8d2d9aa7ee35b1fa6a668e32a22a9753da upstream.
    
    I found potencial out-of-bounds when buffer offset fields of a few requests
    is invalid. This patch set the minimum value of buffer offset field to
    ->Buffer offset to validate buffer length.
    
    Cc: [email protected]
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[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
    
    [ Upstream commit a93ff742820f75bf8bb3fcf21d9f25ca6eb3d4c6 ]
    
    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: Sasha Levin <[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]>

 
KVM: arm64: Always start with clearing SVE flag on load [+ + +]
Author: Marc Zyngier <[email protected]>
Date:   Tue Apr 8 19:09:57 2025 +0100

    KVM: arm64: Always start with clearing SVE flag on load
    
    [ Upstream commit d52d165d67c5aa26c8c89909003c94a66492d23d ]
    
    On each vcpu load, we set the KVM_ARM64_HOST_SVE_ENABLED
    flag if SVE is enabled for EL0 on the host. This is used to restore
    the correct state on vpcu put.
    
    However, it appears that nothing ever clears this flag. Once
    set, it will stick until the vcpu is destroyed, which has the
    potential to spuriously enable SVE for userspace.
    
    We probably never saw the issue because no VMM uses SVE, but
    that's still pretty bad. Unconditionally clearing the flag
    on vcpu load addresses the issue.
    
    Fixes: 8383741ab2e7 ("KVM: arm64: Get rid of host SVE tracking/saving")
    Signed-off-by: Marc Zyngier <[email protected]>
    Cc: [email protected]
    Reviewed-by: Mark Brown <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Calculate cptr_el2 traps on activating traps [+ + +]
Author: Fuad Tabba <[email protected]>
Date:   Tue Apr 8 19:10:05 2025 +0100

    KVM: arm64: Calculate cptr_el2 traps on activating traps
    
    [ Upstream commit 2fd5b4b0e7b440602455b79977bfa64dea101e6c ]
    
    Similar to VHE, calculate the value of cptr_el2 from scratch on
    activate traps. This removes the need to store cptr_el2 in every
    vcpu structure. Moreover, some traps, such as whether the guest
    owns the fp registers, need to be set on every vcpu run.
    
    Reported-by: James Clark <[email protected]>
    Fixes: 5294afdbf45a ("KVM: arm64: Exclude FP ownership from kvm_vcpu_arch")
    Signed-off-by: Fuad Tabba <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Discard any SVE state when entering KVM guests [+ + +]
Author: Mark Brown <[email protected]>
Date:   Tue Apr 8 19:09:58 2025 +0100

    KVM: arm64: Discard any SVE state when entering KVM guests
    
    [ Upstream commit 93ae6b01bafee8fa385aa25ee7ebdb40057f6abe ]
    
    Since 8383741ab2e773a99 (KVM: arm64: Get rid of host SVE tracking/saving)
    KVM has not tracked the host SVE state, relying on the fact that we
    currently disable SVE whenever we perform a syscall. This may not be true
    in future since performance optimisation may result in us keeping SVE
    enabled in order to avoid needing to take access traps to reenable it.
    Handle this by clearing TIF_SVE and converting the stored task state to
    FPSIMD format when preparing to run the guest.  This is done with a new
    call fpsimd_kvm_prepare() to keep the direct state manipulation
    functions internal to fpsimd.c.
    
    Signed-off-by: Mark Brown <[email protected]>
    Reviewed-by: Catalin Marinas <[email protected]>
    Reviewed-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Will Deacon <[email protected]>
    [ Mark: trivial backport to v6.1 ]
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Eagerly switch ZCR_EL{1,2} [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Tue Apr 8 19:10:06 2025 +0100

    KVM: arm64: Eagerly switch ZCR_EL{1,2}
    
    [ Upstream commit 59419f10045bc955d2229819c7cf7a8b0b9c5b59 ]
    
    In non-protected KVM modes, while the guest FPSIMD/SVE/SME state is live on the
    CPU, the host's active SVE VL may differ from the guest's maximum SVE VL:
    
    * For VHE hosts, when a VM uses NV, ZCR_EL2 contains a value constrained
      by the guest hypervisor, which may be less than or equal to that
      guest's maximum VL.
    
      Note: in this case the value of ZCR_EL1 is immaterial due to E2H.
    
    * For nVHE/hVHE hosts, ZCR_EL1 contains a value written by the guest,
      which may be less than or greater than the guest's maximum VL.
    
      Note: in this case hyp code traps host SVE usage and lazily restores
      ZCR_EL2 to the host's maximum VL, which may be greater than the
      guest's maximum VL.
    
    This can be the case between exiting a guest and kvm_arch_vcpu_put_fp().
    If a softirq is taken during this period and the softirq handler tries
    to use kernel-mode NEON, then the kernel will fail to save the guest's
    FPSIMD/SVE state, and will pend a SIGKILL for the current thread.
    
    This happens because kvm_arch_vcpu_ctxsync_fp() binds the guest's live
    FPSIMD/SVE state with the guest's maximum SVE VL, and
    fpsimd_save_user_state() verifies that the live SVE VL is as expected
    before attempting to save the register state:
    
    | if (WARN_ON(sve_get_vl() != vl)) {
    |         force_signal_inject(SIGKILL, SI_KERNEL, 0, 0);
    |         return;
    | }
    
    Fix this and make this a bit easier to reason about by always eagerly
    switching ZCR_EL{1,2} at hyp during guest<->host transitions. With this
    happening, there's no need to trap host SVE usage, and the nVHE/nVHE
    __deactivate_cptr_traps() logic can be simplified to enable host access
    to all present FPSIMD/SVE/SME features.
    
    In protected nVHE/hVHE modes, the host's state is always saved/restored
    by hyp, and the guest's state is saved prior to exit to the host, so
    from the host's PoV the guest never has live FPSIMD/SVE/SME state, and
    the host's ZCR_EL1 is never clobbered by hyp.
    
    Fixes: 8c8010d69c132273 ("KVM: arm64: Save/restore SVE state for nVHE")
    Fixes: 2e3cf82063a00ea0 ("KVM: arm64: nv: Ensure correct VL is loaded before saving SVE state")
    Signed-off-by: Mark Rutland <[email protected]>
    Reviewed-by: Mark Brown <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Fuad Tabba <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Cc: Will Deacon <[email protected]>
    Reviewed-by: Oliver Upton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    [ v6.6 lacks pKVM saving of host SVE state, pull in discovery of maximum
      host VL separately -- broonie ]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Get rid of host SVE tracking/saving [+ + +]
Author: Mark Brown <[email protected]>
Date:   Tue Apr 8 19:09:56 2025 +0100

    KVM: arm64: Get rid of host SVE tracking/saving
    
    From: Marc Zyngier <[email protected]>
    
    [ Upstream commit 8383741ab2e773a992f1f0f8acdca5e7a4687c49 ]
    
    The SVE host tracking in KVM is pretty involved. It relies on a
    set of flags tracking the ownership of the SVE register, as well
    as that of the EL0 access.
    
    It is also pretty scary: __hyp_sve_save_host() computes
    a thread_struct pointer and obtains a sve_state which gets directly
    accessed without further ado, even on nVHE. How can this even work?
    
    The answer to that is that it doesn't, and that this is mostly dead
    code. Closer examination shows that on executing a syscall, userspace
    loses its SVE state entirely. This is part of the ABI. Another
    thing to notice is that although the kernel provides helpers such as
    kernel_neon_begin()/end(), they only deal with the FP/NEON state,
    and not SVE.
    
    Given that you can only execute a guest as the result of a syscall,
    and that the kernel cannot use SVE by itself, it becomes pretty
    obvious that there is never any host SVE state to save, and that
    this code is only there to increase confusion.
    
    Get rid of the TIF_SVE tracking and host save infrastructure altogether.
    
    Reviewed-by: Mark Brown <[email protected]>
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Remove host FPSIMD saving for non-protected KVM [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Tue Apr 8 19:10:03 2025 +0100

    KVM: arm64: Remove host FPSIMD saving for non-protected KVM
    
    [ Upstream commit 8eca7f6d5100b6997df4f532090bc3f7e0203bef ]
    
    Now that the host eagerly saves its own FPSIMD/SVE/SME state,
    non-protected KVM never needs to save the host FPSIMD/SVE/SME state,
    and the code to do this is never used. Protected KVM still needs to
    save/restore the host FPSIMD/SVE state to avoid leaking guest state to
    the host (and to avoid revealing to the host whether the guest used
    FPSIMD/SVE/SME), and that code needs to be retained.
    
    Remove the unused code and data structures.
    
    To avoid the need for a stub copy of kvm_hyp_save_fpsimd_host() in the
    VHE hyp code, the nVHE/hVHE version is moved into the shared switch
    header, where it is only invoked when KVM is in protected mode.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Reviewed-by: Mark Brown <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Acked-by: Will Deacon <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Fuad Tabba <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Reviewed-by: Oliver Upton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Remove VHE host restore of CPACR_EL1.ZEN [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Tue Apr 8 19:10:04 2025 +0100

    KVM: arm64: Remove VHE host restore of CPACR_EL1.ZEN
    
    [ Upstream commit 459f059be702056d91537b99a129994aa6ccdd35 ]
    
    When KVM is in VHE mode, the host kernel tries to save and restore the
    configuration of CPACR_EL1.ZEN (i.e. CPTR_EL2.ZEN when HCR_EL2.E2H=1)
    across kvm_arch_vcpu_load_fp() and kvm_arch_vcpu_put_fp(), since the
    configuration may be clobbered by hyp when running a vCPU. This logic is
    currently redundant.
    
    The VHE hyp code unconditionally configures CPTR_EL2.ZEN to 0b01 when
    returning to the host, permitting host kernel usage of SVE.
    
    Now that the host eagerly saves and unbinds its own FPSIMD/SVE/SME
    state, there's no need to save/restore the state of the EL0 SVE trap.
    The kernel can safely save/restore state without trapping, as described
    above, and will restore userspace state (including trap controls) before
    returning to userspace.
    
    Remove the redundant logic.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Reviewed-by: Mark Brown <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Acked-by: Will Deacon <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Fuad Tabba <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Reviewed-by: Oliver Upton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    [Rework for refactoring of where the flags are stored -- broonie]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Tue Apr 8 19:10:02 2025 +0100

    KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state
    
    [ Upstream commit fbc7e61195e23f744814e78524b73b59faa54ab4 ]
    
    There are several problems with the way hyp code lazily saves the host's
    FPSIMD/SVE state, including:
    
    * Host SVE being discarded unexpectedly due to inconsistent
      configuration of TIF_SVE and CPACR_ELx.ZEN. This has been seen to
      result in QEMU crashes where SVE is used by memmove(), as reported by
      Eric Auger:
    
      https://issues.redhat.com/browse/RHEL-68997
    
    * Host SVE state is discarded *after* modification by ptrace, which was an
      unintentional ptrace ABI change introduced with lazy discarding of SVE state.
    
    * The host FPMR value can be discarded when running a non-protected VM,
      where FPMR support is not exposed to a VM, and that VM uses
      FPSIMD/SVE. In these cases the hyp code does not save the host's FPMR
      before unbinding the host's FPSIMD/SVE/SME state, leaving a stale
      value in memory.
    
    Avoid these by eagerly saving and "flushing" the host's FPSIMD/SVE/SME
    state when loading a vCPU such that KVM does not need to save any of the
    host's FPSIMD/SVE/SME state. For clarity, fpsimd_kvm_prepare() is
    removed and the necessary call to fpsimd_save_and_flush_cpu_state() is
    placed in kvm_arch_vcpu_load_fp(). As 'fpsimd_state' and 'fpmr_ptr'
    should not be used, they are set to NULL; all uses of these will be
    removed in subsequent patches.
    
    Historical problems go back at least as far as v5.17, e.g. erroneous
    assumptions about TIF_SVE being clear in commit:
    
      8383741ab2e773a9 ("KVM: arm64: Get rid of host SVE tracking/saving")
    
    ... and so this eager save+flush probably needs to be backported to ALL
    stable trees.
    
    Fixes: 93ae6b01bafee8fa ("KVM: arm64: Discard any SVE state when entering KVM guests")
    Fixes: 8c845e2731041f0f ("arm64/sve: Leave SVE enabled on syscall if we don't context switch")
    Fixes: ef3be86021c3bdf3 ("KVM: arm64: Add save/restore support for FPMR")
    Reported-by: Eric Auger <[email protected]>
    Reported-by: Wilco Dijkstra <[email protected]>
    Reviewed-by: Mark Brown <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Tested-by: Eric Auger <[email protected]>
    Acked-by: Will Deacon <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Florian Weimer <[email protected]>
    Cc: Fuad Tabba <[email protected]>
    Cc: Jeremy Linton <[email protected]>
    Cc: Marc Zyngier <[email protected]>
    Cc: Oliver Upton <[email protected]>
    Cc: Paolo Bonzini <[email protected]>
    Signed-off-by: Mark Rutland <[email protected]>
    Reviewed-by: Oliver Upton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    [ Mark: Handle vcpu/host flag conflict, remove host_data_ptr() ]
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: s390: Don't use %pK through tracepoints [+ + +]
Author: Thomas Weißschuh <[email protected]>
Date:   Mon Feb 17 14:13:56 2025 +0100

    KVM: s390: Don't use %pK through tracepoints
    
    [ Upstream commit 6c9567e0850be2f0f94ab64fa6512413fd1a1eb1 ]
    
    Restricted pointers ("%pK") are not meant to be used through TP_format().
    It can unintentionally expose security sensitive, raw pointer values.
    
    Use regular pointer formatting instead.
    
    Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@linutronix.de/
    Signed-off-by: Thomas Weißschuh <[email protected]>
    Reviewed-by: Michael Mueller <[email protected]>
    Link: https://lore.kernel.org/r/20250217-restricted-pointers-s390-v1-1-0e4ace75d8aa@linutronix.de
    Signed-off-by: Janosch Frank <[email protected]>
    Message-ID: <20250217-restricted-pointers-s390-v1-1-0e4ace75d8aa@linutronix.de>
    Signed-off-by: Sasha Levin <[email protected]>

KVM: SVM: Allocate IR data using atomic allocation [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Apr 4 12:38:16 2025 -0700

    KVM: SVM: Allocate IR data using atomic allocation
    
    commit 7537deda36521fa8fff9133b39c46e31893606f2 upstream.
    
    Allocate SVM's interrupt remapping metadata using GFP_ATOMIC as
    svm_ir_list_add() is called with IRQs are disabled and irqfs.lock held
    when kvm_irq_routing_update() reacts to GSI routing changes.
    
    Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
    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: Reset IRTE to host control if *new* route isn't postable [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Apr 4 12:38:17 2025 -0700

    KVM: x86: Reset IRTE to host control if *new* route isn't postable
    
    commit 9bcac97dc42d2f4da8229d18feb0fe2b1ce523a2 upstream.
    
    Restore an IRTE back to host control (remapped or posted MSI mode) if the
    *new* GSI route prevents posting the IRQ directly to a vCPU, regardless of
    the GSI routing type.  Updating the IRTE if and only if the new GSI is an
    MSI results in KVM leaving an IRTE posting to a vCPU.
    
    The dangling IRTE can result in interrupts being incorrectly delivered to
    the guest, and in the worst case scenario can result in use-after-free,
    e.g. if the VM is torn down, but the underlying host IRQ isn't freed.
    
    Fixes: efc644048ecd ("KVM: x86: Update IRTE for posted-interrupts")
    Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
    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]>

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

 
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 5.15.181 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Fri May 2 07:44:40 2025 +0200

    Linux 5.15.181
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Hardik Garg <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Tested-by: Hardik Garg <[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]>

 
loop: aio inherit the ioprio of original request [+ + +]
Author: Yunlong Xing <[email protected]>
Date:   Mon Apr 14 11:01:59 2025 +0800

    loop: aio inherit the ioprio of original request
    
    [ Upstream commit 1fdb8188c3d505452b40cdb365b1bb32be533a8e ]
    
    Set cmd->iocb.ki_ioprio to the ioprio of loop device's request.
    The purpose is to inherit the original request ioprio in the aio
    flow.
    
    Signed-off-by: Yunlong Xing <[email protected]>
    Signed-off-by: Zhiguo Niu <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[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]>

 
mcb: fix a double free bug in chameleon_parse_gdd() [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Mon Mar 10 09:46:57 2025 +0100

    mcb: fix a double free bug in chameleon_parse_gdd()
    
    commit 7c7f1bfdb2249f854a736d9b79778c7e5a29a150 upstream.
    
    In chameleon_parse_gdd(), if mcb_device_register() fails, 'mdev'
    would be released in mcb_device_register() via put_device().
    Thus, goto 'err' label and free 'mdev' again causes a double free.
    Just return if mcb_device_register() fails.
    
    Fixes: 3764e82e5150 ("drivers: Introduce MEN Chameleon Bus")
    Cc: stable <[email protected]>
    Signed-off-by: Haoxiang Li <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Link: https://lore.kernel.org/r/6201d09e2975ae5789879f79a6de4c38de9edd4a.1741596225.git.jth@kernel.org
    Signed-off-by: Greg Kroah-Hartman <[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/raid1: Add check for missing source disk in process_checks() [+ + +]
Author: Meir Elisha <[email protected]>
Date:   Tue Apr 8 17:38:08 2025 +0300

    md/raid1: Add check for missing source disk in process_checks()
    
    [ Upstream commit b7c178d9e57c8fd4238ff77263b877f6f16182ba ]
    
    During recovery/check operations, the process_checks function loops
    through available disks to find a 'primary' source with successfully
    read data.
    
    If no suitable source disk is found after checking all possibilities,
    the 'primary' index will reach conf->raid_disks * 2. Add an explicit
    check for this condition after the loop. If no source disk was found,
    print an error message and return early to prevent further processing
    without a valid primary source.
    
    Link: https://lore.kernel.org/linux-raid/[email protected]
    Signed-off-by: Meir Elisha <[email protected]>
    Suggested-and-reviewed-by: Yu Kuai <[email protected]>
    Signed-off-by: Yu Kuai <[email protected]>
    Signed-off-by: Sasha Levin <[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: 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: 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: fix race between device disconnection and urb callback [+ + +]
Author: Murad Masimov <[email protected]>
Date:   Mon Jan 13 13:51:30 2025 +0300

    media: streamzap: fix race between device disconnection and urb callback
    
    [ Upstream commit f656cfbc7a293a039d6a0c7100e1c846845148c1 ]
    
    Syzkaller has reported a general protection fault at function
    ir_raw_event_store_with_filter(). This crash is caused by a NULL pointer
    dereference of dev->raw pointer, even though it is checked for NULL in
    the same function, which means there is a race condition. It occurs due
    to the incorrect order of actions in the streamzap_disconnect() function:
    rc_unregister_device() is called before usb_kill_urb(). The dev->raw
    pointer is freed and set to NULL in rc_unregister_device(), and only
    after that usb_kill_urb() waits for in-progress requests to finish.
    
    If rc_unregister_device() is called while streamzap_callback() handler is
    not finished, this can lead to accessing freed resources. Thus
    rc_unregister_device() should be called after usb_kill_urb().
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Fixes: 8e9e60640067 ("V4L/DVB: staging/lirc: port lirc_streamzap to ir-core")
    Cc: [email protected]
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=34008406ee9a31b13c73
    Signed-off-by: Murad Masimov <[email protected]>
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: streamzap: less chatter [+ + +]
Author: Sean Young <[email protected]>
Date:   Sun Dec 5 22:38:20 2021 +0100

    media: streamzap: less chatter
    
    [ Upstream commit 35088717ad24140b6ab0ec00ef357709be607526 ]
    
    Remove superfluous messages which add no information.
    
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: f656cfbc7a29 ("media: streamzap: fix race between device disconnection and urb callback")
    Signed-off-by: Sasha Levin <[email protected]>

media: streamzap: no need for usb pid/vid in device name [+ + +]
Author: Sean Young <[email protected]>
Date:   Sun Dec 5 18:10:36 2021 +0100

    media: streamzap: no need for usb pid/vid in device name
    
    [ Upstream commit 7a25e6849ad73de5aa01d62da43071bc02b8530c ]
    
    The usb pid/vid can be found elsewhere, the idVendor/idProduct usb sysfs
    files for example.
    
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: f656cfbc7a29 ("media: streamzap: fix race between device disconnection and urb callback")
    Signed-off-by: Sasha Levin <[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: streamzap: remove unnecessary ir_raw_event_reset and handle [+ + +]
Author: Sean Young <[email protected]>
Date:   Sun Dec 5 18:06:30 2021 +0100

    media: streamzap: remove unnecessary ir_raw_event_reset and handle
    
    [ Upstream commit 4bed9306050497f49cbe77b842f0d812f4f27593 ]
    
    There is no reason to have a reset after an IR timeout.
    Calling ir_raw_event_handle() twice for the same interrupt has no
    affect.
    
    Fixes: 56b0ec30c4bc ("[media] rc/streamzap: fix reporting response times")
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: f656cfbc7a29 ("media: streamzap: fix race between device disconnection and urb callback")
    Signed-off-by: Sasha Levin <[email protected]>

media: streamzap: remove unused struct members [+ + +]
Author: Sean Young <[email protected]>
Date:   Mon Dec 6 11:59:41 2021 +0100

    media: streamzap: remove unused struct members
    
    [ Upstream commit 4df69e46c352df9bdbe859824da33428a3ce8a1d ]
    
    These struct members do not serve any purpose.
    
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: f656cfbc7a29 ("media: streamzap: fix race between device disconnection and urb callback")
    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]>

 
mei: me: add panther lake H DID [+ + +]
Author: Alexander Usyskin <[email protected]>
Date:   Tue Apr 8 16:00:05 2025 +0300

    mei: me: add panther lake H DID
    
    commit 86ce5c0a1dec02e21b4c864b2bc0cc5880a2c13c upstream.
    
    Add Panther Lake H device id.
    
    Cc: stable <[email protected]>
    Co-developed-by: Tomas Winkler <[email protected]>
    Signed-off-by: Tomas Winkler <[email protected]>
    Signed-off-by: Alexander Usyskin <[email protected]>
    Link: https://lore.kernel.org/r/[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: cm: Detect CM quirks from device tree [+ + +]
Author: Gregory CLEMENT <[email protected]>
Date:   Thu Jan 23 12:01:56 2025 +0100

    MIPS: cm: Detect CM quirks from device tree
    
    [ Upstream commit e27fbe16af5cfc40639de4ced67d1a866a1953e9 ]
    
    Some information that should be retrieved at runtime for the Coherence
    Manager can be either absent or wrong. This patch allows checking if
    some of this information is available from the device tree and updates
    the internal variable accordingly.
    
    For now, only the compatible string associated with the broken HCI is
    being retrieved.
    
    Signed-off-by: Gregory CLEMENT <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

MIPS: cm: Fix warning if MIPS_CM is disabled [+ + +]
Author: Thomas Bogendoerfer <[email protected]>
Date:   Fri Feb 28 15:37:02 2025 +0100

    MIPS: cm: Fix warning if MIPS_CM is disabled
    
    commit b73c3ccdca95c237750c981054997c71d33e09d7 upstream.
    
    Commit e27fbe16af5c ("MIPS: cm: Detect CM quirks from device tree")
    introduced
    
    arch/mips/include/asm/mips-cm.h:119:13: error: ‘mips_cm_update_property’
            defined but not used [-Werror=unused-function]
    
    Fix this by making empty function implementation inline
    
    Fixes: e27fbe16af5c ("MIPS: cm: Detect CM quirks from device tree")
    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/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: 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: Kirill A. Shutemov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
module: sign with sha512 instead of sha1 by default [+ + +]
Author: Thorsten Leemhuis <[email protected]>
Date:   Wed Oct 16 16:18:41 2024 +0200

    module: sign with sha512 instead of sha1 by default
    
    commit f3b93547b91ad849b58eb5ab2dd070950ad7beb3 upstream.
    
    Switch away from using sha1 for module signing by default and use the
    more modern sha512 instead, which is what among others Arch, Fedora,
    RHEL, and Ubuntu are currently using for their kernels.
    
    Sha1 has not been considered secure against well-funded opponents since
    2005[1]; since 2011 the NIST and other organizations furthermore
    recommended its replacement[2]. This is why OpenSSL on RHEL9, Fedora
    Linux 41+[3], and likely some other current and future distributions
    reject the creation of sha1 signatures, which leads to a build error of
    allmodconfig configurations:
    
      80A20474797F0000:error:03000098:digital envelope routines:do_sigver_init:invalid digest:crypto/evp/m_sigver.c:342:
      make[4]: *** [.../certs/Makefile:53: certs/signing_key.pem] Error 1
      make[4]: *** Deleting file 'certs/signing_key.pem'
      make[4]: *** Waiting for unfinished jobs....
      make[3]: *** [.../scripts/Makefile.build:478: certs] Error 2
      make[2]: *** [.../Makefile:1936: .] Error 2
      make[1]: *** [.../Makefile:224: __sub-make] Error 2
      make[1]: Leaving directory '...'
      make: *** [Makefile:224: __sub-make] Error 2
    
    This change makes allmodconfig work again and sets a default that is
    more appropriate for current and future users, too.
    
    Link: https://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html [1]
    Link: https://csrc.nist.gov/projects/hash-functions [2]
    Link: https://fedoraproject.org/wiki/Changes/OpenSSLDistrustsha1SigVer [3]
    Signed-off-by: Thorsten Leemhuis <[email protected]>
    Reviewed-by: Sami Tolvanen <[email protected]>
    Tested-by: kdevops <[email protected]> [0]
    Link: https://github.com/linux-kdevops/linux-modules-kpd/actions/runs/11420092929/job/31775404330 [0]
    Link: https://lore.kernel.org/r/52ee32c0c92afc4d3263cea1f8a1cdc809728aff.1729088288.git.linux@leemhuis.info
    Signed-off-by: Petr Pavlu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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 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]>
    [ Conflicts in sockopt.c in the context, because commit 3b1e21eb60e8
      ("mptcp: getsockopt: add support for IP_TOS") is not in this release.
      The conflicts are in the context, the new helper can be added without
      issue. It depends on mptcp_put_int_option() which has been added via
      another backport, see commit 874aae15fbef ("mptcp: fix full TCP
      keep-alive support"). ]
    Signed-off-by: Matthieu Baerts (NGI0) <[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: 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: defer final 'struct net' free in netns dismantle [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Wed Dec 4 12:54:55 2024 +0000

    net: defer final 'struct net' free in netns dismantle
    
    commit 0f6ede9fbc747e2553612271bce108f7517e7a45 upstream.
    
    Ilya reported a slab-use-after-free in dst_destroy [1]
    
    Issue is in xfrm6_net_init() and xfrm4_net_init() :
    
    They copy xfrm[46]_dst_ops_template into net->xfrm.xfrm[46]_dst_ops.
    
    But net structure might be freed before all the dst callbacks are
    called. So when dst_destroy() calls later :
    
    if (dst->ops->destroy)
        dst->ops->destroy(dst);
    
    dst->ops points to the old net->xfrm.xfrm[46]_dst_ops, which has been freed.
    
    See a relevant issue fixed in :
    
    ac888d58869b ("net: do not delay dst_entries_add() in dst_release()")
    
    A fix is to queue the 'struct net' to be freed after one
    another cleanup_net() round (and existing rcu_barrier())
    
    [1]
    
    BUG: KASAN: slab-use-after-free in dst_destroy (net/core/dst.c:112)
    Read of size 8 at addr ffff8882137ccab0 by task swapper/37/0
    Dec 03 05:46:18 kernel:
    CPU: 37 UID: 0 PID: 0 Comm: swapper/37 Kdump: loaded Not tainted 6.12.0 #67
    Hardware name: Red Hat KVM/RHEL, BIOS 1.16.1-1.el9 04/01/2014
    Call Trace:
     <IRQ>
    dump_stack_lvl (lib/dump_stack.c:124)
    print_address_description.constprop.0 (mm/kasan/report.c:378)
    ? dst_destroy (net/core/dst.c:112)
    print_report (mm/kasan/report.c:489)
    ? dst_destroy (net/core/dst.c:112)
    ? kasan_addr_to_slab (mm/kasan/common.c:37)
    kasan_report (mm/kasan/report.c:603)
    ? dst_destroy (net/core/dst.c:112)
    ? rcu_do_batch (kernel/rcu/tree.c:2567)
    dst_destroy (net/core/dst.c:112)
    rcu_do_batch (kernel/rcu/tree.c:2567)
    ? __pfx_rcu_do_batch (kernel/rcu/tree.c:2491)
    ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4339 kernel/locking/lockdep.c:4406)
    rcu_core (kernel/rcu/tree.c:2825)
    handle_softirqs (kernel/softirq.c:554)
    __irq_exit_rcu (kernel/softirq.c:589 kernel/softirq.c:428 kernel/softirq.c:637)
    irq_exit_rcu (kernel/softirq.c:651)
    sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1049 arch/x86/kernel/apic/apic.c:1049)
     </IRQ>
     <TASK>
    asm_sysvec_apic_timer_interrupt (./arch/x86/include/asm/idtentry.h:702)
    RIP: 0010:default_idle (./arch/x86/include/asm/irqflags.h:37 ./arch/x86/include/asm/irqflags.h:92 arch/x86/kernel/process.c:743)
    Code: 00 4d 29 c8 4c 01 c7 4c 29 c2 e9 6e ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 90 0f 00 2d c7 c9 27 00 fb f4 <fa> c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90
    RSP: 0018:ffff888100d2fe00 EFLAGS: 00000246
    RAX: 00000000001870ed RBX: 1ffff110201a5fc2 RCX: ffffffffb61a3e46
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffb3d4d123
    RBP: 0000000000000000 R08: 0000000000000001 R09: ffffed11c7e1835d
    R10: ffff888e3f0c1aeb R11: 0000000000000000 R12: 0000000000000000
    R13: ffff888100d20000 R14: dffffc0000000000 R15: 0000000000000000
    ? ct_kernel_exit.constprop.0 (kernel/context_tracking.c:148)
    ? cpuidle_idle_call (kernel/sched/idle.c:186)
    default_idle_call (./include/linux/cpuidle.h:143 kernel/sched/idle.c:118)
    cpuidle_idle_call (kernel/sched/idle.c:186)
    ? __pfx_cpuidle_idle_call (kernel/sched/idle.c:168)
    ? lock_release (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5848)
    ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4347 kernel/locking/lockdep.c:4406)
    ? tsc_verify_tsc_adjust (arch/x86/kernel/tsc_sync.c:59)
    do_idle (kernel/sched/idle.c:326)
    cpu_startup_entry (kernel/sched/idle.c:423 (discriminator 1))
    start_secondary (arch/x86/kernel/smpboot.c:202 arch/x86/kernel/smpboot.c:282)
    ? __pfx_start_secondary (arch/x86/kernel/smpboot.c:232)
    ? soft_restart_cpu (arch/x86/kernel/head_64.S:452)
    common_startup_64 (arch/x86/kernel/head_64.S:414)
     </TASK>
    Dec 03 05:46:18 kernel:
    Allocated by task 12184:
    kasan_save_stack (mm/kasan/common.c:48)
    kasan_save_track (./arch/x86/include/asm/current.h:49 mm/kasan/common.c:60 mm/kasan/common.c:69)
    __kasan_slab_alloc (mm/kasan/common.c:319 mm/kasan/common.c:345)
    kmem_cache_alloc_noprof (mm/slub.c:4085 mm/slub.c:4134 mm/slub.c:4141)
    copy_net_ns (net/core/net_namespace.c:421 net/core/net_namespace.c:480)
    create_new_namespaces (kernel/nsproxy.c:110)
    unshare_nsproxy_namespaces (kernel/nsproxy.c:228 (discriminator 4))
    ksys_unshare (kernel/fork.c:3313)
    __x64_sys_unshare (kernel/fork.c:3382)
    do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
    entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    Dec 03 05:46:18 kernel:
    Freed by task 11:
    kasan_save_stack (mm/kasan/common.c:48)
    kasan_save_track (./arch/x86/include/asm/current.h:49 mm/kasan/common.c:60 mm/kasan/common.c:69)
    kasan_save_free_info (mm/kasan/generic.c:582)
    __kasan_slab_free (mm/kasan/common.c:271)
    kmem_cache_free (mm/slub.c:4579 mm/slub.c:4681)
    cleanup_net (net/core/net_namespace.c:456 net/core/net_namespace.c:446 net/core/net_namespace.c:647)
    process_one_work (kernel/workqueue.c:3229)
    worker_thread (kernel/workqueue.c:3304 kernel/workqueue.c:3391)
    kthread (kernel/kthread.c:389)
    ret_from_fork (arch/x86/kernel/process.c:147)
    ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
    Dec 03 05:46:18 kernel:
    Last potentially related work creation:
    kasan_save_stack (mm/kasan/common.c:48)
    __kasan_record_aux_stack (mm/kasan/generic.c:541)
    insert_work (./include/linux/instrumented.h:68 ./include/asm-generic/bitops/instrumented-non-atomic.h:141 kernel/workqueue.c:788 kernel/workqueue.c:795 kernel/workqueue.c:2186)
    __queue_work (kernel/workqueue.c:2340)
    queue_work_on (kernel/workqueue.c:2391)
    xfrm_policy_insert (net/xfrm/xfrm_policy.c:1610)
    xfrm_add_policy (net/xfrm/xfrm_user.c:2116)
    xfrm_user_rcv_msg (net/xfrm/xfrm_user.c:3321)
    netlink_rcv_skb (net/netlink/af_netlink.c:2536)
    xfrm_netlink_rcv (net/xfrm/xfrm_user.c:3344)
    netlink_unicast (net/netlink/af_netlink.c:1316 net/netlink/af_netlink.c:1342)
    netlink_sendmsg (net/netlink/af_netlink.c:1886)
    sock_write_iter (net/socket.c:729 net/socket.c:744 net/socket.c:1165)
    vfs_write (fs/read_write.c:590 fs/read_write.c:683)
    ksys_write (fs/read_write.c:736)
    do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
    entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    Dec 03 05:46:18 kernel:
    Second to last potentially related work creation:
    kasan_save_stack (mm/kasan/common.c:48)
    __kasan_record_aux_stack (mm/kasan/generic.c:541)
    insert_work (./include/linux/instrumented.h:68 ./include/asm-generic/bitops/instrumented-non-atomic.h:141 kernel/workqueue.c:788 kernel/workqueue.c:795 kernel/workqueue.c:2186)
    __queue_work (kernel/workqueue.c:2340)
    queue_work_on (kernel/workqueue.c:2391)
    __xfrm_state_insert (./include/linux/workqueue.h:723 net/xfrm/xfrm_state.c:1150 net/xfrm/xfrm_state.c:1145 net/xfrm/xfrm_state.c:1513)
    xfrm_state_update (./include/linux/spinlock.h:396 net/xfrm/xfrm_state.c:1940)
    xfrm_add_sa (net/xfrm/xfrm_user.c:912)
    xfrm_user_rcv_msg (net/xfrm/xfrm_user.c:3321)
    netlink_rcv_skb (net/netlink/af_netlink.c:2536)
    xfrm_netlink_rcv (net/xfrm/xfrm_user.c:3344)
    netlink_unicast (net/netlink/af_netlink.c:1316 net/netlink/af_netlink.c:1342)
    netlink_sendmsg (net/netlink/af_netlink.c:1886)
    sock_write_iter (net/socket.c:729 net/socket.c:744 net/socket.c:1165)
    vfs_write (fs/read_write.c:590 fs/read_write.c:683)
    ksys_write (fs/read_write.c:736)
    do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
    entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    
    Fixes: a8a572a6b5f2 ("xfrm: dst_entries_init() per-net dst_ops")
    Reported-by: Ilya Maximets <[email protected]>
    Closes: https://lore.kernel.org/netdev/CANn89iKKYDVpB=MtmfH7nyv2p=rJWSLedO5k7wSZgtY_tO8WQg@mail.gmail.com/T/#m02c98c3009fe66382b73cfb4db9cf1df6fab3fbf
    Signed-off-by: Eric Dumazet <[email protected]>
    Acked-by: Paolo Abeni <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[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]>

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: 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: enable .port_set_policy() for 6320 family [+ + +]
Author: Marek Behún <[email protected]>
Date:   Tue Apr 29 12:14:36 2025 +0200

    net: dsa: mv88e6xxx: enable .port_set_policy() for 6320 family
    
    commit a2ef58e2c4aea4de166fc9832eb2b621e88c98d5 upstream.
    
    Commit f3a2cd326e44 ("net: dsa: mv88e6xxx: introduce .port_set_policy")
    did not add the .port_set_policy() method for the 6320 family. Fix it.
    
    Fixes: f3a2cd326e44 ("net: dsa: mv88e6xxx: introduce .port_set_policy")
    Signed-off-by: Marek Behún <[email protected]>
    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: dsa: mv88e6xxx: enable PVT for 6321 switch [+ + +]
Author: Marek Behún <[email protected]>
Date:   Tue Apr 29 12:14:35 2025 +0200

    net: dsa: mv88e6xxx: enable PVT for 6321 switch
    
    commit f85c69369854a43af2c5d3b3896da0908d713133 upstream.
    
    Commit f36456522168 ("net: dsa: mv88e6xxx: move PVT description in
    info") did not enable PVT for 6321 switch. Fix it.
    
    Fixes: f36456522168 ("net: dsa: mv88e6xxx: move PVT description in info")
    Signed-off-by: Marek Behún <[email protected]>
    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: dsa: mv88e6xxx: fix atu_move_port_mask for 6341 family [+ + +]
Author: Marek Behún <[email protected]>
Date:   Tue Apr 29 12:14:34 2025 +0200

    net: dsa: mv88e6xxx: fix atu_move_port_mask for 6341 family
    
    commit 4ae01ec007716986e1a20f1285eb013cbf188830 upstream.
    
    The atu_move_port_mask for 6341 family (Topaz) is 0xf, not 0x1f. The
    PortVec field is 8 bits wide, not 11 as in 6390 family. Fix this.
    
    Fixes: e606ca36bbf2 ("net: dsa: mv88e6xxx: rework ATU Remove")
    Signed-off-by: Marek Behún <[email protected]>
    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: dsa: mv88e6xxx: fix VTU methods for 6320 family [+ + +]
Author: Marek Behún <[email protected]>
Date:   Mon Mar 17 18:32:44 2025 +0100

    net: dsa: mv88e6xxx: fix VTU methods for 6320 family
    
    [ Upstream commit f9a457722cf5e3534be5ffab549d6b49737fca72 ]
    
    The VTU registers of the 6320 family use the 6352 semantics, not 6185.
    Fix it.
    
    Fixes: b8fee9571063 ("net: dsa: mv88e6xxx: add VLAN Get Next support")
    Signed-off-by: Marek Behún <[email protected]>
    Cc: <[email protected]> # 5.15.x
    Reviewed-by: Andrew Lunn <[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: 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: fix crash when config small gso_max_size/gso_ipv4_max_size [+ + +]
Author: Wang Liang <[email protected]>
Date:   Mon Apr 14 11:50:21 2025 -0700

    net: fix crash when config small gso_max_size/gso_ipv4_max_size
    
    [ Upstream commit 9ab5cf19fb0e4680f95e506d6c544259bf1111c4 ]
    
    Config a small gso_max_size/gso_ipv4_max_size will lead to an underflow
    in sk_dst_gso_max_size(), which may trigger a BUG_ON crash,
    because sk->sk_gso_max_size would be much bigger than device limits.
    Call Trace:
    tcp_write_xmit
        tso_segs = tcp_init_tso_segs(skb, mss_now);
            tcp_set_skb_tso_segs
                tcp_skb_pcount_set
                    // skb->len = 524288, mss_now = 8
                    // u16 tso_segs = 524288/8 = 65535 -> 0
                    tso_segs = DIV_ROUND_UP(skb->len, mss_now)
        BUG_ON(!tso_segs)
    Add check for the minimum value of gso_max_size and gso_ipv4_max_size.
    
    Fixes: 46e6b992c250 ("rtnetlink: allow GSO maximums to be set on device creation")
    Fixes: 9eefedd58ae1 ("net: add gso_ipv4_max_size and gro_ipv4_max_size per device")
    Signed-off-by: Wang Liang <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [ Resolve minor conflicts to fix CVE-2024-50258 ]
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    [Harshit: Clean cherrypick from 6.1.y commit]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: make sock_inuse_add() available [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Mon Nov 15 09:11:48 2021 -0800

    net: make sock_inuse_add() available
    
    commit d477eb9004845cb2dc92ad5eed79a437738a868a upstream.
    
    MPTCP hard codes it, let us instead provide this helper.
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    [ cherry-pick from amazon-linux amazon-5.15.y/mainline ]
    Link: https://github.com/amazonlinux/linux/commit/7154d8eaac16
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: mana: Fix error handling in mana_create_txq/rxq's NAPI cleanup [+ + +]
Author: Souradeep Chakrabarti <[email protected]>
Date:   Mon Apr 14 11:50:18 2025 -0700

    net: mana: Fix error handling in mana_create_txq/rxq's NAPI cleanup
    
    [ Upstream commit b6ecc662037694488bfff7c9fd21c405df8411f2 ]
    
    Currently napi_disable() gets called during rxq and txq cleanup,
    even before napi is enabled and hrtimer is initialized. It causes
    kernel panic.
    
    ? page_fault_oops+0x136/0x2b0
      ? page_counter_cancel+0x2e/0x80
      ? do_user_addr_fault+0x2f2/0x640
      ? refill_obj_stock+0xc4/0x110
      ? exc_page_fault+0x71/0x160
      ? asm_exc_page_fault+0x27/0x30
      ? __mmdrop+0x10/0x180
      ? __mmdrop+0xec/0x180
      ? hrtimer_active+0xd/0x50
      hrtimer_try_to_cancel+0x2c/0xf0
      hrtimer_cancel+0x15/0x30
      napi_disable+0x65/0x90
      mana_destroy_rxq+0x4c/0x2f0
      mana_create_rxq.isra.0+0x56c/0x6d0
      ? mana_uncfg_vport+0x50/0x50
      mana_alloc_queues+0x21b/0x320
      ? skb_dequeue+0x5f/0x80
    
    Cc: [email protected]
    Fixes: e1b5683ff62e ("net: mana: Move NAPI from EQ to CQ")
    Signed-off-by: Souradeep Chakrabarti <[email protected]>
    Reviewed-by: Haiyang Zhang <[email protected]>
    Reviewed-by: Shradha Gupta <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    (cherry picked from commit b6ecc662037694488bfff7c9fd21c405df8411f2)
    [Harshit: conflicts resolved due to missing commit: ed5356b53f07 ("net:
    mana: Add XDP support") and commit: d356abb95b98 ("net: mana: Add
    counter for XDP_TX") in 5.15.y]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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: 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: openvswitch: fix race on port output [+ + +]
Author: Felix Huettner <[email protected]>
Date:   Wed Apr 5 07:53:41 2023 +0000

    net: openvswitch: fix race on port output
    
    commit 066b86787fa3d97b7aefb5ac0a99a22dad2d15f8 upstream.
    
    assume the following setup on a single machine:
    1. An openvswitch instance with one bridge and default flows
    2. two network namespaces "server" and "client"
    3. two ovs interfaces "server" and "client" on the bridge
    4. for each ovs interface a veth pair with a matching name and 32 rx and
       tx queues
    5. move the ends of the veth pairs to the respective network namespaces
    6. assign ip addresses to each of the veth ends in the namespaces (needs
       to be the same subnet)
    7. start some http server on the server network namespace
    8. test if a client in the client namespace can reach the http server
    
    when following the actions below the host has a chance of getting a cpu
    stuck in a infinite loop:
    1. send a large amount of parallel requests to the http server (around
       3000 curls should work)
    2. in parallel delete the network namespace (do not delete interfaces or
       stop the server, just kill the namespace)
    
    there is a low chance that this will cause the below kernel cpu stuck
    message. If this does not happen just retry.
    Below there is also the output of bpftrace for the functions mentioned
    in the output.
    
    The series of events happening here is:
    1. the network namespace is deleted calling
       `unregister_netdevice_many_notify` somewhere in the process
    2. this sets first `NETREG_UNREGISTERING` on both ends of the veth and
       then runs `synchronize_net`
    3. it then calls `call_netdevice_notifiers` with `NETDEV_UNREGISTER`
    4. this is then handled by `dp_device_event` which calls
       `ovs_netdev_detach_dev` (if a vport is found, which is the case for
       the veth interface attached to ovs)
    5. this removes the rx_handlers of the device but does not prevent
       packages to be sent to the device
    6. `dp_device_event` then queues the vport deletion to work in
       background as a ovs_lock is needed that we do not hold in the
       unregistration path
    7. `unregister_netdevice_many_notify` continues to call
       `netdev_unregister_kobject` which sets `real_num_tx_queues` to 0
    8. port deletion continues (but details are not relevant for this issue)
    9. at some future point the background task deletes the vport
    
    If after 7. but before 9. a packet is send to the ovs vport (which is
    not deleted at this point in time) which forwards it to the
    `dev_queue_xmit` flow even though the device is unregistering.
    In `skb_tx_hash` (which is called in the `dev_queue_xmit`) path there is
    a while loop (if the packet has a rx_queue recorded) that is infinite if
    `dev->real_num_tx_queues` is zero.
    
    To prevent this from happening we update `do_output` to handle devices
    without carrier the same as if the device is not found (which would
    be the code path after 9. is done).
    
    Additionally we now produce a warning in `skb_tx_hash` if we will hit
    the infinite loop.
    
    bpftrace (first word is function name):
    
    __dev_queue_xmit server: real_num_tx_queues: 1, cpu: 2, pid: 28024, tid: 28024, skb_addr: 0xffff9edb6f207000, reg_state: 1
    netdev_core_pick_tx server: addr: 0xffff9f0a46d4a000 real_num_tx_queues: 1, cpu: 2, pid: 28024, tid: 28024, skb_addr: 0xffff9edb6f207000, reg_state: 1
    dp_device_event server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, event 2, reg_state: 1
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    dp_device_event server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, event 6, reg_state: 2
    ovs_netdev_detach_dev server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, reg_state: 2
    netdev_rx_handler_unregister server: real_num_tx_queues: 1, cpu: 9, pid: 21024, tid: 21024, reg_state: 2
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    netdev_rx_handler_unregister ret server: real_num_tx_queues: 1, cpu: 9, pid: 21024, tid: 21024, reg_state: 2
    dp_device_event server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, event 27, reg_state: 2
    dp_device_event server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, event 22, reg_state: 2
    dp_device_event server: real_num_tx_queues: 1 cpu 9, pid: 21024, tid: 21024, event 18, reg_state: 2
    netdev_unregister_kobject: real_num_tx_queues: 1, cpu: 9, pid: 21024, tid: 21024
    synchronize_rcu_expedited: cpu 9, pid: 21024, tid: 21024
    ovs_vport_send server: real_num_tx_queues: 0, cpu: 2, pid: 28024, tid: 28024, skb_addr: 0xffff9edb6f207000, reg_state: 2
    __dev_queue_xmit server: real_num_tx_queues: 0, cpu: 2, pid: 28024, tid: 28024, skb_addr: 0xffff9edb6f207000, reg_state: 2
    netdev_core_pick_tx server: addr: 0xffff9f0a46d4a000 real_num_tx_queues: 0, cpu: 2, pid: 28024, tid: 28024, skb_addr: 0xffff9edb6f207000, reg_state: 2
    broken device server: real_num_tx_queues: 0, cpu: 2, pid: 28024, tid: 28024
    ovs_dp_detach_port server: real_num_tx_queues: 0 cpu 9, pid: 9124, tid: 9124, reg_state: 2
    synchronize_rcu_expedited: cpu 9, pid: 33604, tid: 33604
    
    stuck message:
    
    watchdog: BUG: soft lockup - CPU#5 stuck for 26s! [curl:1929279]
    Modules linked in: veth pktgen bridge stp llc ip_set_hash_net nft_counter xt_set nft_compat nf_tables ip_set_hash_ip ip_set nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 tls binfmt_misc nls_iso8859_1 input_leds joydev serio_raw dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua sch_fq_codel drm efi_pstore virtio_rng ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_generic usbhid hid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel virtio_net ahci net_failover crypto_simd cryptd psmouse libahci virtio_blk failover
    CPU: 5 PID: 1929279 Comm: curl Not tainted 5.15.0-67-generic #74-Ubuntu
    Hardware name: OpenStack Foundation OpenStack Nova, BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    RIP: 0010:netdev_pick_tx+0xf1/0x320
    Code: 00 00 8d 48 ff 0f b7 c1 66 39 ca 0f 86 e9 01 00 00 45 0f b7 ff 41 39 c7 0f 87 5b 01 00 00 44 29 f8 41 39 c7 0f 87 4f 01 00 00 <eb> f2 0f 1f 44 00 00 49 8b 94 24 28 04 00 00 48 85 d2 0f 84 53 01
    RSP: 0018:ffffb78b40298820 EFLAGS: 00000246
    RAX: 0000000000000000 RBX: ffff9c8773adc2e0 RCX: 000000000000083f
    RDX: 0000000000000000 RSI: ffff9c8773adc2e0 RDI: ffff9c870a25e000
    RBP: ffffb78b40298858 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff9c870a25e000
    R13: ffff9c870a25e000 R14: ffff9c87fe043480 R15: 0000000000000000
    FS:  00007f7b80008f00(0000) GS:ffff9c8e5f740000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f7b80f6a0b0 CR3: 0000000329d66000 CR4: 0000000000350ee0
    Call Trace:
     <IRQ>
     netdev_core_pick_tx+0xa4/0xb0
     __dev_queue_xmit+0xf8/0x510
     ? __bpf_prog_exit+0x1e/0x30
     dev_queue_xmit+0x10/0x20
     ovs_vport_send+0xad/0x170 [openvswitch]
     do_output+0x59/0x180 [openvswitch]
     do_execute_actions+0xa80/0xaa0 [openvswitch]
     ? kfree+0x1/0x250
     ? kfree+0x1/0x250
     ? kprobe_perf_func+0x4f/0x2b0
     ? flow_lookup.constprop.0+0x5c/0x110 [openvswitch]
     ovs_execute_actions+0x4c/0x120 [openvswitch]
     ovs_dp_process_packet+0xa1/0x200 [openvswitch]
     ? ovs_ct_update_key.isra.0+0xa8/0x120 [openvswitch]
     ? ovs_ct_fill_key+0x1d/0x30 [openvswitch]
     ? ovs_flow_key_extract+0x2db/0x350 [openvswitch]
     ovs_vport_receive+0x77/0xd0 [openvswitch]
     ? __htab_map_lookup_elem+0x4e/0x60
     ? bpf_prog_680e8aff8547aec1_kfree+0x3b/0x714
     ? trace_call_bpf+0xc8/0x150
     ? kfree+0x1/0x250
     ? kfree+0x1/0x250
     ? kprobe_perf_func+0x4f/0x2b0
     ? kprobe_perf_func+0x4f/0x2b0
     ? __mod_memcg_lruvec_state+0x63/0xe0
     netdev_port_receive+0xc4/0x180 [openvswitch]
     ? netdev_port_receive+0x180/0x180 [openvswitch]
     netdev_frame_hook+0x1f/0x40 [openvswitch]
     __netif_receive_skb_core.constprop.0+0x23d/0xf00
     __netif_receive_skb_one_core+0x3f/0xa0
     __netif_receive_skb+0x15/0x60
     process_backlog+0x9e/0x170
     __napi_poll+0x33/0x180
     net_rx_action+0x126/0x280
     ? ttwu_do_activate+0x72/0xf0
     __do_softirq+0xd9/0x2e7
     ? rcu_report_exp_cpu_mult+0x1b0/0x1b0
     do_softirq+0x7d/0xb0
     </IRQ>
     <TASK>
     __local_bh_enable_ip+0x54/0x60
     ip_finish_output2+0x191/0x460
     __ip_finish_output+0xb7/0x180
     ip_finish_output+0x2e/0xc0
     ip_output+0x78/0x100
     ? __ip_finish_output+0x180/0x180
     ip_local_out+0x5e/0x70
     __ip_queue_xmit+0x184/0x440
     ? tcp_syn_options+0x1f9/0x300
     ip_queue_xmit+0x15/0x20
     __tcp_transmit_skb+0x910/0x9c0
     ? __mod_memcg_state+0x44/0xa0
     tcp_connect+0x437/0x4e0
     ? ktime_get_with_offset+0x60/0xf0
     tcp_v4_connect+0x436/0x530
     __inet_stream_connect+0xd4/0x3a0
     ? kprobe_perf_func+0x4f/0x2b0
     ? aa_sk_perm+0x43/0x1c0
     inet_stream_connect+0x3b/0x60
     __sys_connect_file+0x63/0x70
     __sys_connect+0xa6/0xd0
     ? setfl+0x108/0x170
     ? do_fcntl+0xe8/0x5a0
     __x64_sys_connect+0x18/0x20
     do_syscall_64+0x5c/0xc0
     ? __x64_sys_fcntl+0xa9/0xd0
     ? exit_to_user_mode_prepare+0x37/0xb0
     ? syscall_exit_to_user_mode+0x27/0x50
     ? do_syscall_64+0x69/0xc0
     ? __sys_setsockopt+0xea/0x1e0
     ? exit_to_user_mode_prepare+0x37/0xb0
     ? syscall_exit_to_user_mode+0x27/0x50
     ? __x64_sys_setsockopt+0x1f/0x30
     ? do_syscall_64+0x69/0xc0
     ? irqentry_exit+0x1d/0x30
     ? exc_page_fault+0x89/0x170
     entry_SYSCALL_64_after_hwframe+0x61/0xcb
    RIP: 0033:0x7f7b8101c6a7
    Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 18 89 54 24 0c 48 89 34 24 89
    RSP: 002b:00007ffffd6b2198 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7b8101c6a7
    RDX: 0000000000000010 RSI: 00007ffffd6b2360 RDI: 0000000000000005
    RBP: 0000561f1370d560 R08: 00002795ad21d1ac R09: 0030312e302e302e
    R10: 00007ffffd73f080 R11: 0000000000000246 R12: 0000561f1370c410
    R13: 0000000000000000 R14: 0000000000000005 R15: 0000000000000000
     </TASK>
    
    Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
    Co-developed-by: Luca Czesla <[email protected]>
    Signed-off-by: Luca Czesla <[email protected]>
    Signed-off-by: Felix Huettner <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/ZC0pBXBAgh7c76CA@kernel-bug-kernel-bug
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Carlos Soto <[email protected]>
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: phy: leds: fix memory leak [+ + +]
Author: Qingfang Deng <[email protected]>
Date:   Thu Apr 17 11:25:56 2025 +0800

    net: phy: leds: fix memory leak
    
    [ Upstream commit b7f0ee992adf601aa00c252418266177eb7ac2bc ]
    
    A network restart test on a router led to an out-of-memory condition,
    which was traced to a memory leak in the PHY LED trigger code.
    
    The root cause is misuse of the devm API. The registration function
    (phy_led_triggers_register) is called from phy_attach_direct, not
    phy_probe, and the unregister function (phy_led_triggers_unregister)
    is called from phy_detach, not phy_remove. This means the register and
    unregister functions can be called multiple times for the same PHY
    device, but devm-allocated memory is not freed until the driver is
    unbound.
    
    This also prevents kmemleak from detecting the leak, as the devm API
    internally stores the allocated pointer.
    
    Fix this by replacing devm_kzalloc/devm_kcalloc with standard
    kzalloc/kcalloc, and add the corresponding kfree calls in the unregister
    path.
    
    Fixes: 3928ee6485a3 ("net: phy: leds: Add support for "link" trigger")
    Fixes: 2e0bc452f472 ("net: phy: leds: add support for led triggers on phy link state change")
    Signed-off-by: Hao Guan <[email protected]>
    Signed-off-by: Qingfang Deng <[email protected]>
    Reviewed-by: Andrew Lunn <[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: selftests: initialize TCP header and skb payload with zero [+ + +]
Author: Oleksij Rempel <[email protected]>
Date:   Wed Apr 16 18:01:25 2025 +0200

    net: selftests: initialize TCP header and skb payload with zero
    
    commit 9e8d1013b0c38910cbc9e60de74dbe883878469d upstream.
    
    Zero-initialize TCP header via memset() to avoid garbage values that
    may affect checksum or behavior during test transmission.
    
    Also zero-fill allocated payload and padding regions using memset()
    after skb_put(), ensuring deterministic content for all outgoing
    test packets.
    
    Fixes: 3e1e58d64c3d ("net: add generic selftest support")
    Signed-off-by: Oleksij Rempel <[email protected]>
    Cc: [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: Greg Kroah-Hartman <[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: 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: hfsc: Fix a potential UAF in hfsc_dequeue() too [+ + +]
Author: Cong Wang <[email protected]>
Date:   Thu Apr 17 11:47:31 2025 -0700

    net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too
    
    [ Upstream commit 6ccbda44e2cc3d26fd22af54c650d6d5d801addf ]
    
    Similarly to the previous patch, we need to safe guard hfsc_dequeue()
    too. But for this one, we don't have a reliable reproducer.
    
    Fixes: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 ("Linux-2.6.12-rc2")
    Reported-by: Gerrard Tai <[email protected]>
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Jamal Hadi Salim <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net_sched: hfsc: Fix a UAF vulnerability in class handling [+ + +]
Author: Cong Wang <[email protected]>
Date:   Thu Apr 17 11:47:30 2025 -0700

    net_sched: hfsc: Fix a UAF vulnerability in class handling
    
    [ Upstream commit 3df275ef0a6ae181e8428a6589ef5d5231e58b5c ]
    
    This patch fixes a Use-After-Free vulnerability in the HFSC qdisc class
    handling. The issue occurs due to a time-of-check/time-of-use condition
    in hfsc_change_class() when working with certain child qdiscs like netem
    or codel.
    
    The vulnerability works as follows:
    1. hfsc_change_class() checks if a class has packets (q.qlen != 0)
    2. It then calls qdisc_peek_len(), which for certain qdiscs (e.g.,
       codel, netem) might drop packets and empty the queue
    3. The code continues assuming the queue is still non-empty, adding
       the class to vttree
    4. This breaks HFSC scheduler assumptions that only non-empty classes
       are in vttree
    5. Later, when the class is destroyed, this can lead to a Use-After-Free
    
    The fix adds a second queue length check after qdisc_peek_len() to verify
    the queue wasn't emptied.
    
    Fixes: 21f4d5cc25ec ("net_sched/hfsc: fix curve activation in hfsc_change_class()")
    Reported-by: Gerrard Tai <[email protected]>
    Reviewed-by: Konstantin Khlebnikov <[email protected]>
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Jamal Hadi Salim <[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]>

nfs: move nfs_fhandle_hash to common include file [+ + +]
Author: Jeff Layton <[email protected]>
Date:   Fri Mar 3 07:16:02 2023 -0500

    nfs: move nfs_fhandle_hash to common include file
    
    [ Upstream commit e59fb6749ed833deee5b3cfd7e89925296d41f49 ]
    
    lockd needs to be able to hash filehandles for tracepoints. Move the
    nfs_fhandle_hash() helper to a common nfs include file.
    
    Signed-off-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Stable-dep-of: cd35b6cb4664 ("nfs: add missing selections of CONFIG_CRC32")
    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: reduce stack usage in idt_scan_mws [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Fri Feb 21 09:57:25 2025 +0100

    ntb: reduce stack usage in idt_scan_mws
    
    [ Upstream commit aff12700b8dd7422bfe2277696e192af4df9de8f ]
    
    idt_scan_mws() puts a large fixed-size array on the stack and copies
    it into a smaller dynamically allocated array at the end. On 32-bit
    targets, the fixed size can easily exceed the warning limit for
    possible stack overflow:
    
    drivers/ntb/hw/idt/ntb_hw_idt.c:1041:27: error: stack frame size (1032) exceeds limit (1024) in 'idt_scan_mws' [-Werror,-Wframe-larger-than]
    
    Change it to instead just always use dynamic allocation for the
    array from the start. It's too big for the stack, but not actually
    all that much for a permanent allocation.
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Arnd Bergmann <[email protected]>
    Reviewed-by: Dave Jiang <[email protected]>
    Reviewed-by: Damien Le Moal <[email protected]>
    Signed-off-by: Jon Mason <[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: fixup scan failure for non-ANA multipath controllers [+ + +]
Author: Hannes Reinecke <[email protected]>
Date:   Mon Apr 14 14:05:09 2025 +0200

    nvme: fixup scan failure for non-ANA multipath controllers
    
    commit 26d7fb4fd4ca1180e2fa96587dea544563b4962a upstream.
    
    Commit 62baf70c3274 caused the ANA log page to be re-read, even on
    controllers that do not support ANA.  While this should generally
    harmless, some controllers hang on the unsupported log page and
    never finish probing.
    
    Fixes: 62baf70c3274 ("nvme: re-read ANA log page after ns scan completes")
    Signed-off-by: Hannes Reinecke <[email protected]>
    Tested-by: Srikanth Aithal <[email protected]>
    [hch: more detailed commit message]
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Sagi Grimberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nvme: re-read ANA log page after ns scan completes [+ + +]
Author: Hannes Reinecke <[email protected]>
Date:   Thu Apr 3 09:19:30 2025 +0200

    nvme: re-read ANA log page after ns scan completes
    
    [ Upstream commit 62baf70c327444338c34703c71aa8cc8e4189bd6 ]
    
    When scanning for new namespaces we might have missed an ANA AEN.
    
    The NVMe base spec (NVMe Base Specification v2.1, Figure 151 'Asynchonous
    Event Information - Notice': Asymmetric Namespace Access Change) states:
    
      A controller shall not send this even if an Attached Namespace
      Attribute Changed asynchronous event [...] is sent for the same event.
    
    so we need to re-read the ANA log page after we rescanned the namespace
    list to update the ANA states of the new namespaces.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Keith Busch <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

nvme: requeue namespace scan on missed AENs [+ + +]
Author: Hannes Reinecke <[email protected]>
Date:   Thu Apr 3 09:19:29 2025 +0200

    nvme: requeue namespace scan on missed AENs
    
    [ Upstream commit 9546ad1a9bda7362492114f5866b95b0ac4a100e ]
    
    Scanning for namespaces can take some time, so if the target is
    reconfigured while the scan is running we may miss a Attached Namespace
    Attribute Changed AEN.
    
    Check if the NVME_AER_NOTICE_NS_CHANGED bit is set once the scan has
    finished, and requeue scanning to pick up any missed change.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Keith Busch <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nvmet-fc: put ref when assoc->del_work is already scheduled [+ + +]
Author: Daniel Wagner <[email protected]>
Date:   Tue Apr 8 17:29:10 2025 +0200

    nvmet-fc: put ref when assoc->del_work is already scheduled
    
    [ Upstream commit 70289ae5cac4d3a39575405aaf63330486cea030 ]
    
    Do not leak the tgtport reference when the work is already scheduled.
    
    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]>

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-fc: take tgtport reference only once [+ + +]
Author: Daniel Wagner <[email protected]>
Date:   Tue Apr 8 17:29:09 2025 +0200

    nvmet-fc: take tgtport reference only once
    
    [ Upstream commit b0b26ad0e1943de25ce82a7e5af3574f31b1cf99 ]
    
    The reference counting code can be simplified. Instead taking a tgtport
    refrerence at the beginning of nvmet_fc_alloc_hostport and put it back
    if not a new hostport object is allocated, only take it when a new
    hostport object is allocated.
    
    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]>

 
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, ASoC: codecs: wcd934x: Remove potential undefined behavior in wcd934x_slim_irq_handler() [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Mon Mar 24 14:56:09 2025 -0700

    objtool, ASoC: codecs: wcd934x: Remove potential undefined behavior in wcd934x_slim_irq_handler()
    
    [ Upstream commit 060aed9c0093b341480770457093449771cf1496 ]
    
    If 'port_id' is negative, the shift counts in wcd934x_slim_irq_handler()
    also become negative, resulting in undefined behavior due to shift out
    of bounds.
    
    If I'm reading the code correctly, that appears to be not possible, but
    with KCOV enabled, Clang's range analysis isn't always able to determine
    that and generates undefined behavior.
    
    As a result the code generation isn't optimal, and undefined behavior
    should be avoided regardless.  Improve code generation and remove the
    undefined behavior by converting the signed variables to unsigned.
    
    Fixes the following warning with UBSAN:
    
      sound/soc/codecs/snd-soc-wcd934x.o: warning: objtool: .text.wcd934x_slim_irq_handler: unexpected end of section
    
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Acked-by: Mark Brown <[email protected]>
    Cc: Srinivas Kandagatla <[email protected]>
    Cc: Liam Girdwood <[email protected]>
    Cc: Jaroslav Kysela <[email protected]>
    Cc: Takashi Iwai <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Link: https://lore.kernel.org/r/7e863839ec7301bf9c0f429a03873d44e484c31c.1742852847.git.jpoimboe@kernel.org
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Sasha Levin <[email protected]>

 
objtool: Stop UNRET validation on UD2 [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 8 00:02:15 2025 -0700

    objtool: Stop UNRET validation on UD2
    
    [ Upstream commit 9f9cc012c2cbac4833746a0182e06a8eec940d19 ]
    
    In preparation for simplifying INSN_SYSCALL, make validate_unret()
    terminate control flow on UD2 just like validate_branch() already does.
    
    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/ce841269e7e28c8b7f32064464a9821034d724ff.1744095216.git.jpoimboe@kernel.org
    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 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]>

 
openvswitch: fix lockup on tx to unregistering netdev with carrier [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Thu Jan 9 13:21:24 2025 +0100

    openvswitch: fix lockup on tx to unregistering netdev with carrier
    
    commit 47e55e4b410f7d552e43011baa5be1aab4093990 upstream.
    
    Commit in a fixes tag attempted to fix the issue in the following
    sequence of calls:
    
        do_output
        -> ovs_vport_send
           -> dev_queue_xmit
              -> __dev_queue_xmit
                 -> netdev_core_pick_tx
                    -> skb_tx_hash
    
    When device is unregistering, the 'dev->real_num_tx_queues' goes to
    zero and the 'while (unlikely(hash >= qcount))' loop inside the
    'skb_tx_hash' becomes infinite, locking up the core forever.
    
    But unfortunately, checking just the carrier status is not enough to
    fix the issue, because some devices may still be in unregistering
    state while reporting carrier status OK.
    
    One example of such device is a net/dummy.  It sets carrier ON
    on start, but it doesn't implement .ndo_stop to set the carrier off.
    And it makes sense, because dummy doesn't really have a carrier.
    Therefore, while this device is unregistering, it's still easy to hit
    the infinite loop in the skb_tx_hash() from the OVS datapath.  There
    might be other drivers that do the same, but dummy by itself is
    important for the OVS ecosystem, because it is frequently used as a
    packet sink for tcpdump while debugging OVS deployments.  And when the
    issue is hit, the only way to recover is to reboot.
    
    Fix that by also checking if the device is running.  The running
    state is handled by the net core during unregistering, so it covers
    unregistering case better, and we don't really need to send packets
    to devices that are not running anyway.
    
    While only checking the running state might be enough, the carrier
    check is preserved.  The running and the carrier states seem disjoined
    throughout the code and different drivers.  And other core functions
    like __dev_direct_xmit() check both before attempting to transmit
    a packet.  So, it seems safer to check both flags in OVS as well.
    
    Fixes: 066b86787fa3 ("net: openvswitch: fix race on port output")
    Reported-by: Friedrich Weber <[email protected]>
    Closes: https://mail.openvswitch.org/pipermail/ovs-discuss/2025-January/053423.html
    Signed-off-by: Ilya Maximets <[email protected]>
    Tested-by: Friedrich Weber <[email protected]>
    Reviewed-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]>
    Signed-off-by: Carlos Soto <[email protected]>
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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]>

 
parisc: PDT: Fix missing prototype warning [+ + +]
Author: Yu-Chun Lin <[email protected]>
Date:   Sun Feb 9 01:43:04 2025 +0800

    parisc: PDT: Fix missing prototype warning
    
    [ Upstream commit b899981750dcb958ceffa4462d903963ee494aa2 ]
    
    As reported by the kernel test robot, the following error occurs:
    
    arch/parisc/kernel/pdt.c:65:6: warning: no previous prototype for 'arch_report_meminfo' [-Wmissing-prototypes]
          65 | void arch_report_meminfo(struct seq_file *m)
             |      ^~~~~~~~~~~~~~~~~~~
    
    arch_report_meminfo() is declared in include/linux/proc_fs.h and only
    defined when CONFIG_PROC_FS is enabled. Wrap its definition in #ifdef
    CONFIG_PROC_FS to fix the -Wmissing-prototypes warning.
    
    Reported-by: kernel test robot <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Yu-Chun Lin <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI: Assign PCI domain IDs by ida_alloc() [+ + +]
Author: Pali Rohár <[email protected]>
Date:   Thu Jul 14 20:41:30 2022 +0200

    PCI: Assign PCI domain IDs by ida_alloc()
    
    [ Upstream commit c14f7ccc9f5dcf9d06ddeec706f85405b2c80600 ]
    
    Replace assignment of PCI domain IDs from atomic_inc_return() to
    ida_alloc().
    
    Use two IDAs, one for static domain allocations (those which are defined in
    device tree) and second for dynamic allocations (all other).
    
    During removal of root bus / host bridge, also release the domain ID.  The
    released ID can be reused again, for example when dynamically loading and
    unloading native PCI host bridge drivers.
    
    This change also allows to mix static device tree assignment and dynamic by
    kernel as all static allocations are reserved in dynamic pool.
    
    [bhelgaas: set "err" if "bus->domain_nr < 0"]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Pali Rohár <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Stable-dep-of: 804443c1f278 ("PCI: Fix reference leak in pci_register_host_bridge()")
    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: Coalesce host bridge contiguous apertures [+ + +]
Author: Kai-Heng Feng <[email protected]>
Date:   Tue Jul 13 20:50:07 2021 +0800

    PCI: Coalesce host bridge contiguous apertures
    
    [ Upstream commit 7c3855c423b17f6ca211858afb0cef20569914c7 ]
    
    Built-in graphics at 07:00.0 on HP EliteDesk 805 G6 doesn't work because
    graphics can't get the BAR it needs.  The BIOS configuration is
    correct: BARs 0 and 2 both fit in the 00:08.1 bridge window.
    
    But that 00:08.1 window covers two host bridge apertures from _CRS.
    Previously we assumed this was illegal, so we clipped the window to fit
    into one aperture (see 0f7e7aee2f37 ("PCI: Add pci_bus_clip_resource() to
    clip to fit upstream window")).
    
      pci_bus 0000:00: root bus resource [mem 0x10020200000-0x100303fffff window]
      pci_bus 0000:00: root bus resource [mem 0x10030400000-0x100401fffff window]
    
      pci 0000:00:08.1:   bridge window [mem 0x10030000000-0x100401fffff 64bit pref]
      pci 0000:07:00.0: reg 0x10: [mem 0x10030000000-0x1003fffffff 64bit pref]
      pci 0000:07:00.0: reg 0x18: [mem 0x10040000000-0x100401fffff 64bit pref]
    
      pci 0000:00:08.1: can't claim BAR 15 [mem 0x10030000000-0x100401fffff 64bit pref]: no compatible bridge window
      pci 0000:00:08.1: [mem 0x10030000000-0x100401fffff 64bit pref] clipped to [mem 0x10030000000-0x100303fffff 64bit pref]
      pci 0000:00:08.1:   bridge window [mem 0x10030000000-0x100303fffff 64bit pref]
    
      pci 0000:07:00.0: can't claim BAR 0 [mem 0x10030000000-0x1003fffffff 64bit pref]: no compatible bridge window
      pci 0000:07:00.0: can't claim BAR 2 [mem 0x10040000000-0x100401fffff 64bit pref]: no compatible bridge window
    
    However, the host bridge apertures are contiguous, so there's no need to
    clip in this case.  Coalesce contiguous apertures so we can allocate from
    the entire contiguous region.
    
    Previous commit 65db04053efe ("PCI: Coalesce host bridge contiguous
    apertures") was similar but sorted the apertures, and Guenter Roeck
    reported a regression in ppc:sam460ex qemu emulation from nvme; see
    https://lore.kernel.org/all/[email protected]/
    
    [bhelgaas: commit log]
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212013
    Suggested-by: Bjorn Helgaas <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kai-Heng Feng <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Cc: Guenter Roeck <[email protected]>
    Stable-dep-of: 804443c1f278 ("PCI: Fix reference leak in pci_register_host_bridge()")
    Signed-off-by: Sasha Levin <[email protected]>

PCI: Fix dropping valid root bus resources with .end = zero [+ + +]
Author: Geert Uytterhoeven <[email protected]>
Date:   Fri Feb 10 14:46:39 2023 +0100

    PCI: Fix dropping valid root bus resources with .end = zero
    
    commit 9d8ba74a181b1c81def21168795ed96cbe6f05ed upstream.
    
    On r8a7791/koelsch:
    
      kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
      # cat /sys/kernel/debug/kmemleak
      unreferenced object 0xc3a34e00 (size 64):
        comm "swapper/0", pid 1, jiffies 4294937460 (age 199.080s)
        hex dump (first 32 bytes):
          b4 5d 81 f0 b4 5d 81 f0 c0 b0 a2 c3 00 00 00 00  .]...]..........
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<fe3aa979>] __kmalloc+0xf0/0x140
          [<34bd6bc0>] resource_list_create_entry+0x18/0x38
          [<767046bc>] pci_add_resource_offset+0x20/0x68
          [<b3f3edf2>] devm_of_pci_get_host_bridge_resources.constprop.0+0xb0/0x390
    
    When coalescing two resources for a contiguous aperture, the second
    resource is enlarged to cover the full contiguous range, while the first
    resource is marked invalid.  This invalidation is done by clearing the
    flags, start, and end members.
    
    When adding the initial resources to the bus later, invalid resources are
    skipped.  Unfortunately, the check for an invalid resource considers only
    the end member, causing false positives.
    
    E.g. on r8a7791/koelsch, root bus resource 0 ("bus 00") is skipped, and no
    longer registered with pci_bus_insert_busn_res() (causing the memory leak),
    nor printed:
    
       pci-rcar-gen2 ee090000.pci: host bridge /soc/pci@ee090000 ranges:
       pci-rcar-gen2 ee090000.pci:      MEM 0x00ee080000..0x00ee08ffff -> 0x00ee080000
       pci-rcar-gen2 ee090000.pci: PCI: revision 11
       pci-rcar-gen2 ee090000.pci: PCI host bridge to bus 0000:00
      -pci_bus 0000:00: root bus resource [bus 00]
       pci_bus 0000:00: root bus resource [mem 0xee080000-0xee08ffff]
    
    Fix this by only skipping resources where all of the flags, start, and end
    members are zero.
    
    Fixes: 7c3855c423b17f6c ("PCI: Coalesce host bridge contiguous apertures")
    Link: https://lore.kernel.org/r/da0fcd5e86c74239be79c7cb03651c0fce31b515.1676036673.git.geert+renesas@glider.be
    Tested-by: Niklas Schnelle <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Kai-Heng Feng <[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: Fix reference leak in pci_register_host_bridge() [+ + +]
Author: Ma Ke <[email protected]>
Date:   Tue Feb 25 10:14:40 2025 +0800

    PCI: Fix reference leak in pci_register_host_bridge()
    
    [ Upstream commit 804443c1f27883926de94c849d91f5b7d7d696e9 ]
    
    If device_register() fails, call put_device() to give up the reference to
    avoid a memory leak, per the comment at device_register().
    
    Found by code review.
    
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
    Signed-off-by: Ma Ke <[email protected]>
    [bhelgaas: squash Dan Carpenter's double free fix from
    https://lore.kernel.org/r/[email protected]]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Cc: [email protected]
    Signed-off-by: Sasha Levin <[email protected]>

PCI: Fix use-after-free in pci_bus_release_domain_nr() [+ + +]
Author: Rob Herring <[email protected]>
Date:   Wed Mar 29 07:38:35 2023 -0500

    PCI: Fix use-after-free in pci_bus_release_domain_nr()
    
    commit 30ba2d09edb5ea857a1473ae3d820911347ada62 upstream.
    
    Commit c14f7ccc9f5d ("PCI: Assign PCI domain IDs by ida_alloc()")
    introduced a use-after-free bug in the bus removal cleanup. The issue was
    found with kfence:
    
      [   19.293351] BUG: KFENCE: use-after-free read in pci_bus_release_domain_nr+0x10/0x70
    
      [   19.302817] Use-after-free read at 0x000000007f3b80eb (in kfence-#115):
      [   19.309677]  pci_bus_release_domain_nr+0x10/0x70
      [   19.309691]  dw_pcie_host_deinit+0x28/0x78
      [   19.309702]  tegra_pcie_deinit_controller+0x1c/0x38 [pcie_tegra194]
      [   19.309734]  tegra_pcie_dw_probe+0x648/0xb28 [pcie_tegra194]
      [   19.309752]  platform_probe+0x90/0xd8
      ...
    
      [   19.311457] kfence-#115: 0x00000000063a155a-0x00000000ba698da8, size=1072, cache=kmalloc-2k
    
      [   19.311469] allocated by task 96 on cpu 10 at 19.279323s:
      [   19.311562]  __kmem_cache_alloc_node+0x260/0x278
      [   19.311571]  kmalloc_trace+0x24/0x30
      [   19.311580]  pci_alloc_bus+0x24/0xa0
      [   19.311590]  pci_register_host_bridge+0x48/0x4b8
      [   19.311601]  pci_scan_root_bus_bridge+0xc0/0xe8
      [   19.311613]  pci_host_probe+0x18/0xc0
      [   19.311623]  dw_pcie_host_init+0x2c0/0x568
      [   19.311630]  tegra_pcie_dw_probe+0x610/0xb28 [pcie_tegra194]
      [   19.311647]  platform_probe+0x90/0xd8
      ...
    
      [   19.311782] freed by task 96 on cpu 10 at 19.285833s:
      [   19.311799]  release_pcibus_dev+0x30/0x40
      [   19.311808]  device_release+0x30/0x90
      [   19.311814]  kobject_put+0xa8/0x120
      [   19.311832]  device_unregister+0x20/0x30
      [   19.311839]  pci_remove_bus+0x78/0x88
      [   19.311850]  pci_remove_root_bus+0x5c/0x98
      [   19.311860]  dw_pcie_host_deinit+0x28/0x78
      [   19.311866]  tegra_pcie_deinit_controller+0x1c/0x38 [pcie_tegra194]
      [   19.311883]  tegra_pcie_dw_probe+0x648/0xb28 [pcie_tegra194]
      [   19.311900]  platform_probe+0x90/0xd8
      ...
    
      [   19.313579] CPU: 10 PID: 96 Comm: kworker/u24:2 Not tainted 6.2.0 #4
      [   19.320171] Hardware name:  /, BIOS 1.0-d7fb19b 08/10/2022
      [   19.325852] Workqueue: events_unbound deferred_probe_work_func
    
    The stack trace is a bit misleading as dw_pcie_host_deinit() doesn't
    directly call pci_bus_release_domain_nr(). The issue turns out to be in
    pci_remove_root_bus() which first calls pci_remove_bus() which frees the
    struct pci_bus when its struct device is released. Then
    pci_bus_release_domain_nr() is called and accesses the freed struct
    pci_bus. Reordering these fixes the issue.
    
    Fixes: c14f7ccc9f5d ("PCI: Assign PCI domain IDs by ida_alloc()")
    Link: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Reported-by: Jon Hunter <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Signed-off-by: Rob Herring <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>
    Cc: [email protected]      # v6.2+
    Cc: Pali Rohár <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: Release resource invalidated by coalescing [+ + +]
Author: Ross Lagerwall <[email protected]>
Date:   Thu May 25 16:32:48 2023 +0100

    PCI: Release resource invalidated by coalescing
    
    commit e54223275ba1bc6f704a6bab015fcd2ae4f72572 upstream.
    
    When contiguous windows are coalesced by pci_register_host_bridge(), the
    second resource is expanded to include the first, and the first is
    invalidated and consequently not added to the bus. However, it remains in
    the resource hierarchy.  For example, these windows:
    
      fec00000-fec7ffff : PCI Bus 0000:00
      fec80000-fecbffff : PCI Bus 0000:00
    
    are coalesced into this, where the first resource remains in the tree with
    start/end zeroed out:
    
      00000000-00000000 : PCI Bus 0000:00
      fec00000-fecbffff : PCI Bus 0000:00
    
    In some cases (e.g. the Xen scratch region), this causes future calls to
    allocate_resource() to choose an inappropriate location which the caller
    cannot handle.
    
    Fix by releasing the zeroed-out resource and removing it from the resource
    hierarchy.
    
    [bhelgaas: commit log]
    Fixes: 7c3855c423b1 ("PCI: Coalesce host bridge contiguous apertures")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ross Lagerwall <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Cc: [email protected]      # v5.16+
    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]>

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

 
phonet/pep: fix racy skb_queue_empty() use [+ + +]
Author: Rémi Denis-Courmont <[email protected]>
Date:   Mon Apr 14 11:50:20 2025 -0700

    phonet/pep: fix racy skb_queue_empty() use
    
    [ Upstream commit 7d2a894d7f487dcb894df023e9d3014cf5b93fe5 ]
    
    The receive queues are protected by their respective spin-lock, not
    the socket lock. This could lead to skb_peek() unexpectedly
    returning NULL or a pointer to an already dequeued socket buffer.
    
    Fixes: 9641458d3ec4 ("Phonet: Pipe End Point for Phonet Pipes protocol")
    Signed-off-by: Rémi Denis-Courmont <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    [Harshit: backport to 5.15.y, clean cherrypick from 6.1.y commit]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
phy: tegra: xusb: Fix return value of tegra_xusb_find_port_node function [+ + +]
Author: Miaoqian Lin <[email protected]>
Date:   Mon Dec 13 02:05:07 2021 +0000

    phy: tegra: xusb: Fix return value of tegra_xusb_find_port_node function
    
    commit 045a31b95509c8f25f5f04ec5e0dec5cd09f2c5f upstream.
    
    callers of tegra_xusb_find_port_node() function only do NULL checking for
    the return value. return NULL instead of ERR_PTR(-ENOMEM) to keep
    consistent.
    
    Signed-off-by: Miaoqian Lin <[email protected]>
    Acked-by: Thierry Reding <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Alva Lan <[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]>

 
pmdomain: ti: Add a null pointer check to the omap_prm_domain_init [+ + +]
Author: Kunwu Chan <[email protected]>
Date:   Thu Jan 18 13:42:57 2024 +0800

    pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
    
    commit 5d7f58ee08434a33340f75ac7ac5071eea9673b3 upstream.
    
    devm_kasprintf() returns a pointer to dynamically allocated memory
    which can be NULL upon failure. Ensure the allocation was successful
    by checking the pointer validity.
    
    Signed-off-by: Kunwu Chan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[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]>

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

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

pwm: rcar: Simplify multiplication/shift logic [+ + +]
Author: Geert Uytterhoeven <[email protected]>
Date:   Mon Feb 21 17:28:16 2022 +0100

    pwm: rcar: Simplify multiplication/shift logic
    
    [ Upstream commit ed14d36498c8d15be098df4af9ca324f96e9de74 ]
    
    - Remove the superfluous cast; the multiplication will yield a 64-bit
        result due to the "100ULL" anyway,
      - "a * (1 << b)" == "a << b".
    
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Reviewed-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Stable-dep-of: e7327c193014 ("pwm: rcar: Improve register calculation")
    Signed-off-by: Sasha Levin <[email protected]>

 
qibfs: fix _another_ leak [+ + +]
Author: Al Viro <[email protected]>
Date:   Mon May 13 17:50:34 2024 -0600

    qibfs: fix _another_ leak
    
    [ Upstream commit bdb43af4fdb39f844ede401bdb1258f67a580a27 ]
    
    failure to allocate inode => leaked dentry...
    
    this one had been there since the initial merge; to be fair,
    if we are that far OOM, the odds of failing at that particular
    allocation are low...
    
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Sasha Levin <[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 "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 "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]>

 
s390/sclp: Add check for get_zeroed_page() [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Tue Feb 18 10:52:16 2025 +0800

    s390/sclp: Add check for get_zeroed_page()
    
    [ Upstream commit 3db42c75a921854a99db0a2775814fef97415bac ]
    
    Add check for the return value of get_zeroed_page() in
    sclp_console_init() to prevent null pointer dereference.
    Furthermore, to solve the memory leak caused by the loop
    allocation, add a free helper to do the free job.
    
    Signed-off-by: Haoxiang Li <[email protected]>
    Acked-by: Heiko Carstens <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
s390/tty: Fix a potential memory leak bug [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Tue Feb 18 11:41:04 2025 +0800

    s390/tty: Fix a potential memory leak bug
    
    [ Upstream commit ad9bb8f049717d64c5e62b2a44954be9f681c65b ]
    
    The check for get_zeroed_page() leads to a direct return
    and overlooked the memory leak caused by loop allocation.
    Add a free helper to free spaces allocated by get_zeroed_page().
    
    Signed-off-by: Haoxiang Li <[email protected]>
    Acked-by: Heiko Carstens <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP [+ + +]
Author: Oleg Nesterov <[email protected]>
Date:   Sun Mar 30 15:49:55 2025 +0200

    sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP
    
    [ Upstream commit 975776841e689dd8ba36df9fa72ac3eca3c2957a ]
    
    kernel/sched/isolation.c obviously makes no sense without CONFIG_SMP, but
    the Kconfig entry we have right now:
    
            config CPU_ISOLATION
                    bool "CPU isolation"
                    depends on SMP || COMPILE_TEST
    
    allows the creation of pointless .config's which cause
    build failures.
    
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Sasha Levin <[email protected]>

 
sched/task_stack: fix object_is_on_stack() for KASAN tagged pointers [+ + +]
Author: Qun-Wei Lin <[email protected]>
Date:   Wed Nov 13 12:25:43 2024 +0800

    sched/task_stack: fix object_is_on_stack() for KASAN tagged pointers
    
    commit fd7b4f9f46d46acbc7af3a439bb0d869efdc5c58 upstream.
    
    When CONFIG_KASAN_SW_TAGS and CONFIG_KASAN_STACK are enabled, the
    object_is_on_stack() function may produce incorrect results due to the
    presence of tags in the obj pointer, while the stack pointer does not have
    tags.  This discrepancy can lead to incorrect stack object detection and
    subsequently trigger warnings if CONFIG_DEBUG_OBJECTS is also enabled.
    
    Example of the warning:
    
    ODEBUG: object 3eff800082ea7bb0 is NOT on stack ffff800082ea0000, but annotated.
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at lib/debugobjects.c:557 __debug_object_init+0x330/0x364
    Modules linked in:
    CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc5 #4
    Hardware name: linux,dummy-virt (DT)
    pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : __debug_object_init+0x330/0x364
    lr : __debug_object_init+0x330/0x364
    sp : ffff800082ea7b40
    x29: ffff800082ea7b40 x28: 98ff0000c0164518 x27: 98ff0000c0164534
    x26: ffff800082d93ec8 x25: 0000000000000001 x24: 1cff0000c00172a0
    x23: 0000000000000000 x22: ffff800082d93ed0 x21: ffff800081a24418
    x20: 3eff800082ea7bb0 x19: efff800000000000 x18: 0000000000000000
    x17: 00000000000000ff x16: 0000000000000047 x15: 206b63617473206e
    x14: 0000000000000018 x13: ffff800082ea7780 x12: 0ffff800082ea78e
    x11: 0ffff800082ea790 x10: 0ffff800082ea79d x9 : 34d77febe173e800
    x8 : 34d77febe173e800 x7 : 0000000000000001 x6 : 0000000000000001
    x5 : feff800082ea74b8 x4 : ffff800082870a90 x3 : ffff80008018d3c4
    x2 : 0000000000000001 x1 : ffff800082858810 x0 : 0000000000000050
    Call trace:
     __debug_object_init+0x330/0x364
     debug_object_init_on_stack+0x30/0x3c
     schedule_hrtimeout_range_clock+0xac/0x26c
     schedule_hrtimeout+0x1c/0x30
     wait_task_inactive+0x1d4/0x25c
     kthread_bind_mask+0x28/0x98
     init_rescuer+0x1e8/0x280
     workqueue_init+0x1a0/0x3cc
     kernel_init_freeable+0x118/0x200
     kernel_init+0x28/0x1f0
     ret_from_fork+0x10/0x20
    ---[ end trace 0000000000000000 ]---
    ODEBUG: object 3eff800082ea7bb0 is NOT on stack ffff800082ea0000, but annotated.
    ------------[ cut here ]------------
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Qun-Wei Lin <[email protected]>
    Cc: Andrew Yang <[email protected]>
    Cc: AngeloGioacchino Del Regno <[email protected]>
    Cc: Casper Li <[email protected]>
    Cc: Catalin Marinas <[email protected]>
    Cc: Chinwen Chang <[email protected]>
    Cc: Kent Overstreet <[email protected]>
    Cc: Matthias Brugger <[email protected]>
    Cc: Pasha Tatashin <[email protected]>
    Cc: Shakeel Butt <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    [Minor context change fixed]
    Signed-off-by: Zhi Yang <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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: hisi_sas: Factor out task prep and delivery code [+ + +]
Author: John Garry <[email protected]>
Date:   Wed Dec 15 22:37:37 2021 +0800

    scsi: hisi_sas: Factor out task prep and delivery code
    
    [ Upstream commit dc313f6b125b095d3d2683d94d5f69c8dc9bdc36 ]
    
    The task prep code is the same between the normal path (in
    hisi_sas_task_prep()) and the internal abort path, so factor is out into a
    common function.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes [+ + +]
Author: Xingui Yang <[email protected]>
Date:   Wed Mar 12 17:51:35 2025 +0800

    scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
    
    [ Upstream commit daff37f00c7506ca322ccfce95d342022f06ec58 ]
    
    The hw port ID of phy may change when inserting disks in batches, causing
    the port ID in hisi_sas_port and itct to be inconsistent with the hardware,
    resulting in I/O errors. The solution is to set the device state to gone to
    intercept I/O sent to the device, and then execute linkreset to discard and
    find the disk to re-update its information.
    
    Signed-off-by: Xingui Yang <[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: hisi_sas: Fix setting of hisi_sas_slot.is_internal [+ + +]
Author: John Garry <[email protected]>
Date:   Mon Jan 31 19:13:27 2022 +0800

    scsi: hisi_sas: Fix setting of hisi_sas_slot.is_internal
    
    [ Upstream commit c763ec4c10f78678d6d4415646237f07109a5a5f ]
    
    The hisi_sas_slot.is_internal member is not set properly for ATA commands
    which the driver sends directly. A TMF struct pointer is normally used as a
    test to set this, but it is NULL for those commands. It's not ideal, but
    pass an empty TMF struct to set that member properly.
    
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: dc313f6b125b ("scsi: hisi_sas: Factor out task prep and delivery code")
    Reported-by: Xiang Chen <[email protected]>
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: hisi_sas: Pass abort structure for internal abort [+ + +]
Author: John Garry <[email protected]>
Date:   Wed Dec 15 22:37:36 2021 +0800

    scsi: hisi_sas: Pass abort structure for internal abort
    
    [ Upstream commit 08c61b5d902b70180b517e9f2616ad70b7a98dcf ]
    
    To help factor out code in future, it's useful to know if we're executing
    an internal abort, so pass a pointer to the structure. The idea is that a
    NULL pointer means not an internal abort.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Xiang Chen <[email protected]>
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: hisi_sas: Start delivery hisi_sas_task_exec() directly [+ + +]
Author: John Garry <[email protected]>
Date:   Wed Dec 15 22:37:34 2021 +0800

    scsi: hisi_sas: Start delivery hisi_sas_task_exec() directly
    
    [ Upstream commit 0e4620856b89335426a17904933a92346ee4599d ]
    
    Currently we start delivery of commands to the DQ after returning from
    hisi_sas_task_exec() with success.
    
    Let's just start delivery directly in that function without having to check
    if some local variable is set.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Xiang Chen <[email protected]>
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    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: libsas: Add struct sas_tmf_task [+ + +]
Author: John Garry <[email protected]>
Date:   Thu Feb 17 23:42:35 2022 +0800

    scsi: libsas: Add struct sas_tmf_task
    
    [ Upstream commit bbfe82cdbaf84e6622ceb6f3447c8c4bb7dde7ab ]
    
    Some of the LLDDs which use libsas have their own definition of a struct
    to hold TMF info, so add a common struct for libsas.
    
    Also add an interim force phy id field for hisi_sas driver, which will be
    removed once the STP "TMF" code is factored out.
    
    Even though some LLDDs (pm8001) use a u32 for the tag, u16 will be adequate,
    as that named driver only uses tags in range [0, 1024).
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Yihang Li <[email protected]>
    Tested-by: Damien Le Moal <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: libsas: Delete lldd_clear_aca callback [+ + +]
Author: John Garry <[email protected]>
Date:   Thu Feb 17 23:42:31 2022 +0800

    scsi: libsas: Delete lldd_clear_aca callback
    
    [ Upstream commit 25882c82f850e3e972a973e0af310b3e58de38fd ]
    
    This callback is never called, so remove support.
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Yihang Li <[email protected]>
    Tested-by: Damien Le Moal <[email protected]>
    Reviewed-by: Jack Wang <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Xiang Chen <[email protected]>
    Signed-off-by: John Garry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8aa580cd9284 ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan() [+ + +]
Author: Tuo Li <[email protected]>
Date:   Fri Jun 30 10:47:48 2023 +0800

    scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan()
    
    commit 0e881c0a4b6146b7e856735226208f48251facd8 upstream.
    
    The variable phba->fcf.fcf_flag is often protected by the lock
    phba->hbalock() when is accessed. Here is an example in
    lpfc_unregister_fcf_rescan():
    
      spin_lock_irq(&phba->hbalock);
      phba->fcf.fcf_flag |= FCF_INIT_DISC;
      spin_unlock_irq(&phba->hbalock);
    
    However, in the same function, phba->fcf.fcf_flag is assigned with 0
    without holding the lock, and thus can cause a data race:
    
      phba->fcf.fcf_flag = 0;
    
    To fix this possible data race, a lock and unlock pair is added when
    accessing the variable phba->fcf.fcf_flag.
    
    Reported-by: BassCheck <[email protected]>
    Signed-off-by: Tuo Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Justin Tee <[email protected]>
    Reviewed-by: Laurence Oberman <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Bin Lan <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI [+ + +]
Author: James Smart <[email protected]>
Date:   Tue Apr 12 15:19:50 2022 -0700

    scsi: lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI
    
    commit 577a942df3de2666f6947bdd3a5c9e8d30073424 upstream.
    
    If lpfc_issue_els_flogi() fails and returns non-zero status, the node
    reference count is decremented to trigger the release of the nodelist
    structure. However, if there is a prior registration or dev-loss-evt work
    pending, the node may be released prematurely.  When dev-loss-evt
    completes, the released node is referenced causing a use-after-free null
    pointer dereference.
    
    Similarly, when processing non-zero ELS PLOGI completion status in
    lpfc_cmpl_els_plogi(), the ndlp flags are checked for a transport
    registration before triggering node removal.  If dev-loss-evt work is
    pending, the node may be released prematurely and a subsequent call to
    lpfc_dev_loss_tmo_handler() results in a use after free ndlp dereference.
    
    Add test for pending dev-loss before decrementing the node reference count
    for FLOGI, PLOGI, PRLI, and ADISC handling.
    
    Link: https://lore.kernel.org/r/[email protected]
    Co-developed-by: Justin Tee <[email protected]>
    Signed-off-by: Justin Tee <[email protected]>
    Signed-off-by: James Smart <[email protected]>
    Signed-off-by: Martin K. Petersen <[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]>

scsi: pm80xx: Set phy_attached to zero when device is gone [+ + +]
Author: Igor Pylypiv <[email protected]>
Date:   Wed Mar 19 23:03:05 2025 +0000

    scsi: pm80xx: Set phy_attached to zero when device is gone
    
    [ Upstream commit f7b705c238d1483f0a766e2b20010f176e5c0fb7 ]
    
    When a fatal error occurs, a phy down event may not be received to set
    phy->phy_attached to zero.
    
    Signed-off-by: Igor Pylypiv <[email protected]>
    Signed-off-by: Salomon Dushimirimana <[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: 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: ufs: bsg: Set bsg_queue to NULL after removal [+ + +]
Author: Guixin Liu <[email protected]>
Date:   Wed Dec 18 09:42:14 2024 +0800

    scsi: ufs: bsg: Set bsg_queue to NULL after removal
    
    commit 1e95c798d8a7f70965f0f88d4657b682ff0ec75f upstream.
    
    Currently, this does not cause any issues, but I believe it is necessary to
    set bsg_queue to NULL after removing it to prevent potential use-after-free
    (UAF) access.
    
    Signed-off-by: Guixin Liu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Avri Altman <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[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/mincore: Allow read-ahead pages to reach the end of the file [+ + +]
Author: Qiuxu Zhuo <[email protected]>
Date:   Tue Mar 11 16:09:40 2025 +0800

    selftests/mincore: Allow read-ahead pages to reach the end of the file
    
    [ Upstream commit 197c1eaa7ba633a482ed7588eea6fd4aa57e08d4 ]
    
    When running the mincore_selftest on a system with an XFS file system, it
    failed the "check_file_mmap" test case due to the read-ahead pages reaching
    the end of the file. The failure log is as below:
    
       RUN           global.check_file_mmap ...
      mincore_selftest.c:264:check_file_mmap:Expected i (1024) < vec_size (1024)
      mincore_selftest.c:265:check_file_mmap:Read-ahead pages reached the end of the file
      check_file_mmap: Test failed
               FAIL  global.check_file_mmap
    
    This is because the read-ahead window size of the XFS file system on this
    machine is 4 MB, which is larger than the size from the #PF address to the
    end of the file. As a result, all the pages for this file are populated.
    
      blockdev --getra /dev/nvme0n1p5
        8192
      blockdev --getbsz /dev/nvme0n1p5
        512
    
    This issue can be fixed by extending the current FILE_SIZE 4MB to a larger
    number, but it will still fail if the read-ahead window size of the file
    system is larger enough. Additionally, in the real world, read-ahead pages
    reaching the end of the file can happen and is an expected behavior.
    Therefore, allowing read-ahead pages to reach the end of the file is a
    better choice for the "check_file_mmap" test case.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reported-by: Yi Lai <[email protected]>
    Signed-off-by: Qiuxu Zhuo <[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
    
    [ Upstream commit 9c02223e2d9df5cb37c51aedb78f3960294e09b5 ]
    
    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: Sasha Levin <[email protected]>

 
selftests: ublk: fix test_stripe_04 [+ + +]
Author: Ming Lei <[email protected]>
Date:   Fri Apr 4 08:18:49 2025 +0800

    selftests: ublk: fix test_stripe_04
    
    [ Upstream commit 72070e57b0a518ec8e562a2b68fdfc796ef5c040 ]
    
    Commit 57ed58c13256 ("selftests: ublk: enable zero copy for stripe target")
    added test entry of test_stripe_04, but forgot to add the test script.
    
    So fix the test by adding the script file.
    
    Reported-by: Uday Shankar <[email protected]>
    Signed-off-by: Ming Lei <[email protected]>
    Reviewed-by: Uday Shankar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
serial: sifive: lock port in startup()/shutdown() callbacks [+ + +]
Author: Ryo Takakura <[email protected]>
Date:   Sat Apr 12 09:18:47 2025 +0900

    serial: sifive: lock port in startup()/shutdown() callbacks
    
    commit e1ca3ff28ab1e2c1e70713ef3fa7943c725742c3 upstream.
    
    startup()/shutdown() callbacks access SIFIVE_SERIAL_IE_OFFS.
    The register is also accessed from write() callback.
    
    If console were printing and startup()/shutdown() callback
    gets called, its access to the register could be overwritten.
    
    Add port->lock to startup()/shutdown() callbacks to make sure
    their access to SIFIVE_SERIAL_IE_OFFS is synchronized against
    write() callback.
    
    Fixes: 45c054d0815b ("tty: serial: add driver for the SiFive UART")
    Signed-off-by: Ryo Takakura <[email protected]>
    Reviewed-by: Petr Mladek <[email protected]>
    Cc: [email protected]
    Reviewed-by: John Ogness <[email protected]>
    Rule: add
    Link: https://lore.kernel.org/stable/20250330003522.386632-1-ryotkkr98%40gmail.com
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smb/server: fix potential null-ptr-deref of lease_ctx_info in smb2_open() [+ + +]
Author: ChenXiaoSong <[email protected]>
Date:   Thu Aug 22 08:20:51 2024 +0000

    smb/server: fix potential null-ptr-deref of lease_ctx_info in smb2_open()
    
    commit 4e8771a3666c8f216eefd6bd2fd50121c6c437db upstream.
    
    null-ptr-deref will occur when (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
    and parse_lease_state() return NULL.
    
    Fix this by check if 'lease_ctx_info' is NULL.
    
    Additionally, remove the redundant parentheses in
    parse_durable_handle_context().
    
    Signed-off-by: ChenXiaoSong <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [ Drop the parentheses clean-up since the parentheses was introduced by
      c8efcc786146 ("ksmbd: add support for durable handles v1/v2") in v6.9
      Minor context change fixed ]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smb: client: fix NULL ptr deref in crypto_aead_setkey() [+ + +]
Author: Paulo Alcantara <[email protected]>
Date:   Mon Nov 25 17:17:23 2024 -0300

    smb: client: fix NULL ptr deref in crypto_aead_setkey()
    
    commit 4bdec0d1f658f7c98749bd2c5a486e6cfa8565d2 upstream.
    
    Neither SMB3.0 or SMB3.02 supports encryption negotiate context, so
    when SMB2_GLOBAL_CAP_ENCRYPTION flag is set in the negotiate response,
    the client uses AES-128-CCM as the default cipher.  See MS-SMB2
    3.3.5.4.
    
    Commit b0abcd65ec54 ("smb: client: fix UAF in async decryption") added
    a @server->cipher_type check to conditionally call
    smb3_crypto_aead_allocate(), but that check would always be false as
    @server->cipher_type is unset for SMB3.02.
    
    Fix the following KASAN splat by setting @server->cipher_type for
    SMB3.02 as well.
    
    mount.cifs //srv/share /mnt -o vers=3.02,seal,...
    
    BUG: KASAN: null-ptr-deref in crypto_aead_setkey+0x2c/0x130
    Read of size 8 at addr 0000000000000020 by task mount.cifs/1095
    CPU: 1 UID: 0 PID: 1095 Comm: mount.cifs Not tainted 6.12.0 #1
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-3.fc41
    04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x5d/0x80
     ? crypto_aead_setkey+0x2c/0x130
     kasan_report+0xda/0x110
     ? crypto_aead_setkey+0x2c/0x130
     crypto_aead_setkey+0x2c/0x130
     crypt_message+0x258/0xec0 [cifs]
     ? __asan_memset+0x23/0x50
     ? __pfx_crypt_message+0x10/0x10 [cifs]
     ? mark_lock+0xb0/0x6a0
     ? hlock_class+0x32/0xb0
     ? mark_lock+0xb0/0x6a0
     smb3_init_transform_rq+0x352/0x3f0 [cifs]
     ? lock_acquire.part.0+0xf4/0x2a0
     smb_send_rqst+0x144/0x230 [cifs]
     ? __pfx_smb_send_rqst+0x10/0x10 [cifs]
     ? hlock_class+0x32/0xb0
     ? smb2_setup_request+0x225/0x3a0 [cifs]
     ? __pfx_cifs_compound_last_callback+0x10/0x10 [cifs]
     compound_send_recv+0x59b/0x1140 [cifs]
     ? __pfx_compound_send_recv+0x10/0x10 [cifs]
     ? __create_object+0x5e/0x90
     ? hlock_class+0x32/0xb0
     ? do_raw_spin_unlock+0x9a/0xf0
     cifs_send_recv+0x23/0x30 [cifs]
     SMB2_tcon+0x3ec/0xb30 [cifs]
     ? __pfx_SMB2_tcon+0x10/0x10 [cifs]
     ? lock_acquire.part.0+0xf4/0x2a0
     ? __pfx_lock_release+0x10/0x10
     ? do_raw_spin_trylock+0xc6/0x120
     ? lock_acquire+0x3f/0x90
     ? _get_xid+0x16/0xd0 [cifs]
     ? __pfx_SMB2_tcon+0x10/0x10 [cifs]
     ? cifs_get_smb_ses+0xcdd/0x10a0 [cifs]
     cifs_get_smb_ses+0xcdd/0x10a0 [cifs]
     ? __pfx_cifs_get_smb_ses+0x10/0x10 [cifs]
     ? cifs_get_tcp_session+0xaa0/0xca0 [cifs]
     cifs_mount_get_session+0x8a/0x210 [cifs]
     dfs_mount_share+0x1b0/0x11d0 [cifs]
     ? __pfx___lock_acquire+0x10/0x10
     ? __pfx_dfs_mount_share+0x10/0x10 [cifs]
     ? lock_acquire.part.0+0xf4/0x2a0
     ? find_held_lock+0x8a/0xa0
     ? hlock_class+0x32/0xb0
     ? lock_release+0x203/0x5d0
     cifs_mount+0xb3/0x3d0 [cifs]
     ? do_raw_spin_trylock+0xc6/0x120
     ? __pfx_cifs_mount+0x10/0x10 [cifs]
     ? lock_acquire+0x3f/0x90
     ? find_nls+0x16/0xa0
     ? smb3_update_mnt_flags+0x372/0x3b0 [cifs]
     cifs_smb3_do_mount+0x1e2/0xc80 [cifs]
     ? __pfx_vfs_parse_fs_string+0x10/0x10
     ? __pfx_cifs_smb3_do_mount+0x10/0x10 [cifs]
     smb3_get_tree+0x1bf/0x330 [cifs]
     vfs_get_tree+0x4a/0x160
     path_mount+0x3c1/0xfb0
     ? kasan_quarantine_put+0xc7/0x1d0
     ? __pfx_path_mount+0x10/0x10
     ? kmem_cache_free+0x118/0x3e0
     ? user_path_at+0x74/0xa0
     __x64_sys_mount+0x1a6/0x1e0
     ? __pfx___x64_sys_mount+0x10/0x10
     ? mark_held_locks+0x1a/0x90
     do_syscall_64+0xbb/0x1d0
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Cc: Tom Talpey <[email protected]>
    Reported-by: Jianhong Yin <[email protected]>
    Cc: [email protected] # v6.12
    Fixes: b0abcd65ec54 ("smb: client: fix UAF in async decryption")
    Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [Commit b0abcd65ec54 ("smb: client: fix UAF in async decryption")
    fixes CVE-2024-50047 but brings NULL-pointer dereferebce. So
    commit 4bdec0d1f658 ("smb: client: fix NULL ptr deref in crypto_aead_setkey()")
    should be backported too.]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

smb: client: fix potential deadlock when releasing mids [+ + +]
Author: Paulo Alcantara <[email protected]>
Date:   Wed Oct 25 14:58:35 2023 -0300

    smb: client: fix potential deadlock when releasing mids
    
    commit e6322fd177c6885a21dd4609dc5e5c973d1a2eb7 upstream.
    
    All release_mid() callers seem to hold a reference of @mid so there is
    no need to call kref_put(&mid->refcount, __release_mid) under
    @server->mid_lock spinlock.  If they don't, then an use-after-free bug
    would have occurred anyways.
    
    By getting rid of such spinlock also fixes a potential deadlock as
    shown below
    
    CPU 0                                CPU 1
    ------------------------------------------------------------------
    cifs_demultiplex_thread()            cifs_debug_data_proc_show()
     release_mid()
      spin_lock(&server->mid_lock);
                                         spin_lock(&cifs_tcp_ses_lock)
                                          spin_lock(&server->mid_lock)
      __release_mid()
       smb2_find_smb_tcon()
        spin_lock(&cifs_tcp_ses_lock) *deadlock*
    
    Cc: [email protected]
    Signed-off-by: Paulo Alcantara (SUSE) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [cifs_mid_q_entry_release() is renamed to release_mid() and
     _cifs_mid_q_entry_release() is renamed to __release_mid() by
     commit 70f08f914a37 ("cifs: remove useless DeleteMidQEntry()")
     which is integrated into v6.0, so preserve old names in v5.15.]
    Signed-off-by: Cliff Liu <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

smb: client: fix potential UAF in cifs_dump_full_key() [+ + +]
Author: Paulo Alcantara <[email protected]>
Date:   Tue Apr 2 16:33:54 2024 -0300

    smb: client: fix potential UAF in cifs_dump_full_key()
    
    commit 58acd1f497162e7d282077f816faa519487be045 upstream.
    
    Skip sessions that are being teared down (status == SES_EXITING) to
    avoid UAF.
    
    Cc: [email protected]
    Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [ This patch removes lock/unlock operation in routine cifs_dump_full_key()
      for ses_lock is not present in v5.15 and not ported yet. ses->status
      is protected by a global lock, cifs_tcp_ses_lock, in v5.15.  ]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

smb: client: fix potential UAF in cifs_stats_proc_show() [+ + +]
Author: Paulo Alcantara <[email protected]>
Date:   Tue Apr 2 16:33:56 2024 -0300

    smb: client: fix potential UAF in cifs_stats_proc_show()
    
    commit 0865ffefea197b437ba78b5dd8d8e256253efd65 upstream.
    
    Skip sessions that are being teared down (status == SES_EXITING) to
    avoid UAF.
    
    Cc: [email protected]
    Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [ cifs_debug.c was moved from fs/cifs to fs/smb/client since
      38c8a9a52082 ("smb: move client and server files to common directory fs/smb").
      The cifs_ses_exiting() was introduced to cifs_debug.c since
      ca545b7f0823 ("smb: client: fix potential UAF in cifs_debug_files_proc_show()")
      which has been sent to upstream already. ]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

smb: client: fix UAF in async decryption [+ + +]
Author: Enzo Matsumiya <[email protected]>
Date:   Thu Sep 26 14:46:13 2024 -0300

    smb: client: fix UAF in async decryption
    
    commit b0abcd65ec545701b8793e12bc27dc98042b151a upstream.
    
    Doing an async decryption (large read) crashes with a
    slab-use-after-free way down in the crypto API.
    
    Reproducer:
        # mount.cifs -o ...,seal,esize=1 //srv/share /mnt
        # dd if=/mnt/largefile of=/dev/null
        ...
        [  194.196391] ==================================================================
        [  194.196844] BUG: KASAN: slab-use-after-free in gf128mul_4k_lle+0xc1/0x110
        [  194.197269] Read of size 8 at addr ffff888112bd0448 by task kworker/u77:2/899
        [  194.197707]
        [  194.197818] CPU: 12 UID: 0 PID: 899 Comm: kworker/u77:2 Not tainted 6.11.0-lku-00028-gfca3ca14a17a-dirty #43
        [  194.198400] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-3-gd478f380-prebuilt.qemu.org 04/01/2014
        [  194.199046] Workqueue: smb3decryptd smb2_decrypt_offload [cifs]
        [  194.200032] Call Trace:
        [  194.200191]  <TASK>
        [  194.200327]  dump_stack_lvl+0x4e/0x70
        [  194.200558]  ? gf128mul_4k_lle+0xc1/0x110
        [  194.200809]  print_report+0x174/0x505
        [  194.201040]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
        [  194.201352]  ? srso_return_thunk+0x5/0x5f
        [  194.201604]  ? __virt_addr_valid+0xdf/0x1c0
        [  194.201868]  ? gf128mul_4k_lle+0xc1/0x110
        [  194.202128]  kasan_report+0xc8/0x150
        [  194.202361]  ? gf128mul_4k_lle+0xc1/0x110
        [  194.202616]  gf128mul_4k_lle+0xc1/0x110
        [  194.202863]  ghash_update+0x184/0x210
        [  194.203103]  shash_ahash_update+0x184/0x2a0
        [  194.203377]  ? __pfx_shash_ahash_update+0x10/0x10
        [  194.203651]  ? srso_return_thunk+0x5/0x5f
        [  194.203877]  ? crypto_gcm_init_common+0x1ba/0x340
        [  194.204142]  gcm_hash_assoc_remain_continue+0x10a/0x140
        [  194.204434]  crypt_message+0xec1/0x10a0 [cifs]
        [  194.206489]  ? __pfx_crypt_message+0x10/0x10 [cifs]
        [  194.208507]  ? srso_return_thunk+0x5/0x5f
        [  194.209205]  ? srso_return_thunk+0x5/0x5f
        [  194.209925]  ? srso_return_thunk+0x5/0x5f
        [  194.210443]  ? srso_return_thunk+0x5/0x5f
        [  194.211037]  decrypt_raw_data+0x15f/0x250 [cifs]
        [  194.212906]  ? __pfx_decrypt_raw_data+0x10/0x10 [cifs]
        [  194.214670]  ? srso_return_thunk+0x5/0x5f
        [  194.215193]  smb2_decrypt_offload+0x12a/0x6c0 [cifs]
    
    This is because TFM is being used in parallel.
    
    Fix this by allocating a new AEAD TFM for async decryption, but keep
    the existing one for synchronous READ cases (similar to what is done
    in smb3_calc_signature()).
    
    Also remove the calls to aead_request_set_callback() and
    crypto_wait_req() since it's always going to be a synchronous operation.
    
    Signed-off-by: Enzo Matsumiya <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [In linux-5.15, dec and enc fields are named ccmaesdecrypt and ccmaesencrypt.]
    Signed-off-by: Jianqi Ren <[email protected]>
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

smb: client: fix use-after-free bug in cifs_debug_data_proc_show() [+ + +]
Author: Paulo Alcantara <[email protected]>
Date:   Tue Oct 24 13:49:15 2023 -0300

    smb: client: fix use-after-free bug in cifs_debug_data_proc_show()
    
    commit d328c09ee9f15ee5a26431f5aad7c9239fa85e62 upstream.
    
    Skip SMB sessions that are being teared down
    (e.g. @ses->ses_status == SES_EXITING) in cifs_debug_data_proc_show()
    to avoid use-after-free in @ses.
    
    This fixes the following GPF when reading from /proc/fs/cifs/DebugData
    while mounting and umounting
    
      [ 816.251274] general protection fault, probably for non-canonical
      address 0x6b6b6b6b6b6b6d81: 0000 [#1] PREEMPT SMP NOPTI
      ...
      [  816.260138] Call Trace:
      [  816.260329]  <TASK>
      [  816.260499]  ? die_addr+0x36/0x90
      [  816.260762]  ? exc_general_protection+0x1b3/0x410
      [  816.261126]  ? asm_exc_general_protection+0x26/0x30
      [  816.261502]  ? cifs_debug_tcon+0xbd/0x240 [cifs]
      [  816.261878]  ? cifs_debug_tcon+0xab/0x240 [cifs]
      [  816.262249]  cifs_debug_data_proc_show+0x516/0xdb0 [cifs]
      [  816.262689]  ? seq_read_iter+0x379/0x470
      [  816.262995]  seq_read_iter+0x118/0x470
      [  816.263291]  proc_reg_read_iter+0x53/0x90
      [  816.263596]  ? srso_alias_return_thunk+0x5/0x7f
      [  816.263945]  vfs_read+0x201/0x350
      [  816.264211]  ksys_read+0x75/0x100
      [  816.264472]  do_syscall_64+0x3f/0x90
      [  816.264750]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [  816.265135] RIP: 0033:0x7fd5e669d381
    
    Cc: [email protected]
    Signed-off-by: Paulo Alcantara (SUSE) <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    [ This patch removed lock/unlock operation due to ses_lock is
    not present in v5.15 and not ported yet. ses->status is protected
    by a global lock, cifs_tcp_ses_lock, in v5.15. ]
    Signed-off-by: Xiangyu Chen <[email protected]>
    Signed-off-by: He Zhe <[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()
    
    [ Upstream commit c8222ef6cf29dd7cad21643228f96535cc02b327 ]
    
    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: Sasha Levin <[email protected]>

soc: samsung: exynos-chipid: avoid soc_device_to_device() [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Sun Sep 19 11:31:12 2021 +0200

    soc: samsung: exynos-chipid: avoid soc_device_to_device()
    
    [ Upstream commit d1141886c8d72ad77920e6e4b617d366e6e3ee8a ]
    
    soc_device_to_device() seems to be discouraged [1] so remove it in favor
    of printing info message with platform device.  This will only change
    the prefix in the info message from "soc soc0: " to "exynos-chipid
    10000000.chipid:".
    
    [1] https://lore.kernel.org/lkml/[email protected]/
    
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Reviewed-by: Sylwester Nawrocki <[email protected]>
    Tested-by: Sylwester Nawrocki <[email protected]>
    Reviewed-by: Alim Akhtar <[email protected]>
    Tested-by: Alim Akhtar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: c8222ef6cf29 ("soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()")
    Signed-off-by: Sasha Levin <[email protected]>

soc: samsung: exynos-chipid: Pass revision reg offsets [+ + +]
Author: Sam Protsenko <[email protected]>
Date:   Thu Oct 14 16:35:06 2021 +0300

    soc: samsung: exynos-chipid: Pass revision reg offsets
    
    [ Upstream commit c072c4ef7ef09e1d6470c48cf52570487589b76a ]
    
    Old Exynos SoCs have both Product ID and Revision ID in one single
    register, while new SoCs tend to have two separate registers for those
    IDs. Implement handling of both cases by passing Revision ID register
    offsets in driver data.
    
    Previously existing macros for Exynos4210 (removed in this patch) were
    incorrect:
    
        #define EXYNOS_SUBREV_MASK         (0xf << 4)
        #define EXYNOS_MAINREV_MASK        (0xf << 0)
    
    Actual format of PRO_ID register in Exynos4210 (offset 0x0):
    
        [31:12] Product ID
          [9:8] Package information
          [7:4] Main Revision Number
          [3:0] Sub Revision Number
    
    This patch doesn't change the behavior on existing platforms, so
    '/sys/devices/soc0/revision' will show the same string as before.
    
    Signed-off-by: Sam Protsenko <[email protected]>
    Tested-by: Henrik Grimler <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Stable-dep-of: c8222ef6cf29 ("soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()")
    Signed-off-by: Sasha Levin <[email protected]>

 
sound/virtio: Fix cancel_sync warnings on uninitialized work_structs [+ + +]
Author: John Stultz <[email protected]>
Date:   Thu Jan 16 11:40:59 2025 -0800

    sound/virtio: Fix cancel_sync warnings on uninitialized work_structs
    
    [ Upstream commit 3c7df2e27346eb40a0e86230db1ccab195c97cfe ]
    
    Betty reported hitting the following warning:
    
    [    8.709131][  T221] WARNING: CPU: 2 PID: 221 at kernel/workqueue.c:4182
    ...
    [    8.713282][  T221] Call trace:
    [    8.713365][  T221]  __flush_work+0x8d0/0x914
    [    8.713468][  T221]  __cancel_work_sync+0xac/0xfc
    [    8.713570][  T221]  cancel_work_sync+0x24/0x34
    [    8.713667][  T221]  virtsnd_remove+0xa8/0xf8 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276]
    [    8.713868][  T221]  virtsnd_probe+0x48c/0x664 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276]
    [    8.714035][  T221]  virtio_dev_probe+0x28c/0x390
    [    8.714139][  T221]  really_probe+0x1bc/0x4c8
    ...
    
    It seems we're hitting the error path in virtsnd_probe(), which
    triggers a virtsnd_remove() which iterates over the substreams
    calling cancel_work_sync() on the elapsed_period work_struct.
    
    Looking at the code, from earlier in:
    virtsnd_probe()->virtsnd_build_devs()->virtsnd_pcm_parse_cfg()
    
    We set snd->nsubstreams, allocate the snd->substreams, and if
    we then hit an error on the info allocation or something in
    virtsnd_ctl_query_info() fails, we will exit without having
    initialized the elapsed_period work_struct.
    
    When that error path unwinds we then call virtsnd_remove()
    which as long as the substreams array is allocated, will iterate
    through calling cancel_work_sync() on the uninitialized work
    struct hitting this warning.
    
    Takashi Iwai suggested this fix, which initializes the substreams
    structure right after allocation, so that if we hit the error
    paths we avoid trying to cleanup uninitialized data.
    
    Note: I have not yet managed to reproduce the issue myself, so
    this patch has had limited testing.
    
    Feedback or thoughts would be appreciated!
    
    Cc: Anton Yakovlev <[email protected]>
    Cc: "Michael S. Tsirkin" <[email protected]>
    Cc: Jaroslav Kysela <[email protected]>
    Cc: Takashi Iwai <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Reported-by: Betty Zhou <[email protected]>
    Suggested-by: Takashi Iwai <[email protected]>
    Signed-off-by: John Stultz <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Michael S. Tsirkin <[email protected]>
    Signed-off-by: Sasha Levin <[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()
    
    [ Upstream commit d94c12bd97d567de342fd32599e7cd9e50bfa140 ]
    
    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: 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]>

tipc: fix NULL pointer dereference in tipc_mon_reinit_self() [+ + +]
Author: Tung Nguyen <[email protected]>
Date:   Thu Apr 17 14:47:15 2025 +0700

    tipc: fix NULL pointer dereference in tipc_mon_reinit_self()
    
    [ Upstream commit d63527e109e811ef11abb1c2985048fdb528b4cb ]
    
    syzbot reported:
    
    tipc: Node number set to 1055423674
    Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
    KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
    CPU: 3 UID: 0 PID: 6017 Comm: kworker/3:5 Not tainted 6.15.0-rc1-syzkaller-00246-g900241a5cc15 #0 PREEMPT(full)
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
    Workqueue: events tipc_net_finalize_work
    RIP: 0010:tipc_mon_reinit_self+0x11c/0x210 net/tipc/monitor.c:719
    ...
    RSP: 0018:ffffc9000356fb68 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000003ee87cba
    RDX: 0000000000000000 RSI: ffffffff8dbc56a7 RDI: ffff88804c2cc010
    RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000007
    R13: fffffbfff2111097 R14: ffff88804ead8000 R15: ffff88804ead9010
    FS:  0000000000000000(0000) GS:ffff888097ab9000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000f720eb00 CR3: 000000000e182000 CR4: 0000000000352ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     tipc_net_finalize+0x10b/0x180 net/tipc/net.c:140
     process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
     process_scheduled_works kernel/workqueue.c:3319 [inline]
     worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
     kthread+0x3c2/0x780 kernel/kthread.c:464
     ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
     </TASK>
    ...
    RIP: 0010:tipc_mon_reinit_self+0x11c/0x210 net/tipc/monitor.c:719
    ...
    RSP: 0018:ffffc9000356fb68 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000003ee87cba
    RDX: 0000000000000000 RSI: ffffffff8dbc56a7 RDI: ffff88804c2cc010
    RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000007
    R13: fffffbfff2111097 R14: ffff88804ead8000 R15: ffff88804ead9010
    FS:  0000000000000000(0000) GS:ffff888097ab9000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000f720eb00 CR3: 000000000e182000 CR4: 0000000000352ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    
    There is a racing condition between workqueue created when enabling
    bearer and another thread created when disabling bearer right after
    that as follow:
    
    enabling_bearer                          | disabling_bearer
    ---------------                          | ----------------
    tipc_disc_timeout()                      |
    {                                        | bearer_disable()
     ...                                     | {
     schedule_work(&tn->work);               |  tipc_mon_delete()
     ...                                     |  {
    }                                        |   ...
                                             |   write_lock_bh(&mon->lock);
                                             |   mon->self = NULL;
                                             |   write_unlock_bh(&mon->lock);
                                             |   ...
                                             |  }
    tipc_net_finalize_work()                 | }
    {                                        |
     ...                                     |
     tipc_net_finalize()                     |
     {                                       |
      ...                                    |
      tipc_mon_reinit_self()                 |
      {                                      |
       ...                                   |
       write_lock_bh(&mon->lock);            |
       mon->self->addr = tipc_own_addr(net); |
       write_unlock_bh(&mon->lock);          |
       ...                                   |
      }                                      |
      ...                                    |
     }                                       |
     ...                                     |
    }                                        |
    
    'mon->self' is set to NULL in disabling_bearer thread and dereferenced
    later in enabling_bearer thread.
    
    This commit fixes this issue by validating 'mon->self' before assigning
    node address to it.
    
    Reported-by: [email protected]
    Fixes: 46cb01eeeb86 ("tipc: update mon's self addr when node addr generated")
    Signed-off-by: Tung Nguyen <[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]>

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

 
ubsan: Fix panic from test_ubsan_out_of_bounds [+ + +]
Author: Mostafa Saleh <[email protected]>
Date:   Tue Apr 15 20:33:54 2025 +0000

    ubsan: Fix panic from test_ubsan_out_of_bounds
    
    [ Upstream commit 9b044614be12d78d3a93767708b8d02fb7dfa9b0 ]
    
    Running lib_ubsan.ko on arm64 (without CONFIG_UBSAN_TRAP) panics the
    kernel:
    
    [   31.616546] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: test_ubsan_out_of_bounds+0x158/0x158 [test_ubsan]
    [   31.646817] CPU: 3 UID: 0 PID: 179 Comm: insmod Not tainted 6.15.0-rc2 #1 PREEMPT
    [   31.648153] Hardware name: linux,dummy-virt (DT)
    [   31.648970] Call trace:
    [   31.649345]  show_stack+0x18/0x24 (C)
    [   31.650960]  dump_stack_lvl+0x40/0x84
    [   31.651559]  dump_stack+0x18/0x24
    [   31.652264]  panic+0x138/0x3b4
    [   31.652812]  __ktime_get_real_seconds+0x0/0x10
    [   31.653540]  test_ubsan_load_invalid_value+0x0/0xa8 [test_ubsan]
    [   31.654388]  init_module+0x24/0xff4 [test_ubsan]
    [   31.655077]  do_one_initcall+0xd4/0x280
    [   31.655680]  do_init_module+0x58/0x2b4
    
    That happens because the test corrupts other data in the stack:
    400:   d5384108        mrs     x8, sp_el0
    404:   f9426d08        ldr     x8, [x8, #1240]
    408:   f85f83a9        ldur    x9, [x29, #-8]
    40c:   eb09011f        cmp     x8, x9
    410:   54000301        b.ne    470 <test_ubsan_out_of_bounds+0x154>  // b.any
    
    As there is no guarantee the compiler will order the local variables
    as declared in the module:
            volatile char above[4] = { }; /* Protect surrounding memory. */
            volatile int arr[4];
            volatile char below[4] = { }; /* Protect surrounding memory. */
    
    There is another problem where the out-of-bound index is 5 which is larger
    than the extra surrounding memory for protection.
    
    So, use a struct to enforce the ordering, and fix the index to be 4.
    Also, remove some of the volatiles and rely on OPTIMIZER_HIDE_VAR()
    
    Signed-off-by: Mostafa Saleh <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udmabuf: fix a buf size overflow issue during udmabuf creation [+ + +]
Author: Xiaogang Chen <[email protected]>
Date:   Fri Mar 21 11:41:26 2025 -0500

    udmabuf: fix a buf size overflow issue during udmabuf creation
    
    [ Upstream commit 021ba7f1babd029e714d13a6bf2571b08af96d0f ]
    
    by casting size_limit_mb to u64  when calculate pglimit.
    
    Signed-off-by: Xiaogang Chen<[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Christian König <[email protected]>
    Signed-off-by: Sasha Levin <[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: cdns3: Fix deadlock when using NCM gadget [+ + +]
Author: Ralph Siemsen <[email protected]>
Date:   Tue Mar 18 11:09:32 2025 -0400

    usb: cdns3: Fix deadlock when using NCM gadget
    
    commit a1059896f2bfdcebcdc7153c3be2307ea319501f upstream.
    
    The cdns3 driver has the same NCM deadlock as fixed in cdnsp by commit
    58f2fcb3a845 ("usb: cdnsp: Fix deadlock issue during using NCM gadget").
    
    Under PREEMPT_RT the deadlock can be readily triggered by heavy network
    traffic, for example using "iperf --bidir" over NCM ethernet link.
    
    The deadlock occurs because the threaded interrupt handler gets
    preempted by a softirq, but both are protected by the same spinlock.
    Prevent deadlock by disabling softirq during threaded irq handler.
    
    Cc: stable <[email protected]>
    Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
    Signed-off-by: Ralph Siemsen <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Reviewed-by: Sebastian Andrzej Siewior <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Sun Mar 16 13:26:55 2025 +0300

    usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines
    
    commit 8cab0e9a3f3e8d700179e0d6141643d54a267fd5 upstream.
    
    Upon encountering errors during the HSIC pinctrl handling section the
    regulator should be disabled.
    
    Use devm_add_action_or_reset() to let the regulator-disabling routine be
    handled by device resource management stack.
    
    Found by Linux Verification Center (linuxtesting.org).
    
    Fixes: 4d6141288c33 ("usb: chipidea: imx: pinctrl for HSIC is optional")
    Cc: stable <[email protected]>
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: chipidea: ci_hdrc_imx: fix usbmisc handling [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Sun Mar 16 13:26:54 2025 +0300

    usb: chipidea: ci_hdrc_imx: fix usbmisc handling
    
    commit 4e28f79e3dffa52d327b46d1a78dac16efb5810b upstream.
    
    usbmisc is an optional device property so it is totally valid for the
    corresponding data->usbmisc_data to have a NULL value.
    
    Check that before dereferencing the pointer.
    
    Found by Linux Verification Center (linuxtesting.org) with Svace static
    analysis tool.
    
    Fixes: 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()")
    Cc: stable <[email protected]>
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling [+ + +]
Author: Fedor Pchelkin <[email protected]>
Date:   Sun Mar 16 13:26:56 2025 +0300

    usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling
    
    commit 8c531e0a8c2d82509ad97c6d3a1e6217c7ed136d upstream.
    
    usb_phy_init() may return an error code if e.g. its implementation fails
    to prepare/enable some clocks. And properly rollback on probe error path
    by calling the counterpart usb_phy_shutdown().
    
    Found by Linux Verification Center (linuxtesting.org).
    
    Fixes: be9cae2479f4 ("usb: chipidea: imx: Fix ULPI on imx53")
    Cc: stable <[email protected]>
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: dwc3: gadget: Avoid using reserved endpoints on Intel Merrifield [+ + +]
Author: Andy Shevchenko <[email protected]>
Date:   Wed Feb 12 21:28:04 2025 +0200

    usb: dwc3: gadget: Avoid using reserved endpoints on Intel Merrifield
    
    [ Upstream commit 461f24bff86808ee5fbfe74751a825f8a7ab24e0 ]
    
    Intel Merrifield SoC uses these endpoints for tracing and they cannot
    be re-allocated if being used because the side band flow control signals
    are hard wired to certain endpoints:
    
    • 1 High BW Bulk IN (IN#1) (RTIT)
    • 1 1KB BW Bulk IN (IN#8) + 1 1KB BW Bulk OUT (Run Control) (OUT#8)
    
    In device mode, since RTIT (EP#1) and EXI/RunControl (EP#8) uses
    External Buffer Control (EBC) mode, these endpoints are to be mapped to
    EBC mode (to be done by EXI target driver). Additionally TRB for RTIT
    and EXI are maintained in STM (System Trace Module) unit and the EXI
    target driver will as well configure the TRB location for EP #1 IN
    and EP#8 (IN and OUT). Since STM/PTI and EXI hardware blocks manage
    these endpoints and interface to OTG3 controller through EBC interface,
    there is no need to enable any events (such as XferComplete etc)
    for these end points.
    
    Signed-off-by: Andy Shevchenko <[email protected]>
    Tested-by: Ferry Toth <[email protected]>
    Acked-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: dwc3: gadget: check that event count does not exceed event buffer length [+ + +]
Author: Frode Isaksen <[email protected]>
Date:   Thu Apr 3 09:28:03 2025 +0200

    usb: dwc3: gadget: check that event count does not exceed event buffer length
    
    commit 63ccd26cd1f6600421795f6ca3e625076be06c9f upstream.
    
    The event count is read from register DWC3_GEVNTCOUNT.
    There is a check for the count being zero, but not for exceeding the
    event buffer length.
    Check that event count does not exceed event buffer length,
    avoiding an out-of-bounds access when memcpy'ing the event.
    Crash log:
    Unable to handle kernel paging request at virtual address ffffffc0129be000
    pc : __memcpy+0x114/0x180
    lr : dwc3_check_event_buf+0xec/0x348
    x3 : 0000000000000030 x2 : 000000000000dfc4
    x1 : ffffffc0129be000 x0 : ffffff87aad60080
    Call trace:
    __memcpy+0x114/0x180
    dwc3_interrupt+0x24/0x34
    
    Signed-off-by: Frode Isaksen <[email protected]>
    Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
    Cc: stable <[email protected]>
    Acked-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: gadget: aspeed: Add NULL pointer check in ast_vhub_init_dev() [+ + +]
Author: Chenyuan Yang <[email protected]>
Date:   Mon Mar 10 20:27:05 2025 -0500

    usb: gadget: aspeed: Add NULL pointer check in ast_vhub_init_dev()
    
    [ Upstream commit 8c75f3e6a433d92084ad4e78b029ae680865420f ]
    
    The variable d->name, returned by devm_kasprintf(), could be NULL.
    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]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: host: max3421-hcd: Add missing spi_device_id table [+ + +]
Author: Alexander Stein <[email protected]>
Date:   Tue Jan 28 20:51:13 2025 +0100

    usb: host: max3421-hcd: Add missing spi_device_id table
    
    [ Upstream commit 41d5e3806cf589f658f92c75195095df0b66f66a ]
    
    "maxim,max3421" DT compatible is missing its SPI device ID entry, not
    allowing module autoloading and leading to the following message:
     "SPI driver max3421-hcd has no spi_device_id for maxim,max3421"
    
    Fix this by adding the spi_device_id table.
    
    Signed-off-by: Alexander Stein <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02) [+ + +]
Author: Huacai Chen <[email protected]>
Date:   Fri Mar 28 12:00:59 2025 +0800

    USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02)
    
    commit bcb60d438547355b8f9ad48645909139b64d3482 upstream.
    
    The OHCI controller (rev 0x02) under LS7A PCI host has a hardware flaw.
    MMIO register with offset 0x60/0x64 is treated as legacy PS2-compatible
    keyboard/mouse interface, which confuse the OHCI controller. Since OHCI
    only use a 4KB BAR resource indeed, the LS7A OHCI controller's 32KB BAR
    is wrapped around (the second 4KB BAR space is the same as the first 4KB
    internally). So we can add an 4KB offset (0x1000) to the OHCI registers
    (from the PCI BAR resource) as a quirk.
    
    Cc: stable <[email protected]>
    Suggested-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Alan Stern <[email protected]>
    Tested-by: Mingcong Bai <[email protected]>
    Signed-off-by: Huacai Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive [+ + +]
Author: Miao Li <[email protected]>
Date:   Mon Apr 14 14:29:35 2025 +0800

    usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive
    
    commit 37ffdbd695c02189dbf23d6e7d2385e0299587ca upstream.
    
    The SanDisk 3.2Gen1 Flash Drive, which VID:PID is in 0781:55a3,
    just like Silicon Motion Flash Drive:
    https://lore.kernel.org/r/[email protected]
    also needs the DELAY_INIT quirk, or it will randomly work incorrectly
    (e.g.: lsusb and can't list this device info) when connecting Huawei
    hisi platforms and doing thousand of reboot test circles.
    
    Cc: stable <[email protected]>
    Signed-off-by: Miao Li <[email protected]>
    Signed-off-by: Lei Huang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive [+ + +]
Author: Miao Li <[email protected]>
Date:   Tue Apr 1 10:30:27 2025 +0800

    usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive
    
    commit 2932b6b547ec36ad2ed60fbf2117c0e46bb7d40a upstream.
    
    Silicon Motion Flash Drive connects to Huawei hisi platforms and
    performs a system reboot test for two thousand circles, it will
    randomly work incorrectly on boot, set DELAY_INIT quirk can workaround
    this issue.
    
    Signed-off-by: Miao Li <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe [+ + +]
Author: Michael Ehrenreich <[email protected]>
Date:   Mon Mar 17 06:17:15 2025 +0100

    USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe
    
    commit b399078f882b6e5d32da18b6c696cc84b12f90d5 upstream.
    
    Abacus Electrics makes optical probes for interacting with smart meters
    over an optical interface.
    
    At least one version uses an FT232B chip (as detected by ftdi_sio) with
    a custom USB PID, which needs to be added to the list to make the device
    work in a plug-and-play fashion.
    
    Signed-off-by: Michael Ehrenreich <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Sierra Wireless EM9291 [+ + +]
Author: Adam Xue <[email protected]>
Date:   Mon Apr 14 14:14:37 2025 -0700

    USB: serial: option: add Sierra Wireless EM9291
    
    commit 968e1cbb1f6293c3add9607f80b5ce3d29f57583 upstream.
    
    Add Sierra Wireless EM9291.
    
    Interface 0: MBIM control
              1: MBIM data
              3: AT port
              4: Diagnostic port
    
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1199 ProdID=90e3 Rev=00.06
    S:  Manufacturer=Sierra Wireless, Incorporated
    S:  Product=Sierra Wireless EM9291
    S:  SerialNumber=xxxxxxxxxxxxxxxx
    C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=(none)
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Adam Xue <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: simple: add OWON HDS200 series oscilloscope support [+ + +]
Author: Craig Hesling <[email protected]>
Date:   Tue Apr 8 16:27:03 2025 -0700

    USB: serial: simple: add OWON HDS200 series oscilloscope support
    
    commit 4cc01410e1c1dd075df10f750775c81d1cb6672b upstream.
    
    Add serial support for OWON HDS200 series oscilloscopes and likely
    many other pieces of OWON test equipment.
    
    OWON HDS200 series devices host two USB endpoints, designed to
    facilitate bidirectional SCPI. SCPI is a predominately ASCII text
    protocol for test/measurement equipment. Having a serial/tty interface
    for these devices lowers the barrier to entry for anyone trying to
    write programs to communicate with them.
    
    The following shows the USB descriptor for the OWON HDS272S running
    firmware V5.7.1:
    
    Bus 001 Device 068: ID 5345:1234 Owon PDS6062T Oscilloscope
    Negotiated speed: Full Speed (12Mbps)
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass            0 [unknown]
      bDeviceSubClass         0 [unknown]
      bDeviceProtocol         0
      bMaxPacketSize0        64
      idVendor           0x5345 Owon
      idProduct          0x1234 PDS6062T Oscilloscope
      bcdDevice            1.00
      iManufacturer           1 oscilloscope
      iProduct                2 oscilloscope
      iSerial                 3 oscilloscope
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x0029
        bNumInterfaces          1
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0x80
          (Bus Powered)
        MaxPower              100mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass         5 Physical Interface Device
          bInterfaceSubClass      0 [unknown]
          bInterfaceProtocol      0
          iInterface              0
          ** UNRECOGNIZED:  09 21 11 01 00 01 22 5f 00
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval              32
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval              32
    Device Status:     0x0000
      (Bus Powered)
    
    OWON appears to be using the same USB Vendor and Product ID for many
    of their oscilloscopes. Looking at the discussion about the USB
    vendor/product ID, in the link bellow, suggests that this VID/PID is
    shared with VDS, SDS, PDS, and now the HDS series oscilloscopes.
    Available documentation for these devices seems to indicate that all
    use a similar SCPI protocol, some with RS232 options. It is likely that
    this same simple serial setup would work correctly for them all.
    
    Link: https://usb-ids.gowdy.us/read/UD/5345/1234
    Signed-off-by: Craig Hesling <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: storage: quirk for ADATA Portable HDD CH94 [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Thu Apr 3 19:59:45 2025 +0200

    USB: storage: quirk for ADATA Portable HDD CH94
    
    commit 9ab75eee1a056f896b87d139044dd103adc532b9 upstream.
    
    Version 1.60 specifically needs this quirk.
    Version 2.00 is known good.
    
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: VLI disk crashes if LPM is used [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Tue Apr 8 15:57:46 2025 +0200

    USB: VLI disk crashes if LPM is used
    
    commit e00b39a4f3552c730f1e24c8d62c4a8c6aad4e5d upstream.
    
    This device needs the NO_LPM quirk.
    
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: wdm: add annotation [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Tue Apr 1 10:45:41 2025 +0200

    USB: wdm: add annotation
    
    commit 73e9cc1ffd3650b12c4eb059dfdafd56e725ceda upstream.
    
    This is not understandable without a comment on endianness
    
    Fixes: afba937e540c9 ("USB: CDC WDM driver")
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: wdm: close race between wdm_open and wdm_wwan_port_stop [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Tue Apr 1 10:45:39 2025 +0200

    USB: wdm: close race between wdm_open and wdm_wwan_port_stop
    
    commit c1846ed4eb527bdfe6b3b7dd2c78e2af4bf98f4f upstream.
    
    Clearing WDM_WWAN_IN_USE must be the last action or
    we can open a chardev whose URBs are still poisoned
    
    Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration")
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: wdm: handle IO errors in wdm_wwan_port_start [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Tue Apr 1 10:45:38 2025 +0200

    USB: wdm: handle IO errors in wdm_wwan_port_start
    
    commit 9697f5efcf5fdea65b8390b5eb81bebe746ceedc upstream.
    
    In case submitting the URB fails we must undo
    what we've done so far.
    
    Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration")
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Tue Apr 1 10:45:40 2025 +0200

    USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context
    
    commit 1fdc4dca350c0b8ada0b8ebf212504e1ad55e511 upstream.
    
    wdm_wwan_port_tx_complete is called from a completion
    handler with irqs disabled and possible in IRQ context
    usb_autopm_put_interface can take a mutex.
    Hence usb_autopm_put_interface_async must be used.
    
    Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration")
    Cc: stable <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running [+ + +]
Author: Michal Pecio <[email protected]>
Date:   Tue Mar 11 17:45:51 2025 +0200

    usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running
    
    [ Upstream commit 28a76fcc4c85dd39633fb96edb643c91820133e3 ]
    
    Nothing prevents a broken HC from claiming that an endpoint is Running
    and repeatedly rejecting Stop Endpoint with Context State Error.
    
    Avoid infinite retries and give back cancelled TDs.
    
    No such cases known so far, but HCs have bugs.
    
    Signed-off-by: Michal Pecio <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

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

 
virtio_console: fix missing byte order handling for cols and rows [+ + +]
Author: Halil Pasic <[email protected]>
Date:   Sat Mar 22 01:29:54 2025 +0100

    virtio_console: fix missing byte order handling for cols and rows
    
    commit fbd3039a64b01b769040677c4fc68badeca8e3b2 upstream.
    
    As per virtio spec the fields cols and rows are specified as little
    endian. Although there is no legacy interface requirement that would
    state that cols and rows need to be handled as native endian when legacy
    interface is used, unlike for the fields of the adjacent struct
    virtio_console_control, I decided to err on the side of caution based
    on some non-conclusive virtio spec repo archaeology and opt for using
    virtio16_to_cpu() much like for virtio_console_control.event. Strictly
    by the letter of the spec virtio_le_to_cpu() would have been sufficient.
    But when the legacy interface is not used, it boils down to the same.
    
    And when using the legacy interface, the device formatting these as
    little endian when the guest is big endian would surprise me more than
    it using guest native byte order (which would make it compatible with
    the current implementation). Nevertheless somebody trying to implement
    the spec following it to the letter could end up forcing little endian
    byte order when the legacy interface is in use. So IMHO this ultimately
    needs a judgement call by the maintainers.
    
    Fixes: 8345adbf96fc1 ("virtio: console: Accept console size along with resize control message")
    Signed-off-by: Halil Pasic <[email protected]>
    Cc: [email protected] # v2.6.35+
    Message-Id: <[email protected]>
    Signed-off-by: Michael S. Tsirkin <[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: ath10k: avoid NULL pointer error during sdio remove [+ + +]
Author: Kang Yang <[email protected]>
Date:   Tue Oct 8 10:22:46 2024 +0800

    wifi: ath10k: avoid NULL pointer error during sdio remove
    
    commit 95c38953cb1ecf40399a676a1f85dfe2b5780a9a upstream.
    
    When running 'rmmod ath10k', ath10k_sdio_remove() will free sdio
    workqueue by destroy_workqueue(). But if CONFIG_INIT_ON_FREE_DEFAULT_ON
    is set to yes, kernel panic will happen:
    Call trace:
     destroy_workqueue+0x1c/0x258
     ath10k_sdio_remove+0x84/0x94
     sdio_bus_remove+0x50/0x16c
     device_release_driver_internal+0x188/0x25c
     device_driver_detach+0x20/0x2c
    
    This is because during 'rmmod ath10k', ath10k_sdio_remove() will call
    ath10k_core_destroy() before destroy_workqueue(). wiphy_dev_release()
    will finally be called in ath10k_core_destroy(). This function will free
    struct cfg80211_registered_device *rdev and all its members, including
    wiphy, dev and the pointer of sdio workqueue. Then the pointer of sdio
    workqueue will be set to NULL due to CONFIG_INIT_ON_FREE_DEFAULT_ON.
    
    After device release, destroy_workqueue() will use NULL pointer then the
    kernel panic happen.
    
    Call trace:
    ath10k_sdio_remove
      ->ath10k_core_unregister
        ……
        ->ath10k_core_stop
          ->ath10k_hif_stop
            ->ath10k_sdio_irq_disable
        ->ath10k_hif_power_down
          ->del_timer_sync(&ar_sdio->sleep_timer)
      ->ath10k_core_destroy
        ->ath10k_mac_destroy
          ->ieee80211_free_hw
            ->wiphy_free
        ……
              ->wiphy_dev_release
      ->destroy_workqueue
    
    Need to call destroy_workqueue() before ath10k_core_destroy(), free
    the work queue buffer first and then free pointer of work queue by
    ath10k_core_destroy(). This order matches the error path order in
    ath10k_sdio_probe().
    
    No work will be queued on sdio workqueue between it is destroyed and
    ath10k_core_destroy() is called. Based on the call_stack above, the
    reason is:
    Only ath10k_sdio_sleep_timer_handler(), ath10k_sdio_hif_tx_sg() and
    ath10k_sdio_irq_disable() will queue work on sdio workqueue.
    Sleep timer will be deleted before ath10k_core_destroy() in
    ath10k_hif_power_down().
    ath10k_sdio_irq_disable() only be called in ath10k_hif_stop().
    ath10k_core_unregister() will call ath10k_hif_power_down() to stop hif
    bus, so ath10k_sdio_hif_tx_sg() won't be called anymore.
    
    Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00189
    
    Signed-off-by: Kang Yang <[email protected]>
    Tested-by: David Ruth <[email protected]>
    Reviewed-by: David Ruth <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jeff Johnson <[email protected]>
    Signed-off-by: Alva Lan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[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: 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/bugs: Don't fill RSB on context switch with eIBRS [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 8 14:47:34 2025 -0700

    x86/bugs: Don't fill RSB on context switch with eIBRS
    
    [ Upstream commit 27ce8299bc1ec6df8306073785ff82b30b3cc5ee ]
    
    User->user Spectre v2 attacks (including RSB) across context switches
    are already mitigated by IBPB in cond_mitigation(), if enabled globally
    or if either the prev or the next task has opted in to protection.  RSB
    filling without IBPB serves no purpose for protecting user space, as
    indirect branches are still vulnerable.
    
    User->kernel RSB attacks are mitigated by eIBRS.  In which case the RSB
    filling on context switch isn't needed, so remove it.
    
    Suggested-by: Pawan Gupta <[email protected]>
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Pawan Gupta <[email protected]>
    Reviewed-by: Amit Shah <[email protected]>
    Reviewed-by: Nikolay Borisov <[email protected]>
    Link: https://lore.kernel.org/r/98cdefe42180358efebf78e3b80752850c7a3e1b.1744148254.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <[email protected]>

x86/bugs: Don't fill RSB on VMEXIT with eIBRS+retpoline [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 8 14:47:33 2025 -0700

    x86/bugs: Don't fill RSB on VMEXIT with eIBRS+retpoline
    
    [ Upstream commit 18bae0dfec15b24ec14ca17dc18603372f5f254f ]
    
    eIBRS protects against guest->host RSB underflow/poisoning attacks.
    Adding retpoline to the mix doesn't change that.  Retpoline has a
    balanced CALL/RET anyway.
    
    So the current full RSB filling on VMEXIT with eIBRS+retpoline is
    overkill.  Disable it or do the VMEXIT_LITE mitigation if needed.
    
    Suggested-by: Pawan Gupta <[email protected]>
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Reviewed-by: Pawan Gupta <[email protected]>
    Reviewed-by: Amit Shah <[email protected]>
    Reviewed-by: Nikolay Borisov <[email protected]>
    Cc: Paolo Bonzini <[email protected]>
    Cc: Vitaly Kuznetsov <[email protected]>
    Cc: Sean Christopherson <[email protected]>
    Cc: David Woodhouse <[email protected]>
    Link: https://lore.kernel.org/r/84a1226e5c9e2698eae1b5ade861f1b8bf3677dc.1744148254.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <[email protected]>

x86/bugs: Use SBPB in write_ibpb() if applicable [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Tue Apr 8 14:47:31 2025 -0700

    x86/bugs: Use SBPB in write_ibpb() if applicable
    
    [ Upstream commit fc9fd3f98423367c79e0bd85a9515df26dc1b3cc ]
    
    write_ibpb() does IBPB, which (among other things) flushes branch type
    predictions on AMD.  If the CPU has SRSO_NO, or if the SRSO mitigation
    has been disabled, branch type flushing isn't needed, in which case the
    lighter-weight SBPB can be used.
    
    The 'x86_pred_cmd' variable already keeps track of whether IBPB or SBPB
    should be used.  Use that instead of hardcoding IBPB.
    
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Link: https://lore.kernel.org/r/17c5dcd14b29199b75199d67ff7758de9d9a4928.1744148254.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <[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/pvh: Call C code via the kernel virtual mapping [+ + +]
Author: Ard Biesheuvel <[email protected]>
Date:   Wed Oct 9 18:04:40 2024 +0200

    x86/pvh: Call C code via the kernel virtual mapping
    
    commit e8fbc0d9cab6c1ee6403f42c0991b0c1d5dbc092 upstream.
    
    Calling C code via a different mapping than it was linked at is
    problematic, because the compiler assumes that RIP-relative and absolute
    symbol references are interchangeable. GCC in particular may use
    RIP-relative per-CPU variable references even when not using -fpic.
    
    So call xen_prepare_pvh() via its kernel virtual mapping on x86_64, so
    that those RIP-relative references produce the correct values. This
    matches the pre-existing behavior for i386, which also invokes
    xen_prepare_pvh() via the kernel virtual mapping before invoking
    startup_32 with paging disabled again.
    
    Fixes: 7243b93345f7 ("xen/pvh: Bootstrap PVH guest")
    Tested-by: Jason Andryuk <[email protected]>
    Reviewed-by: Jason Andryuk <[email protected]>
    Signed-off-by: Ard Biesheuvel <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    [ Stable context update ]
    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:   Thu Apr 24 15:03:14 2025 +0200

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

 
xen: Change xen-acpi-processor dom0 dependency [+ + +]
Author: Jason Andryuk <[email protected]>
Date:   Mon Mar 31 13:29:12 2025 -0400

    xen: Change xen-acpi-processor dom0 dependency
    
    [ Upstream commit 0f2946bb172632e122d4033e0b03f85230a29510 ]
    
    xen-acpi-processor functions under a PVH dom0 with only a
    xen_initial_domain() runtime check.  Change the Kconfig dependency from
    PV dom0 to generic dom0 to reflect that.
    
    Suggested-by: Jan Beulich <[email protected]>
    Signed-off-by: Jason Andryuk <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Tested-by: Jan Beulich <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    Message-ID: <[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]>