Changelog in Linux kernel 6.12.24

 
accel/ivpu: Fix deadlock in ivpu_ms_cleanup() [+ + +]
Author: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Date:   Tue Mar 25 12:43:05 2025 +0100

    accel/ivpu: Fix deadlock in ivpu_ms_cleanup()
    
    commit 9a6f56762d23a1f3af15e67901493c927caaf882 upstream.
    
    Fix deadlock in ivpu_ms_cleanup() by preventing runtime resume after
    file_priv->ms_lock is acquired.
    
    During a failure in runtime resume, a cold boot is executed, which
    calls ivpu_ms_cleanup_all(). This function calls ivpu_ms_cleanup()
    that acquires file_priv->ms_lock and causes the deadlock.
    
    Fixes: cdfad4db7756 ("accel/ivpu: Add NPU profiling support")
    Cc: stable@vger.kernel.org # v6.11+
    Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
    Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
    Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    Link: https://lore.kernel.org/r/20250325114306.3740022-2-maciej.falkowski@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

accel/ivpu: Fix PM related deadlocks in MS IOCTLs [+ + +]
Author: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Date:   Tue Mar 25 12:43:06 2025 +0100

    accel/ivpu: Fix PM related deadlocks in MS IOCTLs
    
    commit d893da85e06edf54737bb80648bb58ba8fd56d9f upstream.
    
    Prevent runtime resume/suspend while MS IOCTLs are in progress.
    Failed suspend will call ivpu_ms_cleanup() that would try to acquire
    file_priv->ms_lock, which is already held by the IOCTLs.
    
    Fixes: cdfad4db7756 ("accel/ivpu: Add NPU profiling support")
    Cc: stable@vger.kernel.org # v6.11+
    Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
    Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
    Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    Link: https://lore.kernel.org/r/20250325114306.3740022-3-maciej.falkowski@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

accel/ivpu: Fix warning in ivpu_ipc_send_receive_internal() [+ + +]
Author: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Date:   Tue Mar 25 12:42:19 2025 +0100

    accel/ivpu: Fix warning in ivpu_ipc_send_receive_internal()
    
    commit 6b4568b675b14cf890c0c21779773c3e08e80ce5 upstream.
    
    Warn if device is suspended only when runtime PM is enabled.
    Runtime PM is disabled during reset/recovery and it is not an error
    to use ivpu_ipc_send_receive_internal() in such cases.
    
    Fixes: 5eaa49741119 ("accel/ivpu: Prevent recovery invocation during probe and resume")
    Cc: stable@vger.kernel.org # v6.13+
    Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
    Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
    Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    Link: https://lore.kernel.org/r/20250325114219.3739951-1-maciej.falkowski@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ACPI: platform-profile: Fix CFI violation when accessing sysfs files [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
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 <stable@vger.kernel.org>
    Fixes: a2ff95e018f1 ("ACPI: platform: Add platform profile support")
    Reported-by: John Rowley <lkml@johnrowley.me>
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2047
    Tested-by: John Rowley <lkml@johnrowley.me>
    Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
    Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
    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 <rafael.j.wysocki@intel.com>
    [nathan: Fix conflicts in older stable branches]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ahci: add PCI ID for Marvell 88SE9215 SATA Controller [+ + +]
Author: Daniel Kral <d.kral@proxmox.com>
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 <d.kral@proxmox.com>
    Link: https://lore.kernel.org/r/20250304092030.37108-1-d.kral@proxmox.com
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI [+ + +]
Author: Huacai Chen <chenhuacai@kernel.org>
Date:   Tue Mar 18 18:43:14 2025 +0800

    ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI
    
    [ Upstream commit 0507c777f5d8f9e34b137d28ee263599a7b81242 ]
    
    We use CD/DVD drives under Marvell 88SE9215 SATA controller on many
    Loongson-based machines. We found its PIO doesn't work well, and on the
    opposite its DMA seems work very well.
    
    We don't know the detail of the 88SE9215 SATA controller, but we have
    tested different CD/DVD drives and they all have problems under 88SE9215
    (but they all work well under an Intel SATA controller). So, we consider
    this problem is bound to 88SE9215 SATA controller rather than bound to
    CD/DVD drives.
    
    As a solution, we define a new dedicated AHCI board id which is named
    board_ahci_yes_fbs_atapi_dma for 88SE9215, and for this id we set the
    AHCI_HFLAG_ATAPI_DMA_QUIRK and ATA_QUIRK_ATAPI_MOD16_DMA flags on the
    SATA controller in order to prefer ATAPI DMA.
    
    Reported-by: Yuli Wang <wangyuli@uniontech.com>
    Tested-by: Jie Fan <fanjie@uniontech.com>
    Tested-by: Erpeng Xu <xuerpeng@uniontech.com>
    Tested-by: Yuli Wang <wangyuli@uniontech.com>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Link: https://lore.kernel.org/r/20250318104314.2160526-1-chenhuacai@loongson.cn
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/realtek: Enable Mute LED on HP OMEN 16 Laptop xd000xx [+ + +]
Author: Sharan Kumar M <sharweshraajan@gmail.com>
Date:   Sat Mar 29 21:11:06 2025 +0530

    ALSA: hda/realtek: Enable Mute LED on HP OMEN 16 Laptop xd000xx
    
    commit e5182305a5199246dbcb4053299dcb1c8867b6ff upstream.
    
    This patch adds the HP OMEN 16 Laptop xd000xx to enable mute led.
    it uses ALC245_FIXUP_HP_MUTE_LED_COEFBIT with a slight modification
    setting mute_led_coef.off to 0(it was set to 4 i guess
    in that function) which i referred to your previous patch disscusion
    https://bugzilla.kernel.org/show_bug.cgi?id=214735 .
    i am not sure whether i can modify the current working function so i
    added another version calling
    ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT. and both works for me.
    
    Tested on 6.13.4-arch1-1 to 6.14.0-arch1-1
    
    Signed-off-by: Sharan Kumar M <sharweshraajan@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250329154105.7618-2-sharweshraajan@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

ALSA: hda: intel: Fix Optimus when GPU has no sound [+ + +]
Author: Maxim Mikityanskiy <maxtram95@gmail.com>
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 <maxtram95@gmail.com>
    Link: https://patch.msgid.link/20250208214602.39607-2-maxtram95@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Fix CME quirk for UF series keyboards [+ + +]
Author: Ricard Wanderlof <ricard2013@butoba.net>
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 <ricard2013@butoba.net>
    Link: https://patch.msgid.link/20250313-cme-fix-v1-1-d404889e4de8@butoba.net
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64: cputype: Add MIDR_CORTEX_A76AE [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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: stable@vger.kernel.org # dependency of the next fix in the series
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20250107120555.v4.4.I151f3b7ee323bcc3082179b8c60c3cd03308aa94@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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 <dmitry.baryshkov@linaro.org>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Acked-by: Trilok Soni <quic_tsoni@quicinc.com>
    Link: https://lore.kernel.org/r/20241219131107.v3.1.I18e0288742871393228249a768e5d56ea65d93dc@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: dts: exynos: gs101: disable pinctrl_gsacore node [+ + +]
Author: Peter Griffin <peter.griffin@linaro.org>
Date:   Mon Jan 6 14:57:46 2025 +0000

    arm64: dts: exynos: gs101: disable pinctrl_gsacore node
    
    commit 168e24966f10ff635b0ec9728aa71833bf850ee5 upstream.
    
    gsacore registers are not accessible from normal world.
    
    Disable this node, so that the suspend/resume callbacks
    in the pinctrl driver don't cause a Serror attempting to
    access the registers.
    
    Fixes: ea89fdf24fd9 ("arm64: dts: exynos: google: Add initial Google gs101 SoC support")
    Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
    To: Rob Herring <robh@kernel.org>
    To: Krzysztof Kozlowski <krzk+dt@kernel.org>
    To: Conor Dooley <conor+dt@kernel.org>
    To: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: tudor.ambarus@linaro.org
    Cc: andre.draszik@linaro.org
    Cc: kernel-team@android.com
    Cc: willmcvicker@google.com
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250106-contrib-pg-pinctrl_gsacore_disable-v1-1-d3fc88a48aed@linaro.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: mediatek: mt8173: Fix disp-pwm compatible string [+ + +]
Author: Chen-Yu Tsai <wenst@chromium.org>
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 <yh.huang@mediatek.com>
    Cc: stable@vger.kernel.org # v4.5+
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20250108083424.2732375-2-wenst@chromium.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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: stable@vger.kernel.org
    Cc: Scott Bauer <sbauer@quicinc.com>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Acked-by: Trilok Soni <quic_tsoni@quicinc.com>
    Link: https://lore.kernel.org/r/20250107120555.v4.3.Iab8dbfb5c9b1e143e7a29f410bce5f9525a0ba32@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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: stable@vger.kernel.org
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Reviewed-by: James Morse <james.morse@arm.com>
    Link: https://lore.kernel.org/r/20250107120555.v4.5.I4a9a527e03f663040721c5401c41de587d015c82@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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: stable@vger.kernel.org
    Cc: Scott Bauer <sbauer@quicinc.com>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Acked-by: Trilok Soni <quic_tsoni@quicinc.com>
    Link: https://lore.kernel.org/r/20250107120555.v4.1.Ie4ef54abe02e7eb0eee50f830575719bf23bda48@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB [+ + +]
Author: Douglas Anderson <dianders@chromium.org>
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/18dbd7d1-a46c-4112-a425-320c99f67a8d@broadcom.com
    
    Fixes: 558c303c9734 ("arm64: Mitigate spectre style branch history side channels")
    Cc: stable@vger.kernel.org
    Reviewed-by: Julius Werner <jwerner@chromium.org>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20250107120555.v4.2.I2040fa004dafe196243f67ebcc647cbedbb516e6@changeid
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: mm: Correct the update of max_pfn [+ + +]
Author: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Date:   Fri Mar 21 15:00:19 2025 +0800

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

arm64: mops: Do not dereference src reg for a set operation [+ + +]
Author: Keir Fraser <keirf@google.com>
Date:   Wed Mar 26 11:04:47 2025 +0000

    arm64: mops: Do not dereference src reg for a set operation
    
    commit a13bfa4fe0d6949cea14718df2d1fe84c38cd113 upstream.
    
    The source register is not used for SET* and reading it can result in
    a UBSAN out-of-bounds array access error, specifically when the MOPS
    exception is taken from a SET* sequence with XZR (reg 31) as the
    source. Architecturally this is the only case where a src/dst/size
    field in the ESR can be reported as 31.
    
    Prior to 2de451a329cf662b the code in do_el0_mops() was benign as the
    use of pt_regs_read_reg() prevented the out-of-bounds access.
    
    Fixes: 2de451a329cf ("KVM: arm64: Add handler for MOPS exceptions")
    Cc: <stable@vger.kernel.org> # 6.12.x
    Cc: Kristina Martsenko <kristina.martsenko@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: stable@vger.kernel.org
    Reviewed-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Keir Fraser <keirf@google.com>
    Reviewed-by: Kristina Martšenko <kristina.martsenko@arm.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250326110448.3792396-1-keirf@google.com
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: tegra: Remove the Orin NX/Nano suspend key [+ + +]
Author: Ninad Malwade <nmalwade@nvidia.com>
Date:   Thu Feb 6 22:40:34 2025 +0000

    arm64: tegra: Remove the Orin NX/Nano suspend key
    
    commit bb8a3ad25f098b6ea9b1d0f522427b4ad53a7bba upstream.
    
    As per the Orin Nano Dev Kit schematic, GPIO_G.02 is not available
    on this device family. It should not be used at all on Orin NX/Nano.
    Having this unused pin mapped as the suspend key can lead to
    unpredictable behavior for low power modes.
    
    Orin NX/Nano uses GPIO_EE.04 as both a "power" button and a "suspend"
    button. However, we cannot have two gpio-keys mapped to the same
    GPIO. Therefore remove the "suspend" key.
    
    Cc: stable@vger.kernel.org
    Fixes: e63472eda5ea ("arm64: tegra: Support Jetson Orin NX reference platform")
    Signed-off-by: Ninad Malwade <nmalwade@nvidia.com>
    Signed-off-by: Ivy Huang <yijuh@nvidia.com>
    Link: https://lore.kernel.org/r/20250206224034.3691397-1-yijuh@nvidia.com
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

ASoC: amd: ps: use macro for ACP6.3 pci revision id [+ + +]
Author: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Date:   Fri Feb 7 11:57:56 2025 +0530

    ASoC: amd: ps: use macro for ACP6.3 pci revision id
    
    [ Upstream commit 4b36a47e2d989b98953dbfb1e97da0f0169f5086 ]
    
    Use macro for ACP6.3 PCI revision id instead of hard coded value.
    
    Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
    Link: https://patch.msgid.link/20250207062819.1527184-3-Vijendar.Mukunda@amd.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

ASoC: codecs: wcd937x: fix a potential memory leak in wcd937x_soc_codec_probe() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Wed Feb 26 16:50:50 2025 +0800

    ASoC: codecs: wcd937x: fix a potential memory leak in wcd937x_soc_codec_probe()
    
    commit 3e330acf4efd63876d673c046cd073a1d4ed57a8 upstream.
    
    When snd_soc_dapm_new_controls() or snd_soc_dapm_add_routes() fails,
    wcd937x_soc_codec_probe() returns without releasing 'wcd937x->clsh_info',
    which is allocated by wcd_clsh_ctrl_alloc. Add wcd_clsh_ctrl_free()
    to prevent potential memory leak.
    
    Fixes: 313e978df7fc ("ASoC: codecs: wcd937x: add audio routing and Kconfig")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Link: https://patch.msgid.link/20250226085050.3584898-1-haoxiang_li2024@163.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: fsl_audmix: register card device depends on 'dais' property [+ + +]
Author: Shengjiu Wang <shengjiu.wang@nxp.com>
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 <shengjiu.wang@nxp.com>
    Link: https://patch.msgid.link/20250226100508.2352568-5-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Intel: adl: add 2xrt1316 audio configuration [+ + +]
Author: Bard Liao <yung-chuan.liao@linux.intel.com>
Date:   Wed Mar 5 21:54:35 2025 +0800

    ASoC: Intel: adl: add 2xrt1316 audio configuration
    
    commit 8b36447c9ae102539d82d6278971b23b20d87629 upstream.
    
    That is a speaker only configuration and 2 rt1316 are on link 0 and 2.
    
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
    Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Link: https://patch.msgid.link/20250305135443.201884-2-yung-chuan.liao@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ASoC: q6apm-dai: make use of q6apm_get_hw_pointer [+ + +]
Author: Srinivas Kandagatla <srini@kernel.org>
Date:   Fri Mar 14 17:47:58 2025 +0000

    ASoC: q6apm-dai: make use of q6apm_get_hw_pointer
    
    commit a93dad6f4e6a04a5943f6ee5686585f24abf7063 upstream.
    
    With the existing code, the buffer position is only reset in pointer
    callback, which leaves the possiblity of it going over the size of
    buffer size and reporting incorrect position to userspace.
    
    Without this patch, its possible to see errors like:
    snd-x1e80100 sound: invalid position: pcmC0D0p:0, pos = 12288, buffer size = 12288, period size = 1536
    snd-x1e80100 sound: invalid position: pcmC0D0p:0, pos = 12288, buffer size = 12288, period size = 1536
    
    Fixes: 9b4fe0f1cd791 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://patch.msgid.link/20250314174800.10142-4-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs [+ + +]
Author: Srinivas Kandagatla <srini@kernel.org>
Date:   Fri Mar 14 17:47:56 2025 +0000

    ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs
    
    commit 3d4a4411aa8bbc3653ff22a1ff0432eb93d22ae0 upstream.
    
    With the existing code, we are only setting up one period at a time, in a
    ping-pong buffer style. This triggers lot of underruns in the dsp
    leading to jitter noise during audio playback.
    
    Fix this by scheduling all available periods, this will ensure that the dsp
    has enough buffer feed and ultimatley fixing the underruns and audio
    distortion.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: stable@vger.kernel.org
    Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://patch.msgid.link/20250314174800.10142-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: q6apm: add q6apm_get_hw_pointer helper [+ + +]
Author: Srinivas Kandagatla <srini@kernel.org>
Date:   Fri Mar 14 17:47:57 2025 +0000

    ASoC: q6apm: add q6apm_get_hw_pointer helper
    
    commit 0badb5432fd525a00db5630c459b635e9d47f445 upstream.
    
    Implement an helper function in q6apm to be able to read the current
    hardware pointer for both read and write buffers.
    
    This should help q6apm-dai to get the hardware pointer consistently
    without it doing manual calculation, which could go wrong in some race
    conditions.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://patch.msgid.link/20250314174800.10142-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns.
    
    commit 5d01ed9b9939b4c726be74db291a982bc984c584 upstream.
    
    Period sizes less than 6k for capture path triggers overruns in the
    dsp capture pipeline.
    
    Change the period size and number of periods to value which DSP is happy with.
    
    Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://patch.msgid.link/20250314174800.10142-6-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path [+ + +]
Author: Alexey Klimov <alexey.klimov@linaro.org>
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: stable@vger.kernel.org
    Fixes: 5b39363e54cc ("ASoC: q6asm-dai: prepare set params to accept profile change")
    Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Cc: Vinod Koul <vkoul@kernel.org>
    Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
    Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://patch.msgid.link/20250327154650.337404-1-alexey.klimov@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: SOF: topology: Use krealloc_array() to replace krealloc() [+ + +]
Author: Zhang Heng <zhangheng@kylinos.cn>
Date:   Fri Jan 17 09:43:43 2025 +0800

    ASoC: SOF: topology: Use krealloc_array() to replace krealloc()
    
    [ Upstream commit a05143a8f713d9ae6abc41141dac52c66fca8b06 ]
    
    Use krealloc_array() to replace krealloc() with multiplication.
    krealloc_array() has multiply overflow check, which will be safer.
    
    Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
    Link: https://patch.msgid.link/20250117014343.451503-1-zhangheng@kylinos.cn
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: libata-core: Add 'external' to the libata.force kernel parameter [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
Date:   Thu Jan 30 14:35:46 2025 +0100

    ata: libata-core: Add 'external' to the libata.force kernel parameter
    
    [ Upstream commit deca423213cb33feda15e261e7b5b992077a6a08 ]
    
    Commit ae1f3db006b7 ("ata: ahci: do not enable LPM on external ports")
    changed so that LPM is not enabled on external ports (hotplug-capable or
    eSATA ports).
    
    This is because hotplug and LPM are mutually exclusive, see 7.3.1 Hot Plug
    Removal Detection and Power Management Interaction in AHCI 1.3.1.
    
    This does require that firmware has set the appropate bits (HPCP or ESP)
    in PxCMD (which is a per port register in the AHCI controller).
    
    If the firmware has failed to mark a port as hotplug-capable or eSATA in
    PxCMD, then there is currently not much a user can do.
    
    If LPM is enabled on the port, hotplug insertions and removals will not be
    detected on that port.
    
    In order to allow a user to fix up broken firmware, add 'external' to the
    libata.force kernel parameter.
    
    libata.force can be specified either on the kernel command line, or as a
    kernel module parameter.
    
    For more information, see Documentation/admin-guide/kernel-parameters.txt.
    
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Link: https://lore.kernel.org/r/20250130133544.219297-4-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
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 <lists@philpem.me.uk>
    Closes: https://lore.kernel.org/linux-ide/c6722ee8-5e21-4169-af59-cbbae9edc02f@philpem.me.uk/
    Tested-by: Philip Pemberton <lists@philpem.me.uk>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Link: https://lore.kernel.org/r/20250221015422.20687-2-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe() [+ + +]
Author: Henry Martin <bsdhenrymartin@gmail.com>
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 <bsdhenrymartin@gmail.com>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: sata_sx4: Add error handling in pdc20621_i2c_read() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
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 <vulab@iscas.ac.cn>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

    auxdisplay: hd44780: Fix an API misuse in hd44780.c
    
    commit 9b98a7d2e5f4e2beeff88f6571da0cdc5883c7fb upstream.
    
    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: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
backlight: led_bl: Hold led_access lock when calling led_sysfs_disable() [+ + +]
Author: Herve Codina <herve.codina@bootlin.com>
Date:   Wed Jan 22 10:19:14 2025 +0100

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

 
Bluetooth: Add quirk for broken READ_PAGE_SCAN_TYPE [+ + +]
Author: Pedro Nishiyama <nishiyama.pedro@gmail.com>
Date:   Sat Mar 1 03:22:59 2025 -0300

    Bluetooth: Add quirk for broken READ_PAGE_SCAN_TYPE
    
    [ Upstream commit 127881334eaad639e0a19a399ee8c91d6c9dc982 ]
    
    Some fake controllers cannot be initialized because they return a smaller
    report than expected for READ_PAGE_SCAN_TYPE.
    
    Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: Add quirk for broken READ_VOICE_SETTING [+ + +]
Author: Pedro Nishiyama <nishiyama.pedro@gmail.com>
Date:   Sat Mar 1 03:22:58 2025 -0300

    Bluetooth: Add quirk for broken READ_VOICE_SETTING
    
    [ Upstream commit ff26b2dd6568392f60fa67a4e58279938025c3af ]
    
    Some fake controllers cannot be initialized because they return a smaller
    report than expected for READ_VOICE_SETTING.
    
    Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: btintel_pcie: Add device id of Whale Peak [+ + +]
Author: Kiran K <kiran.k@intel.com>
Date:   Thu Jan 16 17:07:09 2025 +0530

    Bluetooth: btintel_pcie: Add device id of Whale Peak
    
    [ Upstream commit 6b8c05e52d66e4fe4ab1df4c6e15f339ecd9aa51 ]
    
    Add device of Whale Peak.
    
    Output of sudo lspci -v  -s 00:14.7:
    
    00:14.7 Bluetooth: Intel Corporation Device e476
            Subsystem: Intel Corporation Device 0011
            Flags: bus master, fast devsel, latency 0, IRQ 16, IOMMU group 11
            Memory at 11011c30000 (64-bit, non-prefetchable) [size=16K]
            Capabilities: [c8] Power Management version 3
            Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
            Capabilities: [40] Express Root Complex Integrated Endpoint, MSI 00
            Capabilities: [80] MSI-X: Enable+ Count=32 Masked-
            Capabilities: [100] Latency Tolerance Reporting
            Kernel driver in use: btintel_pcie
            Kernel modules: btintel_pcie
    
    Signed-off-by: Kiran K <kiran.k@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: btusb: Add 2 HWIDs for MT7922 [+ + +]
Author: Jiande Lu <jiande.lu@mediatek.com>
Date:   Thu Feb 20 10:01:28 2025 +0800

    Bluetooth: btusb: Add 2 HWIDs for MT7922
    
    [ Upstream commit a88643b7e48506777e175e80c902c727ddd90851 ]
    
    Add below HWIDs for MediaTek MT7922 USB Bluetooth chip.
    VID 0x0489, PID 0xe152
    VID 0x0489, PID 0xe153
    
    Patch has been tested successfully and controller is recognized
    device pair successfully.
    
    MT7922 module bring up message as below.
    Bluetooth: Core ver 2.22
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Bluetooth: L2CAP socket layer initialized
    Bluetooth: SCO socket layer initialized
    Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20241106163512
    Bluetooth: hci0: Device setup in 2284925 usecs
    Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
    Bluetooth: hci0: AOSP extensions version v1.00
    Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    Bluetooth: BNEP filters: protocol multicast
    Bluetooth: BNEP socket layer initialized
    Bluetooth: MGMT ver 1.22
    Bluetooth: RFCOMM TTY layer initialized
    Bluetooth: RFCOMM socket layer initialized
    Bluetooth: RFCOMM ver 1.11
    
    Signed-off-by: Jiande Lu <jiande.lu@mediatek.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_qca: use the power sequencer for wcn6750 [+ + +]
Author: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
Date:   Thu Feb 20 16:59:45 2025 +0530

    Bluetooth: hci_qca: use the power sequencer for wcn6750
    
    [ Upstream commit 852cfdc7a5a5af54358325c1e0f490cc178d9664 ]
    
    Older boards are having entry "enable-gpios" in dts, we can safely assume
    latest boards which are supporting PMU node enrty will support power
    sequencer.
    
    Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_uart: Fix another race during initialization [+ + +]
Author: Arseniy Krasnov <avkrasnov@salutedevices.com>
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 <avkrasnov@salutedevices.com>
    Reported-by: syzbot+683f8cb11b94b1824c77@syzkaller.appspotmail.com
    Tested-by: syzbot+683f8cb11b94b1824c77@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-bluetooth/d159c57f-8490-4c26-79da-6ad3612c4a14@salutedevices.com/
    Fixes: 366ceff495f9 ("Bluetooth: hci_uart: fix race during initialization")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_uart: fix race during initialization [+ + +]
Author: Arseniy Krasnov <avkrasnov@salutedevices.com>
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 <avkrasnov@salutedevices.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: qca: simplify WCN399x NVM loading [+ + +]
Author: Dmitry Baryshkov <lumag@kernel.org>
Date:   Fri Feb 7 22:41:16 2025 +0200

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

 
bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags [+ + +]
Author: Willem de Bruijn <willemb@google.com>
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/20250122200402.3461154-1-maze@google.com/
    Link: https://elixir.bootlin.com/linux/2.4.4/source/net/core/filter.c#L244
    Reported-by: Matt Moeller <moeller.matt@gmail.com>
    Co-developed-by: Maciej Żenczykowski <maze@google.com>
    Signed-off-by: Maciej Żenczykowski <maze@google.com>
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://lore.kernel.org/r/20250408132833.195491-2-willemdebruijn.kernel@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

btrfs: harden block_group::bg_list against list_del() races [+ + +]
Author: Boris Burkov <boris@bur.io>
Date:   Wed Mar 5 15:16:57 2025 -0800

    btrfs: harden block_group::bg_list against list_del() races
    
    [ Upstream commit 7511e29cf1355b2c47d0effb39e463119913e2f6 ]
    
    As far as I can tell, these calls of list_del_init() on bg_list cannot
    run concurrently with btrfs_mark_bg_unused() or btrfs_mark_bg_to_reclaim(),
    as they are in transaction error paths and situations where the block
    group is readonly.
    
    However, if there is any chance at all of racing with mark_bg_unused(),
    or a different future user of bg_list, better to be safe than sorry.
    
    Otherwise we risk the following interleaving (bg_list refcount in parens)
    
    T1 (some random op)                       T2 (btrfs_mark_bg_unused)
                                            !list_empty(&bg->bg_list); (1)
    list_del_init(&bg->bg_list); (1)
                                            list_move_tail (1)
    btrfs_put_block_group (0)
                                            btrfs_delete_unused_bgs
                                                 bg = list_first_entry
                                                 list_del_init(&bg->bg_list);
                                                 btrfs_put_block_group(bg); (-1)
    
    Ultimately, this results in a broken ref count that hits zero one deref
    early and the real final deref underflows the refcount, resulting in a WARNING.
    
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Boris Burkov <boris@bur.io>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: tests: fix chunk map leak after failure to add it to the tree [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Tue Mar 11 15:50:50 2025 +0000

    btrfs: tests: fix chunk map leak after failure to add it to the tree
    
    commit 009ca358486ded9b4822eddb924009b6848d7271 upstream.
    
    If we fail to add the chunk map to the fs mapping tree we exit
    test_rmap_block() without freeing the chunk map. Fix this by adding a
    call to btrfs_free_chunk_map() before exiting the test function if the
    call to btrfs_add_chunk_map() failed.
    
    Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps")
    CC: stable@vger.kernel.org # 6.12+
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: zoned: fix zone activation with missing devices [+ + +]
Author: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Date:   Mon Mar 17 12:24:58 2025 +0100

    btrfs: zoned: fix zone activation with missing devices
    
    commit 2bbc4a45e5eb6b868357c1045bf6f38f6ba576e0 upstream.
    
    If btrfs_zone_activate() is called with a filesystem that has missing
    devices (e.g. a RAID file system mounted in degraded mode) it is accessing
    the btrfs_device::zone_info pointer, which will not be set if the device in
    question is missing.
    
    Check if the device is present (by checking if it has a valid block
    device pointer associated) and if not, skip zone activation for it.
    
    Fixes: f9a912a3c45f ("btrfs: zoned: make zone activation multi stripe capable")
    CC: stable@vger.kernel.org # 6.1+
    Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
    Reviewed-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: zoned: fix zone finishing with missing devices [+ + +]
Author: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Date:   Mon Mar 17 12:24:59 2025 +0100

    btrfs: zoned: fix zone finishing with missing devices
    
    commit 35fec1089ebb5617f85884d3fa6a699ce6337a75 upstream.
    
    If do_zone_finish() is called with a filesystem that has missing devices
    (e.g. a RAID file system mounted in degraded mode) it is accessing the
    btrfs_device::zone_info pointer, which will not be set if the device
    in question is missing.
    
    Check if the device is present (by checking if it has a valid block device
    pointer associated) and if not, skip zone finishing for it.
    
    Fixes: 4dcbb8ab31c1 ("btrfs: zoned: make zone finishing multi stripe capable")
    CC: stable@vger.kernel.org # 6.1+
    Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
    Reviewed-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bus: mhi: host: Fix race between unprepare and queue_buf [+ + +]
Author: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
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: stable@vger.kernel.org # 6.8
    Fixes: b89b6a863dd5 ("bus: mhi: host: Add spinlock to protect WP access when queueing TREs")
    Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
    Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
    Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
    Reviewed-by: Youssef Samir <quic_yabdulra@quicinc.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Troy Hanson <quic_thanson@quicinc.com>
    Link: https://lore.kernel.org/r/20250306172913.856982-1-jeff.hugo@oss.qualcomm.com
    [mani: added stable tag]
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
can: flexcan: add NXP S32G2/S32G3 SoC support [+ + +]
Author: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Date:   Mon Jan 13 14:07:04 2025 +0200

    can: flexcan: add NXP S32G2/S32G3 SoC support
    
    [ Upstream commit 8503a4b1a24d32e95f3a233062e8f1dc0b2052bd ]
    
    Add device type data for S32G2/S32G3 SoC.
    
    FlexCAN module from S32G2/S32G3 is similar with i.MX SoCs, but interrupt
    management is different.
    
    On S32G2/S32G3 SoC, there are separate interrupts for state change, bus
    errors, Mailboxes 0-7 and Mailboxes 8-127 respectively.
    In order to handle this FlexCAN hardware particularity, first reuse the
    'FLEXCAN_QUIRK_NR_IRQ_3' quirk provided by mcf5441x's irq handling
    support. Secondly, use the newly introduced
    'FLEXCAN_QUIRK_SECONDARY_MB_IRQ' quirk which handles the case where two
    separate mailbox ranges are controlled by independent hardware interrupt
    lines.
    
    Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
    Link: https://patch.msgid.link/20250113120704.522307-4-ciprianmarian.costea@oss.nxp.com
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

can: flexcan: Add quirk to handle separate interrupt lines for mailboxes [+ + +]
Author: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Date:   Mon Jan 13 14:07:03 2025 +0200

    can: flexcan: Add quirk to handle separate interrupt lines for mailboxes
    
    [ Upstream commit 8c652cf030a769fbfc73cfc280ed3f1656343c35 ]
    
    Introduce 'FLEXCAN_QUIRK_SECONDARY_MB_IRQ' quirk to handle a FlexCAN
    hardware module integration particularity where two ranges of mailboxes
    are controlled by separate hardware interrupt lines.
    The same 'flexcan_irq' handler is used for both separate mailbox interrupt
    lines, with no other changes.
    
    Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
    Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
    Link: https://patch.msgid.link/20250113120704.522307-3-ciprianmarian.costea@oss.nxp.com
    [mkl: flexcan_open(): change order and free irq_secondary_mb first]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk [+ + +]
Author: Philipp Hahn <phahn-oss@avm.de>
Date:   Mon Mar 10 11:17:35 2025 +0100

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

 
cgroup/cpuset: Enforce at most one rebuild_sched_domains_locked() call per operation [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sat Nov 9 21:50:22 2024 -0500

    cgroup/cpuset: Enforce at most one rebuild_sched_domains_locked() call per operation
    
    [ Upstream commit a040c351283e3ac75422621ea205b1d8d687e108 ]
    
    Since commit ff0ce721ec21 ("cgroup/cpuset: Eliminate unncessary
    sched domains rebuilds in hotplug"), there is only one
    rebuild_sched_domains_locked() call per hotplug operation. However,
    writing to the various cpuset control files may still casue more than
    one rebuild_sched_domains_locked() call to happen in some cases.
    
    Juri had found that two rebuild_sched_domains_locked() calls in
    update_prstate(), one from update_cpumasks_hier() and another one from
    update_partition_sd_lb() could cause cpuset partition to be created
    with null total_bw for DL tasks. IOW, DL tasks may not be scheduled
    correctly in such a partition.
    
    A sample command sequence that can reproduce null total_bw is as
    follows.
    
      # echo Y >/sys/kernel/debug/sched/verbose
      # echo +cpuset >/sys/fs/cgroup/cgroup.subtree_control
      # mkdir /sys/fs/cgroup/test
      # echo 0-7 > /sys/fs/cgroup/test/cpuset.cpus
      # echo 6-7 > /sys/fs/cgroup/test/cpuset.cpus.exclusive
      # echo root >/sys/fs/cgroup/test/cpuset.cpus.partition
    
    Fix this double rebuild_sched_domains_locked() calls problem
    by replacing existing calls with cpuset_force_rebuild() except
    the rebuild_sched_domains_cpuslocked() call at the end of
    cpuset_handle_hotplug(). Checking of the force_sd_rebuild flag is
    now done at the end of cpuset_write_resmask() and update_prstate()
    to determine if rebuild_sched_domains_locked() should be called or not.
    
    The cpuset v1 code can still call rebuild_sched_domains_locked()
    directly as double rebuild_sched_domains_locked() calls is not possible.
    
    Reported-by: Juri Lelli <juri.lelli@redhat.com>
    Closes: https://lore.kernel.org/lkml/ZyuUcJDPBln1BK1Y@jlelli-thinkpadt14gen4.remote.csb/
    Signed-off-by: Waiman Long <longman@redhat.com>
    Tested-by: Juri Lelli <juri.lelli@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Stable-dep-of: a22b3d54de94 ("cgroup/cpuset: Fix race between newly created partition and dying one")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cgroup/cpuset: Fix error handling in remote_partition_disable() [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sun Mar 30 17:52:41 2025 -0400

    cgroup/cpuset: Fix error handling in remote_partition_disable()
    
    [ Upstream commit 8bf450f3aec3d1bbd725d179502c64b8992588e4 ]
    
    When remote_partition_disable() is called to disable a remote partition,
    it always sets the partition to an invalid partition state. It should
    only do so if an error code (prs_err) has been set. Correct that and
    add proper error code in places where remote_partition_disable() is
    called due to error.
    
    Fixes: 181c8e091aae ("cgroup/cpuset: Introduce remote partition")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cgroup/cpuset: Fix incorrect isolated_cpus update in update_parent_effective_cpumask() [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sun Mar 30 17:52:40 2025 -0400

    cgroup/cpuset: Fix incorrect isolated_cpus update in update_parent_effective_cpumask()
    
    [ Upstream commit 668e041662e92ab3ebcb9eb606d3ec01884546ab ]
    
    Before commit f0af1bfc27b5 ("cgroup/cpuset: Relax constraints to
    partition & cpus changes"), a cpuset partition cannot be enabled if not
    all the requested CPUs can be granted from the parent cpuset. After
    that commit, a cpuset partition can be created even if the requested
    exclusive CPUs contain CPUs not allowed its parent.  The delmask
    containing exclusive CPUs to be removed from its parent wasn't
    adjusted accordingly.
    
    That is not a problem until the introduction of a new isolated_cpus
    mask in commit 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in
    isolated partitions") as the CPUs in the delmask may be added directly
    into isolated_cpus.
    
    As a result, isolated_cpus may incorrectly contain CPUs that are not
    isolated leading to incorrect data reporting. Fix this by adjusting
    the delmask to reflect the actual exclusive CPUs for the creation of
    the partition.
    
    Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cgroup/cpuset: Fix race between newly created partition and dying one [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sun Mar 30 17:52:39 2025 -0400

    cgroup/cpuset: Fix race between newly created partition and dying one
    
    [ Upstream commit a22b3d54de94f82ca057cc2ebf9496fa91ebf698 ]
    
    There is a possible race between removing a cgroup diectory that is
    a partition root and the creation of a new partition.  The partition
    to be removed can be dying but still online, it doesn't not currently
    participate in checking for exclusive CPUs conflict, but the exclusive
    CPUs are still there in subpartitions_cpus and isolated_cpus. These
    two cpumasks are global states that affect the operation of cpuset
    partitions. The exclusive CPUs in dying cpusets will only be removed
    when cpuset_css_offline() function is called after an RCU delay.
    
    As a result, it is possible that a new partition can be created with
    exclusive CPUs that overlap with those of a dying one. When that dying
    partition is finally offlined, it removes those overlapping exclusive
    CPUs from subpartitions_cpus and maybe isolated_cpus resulting in an
    incorrect CPU configuration.
    
    This bug was found when a warning was triggered in
    remote_partition_disable() during testing because the subpartitions_cpus
    mask was empty.
    
    One possible way to fix this is to iterate the dying cpusets as well and
    avoid using the exclusive CPUs in those dying cpusets. However, this
    can still cause random partition creation failures or other anomalies
    due to racing. A better way to fix this race is to reset the partition
    state at the moment when a cpuset is being killed.
    
    Introduce a new css_killed() CSS function pointer and call it, if
    defined, before setting CSS_DYING flag in kill_css(). Also update the
    css_is_dying() helper to use the CSS_DYING flag introduced by commit
    33c35aa48178 ("cgroup: Prevent kill_css() from being called more than
    once") for proper synchronization.
    
    Add a new cpuset_css_killed() function to reset the partition state of
    a valid partition root if it is being killed.
    
    Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cgroup/cpuset: Further optimize code if CONFIG_CPUSETS_V1 not set [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sat Nov 9 21:50:23 2024 -0500

    cgroup/cpuset: Further optimize code if CONFIG_CPUSETS_V1 not set
    
    [ Upstream commit c4c9cebe2fb9cdc73e55513de7af7a4f50260e88 ]
    
    Currently the cpuset code uses group_subsys_on_dfl() to check if we
    are running with cgroup v2. If CONFIG_CPUSETS_V1 isn't set, there is
    really no need to do this check and we can optimize out some of the
    unneeded v1 specific code paths. Introduce a new cpuset_v2() and use it
    to replace the cgroup_subsys_on_dfl() check to further optimize the
    code.
    
    Signed-off-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Stable-dep-of: a22b3d54de94 ("cgroup/cpuset: Fix race between newly created partition and dying one")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cgroup/cpuset: Revert "Allow suppression of sched domain rebuild in update_cpumasks_hier()" [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Sat Nov 9 21:50:21 2024 -0500

    cgroup/cpuset: Revert "Allow suppression of sched domain rebuild in update_cpumasks_hier()"
    
    [ Upstream commit bcd7012afd7bcd45fcd7a0e2f48e57b273702317 ]
    
    Revert commit 3ae0b773211e ("cgroup/cpuset: Allow suppression of sched
    domain rebuild in update_cpumasks_hier()") to allow for an alternative
    way to suppress unnecessary rebuild_sched_domains_locked() calls in
    update_cpumasks_hier() and elsewhere in a following commit.
    
    Signed-off-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Stable-dep-of: a22b3d54de94 ("cgroup/cpuset: Fix race between newly created partition and dying one")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cifs: avoid NULL pointer dereference in dbg call [+ + +]
Author: Alexandra Diupina <adiupina@astralinux.ru>
Date:   Wed Mar 19 17:28:58 2025 +0300

    cifs: avoid NULL pointer dereference in dbg call
    
    commit b4885bd5935bb26f0a414ad55679a372e53f9b9b upstream.
    
    cifs_server_dbg() implies server to be non-NULL so
    move call under condition to avoid NULL pointer dereference.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: e79b0332ae06 ("cifs: ignore cached share root handle closing errors")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

cifs: fix integer overflow in match_server() [+ + +]
Author: Roman Smirnov <r.smirnov@omp.ru>
Date:   Mon Mar 31 11:22:49 2025 +0300

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

 
CIFS: Propagate min offload along with other parameters from primary to secondary channels. [+ + +]
Author: Aman <aman1@microsoft.com>
Date:   Thu Mar 6 17:46:43 2025 +0000

    CIFS: Propagate min offload along with other parameters from primary to secondary channels.
    
    commit 1821e90be08e7d4a54cd167dd818d80d06e064e9 upstream.
    
    In a multichannel setup, it was observed that a few fields were not being
    copied over to the secondary channels, which impacted performance in cases
    where these options were relevant but not properly synchronized. To address
    this, this patch introduces copying the following parameters from the
    primary channel to the secondary channels:
    
    - min_offload
    - compression.requested
    - dfs_conn
    - ignore_signature
    - leaf_fullpath
    - noblockcnt
    - retrans
    - sign
    
    By copying these parameters, we ensure consistency across channels and
    prevent performance degradation due to missing or outdated settings.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Aman <aman1@microsoft.com>
    Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    clk: qcom: clk-branch: Fix invert halt status bit check for votable clocks
    
    commit 5eac348182d2b5ed1066459abedb7bc6b5466f81 upstream.
    
    BRANCH_HALT_ENABLE and BRANCH_HALT_ENABLE_VOTED flags are used to check
    halt status of branch clocks, which have an inverted logic for the halt
    bit in CBCR register. However, the current logic in the _check_halt()
    method only compares the BRANCH_HALT_ENABLE flags, ignoring the votable
    branch clocks.
    
    Update the logic to correctly handle the invert logic for votable clocks
    using the BRANCH_HALT_ENABLE_VOTED flags.
    
    Fixes: 9092d1083a62 ("clk: qcom: branch: Extend the invert logic for branch2 clocks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ajit Pandey <quic_ajipan@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20250128-push_fix-v1-1-fafec6747881@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code [+ + +]
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Fri Jan 17 13:54:08 2025 +0000

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

clk: qcom: gdsc: Release pm subdomains in reverse add order [+ + +]
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Fri Jan 17 13:54:07 2025 +0000

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

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

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

clk: renesas: r9a07g043: Fix HP clock source for RZ/Five [+ + +]
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Date:   Mon Jan 27 17:31:59 2025 +0000

    clk: renesas: r9a07g043: Fix HP clock source for RZ/Five
    
    commit 7f22a298d926664b51fcfe2f8ea5feb7f8b79952 upstream.
    
    According to the Rev.1.20 hardware manual for the RZ/Five SoC, the clock
    source for HP is derived from PLL6 divided by 2.  Correct the
    implementation by configuring HP as a fixed clock source instead of a
    MUX.
    
    The `CPG_PL6_ETH_SSEL' register, which is available on the RZ/G2UL SoC,
    is not present on the RZ/Five SoC, necessitating this change.
    
    Fixes: 95d48d270305ad2c ("clk: renesas: r9a07g043: Add support for RZ/Five SoC")
    Cc: stable@vger.kernel.org
    Reported-by: Hien Huynh <hien.huynh.px@renesas.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://lore.kernel.org/20250127173159.34572-1-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup [+ + +]
Author: Alexandre Torgue <alexandre.torgue@foss.st.com>
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: stable@vger.kernel.org
    Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
    Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
    Rule: add
    Link: https://lore.kernel.org/stable/20250306083407.2374894-1-fabrice.gasnier%40foss.st.com
    Link: https://lore.kernel.org/r/20250306102501.2980153-1-fabrice.gasnier@foss.st.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()
    
    [ Upstream commit 342debc12183b51773b3345ba267e9263bdfaaef ]
    
    After making all ->qlen_notify() callbacks idempotent, now it is safe to
    remove the check of qlen!=0 from both fq_codel_dequeue() and
    codel_qdisc_dequeue().
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Fixes: 4b549a2ef4be ("fq_codel: Fair Queue Codel AQM")
    Fixes: 76e3cc126bb2 ("codel: Controlled Delay AQM")
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250403211636.166257-1-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
crypto: ccp - Fix check for the primary ASP device [+ + +]
Author: Tom Lendacky <thomas.lendacky@amd.com>
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: stable@vger.kernel.org
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp - Fix uAPI definitions of PSP errors [+ + +]
Author: Dionna Glaze <dionnaglaze@google.com>
Date:   Sat Mar 8 12:10:28 2025 +1100

    crypto: ccp - Fix uAPI definitions of PSP errors
    
    commit b949f55644a6d1645c0a71f78afabf12aec7c33b upstream.
    
    Additions to the error enum after explicit 0x27 setting for
    SEV_RET_INVALID_KEY leads to incorrect value assignments.
    
    Use explicit values to match the manufacturer specifications more
    clearly.
    
    Fixes: 3a45dc2b419e ("crypto: ccp: Define the SEV-SNP commands")
    CC: stable@vger.kernel.org
    Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dlm: fix error if active rsb is not hashed [+ + +]
Author: Alexander Aring <aahringo@redhat.com>
Date:   Fri Feb 28 17:48:51 2025 -0500

    dlm: fix error if active rsb is not hashed
    
    commit a3672304abf2a847ac0c54c84842c64c5bfba279 upstream.
    
    If an active rsb is not hashed anymore and this could occur because we
    releases and acquired locks we need to signal the followed code that
    the lookup failed. Since the lookup was successful, but it isn't part of
    the rsb hash anymore we need to signal it by setting error to -EBADR as
    dlm_search_rsb_tree() does it.
    
    Cc: stable@vger.kernel.org
    Fixes: 5be323b0c64d ("dlm: move dlm_search_rsb_tree() out of lock")
    Signed-off-by: Alexander Aring <aahringo@redhat.com>
    Signed-off-by: David Teigland <teigland@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dlm: fix error if inactive rsb is not hashed [+ + +]
Author: Alexander Aring <aahringo@redhat.com>
Date:   Fri Feb 28 17:48:50 2025 -0500

    dlm: fix error if inactive rsb is not hashed
    
    commit 94e6e889a786dd16542fc8f2a45405fa13e3bbb5 upstream.
    
    If an inactive rsb is not hashed anymore and this could occur because we
    releases and acquired locks we need to signal the followed code that the
    lookup failed. Since the lookup was successful, but it isn't part of the
    rsb hash anymore we need to signal it by setting error to -EBADR as
    dlm_search_rsb_tree() does it.
    
    Cc: stable@vger.kernel.org
    Fixes: 01fdeca1cc2d ("dlm: use rcu to avoid an extra rsb struct lookup")
    Signed-off-by: Alexander Aring <aahringo@redhat.com>
    Signed-off-by: David Teigland <teigland@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-ebs: fix prefetch-vs-suspend race [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Mar 28 16:19:07 2025 +0100

    dm-ebs: fix prefetch-vs-suspend race
    
    commit 9c565428788fb9b49066f94ab7b10efc686a0a4c upstream.
    
    There's a possible race condition in dm-ebs - dm bufio prefetch may be in
    progress while the device is suspended. Fix this by calling
    dm_bufio_client_reset in the postsuspend hook.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-integrity: fix non-constant-time tag verification [+ + +]
Author: Jo Van Bulck <jo.vanbulck@kuleuven.be>
Date:   Fri Mar 28 16:04:47 2025 +0100

    dm-integrity: fix non-constant-time tag verification
    
    commit 8bde1033f9cfc1c08628255cc434c6cf39c9d9ba upstream.
    
    When using dm-integrity in standalone mode with a keyed hmac algorithm,
    integrity tags are calculated and verified internally.
    
    Using plain memcmp to compare the stored and computed tags may leak the
    position of the first byte mismatch through side-channel analysis,
    allowing to brute-force expected tags in linear time (e.g., by counting
    single-stepping interrupts in confidential virtual machine environments).
    
    Co-developed-by: Luca Wilke <work@luca-wilke.com>
    Signed-off-by: Luca Wilke <work@luca-wilke.com>
    Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dm-integrity: set ti->error on memory allocation failure [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
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 <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-verity: fix prefetch-vs-suspend race [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Mar 28 16:17:45 2025 +0100

    dm-verity: fix prefetch-vs-suspend race
    
    commit 2de510fccbca3d1906b55f4be5f1de83fa2424ef upstream.
    
    There's a possible race condition in dm-verity - the prefetch work item
    may race with suspend and it is possible that prefetch continues to run
    while the device is suspended. Fix this by calling flush_workqueue and
    dm_bufio_client_reset in the postsuspend hook.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drivers: base: devres: Allow to release group on device release [+ + +]
Author: Lucas De Marchi <lucas.demarchi@intel.com>
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 <gregkh@linuxfoundation.org>
    Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250222001051.3012936-2-lucas.demarchi@intel.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: stop DML2 from removing pipes based on planes [+ + +]
Author: Mike Katsnelson <mike.katsnelson@amd.com>
Date:   Thu Feb 13 11:52:32 2025 -0500

    drm/amd/display: stop DML2 from removing pipes based on planes
    
    [ Upstream commit 8adeff83a3b07fa6d0958ed51e1b38ba7469e448 ]
    
    [Why]
    Transitioning from low to high resolutions at high refresh rates caused grey corruption.
    During the transition state, there is a period where plane size is based on low resultion
    state and ODM slices are based on high resoultion state, causing the entire plane to be
    contained in one ODM slice. DML2 would turn off the pipe for the ODM slice with no plane,
    causing an underflow since the pixel rate for the higher resolution cannot be supported on
    one pipe. This change stops DML2 from turning off pipes that are mapped to an ODM slice
    with no plane. This is possible to do without negative consequences because pipes can now
    take the minimum viewport and draw with zero recout size, removing the need to have the
    pipe turned off.
    
    [How]
    In map_pipes_from_plane(), remove "check" that skips ODM slices that are not covered by
    the plane. This prevents the pipes for those ODM slices from being freed.
    
    Reviewed-by: Ovidiu Bunea <ovidiu.bunea@amd.com>
    Signed-off-by: Mike Katsnelson <mike.katsnelson@amd.com>
    Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Update Cursor request mode to the beginning prefetch always [+ + +]
Author: Zhikai Zhai <zhikai.zhai@amd.com>
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 <nicholas.kazlauskas@amd.com>
    Signed-off-by: Zhikai Zhai <zhikai.zhai@amd.com>
    Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amdgpu: Fix the race condition for draining retry fault [+ + +]
Author: Emily Deng <Emily.Deng@amd.com>
Date:   Thu Mar 6 08:40:01 2025 +0800

    drm/amdgpu: Fix the race condition for draining retry fault
    
    [ Upstream commit f844732e3ad9c4b78df7436232949b8d2096d1a6 ]
    
    Issue:
    In the scenario where svm_range_restore_pages is called, but
    svm->checkpoint_ts has not been set and the retry fault has not been
    drained, svm_range_unmap_from_cpu is triggered and calls svm_range_free.
    Meanwhile, svm_range_restore_pages continues execution and reaches
    svm_range_from_addr. This results in a "failed to find prange..." error,
     causing the page recovery to fail.
    
    How to fix:
    Move the timestamp check code under the protection of svm->lock.
    
    v2:
    Make sure all right locks are released before go out.
    
    v3:
    Directly goto out_unlock_svms, and return -EAGAIN.
    
    v4:
    Refine code.
    
    Signed-off-by: Emily Deng <Emily.Deng@amd.com>
    Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

    drm/amdgpu: grab an additional reference on the gang fence v2
    
    [ Upstream commit 0d9a95099dcb05b5f4719c830d15bf4fdcad0dc2 ]
    
    We keep the gang submission fence around in adev, make sure that it
    stays alive.
    
    v2: fix memory leak on retry
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Acked-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Thu Mar 6 15:51:48 2025 +0800

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

drm/amdgpu: Unlocked unmap only clear page table leaves [+ + +]
Author: Philip Yang <Philip.Yang@amd.com>
Date:   Tue Jan 14 09:53:13 2025 -0500

    drm/amdgpu: Unlocked unmap only clear page table leaves
    
    [ Upstream commit 23b645231eeffdaf44021debac881d2f26824150 ]
    
    SVM migration unmap pages from GPU and then update mapping to GPU to
    recover page fault. Currently unmap clears the PDE entry for range
    length >= huge page and free PTB bo, update mapping to alloc new PT bo.
    There is race bug that the freed entry bo maybe still on the pt_free
    list, reused when updating mapping and then freed, leave invalid PDE
    entry and cause GPU page fault.
    
    By setting the update to clear only one PDE entry or clear PTB, to
    avoid unmap to free PTE bo. This fixes the race bug and improve the
    unmap and map to GPU performance. Update mapping to huge page will
    still free the PTB bo.
    
    With this change, the vm->pt_freed list and work is not needed. Add
    WARN_ON(unlocked) in amdgpu_vm_pt_free_dfs to catch if unmap to free the
    PTB.
    
    Signed-off-by: Philip Yang <Philip.Yang@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amdkfd: clamp queue size to minimum [+ + +]
Author: David Yat Sin <David.YatSin@amd.com>
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 <David.YatSin@amd.com>
    Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
    Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

drm/amdkfd: Fix pqm_destroy_queue race with GPU reset [+ + +]
Author: Philip Yang <Philip.Yang@amd.com>
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 <Philip.Yang@amd.com>
    Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/bridge: panel: forbid initializing a panel with unknown connector type [+ + +]
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
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 <dmitry.baryshkov@linaro.org>
    Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Signed-off-by: Robert Foss <rfoss@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250214-drm-assorted-cleanups-v7-5-88ca5827d7af@bootlin.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/debugfs: fix printk format for bridge index [+ + +]
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
Date:   Fri Feb 14 13:57:40 2025 +0100

    drm/debugfs: fix printk format for bridge index
    
    [ Upstream commit 72443c730b7a7b5670a921ea928e17b9b99bd934 ]
    
    idx is an unsigned int, use %u for printk-style strings.
    
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Signed-off-by: Robert Foss <rfoss@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250214-drm-assorted-cleanups-v7-1-88ca5827d7af@bootlin.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915/huc: Fix fence not released on early probe errors [+ + +]
Author: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Date:   Wed Apr 2 19:20:57 2025 +0200

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

 
drm/i915: Disable RPG during live selftest [+ + +]
Author: Badal Nilawar <badal.nilawar@intel.com>
Date:   Mon Mar 10 20:58:21 2025 +0530

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

 
drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
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 <ck.hu@mediatek.com>
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/20250217154836.108895-10-angelogioacchino.delregno@collabora.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Mon Feb 17 16:47:59 2025 +0100

    drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
    
    [ Upstream commit c90876a695dd83e76680b88b40067275a5982811 ]
    
    In preparation for adding support for MT8195's HDMI reserved DPI
    instance, move the input_2p_en bit for DP_INTF to platform data.
    
    While at it, remove the input_2pixel member from platform data as
    having this bit implies that the 2pixel feature must be enabled.
    
    Reviewed-by: CK Hu <ck.hu@mediatek.com>
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/20250217154836.108895-7-angelogioacchino.delregno@collabora.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/tests: cmdline: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <mripard@kernel.org>
Date:   Tue Apr 8 09:34:10 2025 +0200

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

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

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

drm/tests: modes: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <mripard@kernel.org>
Date:   Tue Apr 8 09:34:11 2025 +0200

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

drm/tests: modeset: Fix drm_display_mode memory leak [+ + +]
Author: Maxime Ripard <mripard@kernel.org>
Date:   Tue Apr 8 09:34:08 2025 +0200

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

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

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

 
drm/xe/bmg: Add new PCI IDs [+ + +]
Author: Shekhar Chauhan <shekhar.chauhan@intel.com>
Date:   Tue Jan 28 21:50:15 2025 +0530

    drm/xe/bmg: Add new PCI IDs
    
    [ Upstream commit fa8ffaae1b15236b8afb0fbbc04117ff7c900a83 ]
    
    Add 3 new PCI IDs for BMG.
    
    v2: Fix typo -> Replace '.' with ','
    
    Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
    Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250128162015.3288675-1-shekhar.chauhan@intel.com
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/hw_engine: define sysfs_ops on all directories [+ + +]
Author: Tejas Upadhyay <tejas.upadhyay@intel.com>
Date:   Thu Mar 27 17:56:47 2025 +0530

    drm/xe/hw_engine: define sysfs_ops on all directories
    
    [ Upstream commit a5c71fd5b69b9da77e5e0b268e69e256932ba49c ]
    
    Sysfs_ops needs to be defined on all directories which
    can have attr files with set/get method. Add sysfs_ops
    to even those directories which is currently empty but
    would have attr files with set/get method in future.
    Leave .default with default sysfs_ops as it will never
    have setter method.
    
    V2(Himal/Rodrigo):
     - use single sysfs_ops for all dir and attr with set/get
     - add default ops as ./default does not need runtime pm at all
    
    Fixes: 3f0e14651ab0 ("drm/xe: Runtime PM wake on every sysfs call")
    Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250327122647.886637-1-tejas.upadhyay@intel.com
    Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
    (cherry picked from commit 40780b9760b561e093508d07b8b9b06c94ab201e)
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/vf: Don't try to trigger a full GT reset if VF [+ + +]
Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
Date:   Fri Jan 31 19:25:02 2025 +0100

    drm/xe/vf: Don't try to trigger a full GT reset if VF
    
    [ Upstream commit 459777724d306315070d24608fcd89aea85516d6 ]
    
    VFs don't have access to the GDRST(0x941c) register that driver
    uses to reset a GT. Attempt to trigger a reset using debugfs:
    
     $ cat /sys/kernel/debug/dri/0000:00:02.1/gt0/force_reset
    
    or due to a hang condition detected by the driver leads to:
    
     [ ] xe 0000:00:02.1: [drm] GT0: trying reset from force_reset [xe]
     [ ] xe 0000:00:02.1: [drm] GT0: reset queued
     [ ] xe 0000:00:02.1: [drm] GT0: reset started
     [ ] ------------[ cut here ]------------
     [ ] xe 0000:00:02.1: [drm] GT0: VF is trying to write 0x1 to an inaccessible register 0x941c+0x0
     [ ] WARNING: CPU: 3 PID: 3069 at drivers/gpu/drm/xe/xe_gt_sriov_vf.c:996 xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
     [ ] RIP: 0010:xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
     [ ] Call Trace:
     [ ]  <TASK>
     [ ]  ? show_regs+0x6c/0x80
     [ ]  ? __warn+0x93/0x1c0
     [ ]  ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
     [ ]  ? report_bug+0x182/0x1b0
     [ ]  ? handle_bug+0x6e/0xb0
     [ ]  ? exc_invalid_op+0x18/0x80
     [ ]  ? asm_exc_invalid_op+0x1b/0x20
     [ ]  ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
     [ ]  ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
     [ ]  ? xe_gt_tlb_invalidation_reset+0xef/0x110 [xe]
     [ ]  ? __mutex_unlock_slowpath+0x41/0x2e0
     [ ]  xe_mmio_write32+0x64/0x150 [xe]
     [ ]  do_gt_reset+0x2f/0xa0 [xe]
     [ ]  gt_reset_worker+0x14e/0x1e0 [xe]
     [ ]  process_one_work+0x21c/0x740
     [ ]  worker_thread+0x1db/0x3c0
    
    Fix that by sending H2G VF_RESET(0x5507) action instead.
    
    Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4078
    Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250131182502.852-1-michal.wajdeczko@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/xelp: Move Wa_16011163337 from tunings to workarounds [+ + +]
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Date:   Thu Feb 27 10:13:01 2025 +0000

    drm/xe/xelp: Move Wa_16011163337 from tunings to workarounds
    
    [ Upstream commit d9b5d83c5a4d720af6ddbefe2825c78f0325a3fd ]
    
    Workaround database specifies 16011163337 as a workaround so lets move it
    there.
    
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
    Cc: Lucas De Marchi <lucas.demarchi@intel.com>
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Cc: Gustavo Sousa <gustavo.sousa@intel.com>
    Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250227101304.46660-3-tvrtko.ursulin@igalia.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm: allow encoder mode_set even when connectors change for crtc [+ + +]
Author: Abhinav Kumar <quic_abhinavk@quicinc.com>
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 <quic_abhinavk@quicinc.com>
    Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241211-abhinavk-modeset-fix-v3-1-0de4bf3e7c32@quicinc.com
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm: panel-orientation-quirks: Add new quirk for GPD Win 2 [+ + +]
Author: Andrew Wyatt <fewtarius@steamfork.org>
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 <fewtarius@steamfork.org>
    Signed-off-by: John Edwards <uejji@uejji.net>
    Tested-by: Paco Avelar <pacoavelar@hotmail.com>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250213222455.93533-5-uejji@uejji.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

    drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
    
    [ Upstream commit 132c89ef8872e602cfb909377815111d121fe8d7 ]
    
    The AYANEO Slide uses a 1080x1920 portrait LCD panel.  This is the same
    panel used on the AYANEO Air Plus, but the DMI data is too different to
    match both with one entry.
    
    Add a DMI match to correctly rotate the panel on the AYANEO Slide.
    
    This also covers the Antec Core HS, which is a rebranded AYANEO Slide with
    the exact same hardware and DMI strings.
    
    Signed-off-by: Andrew Wyatt <fewtarius@steamfork.org>
    Signed-off-by: John Edwards <uejji@uejji.net>
    Tested-by: John Edwards <uejji@uejji.net>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250213222455.93533-4-uejji@uejji.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

    drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
    
    [ Upstream commit b24dcc183583fc360ae0f0899e286a68f46abbd0 ]
    
    The Intel model of the OneXPlayer Mini uses a 1200x1920 portrait LCD panel.
    The DMI strings are the same as the OneXPlayer, which already has a DMI
    quirk, but the panel is different.
    
    Add a DMI match to correctly rotate this panel.
    
    Signed-off-by: Andrew Wyatt <fewtarius@steamfork.org>
    Co-developed-by: John Edwards <uejji@uejji.net>
    Signed-off-by: John Edwards <uejji@uejji.net>
    Tested-by: João Pedro Kurtz <joexkurtz@gmail.com>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250213222455.93533-6-uejji@uejji.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

    drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
    
    [ Upstream commit 529741c331da1fbf54f86c6ec3a4558b9b0b16dc ]
    
    The AYA NEO Flip DS and KB both use a 1080x1920 portrait LCD panel.  The
    Flip DS additionally uses a 640x960 portrait LCD panel as a second display.
    
    Add DMI matches to correctly rotate these panels.
    
    Signed-off-by: Andrew Wyatt <fewtarius@steamfork.org>
    Co-developed-by: John Edwards <uejji@uejji.net>
    Signed-off-by: John Edwards <uejji@uejji.net>
    Tested-by: Paco Avelar <pacoavelar@hotmail.com>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250213222455.93533-3-uejji@uejji.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm: panel-orientation-quirks: Add support for AYANEO 2S [+ + +]
Author: Andrew Wyatt <fewtarius@steamfork.org>
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 <fewtarius@steamfork.org>
    Signed-off-by: John Edwards <uejji@uejji.net>
    Tested-by: John Edwards <uejji@uejji.net>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250213222455.93533-2-uejji@uejji.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dt-bindings: coresight: qcom,coresight-tpda: Fix too many 'reg' [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Wed Feb 26 12:29:13 2025 +0100

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

dt-bindings: coresight: qcom,coresight-tpdm: Fix too many 'reg' [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Wed Feb 26 12:29:14 2025 +0100

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

dt-bindings: media: st,stmipid02: correct lane-polarities maxItems [+ + +]
Author: Alain Volmat <alain.volmat@foss.st.com>
Date:   Mon Feb 10 11:04:31 2025 +0100

    dt-bindings: media: st,stmipid02: correct lane-polarities maxItems
    
    commit 3a544a39e0a4c492e3026dfbed018321d2bd6caa upstream.
    
    The MIPID02 can use up to 2 data lanes which leads to having a maximum
    item number of 3 for the lane-polarities since this also contains the
    clock lane.
    
    CC: stable@vger.kernel.org
    Fixes: c2741cbe7f8a ("dt-bindings: media: st,stmipid02: Convert the text bindings to YAML")
    Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
    Acked-by: Conor Dooley <conor.dooley@microchip.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
erofs: set error to bio if file-backed IO fails [+ + +]
Author: Sheng Yong <shengyong1@xiaomi.com>
Date:   Tue Apr 8 20:23:50 2025 +0800

    erofs: set error to bio if file-backed IO fails
    
    [ Upstream commit 1595f15391b81815e4ef91c339991913d556c1b6 ]
    
    If a file-backed IO fails before submitting the bio to the lower
    filesystem, an error is returned, but the bio->bi_status is not
    marked as an error. However, the error information should be passed
    to the end_io handler. Otherwise, the IO request will be treated as
    successful.
    
    Fixes: 283213718f5d ("erofs: support compressed inodes for fileio")
    Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
    Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20250408122351.2104507-1-shengyong1@xiaomi.com
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ext4: don't treat fhandle lookup of ea_inode as FS corruption [+ + +]
Author: Jann Horn <jannh@google.com>
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 <jannh@google.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20241129-ext4-ignore-ea-fhandle-v1-1-e532c0d1cee0@google.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ext4: fix off-by-one error in do_split [+ + +]
Author: Artem Sadovnikov <a.sadovnikov@ispras.ru>
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: stable@vger.kernel.org
    Fixes: 5872331b3d91 ("ext4: fix potential negative array index in do_split()")
    Signed-off-by: Artem Sadovnikov <a.sadovnikov@ispras.ru>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250404082804.2567-3-a.sadovnikov@ispras.ru
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: ignore xattrs past end [+ + +]
Author: Bhupesh <bhupesh@igalia.com>
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: syzbot+b244bda78289b00204ed@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=b244bda78289b00204ed
    Suggested-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
    Signed-off-by: Bhupesh <bhupesh@igalia.com>
    Link: https://patch.msgid.link/20250128082751.124948-2-bhupesh@igalia.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ext4: protect ext4_release_dquot against freezing [+ + +]
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
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 <jack@suse.cz>
    Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Reviewed-by: Baokun Li <libaokun1@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20241121123855.645335-3-ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

f2fs: fix to avoid atomicity corruption of atomic file [+ + +]
Author: Yeongjin Gil <youngjin.gil@samsung.com>
Date:   Fri Mar 14 21:06:51 2025 +0900

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

f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks() [+ + +]
Author: Chao Yu <chao@kernel.org>
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: syzbot+6653f10281a1badc749e@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/66fdcdf3.050a0220.40bef.0025.GAE@google.com
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fbdev: omapfb: Add 'plane' value check [+ + +]
Author: Leonid Arapov <arapovl839@gmail.com>
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 <arapovl839@gmail.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Flush console log from kernel_power_off() [+ + +]
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Tue Feb 25 10:33:28 2025 -0800

    Flush console log from kernel_power_off()
    
    [ Upstream commit 6ea9a1781c70a8be1fcdc49134fc1bf4baba8bca ]
    
    Kernels built with CONFIG_PREEMPT_RT=y can lose significant console output
    and shutdown time, which hides shutdown-time RCU issues from rcutorture.
    Therefore, make pr_flush() public and invoke it after then last print
    in kernel_power_off().
    
    [ paulmck: Apply John Ogness feedback. ]
    [ paulmck: Appy Sebastian Andrzej Siewior feedback. ]
    [ paulmck: Apply kernel test robot feedback. ]
    
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Reviewed-by: John Ogness <john.ogness@linutronix.de>
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Link: https://lore.kernel.org/r/5f743488-dc2a-4f19-bdda-cf50b9314832@paulmck-laptop
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs/jfs: cast inactags to s64 to prevent potential overflow [+ + +]
Author: Rand Deeb <rand.sec96@gmail.com>
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 <rand.sec96@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fs/jfs: Prevent integer overflow in AG size calculation [+ + +]
Author: Rand Deeb <rand.sec96@gmail.com>
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 <rand.sec96@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

 
ftrace: Add cond_resched() to ftrace_graph_set_hash() [+ + +]
Author: zhoumin <teczm@foxmail.com>
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: stable@vger.kernel.org
    Fixes: b9b0c831bed26 ("ftrace: Convert graph filter to use hash tables")
    Link: https://lore.kernel.org/tencent_3E06CE338692017B5809534B9C5C03DA7705@qq.com
    Signed-off-by: zhoumin <teczm@foxmail.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ftrace: Properly merge notrace hashes [+ + +]
Author: Andy Chiu <andybnac@gmail.com>
Date:   Wed Apr 9 00:02:57 2025 +0800

    ftrace: Properly merge notrace hashes
    
    commit 04a80a34c22f4db245f553d8696d1318d1c00ece upstream.
    
    The global notrace hash should be jointly decided by the intersection of
    each subops's notrace hash, but not the filter hash.
    
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/20250408160258.48563-1-andybnac@gmail.com
    Fixes: 5fccc7552ccb ("ftrace: Add subops logic to allow one ops to manage many")
    Signed-off-by: Andy Chiu <andybnac@gmail.com>
    [ fixed removing of freeing of filter_hash ]
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: tegra186: fix resource handling in ACPI probe path [+ + +]
Author: Guixin Liu <kanie@linux.alibaba.com>
Date:   Thu Mar 27 11:23:49 2025 +0800

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

gpio: zynq: Fix wakeup source leaks on device unbind [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
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: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250406202245.53854-2-krzysztof.kozlowski@linaro.org
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpiolib: of: Fix the choice for Ingenic NAND quirk [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed Apr 2 15:20:00 2025 +0300

    gpiolib: of: Fix the choice for Ingenic NAND quirk
    
    [ Upstream commit 2b9c536430126c233552cdcd6ec9d5077454ece4 ]
    
    The Ingenic NAND quirk has been added under CONFIG_LCD_HX8357 ifdeffery
    which sounds quite wrong. Fix the choice for Ingenic NAND quirk
    by wrapping it into own ifdeffery related to the respective driver.
    
    Fixes: 3a7fd473bd5d ("mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20250402122058.1517393-2-andriy.shevchenko@linux.intel.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gve: handle overflow when reporting TX consumed descriptors [+ + +]
Author: Joshua Washington <joshwash@google.com>
Date:   Wed Apr 2 00:10:37 2025 +0000

    gve: handle overflow when reporting TX consumed descriptors
    
    commit 15970e1b23f5c25db88c613fddf9131de086f28e upstream.
    
    When the tx tail is less than the head (in cases of wraparound), the TX
    consumed descriptor statistic in DQ will be reported as
    UINT32_MAX - head + tail, which is incorrect. Mask the difference of
    head and tail according to the ring size when reporting the statistic.
    
    Cc: stable@vger.kernel.org
    Fixes: 2c9198356d56 ("gve: Add consumed counts to ethtool stats")
    Signed-off-by: Joshua Washington <joshwash@google.com>
    Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250402001037.2717315-1-hramamurthy@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
HID: Add hid-universal-pidff driver and supported device ids [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:54 2025 +0100

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

HID: hid-universal-pidff: Add Asetek wheelbases support [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 11 15:35:09 2025 +0100

    HID: hid-universal-pidff: Add Asetek wheelbases support
    
    [ Upstream commit c385f61108d403633e8cfbdae15b35ccf7cee686 ]
    
    Adds Asetek vendor id and product ids for:
    - Invicta
    - Forte
    - La Prima
    - Tony Kanaan
    
    v2:
    - Misc spelling fix in driver loaded info
    
    v3:
    - Chanage Oleg's name order
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Add FIX_WHEEL_DIRECTION quirk [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:52 2025 +0100

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

HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:51 2025 +0100

    HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol
    
    [ Upstream commit 36de0164bbaff1484288e84ac5df5cff00580263 ]
    
    This lays out a way to provide an initial set of quirks to enable before
    device initialization takes place. GPL symbol export needed for the
    possibility of building HID drivers which use this function as modules.
    
    Adding a wrapper function to ensure compatibility with the old behavior
    of hid_pidff_init.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Add MISSING_DELAY quirk and its detection [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:48 2025 +0100

    HID: pidff: Add MISSING_DELAY quirk and its detection
    
    [ Upstream commit 2d5c7ce5bf4cc27db41632f357f682d0ee4518e7 ]
    
    A lot of devices do not include this field, and it's seldom used in force
    feedback implementations. I tested about three dozen applications and
    none of them make use of the delay.
    
    This fixes initialization of a lot of PID wheels like Cammus, VRS, FFBeast
    
    This change has no effect on fully compliant devices
    
    Co-developed-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Add MISSING_PBO quirk and its detection [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:49 2025 +0100

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

HID: pidff: Add PERIODIC_SINE_ONLY quirk [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:56 2025 +0100

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

HID: pidff: Add PERMISSIVE_CONTROL quirk [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:50 2025 +0100

    HID: pidff: Add PERMISSIVE_CONTROL quirk
    
    [ Upstream commit a4119108d2530747e61c7cbf52e2affd089cb1f6 ]
    
    With this quirk, a PID device isn't required to have a strict
    logical_minimum of 1 for the the PID_DEVICE_CONTROL usage page.
    
    Some devices come with weird values in their device descriptors and
    this quirk enables their initialization even if the logical minimum
    of the DEVICE_CONTROL page is not 1.
    
    Fixes initialization of VRS Direct Force Pro
    
    Changes in v6:
    - Change quirk name to better reflect it's intention
    
    Co-developed-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Clamp effect playback LOOP_COUNT value [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 25 23:30:01 2025 +0100

    HID: pidff: Clamp effect playback LOOP_COUNT value
    
    [ Upstream commit 0c6673e3d17b258b8c5c7331d28bf6c49f25ed30 ]
    
    Ensures the loop count will never exceed the logical_maximum.
    
    Fixes implementation errors happening when applications use the max
    value of int32/DWORD as the effect iterations. This could be observed
    when running software both native and in wine.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Clamp PERIODIC effect period to device's logical range [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:47 2025 +0100

    HID: pidff: Clamp PERIODIC effect period to device's logical range
    
    [ Upstream commit f538183e997a9fb6087e94e71e372de967b9e56a ]
    
    This ensures the effect can actually be played on the connected force
    feedback device. Adds clamping functions used instead of rescaling, as we
    don't want to change the characteristics of the periodic effects.
    
    Fixes edge cases found on Moza Racing and some other hardware where
    the effects would not play if the period is outside the defined
    logical range.
    
    Changes in v6:
    - Use in-kernel clamp macro instead of a custom solution
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Comment and code style update [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 11 15:35:10 2025 +0100

    HID: pidff: Comment and code style update
    
    [ Upstream commit e19675c2477491401b236ed939ad5a43ddc339af ]
    
    Update comments to fully conform to the Linux comment styling.
    Define Linux infinite effect duration (0) as FF_INFINITE
    
    Chanage Oleg's name order
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Completely rework and fix pidff_reset function [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:57 2025 +0100

    HID: pidff: Completely rework and fix pidff_reset function
    
    [ Upstream commit cb3fd788e3fa5358602a49809c4eb4911539c9d0 ]
    
    Previously, it was assumed that DEVICE_CONTROL usage is always an array
    but a lot of devices implements it as a bitmask variable. This led to
    the pidff_reset function not working and causing errors in such cases.
    
    Selectors can come in three types. One selection of a set, N selections
    and Any selection in form of bitmask as from USB Hid Usage Tables v1.5,
    subsection 3.4.2.1
    
    Added pidff_send_device_control which handles usage flag check which
    decides whether DEVICE_CONTROL should be handled as "One selection of a
    set" or "Any selection of a set".
    
    Reset was triggered once, on device initialization. Now, it's triggered
    every time when uploading an effect to an empty device (no currently
    stored effects), tracked by pidff->effect_count variable.
    
    Co-developed-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 25 23:30:02 2025 +0100

    HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff
    
    [ Upstream commit 1a575044d516972a1d036d54c0180b9085e21dc6 ]
    
    As per USB PID standard:
    INFINITE - Referrers to the maximum value of a range. i.e. if in an 8
    bit unsigned field the value of 255 would indicate INFINITE.
    
    Detecting 0xffff (U16_MAX) is still important as we MIGHT get this value
    as infinite from some native software as 0 was never actually defined
    in Linux' FF api as the infinite value. I'm working on it though.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Convert infinite length from Linux API to PID standard [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
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 <oleg@makarenk.ooo>
    Signed-off-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Define values used in pidff_find_special_fields [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:59 2025 +0100

    HID: pidff: Define values used in pidff_find_special_fields
    
    [ Upstream commit 1c12f136891cf4d2d4e6aa202d671a9d2171a716 ]
    
    Makes it clear where did these values came from
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Do not send effect envelope if it's empty [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
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 <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Factor out code for setting gain [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:01 2025 +0100

    HID: pidff: Factor out code for setting gain
    
    [ Upstream commit f7ebf0b11b9e04bf59c438ad14f0115b12aa2f44 ]
    
    Makes it possible to easily set gain from inside hid-pidff.c
    
    Changes in v7:
    - Check if device gain field exists before setting device gain
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Factor out pool report fetch and remove excess declaration [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:06 2025 +0100

    HID: pidff: Factor out pool report fetch and remove excess declaration
    
    [ Upstream commit 5d98079b2d0186e1f586301a9c00144a669416a8 ]
    
    We only want to refetch the pool report during device init. Reset
    function is now called when uploading effects to an empty device so
    extract pool fetch to separate function and call it from init before
    autocenter check (autocenter check triggered reset during init).
    
    Remove a superfluous pointer declaration and assigment as well.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Fix 90 degrees direction name North -> East [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 25 23:30:03 2025 +0100

    HID: pidff: Fix 90 degrees direction name North -> East
    
    [ Upstream commit f98ecedbeca34a8df1460c3a03cce32639c99a9d ]
    
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Fix null pointer dereference in pidff_find_fields [+ + +]
Author: Tomasz Pakuła <forest10pl@gmail.com>
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 <nolananicholson@gmail.com>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Fix set_device_control() [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 25 23:30:04 2025 +0100

    HID: pidff: Fix set_device_control()
    
    [ Upstream commit e2fa0bdf08a70623f24ed52f2037a330999d9800 ]
    
    As the search for Device Control report is permissive, make sure the
    desired field was actually found, before trying to set it.
    
    Fix bitmask clearing as it was erronously using index instead of
    index - 1 (HID arrays index is 1-based).
    
    Add last two missing Device Control usages to the defined array.
    PID_PAUSE and PID_CONTINUE.
    
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 11 15:35:08 2025 +0100

    HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
    
    [ Upstream commit 1f650dcec32d22deb1d6db12300a2b98483099a9 ]
    
    As noted by Anssi some 20 years ago, pool report is sometimes messed up.
    This worked fine on many devices but casued oops on VRS DirectForce PRO.
    
    Here, we're making sure pool report is refetched before trying to access
    any of it's fields. While loop was replaced with a for loop + exit
    conditions were moved aroud to decrease the possibility of creating an
    infinite loop scenario.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Move all hid-pidff definitions to a dedicated header [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:03 2025 +0100

    HID: pidff: Move all hid-pidff definitions to a dedicated header
    
    [ Upstream commit 0d24d4b1da96df9fc5ff36966f40f980ef864d46 ]
    
    Do not clutter hid includes with stuff not needed outside of
    the kernel.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Remove redundant call to pidff_find_special_keys [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 11 15:35:12 2025 +0100

    HID: pidff: Remove redundant call to pidff_find_special_keys
    
    [ Upstream commit 1bd55e79cbc0ea2d6a65f51e06c891806359c2f2 ]
    
    Probably left out as a mistake after Anssi created the helper macro
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Rename two functions to align them with naming convention [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 25 23:30:00 2025 +0100

    HID: pidff: Rename two functions to align them with naming convention
    
    [ Upstream commit bbeface1051142bcb0473fdcc89102ea5b31607d ]
    
    Driver uses "set" everywhere to indicate setting report values and
    requesting HID_REQ_SET_REPORT
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Rescale time values to match field units [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:00 2025 +0100

    HID: pidff: Rescale time values to match field units
    
    [ Upstream commit 8713107221a8ce4021ec5fa12bb50ecc8165cf08 ]
    
    PID devices can use different exponents for time fields, while Linux
    Force Feedback API only supports miliseconds.
    
    Read the exponent of a given time field and scale its value accordingly.
    
    Changes in v7:
    - Rescale all time fields, not only period
    
    changes in v9:
    - Properly assign fade_lenght, not attack_length to PID_FADE_TIME
    
    Co-developed-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Makarenko Oleg <oleg@makarenk.ooo>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Simplify pidff_rescale_signed [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:04 2025 +0100

    HID: pidff: Simplify pidff_rescale_signed
    
    [ Upstream commit 4eb9c2ee538b62dc5dcae192297c3a4044b7ade5 ]
    
    This function overrelies on ternary operators and makes it hard to parse
    it mentally. New version makes it very easy to understand.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Simplify pidff_upload_effect function [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:58 2025 +0100

    HID: pidff: Simplify pidff_upload_effect function
    
    [ Upstream commit e4bdc80ef14272ef56c38d8ca2f365fdf59cd0ba ]
    
    Merge a bit of code that reqeusts conditional effects upload.
    Makes it clear, that effect handling should be identical for
    SPRING, DAMPER, INERTIA and FRICTION.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Stop all effects before enabling actuators [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:38:53 2025 +0100

    HID: pidff: Stop all effects before enabling actuators
    
    [ Upstream commit ce52c0c939fcb568d1abe454821d5623de38b424 ]
    
    Some PID compliant devices automatically play effects after boot (i.e.
    autocenter spring) that prevent the rendering of other effects since
    it is done outside the kernel driver.
    
    This makes sure all the effects currently played are stopped after
    resetting the device.
    It brings compatibility to the Brunner CLS-P joystick and others
    
    Reported-by: Jules Noirant <jules.noirant@orange.fr>
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Support device error response from PID_BLOCK_LOAD [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Tue Feb 11 15:35:11 2025 +0100

    HID: pidff: Support device error response from PID_BLOCK_LOAD
    
    [ Upstream commit 9d4174dc4a234408d91fd83725e1899766cd1731 ]
    
    If an error happens on the device, the driver will no longer fall
    into the trap of reading this status 60 times before it decides that
    this reply won't change to success/memory full.
    
    Greatly reduces communication overhead during device error situation.
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pidff: Use macros instead of hardcoded min/max values for shorts [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Sat Feb 1 12:39:05 2025 +0100

    HID: pidff: Use macros instead of hardcoded min/max values for shorts
    
    [ Upstream commit 21755162456902998f8d9897086b8c980c540df5 ]
    
    Makes it obvious these magic values ARE in fact derived from min and
    max values for s16 and u16
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Michał Kopeć <michal@nozomi.space>
    Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
    Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
    Tested-by: Pablo Cisneros <patchkez@protonmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
HSI: ssi_protocol: Fix use after free vulnerability in ssi_protocol Driver Due to Race Condition [+ + +]
Author: Kaixin Wang <kxwang23@m.fudan.edu.cn>
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 <kxwang23@m.fudan.edu.cn>
    Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20240918120749.1730-1-kxwang23@m.fudan.edu.cn
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
i3c: Add NULL pointer check in i3c_master_queue_ibi() [+ + +]
Author: Manjunatha Venkatesh <manjunatha.venkatesh@nxp.com>
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: stable@vger.kernel.org
    Link: https://lore.kernel.org/lkml/Z9gjGYudiYyl3bSe@lizhi-Precision-Tower-5810/
    Signed-off-by: Manjunatha Venkatesh <manjunatha.venkatesh@nxp.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20250326123047.2797946-1-manjunatha.venkatesh@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i3c: master: svc: Use readsb helper for reading MDB [+ + +]
Author: Stanley Chu <yschu@nuvoton.com>
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: stable@kernel.org
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Signed-off-by: Stanley Chu <yschu@nuvoton.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20250318053606.3087121-3-yschu@nuvoton.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ima: limit the number of open-writers integrity violations [+ + +]
Author: Mimi Zohar <zohar@linux.ibm.com>
Date:   Mon Jan 27 10:24:13 2025 -0500

    ima: limit the number of open-writers integrity violations
    
    commit 5b3cd801155f0b34b0b95942a5b057c9b8cad33e upstream.
    
    Each time a file in policy, that is already opened for write, is opened
    for read, an open-writers integrity violation audit message is emitted
    and a violation record is added to the IMA measurement list. This
    occurs even if an open-writers violation has already been recorded.
    
    Limit the number of open-writers integrity violations for an existing
    file open for write to one.  After the existing file open for write
    closes (__fput), subsequent open-writers integrity violations may be
    emitted.
    
    Cc: stable@vger.kernel.org # applies cleanly up to linux-6.6
    Tested-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Petr Vorel <pvorel@suse.cz>
    Tested-by: Petr Vorel <pvorel@suse.cz>
    Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ima: limit the number of ToMToU integrity violations [+ + +]
Author: Mimi Zohar <zohar@linux.ibm.com>
Date:   Mon Jan 27 10:45:48 2025 -0500

    ima: limit the number of ToMToU integrity violations
    
    commit a414016218ca97140171aa3bb926b02e1f68c2cc upstream.
    
    Each time a file in policy, that is already opened for read, is opened
    for write, a Time-of-Measure-Time-of-Use (ToMToU) integrity violation
    audit message is emitted and a violation record is added to the IMA
    measurement list.  This occurs even if a ToMToU violation has already
    been recorded.
    
    Limit the number of ToMToU integrity violations per file open for read.
    
    Note: The IMA_MAY_EMIT_TOMTOU atomic flag must be set from the reader
    side based on policy.  This may result in a per file open for read
    ToMToU violation.
    
    Since IMA_MUST_MEASURE is only used for violations, rename the atomic
    IMA_MUST_MEASURE flag to IMA_MAY_EMIT_TOMTOU.
    
    Cc: stable@vger.kernel.org # applies cleanly up to linux-6.6
    Tested-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Petr Vorel <pvorel@suse.cz>
    Tested-by: Petr Vorel <pvorel@suse.cz>
    Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/kbuf: reject zero sized provided buffers [+ + +]
Author: Jens Axboe <axboe@kernel.dk>
Date:   Mon Apr 7 07:51:23 2025 -0600

    io_uring/kbuf: reject zero sized provided buffers
    
    commit cf960726eb65e8d0bfecbcce6cf95f47b1ffa6cc upstream.
    
    This isn't fixing a real issue, but there's also zero point in going
    through group and buffer setup, when the buffers are going to be
    rejected once attempted to get used.
    
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+58928048fd1416f1457c@syzkaller.appspotmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/net: fix accept multishot handling [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Sun Feb 23 17:22:29 2025 +0000

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

io_uring/net: fix io_req_post_cqe abuse by send bundle [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Mar 27 09:57:27 2025 +0000

    io_uring/net: fix io_req_post_cqe abuse by send bundle
    
    commit 6889ae1b4df1579bcdffef023e2ea9a982565dff upstream.
    
    [  114.987980][ T5313] WARNING: CPU: 6 PID: 5313 at io_uring/io_uring.c:872 io_req_post_cqe+0x12e/0x4f0
    [  114.991597][ T5313] RIP: 0010:io_req_post_cqe+0x12e/0x4f0
    [  115.001880][ T5313] Call Trace:
    [  115.002222][ T5313]  <TASK>
    [  115.007813][ T5313]  io_send+0x4fe/0x10f0
    [  115.009317][ T5313]  io_issue_sqe+0x1a6/0x1740
    [  115.012094][ T5313]  io_wq_submit_work+0x38b/0xed0
    [  115.013223][ T5313]  io_worker_handle_work+0x62a/0x1600
    [  115.013876][ T5313]  io_wq_worker+0x34f/0xdf0
    
    As the comment states, io_req_post_cqe() should only be used by
    multishot requests, i.e. REQ_F_APOLL_MULTISHOT, which bundled sends are
    not. Add a flag signifying whether a request wants to post multiple
    CQEs. Eventually REQ_F_APOLL_MULTISHOT should imply the new flag, but
    that's left out for simplicity.
    
    Cc: stable@vger.kernel.org
    Fixes: a05d1f625c7aa ("io_uring/net: support bundles for send")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/8b611dbb54d1cd47a88681f5d38c84d0c02bc563.1743067183.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/exynos: Fix suspend/resume with IDENTITY domain [+ + +]
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Tue Apr 1 22:27:31 2025 +0200

    iommu/exynos: Fix suspend/resume with IDENTITY domain
    
    [ Upstream commit 99deffc409b69000ac4877486e69ec6516becd53 ]
    
    Commit bcb81ac6ae3c ("iommu: Get DT/ACPI parsing into the proper probe
    path") changed the sequence of probing the SYSMMU controller devices and
    calls to arm_iommu_attach_device(), what results in resuming SYSMMU
    controller earlier, when it is still set to IDENTITY mapping. Such change
    revealed the bug in IDENTITY handling in the exynos-iommu driver. When
    SYSMMU controller is set to IDENTITY mapping, data->domain is NULL, so
    adjust checks in suspend & resume callbacks to handle this case
    correctly.
    
    Fixes: b3d14960e629 ("iommu/exynos: Implement an IDENTITY domain")
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Link: https://lore.kernel.org/r/20250401202731.2810474-1-m.szyprowski@samsung.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/mediatek: Fix NULL pointer deference in mtk_iommu_device_group [+ + +]
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Date:   Thu Apr 3 12:22:12 2025 +0200

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

 
iommu/tegra241-cmdqv: Fix warnings due to dmam_free_coherent() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Apr 7 13:19:08 2025 -0700

    iommu/tegra241-cmdqv: Fix warnings due to dmam_free_coherent()
    
    commit 767e22001dfce64cc03b7def1562338591ab6031 upstream.
    
    Two WARNINGs are observed when SMMU driver rolls back upon failure:
     arm-smmu-v3.9.auto: Failed to register iommu
     arm-smmu-v3.9.auto: probe with driver arm-smmu-v3 failed with error -22
     ------------[ cut here ]------------
     WARNING: CPU: 5 PID: 1 at kernel/dma/mapping.c:74 dmam_free_coherent+0xc0/0xd8
     Call trace:
      dmam_free_coherent+0xc0/0xd8 (P)
      tegra241_vintf_free_lvcmdq+0x74/0x188
      tegra241_cmdqv_remove_vintf+0x60/0x148
      tegra241_cmdqv_remove+0x48/0xc8
      arm_smmu_impl_remove+0x28/0x60
      devm_action_release+0x1c/0x40
     ------------[ cut here ]------------
     128 pages are still in use!
     WARNING: CPU: 16 PID: 1 at mm/page_alloc.c:6902 free_contig_range+0x18c/0x1c8
     Call trace:
      free_contig_range+0x18c/0x1c8 (P)
      cma_release+0x154/0x2f0
      dma_free_contiguous+0x38/0xa0
      dma_direct_free+0x10c/0x248
      dma_free_attrs+0x100/0x290
      dmam_free_coherent+0x78/0xd8
      tegra241_vintf_free_lvcmdq+0x74/0x160
      tegra241_cmdqv_remove+0x98/0x198
      arm_smmu_impl_remove+0x28/0x60
      devm_action_release+0x1c/0x40
    
    This is because the LVCMDQ queue memory are managed by devres, while that
    dmam_free_coherent() is called in the context of devm_action_release().
    
    Jason pointed out that "arm_smmu_impl_probe() has mis-ordered the devres
    callbacks if ops->device_remove() is going to be manually freeing things
    that probe allocated":
    https://lore.kernel.org/linux-iommu/20250407174408.GB1722458@nvidia.com/
    
    In fact, tegra241_cmdqv_init_structures() only allocates memory resources
    which means any failure that it generates would be similar to -ENOMEM, so
    there is no point in having that "falling back to standard SMMU" routine,
    as the standard SMMU would likely fail to allocate memory too.
    
    Remove the unwind part in tegra241_cmdqv_init_structures(), and return a
    proper error code to ask SMMU driver to call tegra241_cmdqv_remove() via
    impl_ops->device_remove(). Then, drop tegra241_vintf_free_lvcmdq() since
    devres will take care of that.
    
    Fixes: 483e0bd8883a ("iommu/tegra241-cmdqv: Do not allocate vcmdq until dma_set_mask_and_coherent")
    Cc: stable@vger.kernel.org
    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/20250407201908.172225-1-nicolinc@nvidia.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/vt-d: Don't clobber posted vCPU IRTE when host IRQ affinity changes [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed Mar 19 10:21:00 2025 +0800

    iommu/vt-d: Don't clobber posted vCPU IRTE when host IRQ affinity changes
    
    commit 688124cc541f60d26a7547f45637b23dada4e527 upstream.
    
    Don't overwrite an IRTE that is posting IRQs to a vCPU with a posted MSI
    entry if the host IRQ affinity happens to change.  If/when the IRTE is
    reverted back to "host mode", it will be reconfigured as a posted MSI or
    remapped entry as appropriate.
    
    Drop the "mode" field, which doesn't differentiate between posted MSIs and
    posted vCPUs, in favor of a dedicated posted_vcpu flag.  Note!  The two
    posted_{msi,vcpu} flags are intentionally not mutually exclusive; an IRTE
    can transition between posted MSI and posted vCPU.
    
    Fixes: ed1e48ea4370 ("iommu/vt-d: Enable posted mode for device MSIs")
    Cc: stable@vger.kernel.org
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Link: https://lore.kernel.org/r/20250315025135.2365846-3-seanjc@google.com
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommu/vt-d: Fix possible circular locking dependency [+ + +]
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Wed Mar 19 10:21:01 2025 +0800

    iommu/vt-d: Fix possible circular locking dependency
    
    commit 93ae6e68b6d6b62d92b3a89d1c253d4a1721a1d3 upstream.
    
    We have recently seen report of lockdep circular lock dependency warnings
    on platforms like Skylake and Kabylake:
    
     ======================================================
     WARNING: possible circular locking dependency detected
     6.14.0-rc6-CI_DRM_16276-gca2c04fe76e8+ #1 Not tainted
     ------------------------------------------------------
     swapper/0/1 is trying to acquire lock:
     ffffffff8360ee48 (iommu_probe_device_lock){+.+.}-{3:3},
       at: iommu_probe_device+0x1d/0x70
    
     but task is already holding lock:
     ffff888102c7efa8 (&device->physical_node_lock){+.+.}-{3:3},
       at: intel_iommu_init+0xe75/0x11f0
    
     which lock already depends on the new lock.
    
     the existing dependency chain (in reverse order) is:
    
     -> #6 (&device->physical_node_lock){+.+.}-{3:3}:
            __mutex_lock+0xb4/0xe40
            mutex_lock_nested+0x1b/0x30
            intel_iommu_init+0xe75/0x11f0
            pci_iommu_init+0x13/0x70
            do_one_initcall+0x62/0x3f0
            kernel_init_freeable+0x3da/0x6a0
            kernel_init+0x1b/0x200
            ret_from_fork+0x44/0x70
            ret_from_fork_asm+0x1a/0x30
    
     -> #5 (dmar_global_lock){++++}-{3:3}:
            down_read+0x43/0x1d0
            enable_drhd_fault_handling+0x21/0x110
            cpuhp_invoke_callback+0x4c6/0x870
            cpuhp_issue_call+0xbf/0x1f0
            __cpuhp_setup_state_cpuslocked+0x111/0x320
            __cpuhp_setup_state+0xb0/0x220
            irq_remap_enable_fault_handling+0x3f/0xa0
            apic_intr_mode_init+0x5c/0x110
            x86_late_time_init+0x24/0x40
            start_kernel+0x895/0xbd0
            x86_64_start_reservations+0x18/0x30
            x86_64_start_kernel+0xbf/0x110
            common_startup_64+0x13e/0x141
    
     -> #4 (cpuhp_state_mutex){+.+.}-{3:3}:
            __mutex_lock+0xb4/0xe40
            mutex_lock_nested+0x1b/0x30
            __cpuhp_setup_state_cpuslocked+0x67/0x320
            __cpuhp_setup_state+0xb0/0x220
            page_alloc_init_cpuhp+0x2d/0x60
            mm_core_init+0x18/0x2c0
            start_kernel+0x576/0xbd0
            x86_64_start_reservations+0x18/0x30
            x86_64_start_kernel+0xbf/0x110
            common_startup_64+0x13e/0x141
    
     -> #3 (cpu_hotplug_lock){++++}-{0:0}:
            __cpuhp_state_add_instance+0x4f/0x220
            iova_domain_init_rcaches+0x214/0x280
            iommu_setup_dma_ops+0x1a4/0x710
            iommu_device_register+0x17d/0x260
            intel_iommu_init+0xda4/0x11f0
            pci_iommu_init+0x13/0x70
            do_one_initcall+0x62/0x3f0
            kernel_init_freeable+0x3da/0x6a0
            kernel_init+0x1b/0x200
            ret_from_fork+0x44/0x70
            ret_from_fork_asm+0x1a/0x30
    
     -> #2 (&domain->iova_cookie->mutex){+.+.}-{3:3}:
            __mutex_lock+0xb4/0xe40
            mutex_lock_nested+0x1b/0x30
            iommu_setup_dma_ops+0x16b/0x710
            iommu_device_register+0x17d/0x260
            intel_iommu_init+0xda4/0x11f0
            pci_iommu_init+0x13/0x70
            do_one_initcall+0x62/0x3f0
            kernel_init_freeable+0x3da/0x6a0
            kernel_init+0x1b/0x200
            ret_from_fork+0x44/0x70
            ret_from_fork_asm+0x1a/0x30
    
     -> #1 (&group->mutex){+.+.}-{3:3}:
            __mutex_lock+0xb4/0xe40
            mutex_lock_nested+0x1b/0x30
            __iommu_probe_device+0x24c/0x4e0
            probe_iommu_group+0x2b/0x50
            bus_for_each_dev+0x7d/0xe0
            iommu_device_register+0xe1/0x260
            intel_iommu_init+0xda4/0x11f0
            pci_iommu_init+0x13/0x70
            do_one_initcall+0x62/0x3f0
            kernel_init_freeable+0x3da/0x6a0
            kernel_init+0x1b/0x200
            ret_from_fork+0x44/0x70
            ret_from_fork_asm+0x1a/0x30
    
     -> #0 (iommu_probe_device_lock){+.+.}-{3:3}:
            __lock_acquire+0x1637/0x2810
            lock_acquire+0xc9/0x300
            __mutex_lock+0xb4/0xe40
            mutex_lock_nested+0x1b/0x30
            iommu_probe_device+0x1d/0x70
            intel_iommu_init+0xe90/0x11f0
            pci_iommu_init+0x13/0x70
            do_one_initcall+0x62/0x3f0
            kernel_init_freeable+0x3da/0x6a0
            kernel_init+0x1b/0x200
            ret_from_fork+0x44/0x70
            ret_from_fork_asm+0x1a/0x30
    
     other info that might help us debug this:
    
     Chain exists of:
       iommu_probe_device_lock --> dmar_global_lock -->
         &device->physical_node_lock
    
      Possible unsafe locking scenario:
    
            CPU0                    CPU1
            ----                    ----
       lock(&device->physical_node_lock);
                                    lock(dmar_global_lock);
                                    lock(&device->physical_node_lock);
       lock(iommu_probe_device_lock);
    
      *** DEADLOCK ***
    
    This driver uses a global lock to protect the list of enumerated DMA
    remapping units. It is necessary due to the driver's support for dynamic
    addition and removal of remapping units at runtime.
    
    Two distinct code paths require iteration over this remapping unit list:
    
    - Device registration and probing: the driver iterates the list to
      register each remapping unit with the upper layer IOMMU framework
      and subsequently probe the devices managed by that unit.
    - Global configuration: Upper layer components may also iterate the list
      to apply configuration changes.
    
    The lock acquisition order between these two code paths was reversed. This
    caused lockdep warnings, indicating a risk of deadlock. Fix this warning
    by releasing the global lock before invoking upper layer interfaces for
    device registration.
    
    Fixes: b150654f74bf ("iommu/vt-d: Fix suspicious RCU usage")
    Closes: https://lore.kernel.org/linux-iommu/SJ1PR11MB612953431F94F18C954C4A9CB9D32@SJ1PR11MB6129.namprd11.prod.outlook.com/
    Tested-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Link: https://lore.kernel.org/r/20250317035714.1041549-1-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommu/vt-d: Put IRTE back into posted MSI mode if vCPU posting is disabled [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed Mar 19 10:20:59 2025 +0800

    iommu/vt-d: Put IRTE back into posted MSI mode if vCPU posting is disabled
    
    commit 2454823e97a63d85a6b215905f71e5a06324eab7 upstream.
    
    Add a helper to take care of reconfiguring an IRTE to deliver IRQs to the
    host, i.e. not to a vCPU, and use the helper when an IRTE's vCPU affinity
    is nullified, i.e. when KVM puts an IRTE back into "host" mode.  Because
    posted MSIs use an ephemeral IRTE, using modify_irte() puts the IRTE into
    full remapped mode, i.e. unintentionally disables posted MSIs on the IRQ.
    
    Fixes: ed1e48ea4370 ("iommu/vt-d: Enable posted mode for device MSIs")
    Cc: stable@vger.kernel.org
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Link: https://lore.kernel.org/r/20250315025135.2365846-2-seanjc@google.com
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Apr 10 15:32:46 2025 +0800

    iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs
    
    commit 548183ea388c12b6d76d6982f3d72df3887af0da upstream.
    
    Set the posted MSI irq_chip's irq_ack() hook to irq_move_irq() instead of
    a dummy/empty callback so that posted MSIs process pending changes to the
    IRQ's SMP affinity.  Failure to honor a pending set-affinity results in
    userspace being unable to change the effective affinity of the IRQ, as
    IRQD_SETAFFINITY_PENDING is never cleared and so irq_set_affinity_locked()
    always defers moving the IRQ.
    
    The issue is most easily reproducible by setting /proc/irq/xx/smp_affinity
    multiple times in quick succession, as only the first update is likely to
    be handled in process context.
    
    Fixes: ed1e48ea4370 ("iommu/vt-d: Enable posted mode for device MSIs")
    Cc: Robert Lippert <rlippert@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Reported-by: Wentao Yang <wentaoyang@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250321194249.1217961-1-seanjc@google.com
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommufd: Fail replace if device has not been attached [+ + +]
Author: Yi Liu <yi.l.liu@intel.com>
Date:   Wed Mar 5 19:48:42 2025 -0800

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

iommufd: Fix uninitialized rc in iommufd_access_rw() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Thu Feb 27 12:07:29 2025 -0800

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

iommufd: Make attach_handle generic than fault specific [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Feb 3 21:00:54 2025 -0800

    iommufd: Make attach_handle generic than fault specific
    
    commit fb21b1568adaa76af7a8c853f37c60fba8b28661 upstream.
    
    "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
    used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
    reuse the attach_handle for non-fault cases.
    
    Add a set of new attach/detach/replace helpers that does the attach_handle
    allocation/releasing/replacement in the common path and also handles those
    fault specific routines such as iopf enabling/disabling and auto response.
    
    This covers both non-fault and fault cases in a clean way, replacing those
    inline helpers in the header. The following patch will clean up those old
    helpers in the fault.c file.
    
    Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Yi Liu <yi.l.liu@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv6: Align behavior across nexthops during path selection [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Tue Apr 8 11:43:16 2025 +0300

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

 
jbd2: remove wrong sb->s_sequence check [+ + +]
Author: Jan Kara <jack@suse.cz>
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: stable@vger.kernel.org
    Signed-off-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
    Link: https://patch.msgid.link/20250206094657.20865-3-jack@suse.cz
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
jfs: add sanity check for agwidth in dbMount [+ + +]
Author: Edward Adam Davis <eadavis@qq.com>
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: syzbot+7c808908291a569281a9@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=7c808908291a569281a9
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: Fix uninit-value access of imap allocated in the diMount() function [+ + +]
Author: Zhongqiu Han <quic_zhonhan@quicinc.com>
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 <quic_zhonhan@quicinc.com>
    Reported-by: syzbot+df6cdcb35904203d2b6d@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/lkml/67b5d07e.050a0220.14d86d.00e6.GAE@google.com/
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: Prevent copying of nlink with value 0 from disk inode [+ + +]
Author: Edward Adam Davis <eadavis@qq.com>
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: syzbot+355da3b3a74881008e8f@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=355da3b3a74881008e8f
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
kbuild: Add '-fno-builtin-wcslen' [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
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: stable@vger.kernel.org
    Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [nathan: Resolve small conflict in older trees]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

kbuild: exclude .rodata.(cst|str)* when building ranges [+ + +]
Author: Kris Van Hees <kris.van.hees@oracle.com>
Date:   Fri Mar 7 11:53:28 2025 -0500

    kbuild: exclude .rodata.(cst|str)* when building ranges
    
    commit 87bb368d0637c466a8a77433837056f981d01991 upstream.
    
    The .rodata.(cst|str)* sections are often resized during the final
    linking and since these sections do not cover actual symbols there is
    no need to include them in the modules.builtin.ranges data.
    
    When these sections were included in processing and resizing occurred,
    modules were reported with ranges that extended beyond their true end,
    causing subsequent symbols (in address order) to be associated with
    the wrong module.
    
    Fixes: 5f5e7344322f ("kbuild: generate offset range data for builtin modules")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
    Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ktest: Fix Test Failures Due to Missing LOG_FILE Directories [+ + +]
Author: Ayush Jain <Ayush.jain3@amd.com>
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: <warthog9@eaglescrag.net>
    Link: https://lore.kernel.org/20250307043854.2518539-1-Ayush.jain3@amd.com
    Signed-off-by: Ayush Jain <Ayush.jain3@amd.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KVM: Allow building irqbypass.ko as as module when kvm.ko is a module [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Mar 14 19:46:23 2025 -0700

    KVM: Allow building irqbypass.ko as as module when kvm.ko is a module
    
    commit 459a35111b0a890172a78d51c01b204e13a34a18 upstream.
    
    Convert HAVE_KVM_IRQ_BYPASS into a tristate so that selecting
    IRQ_BYPASS_MANAGER follows KVM={m,y}, i.e. doesn't force irqbypass.ko to
    be built-in.
    
    Note, PPC allows building KVM as a module, but selects HAVE_KVM_IRQ_BYPASS
    from a boolean Kconfig, i.e. KVM PPC unnecessarily forces irqbpass.ko to
    be built-in.  But that flaw is a longstanding PPC specific issue.
    
    Fixes: 61df71ee992d ("kvm: move "select IRQ_BYPASS_MANAGER" to common code")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20250315024623.2363994-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: Tear down vGIC on failed vCPU creation [+ + +]
Author: Will Deacon <will@kernel.org>
Date:   Fri Mar 14 13:34:09 2025 +0000

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

KVM: PPC: Enable CAP_SPAPR_TCE_VFIO on pSeries KVM guests [+ + +]
Author: Amit Machhiwal <amachhiw@linux.ibm.com>
Date:   Thu Feb 20 12:30:02 2025 +0530

    KVM: PPC: Enable CAP_SPAPR_TCE_VFIO on pSeries KVM guests
    
    commit b4392813bbc3b05fc01a33c64d8b8c6c62c32cfa upstream.
    
    Currently on book3s-hv, the capability KVM_CAP_SPAPR_TCE_VFIO is only
    available for KVM Guests running on PowerNV and not for the KVM guests
    running on pSeries hypervisors. This prevents a pSeries L2 guest from
    leveraging the in-kernel acceleration for H_PUT_TCE_INDIRECT and
    H_STUFF_TCE hcalls that results in slow startup times for large memory
    guests.
    
    Support for VFIO on pSeries was restored in commit f431a8cde7f1
    ("powerpc/iommu: Reimplement the iommu_table_group_ops for pSeries"),
    making it possible to re-enable this capability on pSeries hosts.
    
    This change enables KVM_CAP_SPAPR_TCE_VFIO for nested PAPR guests on
    pSeries, while maintaining the existing behavior on PowerNV. Booting an
    L2 guest with 128GB of memory shows an average 11% improvement in
    startup time.
    
    Fixes: f431a8cde7f1 ("powerpc/iommu: Reimplement the iommu_table_group_ops for pSeries")
    Cc: stable@vger.kernel.org
    Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250220070002.1478849-1-amachhiw@linux.ibm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

    KVM: x86: Explicitly zero-initialize on-stack CPUID unions
    
    commit bc52ae0a708cb6fa3926d11c88e3c55e1171b4a1 upstream.
    
    Explicitly zero/empty-initialize the unions used for PMU related CPUID
    entries, instead of manually zeroing all fields (hopefully), or in the
    case of 0x80000022, relying on the compiler to clobber the uninitialized
    bitfields.
    
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Reviewed-by: Jim Mattson <jmattson@google.com>
    Message-ID: <20250315024102.2361628-1-seanjc@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
landlock: Add erratum for TCP fix [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:38 2025 +0100

    landlock: Add erratum for TCP fix
    
    commit 48fce74fe209ba9e9b416d7100ccee546edc9fc6 upstream.
    
    Add erratum for the TCP socket identification fixed with commit
    854277e2cc8c ("landlock: Fix non-TCP sockets restriction").
    
    Fixes: 854277e2cc8c ("landlock: Fix non-TCP sockets restriction")
    Cc: Günther Noack <gnoack@google.com>
    Cc: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-4-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

landlock: Add the errata interface [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
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 <gnoack@google.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-3-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

landlock: Always allow signals between threads of the same process [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:40 2025 +0100

    landlock: Always allow signals between threads of the same process
    
    commit 18eb75f3af40be1f0fc2025d4ff821711222a2fd upstream.
    
    Because Linux credentials are managed per thread, user space relies on
    some hack to synchronize credential update across threads from the same
    process.  This is required by the Native POSIX Threads Library and
    implemented by set*id(2) wrappers and libcap(3) to use tgkill(2) to
    synchronize threads.  See nptl(7) and libpsx(3).  Furthermore, some
    runtimes like Go do not enable developers to have control over threads
    [1].
    
    To avoid potential issues, and because threads are not security
    boundaries, let's relax the Landlock (optional) signal scoping to always
    allow signals sent between threads of the same process.  This exception
    is similar to the __ptrace_may_access() one.
    
    hook_file_set_fowner() now checks if the target task is part of the same
    process as the caller.  If this is the case, then the related signal
    triggered by the socket will always be allowed.
    
    Scoping of abstract UNIX sockets is not changed because kernel objects
    (e.g. sockets) should be tied to their creator's domain at creation
    time.
    
    Note that creating one Landlock domain per thread puts each of these
    threads (and their future children) in their own scope, which is
    probably not what users expect, especially in Go where we do not control
    threads.  However, being able to drop permissions on all threads should
    not be restricted by signal scoping.  We are working on a way to make it
    possible to atomically restrict all threads of a process with the same
    domain [2].
    
    Add erratum for signal scoping.
    
    Closes: https://github.com/landlock-lsm/go-landlock/issues/36
    Fixes: 54a6e6bbf3be ("landlock: Add signal scoping")
    Fixes: c8994965013e ("selftests/landlock: Test signal scoping for threads")
    Depends-on: 26f204380a3c ("fs: Fix file_set_fowner LSM hook inconsistencies")
    Link: https://pkg.go.dev/kernel.org/pub/linux/libs/security/libcap/psx [1]
    Link: https://github.com/landlock-lsm/linux/issues/2 [2]
    Cc: Günther Noack <gnoack@google.com>
    Cc: Paul Moore <paul@paul-moore.com>
    Cc: Serge Hallyn <serge@hallyn.com>
    Cc: Tahera Fahimi <fahimitahera@gmail.com>
    Cc: stable@vger.kernel.org
    Acked-by: Christian Brauner <brauner@kernel.org>
    Link: https://lore.kernel.org/r/20250318161443.279194-6-mic@digikod.net
    [mic: Add extra pointer check and RCU guard, and ease backport]
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

landlock: Move code to ease future backports [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:36 2025 +0100

    landlock: Move code to ease future backports
    
    commit 624f177d8f62032b4f3343c289120269645cec37 upstream.
    
    To ease backports in setup.c, let's group changes from
    __lsm_ro_after_init to __ro_after_init with commit f22f9aaf6c3d
    ("selinux: remove the runtime disable functionality"), and the
    landlock_lsmid addition with commit f3b8788cde61 ("LSM: Identify modules
    by more than name").
    
    That will help to backport the following errata.
    
    Cc: Günther Noack <gnoack@google.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-2-mic@digikod.net
    Fixes: f3b8788cde61 ("LSM: Identify modules by more than name")
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

landlock: Prepare to add second errata [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:39 2025 +0100

    landlock: Prepare to add second errata
    
    commit 6d9ac5e4d70eba3e336f9809ba91ab2c49de6d87 upstream.
    
    Potentially include errata for Landlock ABI v5 (Linux 6.10) and v6
    (Linux 6.12).  That will be useful for the following signal scoping
    erratum.
    
    As explained in errata.h, this commit should be backportable without
    conflict down to ABI v5.  It must then not include the errata/abi-6.h
    file.
    
    Fixes: 54a6e6bbf3be ("landlock: Add signal scoping")
    Cc: Günther Noack <gnoack@google.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-5-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs [+ + +]
Author: Abel Vesa <abel.vesa@linaro.org>
Date:   Wed Mar 5 15:09:06 2025 +0200

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

leds: rgb: leds-qcom-lpg: Fix pwm resolution max for Hi-Res PWMs [+ + +]
Author: Abel Vesa <abel.vesa@linaro.org>
Date:   Wed Mar 5 15:09:05 2025 +0200

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

 
lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets [+ + +]
Author: T Pratham <t-pratham@ti.com>
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/20250319111437.1969903-1-t-pratham@ti.com
    Fixes: f8bcbe62acd0 ("lib: scatterlist: add sg splitting function")
    Signed-off-by: T Pratham <t-pratham@ti.com>
    Cc: Robert Jarzmik <robert.jarzmik@free.fr>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Kamlesh Gurudasani <kamlesh@ti.com>
    Cc: Praneeth Bajjuri <praneeth@ti.com>
    Cc: Vignesh Raghavendra <vigneshr@ti.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
libbpf: Prevent compiler warnings/errors [+ + +]
Author: Eder Zulian <ezulian@redhat.com>
Date:   Tue Oct 22 19:23:28 2024 +0200

    libbpf: Prevent compiler warnings/errors
    
    commit 7f4ec77f3fee41dd6a41f03a40703889e6e8f7b2 upstream.
    
    Initialize 'new_off' and 'pad_bits' to 0 and 'pad_type' to  NULL in
    btf_dump_emit_bit_padding to prevent compiler warnings/errors which are
    observed when compiling with 'EXTRA_CFLAGS=-g -Og' options, but do not
    happen when compiling with current default options.
    
    For example, when compiling libbpf with
    
      $ make "EXTRA_CFLAGS=-g -Og" -C tools/lib/bpf/ clean all
    
    Clang version 17.0.6 and GCC 13.3.1 fail to compile btf_dump.c due to
    following errors:
    
      btf_dump.c: In function ‘btf_dump_emit_bit_padding’:
      btf_dump.c:903:42: error: ‘new_off’ may be used uninitialized [-Werror=maybe-uninitialized]
        903 |         if (new_off > cur_off && new_off <= next_off) {
            |                                  ~~~~~~~~^~~~~~~~~~~
      btf_dump.c:870:13: note: ‘new_off’ was declared here
        870 |         int new_off, pad_bits, bits, i;
            |             ^~~~~~~
      btf_dump.c:917:25: error: ‘pad_type’ may be used uninitialized [-Werror=maybe-uninitialized]
        917 |                         btf_dump_printf(d, "\n%s%s: %d;", pfx(lvl), pad_type,
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        918 |                                         in_bitfield ? new_off - cur_off : 0);
            |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      btf_dump.c:871:21: note: ‘pad_type’ was declared here
        871 |         const char *pad_type;
            |                     ^~~~~~~~
      btf_dump.c:930:20: error: ‘pad_bits’ may be used uninitialized [-Werror=maybe-uninitialized]
        930 |                 if (bits == pad_bits) {
            |                    ^
      btf_dump.c:870:22: note: ‘pad_bits’ was declared here
        870 |         int new_off, pad_bits, bits, i;
            |                      ^~~~~~~~
      cc1: all warnings being treated as errors
    
    Signed-off-by: Eder Zulian <ezulian@redhat.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/bpf/20241022172329.3871958-3-ezulian@redhat.com
    Signed-off-by: He Zhe <zhe.he@windriver.com>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.12.24 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Apr 20 10:16:02 2025 +0200

    Linux 6.12.24
    
    Link: https://lore.kernel.org/r/20250417175107.546547190@linuxfoundation.org
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Link: https://lore.kernel.org/r/20250418110359.237869758@linuxfoundation.org
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
locking/lockdep: Decrease nr_unused_locks if lock unused in zap_class() [+ + +]
Author: Boqun Feng <boqun.feng@gmail.com>
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 <boqun.feng@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Waiman Long <longman@redhat.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250326180831.510348-1-boqun.feng@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
media: chips-media: wave5: Avoid race condition in the interrupt handler [+ + +]
Author: Jackson.lee <jackson.lee@chipsnmedia.com>
Date:   Tue Dec 17 13:51:23 2024 +0900

    media: chips-media: wave5: Avoid race condition in the interrupt handler
    
    commit ac35f768986610480a1c01323d9cf9f5eaf3ee9b upstream.
    
    In case of multiple active instances, new interrupts can occur as soon
    as the current interrupt is cleared. If the driver reads the
    instance_info after clearing the interrupt, then there is no guarantee,
    that the instance_info is still valid for the current interrupt.
    
    Read the instance_info register for each interrupt before clearing the
    interrupt.
    
    Fixes: ed7276ed2fd0 ("media: chips-media: wave5: Add hrtimer based polling support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
    Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: chips-media: wave5: Fix a hang after seeking [+ + +]
Author: Jackson.lee <jackson.lee@chipsnmedia.com>
Date:   Tue Dec 17 13:51:24 2024 +0900

    media: chips-media: wave5: Fix a hang after seeking
    
    commit a2c75e964e51b096e9fe6adfa3eaed53594a668b upstream.
    
    While seeking, the driver calls the flush command. Before the flush
    command is sent to the VPU, the driver should handle the display buffer
    flags and should get all decoded information from the VPU if the VCORE
    is running.
    
    Fixes: 9707a6254a8a ("media: chips-media: wave5: Add the v4l2 layer")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
    Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: chips-media: wave5: Fix gray color on screen [+ + +]
Author: Jackson.lee <jackson.lee@chipsnmedia.com>
Date:   Tue Dec 17 13:51:22 2024 +0900

    media: chips-media: wave5: Fix gray color on screen
    
    commit 6bae4d5053da634eecb611118e7cd91a677a4bbf upstream.
    
    When a decoder instance is created, the W5_CMD_ERR_CONCEAL register
    should be initialized to 0. Otherwise, gray color is occasionally
    displayed on the screen while decoding.
    
    Fixes: 45d1a2b93277 ("media: chips-media: wave5: Add vpuapi layer")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
    Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster [+ + +]
Author: Jackson.lee <jackson.lee@chipsnmedia.com>
Date:   Tue Dec 17 13:51:25 2024 +0900

    media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster
    
    commit 035371c9e5098018b8512efc6a8812912469480c upstream.
    
    The Wave5 521C variant does not support 10 bit decoding. When 10 bit
    decoding support was added for the 515 variant, a section of the code
    was removed which returned an error. This removal causes a timeout for
    the 521 variant, which was discovered during HEVC 10-bit decoding tests.
    
    Fixes: 143e7ab4d9a0 ("media: chips-media: wave5: support decoding HEVC Main10 profile")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
    Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: hi556: Fix memory leak (on error) in hi556_check_hwcfg() [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu Dec 19 20:27:30 2024 +0100

    media: hi556: Fix memory leak (on error) in hi556_check_hwcfg()
    
    commit ed554da65abd0c561e40d35272d1a61d030fe977 upstream.
    
    Commit 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is
    found") moved the v4l2_fwnode_endpoint_alloc_parse() call in
    hi556_check_hwcfg() up, but it did not make the error-exit paths between
    the old and new call-site use "goto check_hwcfg_error;" to free the bus_cfg
    on errors.
    
    Add the missing "goto check_hwcfg_error;" statements to fix a memleak on
    early error-exits from hi556_check_hwcfg().
    
    Fixes: 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is found")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: adv748x: Fix test pattern selection mask [+ + +]
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: stable@vger.kernel.org
    Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    [hverkuil: fixed tiny typo in commit log: my -> by]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ccs: Set the device's runtime PM status correctly in probe [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
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: stable@vger.kernel.org # for >= v5.15
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ccs: Set the device's runtime PM status correctly in remove [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
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: stable@vger.kernel.org # for >= v5.15
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: imx214: Rectify probe error handling related to runtime PM [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Fri Jan 10 14:36:01 2025 +0200

    media: i2c: imx214: Rectify probe error handling related to runtime PM
    
    commit ccc888d1698b6f42d52ddf5cecfe50fe925c95e5 upstream.
    
    There were multiple issues in the driver's probe function related to
    error handling:
    
    - Device's PM runtime status wasn't reverted to suspended on some errors
      in probe.
    
    - Runtime PM was left enabled for the device on some probe errors.
    
    - Device was left powered on if a probe failure happened or when it
      was removed when it was powered on.
    
    - An extra pm_runtime_set_suspended() was issued in driver's remove
      function when the device was suspended.
    
    Fix these bugs.
    
    Fixes: 436190596241 ("media: imx214: Add imx214 camera sensor driver")
    Cc: stable@vger.kernel.org # for >= v6.12
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Acked-by: André Apitzsch <git@apitzsch.eu>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: imx219: Rectify runtime PM handling in probe and remove [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Fri Jan 10 14:53:20 2025 +0200

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

media: i2c: imx319: Rectify runtime PM handling probe and remove [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Fri Jan 10 14:55:59 2025 +0200

    media: i2c: imx319: Rectify runtime PM handling probe and remove
    
    commit 5f5ffd3bc62b2e6c478061918b10473d8b90ac2d upstream.
    
    Idle the device only after the async sub-device has been successfully
    registered. In error handling, set the device's runtime PM status to
    suspended only if it has been set to active previously in probe.
    
    Also set the device's runtime PM status to suspended in remove only if it
    wasn't so already.
    
    Fixes: 8a89dc62f28c ("media: add imx319 camera sensor driver")
    Cc: stable@vger.kernel.org # for >= v6.12
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
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: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ov7251: Set enable GPIO low in probe [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
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: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: imx219: Adjust PLL settings based on the number of MIPI lanes [+ + +]
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date:   Thu Jan 23 15:37:49 2025 +0000

    media: imx219: Adjust PLL settings based on the number of MIPI lanes
    
    commit 591a07588c03437dbcc3addfff07675de95a461e upstream.
    
    Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
    added support for device tree to allow configuration of the sensor to
    use 4 lanes with a link frequency of 363MHz, and amended the advertised
    pixel rate to 280.8MPix/s.
    
    However it didn't change any of the PLL settings, so actually it would
    have been running overclocked in the MIPI block, and with the frame
    rate and exposure calculations being wrong as the pixel rate was
    unchanged.
    
    The pixel rate and link frequency advertised were taken from the "Clock
    Setting Example" section of the datasheet. However those are based on an
    external clock of 12MHz, and are unachievable with a clock of 24MHz - it
    seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the
    automatic configuration documented in "9-1-2 EXCK_FREQ setting depend on
    INCK frequency", not by writing the registers.
    The closest we can get with a 24MHz clock is 281.6MPix/s and 364MHz.
    
    Dropping all support for the 363MHz link frequency would cause problems
    for existing users, so allow it, but log a warning that the requested
    value is being changed to the supported one.
    
    Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
    Cc: stable@vger.kernel.org
    Co-developed-by: Peyton Howe <peyton.howe@bellsouth.net>
    Signed-off-by: Peyton Howe <peyton.howe@bellsouth.net>
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: intel/ipu6: set the dev_parent of video device to pdev [+ + +]
Author: Bingbu Cao <bingbu.cao@intel.com>
Date:   Fri Feb 14 18:52:38 2025 +0800

    media: intel/ipu6: set the dev_parent of video device to pdev
    
    commit 6f0ab5d3671f7cbb326c8cab6fb69cb7ab9901cc upstream.
    
    The bus_info in v4l2_capability of IPU6 isys v4l2_dev is missing.
    The driver didn't set the dev_parent of v4l2_dev, its parent is set
    to its parent auxdev which is neither platform nor PCI device, thus
    media_set_bus_info() will not set the bus_info of v4l2_capability, then
    `v4l2-ctl --all` cannot show the bus_info.
    
    This patch fixes it by setting the dev_parent of video_device and v4l2
    framework can detect the device type and set the bus_info instead.
    
    Fixes: 3c1dfb5a69cf ("media: intel/ipu6: input system video nodes and buffer queues")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
    Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

media: mediatek: vcodec: mark vdec_vp9_slice_map_counts_eob_coef noinline [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Oct 18 15:14:42 2024 +0000

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

media: mgb4: Fix CMT registers update logic [+ + +]
Author: Martin Tůma <martin.tuma@digiteqautomotive.com>
Date:   Fri Feb 21 13:07:42 2025 +0100

    media: mgb4: Fix CMT registers update logic
    
    commit dd05443189f9ae175dd806594b67bf55ddb6539e upstream.
    
    The CMT "magic values" registers must be updated while the CMT reset
    registers are active.
    
    Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: mgb4: Fix switched CMT frequency range "magic values" sets [+ + +]
Author: Martin Tůma <martin.tuma@digiteqautomotive.com>
Date:   Fri Feb 21 13:07:43 2025 +0100

    media: mgb4: Fix switched CMT frequency range "magic values" sets
    
    commit 450acf0840232eaf6eb7a80da11cf492e57498e8 upstream.
    
    The reason why this passed unnoticed is that most infotainment systems
    use frequencies near enough the middle (50MHz) where both sets work.
    
    Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

media: nuvoton: Fix reference handling of ece_node [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Mon Feb 24 07:03:54 2025 +0000

    media: nuvoton: Fix reference handling of ece_node
    
    commit 8ba4ef40ad6ca62368292a69855324213181abfb upstream.
    
    Make sure all the code paths call of_node_put().
    
    Instead of manually calling of_node_put, use the __free macros/helpers.
    
    Cc: stable@vger.kernel.org
    Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: nuvoton: Fix reference handling of ece_pdev [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Mon Feb 24 07:03:55 2025 +0000

    media: nuvoton: Fix reference handling of ece_pdev
    
    commit 453d5cadab1bde8e6fdd5bd05f4200338cb21e72 upstream.
    
    When we obtain a reference to of a platform_device, we need to release
    it via put_device.
    
    Found by cocci:
    ./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
    ./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
    ./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
    ./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
    
    Instead of manually calling put_device, use the __free macros.
    
    Cc: stable@vger.kernel.org
    Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: platform: stm32: Add check for clk_enable() [+ + +]
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Date:   Fri Nov 22 20:46:03 2024 +0000

    media: platform: stm32: Add check for clk_enable()
    
    commit f883f34b6a46b1a09d44d7f94c3cd72fe0e8f93b upstream.
    
    Add check for the return value of clk_enable() to gurantee the success.
    
    Fixes: 002e8f0d5927 ("media: stm32-dma2d: STM32 DMA2D driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: rockchip: rga: fix rga offset lookup [+ + +]
Author: John Keeping <jkeeping@inmusicbrands.com>
Date:   Sat Aug 10 14:02:54 2024 +0100

    media: rockchip: rga: fix rga offset lookup
    
    commit 11de3582675cc0b7136e12f3971f1da3e5a05382 upstream.
    
    The arguments to rga_lookup_draw_pos() are passed in the wrong order,
    rotate mode should be before mirror mode.
    
    Fixes: 558c248f930e6 ("media: rockchip: rga: split src and dst buffer setup")
    Cc: stable@vger.kernel.org
    Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
    Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: s5p-mfc: Corrected NV12M/NV21M plane-sizes [+ + +]
Author: Aakarsh Jain <aakarsh.jain@samsung.com>
Date:   Wed Feb 26 15:52:51 2025 +0530

    media: s5p-mfc: Corrected NV12M/NV21M plane-sizes
    
    [ Upstream commit 7d0d0b2342bebc47a46499cdf21257ed1e58c4aa ]
    
    There is a possibility of getting page fault if the overall
    buffer size is not aligned to 256bytes. Since MFC does read
    operation only and it won't corrupt the data values even if
    it reads the extra bytes.
    Corrected luma and chroma plane sizes for V4L2_PIX_FMT_NV12M
    and V4L2_PIX_FMT_NV21M pixel format.
    
    Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: siano: Fix error handling in smsdvb_module_init() [+ + +]
Author: Yuan Can <yuancan@huawei.com>
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: stable@vger.kernel.org
    Signed-off-by: Yuan Can <yuancan@huawei.com>
    Acked-by: Ricardo Ribalda <ribalda@chromium.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: streamzap: prevent processing IR data on URB failure [+ + +]
Author: Murad Masimov <m.masimov@mt-integration.ru>
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: stable@vger.kernel.org
    Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uapi: rkisp1-config: Fix typo in extensible params example [+ + +]
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Date:   Wed Feb 12 17:50:53 2025 +0100

    media: uapi: rkisp1-config: Fix typo in extensible params example
    
    commit 7b0ee2de7c76e5518e2235a927fd211bc785d320 upstream.
    
    The define used for the version in the example diagram does not match what
    is defined in enum rksip1_ext_param_buffer_version, nor the description
    above it. Correct the typo to make it clear which define to use.
    
    Fixes: e9d05e9d5db1 ("media: uapi: rkisp1-config: Add extensible params format")
    Cc: stable@vger.kernel.org
    Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Add quirk for Actions UVC05 [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 10 10:48:14 2024 +0000

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

media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf() [+ + +]
Author: Karina Yankevich <k.yankevich@omp.ru>
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: stable@vger.kernel.org
    Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
    Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: hfi: add a check to handle OOB in sfr region [+ + +]
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
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: stable@vger.kernel.org
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: hfi: add check to handle incorrect queue size [+ + +]
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
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: stable@vger.kernel.org
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: hfi_parser: add check to avoid out of bound access [+ + +]
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
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: stable@vger.kernel.org
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: hfi_parser: refactor hfi packet parsing logic [+ + +]
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
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: stable@vger.kernel.org
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: vim2m: print device name after registering device [+ + +]
Author: Matthew Majewski <mattwmajewski@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: visl: Fix ERANGE error when setting enum controls [+ + +]
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Tue Dec 10 16:02:53 2024 -0500

    media: visl: Fix ERANGE error when setting enum controls
    
    commit d98e9213a768a3cc3a99f5e1abe09ad3baff2104 upstream.
    
    The visl driver supports both frame and slice mode, with and without a
    start-code. But, the range and default for these enum controls was not
    set, which currently limits the decoder to enums with a value of 0. Fix
    this by setting the decoder mode and start code controls for both the
    H.264 and HEVC codecs.
    
    Fixes: 0c078e310b6d ("media: visl: add virtual stateless decoder driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mfd: ene-kb3930: Fix a potential NULL pointer dereference [+ + +]
Author: Chenyuan Yang <chenyuan0y@gmail.com>
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: stable@vger.kernel.org
    Fixes: ede6b2d1dfc0 ("mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller")
    Suggested-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
    Link: https://lore.kernel.org/r/20250224233736.1919739-1-chenyuan0y@gmail.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
misc: pci_endpoint_test: Fix displaying 'irq_type' after 'request_irq' error [+ + +]
Author: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
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: stable@vger.kernel.org
    Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype")
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
    Link: https://lore.kernel.org/r/20250225110252.28866-4-hayashi.kunihiko@socionext.com
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/damon/ops: have damon_get_folio return folio even for tail pages [+ + +]
Author: Usama Arif <usamaarif642@gmail.com>
Date:   Fri Feb 7 13:20:32 2025 -0800

    mm/damon/ops: have damon_get_folio return folio even for tail pages
    
    commit 3a06696305e757f652dd0dcf4dfa2272eda39434 upstream.
    
    Patch series "mm/damon/paddr: fix large folios access and schemes handling".
    
    DAMON operations set for physical address space, namely 'paddr', treats
    tail pages as unaccessed always.  It can also apply DAMOS action to a
    large folio multiple times within single DAMOS' regions walking.  As a
    result, the monitoring output has poor quality and DAMOS works in
    unexpected ways when large folios are being used.  Fix those.
    
    The patches were parts of Usama's hugepage_size DAMOS filter patch
    series[1].  The first fix has collected from there with a slight commit
    message change for the subject prefix.  The second fix is re-written by SJ
    and posted as an RFC before this series.  The second one also got a slight
    commit message change for the subject prefix.
    
    [1] https://lore.kernel.org/20250203225604.44742-1-usamaarif642@gmail.com
    [2] https://lore.kernel.org/20250206231103.38298-1-sj@kernel.org
    
    
    This patch (of 2):
    
    This effectively adds support for large folios in damon for paddr, as
    damon_pa_mkold/young won't get a null folio from this function and won't
    ignore it, hence access will be checked and reported.  This also means
    that larger folios will be considered for different DAMOS actions like
    pageout, prioritization and migration.  As these DAMOS actions will
    consider larger folios, iterate through the region at folio_size and not
    PAGE_SIZE intervals.  This should not have an affect on vaddr, as
    damon_young_pmd_entry considers pmd entries.
    
    Link: https://lkml.kernel.org/r/20250207212033.45269-1-sj@kernel.org
    Link: https://lkml.kernel.org/r/20250207212033.45269-2-sj@kernel.org
    Fixes: a28397beb55b ("mm/damon: implement primitives for physical address space monitoring")
    Signed-off-by: Usama Arif <usamaarif642@gmail.com>
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    mm/hugetlb: move hugetlb_sysctl_init() to the __init section
    
    commit 1ca77ff1837249701053a7fcbdedabc41f4ae67c upstream.
    
    hugetlb_sysctl_init() is only invoked once by an __init function and is
    merely a wrapper around another __init function so there is not reason to
    keep it.
    
    Fixes the following warning when toning down some GCC inline options:
    
     WARNING: modpost: vmlinux: section mismatch in reference:
       hugetlb_sysctl_init+0x1b (section: .text) ->
         __register_sysctl_init (section: .init.text)
    
    Link: https://lkml.kernel.org/r/20250319060041.2737320-1-marc.herbert@linux.intel.com
    Signed-off-by: Marc Herbert <Marc.Herbert@linux.intel.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Muchun Song <muchun.song@linux.dev>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/hwpoison: do not send SIGBUS to processes with recovered clean pages [+ + +]
Author: Shuai Xue <xueshuai@linux.alibaba.com>
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/20250217063335.22257-1-xueshuai@linux.alibaba.com/T/#mba94f1305b3009dd340ce4114d3221fe810d1871
    Link: https://lkml.kernel.org/r/20250312112852.82415-3-xueshuai@linux.alibaba.com
    Fixes: 046545a661af ("mm/hwpoison: fix error page recovered but reported "not recovered"")
    Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
    Tested-by: Tony Luck <tony.luck@intel.com>
    Acked-by: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: Borislav Betkov <bp@alien8.de>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jane Chu <jane.chu@oracle.com>
    Cc: Jarkko Sakkinen <jarkko@kernel.org>
    Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Cc: Josh Poimboeuf <jpoimboe@kernel.org>
    Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ruidong Tian <tianruidong@linux.alibaba.com>
    Cc: Thomas Gleinxer <tglx@linutronix.de>
    Cc: Yazen Ghannam <yazen.ghannam@amd.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm/hwpoison: introduce folio_contain_hwpoisoned_page() helper [+ + +]
Author: Jinjiang Tu <tujinjiang@huawei.com>
Date:   Tue Mar 18 16:39:38 2025 +0800

    mm/hwpoison: introduce folio_contain_hwpoisoned_page() helper
    
    commit 5f5ee52d4f58605330b09851273d6e56aaadd29e upstream.
    
    Patch series "mm/vmscan: don't try to reclaim hwpoison folio".
    
    Fix a bug during memory reclaim if folio is hwpoisoned.
    
    
    This patch (of 2):
    
    Introduce helper folio_contain_hwpoisoned_page() to check if the entire
    folio is hwpoisoned or it contains hwpoisoned pages.
    
    Link: https://lkml.kernel.org/r/20250318083939.987651-1-tujinjiang@huawei.com
    Link: https://lkml.kernel.org/r/20250318083939.987651-2-tujinjiang@huawei.com
    Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
    Acked-by: Miaohe Lin <linmiaohe@huawei.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: Nanyong Sun <sunnanyong@huawei.com>
    Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/mremap: correctly handle partial mremap() of VMA starting at 0 [+ + +]
Author: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date:   Mon Mar 10 20:50:34 2025 +0000

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

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

    mm/rmap: reject hugetlb folios in folio_make_device_exclusive()
    
    commit bc3fe6805cf09a25a086573a17d40e525208c5d8 upstream.
    
    Even though FOLL_SPLIT_PMD on hugetlb now always fails with -EOPNOTSUPP,
    let's add a safety net in case FOLL_SPLIT_PMD usage would ever be
    reworked.
    
    In particular, before commit 9cb28da54643 ("mm/gup: handle hugetlb in the
    generic follow_page_mask code"), GUP(FOLL_SPLIT_PMD) would just have
    returned a page.  In particular, hugetlb folios that are not PMD-sized
    would never have been prone to FOLL_SPLIT_PMD.
    
    hugetlb folios can be anonymous, and page_make_device_exclusive_one() is
    not really prepared for handling them at all.  So let's spell that out.
    
    Link: https://lkml.kernel.org/r/20250210193801.781278-3-david@redhat.com
    Fixes: b756a3b5e7ea ("mm: device exclusive memory access")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Tested-by: Alistair Popple <apopple@nvidia.com>
    Cc: Alex Shi <alexs@kernel.org>
    Cc: Danilo Krummrich <dakr@kernel.org>
    Cc: Dave Airlie <airlied@gmail.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Liam Howlett <liam.howlett@oracle.com>
    Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: Lyude <lyude@redhat.com>
    Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: SeongJae Park <sj@kernel.org>
    Cc: Simona Vetter <simona.vetter@ffwll.ch>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Yanteng Si <si.yanteng@linux.dev>
    Cc: Barry Song <v-songbaohua@oppo.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock [+ + +]
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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/20250312141014.129725-1-mathieu.desnoyers@efficios.com
    Fixes: d773ed6b856a ("mm: test and set zone reclaim lock before starting reclaim")
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Cc: Andrea Parri <parri.andrea@gmail.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Jade Alglave <j.alglave@ucl.ac.uk>
    Cc: Luc Maranget <luc.maranget@inria.fr>
    Cc: "Paul E. McKenney" <paulmck@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: fix lazy mmu docs and usage [+ + +]
Author: Ryan Roberts <ryan.roberts@arm.com>
Date:   Mon Mar 3 14:15:35 2025 +0000

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

mm: make page_mapped_in_vma() hugetlb walk aware [+ + +]
Author: Jane Chu <jane.chu@oracle.com>
Date:   Mon Feb 24 14:14:45 2025 -0700

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

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

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

 
mptcp: fix NULL pointer in can_accept_new_subflow [+ + +]
Author: Gang Yan <yangang@kylinos.cn>
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: stable@vger.kernel.org
    Suggested-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Gang Yan <yangang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250328-net-mptcp-misc-fixes-6-15-v1-1-34161a482a7f@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: only inc MPJoinAckHMacFailure for HMAC failures [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
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: stable@vger.kernel.org
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250407-net-mptcp-hmac-failure-mib-v1-1-3c9ecd0a3a50@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

    mptcp: sockopt: fix getting freebind & transparent
    
    commit e2f4ac7bab2205d3c4dd9464e6ffd82502177c51 upstream.
    
    When adding a socket option support in MPTCP, both the get and set parts
    are supposed to be implemented.
    
    IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part
    has been added a while ago, but it looks like the get part got
    forgotten. It should have been present as a way to verify a setting has
    been set as expected, and not to act differently from TCP or any other
    socket types.
    
    Everything was in place to expose it, just the last step was missing.
    Only new code is added to cover these specific getsockopt(), that seems
    safe.
    
    Fixes: c9406a23c116 ("mptcp: sockopt: add SOL_IP freebind & transparent options")
    Cc: stable@vger.kernel.org
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-3-122dbb249db3@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: sockopt: fix getting IPV6_V6ONLY [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
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: stable@vger.kernel.org
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/550
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-2-122dbb249db3@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mtd: Add check for devm_kcalloc() [+ + +]
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
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: stable@vger.kernel.org # v5.10+
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: inftlcore: Add error check for inftl_read_oob() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
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: stable@vger.kernel.org # v2.6+
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: rawnand: Add status chack in r852_ready() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
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: stable@vger.kernel.org # v4.20+
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: rawnand: brcmnand: fix PM resume warning [+ + +]
Author: Kamal Dasu <kamal.dasu@broadcom.com>
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: stable@vger.kernel.org
    Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: Replace kcalloc() with devm_kcalloc() [+ + +]
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
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: stable@vger.kernel.org # v5.10+
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net: dsa: mv88e6xxx: fix internal PHYs for 6320 family [+ + +]
Author: Marek Behún <kabel@kernel.org>
Date:   Mon Mar 17 18:32:49 2025 +0100

    net: dsa: mv88e6xxx: fix internal PHYs for 6320 family
    
    commit 52fdc41c3278c981066a461d03d5477ebfcf270c upstream.
    
    Fix internal PHYs definition for the 6320 family, which has only 2
    internal PHYs (on ports 3 and 4).
    
    Fixes: bc3931557d1d ("net: dsa: mv88e6xxx: Add number of internal PHYs")
    Signed-off-by: Marek Behún <kabel@kernel.org>
    Cc: <stable@vger.kernel.org> # 6.6.x
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250317173250.28780-7-kabel@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family [+ + +]
Author: Marek Behún <kabel@kernel.org>
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 <kabel@kernel.org>
    Cc: <stable@vger.kernel.org> # 5.4.x
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250317173250.28780-8-kabel@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ethtool: Don't call .cleanup_data when prepare_data fails [+ + +]
Author: Maxime Chevallier <maxime.chevallier@bootlin.com>
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 <kory.maincent@bootlin.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
    Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20250407130511.75621-1-maxime.chevallier@bootlin.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod. [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Apr 7 09:33:11 2025 -0700

    net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
    
    commit 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569 upstream.
    
    When I ran the repro [0] and waited a few seconds, I observed two
    LOCKDEP splats: a warning immediately followed by a null-ptr-deref. [1]
    
    Reproduction Steps:
    
      1) Mount CIFS
      2) Add an iptables rule to drop incoming FIN packets for CIFS
      3) Unmount CIFS
      4) Unload the CIFS module
      5) Remove the iptables rule
    
    At step 3), the CIFS module calls sock_release() for the underlying
    TCP socket, and it returns quickly.  However, the socket remains in
    FIN_WAIT_1 because incoming FIN packets are dropped.
    
    At this point, the module's refcnt is 0 while the socket is still
    alive, so the following rmmod command succeeds.
    
      # ss -tan
      State      Recv-Q Send-Q Local Address:Port  Peer Address:Port
      FIN-WAIT-1 0      477        10.0.2.15:51062   10.0.0.137:445
    
      # lsmod | grep cifs
      cifs                 1159168  0
    
    This highlights a discrepancy between the lifetime of the CIFS module
    and the underlying TCP socket.  Even after CIFS calls sock_release()
    and it returns, the TCP socket does not die immediately in order to
    close the connection gracefully.
    
    While this is generally fine, it causes an issue with LOCKDEP because
    CIFS assigns a different lock class to the TCP socket's sk->sk_lock
    using sock_lock_init_class_and_name().
    
    Once an incoming packet is processed for the socket or a timer fires,
    sk->sk_lock is acquired.
    
    Then, LOCKDEP checks the lock context in check_wait_context(), where
    hlock_class() is called to retrieve the lock class.  However, since
    the module has already been unloaded, hlock_class() logs a warning
    and returns NULL, triggering the null-ptr-deref.
    
    If LOCKDEP is enabled, we must ensure that a module calling
    sock_lock_init_class_and_name() (CIFS, NFS, etc) cannot be unloaded
    while such a socket is still alive to prevent this issue.
    
    Let's hold the module reference in sock_lock_init_class_and_name()
    and release it when the socket is freed in sk_prot_free().
    
    Note that sock_lock_init() clears sk->sk_owner for svc_create_socket()
    that calls sock_lock_init_class_and_name() for a listening socket,
    which clones a socket by sk_clone_lock() without GFP_ZERO.
    
    [0]:
    CIFS_SERVER="10.0.0.137"
    CIFS_PATH="//${CIFS_SERVER}/Users/Administrator/Desktop/CIFS_TEST"
    DEV="enp0s3"
    CRED="/root/WindowsCredential.txt"
    
    MNT=$(mktemp -d /tmp/XXXXXX)
    mount -t cifs ${CIFS_PATH} ${MNT} -o vers=3.0,credentials=${CRED},cache=none,echo_interval=1
    
    iptables -A INPUT -s ${CIFS_SERVER} -j DROP
    
    for i in $(seq 10);
    do
        umount ${MNT}
        rmmod cifs
        sleep 1
    done
    
    rm -r ${MNT}
    
    iptables -D INPUT -s ${CIFS_SERVER} -j DROP
    
    [1]:
    DEBUG_LOCKS_WARN_ON(1)
    WARNING: CPU: 10 PID: 0 at kernel/locking/lockdep.c:234 hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223)
    Modules linked in: cifs_arc4 nls_ucs2_utils cifs_md4 [last unloaded: cifs]
    CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Not tainted 6.14.0 #36
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    RIP: 0010:hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223)
    ...
    Call Trace:
     <IRQ>
     __lock_acquire (kernel/locking/lockdep.c:4853 kernel/locking/lockdep.c:5178)
     lock_acquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816)
     _raw_spin_lock_nested (kernel/locking/spinlock.c:379)
     tcp_v4_rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcp_ipv4.c:2350)
    ...
    
    BUG: kernel NULL pointer dereference, address: 00000000000000c4
     PF: supervisor read access in kernel mode
     PF: error_code(0x0000) - not-present page
    PGD 0
    Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI
    CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Tainted: G        W          6.14.0 #36
    Tainted: [W]=WARN
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    RIP: 0010:__lock_acquire (kernel/locking/lockdep.c:4852 kernel/locking/lockdep.c:5178)
    Code: 15 41 09 c7 41 8b 44 24 20 25 ff 1f 00 00 41 09 c7 8b 84 24 a0 00 00 00 45 89 7c 24 20 41 89 44 24 24 e8 e1 bc ff ff 4c 89 e7 <44> 0f b6 b8 c4 00 00 00 e8 d1 bc ff ff 0f b6 80 c5 00 00 00 88 44
    RSP: 0018:ffa0000000468a10 EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ff1100010091cc38 RCX: 0000000000000027
    RDX: ff1100081f09ca48 RSI: 0000000000000001 RDI: ff1100010091cc88
    RBP: ff1100010091c200 R08: ff1100083fe6e228 R09: 00000000ffffbfff
    R10: ff1100081eca0000 R11: ff1100083fe10dc0 R12: ff1100010091cc88
    R13: 0000000000000001 R14: 0000000000000000 R15: 00000000000424b1
    FS:  0000000000000000(0000) GS:ff1100081f080000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000000000c4 CR3: 0000000002c4a003 CR4: 0000000000771ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
    PKRU: 55555554
    Call Trace:
     <IRQ>
     lock_acquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816)
     _raw_spin_lock_nested (kernel/locking/spinlock.c:379)
     tcp_v4_rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcp_ipv4.c:2350)
     ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205 (discriminator 1))
     ip_local_deliver_finish (./include/linux/rcupdate.h:878 net/ipv4/ip_input.c:234)
     ip_sublist_rcv_finish (net/ipv4/ip_input.c:576)
     ip_list_rcv_finish (net/ipv4/ip_input.c:628)
     ip_list_rcv (net/ipv4/ip_input.c:670)
     __netif_receive_skb_list_core (net/core/dev.c:5939 net/core/dev.c:5986)
     netif_receive_skb_list_internal (net/core/dev.c:6040 net/core/dev.c:6129)
     napi_complete_done (./include/linux/list.h:37 ./include/net/gro.h:519 ./include/net/gro.h:514 net/core/dev.c:6496)
     e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3815)
     __napi_poll.constprop.0 (net/core/dev.c:7191)
     net_rx_action (net/core/dev.c:7262 net/core/dev.c:7382)
     handle_softirqs (kernel/softirq.c:561)
     __irq_exit_rcu (kernel/softirq.c:596 kernel/softirq.c:435 kernel/softirq.c:662)
     irq_exit_rcu (kernel/softirq.c:680)
     common_interrupt (arch/x86/kernel/irq.c:280 (discriminator 14))
      </IRQ>
     <TASK>
     asm_common_interrupt (./arch/x86/include/asm/idtentry.h:693)
    RIP: 0010:default_idle (./arch/x86/include/asm/irqflags.h:37 ./arch/x86/include/asm/irqflags.h:92 arch/x86/kernel/process.c:744)
    Code: 4c 01 c7 4c 29 c2 e9 72 ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d c3 2b 15 00 fb f4 <fa> c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90
    RSP: 0018:ffa00000000ffee8 EFLAGS: 00000202
    RAX: 000000000000640b RBX: ff1100010091c200 RCX: 0000000000061aa4
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff812f30c5
    RBP: 000000000000000a R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
     ? do_idle (kernel/sched/idle.c:186 kernel/sched/idle.c:325)
     default_idle_call (./include/linux/cpuidle.h:143 kernel/sched/idle.c:118)
     do_idle (kernel/sched/idle.c:186 kernel/sched/idle.c:325)
     cpu_startup_entry (kernel/sched/idle.c:422 (discriminator 1))
     start_secondary (arch/x86/kernel/smpboot.c:315)
     common_startup_64 (arch/x86/kernel/head_64.S:421)
     </TASK>
    Modules linked in: cifs_arc4 nls_ucs2_utils cifs_md4 [last unloaded: cifs]
    CR2: 00000000000000c4
    
    Fixes: ed07536ed673 ("[PATCH] lockdep: annotate nfs/nfsd in-kernel sockets")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250407163313.22682-1-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: libwx: handle page_pool_dev_alloc_pages error [+ + +]
Author: Chenyuan Yang <chenyuan0y@gmail.com>
Date:   Mon Apr 7 13:49:52 2025 -0500

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

net: mana: Switch to page pool for jumbo frames [+ + +]
Author: Haiyang Zhang <haiyangz@microsoft.com>
Date:   Tue Mar 25 09:32:37 2025 -0700

    net: mana: Switch to page pool for jumbo frames
    
    commit fa37a8849634db2dd3545116873da8cf4b1e67c6 upstream.
    
    Frag allocators, such as netdev_alloc_frag(), were not designed to
    work for fragsz > PAGE_SIZE.
    
    So, switch to page pool for jumbo frames instead of using page frag
    allocators. This driver is using page pool for smaller MTUs already.
    
    Cc: stable@vger.kernel.org
    Fixes: 80f6215b450e ("net: mana: Add support for jumbo frame")
    Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
    Reviewed-by: Long Li <longli@microsoft.com>
    Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
    Link: https://patch.msgid.link/1742920357-27263-1-git-send-email-haiyangz@microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: page_pool: don't cast mp param to devmem [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Feb 4 13:56:12 2025 -0800

    net: page_pool: don't cast mp param to devmem
    
    [ Upstream commit 8d522566ae9cb3f0609ddb2a6ce3f4f39988043c ]
    
    page_pool_check_memory_provider() is a generic path and shouldn't assume
    anything about the actual type of the memory provider argument. It's
    fine while devmem is the only provider, but cast away the devmem
    specific binding types to avoid confusion.
    
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Reviewed-by: Mina Almasry <almasrymina@google.com>
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: David Wei <dw@davidwei.uk>
    Link: https://patch.msgid.link/20250204215622.695511-2-dw@davidwei.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Mon Apr 7 12:40:42 2025 +0300

    net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY
    
    [ Upstream commit fc75ea20ffb452652f0d4033f38fe88d7cfdae35 ]
    
    DSA has 2 kinds of drivers:
    
    1. Those who call dsa_switch_suspend() and dsa_switch_resume() from
       their device PM ops: qca8k-8xxx, bcm_sf2, microchip ksz
    2. Those who don't: all others. The above methods should be optional.
    
    For type 1, dsa_switch_suspend() calls dsa_user_suspend() -> phylink_stop(),
    and dsa_switch_resume() calls dsa_user_resume() -> phylink_start().
    These seem good candidates for setting mac_managed_pm = true because
    that is essentially its definition [1], but that does not seem to be the
    biggest problem for now, and is not what this change focuses on.
    
    Talking strictly about the 2nd category of DSA drivers here (which
    do not have MAC managed PM, meaning that for their attached PHYs,
    mdio_bus_phy_suspend() and mdio_bus_phy_resume() should run in full),
    I have noticed that the following warning from mdio_bus_phy_resume() is
    triggered:
    
            WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY &&
                    phydev->state != PHY_UP);
    
    because the PHY state machine is running.
    
    It's running as a result of a previous dsa_user_open() -> ... ->
    phylink_start() -> phy_start() having been initiated by the user.
    
    The previous mdio_bus_phy_suspend() was supposed to have called
    phy_stop_machine(), but it didn't. So this is why the PHY is in state
    PHY_NOLINK by the time mdio_bus_phy_resume() runs.
    
    mdio_bus_phy_suspend() did not call phy_stop_machine() because for
    phylink, the phydev->adjust_link function pointer is NULL. This seems a
    technicality introduced by commit fddd91016d16 ("phylib: fix PAL state
    machine restart on resume"). That commit was written before phylink
    existed, and was intended to avoid crashing with consumer drivers which
    don't use the PHY state machine - phylink always does, when using a PHY.
    But phylink itself has historically not been developed with
    suspend/resume in mind, and apparently not tested too much in that
    scenario, allowing this bug to exist unnoticed for so long. Plus, prior
    to the WARN_ON(), it would have likely been invisible.
    
    This issue is not in fact restricted to type 2 DSA drivers (according to
    the above ad-hoc classification), but can be extrapolated to any MAC
    driver with phylink and MDIO-bus-managed PHY PM ops. DSA is just where
    the issue was reported. Assuming mac_managed_pm is set correctly, a
    quick search indicates the following other drivers might be affected:
    
    $ grep -Zlr PHYLINK_NETDEV drivers/ | xargs -0 grep -L mac_managed_pm
    drivers/net/ethernet/atheros/ag71xx.c
    drivers/net/ethernet/microchip/sparx5/sparx5_main.c
    drivers/net/ethernet/microchip/lan966x/lan966x_main.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
    drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/freescale/ucc_geth.c
    drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
    drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
    drivers/net/ethernet/marvell/mvneta.c
    drivers/net/ethernet/marvell/prestera/prestera_main.c
    drivers/net/ethernet/mediatek/mtk_eth_soc.c
    drivers/net/ethernet/altera/altera_tse_main.c
    drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
    drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
    drivers/net/ethernet/tehuti/tn40_phy.c
    drivers/net/ethernet/mscc/ocelot_net.c
    
    Make the existing conditions dependent on the PHY device having a
    phydev->phy_link_change() implementation equal to the default
    phy_link_change() provided by phylib. Otherwise, we implicitly know that
    the phydev has the phylink-provided phylink_phy_change() callback, and
    when phylink is used, the PHY state machine always needs to be stopped/
    started on the suspend/resume path. The code is structured as such that
    if phydev->phy_link_change() is absent, it is a matter of time until the
    kernel will crash - no need to further complicate the test.
    
    Thus, for the situation where the PM is not managed by the MAC, we will
    make the MDIO bus PM ops treat identically the phylink-controlled PHYs
    with the phylib-controlled PHYs where an adjust_link() callback is
    supplied. In both cases, the MDIO bus PM ops should stop and restart the
    PHY state machine.
    
    [1] https://lore.kernel.org/netdev/Z-1tiW9zjcoFkhwc@shell.armlinux.org.uk/
    
    Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
    Reported-by: Wei Fang <wei.fang@nxp.com>
    Tested-by: Wei Fang <wei.fang@nxp.com>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://patch.msgid.link/20250407094042.2155633-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend() [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Mon Apr 7 12:38:59 2025 +0300

    net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend()
    
    [ Upstream commit f40a673d6b4a128fe95dd9b8c3ed02da50a6a862 ]
    
    In an upcoming change, mdio_bus_phy_may_suspend() will need to
    distinguish a phylib-based PHY client from a phylink PHY client.
    For that, it will need to compare the phydev->phy_link_change() function
    pointer with the eponymous phy_link_change() provided by phylib.
    
    To avoid forward function declarations, the default PHY link state
    change method should be moved upwards. There is no functional change
    associated with this patch, it is only to reduce the noise from a real
    bug fix.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://patch.msgid.link/20250407093900.2155112-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: fc75ea20ffb4 ("net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ppp: Add bound checking for skb data on ppp_sync_txmung [+ + +]
Author: Arnaud Lecomte <contact@arnaud-lcm.com>
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: syzbot+29fc8991b0ecb186cf40@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=29fc8991b0ecb186cf40
    Tested-by: syzbot+29fc8991b0ecb186cf40@syzkaller.appspotmail.com
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Arnaud Lecomte <contact@arnaud-lcm.com>
    Link: https://patch.msgid.link/20250408-bound-checking-ppp_txmung-v2-1-94bb6e1b92d0@arnaud-lcm.com
    [pabeni@redhat.com: fixed subj typo]
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sfp: add quirk for 2.5G OEM BX SFP [+ + +]
Author: Birger Koblitz <mail@birger-koblitz.de>
Date:   Tue Feb 18 18:59:40 2025 +0100

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

net: sfp: add quirk for FS SFP-10GM-T copper SFP+ module [+ + +]
Author: Martin Schiller <ms@dev.tdt.de>
Date:   Thu Feb 27 08:10:58 2025 +0100

    net: sfp: add quirk for FS SFP-10GM-T copper SFP+ module
    
    [ Upstream commit 05ec5c085eb7ae044d49e04a3cff194a0b2a3251 ]
    
    Add quirk for a copper SFP that identifies itself as "FS" "SFP-10GM-T".
    It uses RollBall protocol to talk to the PHY and needs 4 sec wait before
    probing the PHY.
    
    Signed-off-by: Martin Schiller <ms@dev.tdt.de>
    Link: https://patch.msgid.link/20250227071058.1520027-1-ms@dev.tdt.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: tls: explicitly disallow disconnect [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
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: syzbot+b4cd76826045a1eb93c1@syzkaller.appspotmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://patch.msgid.link/20250404180334.3224206-1-kuba@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: asix_devices: add FiberGecko DeviceID [+ + +]
Author: Max Schulze <max.schulze@online.de>
Date:   Wed Feb 12 16:09:51 2025 +0100

    net: usb: asix_devices: add FiberGecko DeviceID
    
    [ Upstream commit 4079918ae720e842ed7dff65fedeb9980b374995 ]
    
    The FiberGecko is a small USB module that connects a 100 Mbit/s SFP
    
    Signed-off-by: Max Schulze <max.schulze@online.de>
    Tested-by: Max Schulze <max.schulze@online.de>
    Suggested-by: David Hollis <dhollis@davehollis.com>
    Reported-by: Sven Kreiensen <s.kreiensen@lyconsys.com>
    Link: https://patch.msgid.link/20250212150957.43900-2-max.schulze@online.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vlan: don't propagate flags on open [+ + +]
Author: Stanislav Fomichev <sdf@fomichev.me>
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: syzbot+b0c03d76056ef6cd12a6@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/Z9CfXjLMKn6VLG5d@mini-arch/T/#m15ba130f53227c883e79fb969687d69d670337a0
    Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250313100657.2287455-1-sdf@fomichev.me
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net_sched: sch_sfq: move the limit validation [+ + +]
Author: Octavian Purdila <tavip@google.com>
Date:   Mon Apr 7 13:24:08 2025 -0700

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

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

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

 
nfsd: don't ignore the return code of svc_proc_register() [+ + +]
Author: Jeff Layton <jlayton@kernel.org>
Date:   Thu Feb 6 13:12:13 2025 -0500

    nfsd: don't ignore the return code of svc_proc_register()
    
    commit 930b64ca0c511521f0abdd1d57ce52b2a6e3476b upstream.
    
    Currently, nfsd_proc_stat_init() ignores the return value of
    svc_proc_register(). If the procfile creation fails, then the kernel
    will WARN when it tries to remove the entry later.
    
    Fix nfsd_proc_stat_init() to return the same type of pointer as
    svc_proc_register(), and fix up nfsd_net_init() to check that and fail
    the nfsd_net construction if it occurs.
    
    svc_proc_register() can fail if the dentry can't be allocated, or if an
    identical dentry already exists. The second case is pretty unlikely in
    the nfsd_net construction codepath, so if this happens, return -ENOMEM.
    
    Reported-by: syzbot+e34ad04f27991521104c@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-nfs/67a47501.050a0220.19061f.05f9.GAE@google.com/
    Cc: stable@vger.kernel.org # v6.9
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NFSD: Fix CB_GETATTR status fix [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon Feb 10 11:43:31 2025 -0500

    NFSD: Fix CB_GETATTR status fix
    
    commit 4990d098433db18c854e75fb0f90d941eb7d479e upstream.
    
    Jeff says:
    
    Now that I look, 1b3e26a5ccbf is wrong. The patch on the ml was correct, but
    the one that got committed is different. It should be:
    
        status = decode_cb_op_status(xdr, OP_CB_GETATTR, &cb->cb_status);
        if (unlikely(status || cb->cb_status))
    
    If "status" is non-zero, decoding failed (usu. BADXDR), but we also want to
    bail out and not decode the rest of the call if the decoded cb_status is
    non-zero. That's not happening here, cb_seq_status has already been checked and
    is non-zero, so this ends up trying to decode the rest of the CB_GETATTR reply
    when it doesn't exist.
    
    Reported-by: Jeff Layton <jlayton@kernel.org>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219737
    Fixes: 1b3e26a5ccbf ("NFSD: fix decoding in nfs4_xdr_dec_cb_getattr")
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

NFSD: fix decoding in nfs4_xdr_dec_cb_getattr [+ + +]
Author: Olga Kornievskaia <okorniev@redhat.com>
Date:   Thu Dec 19 15:12:04 2024 -0500

    NFSD: fix decoding in nfs4_xdr_dec_cb_getattr
    
    commit 1b3e26a5ccbfc2f85bda1930cc278e313165e353 upstream.
    
    If a client were to send an error to a CB_GETATTR call, the code
    erronously continues to try decode past the error code. It ends
    up returning BAD_XDR error to the rpc layer and then in turn
    trigger a WARN_ONCE in nfsd4_cb_done() function.
    
    Fixes: 6487a13b5c6b ("NFSD: add support for CB_GETATTR callback")
    Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nft_set_pipapo: fix incorrect avx2 match of 5th field octet [+ + +]
Author: Florian Westphal <fw@strlen.de>
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 <sontu21@gmail.com>
    Closes: https://lore.kernel.org/netfilter/CANgxkqwnMH7fXra+VUfODT-8+qFLgskq3set1cAzqqJaV4iEZg@mail.gmail.com/T/#t
    Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ntb: use 64-bit arithmetic for the MSI doorbell mask [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
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: stable@vger.kernel.org
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Signed-off-by: Jon Mason <jdmason@kudzu.us>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvmet-fcloop: swap list_add_tail arguments [+ + +]
Author: Daniel Wagner <wagi@kernel.org>
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 <wagi@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret() [+ + +]
Author: Josh Poimboeuf <jpoimboe@kernel.org>
Date:   Tue Apr 8 00:02:13 2025 -0700

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

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

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

 
of/irq: Fix device node refcount leakage in API irq_of_parse_and_map() [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
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: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-6-93e3a2659aa7@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

of/irq: Fix device node refcount leakages in of_irq_count() [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
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: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-5-93e3a2659aa7@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

of/irq: Fix device node refcount leakages in of_irq_init() [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
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: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250209-of_irq_fix-v2-7-93e3a2659aa7@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
page_pool: avoid infinite loop to schedule delayed worker [+ + +]
Author: Jason Xing <kerneljasonxing@gmail.com>
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 <kerneljasonxing@gmail.com>
    Reviewed-by: Mina Almasry <almasrymina@google.com>
    Link: https://patch.msgid.link/20250214064250.85987-1-kerneljasonxing@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PCI: Add Rockchip Vendor ID [+ + +]
Author: Shawn Lin <shawn.lin@rock-chips.com>
Date:   Tue Feb 18 10:21:21 2025 +0100

    PCI: Add Rockchip Vendor ID
    
    [ Upstream commit 20bbb083bbc9d3f8db390f2e35e168f1b23dae8a ]
    
    Move PCI_VENDOR_ID_ROCKCHIP from pci_endpoint_test.c to pci_ids.h and
    reuse it in pcie-rockchip-host.c.
    
    Link: https://lore.kernel.org/r/20250218092120.2322784-2-cassel@kernel.org
    Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe() [+ + +]
Author: Stanimir Varbanov <svarbanov@suse.de>
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: stable@vger.kernel.org # v5.10+
    Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
    Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Link: https://lore.kernel.org/r/20250122222955.1752778-1-svarbanov@suse.de
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: Check BAR index for validity [+ + +]
Author: Philipp Stanner <phasta@kernel.org>
Date:   Wed Mar 12 09:06:35 2025 +0100

    PCI: Check BAR index for validity
    
    [ Upstream commit b1a7f99967fc0c052db8e65b449c7b32b1e9177f ]
    
    Many functions in PCI use accessor macros such as pci_resource_len(),
    which take a BAR index. That index, however, is never checked for
    validity, potentially resulting in undefined behavior by overflowing the
    array pci_dev.resource in the macro pci_resource_n().
    
    Since many users of those macros directly assign the accessed value to
    an unsigned integer, the macros cannot be changed easily anymore to
    return -EINVAL for invalid indexes. Consequently, the problem has to be
    mitigated in higher layers.
    
    Add pci_bar_index_valid(). Use it where appropriate.
    
    Link: https://lore.kernel.org/r/20250312080634.13731-4-phasta@kernel.org
    Closes: https://lore.kernel.org/all/adb53b1f-29e1-3d14-0e61-351fd2d3ff0d@linux.intel.com/
    Reported-by: Bingbu Cao <bingbu.cao@linux.intel.com>
    Signed-off-by: Philipp Stanner <phasta@kernel.org>
    [kwilczynski: correct if-statement condition the pci_bar_index_is_valid()
    helper function uses, tidy up code comments]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    [bhelgaas: fix typo]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: Enable Configuration RRS SV early [+ + +]
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Mon Mar 3 15:02:17 2025 -0600

    PCI: Enable Configuration RRS SV early
    
    [ Upstream commit 3f8c4959fc18e477801386a625e726c59f52a2c4 ]
    
    Following a reset, a Function may respond to Config Requests with Request
    Retry Status (RRS) Completion Status to indicate that it is temporarily
    unable to process the Request, but will be able to process the Request in
    the future (PCIe r6.0, sec 2.3.1).
    
    If the Configuration RRS Software Visibility feature is enabled and a Root
    Complex receives RRS for a config read of the Vendor ID, the Root Complex
    completes the Request to the host by returning PCI_VENDOR_ID_PCI_SIG,
    0x0001 (sec 2.3.2).
    
    The Config RRS SV feature applies only to Root Ports and is not directly
    related to pci_scan_bridge_extend().  Move the RRS SV enable to
    set_pcie_port_type() where we handle other PCIe-specific configuration.
    
    Link: https://lore.kernel.org/r/20250303210217.199504-1-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: Fix reference leak in pci_alloc_child_bus() [+ + +]
Author: Ma Ke <make24@iscas.ac.cn>
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/20250202062357.872971-1-make24@iscas.ac.cn
    Fixes: 4f535093cf8f ("PCI: Put pci_dev in device tree as early as possible")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: Fix reference leak in pci_register_host_bridge() [+ + +]
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Tue Feb 25 10:14:40 2025 +0800

    PCI: Fix reference leak in pci_register_host_bridge()
    
    commit 804443c1f27883926de94c849d91f5b7d7d696e9 upstream.
    
    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/20250225021440.3130264-1-make24@iscas.ac.cn
    Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    [bhelgaas: squash Dan Carpenter's double free fix from
    https://lore.kernel.org/r/db806a6c-a91b-4e5a-a84b-6b7e01bdac85@stanley.mountain]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: Fix wrong length of devres array [+ + +]
Author: Philipp Stanner <phasta@kernel.org>
Date:   Wed Mar 12 09:06:34 2025 +0100

    PCI: Fix wrong length of devres array
    
    commit f09d3937d400433080d17982bd1a540da53a156d upstream.
    
    The array for the iomapping cookie addresses has a length of
    PCI_STD_NUM_BARS. This constant, however, only describes standard BARs;
    while PCI can allow for additional, special BARs.
    
    The total number of PCI resources is described by constant
    PCI_NUM_RESOURCES, which is also used in, e.g., pci_select_bars().
    
    Thus, the devres array has so far been too small.
    
    Change the length of the devres array to PCI_NUM_RESOURCES.
    
    Link: https://lore.kernel.org/r/20250312080634.13731-3-phasta@kernel.org
    Fixes: bbaff68bf4a4 ("PCI: Add managed partial-BAR request and map infrastructure")
    Signed-off-by: Philipp Stanner <phasta@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Cc: stable@vger.kernel.org      # v6.11+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: j721e: Fix the value of .linkdown_irq_regfield for J784S4 [+ + +]
Author: Siddharth Vadapalli <s-vadapalli@ti.com>
Date:   Wed Mar 5 18:50:18 2025 +0530

    PCI: j721e: Fix the value of .linkdown_irq_regfield for J784S4
    
    commit d66b5b336245b91681c2042e7eedf63ef7c2f6db upstream.
    
    Commit e49ad667815d ("PCI: j721e: Add TI J784S4 PCIe configuration")
    assigned the value of .linkdown_irq_regfield for the J784S4 SoC as the
    "LINK_DOWN" macro corresponding to BIT(1), and as a result, the Link
    Down interrupts on J784S4 SoC are missed.
    
    According to the Technical Reference Manual and Register Documentation
    for the J784S4 SoC[1], BIT(1) corresponds to "ENABLE_SYS_EN_PCIE_DPA_1",
    which is not the correct field for the link-state interrupt. Instead, it
    is BIT(10) of the "PCIE_INTD_ENABLE_REG_SYS_2" register that corresponds
    to the link-state field named as "ENABLE_SYS_EN_PCIE_LINK_STATE".
    
    Thus, set .linkdown_irq_regfield to the macro "J7200_LINK_DOWN", which
    expands to BIT(10) and was first defined for the J7200 SoC. Other SoCs
    already reuse this macro since it accurately represents the "link-state"
    field in their respective "PCIE_INTD_ENABLE_REG_SYS_2" register.
    
    1: https://www.ti.com/lit/zip/spruj52
    
    Fixes: e49ad667815d ("PCI: j721e: Add TI J784S4 PCIe configuration")
    Cc: stable@vger.kernel.org
    Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
    [kwilczynski: commit log, add a missing .linkdown_irq_regfield member
    set to the J7200_LINK_DOWN macro to struct j7200_pcie_ep_data]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Link: https://lore.kernel.org/r/20250305132018.2260771-1-s-vadapalli@ti.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: pciehp: Avoid unnecessary device replacement check [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Tue Mar 11 07:27:32 2025 +0100

    PCI: pciehp: Avoid unnecessary device replacement check
    
    commit e3260237aaadc9799107ccb940c6688195c4518d upstream.
    
    Hot-removal of nested PCI hotplug ports suffers from a long-standing race
    condition which can lead to a deadlock:  A parent hotplug port acquires
    pci_lock_rescan_remove(), then waits for pciehp to unbind from a child
    hotplug port.  Meanwhile that child hotplug port tries to acquire
    pci_lock_rescan_remove() as well in order to remove its own children.
    
    The deadlock only occurs if the parent acquires pci_lock_rescan_remove()
    first, not if the child happens to acquire it first.
    
    Several workarounds to avoid the issue have been proposed and discarded
    over the years, e.g.:
    
    https://lore.kernel.org/r/4c882e25194ba8282b78fe963fec8faae7cf23eb.1529173804.git.lukas@wunner.de/
    
    A proper fix is being worked on, but needs more time as it is nontrivial
    and necessarily intrusive.
    
    Recent commit 9d573d19547b ("PCI: pciehp: Detect device replacement during
    system sleep") provokes more frequent occurrence of the deadlock when
    removing more than one Thunderbolt device during system sleep.  The commit
    sought to detect device replacement, but also triggered on device removal.
    Differentiating reliably between replacement and removal is impossible
    because pci_get_dsn() returns 0 both if the device was removed, as well as
    if it was replaced with one lacking a Device Serial Number.
    
    Avoid the more frequent occurrence of the deadlock by checking whether the
    hotplug port itself was hot-removed.  If so, there's no sense in checking
    whether its child device was replaced.
    
    This works because the ->resume_noirq() callback is invoked in top-down
    order for the entire hierarchy:  A parent hotplug port detecting device
    replacement (or removal) marks all children as removed using
    pci_dev_set_disconnected() and a child hotplug port can then reliably
    detect being removed.
    
    Link: https://lore.kernel.org/r/02f166e24c87d6cde4085865cce9adfdfd969688.1741674172.git.lukas@wunner.de
    Fixes: 9d573d19547b ("PCI: pciehp: Detect device replacement during system sleep")
    Reported-by: Kenneth Crudup <kenny@panix.com>
    Closes: https://lore.kernel.org/r/83d9302a-f743-43e4-9de2-2dd66d91ab5b@panix.com/
    Reported-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
    Closes: https://lore.kernel.org/r/20240926125909.2362244-1-acelan.kao@canonical.com/
    Tested-by: Kenneth Crudup <kenny@panix.com>
    Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Cc: stable@vger.kernel.org # v6.11+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type [+ + +]
Author: Ryo Takakura <ryotkkr98@gmail.com>
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 <ryotkkr98@gmail.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Acked-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    [bigeasy: reword commit message]
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Tested-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Link: https://lore.kernel.org/r/20250218080830.ufw3IgyX@linutronix.de
    [kwilczynski: commit log]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    [bhelgaas: add back report info from
    https://lore.kernel.org/lkml/20241218115951.83062-1-ryotkkr98@gmail.com/]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/core: Add aux_pause, aux_resume, aux_start_paused [+ + +]
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Tue Oct 22 18:59:08 2024 +0300

    perf/core: Add aux_pause, aux_resume, aux_start_paused
    
    [ Upstream commit 18d92bb57c39504d9da11c6ef604f58eb1d5a117 ]
    
    Hardware traces, such as instruction traces, can produce a vast amount of
    trace data, so being able to reduce tracing to more specific circumstances
    can be useful.
    
    The ability to pause or resume tracing when another event happens, can do
    that.
    
    Add ability for an event to "pause" or "resume" AUX area tracing.
    
    Add aux_pause bit to perf_event_attr to indicate that, if the event
    happens, the associated AUX area tracing should be paused. Ditto
    aux_resume. Do not allow aux_pause and aux_resume to be set together.
    
    Add aux_start_paused bit to perf_event_attr to indicate to an AUX area
    event that it should start in a "paused" state.
    
    Add aux_paused to struct hw_perf_event for AUX area events to keep track of
    the "paused" state. aux_paused is initialized to aux_start_paused.
    
    Add PERF_EF_PAUSE and PERF_EF_RESUME modes for ->stop() and ->start()
    callbacks. Call as needed, during __perf_event_output(). Add
    aux_in_pause_resume to struct perf_buffer to prevent races with the NMI
    handler. Pause/resume in NMI context will miss out if it coincides with
    another pause/resume.
    
    To use aux_pause or aux_resume, an event must be in a group with the AUX
    area event as the group leader.
    
    Example (requires Intel PT and tools patches also):
    
     $ perf record --kcore -e intel_pt/aux-action=start-paused/k,syscalls:sys_enter_newuname/aux-action=resume/,syscalls:sys_exit_newuname/aux-action=pause/ uname
     Linux
     [ perf record: Woken up 1 times to write data ]
     [ perf record: Captured and wrote 0.043 MB perf.data ]
     $ perf script --call-trace
     uname   30805 [000] 24001.058782799: name: 0x7ffc9c1865b0
     uname   30805 [000] 24001.058784424:  psb offs: 0
     uname   30805 [000] 24001.058784424:  cbr: 39 freq: 3904 MHz (139%)
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])        debug_smp_processor_id
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])        __x64_sys_newuname
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])            down_read
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])                __cond_resched
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])                preempt_count_add
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])                    in_lock_functions
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])                preempt_count_sub
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])            up_read
     uname   30805 [000] 24001.058784629: ([kernel.kallsyms])                preempt_count_add
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])                    in_lock_functions
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])                preempt_count_sub
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])            _copy_to_user
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])        syscall_exit_to_user_mode
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])            syscall_exit_work
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])                perf_syscall_exit
     uname   30805 [000] 24001.058784838: ([kernel.kallsyms])                    debug_smp_processor_id
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                    perf_trace_buf_alloc
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                        perf_swevent_get_recursion_context
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                            debug_smp_processor_id
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                        debug_smp_processor_id
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                    perf_tp_event
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                        perf_trace_buf_update
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                            tracing_gen_ctx_irq_test
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                        perf_swevent_event
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                            __perf_event_account_interrupt
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                                __this_cpu_preempt_check
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                            perf_event_output_forward
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                                perf_event_aux_pause
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                                    ring_buffer_get
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                                        __rcu_read_lock
     uname   30805 [000] 24001.058785046: ([kernel.kallsyms])                                        __rcu_read_unlock
     uname   30805 [000] 24001.058785254: ([kernel.kallsyms])                                    pt_event_stop
     uname   30805 [000] 24001.058785254: ([kernel.kallsyms])                                        debug_smp_processor_id
     uname   30805 [000] 24001.058785254: ([kernel.kallsyms])                                        debug_smp_processor_id
     uname   30805 [000] 24001.058785254: ([kernel.kallsyms])                                        native_write_msr
     uname   30805 [000] 24001.058785463: ([kernel.kallsyms])                                        native_write_msr
     uname   30805 [000] 24001.058785639: 0x0
    
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: James Clark <james.clark@arm.com>
    Link: https://lkml.kernel.org/r/20241022155920.17511-3-adrian.hunter@intel.com
    Stable-dep-of: 56799bc03565 ("perf: Fix hang while freeing sigtrap event")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

perf/core: Simplify the perf_event_alloc() error path [+ + +]
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon Nov 4 14:39:13 2024 +0100

    perf/core: Simplify the perf_event_alloc() error path
    
    [ Upstream commit c70ca298036c58a88686ff388d3d367e9d21acf0 ]
    
    The error cleanup sequence in perf_event_alloc() is a subset of the
    existing _free_event() function (it must of course be).
    
    Split this out into __free_event() and simplify the error path.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>
    Link: https://lore.kernel.org/r/20241104135517.967889521@infradead.org
    Stable-dep-of: 56799bc03565 ("perf: Fix hang while freeing sigtrap event")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/dwc_pcie: fix some unreleased resources [+ + +]
Author: Yunhui Cui <cuiyunhui@bytedance.com>
Date:   Thu Feb 20 20:17:15 2025 +0800

    perf/dwc_pcie: fix some unreleased resources
    
    [ Upstream commit 6eb1e8ef586ac4a3dcdc20248f9cb45e4ceb141f ]
    
    Release leaked resources, such as plat_dev and dev_info.
    
    Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
    Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20250220121716.50324-2-cuiyunhui@bytedance.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf: arm_pmu: Don't disable counter in armpmu_add() [+ + +]
Author: Mark Rutland <mark.rutland@arm.com>
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 <mark.rutland@arm.com>
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Tested-by: James Clark <james.clark@linaro.org>
    Link: https://lore.kernel.org/r/20250218-arm-brbe-v19-v20-2-4e9922fc2e8e@kernel.org
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

perf: Fix hang while freeing sigtrap event [+ + +]
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Tue Mar 4 14:54:46 2025 +0100

    perf: Fix hang while freeing sigtrap event
    
    [ Upstream commit 56799bc035658738f362acec3e7647bb84e68933 ]
    
    Perf can hang while freeing a sigtrap event if a related deferred
    signal hadn't managed to be sent before the file got closed:
    
    perf_event_overflow()
       task_work_add(perf_pending_task)
    
    fput()
       task_work_add(____fput())
    
    task_work_run()
        ____fput()
            perf_release()
                perf_event_release_kernel()
                    _free_event()
                        perf_pending_task_sync()
                            task_work_cancel() -> FAILED
                            rcuwait_wait_event()
    
    Once task_work_run() is running, the list of pending callbacks is
    removed from the task_struct and from this point on task_work_cancel()
    can't remove any pending and not yet started work items, hence the
    task_work_cancel() failure and the hang on rcuwait_wait_event().
    
    Task work could be changed to remove one work at a time, so a work
    running on the current task can always cancel a pending one, however
    the wait / wake design is still subject to inverted dependencies when
    remote targets are involved, as pictured by Oleg:
    
    T1                                                      T2
    
    fd = perf_event_open(pid => T2->pid);                  fd = perf_event_open(pid => T1->pid);
    close(fd)                                              close(fd)
        <IRQ>                                                  <IRQ>
        perf_event_overflow()                                  perf_event_overflow()
           task_work_add(perf_pending_task)                        task_work_add(perf_pending_task)
        </IRQ>                                                 </IRQ>
        fput()                                                 fput()
            task_work_add(____fput())                              task_work_add(____fput())
    
        task_work_run()                                        task_work_run()
            ____fput()                                             ____fput()
                perf_release()                                         perf_release()
                    perf_event_release_kernel()                            perf_event_release_kernel()
                        _free_event()                                          _free_event()
                            perf_pending_task_sync()                               perf_pending_task_sync()
                                rcuwait_wait_event()                                   rcuwait_wait_event()
    
    Therefore the only option left is to acquire the event reference count
    upon queueing the perf task work and release it from the task work, just
    like it was done before 3a5465418f5f ("perf: Fix event leak upon exec and file release")
    but without the leaks it fixed.
    
    Some adjustments are necessary to make it work:
    
    * A child event might dereference its parent upon freeing. Care must be
      taken to release the parent last.
    
    * Some places assuming the event doesn't have any reference held and
      therefore can be freed right away must instead put the reference and
      let the reference counting to its job.
    
    Reported-by: "Yi Lai" <yi1.lai@linux.intel.com>
    Closes: https://lore.kernel.org/all/Zx9Losv4YcJowaP%2F@ly-workstation/
    Reported-by: syzbot+3c4321e10eea460eb606@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/673adf75.050a0220.87769.0024.GAE@google.com/
    Fixes: 3a5465418f5f ("perf: Fix event leak upon exec and file release")
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20250304135446.18905-1-frederic@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
phy: freescale: imx8m-pcie: assert phy reset and perst in power off [+ + +]
Author: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Date:   Wed Mar 5 15:43:16 2025 +0100

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

 
pinctrl: qcom: Clear latched interrupt status when changing IRQ type [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
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: stable@vger.kernel.org
    Fixes: cf9d052aa600 ("pinctrl: qcom: Don't clear pending interrupts when enabling")
    Reported-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
    Closes: https://lore.kernel.org/r/20250227-tlmm-test-v1-1-d18877b4a5db@oss.qualcomm.com/
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Tested-by: Bjorn Andersson <andersson@kernel.org>
    Reviewed-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/20250312-pinctrl-msm-type-latch-v1-1-ce87c561d3d7@linaro.org
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pinctrl: samsung: add support for eint_fltcon_offset [+ + +]
Author: Peter Griffin <peter.griffin@linaro.org>
Date:   Fri Mar 7 10:29:05 2025 +0000

    pinctrl: samsung: add support for eint_fltcon_offset
    
    commit 701d0e910955627734917c3587258aa7e73068bb upstream.
    
    On gs101 SoC the fltcon0 (filter configuration 0) offset isn't at a
    fixed offset like previous SoCs as the fltcon1 register only exists when
    there are more than 4 pins in the bank.
    
    Add a eint_fltcon_offset and new GS101_PIN_BANK_EINT* macros that take
    an additional fltcon_offs variable.
    
    This can then be used in suspend/resume callbacks to save and restore
    the fltcon0 and fltcon1 registers.
    
    Fixes: 4a8be01a1a7a ("pinctrl: samsung: Add gs101 SoC pinctrl configuration")
    Cc: stable@vger.kernel.org
    Reviewed-by: André Draszik <andre.draszik@linaro.org>
    Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
    Link: https://lore.kernel.org/r/20250307-pinctrl-fltcon-suspend-v4-1-2d775e486036@linaro.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
platform/chrome: cros_ec_lpc: Match on Framework ACPI device [+ + +]
Author: Daniel Schaefer <dhs@frame.work>
Date:   Wed Jan 29 02:13:29 2025 +0800

    platform/chrome: cros_ec_lpc: Match on Framework ACPI device
    
    [ Upstream commit d83c45aeec9b223fe6db4175e9d1c4f5699cc37a ]
    
    Load the cros_ec_lpc driver based on a Framework FRMWC004 ACPI device,
    which mirrors GOOG0004, but also applies npcx quirks for Framework
    systems.
    
    Matching on ACPI will let us avoid having to change the SMBIOS match
    rules again and again.
    
    Cc: Tzung-Bi Shih <tzungbi@kernel.org>
    Cc: linux@frame.work
    Cc: Dustin L. Howett <dustin@howett.net>
    Signed-off-by: Daniel Schaefer <dhs@frame.work>
    Link: https://lore.kernel.org/r/20250128181329.8070-1-dhs@frame.work
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86: x86-android-tablets: Add select POWER_SUPPLY to Kconfig [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Mar 24 13:50:52 2025 +0100

    platform/x86: x86-android-tablets: Add select POWER_SUPPLY to Kconfig
    
    [ Upstream commit 2c30357e755b087217c7643fda2b8aea6d6deda4 ]
    
    Commit c78dd25138d1 ("platform/x86: x86-android-tablets: Add Vexia EDU
    ATLA 10 EC battery driver"), adds power_supply class registering to
    the x86-android-tablets code.
    
    Add "select POWER_SUPPLY" to the Kconfig entry to avoid these errors:
    
    ERROR: modpost: "power_supply_get_drvdata" [drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.ko] undefined!
    ERROR: modpost: "power_supply_changed" [drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.ko] undefined!
    ERROR: modpost: "devm_power_supply_register" [drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.ko] undefined!
    
    When POWER_SUPPLY support is not enabled.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202503231159.ga9eWMVO-lkp@intel.com/
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20250324125052.374369-1-hdegoede@redhat.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pm: cpupower: bench: Prevent NULL dereference on malloc failure [+ + +]
Author: Zhongqiu Han <quic_zhonhan@quicinc.com>
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/20250219122715.3892223-1-quic_zhonhan@quicinc.com
    Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PM: hibernate: Avoid deadlock in hibernate_compressor_param_set() [+ + +]
Author: Lizhi Xu <lizhi.xu@windriver.com>
Date:   Mon Feb 24 09:31:39 2025 +0800

    PM: hibernate: Avoid deadlock in hibernate_compressor_param_set()
    
    [ Upstream commit 52323ed1444ea5c2a5f1754ea0a2d9c8c216ccdf ]
    
    syzbot reported a deadlock in lock_system_sleep() (see below).
    
    The write operation to "/sys/module/hibernate/parameters/compressor"
    conflicts with the registration of ieee80211 device, resulting in a deadlock
    when attempting to acquire system_transition_mutex under param_lock.
    
    To avoid this deadlock, change hibernate_compressor_param_set() to use
    mutex_trylock() for attempting to acquire system_transition_mutex and
    return -EBUSY when it fails.
    
    Task flags need not be saved or adjusted before calling
    mutex_trylock(&system_transition_mutex) because the caller is not going
    to end up waiting for this mutex and if it runs concurrently with system
    suspend in progress, it will be frozen properly when it returns to user
    space.
    
    syzbot report:
    
    syz-executor895/5833 is trying to acquire lock:
    ffffffff8e0828c8 (system_transition_mutex){+.+.}-{4:4}, at: lock_system_sleep+0x87/0xa0 kernel/power/main.c:56
    
    but task is already holding lock:
    ffffffff8e07dc68 (param_lock){+.+.}-{4:4}, at: kernel_param_lock kernel/params.c:607 [inline]
    ffffffff8e07dc68 (param_lock){+.+.}-{4:4}, at: param_attr_store+0xe6/0x300 kernel/params.c:586
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #3 (param_lock){+.+.}-{4:4}:
           __mutex_lock_common kernel/locking/mutex.c:585 [inline]
           __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
           ieee80211_rate_control_ops_get net/mac80211/rate.c:220 [inline]
           rate_control_alloc net/mac80211/rate.c:266 [inline]
           ieee80211_init_rate_ctrl_alg+0x18d/0x6b0 net/mac80211/rate.c:1015
           ieee80211_register_hw+0x20cd/0x4060 net/mac80211/main.c:1531
           mac80211_hwsim_new_radio+0x304e/0x54e0 drivers/net/wireless/virtual/mac80211_hwsim.c:5558
           init_mac80211_hwsim+0x432/0x8c0 drivers/net/wireless/virtual/mac80211_hwsim.c:6910
           do_one_initcall+0x128/0x700 init/main.c:1257
           do_initcall_level init/main.c:1319 [inline]
           do_initcalls init/main.c:1335 [inline]
           do_basic_setup init/main.c:1354 [inline]
           kernel_init_freeable+0x5c7/0x900 init/main.c:1568
           kernel_init+0x1c/0x2b0 init/main.c:1457
           ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
           ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
    
    -> #2 (rtnl_mutex){+.+.}-{4:4}:
           __mutex_lock_common kernel/locking/mutex.c:585 [inline]
           __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
           wg_pm_notification drivers/net/wireguard/device.c:80 [inline]
           wg_pm_notification+0x49/0x180 drivers/net/wireguard/device.c:64
           notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
           notifier_call_chain_robust kernel/notifier.c:120 [inline]
           blocking_notifier_call_chain_robust kernel/notifier.c:345 [inline]
           blocking_notifier_call_chain_robust+0xc9/0x170 kernel/notifier.c:333
           pm_notifier_call_chain_robust+0x27/0x60 kernel/power/main.c:102
           snapshot_open+0x189/0x2b0 kernel/power/user.c:77
           misc_open+0x35a/0x420 drivers/char/misc.c:179
           chrdev_open+0x237/0x6a0 fs/char_dev.c:414
           do_dentry_open+0x735/0x1c40 fs/open.c:956
           vfs_open+0x82/0x3f0 fs/open.c:1086
           do_open fs/namei.c:3830 [inline]
           path_openat+0x1e88/0x2d80 fs/namei.c:3989
           do_filp_open+0x20c/0x470 fs/namei.c:4016
           do_sys_openat2+0x17a/0x1e0 fs/open.c:1428
           do_sys_open fs/open.c:1443 [inline]
           __do_sys_openat fs/open.c:1459 [inline]
           __se_sys_openat fs/open.c:1454 [inline]
           __x64_sys_openat+0x175/0x210 fs/open.c:1454
           do_syscall_x64 arch/x86/entry/common.c:52 [inline]
           do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
           entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    -> #1 ((pm_chain_head).rwsem){++++}-{4:4}:
           down_read+0x9a/0x330 kernel/locking/rwsem.c:1524
           blocking_notifier_call_chain_robust kernel/notifier.c:344 [inline]
           blocking_notifier_call_chain_robust+0xa9/0x170 kernel/notifier.c:333
           pm_notifier_call_chain_robust+0x27/0x60 kernel/power/main.c:102
           snapshot_open+0x189/0x2b0 kernel/power/user.c:77
           misc_open+0x35a/0x420 drivers/char/misc.c:179
           chrdev_open+0x237/0x6a0 fs/char_dev.c:414
           do_dentry_open+0x735/0x1c40 fs/open.c:956
           vfs_open+0x82/0x3f0 fs/open.c:1086
           do_open fs/namei.c:3830 [inline]
           path_openat+0x1e88/0x2d80 fs/namei.c:3989
           do_filp_open+0x20c/0x470 fs/namei.c:4016
           do_sys_openat2+0x17a/0x1e0 fs/open.c:1428
           do_sys_open fs/open.c:1443 [inline]
           __do_sys_openat fs/open.c:1459 [inline]
           __se_sys_openat fs/open.c:1454 [inline]
           __x64_sys_openat+0x175/0x210 fs/open.c:1454
           do_syscall_x64 arch/x86/entry/common.c:52 [inline]
           do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
           entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    -> #0 (system_transition_mutex){+.+.}-{4:4}:
           check_prev_add kernel/locking/lockdep.c:3163 [inline]
           check_prevs_add kernel/locking/lockdep.c:3282 [inline]
           validate_chain kernel/locking/lockdep.c:3906 [inline]
           __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5228
           lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5851
           __mutex_lock_common kernel/locking/mutex.c:585 [inline]
           __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
           lock_system_sleep+0x87/0xa0 kernel/power/main.c:56
           hibernate_compressor_param_set+0x1c/0x210 kernel/power/hibernate.c:1452
           param_attr_store+0x18f/0x300 kernel/params.c:588
           module_attr_store+0x55/0x80 kernel/params.c:924
           sysfs_kf_write+0x117/0x170 fs/sysfs/file.c:139
           kernfs_fop_write_iter+0x33d/0x500 fs/kernfs/file.c:334
           new_sync_write fs/read_write.c:586 [inline]
           vfs_write+0x5ae/0x1150 fs/read_write.c:679
           ksys_write+0x12b/0x250 fs/read_write.c:731
           do_syscall_x64 arch/x86/entry/common.c:52 [inline]
           do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
           entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    other info that might help us debug this:
    
    Chain exists of:
      system_transition_mutex --> rtnl_mutex --> param_lock
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(param_lock);
                                   lock(rtnl_mutex);
                                   lock(param_lock);
      lock(system_transition_mutex);
    
     *** DEADLOCK ***
    
    Reported-by: syzbot+ace60642828c074eb913@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=ace60642828c074eb913
    Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
    Link: https://patch.msgid.link/20250224013139.3994500-1-lizhi.xu@windriver.com
    [ rjw: New subject matching the code changes, changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pwm: fsl-ftm: Handle clk_get_rate() returning 0 [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
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 <u.kleine-koenig@baylibre.com>
    Link: https://lore.kernel.org/r/b68351a51017035651bc62ad3146afcb706874f0.1743501688.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config() [+ + +]
Author: Josh Poimboeuf <jpoimboe@kernel.org>
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 <jpoimboe@kernel.org>
    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 <u.kleine-koenig@baylibre.com>
    Link: https://lore.kernel.org/r/9e78a0796acba3435553ed7db1c7965dcffa6215.1743501688.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pwm: rcar: Improve register calculation [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
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 <u.kleine-koenig@baylibre.com>
    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/202504031354.VJtxScP5-lkp@intel.com/
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "f2fs: rebuild nat_bits during umount" [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Wed Mar 5 19:07:12 2025 +0800

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

 
Revert "media: imx214: Fix the error handling in imx214_probe()" [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Fri Jan 10 10:11:51 2025 +0200

    Revert "media: imx214: Fix the error handling in imx214_probe()"
    
    commit abd88757252c2a2cea7909f3922de1f0e9e04002 upstream.
    
    This reverts commit 9bc92332cc3f06fda3c6e2423995ca2da0a7ec9a.
    
    Revert this "fix" as it's not really helpful but makes backporting a
    proper fix harder.
    
    Fixes: 9bc92332cc3f ("media: imx214: Fix the error handling in imx214_probe()")
    Cc: stable@vger.kernel.org # for >= v6.12
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ring-buffer: Use flush_kernel_vmap_range() over flush_dcache_folio() [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Wed Apr 2 10:49:07 2025 -0400

    ring-buffer: Use flush_kernel_vmap_range() over flush_dcache_folio()
    
    commit e4d4b8670c44cdd22212cab3c576e2d317efa67c upstream.
    
    Some architectures do not have data cache coherency between user and
    kernel space. For these architectures, the cache needs to be flushed on
    both the kernel and user addresses so that user space can see the updates
    the kernel has made.
    
    Instead of using flush_dcache_folio() and playing with virt_to_folio()
    within the call to that function, use flush_kernel_vmap_range() which
    takes the virtual address and does the work for those architectures that
    need it.
    
    This also fixes a bug where the flush of the reader page only flushed one
    page. If the sub-buffer order is 1 or more, where the sub-buffer size
    would be greater than a page, it would miss the rest of the sub-buffer
    content, as the "reader page" is not just a page, but the size of a
    sub-buffer.
    
    Link: https://lore.kernel.org/all/CAG48ez3w0my4Rwttbc5tEbNsme6tc0mrSN95thjXUFaJ3aQ6SA@mail.gmail.com/
    
    Cc: stable@vger.kernel.org
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Vincent Donnefort <vdonnefort@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mike Rapoport <rppt@kernel.org>
    Link: https://lore.kernel.org/20250402144953.920792197@goodmis.org
    Fixes: 117c39200d9d7 ("ring-buffer: Introducing ring-buffer mapping functions");
    Suggested-by: Jann Horn <jannh@google.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/cpumf: Fix double free on error in cpumf_pmu_event_init() [+ + +]
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Wed Apr 9 10:03:53 2025 +0200

    s390/cpumf: Fix double free on error in cpumf_pmu_event_init()
    
    commit aa1ac98268cd1f380c713f07e39b1fa1d5c7650c upstream.
    
    In PMU event initialization functions
     - cpumsf_pmu_event_init()
     - cpumf_pmu_event_init()
     - cfdiag_event_init()
    the partially created event had to be removed when an error was detected.
    The event::event_init() member function had to release all resources
    it allocated in case of error. event::destroy() had to be called
    on freeing an event after it was successfully created and
    event::event_init() returned success.
    
    With
    
    commit c70ca298036c ("perf/core: Simplify the perf_event_alloc() error path")
    
    this is not necessary anymore. The performance subsystem common
    code now always calls event::destroy() to clean up the allocated
    resources created during event initialization.
    
    Remove the event::destroy() invocation in PMU event initialization
    or that function is called twice for each event that runs into an
    error condition in event creation.
    
    This is the kernel log entry which shows up without the fix:
    
    ------------[ cut here ]------------
    refcount_t: underflow; use-after-free.
    WARNING: CPU: 0 PID: 43388 at lib/refcount.c:87 refcount_dec_not_one+0x74/0x90
    CPU: 0 UID: 0 PID: 43388 Comm: perf Not tainted 6.15.0-20250407.rc1.git0.300.fc41.s390x+git #1 NONE
    Hardware name: IBM 3931 A01 704 (LPAR)
    Krnl PSW : 0704c00180000000 00000209cb2c1b88 (refcount_dec_not_one+0x78/0x90)
               R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
    Krnl GPRS: 0000020900000027 0000020900000023 0000000000000026 0000018900000000
               00000004a2200a00 0000000000000000 0000000000000057 ffffffffffffffea
               00000002b386c600 00000002b3f5b3e0 00000209cc51f140 00000209cc7fc550
               0000000001449d38 ffffffffffffffff 00000209cb2c1b84 00000189d67dfb80
    Krnl Code: 00000209cb2c1b78: c02000506727       larl    %r2,00000209cbcce9c6
               00000209cb2c1b7e: c0e5ffbd4431       brasl   %r14,00000209caa6a3e0
              #00000209cb2c1b84: af000000           mc      0,0
              >00000209cb2c1b88: a7480001           lhi     %r4,1
               00000209cb2c1b8c: ebeff0a00004       lmg     %r14,%r15,160(%r15)
               00000209cb2c1b92: ec243fbf0055       risbg   %r2,%r4,63,191,0
               00000209cb2c1b98: 07fe               bcr     15,%r14
               00000209cb2c1b9a: 47000700           bc      0,1792
    Call Trace:
     [<00000209cb2c1b88>] refcount_dec_not_one+0x78/0x90
     [<00000209cb2c1dc4>] refcount_dec_and_mutex_lock+0x24/0x90
     [<00000209caa3c29e>] hw_perf_event_destroy+0x2e/0x80
     [<00000209cacaf8b4>] __free_event+0x74/0x270
     [<00000209cacb47c4>] perf_event_alloc.part.0+0x4a4/0x730
     [<00000209cacbf3e8>] __do_sys_perf_event_open+0x248/0xc20
     [<00000209cacc14a4>] __s390x_sys_perf_event_open+0x44/0x50
     [<00000209cb8114de>] __do_syscall+0x12e/0x260
     [<00000209cb81ce34>] system_call+0x74/0x98
    Last Breaking-Event-Address:
     [<00000209caa6a4d2>] __warn_printk+0xf2/0x100
    ---[ end trace 0000000000000000 ]---
    
    Fixes: c70ca298036c ("perf/core: Simplify the perf_event_alloc() error path")
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/pci: Fix s390_mmio_read/write syscall page fault handling [+ + +]
Author: Niklas Schnelle <schnelle@linux.ibm.com>
Date:   Wed Feb 26 13:07:45 2025 +0100

    s390/pci: Fix s390_mmio_read/write syscall page fault handling
    
    [ Upstream commit 41a0926e82f4963046876ed9a1b5f681be8087a8 ]
    
    The s390 MMIO syscalls when using the classic PCI instructions do not
    cause a page fault when follow_pfnmap_start() fails due to the page not
    being present. Besides being a general deficiency this breaks vfio-pci's
    mmap() handling once VFIO_PCI_MMAP gets enabled as this lazily maps on
    first access. Fix this by following a failed follow_pfnmap_start() with
    fixup_user_page() and retrying the follow_pfnmap_start(). Also fix
    a VM_READ vs VM_WRITE mixup in the read syscall.
    
    Link: https://lore.kernel.org/r/20250226-vfio_pci_mmap-v7-1-c5c0f1d26efd@linux.ibm.com
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

s390/pci: Fix zpci_bus_is_isolated_vf() for non-VFs [+ + +]
Author: Niklas Schnelle <schnelle@linux.ibm.com>
Date:   Thu Mar 20 17:26:12 2025 +0100

    s390/pci: Fix zpci_bus_is_isolated_vf() for non-VFs
    
    commit 8691abd3afaadd816a298503ec1a759df1305d2e upstream.
    
    For non-VFs, zpci_bus_is_isolated_vf() should return false because they
    aren't VFs. While zpci_iov_find_parent_pf() specifically checks if
    a function is a VF, it then simply returns that there is no parent. The
    simplistic check for a parent then leads to these functions being
    confused with isolated VFs and isolating them on their own domain even
    if sibling PFs should share the domain.
    
    Fix this by explicitly checking if a function is not a VF. Note also
    that at this point the case where RIDs are ignored is already handled
    and in this case all PCI functions get isolated by being detected in
    zpci_bus_is_multifunction_root().
    
    Cc: stable@vger.kernel.org
    Fixes: 2844ddbd540f ("s390/pci: Fix handling of isolated VFs")
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/virtio_ccw: Don't allocate/assign airqs for non-existing queues [+ + +]
Author: David Hildenbrand <david@redhat.com>
Date:   Wed Apr 2 22:36:21 2025 +0200

    s390/virtio_ccw: Don't allocate/assign airqs for non-existing queues
    
    commit 2ccd42b959aaf490333dbd3b9b102eaf295c036a upstream.
    
    If we finds a vq without a name in our input array in
    virtio_ccw_find_vqs(), we treat it as "non-existing" and set the vq pointer
    to NULL; we will not call virtio_ccw_setup_vq() to allocate/setup a vq.
    
    Consequently, we create only a queue if it actually exists (name != NULL)
    and assign an incremental queue index to each such existing queue.
    
    However, in virtio_ccw_register_adapter_ind()->get_airq_indicator() we
    will not ignore these "non-existing queues", but instead assign an airq
    indicator to them.
    
    Besides never releasing them in virtio_ccw_drop_indicators() (because
    there is no virtqueue), the bigger issue seems to be that there will be a
    disagreement between the device and the Linux guest about the airq
    indicator to be used for notifying a queue, because the indicator bit
    for adapter I/O interrupt is derived from the queue index.
    
    The virtio spec states under "Setting Up Two-Stage Queue Indicators":
    
            ... indicator contains the guest address of an area wherein the
            indicators for the devices are contained, starting at bit_nr, one
            bit per virtqueue of the device.
    
    And further in "Notification via Adapter I/O Interrupts":
    
            For notifying the driver of virtqueue buffers, the device sets the
            bit in the guest-provided indicator area at the corresponding
            offset.
    
    For example, QEMU uses in virtio_ccw_notify() the queue index (passed as
    "vector") to select the relevant indicator bit. If a queue does not exist,
    it does not have a corresponding indicator bit assigned, because it
    effectively doesn't have a queue index.
    
    Using a virtio-balloon-ccw device under QEMU with free-page-hinting
    disabled ("free-page-hint=off") but free-page-reporting enabled
    ("free-page-reporting=on") will result in free page reporting
    not working as expected: in the virtio_balloon driver, we'll be stuck
    forever in virtballoon_free_page_report()->wait_event(), because the
    waitqueue will not be woken up as the notification from the device is
    lost: it would use the wrong indicator bit.
    
    Free page reporting stops working and we get splats (when configured to
    detect hung wqs) like:
    
     INFO: task kworker/1:3:463 blocked for more than 61 seconds.
           Not tainted 6.14.0 #4
     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
     task:kworker/1:3 [...]
     Workqueue: events page_reporting_process
     Call Trace:
      [<000002f404e6dfb2>] __schedule+0x402/0x1640
      [<000002f404e6f22e>] schedule+0x3e/0xe0
      [<000002f3846a88fa>] virtballoon_free_page_report+0xaa/0x110 [virtio_balloon]
      [<000002f40435c8a4>] page_reporting_process+0x2e4/0x740
      [<000002f403fd3ee2>] process_one_work+0x1c2/0x400
      [<000002f403fd4b96>] worker_thread+0x296/0x420
      [<000002f403fe10b4>] kthread+0x124/0x290
      [<000002f403f4e0dc>] __ret_from_fork+0x3c/0x60
      [<000002f404e77272>] ret_from_fork+0xa/0x38
    
    There was recently a discussion [1] whether the "holes" should be
    treated differently again, effectively assigning also non-existing
    queues a queue index: that should also fix the issue, but requires other
    workarounds to not break existing setups.
    
    Let's fix it without affecting existing setups for now by properly ignoring
    the non-existing queues, so the indicator bits will match the queue
    indexes.
    
    [1] https://lore.kernel.org/all/cover.1720611677.git.mst@redhat.com/
    
    Fixes: a229989d975e ("virtio: don't allocate vqs when names[i] = NULL")
    Reported-by: Chandra Merla <cmerla@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Cornelia Huck <cohuck@redhat.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Link: https://lore.kernel.org/r/20250402203621.940090-1-david@redhat.com
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390: Fix linker error when -no-pie option is unavailable [+ + +]
Author: Sumanth Korikkar <sumanthk@linux.ibm.com>
Date:   Tue Mar 25 19:02:45 2025 +0100

    s390: Fix linker error when -no-pie option is unavailable
    
    commit 991a20173a1fbafd9fc0df0c7e17bb62d44a4deb upstream.
    
    The kernel build may fail if the linker does not support -no-pie option,
    as it always included in LDFLAGS_vmlinux.
    
    Error log:
    s390-linux-ld: unable to disambiguate: -no-pie (did you mean --no-pie ?)
    
    Although the GNU linker defaults to -no-pie, the ability to explicitly
    specify this option was introduced in binutils 2.36.
    
    Hence, fix it by adding -no-pie to LDFLAGS_vmlinux only when it is
    available.
    
    Cc: stable@vger.kernel.org
    Fixes: 00cda11d3b2e ("s390: Compile kernel with -fPIC and link with -no-pie")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202503220342.T3fElO9L-lkp@intel.com/
    Suggested-by: Jens Remus <jremus@linux.ibm.com>
    Reviewed-by: Jens Remus <jremus@linux.ibm.com>
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sched_ext: create_dsq: Return -EEXIST on duplicate request [+ + +]
Author: Jake Hillion <jake@hillion.co.uk>
Date:   Tue Mar 25 22:41:52 2025 +0000

    sched_ext: create_dsq: Return -EEXIST on duplicate request
    
    commit a8897ed8523d4c9d782e282b18005a3779c92714 upstream.
    
    create_dsq and therefore the scx_bpf_create_dsq kfunc currently silently
    ignore duplicate entries. As a sched_ext scheduler is creating each DSQ
    for a different purpose this is surprising behaviour.
    
    Replace rhashtable_insert_fast which ignores duplicates with
    rhashtable_lookup_insert_fast that reports duplicates (though doesn't
    return their value). The rest of the code is structured correctly and
    this now returns -EEXIST.
    
    Tested by adding an extra scx_bpf_create_dsq to scx_simple. Previously
    this was ignored, now init fails with a -17 code. Also ran scx_lavd
    which continued to work well.
    
    Signed-off-by: Jake Hillion <jake@hillion.co.uk>
    Acked-by: Andrea Righi <arighi@nvidia.com>
    Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
    Cc: stable@vger.kernel.org # v6.12+
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
scsi: mpi3mr: Avoid reply queue full condition [+ + +]
Author: Ranjan Kumar <ranjan.kumar@broadcom.com>
Date:   Wed Jan 29 15:38:47 2025 +0530

    scsi: mpi3mr: Avoid reply queue full condition
    
    [ Upstream commit f08b24d82749117ce779cc66689e8594341130d3 ]
    
    To avoid reply queue full condition, update the driver to check IOCFacts
    capabilities for qfull.
    
    Update the operational reply queue's Consumer Index after processing 100
    replies. If pending I/Os on a reply queue exceeds a threshold
    (reply_queue_depth - 200), then return I/O back to OS to retry.
    
    Also increase default admin reply queue size to 2K.
    
    Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
    Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
    Link: https://lore.kernel.org/r/20250129100850.25430-2-ranjan.kumar@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: mpi3mr: Synchronous access b/w reset and tm thread for reply queue [+ + +]
Author: Ranjan Kumar <ranjan.kumar@broadcom.com>
Date:   Wed Jan 29 15:38:49 2025 +0530

    scsi: mpi3mr: Synchronous access b/w reset and tm thread for reply queue
    
    [ Upstream commit f195fc060c738d303a21fae146dbf85e1595fb4c ]
    
    When the task management thread processes reply queues while the reset
    thread resets them, the task management thread accesses an invalid queue ID
    (0xFFFF), set by the reset thread, which points to unallocated memory,
    causing a crash.
    
    Add flag 'io_admin_reset_sync' to synchronize access between the reset,
    I/O, and admin threads. Before a reset, the reset handler sets this flag to
    block I/O and admin processing threads. If any thread bypasses the initial
    check, the reset thread waits up to 10 seconds for processing to finish. If
    the wait exceeds 10 seconds, the controller is marked as unrecoverable.
    
    Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
    Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
    Link: https://lore.kernel.org/r/20250129100850.25430-4-ranjan.kumar@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: st: Fix array overflow in st_setup() [+ + +]
Author: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
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 <chenyuan0y@gmail.com>
    Closes: https://lore.kernel.org/linux-scsi/CALGdzuoubbra4xKOJcsyThdk5Y1BrAmZs==wbqjbkAgmKS39Aw@mail.gmail.com/
    Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
    Link: https://lore.kernel.org/r/20250311112516.5548-2-Kai.Makisara@kolumbus.fi
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: target: spc: Fix RSOC parameter data header size [+ + +]
Author: Chaohai Chen <wdhh66@163.com>
Date:   Wed Jan 15 15:07:39 2025 +0800

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

 
sctp: detect and prevent references to a freed transport in sendmsg [+ + +]
Author: Ricardo Cañuelo Navarro <rcn@igalia.com>
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: stable@vger.kernel.org
    Fixes: df132eff4638 ("sctp: clear the transport of some out_chunk_list chunks in sctp_assoc_rm_peer")
    Suggested-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: Ricardo Cañuelo Navarro <rcn@igalia.com>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    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 <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/futex: futex_waitv wouldblock test should fail [+ + +]
Author: Edward Liaw <edliaw@google.com>
Date:   Fri Apr 4 22:12:20 2025 +0000

    selftests/futex: futex_waitv wouldblock test should fail
    
    [ Upstream commit 7d50e00fef2832e98d7e06bbfc85c1d66ee110ca ]
    
    Testcase should fail if -EWOULDBLOCK is not returned when expected value
    differs from actual value from the waiter.
    
    Link: https://lore.kernel.org/r/20250404221225.1596324-1-edliaw@google.com
    Fixes: 9d57f7c79748920636f8293d2f01192d702fe390 ("selftests: futex: Test sys_futex_waitv() wouldblock")
    Signed-off-by: Edward Liaw <edliaw@google.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: André Almeida <andrealmeid@igalia.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/landlock: Add a new test for setuid() [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:42 2025 +0100

    selftests/landlock: Add a new test for setuid()
    
    commit c5efa393d82cf68812e0ae4d93e339873eabe9fe upstream.
    
    The new signal_scoping_thread_setuid tests check that the libc's
    setuid() function works as expected even when a thread is sandboxed with
    scoped signal restrictions.
    
    Before the signal scoping fix, this test would have failed with the
    setuid() call:
    
      [pid    65] getpid()                    = 65
      [pid    65] tgkill(65, 66, SIGRT_1)     = -1 EPERM (Operation not permitted)
      [pid    65] futex(0x40a66cdc, FUTEX_WAKE_PRIVATE, 1) = 0
      [pid    65] setuid(1001)                = 0
    
    After the fix, tgkill(2) is successfully leveraged to synchronize
    credentials update across threads:
    
      [pid    65] getpid()                    = 65
      [pid    65] tgkill(65, 66, SIGRT_1)     = 0
      [pid    66] <... read resumed>0x40a65eb7, 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
      [pid    66] --- SIGRT_1 {si_signo=SIGRT_1, si_code=SI_TKILL, si_pid=65, si_uid=1000} ---
      [pid    66] getpid()                    = 65
      [pid    66] setuid(1001)                = 0
      [pid    66] futex(0x40a66cdc, FUTEX_WAKE_PRIVATE, 1) = 0
      [pid    66] rt_sigreturn({mask=[]})     = 0
      [pid    66] read(3,  <unfinished ...>
      [pid    65] setuid(1001)                = 0
    
    Test coverage for security/landlock is 92.9% of 1137 lines according to
    gcc/gcov-14.
    
    Fixes: c8994965013e ("selftests/landlock: Test signal scoping for threads")
    Cc: Günther Noack <gnoack@google.com>
    Cc: Tahera Fahimi <fahimitahera@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-8-mic@digikod.net
    [mic: Update test coverage]
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/landlock: Split signal_scoping_threads tests [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Tue Mar 18 17:14:41 2025 +0100

    selftests/landlock: Split signal_scoping_threads tests
    
    commit bbe72274035a83159c8fff7d553b4a0b3c473690 upstream.
    
    Split signal_scoping_threads tests into signal_scoping_thread_before
    and signal_scoping_thread_after.
    
    Use local variables for thread synchronization.  Fix exported function.
    Replace some asserts with expects.
    
    Fixes: c8994965013e ("selftests/landlock: Test signal scoping for threads")
    Cc: Günther Noack <gnoack@google.com>
    Cc: Tahera Fahimi <fahimitahera@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318161443.279194-7-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests: mptcp: close fd_in before returning in main_loop [+ + +]
Author: Geliang Tang <geliang@kernel.org>
Date:   Fri Mar 28 15:27:18 2025 +0100

    selftests: mptcp: close fd_in before returning in main_loop
    
    commit c183165f87a486d5879f782c05a23c179c3794ab upstream.
    
    The file descriptor 'fd_in' is opened when cfg_input is configured, but
    not closed in main_loop(), this patch fixes it.
    
    Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
    Cc: stable@vger.kernel.org
    Co-developed-by: Cong Liu <liucong2@kylinos.cn>
    Signed-off-by: Cong Liu <liucong2@kylinos.cn>
    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250328-net-mptcp-misc-fixes-6-15-v1-3-34161a482a7f@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: fix incorrect fd checks in main_loop [+ + +]
Author: Cong Liu <liucong2@kylinos.cn>
Date:   Fri Mar 28 15:27:17 2025 +0100

    selftests: mptcp: fix incorrect fd checks in main_loop
    
    commit 7335d4ac812917c16e04958775826d12d481c92d upstream.
    
    Fix a bug where the code was checking the wrong file descriptors
    when opening the input files. The code was checking 'fd' instead
    of 'fd_in', which could lead to incorrect error handling.
    
    Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
    Cc: stable@vger.kernel.org
    Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")
    Co-developed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Cong Liu <liucong2@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250328-net-mptcp-misc-fixes-6-15-v1-2-34161a482a7f@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
smb: client: fix UAF in decryption with multichannel [+ + +]
Author: Paulo Alcantara <pc@manguebit.com>
Date:   Wed Apr 9 11:14:21 2025 -0300

    smb: client: fix UAF in decryption with multichannel
    
    [ Upstream commit 9502dd5c7029902f4a425bf959917a5a9e7c0e50 ]
    
    After commit f7025d861694 ("smb: client: allocate crypto only for
    primary server") and commit b0abcd65ec54 ("smb: client: fix UAF in
    async decryption"), the channels started reusing AEAD TFM from primary
    channel to perform synchronous decryption, but that can't done as
    there could be multiple cifsd threads (one per channel) simultaneously
    accessing it to perform decryption.
    
    This fixes the following KASAN splat when running fstest generic/249
    with 'vers=3.1.1,multichannel,max_channels=4,seal' against Windows
    Server 2022:
    
    BUG: KASAN: slab-use-after-free in gf128mul_4k_lle+0xba/0x110
    Read of size 8 at addr ffff8881046c18a0 by task cifsd/986
    CPU: 3 UID: 0 PID: 986 Comm: cifsd Not tainted 6.15.0-rc1 #1
    PREEMPT(voluntary)
    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
     print_report+0x156/0x528
     ? gf128mul_4k_lle+0xba/0x110
     ? __virt_addr_valid+0x145/0x300
     ? __phys_addr+0x46/0x90
     ? gf128mul_4k_lle+0xba/0x110
     kasan_report+0xdf/0x1a0
     ? gf128mul_4k_lle+0xba/0x110
     gf128mul_4k_lle+0xba/0x110
     ghash_update+0x189/0x210
     shash_ahash_update+0x295/0x370
     ? __pfx_shash_ahash_update+0x10/0x10
     ? __pfx_shash_ahash_update+0x10/0x10
     ? __pfx_extract_iter_to_sg+0x10/0x10
     ? ___kmalloc_large_node+0x10e/0x180
     ? __asan_memset+0x23/0x50
     crypto_ahash_update+0x3c/0xc0
     gcm_hash_assoc_remain_continue+0x93/0xc0
     crypt_message+0xe09/0xec0 [cifs]
     ? __pfx_crypt_message+0x10/0x10 [cifs]
     ? _raw_spin_unlock+0x23/0x40
     ? __pfx_cifs_readv_from_socket+0x10/0x10 [cifs]
     decrypt_raw_data+0x229/0x380 [cifs]
     ? __pfx_decrypt_raw_data+0x10/0x10 [cifs]
     ? __pfx_cifs_read_iter_from_socket+0x10/0x10 [cifs]
     smb3_receive_transform+0x837/0xc80 [cifs]
     ? __pfx_smb3_receive_transform+0x10/0x10 [cifs]
     ? __pfx___might_resched+0x10/0x10
     ? __pfx_smb3_is_transform_hdr+0x10/0x10 [cifs]
     cifs_demultiplex_thread+0x692/0x1570 [cifs]
     ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
     ? rcu_is_watching+0x20/0x50
     ? rcu_lockdep_current_cpu_online+0x62/0xb0
     ? find_held_lock+0x32/0x90
     ? kvm_sched_clock_read+0x11/0x20
     ? local_clock_noinstr+0xd/0xd0
     ? trace_irq_enable.constprop.0+0xa8/0xe0
     ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
     kthread+0x1fe/0x380
     ? kthread+0x10f/0x380
     ? __pfx_kthread+0x10/0x10
     ? local_clock_noinstr+0xd/0xd0
     ? ret_from_fork+0x1b/0x60
     ? local_clock+0x15/0x30
     ? lock_release+0x29b/0x390
     ? rcu_is_watching+0x20/0x50
     ? __pfx_kthread+0x10/0x10
     ret_from_fork+0x31/0x60
     ? __pfx_kthread+0x10/0x10
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Tested-by: David Howells <dhowells@redhat.com>
    Reported-by: Steve French <stfrench@microsoft.com>
    Closes: https://lore.kernel.org/r/CAH2r5mu6Yc0-RJXM3kFyBYUB09XmXBrNodOiCVR4EDrmxq5Szg@mail.gmail.com
    Fixes: f7025d861694 ("smb: client: allocate crypto only for primary server")
    Fixes: b0abcd65ec54 ("smb: client: fix UAF in async decryption")
    Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

 
sparc/mm: avoid calling arch_enter/leave_lazy_mmu() in set_ptes [+ + +]
Author: Ryan Roberts <ryan.roberts@arm.com>
Date:   Mon Mar 3 14:15:38 2025 +0000

    sparc/mm: avoid calling arch_enter/leave_lazy_mmu() in set_ptes
    
    commit eb61ad14c459b54f71f76331ca35d12fa3eb8f98 upstream.
    
    With commit 1a10a44dfc1d ("sparc64: implement the new page table range
    API") set_ptes was added to the sparc architecture.  The implementation
    included calling arch_enter/leave_lazy_mmu() calls.
    
    The patch removes the usage of arch_enter/leave_lazy_mmu() since this
    implies nesting of lazy mmu regions which is not supported.  Without this
    fix, lazy mmu mode is effectively disabled because we exit the mode after
    the first set_ptes:
    
    remap_pte_range()
      -> arch_enter_lazy_mmu()
      -> set_ptes()
          -> arch_enter_lazy_mmu()
          -> arch_leave_lazy_mmu()
      -> arch_leave_lazy_mmu()
    
    Powerpc suffered the same problem and fixed it in a corresponding way with
    commit 47b8def9358c ("powerpc/mm: Avoid calling
    arch_enter/leave_lazy_mmu() in set_ptes").
    
    Link: https://lkml.kernel.org/r/20250303141542.3371656-5-ryan.roberts@arm.com
    Fixes: 1a10a44dfc1d ("sparc64: implement the new page table range API")
    Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Acked-by: Andreas Larsson <andreas@gaisler.com>
    Acked-by: Juergen Gross <jgross@suse.com>
    Cc: Borislav Betkov <bp@alien8.de>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Juegren Gross <jgross@suse.com>
    Cc: Matthew Wilcow (Oracle) <willy@infradead.org>
    Cc: Thomas Gleinxer <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sparc/mm: disable preemption in lazy mmu mode [+ + +]
Author: Ryan Roberts <ryan.roberts@arm.com>
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/20250303141542.3371656-4-ryan.roberts@arm.com
    Fixes: 38e0edb15bd0 ("mm/apply_to_range: call pte function with lazy updates")
    Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Acked-by: Andreas Larsson <andreas@gaisler.com>
    Acked-by: Juergen Gross <jgross@suse.com>
    Cc: Borislav Betkov <bp@alien8.de>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Juegren Gross <jgross@suse.com>
    Cc: Matthew Wilcow (Oracle) <willy@infradead.org>
    Cc: Thomas Gleinxer <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
spi: cadence-qspi: Fix probe on AM62A LP SK [+ + +]
Author: Miquel Raynal <miquel.raynal@bootlin.com>
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: stable@vger.kernel.org
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://patch.msgid.link/20250305200933.2512925-2-miquel.raynal@bootlin.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
svcrdma: do not unregister device for listeners [+ + +]
Author: Olga Kornievskaia <okorniev@redhat.com>
Date:   Thu Feb 6 13:15:34 2025 -0500

    svcrdma: do not unregister device for listeners
    
    commit 750037aa0a9f28d84df3dcf319a28423d69092fd upstream.
    
    On an rdma-capable machine, a start/stop/start and then on a stop of
    a knfsd server would lead kref underflow warning because svc_rdma_free
    would indiscriminately unregister the rdma device but a listening
    transport never calls the rdma_rn_register() thus leading to kref
    going down to 0 on the 1st stop of the server and on the 2nd stop
    it leads to a problem.
    
    Suggested-by: Chuck Lever <chuck.lever@oracle.com>
    Fixes: c4de97f7c454 ("svcrdma: Handle device removal outside of the CM event handler")
    Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
thermal/drivers/mediatek/lvts: Disable monitor mode during suspend [+ + +]
Author: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Date:   Mon Jan 13 10:27:12 2025 -0300

    thermal/drivers/mediatek/lvts: Disable monitor mode during suspend
    
    commit 65594b3745024857f812145a58db3601d733676c upstream.
    
    When configured in filtered mode, the LVTS thermal controller will
    monitor the temperature from the sensors and trigger an interrupt once a
    thermal threshold is crossed.
    
    Currently this is true even during suspend and resume. The problem with
    that is that when enabling the internal clock of the LVTS controller in
    lvts_ctrl_set_enable() during resume, the temperature reading can glitch
    and appear much higher than the real one, resulting in a spurious
    interrupt getting generated.
    
    Disable the temperature monitoring and give some time for the signals to
    stabilize during suspend in order to prevent such spurious interrupts.
    
    Cc: stable@vger.kernel.org
    Reported-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
    Closes: https://lore.kernel.org/all/20241108-lvts-v1-1-eee339c6ca20@chromium.org/
    Fixes: 8137bb90600d ("thermal/drivers/mediatek/lvts_thermal: Add suspend and resume")
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
    Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-1-07a25200c7c6@collabora.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thermal/drivers/mediatek/lvts: Disable Stage 3 thermal threshold [+ + +]
Author: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Date:   Mon Jan 13 10:27:13 2025 -0300

    thermal/drivers/mediatek/lvts: Disable Stage 3 thermal threshold
    
    commit c612cbcdf603aefb3358b2e3964dcd5aa3f827a0 upstream.
    
    The Stage 3 thermal threshold is currently configured during
    the controller initialization to 105 Celsius. From the kernel
    perspective, this configuration is harmful because:
    * The stage 3 interrupt that gets triggered when the threshold is
      crossed is not handled in any way by the IRQ handler, it just gets
      cleared. Besides, the temperature used for stage 3 comes from the
      sensors, and the critical thermal trip points described in the
      Devicetree will already cause a shutdown when crossed (at a lower
      temperature, of 100 Celsius, for all SoCs currently using this
      driver).
    * The only effect of crossing the stage 3 threshold that has been
      observed is that it causes the machine to no longer be able to enter
      suspend. Even if that was a result of a momentary glitch in the
      temperature reading of a sensor (as has been observed on the
      MT8192-based Chromebooks).
    
    For those reasons, disable the Stage 3 thermal threshold configuration.
    
    Cc: stable@vger.kernel.org
    Reported-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
    Closes: https://lore.kernel.org/all/20241108-lvts-v1-1-eee339c6ca20@chromium.org/
    Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver")
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
    Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-2-07a25200c7c6@collabora.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
thermal/drivers/rockchip: Add missing rk3328 mapping entry [+ + +]
Author: Trevor Woerner <twoerner@gmail.com>
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: stable@vger.kernel.org
    Fixes: eda519d5f73e ("thermal: rockchip: Support the RK3328 SOC in thermal driver")
    Signed-off-by: Trevor Woerner <twoerner@gmail.com>
    Reviewed-by: Dragan Simic <dsimic@manjaro.org>
    Link: https://lore.kernel.org/r/20250207175048.35959-1-twoerner@gmail.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tipc: fix memory leak in tipc_link_xmit [+ + +]
Author: Tung Nguyen <tung.quang.nguyen@est.tech>
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 <tung.quang.nguyen@est.tech>
    Link: https://patch.msgid.link/20250403092431.514063-1-tung.quang.nguyen@est.tech
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

tpm: End any active auth session before shutdown [+ + +]
Author: Jonathan McDowell <noodles@meta.com>
Date:   Fri Mar 7 12:25:23 2025 +0000

    tpm: End any active auth session before shutdown
    
    [ Upstream commit 1dbf74e00a5f882b04b398399b6def65cd51ef21 ]
    
    Lazy flushing of TPM auth sessions can interact badly with IMA + kexec,
    resulting in loaded session handles being leaked across the kexec and
    not cleaned up. Fix by ensuring any active auth session is ended before
    the TPM is told about the shutdown, matching what is done when
    suspending.
    
    Before:
    
    root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
    root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
    root@debian-qemu-efi:~# kexec --load --kexec-file-syscall …
    root@debian-qemu-efi:~# systemctl kexec
    …
    root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
    - 0x2000000
    root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
    root@debian-qemu-efi:~#
    (repeat kexec steps)
    root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
    - 0x2000000
    - 0x2000001
    root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
    root@debian-qemu-efi:~#
    
    After:
    
    root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
    root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
    root@debian-qemu-efi:~# kexec --load --kexec-file-syscall …
    root@debian-qemu-efi:~# systemctl kexec
    …
    root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
    root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
    root@debian-qemu-efi:~#
    
    Signed-off-by: Jonathan McDowell <noodles@meta.com>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER [+ + +]
Author: Gabriele Paoloni <gpaoloni@redhat.com>
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/20250321170821.101403-1-gpaoloni@redhat.com
    Signed-off-by: Gabriele Paoloni <gpaoloni@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tracing: fprobe events: Fix possible UAF on modules [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Mon Mar 31 23:05:07 2025 +0900

    tracing: fprobe events: Fix possible UAF on modules
    
    commit dd941507a9486252d6fcf11814387666792020f3 upstream.
    
    Commit ac91052f0ae5 ("tracing: tprobe-events: Fix leakage of module
    refcount") moved try_module_get() from __find_tracepoint_module_cb()
    to find_tracepoint() caller, but that introduced a possible UAF
    because the module can be unloaded before try_module_get(). In this
    case, the module object should be freed too. Thus, try_module_get()
    does not only fail but may access to the freed object.
    
    To avoid that, try_module_get() in __find_tracepoint_module_cb()
    again.
    
    Link: https://lore.kernel.org/all/174342990779.781946.9138388479067729366.stgit@devnote2/
    
    Fixes: ac91052f0ae5 ("tracing: tprobe-events: Fix leakage of module refcount")
    Cc: stable@vger.kernel.org
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
ublk: fix handling recovery & reissue in ublk_abort_queue() [+ + +]
Author: Ming Lei <ming.lei@redhat.com>
Date:   Wed Apr 9 09:14:41 2025 +0800

    ublk: fix handling recovery & reissue in ublk_abort_queue()
    
    [ Upstream commit 6ee6bd5d4fce502a5b5a2ea805e9ff16e6aa890f ]
    
    Commit 8284066946e6 ("ublk: grab request reference when the request is handled
    by userspace") doesn't grab request reference in case of recovery reissue.
    Then the request can be requeued & re-dispatch & failed when canceling
    uring command.
    
    If it is one zc request, the request can be freed before io_uring
    returns the zc buffer back, then cause kernel panic:
    
    [  126.773061] BUG: kernel NULL pointer dereference, address: 00000000000000c8
    [  126.773657] #PF: supervisor read access in kernel mode
    [  126.774052] #PF: error_code(0x0000) - not-present page
    [  126.774455] PGD 0 P4D 0
    [  126.774698] Oops: Oops: 0000 [#1] SMP NOPTI
    [  126.775034] CPU: 13 UID: 0 PID: 1612 Comm: kworker/u64:55 Not tainted 6.14.0_blk+ #182 PREEMPT(full)
    [  126.775676] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-1.fc39 04/01/2014
    [  126.776275] Workqueue: iou_exit io_ring_exit_work
    [  126.776651] RIP: 0010:ublk_io_release+0x14/0x130 [ublk_drv]
    
    Fixes it by always grabbing request reference for aborting the request.
    
    Reported-by: Caleb Sander Mateos <csander@purestorage.com>
    Closes: https://lore.kernel.org/linux-block/CADUfDZodKfOGUeWrnAxcZiLT+puaZX8jDHoj_sfHZCOZwhzz6A@mail.gmail.com/
    Fixes: 8284066946e6 ("ublk: grab request reference when the request is handled by userspace")
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20250409011444.2142010-2-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ublk: refactor recovery configuration flag helpers [+ + +]
Author: Uday Shankar <ushankar@purestorage.com>
Date:   Mon Oct 7 12:24:15 2024 -0600

    ublk: refactor recovery configuration flag helpers
    
    [ Upstream commit 3b939b8f715e014adcc48f7827fe9417252f0833 ]
    
    ublk currently supports the following behaviors on ublk server exit:
    
    A: outstanding I/Os get errors, subsequently issued I/Os get errors
    B: outstanding I/Os get errors, subsequently issued I/Os queue
    C: outstanding I/Os get reissued, subsequently issued I/Os queue
    
    and the following behaviors for recovery of preexisting block devices by
    a future incarnation of the ublk server:
    
    1: ublk devices stopped on ublk server exit (no recovery possible)
    2: ublk devices are recoverable using start/end_recovery commands
    
    The userspace interface allows selection of combinations of these
    behaviors using flags specified at device creation time, namely:
    
    default behavior: A + 1
    UBLK_F_USER_RECOVERY: B + 2
    UBLK_F_USER_RECOVERY|UBLK_F_USER_RECOVERY_REISSUE: C + 2
    
    We can't easily change the userspace interface to allow independent
    selection of one of {A, B, C} and one of {1, 2}, but we can refactor the
    internal helpers which test for the flags. Replace the existing helpers
    with the following set:
    
    ublk_nosrv_should_reissue_outstanding: tests for behavior C
    ublk_nosrv_[dev_]should_queue_io: tests for behavior B
    ublk_nosrv_should_stop_dev: tests for behavior 1
    
    Signed-off-by: Uday Shankar <ushankar@purestorage.com>
    Reviewed-by: Ming Lei <ming.lei@redhat.com>
    Link: https://lore.kernel.org/r/20241007182419.3263186-3-ushankar@purestorage.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Stable-dep-of: 6ee6bd5d4fce ("ublk: fix handling recovery & reissue in ublk_abort_queue()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
udf: Fix inode_getblk() return value [+ + +]
Author: Jan Kara <jack@suse.cz>
Date:   Wed Mar 12 16:18:39 2025 +0100

    udf: Fix inode_getblk() return value
    
    commit 6afdc60ec30b0a9390d11b7cebed79c857ce82aa upstream.
    
    Smatch noticed that inode_getblk() can return 1 on successful mapping of
    a block instead of expected 0 after commit b405c1e58b73 ("udf: refactor
    udf_next_aext() to handle error"). This could confuse some of the
    callers and lead to strange failures (although the one reported by
    Smatch in udf_mkdir() is impossible to trigger in practice). Fix the
    return value of inode_getblk().
    
    Link: https://lore.kernel.org/all/cb514af7-bbe0-435b-934f-dd1d7a16d2cd@stanley.mountain
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
    Fixes: b405c1e58b73 ("udf: refactor udf_next_aext() to handle error")
    CC: stable@vger.kernel.org
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
umount: Allow superblock owners to force umount [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
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 <trond.myklebust@hammerspace.com>
    Link: https://lore.kernel.org/r/12f212d4ef983714d065a6bb372fbb378753bf4c.1742315194.git.trond.myklebust@hammerspace.com
    Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vdpa/mlx5: Fix oversized null mkey longer than 32bit [+ + +]
Author: Si-Wei Liu <si-wei.liu@oracle.com>
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: stable@vger.kernel.org
    Reported-by: Cong Meng <cong.meng@oracle.com>
    Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
    Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
    Acked-by: Eugenio Pérez <eperezma@redhat.com>
    Message-Id: <20250220193732.521462-2-dtatulea@nvidia.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues [+ + +]
Author: P Praneesh <quic_ppranees@quicinc.com>
Date:   Sun Jan 19 22:12:18 2025 +0530

    wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues
    
    [ Upstream commit 1bcd20981834928ccc5d981aacb806bb523d8b29 ]
    
    Currently, the driver allocates cacheable DMA buffers for rings like
    HAL_REO_DST and HAL_WBM2SW_RELEASE. The buffers for HAL_WBM2SW_RELEASE
    are large (1024 KiB), exceeding the SWIOTLB slot size of 256 KiB. This
    leads to "swiotlb buffer is full" error messages on systems without an
    IOMMU that use SWIOTLB, causing driver initialization failures. The driver
    calls dma_map_single() with these large buffers obtained from kzalloc(),
    resulting in ring initialization errors on systems without an IOMMU that
    use SWIOTLB.
    
    To address these issues, replace the flawed buffer allocation mechanism
    with the appropriate DMA API. Specifically, use dma_alloc_noncoherent()
    for cacheable DMA buffers, ensuring proper freeing of buffers with
    dma_free_noncoherent().
    
    Error log:
    [   10.194343] ath11k_pci 0000:04:00.0: swiotlb buffer is full (sz:1048583 bytes), total 32768 (slots), used 2529 (slots)
    [   10.194406] ath11k_pci 0000:04:00.0: failed to set up tcl_comp ring (0) :-12
    [   10.194781] ath11k_pci 0000:04:00.0: failed to init DP: -12
    
    Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
    Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
    
    Reported-by: Tim Harvey <tharvey@gateworks.com>
    Closes: https://lore.kernel.org/all/20241210041133.GA17116@lst.de/
    Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
    Tested-by: Tim Harvey <tharvey@gateworks.com>
    Link: https://patch.msgid.link/20250119164219.647059-2-quic_ppranees@quicinc.com
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: ath11k: fix memory leak in ath11k_xxx_remove() [+ + +]
Author: Miaoqing Pan <quic_miaoqing@quicinc.com>
Date:   Thu Jan 23 16:49:48 2025 +0800

    wifi: ath11k: fix memory leak in ath11k_xxx_remove()
    
    [ Upstream commit efb24b1f0d29537714dd3cc46fb335ac27855251 ]
    
    The firmware memory was allocated in ath11k_pci_probe() or
    ath11k_ahb_probe(), but not freed in ath11k_xxx_remove() in case
    ATH11K_FLAG_QMI_FAIL bit is set. So call ath11k_fw_destroy() to
    free the memory.
    
    Found while fixing the same problem in ath12k:
    https://lore.kernel.org/linux-wireless/20240314012746.2729101-1-quic_miaoqing@quicinc.com
    
    Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04546-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1
    
    Signed-off-by: Miaoqing Pan <quic_miaoqing@quicinc.com>
    Reviewed-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
    Link: https://patch.msgid.link/20250123084948.1124357-1-quic_miaoqing@quicinc.com
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi [+ + +]
Author: Manish Dharanenthiran <quic_mdharane@quicinc.com>
Date:   Tue Feb 11 14:33:02 2025 +0530

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

wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process [+ + +]
Author: P Praneesh <quic_ppranees@quicinc.com>
Date:   Mon Dec 23 11:31:24 2024 +0530

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

wifi: ath12k: fix memory leak in ath12k_pci_remove() [+ + +]
Author: Miaoqing Pan <quic_miaoqing@quicinc.com>
Date:   Thu Jan 23 16:02:26 2025 +0800

    wifi: ath12k: fix memory leak in ath12k_pci_remove()
    
    [ Upstream commit 1b24394ed5c8a8d8f7b9e3aa9044c31495d46f2e ]
    
    Kmemleak reported this error:
    
      unreferenced object 0xffff1c165cec3060 (size 32):
        comm "insmod", pid 560, jiffies 4296964570 (age 235.596s)
        backtrace:
          [<000000005434db68>] __kmem_cache_alloc_node+0x1f4/0x2c0
          [<000000001203b155>] kmalloc_trace+0x40/0x88
          [<0000000028adc9c8>] _request_firmware+0xb8/0x608
          [<00000000cad1aef7>] firmware_request_nowarn+0x50/0x80
          [<000000005011a682>] local_pci_probe+0x48/0xd0
          [<00000000077cd295>] pci_device_probe+0xb4/0x200
          [<0000000087184c94>] really_probe+0x150/0x2c0
    
    The firmware memory was allocated in ath12k_pci_probe(), but not
    freed in ath12k_pci_remove() in case ATH12K_FLAG_QMI_FAIL bit is
    set. So call ath12k_fw_unmap() to free the memory.
    
    Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.2.0-02280-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
    
    Signed-off-by: Miaoqing Pan <quic_miaoqing@quicinc.com>
    Reviewed-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
    Link: https://patch.msgid.link/20250123080226.1116479-1-quic_miaoqing@quicinc.com
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: add strict mode disabling workarounds [+ + +]
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Feb 5 11:39:16 2025 +0200

    wifi: mac80211: add strict mode disabling workarounds
    
    [ Upstream commit 3ad4fce66e4f9d82abfc366707757e29cc14a9d2 ]
    
    Add a strict mode where we disable certain workarounds and have
    additional checks such as, for now, that VHT capabilities from
    association response match those from beacon/probe response. We
    can extend the checks in the future.
    
    Make it an opt-in setting by the driver so it can be set there
    in some driver-specific way, for example. Also allow setting
    this one hw flag through the hwflags debugfs, by writing a new
    strict=0 or strict=1 value.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Reviewed-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20250205110958.5cecb0469479.I4a69617dc60ba0d6308416ffbc3102cfd08ba068@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: ensure sdata->work is canceled before initialized. [+ + +]
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Wed Feb 5 11:39:26 2025 +0200

    wifi: mac80211: ensure sdata->work is canceled before initialized.
    
    [ Upstream commit 6c93fd502023dd919b5987ccbe990735410edd49 ]
    
    This wiphy work is canceled when the iface is stopped,
    and shouldn't be queued for a non-running iface.
    If it happens to be queued for a non-running iface (due to a bug)
    it can cause a corruption of wiphy_work_list when ieee80211_setup_sdata
    is called. Make sure to cancel it in this case and warn on.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Reviewed-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://patch.msgid.link/20250205110958.99204c767c10.I84ce27a239059f6009cee197b252549a11426046@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: fix integer overflow in hwmp_route_info_get() [+ + +]
Author: Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru>
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: stable@vger.kernel.org
    Signed-off-by: Ilia Gavrilov <Ilia.Gavrilov@infotecs.ru>
    Link: https://patch.msgid.link/20250212082124.4078236-1-Ilia.Gavrilov@infotecs.ru
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: Add check for devm_kstrdup() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
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: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Link: https://patch.msgid.link/20250219033645.2594753-1-haoxiang_li2024@163.com
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table [+ + +]
Author: Icenowy Zheng <uwu@icenowy.me>
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 <uwu@icenowy.me>
    Link: https://patch.msgid.link/20250317102235.1421726-1-uwu@icenowy.me
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mt76: mt7925: ensure wow pattern command align fw format [+ + +]
Author: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date:   Thu Jan 16 13:59:25 2025 +0800

    wifi: mt76: mt7925: ensure wow pattern command align fw format
    
    commit 8ae45b1f699bbc27ea8647093f794f671e77410b upstream.
    
    Align the format of "struct mt7925_wow_pattern_tlv" with
    firmware to ensure proper functionality.
    
    Cc: stable@vger.kernel.org
    Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
    Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
    Link: https://patch.msgid.link/20250116055925.3856856-1-mingyen.hsieh@mediatek.com
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: mt7925: fix country count limitation for CLC [+ + +]
Author: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date:   Thu Jan 16 14:21:31 2025 +0800

    wifi: mt76: mt7925: fix country count limitation for CLC
    
    commit 6458d760a0c0afd2fda11e83ed3e1125a252432f upstream.
    
    Due to the increase in the number of power tables for 6Ghz on CLC,
    the variable nr_country is no longer sufficient to represent the
    total quantity. Therefore, we have switched to calculating the
    length of clc buf to obtain the correct power table.
    
    Cc: stable@vger.kernel.org
    Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
    Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
    Link: https://patch.msgid.link/20250116062131.3860198-1-mingyen.hsieh@mediatek.com
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present [+ + +]
Author: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date:   Tue Mar 4 16:08:47 2025 -0800

    wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present
    
    commit 4bada9b0a29c185d45cc9512509edd6069fbfa79 upstream.
    
    When the p2p device and MLO station are running concurrently, the p2p device
    will occupy the wrong link_idx when the MLO secondary link is added.
    
    Fixes: 9e4c3a007f01 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO")
    Cc: stable@vger.kernel.org
    Co-developed-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Tested-by: Caleb Jorden <cjorden@gmail.com>
    Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
    Link: https://patch.msgid.link/20250305000851.493671-2-sean.wang@kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO [+ + +]
Author: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date:   Tue Mar 4 16:08:48 2025 -0800

    wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO
    
    commit 7dcea6fe33ee3d7cbb65baee0dd7adc76d1c9ddc upstream.
    
    The mt7925 chip is only support a single radio, so the maximum
    number of simultaneous should be 0.
    
    Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
    Cc: stable@vger.kernel.org
    Co-developed-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: Sean Wang <sean.wang@mediatek.com>
    Tested-by: Caleb Jorden <cjorden@gmail.com>
    Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
    Link: https://patch.msgid.link/20250305000851.493671-3-sean.wang@kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI [+ + +]
Author: Petr Vaněk <arkamar@atlas.cz>
Date:   Mon Apr 7 15:24:27 2025 +0200

    x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
    
    [ Upstream commit 8b37357a78d7fa13d88ea822b35b40137da1c85e ]
    
    Xen disables ACPI for PV guests in DomU, which causes acpi_mps_check() to
    return 1 when CONFIG_X86_MPPARSE is not set. As a result, the local APIC is
    disabled and the guest is later limited to a single vCPU, despite being
    configured with more.
    
    This regression was introduced in version 6.9 in commit 7c0edad3643f
    ("x86/cpu/topology: Rework possible CPU management"), which added an
    early check that limits CPUs to 1 if apic_is_disabled.
    
    Update the acpi_mps_check() logic to return 0 early when running as a Xen
    PV guest in DomU, preventing APIC from being disabled in this specific case
    and restoring correct multi-vCPU behaviour.
    
    Fixes: 7c0edad3643f ("x86/cpu/topology: Rework possible CPU management")
    Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/all/20250407132445.6732-2-arkamar@atlas.cz
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
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 <max@grobecker.info>
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 <max@grobecker.info>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: linux-kernel@vger.kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/e820: Fix handling of subpage regions when calculating nosave ranges in e820__register_nosave_regions() [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
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 <io@r-ricci.it>
    Tested-by: Roberto Ricci <io@r-ricci.it>
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: David Woodhouse <dwmw@amazon.co.uk>
    Cc: Len Brown <len.brown@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250406-fix-e820-nosave-v3-1-f3787bc1ee1d@qtmlabs.xyz
    Closes: https://lore.kernel.org/all/Z4WFjBVHpndct7br@desktop0a/
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

 
x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT [+ + +]
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Fri Feb 28 01:44:14 2025 +0000

    x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT
    
    commit 22cc5ca5de52bbfc36a7d4a55323f91fb4492264 upstream.
    
    CONFIG_PARAVIRT_XXL is mainly defined/used by XEN PV guests. For
    other VM guest types, features supported under CONFIG_PARAVIRT
    are self sufficient. CONFIG_PARAVIRT mainly provides support for
    TLB flush operations and time related operations.
    
    For TDX guest as well, paravirt calls under CONFIG_PARVIRT meets
    most of its requirement except the need of HLT and SAFE_HLT
    paravirt calls, which is currently defined under
    CONFIG_PARAVIRT_XXL.
    
    Since enabling CONFIG_PARAVIRT_XXL is too bloated for TDX guest
    like platforms, move HLT and SAFE_HLT paravirt calls under
    CONFIG_PARAVIRT.
    
    Moving HLT and SAFE_HLT paravirt calls are not fatal and should not
    break any functionality for current users of CONFIG_PARAVIRT.
    
    Fixes: bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
    Co-developed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Signed-off-by: Vishal Annapurve <vannapurve@google.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Andi Kleen <ak@linux.intel.com>
    Reviewed-by: Tony Luck <tony.luck@intel.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Tested-by: Ryan Afranji <afranji@google.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/r/20250228014416.3925664-2-vannapurve@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/percpu: Disable named address spaces for UBSAN_BOOL with KASAN for GCC < 14.2 [+ + +]
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Thu Feb 27 15:06:58 2025 +0100

    x86/percpu: Disable named address spaces for UBSAN_BOOL with KASAN for GCC < 14.2
    
    [ Upstream commit b6762467a09ba8838c499e4f36561e82fc608ed1 ]
    
    GCC < 14.2 does not correctly propagate address space qualifiers
    with -fsanitize=bool,enum. Together with address sanitizer then
    causes that load to be sanitized.
    
    Disable named address spaces for GCC < 14.2 when both, UBSAN_BOOL
    and KASAN are enabled.
    
    Reported-by: Matt Fleming <matt@readmodwrite.com>
    Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20250227140715.2276353-1-ubizjak@gmail.com
    Closes: https://lore.kernel.org/lkml/20241213190119.3449103-1-matt@readmodwrite.com/
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/xen: fix balloon target initialization for PVH dom0 [+ + +]
Author: Roger Pau Monne <roger.pau@citrix.com>
Date:   Mon Apr 7 10:28:37 2025 +0200

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

 
xen/mcelog: Add __nonstring annotations for unterminated strings [+ + +]
Author: Kees Cook <kees@kernel.org>
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 <jgross@suse.com>
    Cc: Stefano Stabellini <sstabellini@kernel.org>
    Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Cc: xen-devel@lists.xenproject.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Acked-by: Juergen Gross <jgross@suse.com>
    Message-ID: <20250310222234.work.473-kees@kernel.org>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xenfs/xensyms: respect hypervisor's "next" indication [+ + +]
Author: Jan Beulich <jbeulich@suse.com>
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: stable@kernel.org
    Fixes: a11f4f0a4e18 ("xen: xensyms support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Message-ID: <15d5e7fa-ec5d-422f-9319-d28bed916349@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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