Changelog in Linux kernel 6.12.14

 
accel/ivpu: Clear runtime_error after pm_runtime_resume_and_get() fails [+ + +]
Author: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Date:   Wed Jan 29 13:40:08 2025 +0100

    accel/ivpu: Clear runtime_error after pm_runtime_resume_and_get() fails
    
    commit f2bc2afe34c107a02ce829a4039e85514feafe55 upstream.
    
    pm_runtime_resume_and_get() sets dev->power.runtime_error that causes
    all subsequent pm_runtime_get_sync() calls to fail.
    Clear the runtime_error using pm_runtime_set_suspended(), so the driver
    doesn't have to be reloaded to recover when the NPU fails to boot during
    runtime resume.
    
    Fixes: 7d4b4c74432d ("accel/ivpu: Remove suspend_reschedule_counter")
    Cc: stable@vger.kernel.org # v6.11+
    Reviewed-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
    Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
    Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250129124009.1039982-3-jacek.lawrynowicz@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

accel/ivpu: Fix Qemu crash when running in passthrough [+ + +]
Author: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Date:   Wed Nov 6 11:55:49 2024 +0100

    accel/ivpu: Fix Qemu crash when running in passthrough
    
    commit 901dd2617c9c3554b2449c8844b6338009112fcf upstream.
    
    Restore PCI state after putting the NPU in D0.
    Restoring state before powering up the device caused a Qemu crash
    if NPU was running in passthrough mode and recovery was performed.
    
    Fixes: 3534eacbf101 ("accel/ivpu: Fix PCI D0 state entry in resume")
    Cc: stable@vger.kernel.org # v6.8+
    Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>
    Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241106105549.2757115-1-jacek.lawrynowicz@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ACPI: PRM: Remove unnecessary strict handler address checks [+ + +]
Author: Aubrey Li <aubrey.li@linux.intel.com>
Date:   Sun Jan 26 10:22:50 2025 +0800

    ACPI: PRM: Remove unnecessary strict handler address checks
    
    commit 7f5704b6a143b8eca640cba820968e798d065e91 upstream.
    
    Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM
    handler and context") added unnecessary strict handler address checks,
    causing the PRM module to fail in translating memory error addresses.
    
    Both static data buffer address and ACPI parameter buffer address may
    be NULL if they are not needed, as described in section 4.1.2 PRM Handler
    Information Structure of Platform Runtime Mechanism specification [1].
    
    Here are two examples from real hardware:
    
    ----PRMT.dsl----
    
    - staic data address is not used
    [10Ch 0268   2]                     Revision : 0000
    [10Eh 0270   2]                       Length : 002C
    [110h 0272  16]                 Handler GUID : F6A58D47-E04F-4F5A-86B8-2A50D4AA109B
    [120h 0288   8]              Handler address : 0000000065CE51F4
    [128h 0296   8]           Satic Data Address : 0000000000000000
    [130h 0304   8]       ACPI Parameter Address : 000000006522A718
    
    - ACPI parameter address is not used
    [1B0h 0432   2]                     Revision : 0000
    [1B2h 0434   2]                       Length : 002C
    [1B4h 0436  16]                 Handler GUID : 657E8AE6-A8FC-4877-BB28-42E7DE1899A5
    [1C4h 0452   8]              Handler address : 0000000065C567C8
    [1CCh 0460   8]           Satic Data Address : 000000006113FB98
    [1D4h 0468   8]       ACPI Parameter Address : 0000000000000000
    
    Fixes: 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context")
    Reported-and-tested-by: Shi Liu <aurelianliu@tencent.com>
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
    Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf # [1]
    Reviewed-by: Koba Ko <kobak@nvidia.com>
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://patch.msgid.link/20250126022250.3014210-1-aubrey.li@linux.intel.com
    [ rjw: Minor changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: property: Fix return value for nval == 0 in acpi_data_prop_read() [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Mon Feb 3 21:46:29 2025 +0200

    ACPI: property: Fix return value for nval == 0 in acpi_data_prop_read()
    
    [ Upstream commit ab930483eca9f3e816c35824b5868599af0c61d7 ]
    
    While analysing code for software and OF node for the corner case when
    caller asks to read zero items in the supposed to be an array of values
    I found that ACPI behaves differently to what OF does, i.e.
    
     1. It returns -EINVAL when caller asks to read zero items from integer
        array, while OF returns 0, if no other errors happened.
    
     2. It returns -EINVAL when caller asks to read zero items from string
        array, while OF returns -ENODATA, if no other errors happened.
    
    Amend ACPI implementation to follow what OF does.
    
    Fixes: b31384fa5de3 ("Driver core: Unified device properties interface for platform firmware")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/20250203194629.3731895-1-andriy.shevchenko@linux.intel.com
    [ rjw: Added empty line after a conditional ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/realtek: Enable headset mic on Positivo C6400 [+ + +]
Author: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
Date:   Tue Jan 14 14:06:19 2025 -0300

    ALSA: hda/realtek: Enable headset mic on Positivo C6400
    
    commit 1aec3ed2e3e1512aba15e7e790196a44efd5f0a7 upstream.
    
    Positivo C6400 is equipped with ALC269VB, and it needs
    ALC269VB_FIXUP_ASUS_ZENBOOK quirk to make its headset mic work.
    Also must to limits the microphone boost.
    
    Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250114170619.11510-1-edson.drosdeck@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Enable Mute LED on HP Laptop 14s-fq1xxx [+ + +]
Author: Sebastian Wiese-Wagner <seb@fastmail.to>
Date:   Mon Jan 20 19:12:40 2025 +0100

    ALSA: hda/realtek: Enable Mute LED on HP Laptop 14s-fq1xxx
    
    commit 711aad3c43a9853657e00225466d204e46ae528b upstream.
    
    This HP Laptop uses ALC236 codec with COEF 0x07 controlling the mute
    LED. Enable existing quirk for this device.
    
    Signed-off-by: Sebastian Wiese-Wagner <seb@fastmail.to>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250120181240.13106-1-seb@fastmail.to
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Fix quirk matching for Legion Pro 7 [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sat Jan 25 13:04:40 2025 +0100

    ALSA: hda/realtek: Fix quirk matching for Legion Pro 7
    
    commit 0f3a822ae2254a1e7ce3a130a1efd94e2cab73ee upstream.
    
    The recent cleanup of the quirk table entries with the codec ID
    matching caused a regression on some Lenovo Legion 7 models with PCI
    SSID 17aa:386f: it assumed wrongly as if the codec SSID on the machine
    were also 17aa:386f, but in this case, it was 17aa:38a8.  This made
    the binding with a wrong sub-codec, instead of TAS2781, the Cirrus
    codec was bound.
    
    For addressing the regression, correct the quirk entry to the right
    value 17aa:38a8.
    
    Note that this makes the entry appearing in an unsorted position.
    This exception is needed because the entry must match before the PCI
    SSID 17aa:386f.
    
    Also there is another entry for 17aa:38a8, but the latter is for PCI
    SSID matching while the new entry is for the codec SSID matching.
    
    Fixes: 504f052aa343 ("ALSA: hda/realtek: Use codec SSID matching for Lenovo devices")
    Reported-and-tested-by: Samantha Glocker <iam@anislandsomewhere.com>
    Closes: https://lore.kernel.org/CAGPQRHYd48U__UKYj2jJnT4+dnNNoWRBi+wj6zPRn=JpNMBUrg@mail.gmail.com
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250125120519.16420-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda: Fix headset detection failure due to unstable sort [+ + +]
Author: Kuan-Wei Chiu <visitorckw@gmail.com>
Date:   Wed Jan 29 00:54:15 2025 +0800

    ALSA: hda: Fix headset detection failure due to unstable sort
    
    commit 3b4309546b48fc167aa615a2d881a09c0a97971f upstream.
    
    The auto_parser assumed sort() was stable, but the kernel's sort() uses
    heapsort, which has never been stable. After commit 0e02ca29a563
    ("lib/sort: optimize heapsort with double-pop variation"), the order of
    equal elements changed, causing the headset to fail to work.
    
    Fix the issue by recording the original order of elements before
    sorting and using it as a tiebreaker for equal elements in the
    comparison function.
    
    Fixes: b9030a005d58 ("ALSA: hda - Use standard sort function in hda_auto_parser.c")
    Reported-by: Austrum <austrum.lab@gmail.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219158
    Tested-by: Austrum <austrum.lab@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
    Link: https://patch.msgid.link/20250128165415.643223-1-visitorckw@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
APEI: GHES: Have GHES honor the panic= setting [+ + +]
Author: Borislav Petkov <bp@alien8.de>
Date:   Mon Jan 13 13:52:24 2025 +0100

    APEI: GHES: Have GHES honor the panic= setting
    
    [ Upstream commit 5c0e00a391dd0099fe95991bb2f962848d851916 ]
    
    The GHES driver overrides the panic= setting by force-rebooting the
    system after a fatal hw error has been reported. The intent being that
    such an error would be reported earlier.
    
    However, this is not optimal when a hard-to-debug issue requires long
    time to reproduce and when that happens, the box will get rebooted after
    30 seconds and thus destroy the whole hw context of when the error
    happened.
    
    So rip out the default GHES panic timeout and honor the global one.
    
    In the panic disabled (panic=0) case, the error will still be logged to
    dmesg for later inspection and if panic after a hw error is really
    required, then that can be controlled the usual way - use panic= on the
    cmdline or set it in the kernel .config's CONFIG_PANIC_TIMEOUT.
    
    Reported-by: Feng Tang <feng.tang@linux.alibaba.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Feng Tang <feng.tang@linux.alibaba.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/20250113125224.GFZ4UMiNtWIJvgpveU@fat_crate.local
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64/kvm: Configure HYP TCR.PS/DS based on host stage1 [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Thu Dec 12 09:18:45 2024 +0100

    arm64/kvm: Configure HYP TCR.PS/DS based on host stage1
    
    commit f0da16992aef7e246b2f3bba1492e3a52c38ca0e upstream.
    
    When the host stage1 is configured for LPA2, the value currently being
    programmed into TCR_EL2.T0SZ may be invalid unless LPA2 is configured
    at HYP as well.  This means kvm_lpa2_is_enabled() is not the right
    condition to test when setting TCR_EL2.DS, as it will return false if
    LPA2 is only available for stage 1 but not for stage 2.
    
    Similary, programming TCR_EL2.PS based on a limited IPA range due to
    lack of stage2 LPA2 support could potentially result in problems.
    
    So use lpa2_is_enabled() instead, and set the PS field according to the
    host's IPS, which is capped at 48 bits if LPA2 support is absent or
    disabled. Whether or not we can make meaningful use of such a
    configuration is a different question.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20241212081841.2168124-11-ardb+git@google.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64/mm: Ensure adequate HUGE_MAX_HSTATE [+ + +]
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date:   Mon Dec 2 12:14:07 2024 +0530

    arm64/mm: Ensure adequate HUGE_MAX_HSTATE
    
    [ Upstream commit 1e5823c8e86de83a43d59a522b4de29066d3b306 ]
    
    This asserts that HUGE_MAX_HSTATE is sufficient enough preventing potential
    hugetlb_max_hstate runtime overflow in hugetlb_add_hstate() thus triggering
    a BUG_ON() there after.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
    Reviewed-by: Gavin Shan <gshan@redhat.com>
    Link: https://lore.kernel.org/r/20241202064407.53807-1-anshuman.khandual@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64/mm: Override PARange for !LPA2 and use it consistently [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Thu Dec 12 09:18:44 2024 +0100

    arm64/mm: Override PARange for !LPA2 and use it consistently
    
    commit 62cffa496aac0c2c4eeca00d080058affd7a0172 upstream.
    
    When FEAT_LPA{,2} are not implemented, the ID_AA64MMFR0_EL1.PARange and
    TCR.IPS values corresponding with 52-bit physical addressing are
    reserved.
    
    Setting the TCR.IPS field to 0b110 (52-bit physical addressing) has side
    effects, such as how the TTBRn_ELx.BADDR fields are interpreted, and so
    it is important that disabling FEAT_LPA2 (by overriding the
    ID_AA64MMFR0.TGran fields) also presents a PARange field consistent with
    that.
    
    So limit the field to 48 bits unless LPA2 is enabled, and update
    existing references to use the override consistently.
    
    Fixes: 352b0395b505 ("arm64: Enable 52-bit virtual addressing for 4k and 16k granule configs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20241212081841.2168124-10-ardb+git@google.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64/mm: Reduce PA space to 48 bits when LPA2 is not enabled [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Thu Dec 12 09:18:43 2024 +0100

    arm64/mm: Reduce PA space to 48 bits when LPA2 is not enabled
    
    commit bf74bb73cd87c64bd5afc1fd4b749029997b6170 upstream.
    
    Currently, LPA2 kernel support implies support for up to 52 bits of
    physical addressing, and this is reflected in global definitions such as
    PHYS_MASK_SHIFT and MAX_PHYSMEM_BITS.
    
    This is potentially problematic, given that LPA2 hardware support is
    modeled as a CPU feature which can be overridden, and with LPA2 hardware
    support turned off, attempting to map physical regions with address bits
    [51:48] set (which may exist on LPA2 capable systems booting with
    arm64.nolva) will result in corrupted mappings with a truncated output
    address and bogus shareability attributes.
    
    This means that the accepted physical address range in the mapping
    routines should be at most 48 bits wide when LPA2 support is configured
    but not enabled at runtime.
    
    Fixes: 352b0395b505 ("arm64: Enable 52-bit virtual addressing for 4k and 16k granule configs")
    Cc: stable@vger.kernel.org
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20241212081841.2168124-9-ardb+git@google.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64/sme: Move storage of reg_smidr to __cpuinfo_store_cpu() [+ + +]
Author: Mark Brown <broonie@kernel.org>
Date:   Tue Dec 17 21:59:48 2024 +0000

    arm64/sme: Move storage of reg_smidr to __cpuinfo_store_cpu()
    
    commit d3c7c48d004f6c8d892f39b5d69884fd0fe98c81 upstream.
    
    In commit 892f7237b3ff ("arm64: Delay initialisation of
    cpuinfo_arm64::reg_{zcr,smcr}") we moved access to ZCR, SMCR and SMIDR
    later in the boot process in order to ensure that we don't attempt to
    interact with them if SVE or SME is disabled on the command line.
    Unfortunately when initialising the boot CPU in init_cpu_features() we work
    on a copy of the struct cpuinfo_arm64 for the boot CPU used only during
    boot, not the percpu copy used by the sysfs code. The expectation of the
    feature identification code was that the ID registers would be read in
    __cpuinfo_store_cpu() and the values not modified by init_cpu_features().
    
    The main reason for the original change was to avoid early accesses to
    ZCR on practical systems that were seen shipping with SVE reported in ID
    registers but traps enabled at EL3 and handled as fatal errors, SME was
    rolled in due to the similarity with SVE. Since then we have removed the
    early accesses to ZCR and SMCR in commits:
    
      abef0695f9665c3d ("arm64/sve: Remove ZCR pseudo register from cpufeature code")
      391208485c3ad50f ("arm64/sve: Remove SMCR pseudo register from cpufeature code")
    
    so only the SMIDR_EL1 part of the change remains. Since SMIDR_EL1 is
    only trapped via FEAT_IDST and not the SME trap it is less likely to be
    affected by similar issues, and the factors that lead to issues with SVE
    are less likely to apply to SME.
    
    Since we have not yet seen practical SME systems that need to use a
    command line override (and are only just beginning to see SME systems at
    all) and the ID register read is much more likely to be safe let's just
    store SMIDR_EL1 along with all the other ID register reads in
    __cpuinfo_store_cpu().
    
    This issue wasn't apparent when testing on emulated platforms that do not
    report values in SMIDR_EL1.
    
    Fixes: 892f7237b3ff ("arm64: Delay initialisation of cpuinfo_arm64::reg_{zcr,smcr}")
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241217-arm64-fix-boot-cpu-smidr-v3-1-7be278a85623@kernel.org
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: dts: mediatek: mt8183: Disable DPI display output by default [+ + +]
Author: Chen-Yu Tsai <wenst@chromium.org>
Date:   Fri Oct 25 15:56:27 2024 +0800

    arm64: dts: mediatek: mt8183: Disable DPI display output by default
    
    commit 93a680af46436780fd64f4e856a4cfa8b393be6e upstream.
    
    This reverts commit 377548f05bd0905db52a1d50e5b328b9b4eb049d.
    
    Most SoC dtsi files have the display output interfaces disabled by
    default, and only enabled on boards that utilize them. The MT8183
    has it backwards: the display outputs are left enabled by default,
    and only disabled at the board level.
    
    Reverse the situation for the DPI output so that it follows the
    normal scheme. For ease of backporting the DSI output is handled
    in a separate patch.
    
    Fixes: 009d855a26fd ("arm64: dts: mt8183: add dpi node to mt8183")
    Fixes: 377548f05bd0 ("arm64: dts: mediatek: mt8183-kukui: Disable DPI display interface")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    Reviewed-by: Fei Shao <fshao@chromium.org>
    Link: https://lore.kernel.org/r/20241025075630.3917458-1-wenst@chromium.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sdx75: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:09 2024 +0100

    arm64: dts: qcom: sdx75: Fix MPSS memory length
    
    commit 9a27f0e1869e992e4107e2af8ec348e1a3b9d4d5 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Cc: stable@vger.kernel.org
    Fixes: 41c72f36b286 ("arm64: dts: qcom: sdx75: Add remoteproc node")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-20-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6115: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:12 2024 +0100

    arm64: dts: qcom: sm6115: Fix ADSP memory base and length
    
    commit 47d178caac3ec13f5f472afda25fcfdfaa00d0da upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0a40_0000 with length of 0x4040.
    
    0x0ab0_0000, value used so far, is the SSC_QUPV3 block, so entierly
    unrelated.
    
    Correct the base address and length, which should have no functional
    impact on Linux users, because PAS loader does not use this address
    space at all.
    
    Cc: stable@vger.kernel.org
    Fixes: 96ce9227fdbc ("arm64: dts: qcom: sm6115: Add remoteproc nodes")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-23-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6115: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:11 2024 +0100

    arm64: dts: qcom: sm6115: Fix CDSP memory length
    
    commit 846f49c3f01680f4af3043bf5b7abc9cf71bb42d upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x4040.  Value of 0x100000 covers
    entire Touring/CDSP memory block seems to big here.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Cc: stable@vger.kernel.org
    Fixes: 96ce9227fdbc ("arm64: dts: qcom: sm6115: Add remoteproc nodes")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-22-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6115: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:10 2024 +0100

    arm64: dts: qcom: sm6115: Fix MPSS memory length
    
    commit 472d65e7cb591c8379dd6f40561f96be73a46f0f upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x100 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Cc: stable@vger.kernel.org
    Fixes: 96ce9227fdbc ("arm64: dts: qcom: sm6115: Add remoteproc nodes")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-21-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6350: Fix ADSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:04 2024 +0100

    arm64: dts: qcom: sm6350: Fix ADSP memory length
    
    commit b0805a864459a29831577d2a47165afebe338faf upstream.
    
    The address space in ADSP (Peripheral Authentication Service) remoteproc
    node should point to the QDSP PUB address space (QDSP6...SS_PUB) which
    has a length of 0x10000.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: efc33c969f23 ("arm64: dts: qcom: sm6350: Add ADSP nodes")
    Cc: stable@vger.kernel.org
    Tested-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-15-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6350: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:05 2024 +0100

    arm64: dts: qcom: sm6350: Fix MPSS memory length
    
    commit cd8d83de9cc9ecfb1f9a12bc838041c4eb4d10bd upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 489be59b635b ("arm64: dts: qcom: sm6350: Add MPSS nodes")
    Cc: stable@vger.kernel.org
    Tested-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-16-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6350: Fix uart1 interconnect path [+ + +]
Author: Luca Weiss <luca.weiss@fairphone.com>
Date:   Fri Dec 20 09:59:50 2024 +0100

    arm64: dts: qcom: sm6350: Fix uart1 interconnect path
    
    commit be2f81eaa2c8e81d3de5b73dca5e133f63384cb3 upstream.
    
    The path MASTER_QUP_0 to SLAVE_EBI_CH0 would be qup-memory path and not
    qup-config. Since the qup-memory path is not part of the qcom,geni-uart
    bindings, just replace that path with the correct path for qup-config.
    
    Fixes: b179f35b887b ("arm64: dts: qcom: sm6350: add uart1 node")
    Cc: stable@vger.kernel.org
    Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241220-sm6350-uart1-icc-v1-1-f4f10fd91adf@fairphone.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6375: Fix ADSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:06 2024 +0100

    arm64: dts: qcom: sm6375: Fix ADSP memory length
    
    commit bf4dda83da27b7efc49326ebb82cbd8b3e637c38 upstream.
    
    The address space in ADSP (Peripheral Authentication Service) remoteproc
    node should point to the QDSP PUB address space (QDSP6...SS_PUB) which
    has a length of 0x10000.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: fe6fd26aeddf ("arm64: dts: qcom: sm6375: Add ADSP&CDSP")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-17-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6375: Fix CDSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:07 2024 +0100

    arm64: dts: qcom: sm6375: Fix CDSP memory base and length
    
    commit c9f7f341e896836c99709421a23bae5f53039aab upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0b30_0000 with length of 0x10000.
    
    0x0b00_0000, value used so far, is the main region of CDSP.
    
    Correct the base address and length, which should have no functional
    impact on Linux users, because PAS loader does not use this address
    space at all.
    
    Fixes: fe6fd26aeddf ("arm64: dts: qcom: sm6375: Add ADSP&CDSP")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-18-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm6375: Fix MPSS memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:08 2024 +0100

    arm64: dts: qcom: sm6375: Fix MPSS memory base and length
    
    commit 918e71ba0c08c3d609ad69067854b0f675c4a253 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0608_0000 with length of 0x10000.
    
    0x0600_0000, value used so far, is the main region of Modem.
    
    Correct the base address and length, which should have no functional
    impact on Linux users, because PAS loader does not use this address
    space at all.
    
    Fixes: 31cc61104f68 ("arm64: dts: qcom: sm6375: Add modem nodes")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-19-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8350: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:50 2024 +0100

    arm64: dts: qcom: sm8350: Fix ADSP memory base and length
    
    commit f9ba85566ddd5a3db8fa291aaecd70c4e55a3732 upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0300_0000 with length of 0x10000.  0x1730_0000,
    value used so far, was copied from downstream DTS, is in the middle of
    unused space and downstream DTS describes the PIL loader, which is a bit
    different interface.
    
    Assume existing value (thus downstream DTS) is not really describing the
    intended ADSP PAS region.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: 177fcf0aeda2 ("arm64: dts: qcom: sm8350: Add remoteprocs")
    Cc: stable@vger.kernel.org
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-1-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8350: Fix CDSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:51 2024 +0100

    arm64: dts: qcom: sm8350: Fix CDSP memory base and length
    
    commit f4afd8ba453b6e82245b9068868c72c831aec84e upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0a30_0000 with length of 0x10000.  0x9890_0000,
    value used so far, was copied from downstream DTS, is in the middle of
    RAM/DDR space and downstream DTS describes the PIL loader, which is a
    bit different interface.  Datasheet says that one of the main CDSP
    address spaces is 0x0980_0000, which is oddly similar to 0x9890_0000,
    but quite different.
    
    Assume existing value (thus downstream DTS) is not really describing the
    intended CDSP PAS region.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: 177fcf0aeda2 ("arm64: dts: qcom: sm8350: Add remoteprocs")
    Cc: stable@vger.kernel.org
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-2-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8350: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:52 2024 +0100

    arm64: dts: qcom: sm8350: Fix MPSS memory length
    
    commit da1937dec9cd986e685b6a429b528a4cbc7b1603 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 177fcf0aeda2 ("arm64: dts: qcom: sm8350: Add remoteprocs")
    Cc: stable@vger.kernel.org
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-3-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8450: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:53 2024 +0100

    arm64: dts: qcom: sm8450: Fix ADSP memory base and length
    
    commit 13c96bee5d5e5b61a9d8d000c9bb37bb9a2a0551 upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0300_0000 with length of 0x10000, which also matches
    downstream DTS.  0x3000_0000, value used so far, was in datasheet is the
    region of CDSP.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: 1172729576fb ("arm64: dts: qcom: sm8450: Add remoteproc enablers and instances")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-4-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8450: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:54 2024 +0100

    arm64: dts: qcom: sm8450: Fix CDSP memory length
    
    commit 3751fe2cba2a9fba2204ef62102bc4bb027cec7b upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x1400000 was
    copied from older DTS, but it does not look accurate at all.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 1172729576fb ("arm64: dts: qcom: sm8450: Add remoteproc enablers and instances")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-5-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8450: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:55 2024 +0100

    arm64: dts: qcom: sm8450: Fix MPSS memory length
    
    commit fa6442e87ab7c4a58c0b5fc64aab1aacc8034712 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 1172729576fb ("arm64: dts: qcom: sm8450: Add remoteproc enablers and instances")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-6-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8550: correct MDSS interconnects [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Sat Oct 26 20:59:40 2024 +0300

    arm64: dts: qcom: sm8550: correct MDSS interconnects
    
    commit b8591df49cde459e3b84cdc0517d7bf92053d244 upstream.
    
    SM8550 lists two interconnects for the display subsystem, mdp0-mem
    (between MDP and LLCC) and mdp1-mem (between LLCC and EBI, memory).
    The second interconnect is a misuse. mdpN-mem paths should be used for
    several outboud MDP interconnects rather than the path between LLCC and
    memory. This kind of misuse can result in bandwidth underflows, possibly
    degrading picture quality as the required memory bandwidth is divided
    between all mdpN-mem paths (and LLCC-EBI should not be a part of such
    division).
    
    Drop the second path and use direct MDP-EBI path for mdp0-mem until we
    support separate MDP-LLCC and LLCC-EBI paths.
    
    Fixes: d7da51db5b81 ("arm64: dts: qcom: sm8550: add display hardware devices")
    Cc: stable@kernel.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241026-fix-sm8x50-mdp-icc-v2-1-fd8ddf755acc@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8550: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:56 2024 +0100

    arm64: dts: qcom: sm8550: Fix ADSP memory base and length
    
    commit a6a8f54bc2af555738322783ba1e990c2ae7f443 upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
    
    0x3000_0000, value used so far, is the main region of CDSP.  Downstream
    DTS uses 0x0300_0000, which is oddly similar to 0x3000_0000, yet quite
    different and points to unused area.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: d0c061e366ed ("arm64: dts: qcom: sm8550: add adsp, cdsp & mdss nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-7-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8550: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:57 2024 +0100

    arm64: dts: qcom: sm8550: Fix CDSP memory length
    
    commit 6b2570e1e43e4acd0fcb98c6489736fe1c67b222 upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x1400000 was
    copied from older DTS, but it does not look accurate at all.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: d0c061e366ed ("arm64: dts: qcom: sm8550: add adsp, cdsp & mdss nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-8-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8550: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:58 2024 +0100

    arm64: dts: qcom: sm8550: Fix MPSS memory length
    
    commit 8ef227e93a513d431f9345f23cd4d2d65607b985 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: d0c061e366ed ("arm64: dts: qcom: sm8550: add adsp, cdsp & mdss nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-9-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8650: correct MDSS interconnects [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Sat Oct 26 20:59:41 2024 +0300

    arm64: dts: qcom: sm8650: correct MDSS interconnects
    
    commit 9fa33cbca3d2842f1f47ed4e5f6574e611dae32b upstream.
    
    SM8650 lists two interconnects for the display subsystem, mdp0-mem
    (between MDP and LLCC) and mdp1-mem (between LLCC and EBI, memory).
    The second interconnect is a misuse. mdpN-mem paths should be used for
    several outboud MDP interconnects rather than the path between LLCC and
    memory. This kind of misuse can result in bandwidth underflows, possibly
    degrading picture quality as the required memory bandwidth is divided
    between all mdpN-mem paths (and LLCC-EBI should not be a part of such
    division).
    
    Drop the second path and use direct MDP-EBI path for mdp0-mem until we
    support separate MDP-LLCC and LLCC-EBI paths.
    
    Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
    Cc: stable@kernel.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241026-fix-sm8x50-mdp-icc-v2-2-fd8ddf755acc@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8650: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:59 2024 +0100

    arm64: dts: qcom: sm8650: Fix ADSP memory base and length
    
    commit b6ddc5c37323f7875c2533cc4949be58d15e430a upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
    
    0x3000_0000, value used so far, is the main region of CDSP.  Downstream
    DTS uses 0x0300_0000, which is oddly similar to 0x3000_0000, yet quite
    different and points to unused area.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-10-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8650: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:00 2024 +0100

    arm64: dts: qcom: sm8650: Fix CDSP memory length
    
    commit aca0053f051625a224c2e802a0e88755770819e4 upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x1400000 was
    copied from older DTS, but it does not look accurate at all.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-11-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: sm8650: Fix MPSS memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:01 2024 +0100

    arm64: dts: qcom: sm8650: Fix MPSS memory length
    
    commit d4fa87daf3dd39d6bd4b69613e22bfb43c737831 upstream.
    
    The address space in MPSS/Modem PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x4040 was
    copied from older DTS, but it grew since then.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-12-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e78100-lenovo-thinkpad-t14s: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:33 2024 +0100

    arm64: dts: qcom: x1e78100-lenovo-thinkpad-t14s: Fix USB QMP PHY supplies
    
    commit 6efc01b75f819a2988aa9392f93a4d6501871525 upstream.
    
    On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Since x1e78100-lenovo-thinkpad-t14s mostly just mirrors the power supplies
    from the x1e80100-crd device tree, assume that the fix also applies here.
    
    Cc: stable@vger.kernel.org
    Fixes: 7d1cbe2f4985 ("arm64: dts: qcom: Add X1E78100 ThinkPad T14s Gen 6")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-2-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100-asus-vivobook-s15: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:34 2024 +0100

    arm64: dts: qcom: x1e80100-asus-vivobook-s15: Fix USB QMP PHY supplies
    
    commit bf5e9aa844ca74e9c202d8de2ce7390d24ec38a4 upstream.
    
    On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Since x1e80100-asus-vivobook-s15 mostly just mirrors the power supplies
    from the x1e80100-crd device tree, assume that the fix also applies here.
    
    Cc: stable@vger.kernel.org
    Fixes: d0e2f8f62dff ("arm64: dts: qcom: Add device tree for ASUS Vivobook S 15")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Tested-by: Maud Spierings <maud_spierings@hotmail.com>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-3-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100-crd: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:35 2024 +0100

    arm64: dts: qcom: x1e80100-crd: Fix USB QMP PHY supplies
    
    commit 789209dd08124da448bfa7524b21049a04d98f83 upstream.
    
    On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Cc: stable@vger.kernel.org
    Fixes: ae5cee8e7349 ("arm64: dts: qcom: x1e80100-crd: Fix USB PHYs regulators")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-4-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100-lenovo-yoga-slim7x: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:37 2024 +0100

    arm64: dts: qcom: x1e80100-lenovo-yoga-slim7x: Fix USB QMP PHY supplies
    
    commit 6ba8e1b8242d27dd83ed4ce58a104c709e72f45f upstream.
    
    On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Since x1e80100-lenovo-yoga-slim7x mostly just mirrors the power supplies
    from the x1e80100-crd device tree, assume that the fix also applies here.
    
    Cc: stable@vger.kernel.org
    Fixes: 45247fe17db2 ("arm64: dts: qcom: x1e80100: add Lenovo Thinkpad Yoga slim 7x devicetree")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-6-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100-microsoft-romulus: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:38 2024 +0100

    arm64: dts: qcom: x1e80100-microsoft-romulus: Fix USB QMP PHY supplies
    
    commit c0562f51b177d49829a378b5aeda73f78c60d0fc upstream.
    
    On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Since x1e80100-microsoft-romulus mostly just mirrors the power supplies
    from the x1e80100-crd device tree, assume that the fix also applies here.
    
    Cc: stable@vger.kernel.org
    Fixes: 09d77be56093 ("arm64: dts: qcom: Add support for X1-based Surface Laptop 7 devices")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-7-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100-qcp: Fix USB QMP PHY supplies [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Tue Dec 10 10:07:39 2024 +0100

    arm64: dts: qcom: x1e80100-qcp: Fix USB QMP PHY supplies
    
    commit 4861ba7cf5a49969dee258dda2bf8d4e819135d1 upstream.
    
    On the X1E80100 QCP, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1
    (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2
    are actually powered by &vreg_l2j_1p2.
    
    Cc: stable@vger.kernel.org
    Fixes: 20676f7819d7 ("arm64: dts: qcom: x1e80100-qcp: Fix USB PHYs regulators")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241210-x1e80100-usb-qmp-supply-fix-v1-8-0adda5d30bbd@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100: Fix ADSP memory base and length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:02 2024 +0100

    arm64: dts: qcom: x1e80100: Fix ADSP memory base and length
    
    commit 7a003077366946a5ed1adab6d177efb2ab59e815 upstream.
    
    The address space in ADSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
    
    0x3000_0000, value used so far, is the main region of CDSP and was
    simply copied from other/older DTS.
    
    Correct the base address and length, which also moves the node to
    different place to keep things sorted by unit address.  The diff looks
    big, but only the unit address and "reg" property were changed.  This
    should have no functional impact on Linux users, because PAS loader does
    not use this address space at all.
    
    Fixes: 5f2a9cd4b104 ("arm64: dts: qcom: x1e80100: Add ADSP/CDSP remoteproc nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-13-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:54:03 2024 +0100

    arm64: dts: qcom: x1e80100: Fix CDSP memory length
    
    commit 3de1bf12c6bfb9a92f0803941ecae39b08470446 upstream.
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x1400000 was
    copied from older DTS, but it does not look accurate at all.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 5f2a9cd4b104 ("arm64: dts: qcom: x1e80100: Add ADSP/CDSP remoteproc nodes")
    Cc: stable@vger.kernel.org
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-14-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: qcom: x1e80100: Fix usb_2 controller interrupts [+ + +]
Author: Abel Vesa <abel.vesa@linaro.org>
Date:   Tue Jan 7 15:15:16 2025 +0200

    arm64: dts: qcom: x1e80100: Fix usb_2 controller interrupts
    
    commit 680421056216efe727ff4ed48f481691d5873b9e upstream.
    
    Back when the CRD support was brought up, the usb_2 controller didn't
    have anything connected to it in order to test it properly, so it was
    never enabled.
    
    On the Lenovo ThinkPad T14s, the usb_2 controller has the fingerprint
    controller connected to it. So enabling it, proved that the interrupts
    lines were wrong from the start.
    
    Fix both the pwr_event and the DWC ctrl_irq lines, according to
    documentation.
    
    Fixes: 4af46b7bd66f ("arm64: dts: qcom: x1e80100: Add USB nodes")
    Cc: stable@vger.kernel.org      # 6.9
    Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20250107-x1e80100-fix-usb2-controller-irqs-v1-1-4689aa9852a7@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: rockchip: add reset-names for combphy on rk3568 [+ + +]
Author: Chukun Pan <amadeus@jmu.edu.cn>
Date:   Fri Nov 22 15:30:05 2024 +0800

    arm64: dts: rockchip: add reset-names for combphy on rk3568
    
    commit 8b9c12757f919157752646faf3821abf2b7d2a64 upstream.
    
    The reset-names of combphy are missing, add it.
    
    Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
    Fixes: fd3ac6e80497 ("dt-bindings: phy: rockchip: rk3588 has two reset lines")
    Link: https://lore.kernel.org/r/20241122073006.99309-1-amadeus@jmu.edu.cn
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma [+ + +]
Author: Jakob Unterwurzacher <jakobunt@gmail.com>
Date:   Fri Dec 13 10:54:58 2024 +0100

    arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma
    
    commit 9d241b06802c6c2176ae7aa4f9f17f8a577ed337 upstream.
    
    During mass manufacturing, we noticed the mmc_rx_crc_error counter,
    as reported by "ethtool -S eth0 | grep mmc_rx_crc_error", to increase
    above zero during nuttcp speedtests. Most of the time, this did not
    affect the achieved speed, but it prompted this investigation.
    
    Cycling through the rx_delay range on six boards (see table below) of
    various ages shows that there is a large good region from 0x12 to 0x35
    where we see zero crc errors on all tested boards.
    
    The old rx_delay value (0x10) seems to have always been on the edge for
    the KSZ9031RNX that is usually placed on Puma.
    
    Choose "rx_delay = 0x23" to put us smack in the middle of the good
    region. This works fine as well with the KSZ9131RNX PHY that was used
    for a small number of boards during the COVID chip shortages.
    
            Board S/N        PHY        rx_delay good region
            ---------        ---        --------------------
            Puma TT0069903   KSZ9031RNX 0x11 0x35
            Puma TT0157733   KSZ9031RNX 0x11 0x35
            Puma TT0681551   KSZ9031RNX 0x12 0x37
            Puma TT0681156   KSZ9031RNX 0x10 0x38
            Puma 17496030079 KSZ9031RNX 0x10 0x37 (Puma v1.2 from 2017)
            Puma TT0681720   KSZ9131RNX 0x02 0x39 (alternative PHY used in very few boards)
    
            Intersection of good regions = 0x12 0x35
            Middle of good region = 0x23
    
    Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM")
    Cc: stable@vger.kernel.org
    Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
    Tested-by: Quentin Schulz <quentin.schulz@cherry.de> # Puma v2.1 and v2.3 with KSZ9031
    Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
    Link: https://lore.kernel.org/r/20241213-puma_rx_delay-v4-1-8e8e11cc6ed7@cherry.de
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: Filter out SVE hwcaps when FEAT_SVE isn't implemented [+ + +]
Author: Marc Zyngier <maz@kernel.org>
Date:   Tue Jan 7 22:59:41 2025 +0000

    arm64: Filter out SVE hwcaps when FEAT_SVE isn't implemented
    
    commit 064737920bdbca86df91b96aed256e88018fef3a upstream.
    
    The hwcaps code that exposes SVE features to userspace only
    considers ID_AA64ZFR0_EL1, while this is only valid when
    ID_AA64PFR0_EL1.SVE advertises that SVE is actually supported.
    
    The expectations are that when ID_AA64PFR0_EL1.SVE is 0, the
    ID_AA64ZFR0_EL1 register is also 0. So far, so good.
    
    Things become a bit more interesting if the HW implements SME.
    In this case, a few ID_AA64ZFR0_EL1 fields indicate *SME*
    features. And these fields overlap with their SVE interpretations.
    But the architecture says that the SME and SVE feature sets must
    match, so we're still hunky-dory.
    
    This goes wrong if the HW implements SME, but not SVE. In this
    case, we end-up advertising some SVE features to userspace, even
    if the HW has none. That's because we never consider whether SVE
    is actually implemented. Oh well.
    
    Fix it by restricting all SVE capabilities to ID_AA64PFR0_EL1.SVE
    being non-zero. The HWCAPS documentation is amended to reflect the
    actually checks performed by the kernel.
    
    Fixes: 06a916feca2b ("arm64: Expose SVE2 features for userspace")
    Reported-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: Will Deacon <will@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Mark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20250107-arm64-2024-dpisa-v5-1-7578da51fc3d@kernel.org
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: tegra: Disable Tegra234 sce-fabric node [+ + +]
Author: Sumit Gupta <sumitg@nvidia.com>
Date:   Wed Dec 18 00:07:37 2024 +0000

    arm64: tegra: Disable Tegra234 sce-fabric node
    
    commit a5e6fc0a10fe280989f1367a3b4f8047c7d00ea6 upstream.
    
    Access to safety cluster engine (SCE) fabric registers was blocked
    by firewall after the introduction of Functional Safety Island in
    Tegra234. After that, any access by software to SCE registers is
    correctly resulting in the internal bus error. However, when CPUs
    try accessing the SCE-fabric registers to print error info,
    another firewall error occurs as the fabric registers are also
    firewall protected. This results in a second error to be printed.
    Disable the SCE fabric node to avoid printing the misleading error.
    The first error info will be printed by the interrupt from the
    fabric causing the actual access.
    
    Cc: stable@vger.kernel.org
    Fixes: 302e154000ec ("arm64: tegra: Add node for CBB 2.0 on Tegra234")
    Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
    Signed-off-by: Ivy Huang <yijuh@nvidia.com>
    Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
    Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
    Link: https://lore.kernel.org/r/20241218000737.1789569-3-yijuh@nvidia.com
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: tegra: Fix Tegra234 PCIe interrupt-map [+ + +]
Author: Brad Griffis <bgriffis@nvidia.com>
Date:   Fri Dec 13 23:56:02 2024 +0000

    arm64: tegra: Fix Tegra234 PCIe interrupt-map
    
    commit b615fbd70fce8582d92b3bdbbf3c9b80cadcfb55 upstream.
    
    For interrupt-map entries, the DTS specification requires
    that #address-cells is defined for both the child node and the
    interrupt parent.  For the PCIe interrupt-map entries, the parent
    node ("gic") has not specified #address-cells. The existing layout
    of the PCIe interrupt-map entries indicates that it assumes
    that #address-cells is zero for this node.
    
    Explicitly set #address-cells to zero for "gic" so that it complies
    with the device tree specification.
    
    NVIDIA EDK2 works around this issue by assuming #address-cells
    is zero in this scenario, but that workaround is being removed and so
    this update is needed or else NVIDIA EDK2 cannot successfully parse the
    device tree and the board cannot boot.
    
    Fixes: ec142c44b026 ("arm64: tegra: Add P2U and PCIe controller nodes to Tegra234 DT")
    Signed-off-by: Brad Griffis <bgriffis@nvidia.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241213235602.452303-1-bgriffis@nvidia.com
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

arm64: tegra: Fix typo in Tegra234 dce-fabric compatible [+ + +]
Author: Sumit Gupta <sumitg@nvidia.com>
Date:   Wed Dec 18 00:07:36 2024 +0000

    arm64: tegra: Fix typo in Tegra234 dce-fabric compatible
    
    commit 604120fd9e9df50ee0e803d3c6e77a1f45d2c58e upstream.
    
    The compatible string for the Tegra DCE fabric is currently defined as
    'nvidia,tegra234-sce-fabric' but this is incorrect because this is the
    compatible string for SCE fabric. Update the compatible for the DCE
    fabric to correct the compatible string.
    
    This compatible needs to be correct in order for the interconnect
    to catch things such as improper data accesses.
    
    Cc: stable@vger.kernel.org
    Fixes: 302e154000ec ("arm64: tegra: Add node for CBB 2.0 on Tegra234")
    Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
    Signed-off-by: Ivy Huang <yijuh@nvidia.com>
    Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
    Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
    Link: https://lore.kernel.org/r/20241218000737.1789569-2-yijuh@nvidia.com
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ARM: dts: dra7: Add bus_dma_limit for l4 cfg bus [+ + +]
Author: Romain Naour <romain.naour@skf.com>
Date:   Fri Nov 15 11:25:37 2024 +0100

    ARM: dts: dra7: Add bus_dma_limit for l4 cfg bus
    
    commit c1472ec1dc4419d0bae663c1a1e6cb98dc7881ad upstream.
    
    A bus_dma_limit was added for l3 bus by commit cfb5d65f2595
    ("ARM: dts: dra7: Add bus_dma_limit for L3 bus") to fix an issue
    observed only with SATA on DRA7-EVM with 4GB RAM and CONFIG_ARM_LPAE
    enabled.
    
    Since kernel 5.13, the SATA issue can be reproduced again following
    the SATA node move from L3 bus to L4_cfg in commit 8af15365a368
    ("ARM: dts: Configure interconnect target module for dra7 sata").
    
    Fix it by adding an empty dma-ranges property to l4_cfg and
    segment@100000 nodes (parent device tree node of SATA controller) to
    inherit the 2GB dma ranges limit from l3 bus node.
    
    Note: A similar fix was applied for PCIe controller by commit
    90d4d3f4ea45 ("ARM: dts: dra7: Fix bus_dma_limit for PCIe").
    
    Fixes: 8af15365a368 ("ARM: dts: Configure interconnect target module for dra7 sata").
    Link: https://lore.kernel.org/linux-omap/c583e1bb-f56b-4489-8012-ce742e85f233@smile.fr/
    Cc: stable@vger.kernel.org # 5.13
    Signed-off-by: Romain Naour <romain.naour@skf.com>
    Link: https://lore.kernel.org/r/20241115102537.1330300-1-romain.naour@smile.fr
    Signed-off-by: Kevin Hilman <khilman@baylibre.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ARM: dts: ti/omap: gta04: fix pm issues caused by spi module [+ + +]
Author: Andreas Kemnade <andreas@kemnade.info>
Date:   Wed Dec 4 18:41:52 2024 +0100

    ARM: dts: ti/omap: gta04: fix pm issues caused by spi module
    
    commit 0cfbd7805fe13406500e6a6f2aa08f198d5db4bd upstream.
    
    Despite CM_IDLEST1_CORE and CM_FCLKEN1_CORE behaving normal,
    disabling SPI leads to messages like when suspending:
    Powerdomain (core_pwrdm) didn't enter target state 0
    and according to /sys/kernel/debug/pm_debug/count off state is not
    entered. That was not connected to SPI during the discussion
    of disabling SPI. See:
    https://lore.kernel.org/linux-omap/20230122100852.32ae082c@aktux/
    
    The reason is that SPI is per default in slave mode. Linux driver
    will turn it to master per default. It slave mode, the powerdomain seems to
    be kept active if active chip select input is sensed.
    
    Fix that by explicitly disabling the SPI3 pins which used to be muxed by
    the bootloader since they are available on an optionally fitted header
    which would require dtb overlays anyways.
    
    Fixes: a622310f7f01 ("ARM: dts: gta04: fix excess dma channel usage")
    CC: stable@vger.kernel.org
    Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Link: https://lore.kernel.org/r/20241204174152.2360431-1-andreas@kemnade.info
    Signed-off-by: Kevin Hilman <khilman@baylibre.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: acp: Support microphone from Lenovo Go S [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Jan 22 20:49:13 2025 -0600

    ASoC: acp: Support microphone from Lenovo Go S
    
    commit b9a8ea185f3f8024619b2e74b74375493c87df8c upstream.
    
    On Lenovo Go S there is a DMIC connected to the ACP but the firmware
    has no `AcpDmicConnected` ACPI _DSD.
    
    Add a DMI entry for all possible Lenovo Go S SKUs to enable DMIC.
    
    Cc: nijs1@lenovo.com
    Cc: pgriffais@valvesoftware.com
    Cc: mpearson-lenovo@squebb.ca
    Cc: stable@vger.kernel.org
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://patch.msgid.link/20250123024915.2457115-1-superm1@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: amd: Add ACPI dependency to fix build error [+ + +]
Author: Yu-Chun Lin <eleanor15x@gmail.com>
Date:   Fri Jan 10 01:15:47 2025 +0800

    ASoC: amd: Add ACPI dependency to fix build error
    
    [ Upstream commit 7e24ec93aecd12e33d31e38e5af4625553bbc727 ]
    
    As reported by the kernel test robot, the following error occurs:
    
       sound/soc/amd/yc/acp6x-mach.c: In function 'acp6x_probe':
    >> sound/soc/amd/yc/acp6x-mach.c:573:15: error: implicit declaration of function 'acpi_evaluate_integer'; did you mean 'acpi_evaluate_object'? [-Werror=implicit-function-declaration]
         573 |         ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
             |               ^~~~~~~~~~~~~~~~~~~~~
             |               acpi_evaluate_object
       cc1: some warnings being treated as errors
    
    The function 'acpi_evaluate_integer' and its prototype in 'acpi_bus.h'
    are only available when 'CONFIG_ACPI' is enabled. Add a 'depends on ACPI'
    directive in Kconfig to ensure proper compilation.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501090345.pBIDRTym-lkp@intel.com/
    Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
    Link: https://patch.msgid.link/20250109171547.362412-1-eleanor15x@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Intel: sof_sdw: Correct quirk for Lenovo Yoga Slim 7 [+ + +]
Author: Simon Trimmer <simont@opensource.cirrus.com>
Date:   Fri Dec 6 15:58:57 2024 +0800

    ASoC: Intel: sof_sdw: Correct quirk for Lenovo Yoga Slim 7
    
    [ Upstream commit 7662f0e5d55728a009229112ec820e963ed0e21c ]
    
    In addition to changing the DMI match to examine the product name rather
    than the SKU, this adds the quirk to inform the machine driver to not
    bind in the cs42l43 microphone DAI link.
    
    Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
    Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Link: https://patch.msgid.link/20241206075903.195730-5-yung-chuan.liao@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: soc-pcm: don't use soc_pcm_ret() on .prepare callback [+ + +]
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri Dec 13 01:21:10 2024 +0000

    ASoC: soc-pcm: don't use soc_pcm_ret() on .prepare callback
    
    [ Upstream commit 301c26a018acb94dd537a4418cefa0f654500c6f ]
    
    commit 1f5664351410 ("ASoC: lower "no backend DAIs enabled for ... Port"
    log severity") ignores -EINVAL error message on common soc_pcm_ret().
    It is used from many functions, ignoring -EINVAL is over-kill.
    
    The reason why -EINVAL was ignored was it really should only be used
    upon invalid parameters coming from userspace and in that case we don't
    want to log an error since we do not want to give userspace a way to do
    a denial-of-service attack on the syslog / diskspace.
    
    So don't use soc_pcm_ret() on .prepare callback is better idea.
    
    Link: https://lore.kernel.org/r/87v7vptzap.wl-kuninori.morimoto.gx@renesas.com
    Cc: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://patch.msgid.link/87bjxg8jju.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: SOF: Intel: hda-dai: Ensure DAI widget is valid during params [+ + +]
Author: Bard Liao <yung-chuan.liao@linux.intel.com>
Date:   Tue Dec 3 18:48:53 2024 +0800

    ASoC: SOF: Intel: hda-dai: Ensure DAI widget is valid during params
    
    [ Upstream commit 569922b82ca660f8b24e705f6cf674e6b1f99cc7 ]
    
    Each cpu DAI should associate with a widget. However, the topology might
    not create the right number of DAI widgets for aggregated amps. And it
    will cause NULL pointer deference.
    Check that the DAI widget associated with the CPU DAI is valid to prevent
    NULL pointer deference due to missing DAI widgets in topologies with
    aggregated amps.
    
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
    Link: https://patch.msgid.link/20241203104853.56956-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: libata-sff: Ensure that we cannot write outside the allocated buffer [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
Date:   Mon Jan 27 16:43:04 2025 +0100

    ata: libata-sff: Ensure that we cannot write outside the allocated buffer
    
    commit 6e74e53b34b6dec5a50e1404e2680852ec6768d2 upstream.
    
    reveliofuzzing reported that a SCSI_IOCTL_SEND_COMMAND ioctl with out_len
    set to 0xd42, SCSI command set to ATA_16 PASS-THROUGH, ATA command set to
    ATA_NOP, and protocol set to ATA_PROT_PIO, can cause ata_pio_sector() to
    write outside the allocated buffer, overwriting random memory.
    
    While a ATA device is supposed to abort a ATA_NOP command, there does seem
    to be a bug either in libata-sff or QEMU, where either this status is not
    set, or the status is cleared before read by ata_sff_hsm_move().
    Anyway, that is most likely a separate bug.
    
    Looking at __atapi_pio_bytes(), it already has a safety check to ensure
    that __atapi_pio_bytes() cannot write outside the allocated buffer.
    
    Add a similar check to ata_pio_sector(), such that also ata_pio_sector()
    cannot write outside the allocated buffer.
    
    Cc: stable@vger.kernel.org
    Reported-by: reveliofuzzing <reveliofuzzing@gmail.com>
    Closes: https://lore.kernel.org/linux-ide/CA+-ZZ_jTgxh3bS7m+KX07_EWckSnW3N2adX3KV63y4g7M4CZ2A@mail.gmail.com/
    Link: https://lore.kernel.org/r/20250127154303.15567-2-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
atomic64: Use arch_spin_locks instead of raw_spin_locks [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Wed Jan 22 14:43:11 2025 -0500

    atomic64: Use arch_spin_locks instead of raw_spin_locks
    
    commit 6c8ad3ab45ad0e94bfb7a9c71f2fa9c6cacea4b2 upstream.
    
    raw_spin_locks can be traced by lockdep or tracing itself. Atomic64
    operations can be used in the tracing infrastructure. When an architecture
    does not have true atomic64 operations it can use the generic version that
    disables interrupts and uses spin_locks.
    
    The tracing ring buffer code uses atomic64 operations for the time
    keeping. But because some architectures use the default operations, the
    locking inside the atomic operations can cause an infinite recursion.
    
    As atomic64 implementation is architecture specific, it should not be
    using raw_spin_locks() but instead arch_spin_locks as that is the purpose
    of arch_spin_locks. To be used in architecture specific implementations of
    generic infrastructure like atomic64 operations.
    
    Note, by switching from raw_spin_locks to arch_spin_locks, the locks taken
    to emulate the atomic64 operations will not have lockdep, mmio, or any
    kind of checks done on them. They will not even disable preemption,
    although the code will disable interrupts preventing the tasks that hold
    the locks from being preempted. As the locks held are done so for very
    short periods of time, and the logic is only done to emulate atomic64, not
    having them be instrumented should not be an issue.
    
    Cc: stable@vger.kernel.org
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Andreas Larsson <andreas@gaisler.com>
    Link: https://lore.kernel.org/20250122144311.64392baf@gandalf.local.home
    Fixes: c84897c0ff592 ("ring-buffer: Remove 32bit timestamp logic")
    Closes: https://lore.kernel.org/all/86fb4f86-a0e4-45a2-a2df-3154acc4f086@gaisler.com/
    Reported-by: Ludwig Rydberg <ludwig.rydberg@gaisler.com>
    Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
binfmt_flat: Fix integer overflow bug on 32 bit systems [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Dec 4 15:07:15 2024 +0300

    binfmt_flat: Fix integer overflow bug on 32 bit systems
    
    commit 55cf2f4b945f6a6416cc2524ba740b83cc9af25a upstream.
    
    Most of these sizes and counts are capped at 256MB so the math doesn't
    result in an integer overflow.  The "relocs" count needs to be checked
    as well.  Otherwise on 32bit systems the calculation of "full_data"
    could be wrong.
    
            full_data = data_len + relocs * sizeof(unsigned long);
    
    Fixes: c995ee28d29d ("binfmt_flat: prevent kernel dammage from corrupted executable headers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Acked-by: Nicolas Pitre <npitre@baylibre.com>
    Link: https://lore.kernel.org/r/5be17f6c-5338-43be-91ef-650153b975cb@stanley.mountain
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
blk-cgroup: Fix class @block_class's subsystem refcount leakage [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Sun Jan 5 16:34:03 2025 +0800

    blk-cgroup: Fix class @block_class's subsystem refcount leakage
    
    commit d1248436cbef1f924c04255367ff4845ccd9025e upstream.
    
    blkcg_fill_root_iostats() iterates over @block_class's devices by
    class_dev_iter_(init|next)(), but does not end iterating with
    class_dev_iter_exit(), so causes the class's subsystem refcount leakage.
    
    Fix by ending the iterating with class_dev_iter_exit().
    
    Fixes: ef45fe470e1e ("blk-cgroup: show global disk stats in root cgroup io.stat")
    Reviewed-by: Michal Koutný <mkoutny@suse.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: stable@vger.kernel.org
    Acked-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250105-class_fix-v6-2-3a2f1768d4d4@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
block: don't revert iter for -EIOCBQUEUED [+ + +]
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Jan 23 06:18:41 2025 -0700

    block: don't revert iter for -EIOCBQUEUED
    
    commit b13ee668e8280ca5b07f8ce2846b9957a8a10853 upstream.
    
    blkdev_read_iter() has a few odd checks, like gating the position and
    count adjustment on whether or not the result is bigger-than-or-equal to
    zero (where bigger than makes more sense), and not checking the return
    value of blkdev_direct_IO() before doing an iov_iter_revert(). The
    latter can lead to attempting to revert with a negative value, which
    when passed to iov_iter_revert() as an unsigned value will lead to
    throwing a WARN_ON() because unroll is bigger than MAX_RW_COUNT.
    
    Be sane and don't revert for -EIOCBQUEUED, like what is done in other
    spots.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: btusb: Add new VID/PID 13d3/3610 for MT7922 [+ + +]
Author: Andrew Halaney <ajhalaney@gmail.com>
Date:   Tue Dec 24 14:42:11 2024 -0600

    Bluetooth: btusb: Add new VID/PID 13d3/3610 for MT7922
    
    [ Upstream commit 45e7d389bf2e52dfc893779c611dd5cff461b590 ]
    
    A new machine has a Archer AX3000 / TX55e in it,
    and out the box reported issues resetting hci0. It looks like
    this is a MT7922 from the lspci output, so treat it as a MediaTek
    device and use the proper callbacks. With that in place an xbox
    controller can be used without issue as seen below:
    
        [    7.047388] Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20241106163512
        [    9.583883] Bluetooth: hci0: Device setup in 2582842 usecs
        [    9.583895] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
        [    9.644780] Bluetooth: hci0: AOSP extensions version v1.00
        [    9.644784] Bluetooth: hci0: AOSP quality report is supported
        [  876.379876] input: Xbox Wireless Controller as /devices/virtual/misc/uhid/0005:045E:0B13.0006/input/input27
        [  876.380215] hid-generic 0005:045E:0B13.0006: input,hidraw3: BLUETOOTH HID v5.15 Gamepad [Xbox Wireless Controller] on c0:bf:be:27:de:f7
        [  876.429368] input: Xbox Wireless Controller as /devices/virtual/misc/uhid/0005:045E:0B13.0006/input/input28
        [  876.429423] microsoft 0005:045E:0B13.0006: input,hidraw3: BLUETOOTH HID v5.15 Gamepad [Xbox Wireless Controller] on c0:bf:be:27:de:f7
    
    lspci output:
    
        root@livingroom:/home/ajhalaney/git# lspci
        ...
        05:00.0 Network controller: MEDIATEK Corp. MT7922 802.11ax PCI Express Wireless Network Adapter
    
    and USB device:
    
        root@livingroom:/home/ajhalaney/git# cat /sys/kernel/debug/usb/devices
        ...
        T:  Bus=01 Lev=01 Prnt=01 Port=10 Cnt=03 Dev#=  4 Spd=480  MxCh= 0
        D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=13d3 ProdID=3610 Rev= 1.00
        S:  Manufacturer=MediaTek Inc.
        S:  Product=Wireless_Device
        S:  SerialNumber=000000000
        C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
        A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
        I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
        E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
        I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
        I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
        I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
        I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
        I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
        I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
        E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
        I:  If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
        E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
        I:* If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
        E:  Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us
        E:  Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
    
    Signed-off-by: Andrew Halaney <ajhalaney@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: btusb: Add new VID/PID 13d3/3628 for MT7925 [+ + +]
Author: En-Wei Wu <en-wei.wu@canonical.com>
Date:   Tue Dec 24 14:35:22 2024 +0800

    Bluetooth: btusb: Add new VID/PID 13d3/3628 for MT7925
    
    [ Upstream commit f63f401130e5c5cd0dd2f18c9df967ab75cd4732 ]
    
    Add VID 13d3 & PID 3628 for MediaTek MT7925 USB Bluetooth chip.
    
    The information in /sys/kernel/debug/usb/devices about the Bluetooth
    device is listed as the below.
    
    T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#=  4 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=13d3 ProdID=3628 Rev= 1.00
    S:  Manufacturer=MediaTek Inc.
    S:  Product=Wireless_Device
    S:  SerialNumber=000000000
    C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
    A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
    E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
    I:* If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us
    E:  Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
    
    Signed-off-by: En-Wei Wu <en-wei.wu@canonical.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
Date:   Wed Jan 29 00:08:14 2025 +0300

    Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
    
    commit 5c61419e02033eaf01733d66e2fcd4044808f482 upstream.
    
    One of the possible ways to enable the input MTU auto-selection for L2CAP
    connections is supposed to be through passing a special "0" value for it
    as a socket option. Commit [1] added one of those into avdtp. However, it
    simply wouldn't work because the kernel still treats the specified value
    as invalid and denies the setting attempt. Recorded BlueZ logs include the
    following:
    
      bluetoothd[496]: profiles/audio/avdtp.c:l2cap_connect() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
    
    [1]: https://github.com/bluez/bluez/commit/ae5be371a9f53fed33d2b34748a95a5498fd4b77
    
    Found by Linux Verification Center (linuxtesting.org).
    
    Fixes: 4b6e228e297b ("Bluetooth: Auto tune if input MTU is set to 0")
    Cc: stable@vger.kernel.org
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
Date:   Wed Dec 18 00:19:59 2024 +0300

    Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
    
    commit 5f397409f8ee5bc82901eeaf799e1cbc4f8edcf1 upstream.
    
    A NULL sock pointer is passed into l2cap_sock_alloc() when it is called
    from l2cap_sock_new_connection_cb() and the error handling paths should
    also be aware of it.
    
    Seemingly a more elegant solution would be to swap bt_sock_alloc() and
    l2cap_chan_create() calls since they are not interdependent to that moment
    but then l2cap_chan_create() adds the soon to be deallocated and still
    dummy-initialized channel to the global list accessible by many L2CAP
    paths. The channel would be removed from the list in short period of time
    but be a bit more straight-forward here and just check for NULL instead of
    changing the order of function calls.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE static
    analysis tool.
    
    Fixes: 7c4f78cdb8e7 ("Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: MGMT: Fix slab-use-after-free Read in mgmt_remove_adv_monitor_sync [+ + +]
Author: Mazin Al Haddad <mazin@getstate.dev>
Date:   Tue Dec 24 05:06:16 2024 +0300

    Bluetooth: MGMT: Fix slab-use-after-free Read in mgmt_remove_adv_monitor_sync
    
    [ Upstream commit 26fbd3494a7dd26269cb0817c289267dbcfdec06 ]
    
    This fixes the following crash:
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_sync+0x3a/0xd0 net/bluetooth/mgmt.c:5543
    Read of size 8 at addr ffff88814128f898 by task kworker/u9:4/5961
    
    CPU: 1 UID: 0 PID: 5961 Comm: kworker/u9:4 Not tainted 6.12.0-syzkaller-10684-gf1cd565ce577 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
    Workqueue: hci0 hci_cmd_sync_work
    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:378 [inline]
     print_report+0x169/0x550 mm/kasan/report.c:489
     kasan_report+0x143/0x180 mm/kasan/report.c:602
     mgmt_remove_adv_monitor_sync+0x3a/0xd0 net/bluetooth/mgmt.c:5543
     hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:332
     process_one_work kernel/workqueue.c:3229 [inline]
     process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
     worker_thread+0x870/0xd30 kernel/workqueue.c:3391
     kthread+0x2f0/0x390 kernel/kthread.c:389
     ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
     </TASK>
    
    Allocated by task 16026:
     kasan_save_stack mm/kasan/common.c:47 [inline]
     kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
     poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
     __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
     kasan_kmalloc include/linux/kasan.h:260 [inline]
     __kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4314
     kmalloc_noprof include/linux/slab.h:901 [inline]
     kzalloc_noprof include/linux/slab.h:1037 [inline]
     mgmt_pending_new+0x65/0x250 net/bluetooth/mgmt_util.c:269
     mgmt_pending_add+0x36/0x120 net/bluetooth/mgmt_util.c:296
     remove_adv_monitor+0x102/0x1b0 net/bluetooth/mgmt.c:5568
     hci_mgmt_cmd+0xc47/0x11d0 net/bluetooth/hci_sock.c:1712
     hci_sock_sendmsg+0x7b8/0x11c0 net/bluetooth/hci_sock.c:1832
     sock_sendmsg_nosec net/socket.c:711 [inline]
     __sock_sendmsg+0x221/0x270 net/socket.c:726
     sock_write_iter+0x2d7/0x3f0 net/socket.c:1147
     new_sync_write fs/read_write.c:586 [inline]
     vfs_write+0xaeb/0xd30 fs/read_write.c:679
     ksys_write+0x18f/0x2b0 fs/read_write.c:731
     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
    
    Freed by task 16022:
     kasan_save_stack mm/kasan/common.c:47 [inline]
     kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
     kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
     poison_slab_object mm/kasan/common.c:247 [inline]
     __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
     kasan_slab_free include/linux/kasan.h:233 [inline]
     slab_free_hook mm/slub.c:2338 [inline]
     slab_free mm/slub.c:4598 [inline]
     kfree+0x196/0x420 mm/slub.c:4746
     mgmt_pending_foreach+0xd1/0x130 net/bluetooth/mgmt_util.c:259
     __mgmt_power_off+0x183/0x430 net/bluetooth/mgmt.c:9550
     hci_dev_close_sync+0x6c4/0x11c0 net/bluetooth/hci_sync.c:5208
     hci_dev_do_close net/bluetooth/hci_core.c:483 [inline]
     hci_dev_close+0x112/0x210 net/bluetooth/hci_core.c:508
     sock_do_ioctl+0x158/0x460 net/socket.c:1209
     sock_ioctl+0x626/0x8e0 net/socket.c:1328
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:906 [inline]
     __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
     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+479aff51bb361ef5aa18@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=479aff51bb361ef5aa18
    Tested-by: syzbot+479aff51bb361ef5aa18@syzkaller.appspotmail.com
    Signed-off-by: Mazin Al Haddad <mazin@getstate.dev>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
btrfs: avoid monopolizing a core when activating a swap file [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Fri Feb 7 01:22:17 2025 +0900

    btrfs: avoid monopolizing a core when activating a swap file
    
    commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
    
    This commit re-attempts the backport of the change to the linux-6.12.y
    branch. Commit 9f372e86b9bd ("btrfs: avoid monopolizing a core when
    activating a swap file") on this branch was reverted.
    
    During swap activation we iterate over the extents of a file and we can
    have many thousands of them, so we can end up in a busy loop monopolizing
    a core. Avoid this by doing a voluntary reschedule after processing each
    extent.
    
    CC: stable@vger.kernel.org # 5.4+
    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: Koichiro Den <koichiro.den@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: convert BUG_ON in btrfs_reloc_cow_block() to proper error handling [+ + +]
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Thu Oct 3 11:43:03 2024 -0400

    btrfs: convert BUG_ON in btrfs_reloc_cow_block() to proper error handling
    
    [ Upstream commit 6a4730b325aaa48f7a5d5ba97aff0a955e2d9cec ]
    
    This BUG_ON is meant to catch backref cache problems, but these can
    arise from either bugs in the backref cache or corruption in the extent
    tree.  Fix it to be a proper error.
    
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: do not output error message if a qgroup has been already cleaned up [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Mon Jan 20 09:40:43 2025 +1030

    btrfs: do not output error message if a qgroup has been already cleaned up
    
    [ Upstream commit c9c863793395cf0a66c2778a29d72c48c02fbb66 ]
    
    [BUG]
    There is a bug report that btrfs outputs the following error message:
    
      BTRFS info (device nvme0n1p2): qgroup scan completed (inconsistency flag cleared)
      BTRFS warning (device nvme0n1p2): failed to cleanup qgroup 0/1179: -2
    
    [CAUSE]
    The error itself is pretty harmless, and the end user should ignore it.
    
    When a subvolume is fully dropped, btrfs will call
    btrfs_qgroup_cleanup_dropped_subvolume() to delete the qgroup.
    
    However if a qgroup rescan happened before a subvolume fully dropped,
    qgroup for that subvolume will not be re-created, as rescan will only
    create new qgroup if there is a BTRFS_ROOT_REF_KEY found.
    
    But before we drop a subvolume, the subvolume is unlinked thus there is no
    BTRFS_ROOT_REF_KEY.
    
    In that case, btrfs_remove_qgroup() will fail with -ENOENT and trigger
    the above error message.
    
    [FIX]
    Just ignore -ENOENT error from btrfs_remove_qgroup() inside
    btrfs_qgroup_cleanup_dropped_subvolume().
    
    Reported-by: John Shand <jshand2013@gmail.com>
    Link: https://bugzilla.suse.com/show_bug.cgi?id=1236056
    Fixes: 839d6ea4f86d ("btrfs: automatically remove the subvolume qgroup")
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: fix assertion failure when splitting ordered extent after transaction abort [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Mon Jan 13 15:01:08 2025 +0000

    btrfs: fix assertion failure when splitting ordered extent after transaction abort
    
    [ Upstream commit 0d85f5c2dd91df6b5da454406756f463ba923b69 ]
    
    If while we are doing a direct IO write a transaction abort happens, we
    mark all existing ordered extents with the BTRFS_ORDERED_IOERR flag (done
    at btrfs_destroy_ordered_extents()), and then after that if we enter
    btrfs_split_ordered_extent() and the ordered extent has bytes left
    (meaning we have a bio that doesn't cover the whole ordered extent, see
    details at btrfs_extract_ordered_extent()), we will fail on the following
    assertion at btrfs_split_ordered_extent():
    
       ASSERT(!(flags & ~BTRFS_ORDERED_TYPE_FLAGS));
    
    because the BTRFS_ORDERED_IOERR flag is set and the definition of
    BTRFS_ORDERED_TYPE_FLAGS is just the union of all flags that identify the
    type of write (regular, nocow, prealloc, compressed, direct IO, encoded).
    
    Fix this by returning an error from btrfs_extract_ordered_extent() if we
    find the BTRFS_ORDERED_IOERR flag in the ordered extent. The error will
    be the error that resulted in the transaction abort or -EIO if no
    transaction abort happened.
    
    This was recently reported by syzbot with the following trace:
    
       FAULT_INJECTION: forcing a failure.
       name failslab, interval 1, probability 0, space 0, times 1
       CPU: 0 UID: 0 PID: 5321 Comm: syz.0.0 Not tainted 6.13.0-rc5-syzkaller #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
        fail_dump lib/fault-inject.c:53 [inline]
        should_fail_ex+0x3b0/0x4e0 lib/fault-inject.c:154
        should_failslab+0xac/0x100 mm/failslab.c:46
        slab_pre_alloc_hook mm/slub.c:4072 [inline]
        slab_alloc_node mm/slub.c:4148 [inline]
        __do_kmalloc_node mm/slub.c:4297 [inline]
        __kmalloc_noprof+0xdd/0x4c0 mm/slub.c:4310
        kmalloc_noprof include/linux/slab.h:905 [inline]
        kzalloc_noprof include/linux/slab.h:1037 [inline]
        btrfs_chunk_alloc_add_chunk_item+0x244/0x1100 fs/btrfs/volumes.c:5742
        reserve_chunk_space+0x1ca/0x2c0 fs/btrfs/block-group.c:4292
        check_system_chunk fs/btrfs/block-group.c:4319 [inline]
        do_chunk_alloc fs/btrfs/block-group.c:3891 [inline]
        btrfs_chunk_alloc+0x77b/0xf80 fs/btrfs/block-group.c:4187
        find_free_extent_update_loop fs/btrfs/extent-tree.c:4166 [inline]
        find_free_extent+0x42d1/0x5810 fs/btrfs/extent-tree.c:4579
        btrfs_reserve_extent+0x422/0x810 fs/btrfs/extent-tree.c:4672
        btrfs_new_extent_direct fs/btrfs/direct-io.c:186 [inline]
        btrfs_get_blocks_direct_write+0x706/0xfa0 fs/btrfs/direct-io.c:321
        btrfs_dio_iomap_begin+0xbb7/0x1180 fs/btrfs/direct-io.c:525
        iomap_iter+0x697/0xf60 fs/iomap/iter.c:90
        __iomap_dio_rw+0xeb9/0x25b0 fs/iomap/direct-io.c:702
        btrfs_dio_write fs/btrfs/direct-io.c:775 [inline]
        btrfs_direct_write+0x610/0xa30 fs/btrfs/direct-io.c:880
        btrfs_do_write_iter+0x2a0/0x760 fs/btrfs/file.c:1397
        do_iter_readv_writev+0x600/0x880
        vfs_writev+0x376/0xba0 fs/read_write.c:1050
        do_pwritev fs/read_write.c:1146 [inline]
        __do_sys_pwritev2 fs/read_write.c:1204 [inline]
        __se_sys_pwritev2+0x196/0x2b0 fs/read_write.c:1195
        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:0x7f1281f85d29
       RSP: 002b:00007f12819fe038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
       RAX: ffffffffffffffda RBX: 00007f1282176080 RCX: 00007f1281f85d29
       RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000005
       RBP: 00007f12819fe090 R08: 0000000000000000 R09: 0000000000000003
       R10: 0000000000007000 R11: 0000000000000246 R12: 0000000000000002
       R13: 0000000000000000 R14: 00007f1282176080 R15: 00007ffcb9e23328
        </TASK>
       BTRFS error (device loop0 state A): Transaction aborted (error -12)
       BTRFS: error (device loop0 state A) in btrfs_chunk_alloc_add_chunk_item:5745: errno=-12 Out of memory
       BTRFS info (device loop0 state EA): forced readonly
       assertion failed: !(flags & ~BTRFS_ORDERED_TYPE_FLAGS), in fs/btrfs/ordered-data.c:1234
       ------------[ cut here ]------------
       kernel BUG at fs/btrfs/ordered-data.c:1234!
       Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
       CPU: 0 UID: 0 PID: 5321 Comm: syz.0.0 Not tainted 6.13.0-rc5-syzkaller #0
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
       RIP: 0010:btrfs_split_ordered_extent+0xd8d/0xe20 fs/btrfs/ordered-data.c:1234
       RSP: 0018:ffffc9000d1df2b8 EFLAGS: 00010246
       RAX: 0000000000000057 RBX: 000000000006a000 RCX: 9ce21886c4195300
       RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
       RBP: 0000000000000091 R08: ffffffff817f0a3c R09: 1ffff92001a3bdf4
       R10: dffffc0000000000 R11: fffff52001a3bdf5 R12: 1ffff1100a45f401
       R13: ffff8880522fa018 R14: dffffc0000000000 R15: 000000000006a000
       FS:  00007f12819fe6c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000557750bd7da8 CR3: 00000000400ea000 CR4: 0000000000352ef0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        <TASK>
        btrfs_extract_ordered_extent fs/btrfs/direct-io.c:702 [inline]
        btrfs_dio_submit_io+0x4be/0x6d0 fs/btrfs/direct-io.c:737
        iomap_dio_submit_bio fs/iomap/direct-io.c:85 [inline]
        iomap_dio_bio_iter+0x1022/0x1740 fs/iomap/direct-io.c:447
        __iomap_dio_rw+0x13b7/0x25b0 fs/iomap/direct-io.c:703
        btrfs_dio_write fs/btrfs/direct-io.c:775 [inline]
        btrfs_direct_write+0x610/0xa30 fs/btrfs/direct-io.c:880
        btrfs_do_write_iter+0x2a0/0x760 fs/btrfs/file.c:1397
        do_iter_readv_writev+0x600/0x880
        vfs_writev+0x376/0xba0 fs/read_write.c:1050
        do_pwritev fs/read_write.c:1146 [inline]
        __do_sys_pwritev2 fs/read_write.c:1204 [inline]
        __se_sys_pwritev2+0x196/0x2b0 fs/read_write.c:1195
        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:0x7f1281f85d29
       RSP: 002b:00007f12819fe038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
       RAX: ffffffffffffffda RBX: 00007f1282176080 RCX: 00007f1281f85d29
       RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000005
       RBP: 00007f12819fe090 R08: 0000000000000000 R09: 0000000000000003
       R10: 0000000000007000 R11: 0000000000000246 R12: 0000000000000002
       R13: 0000000000000000 R14: 00007f1282176080 R15: 00007ffcb9e23328
        </TASK>
       Modules linked in:
       ---[ end trace 0000000000000000 ]---
       RIP: 0010:btrfs_split_ordered_extent+0xd8d/0xe20 fs/btrfs/ordered-data.c:1234
       RSP: 0018:ffffc9000d1df2b8 EFLAGS: 00010246
       RAX: 0000000000000057 RBX: 000000000006a000 RCX: 9ce21886c4195300
       RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
       RBP: 0000000000000091 R08: ffffffff817f0a3c R09: 1ffff92001a3bdf4
       R10: dffffc0000000000 R11: fffff52001a3bdf5 R12: 1ffff1100a45f401
       R13: ffff8880522fa018 R14: dffffc0000000000 R15: 000000000006a000
       FS:  00007f12819fe6c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000557750bd7da8 CR3: 00000000400ea000 CR4: 0000000000352ef0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    
    In this case the transaction abort was due to (an injected) memory
    allocation failure when attempting to allocate a new chunk.
    
    Reported-by: syzbot+f60d8337a5c8e8d92a77@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/linux-btrfs/6777f2dd.050a0220.178762.0045.GAE@google.com/
    Fixes: 52b1fdca23ac ("btrfs: handle completed ordered extents in btrfs_split_ordered_extent")
    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: Sasha Levin <sashal@kernel.org>

btrfs: fix data race when accessing the inode's disk_i_size at btrfs_drop_extents() [+ + +]
Author: Hao-ran Zheng <zhenghaoran154@gmail.com>
Date:   Tue Dec 3 15:56:51 2024 +0800

    btrfs: fix data race when accessing the inode's disk_i_size at btrfs_drop_extents()
    
    [ Upstream commit 5324c4e10e9c2ce307a037e904c0d9671d7137d9 ]
    
    A data race occurs when the function `insert_ordered_extent_file_extent()`
    and the function `btrfs_inode_safe_disk_i_size_write()` are executed
    concurrently. The function `insert_ordered_extent_file_extent()` is not
    locked when reading inode->disk_i_size, causing
    `btrfs_inode_safe_disk_i_size_write()` to cause data competition when
    writing inode->disk_i_size, thus affecting the value of `modify_tree`.
    
    The specific call stack that appears during testing is as follows:
    
      ============DATA_RACE============
       btrfs_drop_extents+0x89a/0xa060 [btrfs]
       insert_reserved_file_extent+0xb54/0x2960 [btrfs]
       insert_ordered_extent_file_extent+0xff5/0x1760 [btrfs]
       btrfs_finish_one_ordered+0x1b85/0x36a0 [btrfs]
       btrfs_finish_ordered_io+0x37/0x60 [btrfs]
       finish_ordered_fn+0x3e/0x50 [btrfs]
       btrfs_work_helper+0x9c9/0x27a0 [btrfs]
       process_scheduled_works+0x716/0xf10
       worker_thread+0xb6a/0x1190
       kthread+0x292/0x330
       ret_from_fork+0x4d/0x80
       ret_from_fork_asm+0x1a/0x30
      ============OTHER_INFO============
       btrfs_inode_safe_disk_i_size_write+0x4ec/0x600 [btrfs]
       btrfs_finish_one_ordered+0x24c7/0x36a0 [btrfs]
       btrfs_finish_ordered_io+0x37/0x60 [btrfs]
       finish_ordered_fn+0x3e/0x50 [btrfs]
       btrfs_work_helper+0x9c9/0x27a0 [btrfs]
       process_scheduled_works+0x716/0xf10
       worker_thread+0xb6a/0x1190
       kthread+0x292/0x330
       ret_from_fork+0x4d/0x80
       ret_from_fork_asm+0x1a/0x30
      =================================
    
    The main purpose of the check of the inode's disk_i_size is to avoid
    taking write locks on a btree path when we have a write at or beyond
    EOF, since in these cases we don't expect to find extent items in the
    root to drop. However if we end up taking write locks due to a data
    race on disk_i_size, everything is still correct, we only add extra
    lock contention on the tree in case there's concurrency from other tasks.
    If the race causes us to not take write locks when we actually need them,
    then everything is functionally correct as well, since if we find out we
    have extent items to drop and we took read locks (modify_tree set to 0),
    we release the path and retry again with write locks.
    
    Since this data race does not affect the correctness of the function,
    it is a harmless data race, use data_race() to check inode->disk_i_size.
    
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Hao-ran Zheng <zhenghaoran154@gmail.com>
    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: Sasha Levin <sashal@kernel.org>

btrfs: fix use-after-free when attempting to join an aborted transaction [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Mon Jan 20 17:26:10 2025 +0000

    btrfs: fix use-after-free when attempting to join an aborted transaction
    
    [ Upstream commit e2f0943cf37305dbdeaf9846e3c941451bcdef63 ]
    
    When we are trying to join the current transaction and if it's aborted,
    we read its 'aborted' field after unlocking fs_info->trans_lock and
    without holding any extra reference count on it. This means that a
    concurrent task that is aborting the transaction may free the transaction
    before we read its 'aborted' field, leading to a use-after-free.
    
    Fix this by reading the 'aborted' field while holding fs_info->trans_lock
    since any freeing task must first acquire that lock and set
    fs_info->running_transaction to NULL before freeing the transaction.
    
    This was reported by syzbot and Dmitry with the following stack traces
    from KASAN:
    
       ==================================================================
       BUG: KASAN: slab-use-after-free in join_transaction+0xd9b/0xda0 fs/btrfs/transaction.c:278
       Read of size 4 at addr ffff888011839024 by task kworker/u4:9/1128
    
       CPU: 0 UID: 0 PID: 1128 Comm: kworker/u4:9 Not tainted 6.13.0-rc7-syzkaller-00019-gc45323b7560e #0
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
       Workqueue: events_unbound btrfs_async_reclaim_data_space
       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:378 [inline]
        print_report+0x169/0x550 mm/kasan/report.c:489
        kasan_report+0x143/0x180 mm/kasan/report.c:602
        join_transaction+0xd9b/0xda0 fs/btrfs/transaction.c:278
        start_transaction+0xaf8/0x1670 fs/btrfs/transaction.c:697
        flush_space+0x448/0xcf0 fs/btrfs/space-info.c:803
        btrfs_async_reclaim_data_space+0x159/0x510 fs/btrfs/space-info.c:1321
        process_one_work kernel/workqueue.c:3236 [inline]
        process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3317
        worker_thread+0x870/0xd30 kernel/workqueue.c:3398
        kthread+0x2f0/0x390 kernel/kthread.c:389
        ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
        ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
        </TASK>
    
       Allocated by task 5315:
        kasan_save_stack mm/kasan/common.c:47 [inline]
        kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
        poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
        __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
        kasan_kmalloc include/linux/kasan.h:260 [inline]
        __kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4329
        kmalloc_noprof include/linux/slab.h:901 [inline]
        join_transaction+0x144/0xda0 fs/btrfs/transaction.c:308
        start_transaction+0xaf8/0x1670 fs/btrfs/transaction.c:697
        btrfs_create_common+0x1b2/0x2e0 fs/btrfs/inode.c:6572
        lookup_open fs/namei.c:3649 [inline]
        open_last_lookups fs/namei.c:3748 [inline]
        path_openat+0x1c03/0x3590 fs/namei.c:3984
        do_filp_open+0x27f/0x4e0 fs/namei.c:4014
        do_sys_openat2+0x13e/0x1d0 fs/open.c:1402
        do_sys_open fs/open.c:1417 [inline]
        __do_sys_creat fs/open.c:1495 [inline]
        __se_sys_creat fs/open.c:1489 [inline]
        __x64_sys_creat+0x123/0x170 fs/open.c:1489
        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
    
       Freed by task 5336:
        kasan_save_stack mm/kasan/common.c:47 [inline]
        kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
        kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
        poison_slab_object mm/kasan/common.c:247 [inline]
        __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
        kasan_slab_free include/linux/kasan.h:233 [inline]
        slab_free_hook mm/slub.c:2353 [inline]
        slab_free mm/slub.c:4613 [inline]
        kfree+0x196/0x430 mm/slub.c:4761
        cleanup_transaction fs/btrfs/transaction.c:2063 [inline]
        btrfs_commit_transaction+0x2c97/0x3720 fs/btrfs/transaction.c:2598
        insert_balance_item+0x1284/0x20b0 fs/btrfs/volumes.c:3757
        btrfs_balance+0x992/0x10c0 fs/btrfs/volumes.c:4633
        btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3670
        vfs_ioctl fs/ioctl.c:51 [inline]
        __do_sys_ioctl fs/ioctl.c:906 [inline]
        __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
        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
    
       The buggy address belongs to the object at ffff888011839000
        which belongs to the cache kmalloc-2k of size 2048
       The buggy address is located 36 bytes inside of
        freed 2048-byte region [ffff888011839000, ffff888011839800)
    
       The buggy address belongs to the physical page:
       page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11838
       head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
       flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
       page_type: f5(slab)
       raw: 00fff00000000040 ffff88801ac42000 ffffea0000493400 dead000000000002
       raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000
       head: 00fff00000000040 ffff88801ac42000 ffffea0000493400 dead000000000002
       head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000
       head: 00fff00000000003 ffffea0000460e01 ffffffffffffffff 0000000000000000
       head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
       page dumped because: kasan: bad access detected
       page_owner tracks the page as allocated
       page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 57, tgid 57 (kworker/0:2), ts 67248182943, free_ts 67229742023
        set_page_owner include/linux/page_owner.h:32 [inline]
        post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558
        prep_new_page mm/page_alloc.c:1566 [inline]
        get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3476
        __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753
        alloc_pages_mpol_noprof+0x3e1/0x780 mm/mempolicy.c:2269
        alloc_slab_page+0x6a/0x110 mm/slub.c:2423
        allocate_slab+0x5a/0x2b0 mm/slub.c:2589
        new_slab mm/slub.c:2642 [inline]
        ___slab_alloc+0xc27/0x14a0 mm/slub.c:3830
        __slab_alloc+0x58/0xa0 mm/slub.c:3920
        __slab_alloc_node mm/slub.c:3995 [inline]
        slab_alloc_node mm/slub.c:4156 [inline]
        __do_kmalloc_node mm/slub.c:4297 [inline]
        __kmalloc_node_track_caller_noprof+0x2e9/0x4c0 mm/slub.c:4317
        kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:609
        __alloc_skb+0x1f3/0x440 net/core/skbuff.c:678
        alloc_skb include/linux/skbuff.h:1323 [inline]
        alloc_skb_with_frags+0xc3/0x820 net/core/skbuff.c:6612
        sock_alloc_send_pskb+0x91a/0xa60 net/core/sock.c:2884
        sock_alloc_send_skb include/net/sock.h:1803 [inline]
        mld_newpack+0x1c3/0xaf0 net/ipv6/mcast.c:1747
        add_grhead net/ipv6/mcast.c:1850 [inline]
        add_grec+0x1492/0x19a0 net/ipv6/mcast.c:1988
        mld_send_cr net/ipv6/mcast.c:2114 [inline]
        mld_ifc_work+0x691/0xd90 net/ipv6/mcast.c:2651
       page last free pid 5300 tgid 5300 stack trace:
        reset_page_owner include/linux/page_owner.h:25 [inline]
        free_pages_prepare mm/page_alloc.c:1127 [inline]
        free_unref_page+0xd3f/0x1010 mm/page_alloc.c:2659
        __slab_free+0x2c2/0x380 mm/slub.c:4524
        qlink_free mm/kasan/quarantine.c:163 [inline]
        qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
        kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
        __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
        kasan_slab_alloc include/linux/kasan.h:250 [inline]
        slab_post_alloc_hook mm/slub.c:4119 [inline]
        slab_alloc_node mm/slub.c:4168 [inline]
        __do_kmalloc_node mm/slub.c:4297 [inline]
        __kmalloc_noprof+0x236/0x4c0 mm/slub.c:4310
        kmalloc_noprof include/linux/slab.h:905 [inline]
        kzalloc_noprof include/linux/slab.h:1037 [inline]
        fib_create_info+0xc14/0x25b0 net/ipv4/fib_semantics.c:1435
        fib_table_insert+0x1f6/0x1f20 net/ipv4/fib_trie.c:1231
        fib_magic+0x3d8/0x620 net/ipv4/fib_frontend.c:1112
        fib_add_ifaddr+0x40c/0x5e0 net/ipv4/fib_frontend.c:1156
        fib_netdev_event+0x375/0x490 net/ipv4/fib_frontend.c:1494
        notifier_call_chain+0x1a5/0x3f0 kernel/notifier.c:85
        __dev_notify_flags+0x207/0x400
        dev_change_flags+0xf0/0x1a0 net/core/dev.c:9045
        do_setlink+0xc90/0x4210 net/core/rtnetlink.c:3109
        rtnl_changelink net/core/rtnetlink.c:3723 [inline]
        __rtnl_newlink net/core/rtnetlink.c:3875 [inline]
        rtnl_newlink+0x1bb6/0x2210 net/core/rtnetlink.c:4012
    
       Memory state around the buggy address:
        ffff888011838f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
        ffff888011838f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       >ffff888011839000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                      ^
        ffff888011839080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        ffff888011839100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ==================================================================
    
    Reported-by: syzbot+45212e9d87a98c3f5b42@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/linux-btrfs/678e7da5.050a0220.303755.007c.GAE@google.com/
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Link: https://lore.kernel.org/linux-btrfs/CACT4Y+ZFBdo7pT8L2AzM=vegZwjp-wNkVJZQf0Ta3vZqtExaSw@mail.gmail.com/
    Fixes: 871383be592b ("btrfs: add missing unlocks to transaction abort paths")
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    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: Sasha Levin <sashal@kernel.org>

 
ceph: fix memory leak in ceph_mds_auth_match() [+ + +]
Author: Antoine Viallon <antoine@lesviallon.fr>
Date:   Tue Jan 14 23:45:14 2025 +0100

    ceph: fix memory leak in ceph_mds_auth_match()
    
    commit 3b7d93db450e9d8ead80d75e2a303248f1528c35 upstream.
    
    We now free the temporary target path substring allocation on every
    possible branch, instead of omitting the default branch.  In some
    cases, a memory leak occured, which could rapidly crash the system
    (depending on how many file accesses were attempted).
    
    This was detected in production because it caused a continuous memory
    growth, eventually triggering kernel OOM and completely hard-locking
    the kernel.
    
    Relevant kmemleak stacktrace:
    
        unreferenced object 0xffff888131e69900 (size 128):
          comm "git", pid 66104, jiffies 4295435999
          hex dump (first 32 bytes):
            76 6f 6c 75 6d 65 73 2f 63 6f 6e 74 61 69 6e 65  volumes/containe
            72 73 2f 67 69 74 65 61 2f 67 69 74 65 61 2f 67  rs/gitea/gitea/g
          backtrace (crc 2f3bb450):
            [<ffffffffaa68fb49>] __kmalloc_noprof+0x359/0x510
            [<ffffffffc32bf1df>] ceph_mds_check_access+0x5bf/0x14e0 [ceph]
            [<ffffffffc3235722>] ceph_open+0x312/0xd80 [ceph]
            [<ffffffffaa7dd786>] do_dentry_open+0x456/0x1120
            [<ffffffffaa7e3729>] vfs_open+0x79/0x360
            [<ffffffffaa832875>] path_openat+0x1de5/0x4390
            [<ffffffffaa834fcc>] do_filp_open+0x19c/0x3c0
            [<ffffffffaa7e44a1>] do_sys_openat2+0x141/0x180
            [<ffffffffaa7e4945>] __x64_sys_open+0xe5/0x1a0
            [<ffffffffac2cc2f7>] do_syscall_64+0xb7/0x210
            [<ffffffffac400130>] entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    It can be triggered by mouting a subdirectory of a CephFS filesystem,
    and then trying to access files on this subdirectory with an auth token
    using a path-scoped capability:
    
        $ ceph auth get client.services
        [client.services]
                key = REDACTED
                caps mds = "allow rw fsname=cephfs path=/volumes/"
                caps mon = "allow r fsname=cephfs"
                caps osd = "allow rw tag cephfs data=cephfs"
    
        $ cat /proc/self/mounts
        services@[REDACTED].cephfs=/volumes/containers /ceph/containers ceph rw,noatime,name=services,secret=<hidden>,ms_mode=prefer-crc,mount_timeout=300,acl,mon_addr=[REDACTED]:3300,recover_session=clean 0 0
    
        $ seq 1 1000000 | xargs -P32 --replace={} touch /ceph/containers/file-{} && \
        seq 1 1000000 | xargs -P32 --replace={} cat /ceph/containers/file-{}
    
    [ idryomov: combine if statements, rename rc to path_matched and make
                it a bool, formatting ]
    
    Cc: stable@vger.kernel.org
    Fixes: 596afb0b8933 ("ceph: add ceph_mds_check_access() helper")
    Signed-off-by: Antoine Viallon <antoine@lesviallon.fr>
    Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
    Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cifs: Remove intermediate object of failed create SFU call [+ + +]
Author: Pali Rohár <pali@kernel.org>
Date:   Wed Dec 25 14:00:39 2024 +0100

    cifs: Remove intermediate object of failed create SFU call
    
    commit 25f6184e24b3991eae977a29ecf27d537cc930b2 upstream.
    
    Check if the server honored ATTR_SYSTEM flag by CREATE_OPTION_SPECIAL
    option. If not then server does not support ATTR_SYSTEM and newly
    created file is not SFU compatible, which means that the call failed.
    
    If CREATE was successful but either setting ATTR_SYSTEM failed or
    writing type/data information failed then remove the intermediate
    object created by CREATE. Otherwise intermediate empty object stay
    on the server.
    
    This ensures that if the creating of SFU files with system attribute is
    unsupported by the server then no empty file stay on the server as a result
    of unsupported operation.
    
    This is for example case with Samba server and Linux tmpfs storage without
    enabled xattr support (where Samba stores ATTR_SYSTEM bit).
    
    Cc: stable@vger.kernel.org
    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>

 
clk: clk-loongson2: Fix the number count of clk provider [+ + +]
Author: Binbin Zhou <zhoubinbin@loongson.cn>
Date:   Tue Jan 14 21:00:29 2025 +0800

    clk: clk-loongson2: Fix the number count of clk provider
    
    commit 5fb33b6797633ce60908d13dc06c54a101621845 upstream.
    
    Since commit 02fb4f008433 ("clk: clk-loongson2: Fix potential buffer
    overflow in flexible-array member access"), the clk provider register is
    failed.
    
    The count of `clks_num` is shown below:
    
            for (p = data; p->name; p++)
                    clks_num++;
    
    In fact, `clks_num` represents the number of SoC clocks and should be
    expressed as the maximum value of the clock binding id in use (p->id + 1).
    
    Now we fix it to avoid the following error when trying to register a clk
    provider:
    
    [ 13.409595] of_clk_hw_onecell_get: invalid index 17
    
    Cc: stable@vger.kernel.org
    Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
    Fixes: 02fb4f008433 ("clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access")
    Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
    Link: https://lore.kernel.org/r/82e43d89a9a6791129cf8ea14f4eeb666cd87be4.1736856470.git.zhoubinbin@loongson.cn
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mediatek: mt2701-aud: fix conversion to mtk_clk_simple_probe [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:11 2024 +0000

    clk: mediatek: mt2701-aud: fix conversion to mtk_clk_simple_probe
    
    commit 5fba40be5fbad563914e3ce9d5129a6baaea1ff5 upstream.
    
    Some of the audio subsystem clocks defined in clk-mt2701.h aren't
    actually used by the driver. This broke conversion to
    mtk_clk_simple_probe which expects that the highest possible clk id is
    defined by the ARRAY_SIZE.
    
    Add additional dummy clocks to fill the gaps and remain compatible with
    the existing DT bindings.
    
    Fixes: 0f69a423c458 ("clk: mediatek: Switch to mtk_clk_simple_probe() where possible")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/a07584d803af57b9ce4b5df5e122c09bf5a56ac9.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mediatek: mt2701-bdp: add missing dummy clk [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:24 2024 +0000

    clk: mediatek: mt2701-bdp: add missing dummy clk
    
    commit fd291adc5e9a4ee6cd91e57f148f3b427f80647b upstream.
    
    Add dummy clk for index 0 which was missed during the conversion to
    mtk_clk_simple_probe().
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/b8526c882a50f2b158df0eccb4a165956fd8fa13.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mediatek: mt2701-img: add missing dummy clk [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:48 2024 +0000

    clk: mediatek: mt2701-img: add missing dummy clk
    
    commit 366640868ccb4a7991aebe8442b01340fab218e2 upstream.
    
    Add dummy clk for index 0 which was missed during the conversion to
    mtk_clk_simple_probe().
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/d677486a5c563fe5c47aa995841adc2aaa183b8a.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mediatek: mt2701-mm: add missing dummy clk [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:34 2024 +0000

    clk: mediatek: mt2701-mm: add missing dummy clk
    
    commit 67aea188f23a5dde51c31a720ccf66aed0ce4187 upstream.
    
    Add dummy clk which was missed during the conversion to
    mtk_clk_pdev_probe() and is required for the existing DT bindings to
    keep working.
    
    Fixes: 65c10c50c9c7 ("clk: mediatek: Migrate to mtk_clk_pdev_probe() for multimedia clocks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/9de23440fcba1ffef9e77d58c9f505105e57a250.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:13:49 2024 +0000

    clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe
    
    commit 7c8746126a4e256fcf1af9174ee7d92cc3f3bc31 upstream.
    
    Commit 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to
    simplify driver") broke DT bindings as the highest index was reduced by
    1 because the id count starts from 1 and not from 0.
    
    Fix this, like for other drivers which had the same issue, by adding a
    dummy clk at index 0.
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/b126a5577f3667ef19b1b5feea5e70174084fb03.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: mmp2: call pm_genpd_init() only after genpd.name is set [+ + +]
Author: Lubomir Rintel <lkundrak@v3.sk>
Date:   Tue Dec 31 20:03:35 2024 +0100

    clk: mmp2: call pm_genpd_init() only after genpd.name is set
    
    commit e24b15d4704dcb73920c3d18a6157abd18df08c1 upstream.
    
    Setting the genpd's struct device's name with dev_set_name() is
    happening within pm_genpd_init(). If it remains NULL, things can blow up
    later, such as when crafting the devfs hierarchy for the power domain:
    
      Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
      ...
      Call trace:
       strlen from start_creating+0x90/0x138
       start_creating from debugfs_create_dir+0x20/0x178
       debugfs_create_dir from genpd_debug_add.part.0+0x4c/0x144
       genpd_debug_add.part.0 from genpd_debug_init+0x74/0x90
       genpd_debug_init from do_one_initcall+0x5c/0x244
       do_one_initcall from kernel_init_freeable+0x19c/0x1f4
       kernel_init_freeable from kernel_init+0x1c/0x12c
       kernel_init from ret_from_fork+0x14/0x28
    
    Bisecting tracks this crash back to commit 899f44531fe6 ("pmdomain: core:
    Add GENPD_FLAG_DEV_NAME_FW flag"), which exchanges use of genpd->name
    with dev_name(&genpd->dev) in genpd_debug_add.part().
    
    Fixes: 899f44531fe6 ("pmdomain: core: Add GENPD_FLAG_DEV_NAME_FW flag")
    Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
    Cc: stable@vger.kernel.org # v6.12+
    Link: https://lore.kernel.org/r/20241231190336.423172-1-lkundrak@v3.sk
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: clk-alpha-pll: fix alpha mode configuration [+ + +]
Author: Gabor Juhos <j4g8y7@gmail.com>
Date:   Mon Oct 21 19:32:48 2024 +0200

    clk: qcom: clk-alpha-pll: fix alpha mode configuration
    
    commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
    
    Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration")
    added support for configuring alpha mode, but it seems that the feature
    was never working in practice.
    
    The value of the alpha_{en,mode}_mask members of the configuration gets
    added to the value parameter passed to the regmap_update_bits() function,
    however the same values are not getting applied to the bitmask. As the
    result, the respective bits in the USER_CTL register are never modifed
    which leads to improper configuration of several PLLs.
    
    The following table shows the PLL configurations where the 'alpha_en_mask'
    member is set and which are passed as a parameter for the
    clk_alpha_pll_configure() function. In the table the 'expected rate' column
    shows the rate the PLL should run at with the given configuration, and
    the 'real rate' column shows the rate the PLL runs at actually. The real
    rates has been verified on hardwareOn IPQ* platforms, on other platforms,
    those are computed values only.
    
          file                 pll         expected rate   real rate
      dispcc-qcm2290.c     disp_cc_pll0      768.0 MHz     768.0 MHz
      dispcc-sm6115.c      disp_cc_pll0      768.0 MHz     768.0 MHz
      gcc-ipq5018.c        ubi32_pll        1000.0 MHz !=  984.0 MHz
      gcc-ipq6018.c        nss_crypto_pll   1200.0 MHz    1200.0 MHz
      gcc-ipq6018.c        ubi32_pll        1497.6 MHz != 1488.0 MHz
      gcc-ipq8074.c        nss_crypto_pll   1200.0 MHz != 1190.4 MHz
      gcc-qcm2290.c        gpll11            532.0 MHz !=  518.4 MHz
      gcc-qcm2290.c        gpll8             533.2 MHz !=  518.4 MHz
      gcc-qcs404.c         gpll3             921.6 MHz     921.6 MHz
      gcc-sm6115.c         gpll11            600.0 MHz !=  595.2 MHz
      gcc-sm6115.c         gpll8             800.0 MHz !=  787.2 MHz
      gpucc-sdm660.c       gpu_cc_pll0       800.0 MHz !=  787.2 MHz
      gpucc-sdm660.c       gpu_cc_pll1       740.0 MHz !=  729.6 MHz
      gpucc-sm6115.c       gpu_cc_pll0      1200.0 MHz != 1190.4 MHz
      gpucc-sm6115.c       gpu_cc_pll1       640.0 MHz !=  633.6 MHz
      gpucc-sm6125.c       gpu_pll0         1020.0 MHz != 1017.6 MHz
      gpucc-sm6125.c       gpu_pll1          930.0 MHz !=  921.6 MHz
      mmcc-sdm660.c        mmpll8            930.0 MHz !=  921.6 MHz
      mmcc-sdm660.c        mmpll5            825.0 MHz !=  806.4 MHz
    
    As it can be seen from the above, there are several PLLs which are
    configured incorrectly.
    
    Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask'
    values to the bitmask in order to configure the alpha mode correctly.
    
    Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed
    in the table above. Since the 'alpha_mode_mask' is not used by any driver
    currently, that part of the change causes no functional changes.
    
    Cc: stable@vger.kernel.org
    Fixes: c45ae598fc16 ("clk: qcom: support for alpha mode configuration")
    Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Tested-by: Gabor Juhos <j4g8y7@gmail.com>
    Link: https://lore.kernel.org/r/20241021-fix-alpha-mode-config-v1-1-f32c254e02bc@gmail.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate [+ + +]
Author: Anastasia Belova <abelova@astralinux.ru>
Date:   Tue Dec 3 11:42:31 2024 +0300

    clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
    
    commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
    
    aggr_state and unit fields are u32. The result of their
    multiplication may not fit in this type.
    
    Add explicit casting to prevent overflow.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support")
    Cc: stable@vger.kernel.org # 5.4+
    Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
    Link: https://lore.kernel.org/r/20241203084231.6001-1-abelova@astralinux.ru
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: dispcc-sm6350: Add missing parent_map for a clock [+ + +]
Author: Luca Weiss <luca.weiss@fairphone.com>
Date:   Fri Dec 20 10:03:31 2024 +0100

    clk: qcom: dispcc-sm6350: Add missing parent_map for a clock
    
    commit d4cdb196f182d2fbe336c968228be00d8c3fed05 upstream.
    
    If a clk_rcg2 has a parent, it should also have parent_map defined,
    otherwise we'll get a NULL pointer dereference when calling clk_set_rate
    like the following:
    
      [    3.388105] Call trace:
      [    3.390664]  qcom_find_src_index+0x3c/0x70 (P)
      [    3.395301]  qcom_find_src_index+0x1c/0x70 (L)
      [    3.399934]  _freq_tbl_determine_rate+0x48/0x100
      [    3.404753]  clk_rcg2_determine_rate+0x1c/0x28
      [    3.409387]  clk_core_determine_round_nolock+0x58/0xe4
      [    3.421414]  clk_core_round_rate_nolock+0x48/0xfc
      [    3.432974]  clk_core_round_rate_nolock+0xd0/0xfc
      [    3.444483]  clk_core_set_rate_nolock+0x8c/0x300
      [    3.455886]  clk_set_rate+0x38/0x14c
    
    Add the parent_map property for the clock where it's missing and also
    un-inline the parent_data as well to keep the matching parent_map and
    parent_data together.
    
    Fixes: 837519775f1d ("clk: qcom: Add display clock controller driver for SM6350")
    Cc: stable@vger.kernel.org
    Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241220-sm6350-parent_map-v1-2-64f3d04cb2eb@fairphone.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: gcc-mdm9607: Fix cmd_rcgr offset for blsp1_uart6 rcg [+ + +]
Author: Satya Priya Kakitapalli <quic_skakitap@quicinc.com>
Date:   Fri Dec 20 15:20:48 2024 +0530

    clk: qcom: gcc-mdm9607: Fix cmd_rcgr offset for blsp1_uart6 rcg
    
    commit 88d9dca36aac9659446be1e569d8fbe3462b5741 upstream.
    
    Fix cmd_rcgr offset for blsp1_uart6_apps_clk_src on mdm9607 platform.
    
    Fixes: 48b7253264ea ("clk: qcom: Add MDM9607 GCC driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@quicinc.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241220095048.248425-1-quic_skakitap@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: gcc-sm6350: Add missing parent_map for two clocks [+ + +]
Author: Luca Weiss <luca.weiss@fairphone.com>
Date:   Fri Dec 20 10:03:30 2024 +0100

    clk: qcom: gcc-sm6350: Add missing parent_map for two clocks
    
    commit 96fe1a7ee477d701cfc98ab9d3c730c35d966861 upstream.
    
    If a clk_rcg2 has a parent, it should also have parent_map defined,
    otherwise we'll get a NULL pointer dereference when calling clk_set_rate
    like the following:
    
      [    3.388105] Call trace:
      [    3.390664]  qcom_find_src_index+0x3c/0x70 (P)
      [    3.395301]  qcom_find_src_index+0x1c/0x70 (L)
      [    3.399934]  _freq_tbl_determine_rate+0x48/0x100
      [    3.404753]  clk_rcg2_determine_rate+0x1c/0x28
      [    3.409387]  clk_core_determine_round_nolock+0x58/0xe4
      [    3.421414]  clk_core_round_rate_nolock+0x48/0xfc
      [    3.432974]  clk_core_round_rate_nolock+0xd0/0xfc
      [    3.444483]  clk_core_set_rate_nolock+0x8c/0x300
      [    3.455886]  clk_set_rate+0x38/0x14c
    
    Add the parent_map property for two clocks where it's missing and also
    un-inline the parent_data as well to keep the matching parent_map and
    parent_data together.
    
    Fixes: 131abae905df ("clk: qcom: Add SM6350 GCC driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20241220-sm6350-parent_map-v1-1-64f3d04cb2eb@fairphone.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: gcc-sm8550: Do not turn off PCIe GDSCs during gdsc_disable() [+ + +]
Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date:   Thu Dec 19 22:30:10 2024 +0530

    clk: qcom: gcc-sm8550: Do not turn off PCIe GDSCs during gdsc_disable()
    
    commit 967e011013eda287dbec9e8bd3a19ebe730b8a08 upstream.
    
    With PWRSTS_OFF_ON, PCIe GDSCs are turned off during gdsc_disable(). This
    can happen during scenarios such as system suspend and breaks the resume
    of PCIe controllers from suspend.
    
    So use PWRSTS_RET_ON to indicate the GDSC driver to not turn off the GDSCs
    during gdsc_disable() and allow the hardware to transition the GDSCs to
    retention when the parent domain enters low power state during system
    suspend.
    
    Cc: stable@vger.kernel.org # 6.2
    Fixes: 955f2ea3b9e9 ("clk: qcom: Add GCC driver for SM8550")
    Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on QRD8550
    Link: https://lore.kernel.org/r/20241219170011.70140-1-manivannan.sadhasivam@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: gcc-sm8650: Do not turn off PCIe GDSCs during gdsc_disable() [+ + +]
Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date:   Thu Dec 19 22:30:11 2024 +0530

    clk: qcom: gcc-sm8650: Do not turn off PCIe GDSCs during gdsc_disable()
    
    commit a57465766a91c6e173876f9cbb424340e214313f upstream.
    
    With PWRSTS_OFF_ON, PCIe GDSCs are turned off during gdsc_disable(). This
    can happen during scenarios such as system suspend and breaks the resume
    of PCIe controllers from suspend.
    
    So use PWRSTS_RET_ON to indicate the GDSC driver to not turn off the GDSCs
    during gdsc_disable() and allow the hardware to transition the GDSCs to
    retention when the parent domain enters low power state during system
    suspend.
    
    Cc: stable@vger.kernel.org # 6.8
    Fixes: c58225b7e3d7 ("clk: qcom: add the SM8650 Global Clock Controller driver, part 1")
    Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on QRD8650
    Link: https://lore.kernel.org/r/20241219170011.70140-2-manivannan.sadhasivam@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

clk: qcom: Make GCC_8150 depend on QCOM_GDSC [+ + +]
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Date:   Sat Oct 26 12:58:13 2024 +0200

    clk: qcom: Make GCC_8150 depend on QCOM_GDSC
    
    [ Upstream commit 1474149c4209943b37a2c01b82f07ba39465e5fe ]
    
    Like all other non-ancient Qualcomm clock drivers, QCOM_GDSC is
    required, as the GCC driver defines and instantiates a bunch of GDSCs.
    
    Add the missing dependency.
    
    Reported-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
    Closes: https://lore.kernel.org/linux-arm-msm/ab85f2ae-6c97-4fbb-a15b-31cc9e1f77fc@linaro.org/
    Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
    Link: https://lore.kernel.org/r/20241026-topic-8150gcc_kconfig-v1-1-3772013d8804@oss.qualcomm.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: sunxi-ng: a100: enable MMC clock reparenting [+ + +]
Author: Cody Eksal <masterr3c0rd@epochal.quest>
Date:   Fri Nov 8 20:37:37 2024 -0400

    clk: sunxi-ng: a100: enable MMC clock reparenting
    
    commit 16414720045de30945b8d14b7907e0cbf81a4b49 upstream.
    
    While testing the MMC nodes proposed in [1], it was noted that mmc0/1
    would fail to initialize, with "mmc: fatal err update clk timeout" in
    the kernel logs. A closer look at the clock definitions showed that the MMC
    MPs had the "CLK_SET_RATE_NO_REPARENT" flag set. No reason was given for
    adding this flag in the first place, and its original purpose is unknown,
    but it doesn't seem to make sense and results in severe limitations to MMC
    speeds. Thus, remove this flag from the 3 MMC MPs.
    
    [1] https://msgid.link/20241024170540.2721307-10-masterr3c0rd@epochal.quest
    
    Fixes: fb038ce4db55 ("clk: sunxi-ng: add support for the Allwinner A100 CCU")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cody Eksal <masterr3c0rd@epochal.quest>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Link: https://patch.msgid.link/20241109003739.3440904-1-masterr3c0rd@epochal.quest
    Signed-off-by: Chen-Yu Tsai <wens@csie.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cpufreq: fix using cpufreq-dt as module [+ + +]
Author: Andreas Kemnade <andreas@kemnade.info>
Date:   Sun Nov 3 22:02:51 2024 +0100

    cpufreq: fix using cpufreq-dt as module
    
    commit f1f010c9d9c62c865d9f54e94075800ba764b4d9 upstream.
    
    This driver can be built as a module since commit 3b062a086984 ("cpufreq:
    dt-platdev: Support building as module"), but unfortunately this caused
    a regression because the cputfreq-dt-platdev.ko module does not autoload.
    
    Usually, this is solved by just using the MODULE_DEVICE_TABLE() macro to
    export all the device IDs as module aliases. But this driver is special
    due how matches with devices and decides what platform supports.
    
    There are two of_device_id lists, an allow list that are for CPU devices
    that always match and a deny list that's for devices that must not match.
    
    The driver registers a cpufreq-dt platform device for all the CPU device
    nodes that either are in the allow list or contain an operating-points-v2
    property and are not in the deny list.
    
    Enforce builtin compile of cpufreq-dt-platdev to make autoload work.
    
    Fixes: 3b062a086984 ("cpufreq: dt-platdev: Support building as module")
    Link: https://lore.kernel.org/all/20241104201424.2a42efdd@akair/
    Link: https://lore.kernel.org/all/20241119111918.1732531-1-javierm@redhat.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
    Reported-by: Radu Rendec <rrendec@redhat.com>
    Reported-by: Javier Martinez Canillas <javierm@redhat.com>
    [ Viresh: Picked commit log from Javier, updated tags ]
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: s3c64xx: Fix compilation warning [+ + +]
Author: Viresh Kumar <viresh.kumar@linaro.org>
Date:   Wed Jan 22 11:36:16 2025 +0530

    cpufreq: s3c64xx: Fix compilation warning
    
    commit 43855ac61483cb914f060851535ea753c094b3e0 upstream.
    
    The driver generates following warning when regulator support isn't
    enabled in the kernel. Fix it.
    
       drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target':
    >> drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable]
          55 |         unsigned int old_freq, new_freq;
             |                      ^~~~~~~~
    >> drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable]
          54 |         struct s3c64xx_dvfs *dvfs;
             |                              ^~~~
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501191803.CtfT7b2o-lkp@intel.com/
    Cc: 5.4+ <stable@vger.kernel.org> # v5.4+
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Link: https://patch.msgid.link/236b227e929e5adc04d1e9e7af6845a46c8e9432.1737525916.git.viresh.kumar@linaro.org
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
crypto: qce - fix goto jump in error path [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date:   Tue Dec 3 10:19:29 2024 +0100

    crypto: qce - fix goto jump in error path
    
    commit 5278275c1758a38199b43530adfc50098f4b41c7 upstream.
    
    If qce_check_version() fails, we should jump to err_dma as we already
    called qce_dma_request() a couple lines before.
    
    Cc: stable@vger.kernel.org
    Fixes: ec8f5d8f6f76 ("crypto: qce - Qualcomm crypto engine driver")
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qce - fix priority to be less than ARMv8 CE [+ + +]
Author: Eric Biggers <ebiggers@google.com>
Date:   Tue Dec 3 10:05:53 2024 -0800

    crypto: qce - fix priority to be less than ARMv8 CE
    
    commit 49b9258b05b97c6464e1964b6a2fddb3ddb65d17 upstream.
    
    As QCE is an order of magnitude slower than the ARMv8 Crypto Extensions
    on the CPU, and is also less well tested, give it a lower priority.
    Previously the QCE SHA algorithms had higher priority than the ARMv8 CE
    equivalents, and the ciphers such as AES-XTS had the same priority which
    meant the QCE versions were chosen if they happened to be loaded later.
    
    Fixes: ec8f5d8f6f76 ("crypto: qce - Qualcomm crypto engine driver")
    Cc: stable@vger.kernel.org
    Cc: Bartosz Golaszewski <brgl@bgdev.pl>
    Cc: Neil Armstrong <neil.armstrong@linaro.org>
    Cc: Thara Gopinath <thara.gopinath@gmail.com>
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qce - unregister previously registered algos in error path [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date:   Tue Dec 3 10:19:30 2024 +0100

    crypto: qce - unregister previously registered algos in error path
    
    commit e80cf84b608725303113d6fe98bb727bf7b7a40d upstream.
    
    If we encounter an error when registering alorithms with the crypto
    framework, we just bail out and don't unregister the ones we
    successfully registered in prior iterations of the loop.
    
    Add code that goes back over the algos and unregisters them before
    returning an error from qce_register_algs().
    
    Cc: stable@vger.kernel.org
    Fixes: ec8f5d8f6f76 ("crypto: qce - Qualcomm crypto engine driver")
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-crypt: don't update io->sector after kcryptd_crypt_write_io_submit() [+ + +]
Author: Hou Tao <houtao1@huawei.com>
Date:   Mon Jan 20 16:29:49 2025 +0800

    dm-crypt: don't update io->sector after kcryptd_crypt_write_io_submit()
    
    commit 9fdbbdbbc92b1474a87b89f8b964892a63734492 upstream.
    
    The updates of io->sector are the leftovers when dm-crypt allocated
    pages for partial write request. However, since commit cf2f1abfbd0db
    ("dm crypt: don't allocate pages for a partial request"), there is no
    partial request anymore.
    
    After the introduction of write request rb-tree, the updates of
    io->sectors may interfere the insertion procedure, because ->sectors of
    these write requests which have already been added in the rb-tree may be
    changed during the insertion of new write request.
    
    Fix it by removing these buggy updates of io->sectors. Considering these
    updates only effect the write request rb-tree, the commit which
    introduces the write request rb-tree is used as the fix tag.
    
    Fixes: b3c5fd305249 ("dm crypt: sort writes")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hou Tao <houtao1@huawei.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dm-crypt: track tag_offset in convert_context [+ + +]
Author: Hou Tao <houtao1@huawei.com>
Date:   Mon Jan 20 16:29:51 2025 +0800

    dm-crypt: track tag_offset in convert_context
    
    commit 8b8f8037765757861f899ed3a2bfb34525b5c065 upstream.
    
    dm-crypt uses tag_offset to index the integrity metadata for each crypt
    sector. When the initial crypt_convert() returns BLK_STS_DEV_RESOURCE,
    dm-crypt will try to continue the crypt/decrypt procedure in a kworker.
    However, it resets tag_offset as zero instead of using the tag_offset
    related with current sector. It may return unexpected data when using
    random IV or return unexpected integrity related error.
    
    Fix the problem by tracking tag_offset in per-IO convert_context.
    Therefore, when the crypt/decrypt procedure continues in a kworker, it
    could use the next tag_offset saved in convert_context.
    
    Fixes: 8abec36d1274 ("dm crypt: do not wait for backlogged crypto request completion in softirq")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hou Tao <houtao1@huawei.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/amdgpu: change the config of cgcg on gfx12 [+ + +]
Author: Kenneth Feng <kenneth.feng@amd.com>
Date:   Mon Jan 20 15:33:03 2025 +0800

    drm/amd/amdgpu: change the config of cgcg on gfx12
    
    commit 5cda56bd86c455341087dca29c65dc7c87f84340 upstream.
    
    change the config of cgcg on gfx12
    
    Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
    Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org # 6.12.x
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor [+ + +]
Author: Fangzhi Zuo <Jerry.Zuo@amd.com>
Date:   Mon Dec 2 13:30:37 2024 -0500

    drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor
    
    [ Upstream commit e56ad45e991128bf4db160b75a1d9f647a341d8f ]
    
    Source --> DP2.1 MST hub --> DP1.4/2.1 monitor
    
    When change from DP1.4 to DP2.1 from monitor manual, modes higher than
    4k120 are all cutoff by mode validation. Switch back to DP1.4 gets all
    the modes up to 4k240 available to be enabled by dsc passthrough.
    
    [why]
    Compared to DP1.4 link from hub to monitor, DP2.1 link has larger
    full_pbn value that causes overflow in the process of doing conversion
    from pbn to kbps.
    
    [how]
    Change the data type accordingly to fit into the data limit during
    conversion calculation.
    
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Reviewed-by: Wayne Lin <wayne.lin@amd.com>
    Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
    Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Fix seamless boot sequence [+ + +]
Author: Lo-an Chen <lo-an.chen@amd.com>
Date:   Fri Jan 17 17:56:25 2025 +0800

    drm/amd/display: Fix seamless boot sequence
    
    commit e01f07cb92513ca4b9b219ab9caa34d607bc1e2d upstream.
    
    [WHY]
    When the system powers up eDP with external monitors in seamless boot
    sequence, stutter get enabled before TTU and HUBP registers being
    programmed, which resulting in underflow.
    
    [HOW]
    Enable TTU in hubp_init.
    Change the sequence that do not perpare_bandwidth and optimize_bandwidth
    while having seamless boot streams.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: Lo-an Chen <lo-an.chen@amd.com>
    Signed-off-by: Paul Hsieh <paul.hsieh@amd.com>
    Signed-off-by: Alex Hung <alex.hung@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Thu Dec 19 16:46:35 2024 -0700

    drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang
    
    [ Upstream commit e4479aecf6581af81bc0908575447878d2a07e01 ]
    
    Commit 24909d9ec7c3 ("drm/amd/display: Overwriting dualDPP UBF values
    before usage") added a new warning in dml2/display_mode_core.c when
    building allmodconfig with clang:
    
      drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6268:13: error: stack frame size (3128) exceeds limit (3072) in 'dml_prefetch_check' [-Werror,-Wframe-larger-than]
       6268 | static void dml_prefetch_check(struct display_mode_lib_st *mode_lib)
            |             ^
    
    Commit be4e3509314a ("drm/amd/display: DML21 Reintegration For Various
    Fixes") introduced one in dml2_core/dml2_core_dcn4_calcs.c with the same
    configuration:
    
      drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7236:13: error: stack frame size (3256) exceeds limit (3072) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
       7236 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
            |             ^
    
    In the case of the first warning, the stack usage was already at the
    limit at the parent change, so the offending change was rather
    innocuous. In the case of the second warning, there was a rather
    dramatic increase in stack usage compared to the parent:
    
      drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7032:13: error: stack frame size (2696) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
       7032 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
            |             ^
    
    This is an unfortunate interaction between an issue with stack slot
    reuse in LLVM that gets exacerbated by sanitization (which gets enabled
    with all{mod,yes}config) and function calls using a much higher number
    of parameters than is typical in the kernel, necessitating passing most
    of these values on the stack.
    
    While it is possible that there should be source code changes to address
    these warnings, this code is difficult to modify for various reasons, as
    has been noted in other changes that have occurred for similar reasons,
    such as commit 6740ec97bcdb ("drm/amd/display: Increase frame warning
    limit with KASAN or KCSAN in dml2").
    
    Increase the frame larger than limit when compile testing with clang and
    the sanitizers enabled to avoid this breakage in all{mod,yes}config, as
    they are commonly used and valuable testing targets. While it is not the
    best to hide this issue, it is not really relevant when compile testing,
    as the sanitizers are commonly stressful on optimizations and they are
    only truly useful at runtime, which COMPILE_TEST states will not occur
    with the current build.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202412121748.chuX4sap-lkp@intel.com/
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Limit Scaling Ratio on DCN3.01 [+ + +]
Author: Gabe Teeger <Gabe.Teeger@amd.com>
Date:   Fri Dec 13 15:15:00 2024 -0500

    drm/amd/display: Limit Scaling Ratio on DCN3.01
    
    [ Upstream commit abc0ad6d08440761b199988c329ad7ac83f41c9b ]
    
    [why]
    Underflow and flickering was occuring due to high scaling ratios
    when resizing videos.
    
    [how]
    Limit the scaling ratios by increasing the max scaling factor
    
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: Gabe Teeger <Gabe.Teeger@amd.com>
    Signed-off-by: Tom Chung <chiahsuan.chung@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: Optimize cursor position updates [+ + +]
Author: Aric Cyr <Aric.Cyr@amd.com>
Date:   Tue Dec 10 18:38:15 2024 -0500

    drm/amd/display: Optimize cursor position updates
    
    commit 024771f3fb75dc817e9429d5763f1a6eb84b6f21 upstream.
    
    [why]
    Updating the cursor enablement register can be a slow operation and accumulates
    when high polling rate cursors cause frequent updates asynchronously to the
    cursor position.
    
    [how]
    Since the cursor enable bit is cached there is no need to update the
    enablement register if there is no change to it.  This removes the
    read-modify-write from the cursor position programming path in HUBP and
    DPP, leaving only the register writes.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Sung Lee <sung.lee@amd.com>
    Signed-off-by: Aric Cyr <Aric.Cyr@amd.com>
    Signed-off-by: Wayne Lin <wayne.lin@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Overwriting dualDPP UBF values before usage [+ + +]
Author: Ausef Yousof <Ausef.Yousof@amd.com>
Date:   Tue Nov 26 15:26:01 2024 -0500

    drm/amd/display: Overwriting dualDPP UBF values before usage
    
    [ Upstream commit 24909d9ec7c3afa8da2f3c9afa312e7a4a61f250 ]
    
    [WHY]
    Right now in dml2 mode validation we are calculating UBF parameters for
    prefetch calculation for single and dual DPP scenarios. Data structure
    to store such values are just 1D arrays, the single DPP values are
    overwritten by the dualDPP values, and we end up using dualDPP for
    prefetch calculations twice (once in place of singleDPP support check
    and again for dual).
    
    This naturally leads to many problems, one of which validating a mode in
    "singleDPP" (when we used dual DPP parameters) and sending the singleDPP
    parameters to mode programming, if we cannot support then we observe the
    corruption as described in the ticket.
    
    [HOW]
    UBF values need to have 2d arrays to store values specific to single and
    dual DPP states to avoid single DPP values being overwritten. Other
    parameters are recorded on a per state basis such as prefetch UBF values
    but they are in the same loop used for calculation and at that point its
    fine to overwrite them, its not the case for plain UBF values.
    
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: Ausef Yousof <Ausef.Yousof@amd.com>
    Signed-off-by: Aurabindo Pillai <aurabindo.pillai@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: Populate chroma prefetch parameters, DET buffer fix [+ + +]
Author: Ausef Yousof <Ausef.Yousof@amd.com>
Date:   Wed Nov 20 12:38:11 2024 -0500

    drm/amd/display: Populate chroma prefetch parameters, DET buffer fix
    
    [ Upstream commit 70fec46519fca859aa209f5f02e7e0a0123aca4a ]
    
    [WHY]
    Soft hang/lag observed during 10bit playback + moving cursor, corruption
    observed in other tickets for same reason, also failing MPO.
    
    1. Currently, we are always running
       calculate_lowest_supported_state_for_temp_read which is only
       necessary on dGPU
    2. Fast validate path does not apply DET buffer allocation policy
    3. Prefetch UrgBFactor chroma parameter not populated in prefetch
       calculation
    
    [HOW]
    1. Add a check to see if we are on APU, if so, skip the code
    2. Add det buffer alloc policy checks to fast validate path
    3. Populate UrgentBurstChroma param in call to calculate
       UrgBChroma prefetch values
    
    -revision commits: small formatting/brackets/null check addition + remove test change + dGPU code
    
    Reviewed-by: Charlene Liu <charlene.liu@amd.com>
    Signed-off-by: Ausef Yousof <Ausef.Yousof@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@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: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:07 2024 +0200

    drm/amd/display: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit 819bee01eea06282d7bda17d46caf29cae4f6d84 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-4-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/pm: Mark MM activity as unsupported [+ + +]
Author: Lijo Lazar <lijo.lazar@amd.com>
Date:   Wed Jan 22 09:12:41 2025 +0530

    drm/amd/pm: Mark MM activity as unsupported
    
    commit 819bf6662b93a5a8b0c396d2c7e7fab6264c9808 upstream.
    
    Aldebaran doesn't support querying MM activity percentage. Keep the
    field as 0xFFs to mark it as unsupported.
    
    Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
    Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdgpu: add a BO metadata flag to disable write compression for Vulkan [+ + +]
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Fri Jan 24 09:43:45 2025 -0500

    drm/amdgpu: add a BO metadata flag to disable write compression for Vulkan
    
    commit 2255b40cacc2e5ef1b127770fc1808c60de4a2fc upstream.
    
    Vulkan can't support DCC and Z/S compression on GFX12 without
    WRITE_COMPRESS_DISABLE in this commit or a completely different DCC
    interface.
    
    AMDGPU_TILING_GFX12_SCANOUT is added because it's already used by userspace.
    
    Cc: stable@vger.kernel.org # 6.12.x
    Signed-off-by: Marek Olšák <marek.olsak@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: Don't enable sdma 4.4.5 CTXEMPTY interrupt [+ + +]
Author: Philip Yang <Philip.Yang@amd.com>
Date:   Tue Nov 26 15:45:32 2024 -0500

    drm/amdgpu: Don't enable sdma 4.4.5 CTXEMPTY interrupt
    
    [ Upstream commit b4b7271e5ca95b581f2fcc4ae852c4079215e92d ]
    
    The sdma context empty interrupt is dropped in amdgpu_irq_dispatch
    as unregistered interrupt src_id 243, this interrupt accounts to 1/3 of
    total interrupts and causes IH primary ring overflow when running
    stressful benchmark application. Disable this interrupt has no side
    effect found.
    
    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/amdgpu: Fix Circular Locking Dependency in AMDGPU GFX Isolation [+ + +]
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Date:   Thu Jan 9 21:33:51 2025 +0530

    drm/amdgpu: Fix Circular Locking Dependency in AMDGPU GFX Isolation
    
    [ Upstream commit 1e8c193f8ca7ab7dff4f4747b45a55dca23c00f4 ]
    
    This commit addresses a circular locking dependency issue within the GFX
    isolation mechanism. The problem was identified by a warning indicating
    a potential deadlock due to inconsistent lock acquisition order.
    
    - The `amdgpu_gfx_enforce_isolation_ring_begin_use` and
      `amdgpu_gfx_enforce_isolation_ring_end_use` functions previously
      acquired `enforce_isolation_mutex` and called `amdgpu_gfx_kfd_sch_ctrl`,
      leading to potential deadlocks. ie., If `amdgpu_gfx_kfd_sch_ctrl` is
      called while `enforce_isolation_mutex` is held, and
      `amdgpu_gfx_enforce_isolation_handler` is called while `kfd_sch_mutex` is
      held, it can create a circular dependency.
    
    By ensuring consistent lock usage, this fix resolves the issue:
    
    [  606.297333] ======================================================
    [  606.297343] WARNING: possible circular locking dependency detected
    [  606.297353] 6.10.0-amd-mlkd-610-311224-lof #19 Tainted: G           OE
    [  606.297365] ------------------------------------------------------
    [  606.297375] kworker/u96:3/3825 is trying to acquire lock:
    [  606.297385] ffff9aa64e431cb8 ((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work)){+.+.}-{0:0}, at: __flush_work+0x232/0x610
    [  606.297413]
                   but task is already holding lock:
    [  606.297423] ffff9aa64e432338 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}, at: amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
    [  606.297725]
                   which lock already depends on the new lock.
    
    [  606.297738]
                   the existing dependency chain (in reverse order) is:
    [  606.297749]
                   -> #2 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}:
    [  606.297765]        __mutex_lock+0x85/0x930
    [  606.297776]        mutex_lock_nested+0x1b/0x30
    [  606.297786]        amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
    [  606.298007]        amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
    [  606.298225]        amdgpu_ring_alloc+0x48/0x70 [amdgpu]
    [  606.298412]        amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
    [  606.298603]        amdgpu_job_run+0xac/0x1e0 [amdgpu]
    [  606.298866]        drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
    [  606.298880]        process_one_work+0x21e/0x680
    [  606.298890]        worker_thread+0x190/0x350
    [  606.298899]        kthread+0xe7/0x120
    [  606.298908]        ret_from_fork+0x3c/0x60
    [  606.298919]        ret_from_fork_asm+0x1a/0x30
    [  606.298929]
                   -> #1 (&adev->enforce_isolation_mutex){+.+.}-{3:3}:
    [  606.298947]        __mutex_lock+0x85/0x930
    [  606.298956]        mutex_lock_nested+0x1b/0x30
    [  606.298966]        amdgpu_gfx_enforce_isolation_handler+0x87/0x370 [amdgpu]
    [  606.299190]        process_one_work+0x21e/0x680
    [  606.299199]        worker_thread+0x190/0x350
    [  606.299208]        kthread+0xe7/0x120
    [  606.299217]        ret_from_fork+0x3c/0x60
    [  606.299227]        ret_from_fork_asm+0x1a/0x30
    [  606.299236]
                   -> #0 ((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work)){+.+.}-{0:0}:
    [  606.299257]        __lock_acquire+0x16f9/0x2810
    [  606.299267]        lock_acquire+0xd1/0x300
    [  606.299276]        __flush_work+0x250/0x610
    [  606.299286]        cancel_delayed_work_sync+0x71/0x80
    [  606.299296]        amdgpu_gfx_kfd_sch_ctrl+0x287/0x4d0 [amdgpu]
    [  606.299509]        amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
    [  606.299723]        amdgpu_ring_alloc+0x48/0x70 [amdgpu]
    [  606.299909]        amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
    [  606.300101]        amdgpu_job_run+0xac/0x1e0 [amdgpu]
    [  606.300355]        drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
    [  606.300369]        process_one_work+0x21e/0x680
    [  606.300378]        worker_thread+0x190/0x350
    [  606.300387]        kthread+0xe7/0x120
    [  606.300396]        ret_from_fork+0x3c/0x60
    [  606.300406]        ret_from_fork_asm+0x1a/0x30
    [  606.300416]
                   other info that might help us debug this:
    
    [  606.300428] Chain exists of:
                     (work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work) --> &adev->enforce_isolation_mutex --> &adev->gfx.kfd_sch_mutex
    
    [  606.300458]  Possible unsafe locking scenario:
    
    [  606.300468]        CPU0                    CPU1
    [  606.300476]        ----                    ----
    [  606.300484]   lock(&adev->gfx.kfd_sch_mutex);
    [  606.300494]                                lock(&adev->enforce_isolation_mutex);
    [  606.300508]                                lock(&adev->gfx.kfd_sch_mutex);
    [  606.300521]   lock((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work));
    [  606.300536]
                    *** DEADLOCK ***
    
    [  606.300546] 5 locks held by kworker/u96:3/3825:
    [  606.300555]  #0: ffff9aa5aa1f5d58 ((wq_completion)comp_1.1.0){+.+.}-{0:0}, at: process_one_work+0x3f5/0x680
    [  606.300577]  #1: ffffaa53c3c97e40 ((work_completion)(&sched->work_run_job)){+.+.}-{0:0}, at: process_one_work+0x1d6/0x680
    [  606.300600]  #2: ffff9aa64e463c98 (&adev->enforce_isolation_mutex){+.+.}-{3:3}, at: amdgpu_gfx_enforce_isolation_ring_begin_use+0x1c3/0x5d0 [amdgpu]
    [  606.300837]  #3: ffff9aa64e432338 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}, at: amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
    [  606.301062]  #4: ffffffff8c1a5660 (rcu_read_lock){....}-{1:2}, at: __flush_work+0x70/0x610
    [  606.301083]
                   stack backtrace:
    [  606.301092] CPU: 14 PID: 3825 Comm: kworker/u96:3 Tainted: G           OE      6.10.0-amd-mlkd-610-311224-lof #19
    [  606.301109] Hardware name: Gigabyte Technology Co., Ltd. X570S GAMING X/X570S GAMING X, BIOS F7 03/22/2024
    [  606.301124] Workqueue: comp_1.1.0 drm_sched_run_job_work [gpu_sched]
    [  606.301140] Call Trace:
    [  606.301146]  <TASK>
    [  606.301154]  dump_stack_lvl+0x9b/0xf0
    [  606.301166]  dump_stack+0x10/0x20
    [  606.301175]  print_circular_bug+0x26c/0x340
    [  606.301187]  check_noncircular+0x157/0x170
    [  606.301197]  ? register_lock_class+0x48/0x490
    [  606.301213]  __lock_acquire+0x16f9/0x2810
    [  606.301230]  lock_acquire+0xd1/0x300
    [  606.301239]  ? __flush_work+0x232/0x610
    [  606.301250]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  606.301261]  ? mark_held_locks+0x54/0x90
    [  606.301274]  ? __flush_work+0x232/0x610
    [  606.301284]  __flush_work+0x250/0x610
    [  606.301293]  ? __flush_work+0x232/0x610
    [  606.301305]  ? __pfx_wq_barrier_func+0x10/0x10
    [  606.301318]  ? mark_held_locks+0x54/0x90
    [  606.301331]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  606.301345]  cancel_delayed_work_sync+0x71/0x80
    [  606.301356]  amdgpu_gfx_kfd_sch_ctrl+0x287/0x4d0 [amdgpu]
    [  606.301661]  amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
    [  606.302050]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  606.302069]  amdgpu_ring_alloc+0x48/0x70 [amdgpu]
    [  606.302452]  amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
    [  606.302862]  ? drm_sched_entity_error+0x82/0x190 [gpu_sched]
    [  606.302890]  amdgpu_job_run+0xac/0x1e0 [amdgpu]
    [  606.303366]  drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
    [  606.303388]  process_one_work+0x21e/0x680
    [  606.303409]  worker_thread+0x190/0x350
    [  606.303424]  ? __pfx_worker_thread+0x10/0x10
    [  606.303437]  kthread+0xe7/0x120
    [  606.303449]  ? __pfx_kthread+0x10/0x10
    [  606.303463]  ret_from_fork+0x3c/0x60
    [  606.303476]  ? __pfx_kthread+0x10/0x10
    [  606.303489]  ret_from_fork_asm+0x1a/0x30
    [  606.303512]  </TASK>
    
    v2: Refactor lock handling to resolve circular dependency (Alex)
    
    - Introduced a `sched_work` flag to defer the call to
      `amdgpu_gfx_kfd_sch_ctrl` until after releasing
      `enforce_isolation_mutex`.
    - This change ensures that `amdgpu_gfx_kfd_sch_ctrl` is called outside
      the critical section, preventing the circular dependency and deadlock.
    - The `sched_work` flag is set within the mutex-protected section if
      conditions are met, and the actual function call is made afterward.
    - This approach ensures consistent lock acquisition order.
    
    Fixes: afefd6f24502 ("drm/amdgpu: Implement Enforce Isolation Handler for KGD/KFD serialization")
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Suggested-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amdkfd: Block per-queue reset when halt_if_hws_hang=1 [+ + +]
Author: Jay Cornwall <jay.cornwall@amd.com>
Date:   Thu Jan 16 14:36:39 2025 -0600

    drm/amdkfd: Block per-queue reset when halt_if_hws_hang=1
    
    commit f214b7beb00621b983e67ce97477afc3ab4b38f4 upstream.
    
    The purpose of halt_if_hws_hang is to preserve GPU state for driver
    debugging when queue preemption fails. Issuing per-queue reset may
    kill wavefronts which caused the preemption failure.
    
    Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
    Reviewed-by: Jonathan Kim <Jonathan.Kim@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org # 6.12.x
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: only flush the validate MES contex [+ + +]
Author: Prike Liang <Prike.Liang@amd.com>
Date:   Tue Jan 14 11:20:17 2025 +0800

    drm/amdkfd: only flush the validate MES contex
    
    commit 9078a5bfa21e78ae68b6d7c365d1b92f26720c55 upstream.
    
    The following page fault was observed duringthe KFD process release.
    In this particular error case, the HIP test (./MemcpyPerformance -h)
    does not require the queue. As a result, the process_context_addr was
    not assigned when the KFD process was released, ultimately leading to
    this page fault during the execution of the function
    kfd_process_dequeue_from_all_devices().
    
    [345962.294891] amdgpu 0000:03:00.0: amdgpu: [gfxhub] page fault (src_id:0 ring:153 vmid:0 pasid:0)
    [345962.295333] amdgpu 0000:03:00.0: amdgpu:   in page starting at address 0x0000000000000000 from client 10
    [345962.295775] amdgpu 0000:03:00.0: amdgpu: GCVM_L2_PROTECTION_FAULT_STATUS:0x00000B33
    [345962.296097] amdgpu 0000:03:00.0: amdgpu:     Faulty UTCL2 client ID: CPC (0x5)
    [345962.296394] amdgpu 0000:03:00.0: amdgpu:     MORE_FAULTS: 0x1
    [345962.296633] amdgpu 0000:03:00.0: amdgpu:     WALKER_ERROR: 0x1
    [345962.296876] amdgpu 0000:03:00.0: amdgpu:     PERMISSION_FAULTS: 0x3
    [345962.297135] amdgpu 0000:03:00.0: amdgpu:     MAPPING_ERROR: 0x1
    [345962.297377] amdgpu 0000:03:00.0: amdgpu:     RW: 0x0
    [345962.297682] amdgpu 0000:03:00.0: amdgpu: [gfxhub] page fault (src_id:0 ring:169 vmid:0 pasid:0)
    
    Signed-off-by: Prike Liang <Prike.Liang@amd.com>
    Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: Queue interrupt work to different CPU [+ + +]
Author: Philip Yang <Philip.Yang@amd.com>
Date:   Tue Nov 26 11:33:15 2024 -0500

    drm/amdkfd: Queue interrupt work to different CPU
    
    [ Upstream commit 34db5a32617d102e8042151bb87590e43c97132e ]
    
    For CPX mode, each KFD node has interrupt worker to process ih_fifo to
    send events to user space. Currently all interrupt workers of same adev
    queue to same CPU, all workers execution are actually serialized and
    this cause KFD ih_fifo overflow when CPU usage is high.
    
    Use per-GPU unbounded highpri queue with number of workers equals to
    number of partitions, let queue_work select the next CPU round robin
    among the local CPUs of same NUMA.
    
    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: anx7625: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:05 2024 +0200

    drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit e72bf423a60afd744d13e40ab2194044a3af5217 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-2-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT [+ + +]
Author: Hermes Wu <hermes.wu@ite.com.tw>
Date:   Mon Dec 30 18:51:22 2024 +0800

    drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
    
    [ Upstream commit 85597bc0d70c287ba41f17d14d3d857a38a3d727 ]
    
    A HDCP source device shall support max downstream to 127 devices.
    Change definition MAX_HDCP_DOWN_STREAM_COUNT to 127
    
    KSVs shall save for DRM blocked devices check.
    This results in struct it6505 growth by ~0.5 KiB.
    
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-4-e0fdd4844703@ite.corp-partner.google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: it6505: fix HDCP Bstatus check [+ + +]
Author: Hermes Wu <hermes.wu@ite.com.tw>
Date:   Mon Dec 30 18:51:23 2024 +0800

    drm/bridge: it6505: fix HDCP Bstatus check
    
    [ Upstream commit 0fd2ff47d8c207fa3173661de04bb9e8201c0ad2 ]
    
    When HDCP is activated,
    a DisplayPort source receiving CP_IRQ from the sink
    shall check Bstatus from DPCD and process the corresponding value
    
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-5-e0fdd4844703@ite.corp-partner.google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: it6505: fix HDCP CTS compare V matching [+ + +]
Author: Hermes Wu <hermes.wu@ite.com.tw>
Date:   Mon Dec 30 18:51:26 2024 +0800

    drm/bridge: it6505: fix HDCP CTS compare V matching
    
    [ Upstream commit 0989c02c7a5c887c70afeae80c64d0291624e1a7 ]
    
    When HDCP negotiation with a repeater device.
    Checking SHA V' matching must retry 3 times before restarting HDCP.
    
    Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-8-e0fdd4844703@ite.corp-partner.google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: it6505: fix HDCP CTS KSV list wait timer [+ + +]
Author: Hermes Wu <hermes.wu@ite.com.tw>
Date:   Mon Dec 30 18:51:27 2024 +0800

    drm/bridge: it6505: fix HDCP CTS KSV list wait timer
    
    [ Upstream commit 9f9eef9ec1a2b57d95a86fe81df758e8253a7766 ]
    
    HDCP must disabled encryption and restart authentication after
    waiting KSV for 5s.
    The original method uses a counter in a waitting loop that may
    wait much longer than it is supposed to.
    Use time_after() for KSV wait timeout.
    
    Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-9-e0fdd4844703@ite.corp-partner.google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: it6505: fix HDCP encryption when R0 ready [+ + +]
Author: Hermes Wu <hermes.wu@ite.com.tw>
Date:   Mon Dec 30 18:51:24 2024 +0800

    drm/bridge: it6505: fix HDCP encryption when R0 ready
    
    [ Upstream commit 8c01b0bae2f9e58f2fee0e811cb90d8331986554 ]
    
    When starting HDCP authentication, HDCP encryption should be enabled
    when R0'is checked.
    
    Change encryption enables time at R0' ready.
    The hardware HDCP engine trigger is changed and the repeater KSV fails
    will restart HDCP.
    
    Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-6-e0fdd4844703@ite.corp-partner.google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:06 2024 +0200

    drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit 39ead6e02ea7d19b421e9d42299d4293fed3064e ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-3-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/client: Handle tiled displays better [+ + +]
Author: Maarten Lankhorst <dev@lankhorst.se>
Date:   Thu Jan 16 15:28:25 2025 +0100

    drm/client: Handle tiled displays better
    
    commit 10026f536843eb8c9148ef6ffb4c6deeebc26838 upstream.
    
    When testing on my tiled display, initially the tiled display is
    detected correctly:
    [90376.523692] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] fallback: Not all outputs enabled
    [90376.523713] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] Enabled: 0, detected: 2
    ...
    [90376.523967] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:82:pipe A] desired mode 1920x2160 set (1920,0)
    [90376.524020] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:134:pipe B] desired mode 1920x2160 set (0,0)
    
    But then, when modes have been set:
    [90379.729525] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] [CONNECTOR:287:DP-4] on [CRTC:82:pipe A]: 1920x2160
    [90379.729640] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] [CONNECTOR:289:DP-5] on [CRTC:134:pipe B]: 1920x2160
    ...
    [90379.730036] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:82:pipe A] desired mode 1920x2160 set (0,0)
    [90379.730124] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:134:pipe B] desired mode 1920x2160 set (0,0)
    
    Call drm_client_get_tile_offsets() in drm_client_firmware_config() as
    well, to ensure that the offset is set correctly.
    
    This has to be done as a separate pass, as the tile order may not be
    equal to the drm connector order.
    
    Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250116142825.3933-2-dev@lankhorst.se
    Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/connector: add mutex to protect ELD from concurrent access [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:04 2024 +0200

    drm/connector: add mutex to protect ELD from concurrent access
    
    [ Upstream commit df7c8e3dde37a9d81c0613285b43600f3cc70f34 ]
    
    The connector->eld is accessed by the .get_eld() callback. This access
    can collide with the drm_edid_to_eld() updating the data at the same
    time. Add drm_connector.eld_mutex to protect the data from concurrenct
    access. Individual drivers are not updated (to reduce possible issues
    while applying the patch), maintainers are to find a best suitable way
    to lock that mutex while accessing the ELD data.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-1-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/exynos: hdmi: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:08 2024 +0200

    drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit 5e8436d334ed7f6785416447c50b42077c6503e0 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-5-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915/dp: fix the Adaptive sync Operation mode for SDP [+ + +]
Author: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Date:   Thu Jan 30 10:46:06 2025 +0530

    drm/i915/dp: fix the Adaptive sync Operation mode for SDP
    
    [ Upstream commit 4466302262b38f5e6c65325035b4036a42efc934 ]
    
    Currently we support Adaptive sync operation mode with dynamic frame
    rate, but instead the operation mode with fixed rate is set.
    This was initially set correctly in the earlier version of changes but
    later got changed, while defining a macro for the same.
    
    Fixes: a5bd5991cb8a ("drm/i915/display: Compute AS SDP parameters")
    Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
    Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
    Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250130051609.1796524-4-mitulkumar.ajitkumar.golani@intel.com
    (cherry picked from commit c5806862543ff6c2ad242409fcdf0667eac26dae)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/i915/dp: Iterate DSC BPP from high to low on all platforms [+ + +]
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Fri Jan 31 14:49:54 2025 +0200

    drm/i915/dp: Iterate DSC BPP from high to low on all platforms
    
    commit 230b19bc2bcc5897d0e20b4ce7e9790a469a2db0 upstream.
    
    Commit 1c56e9a39833 ("drm/i915/dp: Get optimal link config to have best
    compressed bpp") tries to find the best compressed bpp for the
    link. However, it iterates from max to min bpp on display 13+, and from
    min to max on other platforms. This presumably leads to minimum
    compressed bpp always being chosen on display 11-12.
    
    Iterate from high to low on all platforms to actually use the best
    possible compressed bpp.
    
    Fixes: 1c56e9a39833 ("drm/i915/dp: Get optimal link config to have best compressed bpp")
    Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: <stable@vger.kernel.org> # v6.7+
    Reviewed-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/3bba67923cbcd13a59d26ef5fa4bb042b13c8a9b.1738327620.git.jani.nikula@intel.com
    (cherry picked from commit 56b0337d429356c3b9ecc36a03023c8cc856b196)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915/guc: Debug print LRC state entries only if the context is pinned [+ + +]
Author: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Date:   Tue Jan 14 16:13:34 2025 -0800

    drm/i915/guc: Debug print LRC state entries only if the context is pinned
    
    commit 57965269896313e1629a518d3971ad55f599b792 upstream.
    
    After the context is unpinned the backing memory can also be unpinned,
    so any accesses via the lrc_reg_state pointer can end up in unmapped
    memory. To avoid that, make sure to only access that memory if the
    context is pinned when printing its info.
    
    v2: fix newline alignment
    
    Fixes: 28ff6520a34d ("drm/i915/guc: Update GuC debugfs to support new GuC")
    Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
    Cc: John Harrison <John.C.Harrison@Intel.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: <stable@vger.kernel.org> # v5.15+
    Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250115001334.3875347-1-daniele.ceraolospurio@intel.com
    (cherry picked from commit 5bea40687c5cf2a33bf04e9110eb2e2b80222ef5)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915: Drop 64bpp YUV formats from ICL+ SDR planes [+ + +]
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Dec 18 19:36:47 2024 +0200

    drm/i915: Drop 64bpp YUV formats from ICL+ SDR planes
    
    commit c7b49506b3ba7a62335e6f666a43f67d5cd9fd1e upstream.
    
    I'm seeing underruns with these 64bpp YUV formats on TGL.
    
    The weird details:
    - only happens on pipe B/C/D SDR planes, pipe A SDR planes
      seem fine, as do all HDR planes
    - somehow CDCLK related, higher CDCLK allows for bigger plane
      with these formats without underruns. With 300MHz CDCLK I
      can only go up to 1200 pixels wide or so, with 650MHz even
      a 3840 pixel wide plane was OK
    - ICL and ADL so far appear unaffected
    
    So not really sure what's the deal with this, but bspec does
    state "64-bit formats supported only on the HDR planes" so
    let's just drop these formats from the SDR planes. We already
    disallow 64bpp RGB formats.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241218173650.19782-2-ville.syrjala@linux.intel.com
    Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
    (cherry picked from commit 35e1aacfe536d6e8d8d440cd7155366da2541ad4)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/i915: Fix page cleanup on DMA remap failure [+ + +]
Author: Brian Geffon <bgeffon@google.com>
Date:   Mon Jan 27 15:43:32 2025 -0500

    drm/i915: Fix page cleanup on DMA remap failure
    
    commit fa6182c8b13ebfdc70ebdc09161a70dd8131f3b1 upstream.
    
    When converting to folios the cleanup path of shmem_get_pages() was
    missed. When a DMA remap fails and the max segment size is greater than
    PAGE_SIZE it will attempt to retry the remap with a PAGE_SIZEd segment
    size. The cleanup code isn't properly using the folio apis and as a
    result isn't handling compound pages correctly.
    
    v2 -> v3:
    (Ville) Just use shmem_sg_free_table() as-is in the failure path of
    shmem_get_pages(). shmem_sg_free_table() will clear mapping unevictable
    but it will be reset when it retries in shmem_sg_alloc_table().
    
    v1 -> v2:
    (Ville) Fixed locations where we were not clearing mapping unevictable.
    
    Cc: stable@vger.kernel.org
    Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
    Cc: Vidya Srinivas <vidya.srinivas@intel.com>
    Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13487
    Link: https://lore.kernel.org/lkml/20250116135636.410164-1-bgeffon@google.com/
    Fixes: 0b62af28f249 ("i915: convert shmem_sg_free_table() to use a folio_batch")
    Signed-off-by: Brian Geffon <bgeffon@google.com>
    Suggested-by: Tomasz Figa <tfiga@google.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250127204332.336665-1-bgeffon@google.com
    Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    (cherry picked from commit 9e304a18630875352636ad52a3d2af47c3bde824)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/komeda: Add check for komeda_get_layer_fourcc_list() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Thu Dec 19 17:02:56 2024 +0800

    drm/komeda: Add check for komeda_get_layer_fourcc_list()
    
    commit 79fc672a092d93a7eac24fe20a571d4efd8fa5a4 upstream.
    
    Add check for the return value of komeda_get_layer_fourcc_list()
    to catch the potential exception.
    
    Fixes: 5d51f6c0da1b ("drm/komeda: Add writeback support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Acked-by: Liviu Dudau <liviu.dudau@arm.com>
    Link: https://lore.kernel.org/r/20241219090256.146424-1-haoxiang_li2024@163.com
    Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/modeset: Handle tiled displays in pan_display_atomic. [+ + +]
Author: Maarten Lankhorst <dev@lankhorst.se>
Date:   Thu Jan 16 15:28:24 2025 +0100

    drm/modeset: Handle tiled displays in pan_display_atomic.
    
    commit f4a9dd57e549a17a7dac1c1defec26abd7e5c2d4 upstream.
    
    Tiled displays have a different x/y offset to begin with. Instead of
    attempting to remember this, just apply a delta instead.
    
    This fixes the first tile being duplicated on other tiles when vt
    switching.
    
    Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250116142825.3933-1-dev@lankhorst.se
    Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/radeon: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:11 2024 +0200

    drm/radeon: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit b54c14f82428c8a602392d4cae1958a71a578132 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-8-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/rockchip: cdn-dp: Use drm_connector_helper_hpd_irq_event() [+ + +]
Author: Thomas Zimmermann <tzimmermann@suse.de>
Date:   Tue Nov 5 14:38:16 2024 +0100

    drm/rockchip: cdn-dp: Use drm_connector_helper_hpd_irq_event()
    
    commit 666e1960464140cc4bc9203c203097e70b54c95a upstream.
    
    The code for detecting and updating the connector status in
    cdn_dp_pd_event_work() has a number of problems.
    
    - It does not aquire the locks to call the detect helper and update
    the connector status. These are struct drm_mode_config.connection_mutex
    and struct drm_mode_config.mutex.
    
    - It does not use drm_helper_probe_detect(), which helps with the
    details of locking and detection.
    
    - It uses the connector's status field to determine a change to
    the connector status. The epoch_counter field is the correct one. The
    field signals a change even if the connector status' value did not
    change.
    
    Replace the code with a call to drm_connector_helper_hpd_irq_event(),
    which fixes all these problems.
    
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Fixes: 81632df69772 ("drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event")
    Cc: Chris Zhong <zyw@rock-chips.com>
    Cc: Guenter Roeck <groeck@chromium.org>
    Cc: Sandy Huang <hjc@rock-chips.com>
    Cc: "Heiko Stübner" <heiko@sntech.de>
    Cc: Andy Yan <andy.yan@rock-chips.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-rockchip@lists.infradead.org
    Cc: <stable@vger.kernel.org> # v4.11+
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241105133848.480407-1-tzimmermann@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/sti: hdmi: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:12 2024 +0200

    drm/sti: hdmi: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit e99c0b517bcd53cf61f998a3c4291333401cb391 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-9-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/tests: hdmi: handle empty modes in find_preferred_mode() [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Sat Nov 30 03:52:26 2024 +0200

    drm/tests: hdmi: handle empty modes in find_preferred_mode()
    
    [ Upstream commit d3314efd6ebf335a3682b1d6b1b81cdab3d8254a ]
    
    If the connector->modes list is empty, then list_first_entry() returns a
    bogus entry. Change that to use list_first_entry_or_null().
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241130-hdmi-mode-valid-v5-1-742644ec3b1f@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/tests: hdmi: return meaningful value from set_connector_edid() [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Sat Nov 30 03:52:28 2024 +0200

    drm/tests: hdmi: return meaningful value from set_connector_edid()
    
    [ Upstream commit a8403be6eea91e4f5d8ad5dbc463dd08339eaece ]
    
    The set_connector_edid() function returns a bogus 0, performing the
    check on the connector->funcs->fill_modes() result internally. Make the
    function pass the fill_modes()'s return value to the caller and move
    corresponding checks to the caller site.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241130-hdmi-mode-valid-v5-3-742644ec3b1f@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/vc4: hdmi: use eld_mutex to protect access to connector->eld [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Fri Dec 6 11:43:13 2024 +0200

    drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
    
    [ Upstream commit 81a9a93b169a273ccc4a9a1ee56f17e9981d3f98 ]
    
    Reading access to connector->eld can happen at the same time the
    drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
    order to protect connector->eld from concurrent access.
    
    Reviewed-by: Maxime Ripard <mripard@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-10-c9bce1ee8bea@linaro.org
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/virtio: New fence for every plane update [+ + +]
Author: Dongwon Kim <dongwon.kim@intel.com>
Date:   Mon Oct 21 02:08:03 2024 +0300

    drm/virtio: New fence for every plane update
    
    [ Upstream commit d3c55b8ab6fe5fa2e7ab02efd36d09c39ee5022f ]
    
    Having a fence linked to a virtio_gpu_framebuffer in the plane update
    sequence would cause conflict when several planes referencing the same
    framebuffer (e.g. Xorg screen covering multi-displays configured for an
    extended mode) and those planes are updated concurrently. So it is needed
    to allocate a fence for every plane state instead of the framebuffer.
    
    Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
    [dmitry.osipenko@collabora.com: rebase, fix up, edit commit message]
    Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
    Reviewed-by: Rob Clark <robdclark@gmail.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241020230803.247419-2-dmitry.osipenko@collabora.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/devcoredump: Move exec queue snapshot to Contexts section [+ + +]
Author: Lucas De Marchi <lucas.demarchi@intel.com>
Date:   Wed Jan 22 21:11:11 2025 -0800

    drm/xe/devcoredump: Move exec queue snapshot to Contexts section
    
    commit 042c48b73699c47d84b6ace73036e5a31a0d4cfc upstream.
    
    Having the exec queue snapshot inside a "GuC CT" section was always
    wrong.  Commit c28fd6c358db ("drm/xe/devcoredump: Improve section
    headings and add tile info") tried to fix that bug, but with that also
    broke the mesa tool that parses the devcoredump, hence it was reverted
    in commit a53da2fb25a3 ("drm/xe: Revert some changes that break a mesa
    debug tool").
    
    With the mesa tool also fixed, this can propagate as a fix on both
    kernel and userspace side to avoid unnecessary headache for a debug
    feature.
    
    Cc: John Harrison <John.C.Harrison@Intel.com>
    Cc: Julia Filipchuk <julia.filipchuk@intel.com>
    Cc: José Roberto de Souza <jose.souza@intel.com>
    Cc: stable@vger.kernel.org
    Fixes: a53da2fb25a3 ("drm/xe: Revert some changes that break a mesa debug tool")
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250123051112.1938193-2-lucas.demarchi@intel.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    (cherry picked from commit a37934ea75d331fafa7fe80b6180642ba5193422)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/xe: Fix and re-enable xe_print_blob_ascii85() [+ + +]
Author: Lucas De Marchi <lucas.demarchi@intel.com>
Date:   Thu Jan 23 12:22:03 2025 -0800

    drm/xe: Fix and re-enable xe_print_blob_ascii85()
    
    commit a9ab6591b45258b79af1cb66112fd9f83c8855da upstream.
    
    Commit 70fb86a85dc9 ("drm/xe: Revert some changes that break a mesa
    debug tool") partially reverted some changes to workaround breakage
    caused to mesa tools. However, in doing so it also broke fetching the
    GuC log via debugfs since xe_print_blob_ascii85() simply bails out.
    
    The fix is to avoid the extra newlines: the devcoredump interface is
    line-oriented and adding random newlines in the middle breaks it. If a
    tool is able to parse it by looking at the data and checking for chars
    that are out of the ascii85 space, it can still do so. A format change
    that breaks the line-oriented output on devcoredump however needs better
    coordination with existing tools.
    
    v2: Add suffix description comment
    v3: Reword explanation of xe_print_blob_ascii85() calling drm_puts()
        in a loop
    
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
    Cc: John Harrison <John.C.Harrison@Intel.com>
    Cc: Julia Filipchuk <julia.filipchuk@intel.com>
    Cc: José Roberto de Souza <jose.souza@intel.com>
    Cc: stable@vger.kernel.org
    Fixes: 70fb86a85dc9 ("drm/xe: Revert some changes that break a mesa debug tool")
    Fixes: ec1455ce7e35 ("drm/xe/devcoredump: Add ASCII85 dump helper function")
    Link: https://patchwork.freedesktop.org/patch/msgid/20250123202307.95103-2-jose.souza@intel.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    (cherry picked from commit 2c95bbf5002776117a69caed3b31c10bf7341bec)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm: Add panel backlight quirks [+ + +]
Author: Thomas Weißschuh <linux@weissschuh.net>
Date:   Mon Nov 11 19:09:35 2024 +0100

    drm: Add panel backlight quirks
    
    [ Upstream commit 22e5c7ae12145af13785e3ff138395d5b1a22116 ]
    
    Panels using a PWM-controlled backlight source do not have a standard
    way to communicate their valid PWM ranges.
    On x86 the ranges are read from ACPI through driver-specific tables.
    The built-in ranges are not necessarily correct, or may grow stale if an
    older device can be retrofitted with newer panels.
    
    Add a quirk infrastructure with which the minimum valid backlight value
    can be maintained as part of the kernel.
    
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Tested-by: Dustin L. Howett <dustin@howett.net>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241111-amdgpu-min-backlight-quirk-v7-1-f662851fda69@weissschuh.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm: panel-backlight-quirks: Add Framework 13 glossy and 2.8k panels [+ + +]
Author: Dustin L. Howett <dustin@howett.net>
Date:   Mon Nov 11 19:09:38 2024 +0100

    drm: panel-backlight-quirks: Add Framework 13 glossy and 2.8k panels
    
    [ Upstream commit d80b5c5b9be6b2e1cdeaaeaa8259523b63cae292 ]
    
    I have tested these panels on the Framework Laptop 13 AMD with firmware
    revision 3.05 (latest at time of submission).
    
    Signed-off-by: Dustin L. Howett <dustin@howett.net>
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241111-amdgpu-min-backlight-quirk-v7-4-f662851fda69@weissschuh.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm: panel-backlight-quirks: Add Framework 13 matte panel [+ + +]
Author: Thomas Weißschuh <linux@weissschuh.net>
Date:   Mon Nov 11 19:09:37 2024 +0100

    drm: panel-backlight-quirks: Add Framework 13 matte panel
    
    [ Upstream commit 916ecc0db336768d80e14ef28a8c64a775274f95 ]
    
    The value of "min_input_signal" returned from ATIF on a Framework AMD 13
    is "12". This leads to a fairly bright minimum display backlight.
    
    Add a quirk to override that the minimum backlight PWM to "0" which
    leads to a much lower minimum brightness, which is still visible.
    
    Tested on a Framework AMD 13 BIOS 3.05 with the matte panel.
    
    Link: https://community.frame.work/t/25711/9
    Link: https://community.frame.work/t/47036
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Tested-by: Dustin L. Howett <dustin@howett.net>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241111-amdgpu-min-backlight-quirk-v7-3-f662851fda69@weissschuh.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
efi: libstub: Use '-std=gnu11' to fix build with GCC 15 [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jan 21 18:11:34 2025 -0700

    efi: libstub: Use '-std=gnu11' to fix build with GCC 15
    
    commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream.
    
    GCC 15 changed the default C standard version to C23, which should not
    have impacted the kernel because it requests the gnu11 standard via
    '-std=' in the main Makefile. However, the EFI libstub Makefile uses its
    own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using
    the default), resulting in errors from the kernel's definitions of bool,
    true, and false in stddef.h, which are reserved keywords under C23.
    
      ./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
         11 |         false   = 0,
      ./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
         35 | typedef _Bool                   bool;
    
    Set '-std=gnu11' in the x86 cflags to resolve the error and consistently
    use the same C standard version for the entire kernel. All other
    architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this
    issue is not visible for them.
    
    Cc: stable@vger.kernel.org
    Reported-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
    Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/
    Reported-by: Jakub Jelinek <jakub@redhat.com>
    Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ethtool: rss: fix hiding unsupported fields in dumps [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Jan 31 17:30:37 2025 -0800

    ethtool: rss: fix hiding unsupported fields in dumps
    
    [ Upstream commit 244f8aa46fa9e2f4ea5fe0e04988b395d5e30fc7 ]
    
    Commit ec6e57beaf8b ("ethtool: rss: don't report key if device
    doesn't support it") intended to stop reporting key fields for
    additional rss contexts if device has a global hashing key.
    
    Later we added dump support and the filtering wasn't properly
    added there. So we end up reporting the key fields in dumps
    but not in dos:
    
      # ./pyynl/cli.py --spec netlink/specs/ethtool.yaml --do rss-get \
                    --json '{"header": {"dev-index":2}, "context": 1 }'
      {
         "header": { ... },
         "context": 1,
         "indir": [0, 1, 2, 3, ...]]
      }
    
      # ./pyynl/cli.py --spec netlink/specs/ethtool.yaml --dump rss-get
      [
         ... snip context 0 ...
         { "header": { ... },
           "context": 1,
           "indir": [0, 1, 2, 3, ...],
     ->    "input_xfrm": 255,
     ->    "hfunc": 1,
     ->    "hkey": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
         }
      ]
    
    Hide these fields correctly.
    
    The drivers/net/hw/rss_ctx.py selftest catches this when run on
    a device with single key, already:
    
      # Check| At /root/./ksft-net-drv/drivers/net/hw/rss_ctx.py, line 381, in test_rss_context_dump:
      # Check|     ksft_ne(set(data.get('hkey', [1])), {0}, "key is all zero")
      # Check failed {0} == {0} key is all zero
      not ok 8 rss_ctx.test_rss_context_dump
    
    Fixes: f6122900f4e2 ("ethtool: rss: support dumping RSS contexts")
    Reviewed-by: Gal Pressman <gal@nvidia.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Link: https://patch.msgid.link/20250201013040.725123-2-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
exec: fix up /proc/pid/comm in the execveat(AT_EMPTY_PATH) case [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Thu Nov 21 07:07:05 2024 -0800

    exec: fix up /proc/pid/comm in the execveat(AT_EMPTY_PATH) case
    
    [ Upstream commit 543841d1806029889c2f69f040e88b247aba8e22 ]
    
    Zbigniew mentioned at Linux Plumber's that systemd is interested in
    switching to execveat() for service execution, but can't, because the
    contents of /proc/pid/comm are the file descriptor which was used,
    instead of the path to the binary[1]. This makes the output of tools like
    top and ps useless, especially in a world where most fds are opened
    CLOEXEC so the number is truly meaningless.
    
    When the filename passed in is empty (e.g. with AT_EMPTY_PATH), use the
    dentry's filename for "comm" instead of using the useless numeral from
    the synthetic fdpath construction. This way the actual exec machinery
    is unchanged, but cosmetically the comm looks reasonable to admins
    investigating things.
    
    Instead of adding TASK_COMM_LEN more bytes to bprm, use one of the unused
    flag bits to indicate that we need to set "comm" from the dentry.
    
    Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
    Suggested-by: Tycho Andersen <tandersen@netflix.com>
    Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://github.com/uapi-group/kernel-features#set-comm-field-before-exec [1]
    Reviewed-by: Aleksa Sarai <cyphar@cyphar.com>
    Tested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fgraph: Fix set_graph_notrace with setting TRACE_GRAPH_NOTRACE_BIT [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Sat Feb 8 00:15:11 2025 -0500

    fgraph: Fix set_graph_notrace with setting TRACE_GRAPH_NOTRACE_BIT
    
    commit c8c9b1d2d5b4377c72a979f5a26e842a869aefc9 upstream.
    
    The code was restructured where the function graph notrace code, that
    would not trace a function and all its children is done by setting a
    NOTRACE flag when the function that is not to be traced is hit.
    
    There's a TRACE_GRAPH_NOTRACE_BIT which defines the bit in the flags and a
    TRACE_GRAPH_NOTRACE which is the mask with that bit set. But the
    restructuring used TRACE_GRAPH_NOTRACE_BIT when it should have used
    TRACE_GRAPH_NOTRACE.
    
    For example:
    
     # cd /sys/kernel/tracing
     # echo set_track_prepare stack_trace_save  > set_graph_notrace
     # echo function_graph > current_tracer
     # cat trace
    [..]
     0)               |                          __slab_free() {
     0)               |                            free_to_partial_list() {
     0)               |                                  arch_stack_walk() {
     0)               |                                    __unwind_start() {
     0)   0.501 us    |                                      get_stack_info();
    
    Where a non filter trace looks like:
    
     # echo > set_graph_notrace
     # cat trace
     0)               |                            free_to_partial_list() {
     0)               |                              set_track_prepare() {
     0)               |                                stack_trace_save() {
     0)               |                                  arch_stack_walk() {
     0)               |                                    __unwind_start() {
    
    Where the filter should look like:
    
     # cat trace
     0)               |                            free_to_partial_list() {
     0)               |                              _raw_spin_lock_irqsave() {
     0)   0.350 us    |                                preempt_count_add();
     0)   0.351 us    |                                do_raw_spin_lock();
     0)   2.440 us    |                              }
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Link: https://lore.kernel.org/20250208001511.535be150@batman.local.home
    Fixes: b84214890a9bc ("function_graph: Move graph notrace bit to shadow stack global var")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry [+ + +]
Author: Prasad Pandit <pjp@fedoraproject.org>
Date:   Mon Mar 11 16:21:22 2024 +0530

    firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry
    
    [ Upstream commit e1e17a1715982201034024863efbf238bee2bdf9 ]
    
    Fix ISCSI_IBFT Kconfig entry, replace tab with a space character.
    
    Fixes: 138fe4e0697 ("Firmware: add iSCSI iBFT Support")
    Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

firmware: qcom: scm: Fix missing read barrier in qcom_scm_get_tzmem_pool() [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Mon Dec 9 15:27:55 2024 +0100

    firmware: qcom: scm: Fix missing read barrier in qcom_scm_get_tzmem_pool()
    
    commit b628510397b5cafa1f5d3e848a28affd1c635302 upstream.
    
    Commit 2e4955167ec5 ("firmware: qcom: scm: Fix __scm and waitq
    completion variable initialization") introduced a write barrier in probe
    function to store global '__scm' variable.  We all known barriers are
    paired (see memory-barriers.txt: "Note that write barriers should
    normally be paired with read or address-dependency barriers"), therefore
    accessing it from concurrent contexts requires read barrier.  Previous
    commit added such barrier in qcom_scm_is_available(), so let's use that
    directly.
    
    Lack of this read barrier can result in fetching stale '__scm' variable
    value, NULL, and dereferencing it.
    
    Note that barrier in qcom_scm_is_available() satisfies here the control
    dependency.
    
    Fixes: ca61d6836e6f ("firmware: qcom: scm: fix a NULL-pointer dereference")
    Fixes: 449d0d84bcd8 ("firmware: qcom: scm: smc: switch to using the SCM allocator")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241209-qcom-scm-missing-barriers-and-all-sort-of-srap-v2-2-9061013c8d92@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

firmware: qcom: scm: Fix missing read barrier in qcom_scm_is_available() [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Mon Dec 9 15:27:54 2024 +0100

    firmware: qcom: scm: Fix missing read barrier in qcom_scm_is_available()
    
    commit 0a744cceebd0480cb39587b3b1339d66a9d14063 upstream.
    
    Commit 2e4955167ec5 ("firmware: qcom: scm: Fix __scm and waitq
    completion variable initialization") introduced a write barrier in probe
    function to store global '__scm' variable.  It also claimed that it
    added a read barrier, because as we all known barriers are paired (see
    memory-barriers.txt: "Note that write barriers should normally be paired
    with read or address-dependency barriers"), however it did not really
    add it.
    
    The offending commit used READ_ONCE() to access '__scm' global which is
    not a barrier.
    
    The barrier is needed so the store to '__scm' will be properly visible.
    This is most likely not fatal in current driver design, because missing
    read barrier would mean qcom_scm_is_available() callers will access old
    value, NULL.  Driver does not support unbinding and does not correctly
    handle probe failures, thus there is no risk of stale or old pointer in
    '__scm' variable.
    
    However for code correctness, readability and to be sure that we did not
    mess up something in this tricky topic of SMP barriers, add a read
    barrier for accessing '__scm'.  Change also comment from useless/obvious
    what does barrier do, to what is expected: which other parts of the code
    are involved here.
    
    Fixes: 2e4955167ec5 ("firmware: qcom: scm: Fix __scm and waitq completion variable initialization")
    Cc: stable@vger.kernel.org
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241209-qcom-scm-missing-barriers-and-all-sort-of-srap-v2-1-9061013c8d92@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs/proc: do_task_stat: Fix ESP not readable during coredump [+ + +]
Author: Nam Cao <namcao@linutronix.de>
Date:   Thu Jan 2 09:22:56 2025 +0100

    fs/proc: do_task_stat: Fix ESP not readable during coredump
    
    commit ab251dacfbae28772c897f068a4184f478189ff2 upstream.
    
    The field "eip" (instruction pointer) and "esp" (stack pointer) of a task
    can be read from /proc/PID/stat. These fields can be interesting for
    coredump.
    
    However, these fields were disabled by commit 0a1eb2d474ed ("fs/proc: Stop
    reporting eip and esp in /proc/PID/stat"), because it is generally unsafe
    to do so. But it is safe for a coredumping process, and therefore
    exceptions were made:
    
      - for a coredumping thread by commit fd7d56270b52 ("fs/proc: Report
        eip/esp in /prod/PID/stat for coredumping").
    
      - for all other threads in a coredumping process by commit cb8f381f1613
        ("fs/proc/array.c: allow reporting eip/esp for all coredumping
        threads").
    
    The above two commits check the PF_DUMPCORE flag to determine a coredump thread
    and the PF_EXITING flag for the other threads.
    
    Unfortunately, commit 92307383082d ("coredump:  Don't perform any cleanups
    before dumping core") moved coredump to happen earlier and before PF_EXITING is
    set. Thus, checking PF_EXITING is no longer the correct way to determine
    threads in a coredumping process.
    
    Instead of PF_EXITING, use PF_POSTCOREDUMP to determine the other threads.
    
    Checking of PF_EXITING was added for coredumping, so it probably can now be
    removed. But it doesn't hurt to keep.
    
    Fixes: 92307383082d ("coredump:  Don't perform any cleanups before dumping core")
    Cc: stable@vger.kernel.org
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Acked-by: Oleg Nesterov <oleg@redhat.com>
    Acked-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Link: https://lore.kernel.org/r/d89af63d478d6c64cc46a01420b46fd6eb147d6f.1735805772.git.namcao@linutronix.de
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs: fix adding security options to statmount.mnt_opt [+ + +]
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Wed Jan 29 16:12:53 2025 +0100

    fs: fix adding security options to statmount.mnt_opt
    
    commit 5eb987105357cb7cfa7cf3b1e2f66d5c0977e412 upstream.
    
    Prepending security options was made conditional on sb->s_op->show_options,
    but security options are independent of sb options.
    
    Fixes: 056d33137bf9 ("fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()")
    Fixes: f9af549d1fd3 ("fs: export mount options via statmount()")
    Cc: stable@vger.kernel.org # v6.11
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Link: https://lore.kernel.org/r/20250129151253.33241-1-mszeredi@redhat.com
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fs: prepend statmount.mnt_opts string with security_sb_mnt_opts() [+ + +]
Author: Jeff Layton <jlayton@kernel.org>
Date:   Fri Nov 15 10:35:53 2024 -0500

    fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()
    
    commit 056d33137bf9364456ee70aa265ccbb948daee49 upstream.
    
    Currently these mount options aren't accessible via statmount().
    
    The read handler for /proc/#/mountinfo calls security_sb_show_options()
    to emit the security options after emitting superblock flag options, but
    before calling sb->s_op->show_options.
    
    Have statmount_mnt_opts() call security_sb_show_options() before
    calling ->show_options.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Link: https://lore.kernel.org/r/20241115-statmount-v2-2-cd29aeff9cbb@kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Stable-dep-of: 5eb987105357 ("fs: fix adding security options to statmount.mnt_opt")
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: pca953x: Improve interrupt support [+ + +]
Author: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Date:   Thu Jun 6 15:31:02 2024 +1200

    gpio: pca953x: Improve interrupt support
    
    [ Upstream commit d6179f6c6204f9932aed3a7a2100b4a295dfed9d ]
    
    The GPIO drivers with latch interrupt support (typically types starting
    with PCAL) have interrupt status registers to determine which particular
    inputs have caused an interrupt. Unfortunately there is no atomic
    operation to read these registers and clear the interrupt. Clearing the
    interrupt is done by reading the input registers.
    
    The code was reading the interrupt status registers, and then reading
    the input registers. If an input changed between these two events it was
    lost.
    
    The solution in this patch is to revert to the non-latch version of
    code, i.e. remembering the previous input status, and looking for the
    changes. This system results in no more I2C transfers, so is no slower.
    The latch property of the device still means interrupts will still be
    noticed if the input changes back to its initial state.
    
    Fixes: 44896beae605 ("gpio: pca953x: add PCAL9535 interrupt support for Galileo Gen2")
    Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20240606033102.2271916-1-mark.tomlinson@alliedtelesis.co.nz
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

gpio: sim: lock hog configfs items if present [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date:   Mon Feb 3 12:01:23 2025 +0100

    gpio: sim: lock hog configfs items if present
    
    [ Upstream commit 015b7dae084fa95465ff89f6cbf15fe49906a370 ]
    
    Depending on the user config, the leaf entry may be the hog directory,
    not line. Check it and lock the correct item.
    
    Fixes: 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on")
    Tested-by: Koichiro Den <koichiro.den@canonical.com>
    Link: https://lore.kernel.org/r/20250203110123.87701-1-brgl@bgdev.pl
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gpu: drm_dp_cec: fix broken CEC adapter properties check [+ + +]
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date:   Wed Jan 29 10:51:48 2025 +0100

    gpu: drm_dp_cec: fix broken CEC adapter properties check
    
    [ Upstream commit 6daaae5ff7f3b23a2dacc9c387ff3d4f95b67cad ]
    
    If the hotplug detect of a display is low for longer than one second
    (configurable through drm_dp_cec_unregister_delay), then the CEC adapter
    is unregistered since we assume the display was disconnected. If the
    HPD went low for less than one second, then we check if the properties
    of the CEC adapter have changed, since that indicates that we actually
    switch to new hardware and we have to unregister the old CEC device and
    register a new one.
    
    Unfortunately, the test for changed properties was written poorly, and
    after a new CEC capability was added to the CEC core code the test always
    returned true (i.e. the properties had changed).
    
    As a result the CEC device was unregistered and re-registered for every
    HPD toggle. If the CEC remote controller integration was also enabled
    (CONFIG_MEDIA_CEC_RC was set), then the corresponding input device was
    also unregistered and re-registered. As a result the input device in
    /sys would keep incrementing its number, e.g.:
    
    /sys/devices/pci0000:00/0000:00:08.1/0000:e7:00.0/rc/rc0/input20
    
    Since short HPD toggles are common, the number could over time get into
    the thousands.
    
    While not a serious issue (i.e. nothing crashes), it is not intended
    to work that way.
    
    This patch changes the test so that it only checks for the single CEC
    capability that can actually change, and it ignores any other
    capabilities, so this is now safe as well if new caps are added in
    the future.
    
    With the changed test the bit under #ifndef CONFIG_MEDIA_CEC_RC can be
    dropped as well, so that's a nice cleanup.
    
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Reported-by: Farblos <farblos@vodafonemail.de>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Fixes: 2c6d1fffa1d9 ("drm: add support for DisplayPort CEC-Tunneling-over-AUX")
    Tested-by: Farblos <farblos@vodafonemail.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/361bb03d-1691-4e23-84da-0861ead5dbdc@xs4all.nl
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
HID: hid-asus: Disable OOBE mode on the ProArt P16 [+ + +]
Author: Luke D. Jones <luke@ljones.dev>
Date:   Sat Jan 11 14:01:53 2025 +1300

    HID: hid-asus: Disable OOBE mode on the ProArt P16
    
    [ Upstream commit 53078a736fbc60e5d3a1e14f4cd4214003815026 ]
    
    The new ASUS ProArt 16" laptop series come with their keyboards stuck in
    an Out-Of-Box-Experience mode. While in this mode most functions will
    not work such as LED control or Fn key combos. The correct init sequence
    is now done to disable this OOBE.
    
    This patch addresses only the ProArt series so far and it is unknown if
    there may be others, in which case a new quirk may be required.
    
    Signed-off-by: Luke D. Jones <luke@ljones.dev>
    Co-developed-by: Connor Belli <connorbelli2003@gmail.com>
    Signed-off-by: Connor Belli <connorbelli2003@gmail.com>
    Tested-by: Jan Schmidt <jan@centricular.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: hid-sensor-hub: don't use stale platform-data on remove [+ + +]
Author: Heiko Stuebner <heiko@sntech.de>
Date:   Thu Nov 7 12:47:04 2024 +0100

    HID: hid-sensor-hub: don't use stale platform-data on remove
    
    commit 8a5b38c3fd709e8acd2bfdedf66c25e6af759576 upstream.
    
    The hid-sensor-hub creates the individual device structs and transfers them
    to the created mfd platform-devices via the platform_data in the mfd_cell.
    
    Before e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads")
    the sensor-hub was managing access centrally, with one "completion" in the
    hub's data structure, which needed to be finished on removal at the latest.
    
    The mentioned commit then moved this central management to each hid sensor
    device, resulting on a completion in each struct hid_sensor_hub_device.
    The remove procedure was adapted to go through all sensor devices and
    finish any pending "completion".
    
    What this didn't take into account was, platform_device_add_data() that is
    used by mfd_add{_hotplug}_devices() does a kmemdup on the submitted
    platform-data. So the data the platform-device gets is a copy of the
    original data, meaning that the device worked on a different completion
    than what sensor_hub_remove() currently wants to access.
    
    To fix that, use device_for_each_child() to go through each child-device
    similar to how mfd_remove_devices() unregisters the devices later and
    with that get the live platform_data to finalize the correct completion.
    
    Fixes: e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Acked-by: Benjamin Tissoires <bentiss@kernel.org>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Acked-by: Jiri Kosina <jkosina@suse.com>
    Link: https://lore.kernel.org/r/20241107114712.538976-2-heiko@sntech.de
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: multitouch: Add quirk for Hantick 5288 touchpad [+ + +]
Author: Youwan Wang <youwan@nfschina.com>
Date:   Mon Dec 16 10:18:01 2024 +0800

    HID: multitouch: Add quirk for Hantick 5288 touchpad
    
    [ Upstream commit b5e65ae557da9fd17b08482ee44ee108ba636182 ]
    
    This device sometimes doesn't send touch release signals when moving
    from >=2 fingers to <2 fingers. Using MT_QUIRK_NOT_SEEN_MEANS_UP instead
    of MT_QUIRK_ALWAYS_VALID makes sure that no touches become stuck.
    
    Signed-off-by: Enze Xie <enze@nfschina.com>
    Signed-off-by: Youwan Wang <youwan@nfschina.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: Wacom: Add PCI Wacom device support [+ + +]
Author: Even Xu <even.xu@intel.com>
Date:   Thu Dec 26 09:35:27 2024 +0800

    HID: Wacom: Add PCI Wacom device support
    
    [ Upstream commit c4c123504a65583e3689b3de04a61dc5272e453a ]
    
    Add PCI device ID of wacom device into driver support list.
    
    Signed-off-by: Even Xu <even.xu@intel.com>
    Tested-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com>
    Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING [+ + +]
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Sat Jan 18 00:24:33 2025 +0100

    hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
    
    commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 upstream.
    
    hrtimers are migrated away from the dying CPU to any online target at
    the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers
    handling tasks involved in the CPU hotplug forward progress.
    
    However wakeups can still be performed by the outgoing CPU after
    CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being
    armed. Depending on several considerations (crystal ball power management
    based election, earliest timer already enqueued, timer migration enabled or
    not), the target may eventually be the current CPU even if offline. If that
    happens, the timer is eventually ignored.
    
    The most notable example is RCU which had to deal with each and every of
    those wake-ups by deferring them to an online CPU, along with related
    workarounds:
    
    _ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying)
    _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU)
    _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
    
    The problem isn't confined to RCU though as the stop machine kthread
    (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end
    of its work through cpu_stop_signal_done() and performs a wake up that
    eventually arms the deadline server timer:
    
       WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
       CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
       Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
       RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
       Call Trace:
       <TASK>
         start_dl_timer
         enqueue_dl_entity
         dl_server_start
         enqueue_task_fair
         enqueue_task
         ttwu_do_activate
         try_to_wake_up
         complete
         cpu_stopper_thread
    
    Instead of providing yet another bandaid to work around the situation, fix
    it in the hrtimers infrastructure instead: always migrate away a timer to
    an online target whenever it is enqueued from an offline CPU.
    
    This will also allow to revert all the above RCU disgraceful hacks.
    
    Fixes: 5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
    Reported-by: Vlad Poenaru <vlad.wing@gmail.com>
    Reported-by: Usama Arif <usamaarif642@gmail.com>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Tested-by: Paul E. McKenney <paulmck@kernel.org>
    Link: https://lore.kernel.org/all/20250117232433.24027-1-frederic@kernel.org
    Closes: 20241213203739.1519801-1-usamaarif642@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
i2c: Force ELAN06FA touchpad I2C bus freq to 100KHz [+ + +]
Author: Randolph Ha <rha051117@gmail.com>
Date:   Mon Jan 13 14:52:37 2025 -0500

    i2c: Force ELAN06FA touchpad I2C bus freq to 100KHz
    
    [ Upstream commit bfd74cd1fbc026f04446e67d6915c7e199c2bffd ]
    
    When a 400KHz freq is used on this model of ELAN touchpad in Linux,
    excessive smoothing (similar to when the touchpad's firmware detects
    a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo
    V15 G4) ACPI tables specify a 400KHz frequency for this device and
    some I2C busses (e.g, Designware I2C) default to a 400KHz freq,
    force the speed to 100KHz as a workaround.
    
    For future investigation: This problem may be related to the default
    HCNT/LCNT values given by some busses' drivers, because they are not
    specified in the aforementioned devices' ACPI tables, and because
    the device works without issues on Windows at what is expected to be
    a 400KHz frequency. The root cause of the issue is not known.
    
    Signed-off-by: Randolph Ha <rha051117@gmail.com>
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i3c: master: Fix missing 'ret' assignment in set_speed() [+ + +]
Author: Frank Li <Frank.Li@nxp.com>
Date:   Wed Jan 8 17:55:33 2025 -0500

    i3c: master: Fix missing 'ret' assignment in set_speed()
    
    commit b266e0d4dac00eecdfaf50ec3f708fd0c3b39637 upstream.
    
    Fix a probe failure in the i3c master driver that occurs when no i3c
    devices are connected to the bus.
    
    The issue arises in `i3c_master_bus_init()` where the `ret` value is not
    updated after calling `master->ops->set_speed()`. If no devices are
    present, `ret` remains set to `I3C_ERROR_M2`, causing the code to
    incorrectly proceed to `err_bus_cleanup`.
    
    Cc: stable@vger.kernel.org
    Fixes: aef79e189ba2 ("i3c: master: support to adjust first broadcast address speed")
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/r/20250108225533.915334-1-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ice: Add check for devm_kzalloc() [+ + +]
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Date:   Fri Jan 31 01:38:32 2025 +0000

    ice: Add check for devm_kzalloc()
    
    [ Upstream commit a8aa6a6ddce9b5585f2b74f27f3feea1427fb4e7 ]
    
    Add check for the return value of devm_kzalloc() to guarantee the success
    of allocation.
    
    Fixes: 42c2eb6b1f43 ("ice: Implement devlink-rate API")
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Link: https://patch.msgid.link/20250131013832.24805-1-jiashengjiangcool@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: gather page_count()'s of each frag right before XDP prog call [+ + +]
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date:   Thu Jan 23 16:01:17 2025 +0100

    ice: gather page_count()'s of each frag right before XDP prog call
    
    [ Upstream commit 11c4aa074d547d825b19cd8d9f288254d89d805c ]
    
    If we store the pgcnt on few fragments while being in the middle of
    gathering the whole frame and we stumbled upon DD bit not being set, we
    terminate the NAPI Rx processing loop and come back later on. Then on
    next NAPI execution we work on previously stored pgcnt.
    
    Imagine that second half of page was used actively by networking stack
    and by the time we came back, stack is not busy with this page anymore
    and decremented the refcnt. The page reuse algorithm in this case should
    be good to reuse the page but given the old refcnt it will not do so and
    attempt to release the page via page_frag_cache_drain() with
    pagecnt_bias used as an arg. This in turn will result in negative refcnt
    on struct page, which was initially observed by Xu Du.
    
    Therefore, move the page count storage from ice_get_rx_buf() to a place
    where we are sure that whole frame has been collected, but before
    calling XDP program as it internally can also change the page count of
    fragments belonging to xdp_buff.
    
    Fixes: ac0753391195 ("ice: Store page count inside ice_rx_buf")
    Reported-and-tested-by: Xu Du <xudu@redhat.com>
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Co-developed-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: put Rx buffers after being done with current frame [+ + +]
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date:   Thu Jan 23 16:01:16 2025 +0100

    ice: put Rx buffers after being done with current frame
    
    [ Upstream commit 743bbd93cf29f653fae0e1416a31f03231689911 ]
    
    Introduce a new helper ice_put_rx_mbuf() that will go through gathered
    frags from current frame and will call ice_put_rx_buf() on them. Current
    logic that was supposed to simplify and optimize the driver where we go
    through a batch of all buffers processed in current NAPI instance turned
    out to be broken for jumbo frames and very heavy load that was coming
    from both multi-thread iperf and nginx/wrk pair between server and
    client. The delay introduced by approach that we are dropping is simply
    too big and we need to take the decision regarding page
    recycling/releasing as quick as we can.
    
    While at it, address an error path of ice_add_xdp_frag() - we were
    missing buffer putting from day 1 there.
    
    As a nice side effect we get rid of annoying and repetitive three-liner:
    
            xdp->data = NULL;
            rx_ring->first_desc = ntc;
            rx_ring->nr_frags = 0;
    
    by embedding it within introduced routine.
    
    Fixes: 1dc1a7e7f410 ("ice: Centrallize Rx buffer recycling")
    Reported-and-tested-by: Xu Du <xudu@redhat.com>
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Co-developed-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: stop storing XDP verdict within ice_rx_buf [+ + +]
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date:   Thu Jan 23 16:01:18 2025 +0100

    ice: stop storing XDP verdict within ice_rx_buf
    
    [ Upstream commit 468a1952df78f65c5991b7ac885c8b5b7dd87bab ]
    
    Idea behind having ice_rx_buf::act was to simplify and speed up the Rx
    data path by walking through buffers that were representing cleaned HW
    Rx descriptors. Since it caused us a major headache recently and we
    rolled back to old approach that 'puts' Rx buffers right after running
    XDP prog/creating skb, this is useless now and should be removed.
    
    Get rid of ice_rx_buf::act and related logic. We still need to take care
    of a corner case where XDP program releases a particular fragment.
    
    Make ice_run_xdp() to return its result and use it within
    ice_put_rx_mbuf().
    
    Fixes: 2fba7dc5157b ("ice: Add support for XDP multi-buffer on Rx side")
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iio: light: as73211: fix channel handling in only-color triggered buffer [+ + +]
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Date:   Sat Dec 14 23:55:50 2024 +0100

    iio: light: as73211: fix channel handling in only-color triggered buffer
    
    commit ab09c6cfe01b317f515bcd944668697241a54b9d upstream.
    
    The channel index is off by one unit if AS73211_SCAN_MASK_ALL is not
    set (optimized path for color channel readings), and it must be shifted
    instead of leaving an empty channel for the temperature when it is off.
    
    Once the channel index is fixed, the uninitialized channel must be set
    to zero to avoid pushing uninitialized data.
    
    Add available_scan_masks for all channels and only-color channels to let
    the IIO core demux and repack the enabled channels.
    
    Cc: stable@vger.kernel.org
    Fixes: 403e5586b52e ("iio: light: as73211: New driver")
    Tested-by: Christian Eggers <ceggers@arri.de>
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Link: https://patch.msgid.link/20241214-iio_memset_scan_holes-v4-1-260b395b8ed5@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Input: allocate keycode for phone linking [+ + +]
Author: Illia Ostapyshyn <illia@yshyn.com>
Date:   Thu Nov 14 18:39:29 2024 +0100

    Input: allocate keycode for phone linking
    
    [ Upstream commit 1bebc7869c99d466f819dd2cffaef0edf7d7a035 ]
    
    The F11 key on the new Lenovo Thinkpad T14 Gen 5, T16 Gen 3, and P14s
    Gen 5 laptops includes a symbol showing a smartphone and a laptop
    chained together.  According to the user manual, it starts the Microsoft
    Phone Link software used to connect to Android/iOS devices and relay
    messages/calls or sync data.
    
    As there are no suitable keycodes for this action, introduce a new one.
    
    Signed-off-by: Illia Ostapyshyn <illia@yshyn.com>
    Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Link: https://lore.kernel.org/r/20241114173930.44983-2-illia@yshyn.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>

Input: bbnsm_pwrkey - add remove hook [+ + +]
Author: Peng Fan <peng.fan@nxp.com>
Date:   Thu Dec 12 11:03:22 2024 +0800

    Input: bbnsm_pwrkey - add remove hook
    
    commit 55b75306c3edf369285ce22ba1ced45e335094c2 upstream.
    
    Without remove hook to clear wake irq, there will be kernel dump when
    doing module test.
    "bbnsm_pwrkey 44440000.bbnsm:pwrkey: wake irq already initialized"
    
    Add remove hook to clear wake irq and set wakeup to false.
    
    Signed-off-by: Peng Fan <peng.fan@nxp.com>
    Fixes: 40e40fdfec3f ("Input: bbnsm_pwrkey - add bbnsm power key support")
    Link: https://lore.kernel.org/r/20241212030322.3110017-1-peng.fan@oss.nxp.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/net: don't retry connect operation on EPOLLERR [+ + +]
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Jan 30 08:40:29 2025 -0700

    io_uring/net: don't retry connect operation on EPOLLERR
    
    commit 8c8492ca64e79c6e0f433e8c9d2bcbd039ef83d0 upstream.
    
    If a socket is shutdown before the connection completes, POLLERR is set
    in the poll mask. However, connect ignores this as it doesn't know, and
    attempts the connection again. This may lead to a bogus -ETIMEDOUT
    result, where it should have noticed the POLLERR and just returned
    -ECONNRESET instead.
    
    Have the poll logic check for whether or not POLLERR is set in the mask,
    and if so, mark the request as failed. Then connect can appropriately
    fail the request rather than retry it.
    
    Reported-by: Sergey Galas <ssgalas@cloud.ru>
    Cc: stable@vger.kernel.org
    Link: https://github.com/axboe/liburing/discussions/1335
    Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring: fix multishots with selected buffers [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jan 28 00:55:24 2025 +0000

    io_uring: fix multishots with selected buffers
    
    commit d63b0e8a628e62ca85a0f7915230186bb92f8bb4 upstream.
    
    We do io_kbuf_recycle() when arming a poll but every iteration of a
    multishot can grab more buffers, which is why we need to flush the kbuf
    ring state before continuing with waiting.
    
    Cc: stable@vger.kernel.org
    Fixes: b3fdea6ecb55c ("io_uring: multishot recv")
    Reported-by: Muhammad Ramdhan <ramdhan@starlabs.sg>
    Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
    Reported-by: Jacob Soo <jacob.soo@starlabs.sg>
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/1bfc9990fe435f1fc6152ca9efeba5eb3e68339c.1738025570.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/arm-smmu-qcom: add sdm670 adreno iommu compatible [+ + +]
Author: Richard Acayan <mailingradian@gmail.com>
Date:   Wed Nov 13 19:47:16 2024 -0500

    iommu/arm-smmu-qcom: add sdm670 adreno iommu compatible
    
    [ Upstream commit 42314738906380cbd3b6e9caf3ad34e1b2d66035 ]
    
    Add the compatible for the separate IOMMU on SDM670 for the Adreno GPU.
    
    This IOMMU has the compatible strings:
    
            "qcom,sdm670-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2"
    
    While the SMMU 500 doesn't need an entry for this specific SoC, the
    SMMU v2 compatible should have its own entry, as the fallback entry in
    arm-smmu.c handles "qcom,smmu-v2" without per-process page table support
    unless there is an entry here. This entry can't be the
    "qcom,adreno-smmu" compatible because dedicated GPU IOMMUs can also be
    SMMU 500 with different handling.
    
    Signed-off-by: Richard Acayan <mailingradian@gmail.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241114004713.42404-6-mailingradian@gmail.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/arm-smmu-v3: Clean up more on probe failure [+ + +]
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Thu Dec 5 16:33:57 2024 +0000

    iommu/arm-smmu-v3: Clean up more on probe failure
    
    [ Upstream commit fcbd621567420b3a2f21f49bbc056de8b273c625 ]
    
    kmemleak noticed that the iopf queue allocated deep down within
    arm_smmu_init_structures() can be leaked by a subsequent error return
    from arm_smmu_device_probe(). Furthermore, after arm_smmu_device_reset()
    we will also leave the SMMU enabled with an empty Stream Table, silently
    blocking all DMA. This proves rather annoying for debugging said probe
    failure, so let's handle it a bit better by putting the SMMU back into
    (more or less) the same state as if it hadn't probed at all.
    
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Link: https://lore.kernel.org/r/5137901958471cf67f2fad5c2229f8a8f1ae901a.1733406914.git.robin.murphy@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/tegra241-cmdqv: Read SMMU IDR1.CMDQS instead of hardcoding [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Wed Dec 18 21:14:21 2024 -0800

    iommu/tegra241-cmdqv: Read SMMU IDR1.CMDQS instead of hardcoding
    
    commit e94dc6ddda8dd3770879a132d577accd2cce25f9 upstream.
    
    The hardware limitation "max=19" actually comes from SMMU Command Queue.
    So, it'd be more natural for tegra241-cmdqv driver to read it out rather
    than hardcoding it itself.
    
    This is not an issue yet for a kernel on a baremetal system, but a guest
    kernel setting the queue base/size in form of IPA/gPA might result in a
    noncontiguous queue in the physical address space, if underlying physical
    pages backing up the guest RAM aren't contiguous entirely: e.g. 2MB-page
    backed guest RAM cannot guarantee a contiguous queue if it is 8MB (capped
    to VCMDQ_LOG2SIZE_MAX=19). This might lead to command errors when HW does
    linear-read from a noncontiguous queue memory.
    
    Adding this extra IDR1.CMDQS cap (in the guest kernel) allows VMM to set
    SMMU's IDR1.CMDQS=17 for the case mentioned above, so a guest-level queue
    will be capped to maximum 2MB, ensuring a contiguous queue memory.
    
    Fixes: a3799717b881 ("iommu/tegra241-cmdqv: Fix alignment failure at max_n_shift")
    Reported-by: Ian Kalinowski <ikalinowski@nvidia.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/20241219051421.1850267-1-nicolinc@nvidia.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommufd/fault: Destroy response and mutex in iommufd_fault_destroy() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Tue Jan 14 22:55:59 2025 -0800

    iommufd/fault: Destroy response and mutex in iommufd_fault_destroy()
    
    commit 3f4818ec139030f425476bf8a10b616bab53a7b5 upstream.
    
    Both were missing in the initial patch.
    
    Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
    Link: https://patch.msgid.link/r/bc8bb13e215af27e62ee51bdba3648dd4ed2dce3.1736923732.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
    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/fault: Use a separate spinlock to protect fault->deliver list [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Fri Jan 17 11:29:01 2025 -0800

    iommufd/fault: Use a separate spinlock to protect fault->deliver list
    
    commit 3d49020a327cd7d069059317c11df24e407ccfa3 upstream.
    
    The fault->mutex serializes the fault read()/write() fops and the
    iommufd_fault_auto_response_faults(), mainly for fault->response. Also, it
    was conveniently used to fence the fault->deliver in poll() fop and
    iommufd_fault_iopf_handler().
    
    However, copy_from/to_user() may sleep if pagefaults are enabled. Thus,
    they could take a long time to wait for user pages to swap in, blocking
    iommufd_fault_iopf_handler() and its caller that is typically a shared IRQ
    handler of an IOMMU driver, resulting in a potential global DOS.
    
    Instead of reusing the mutex to protect the fault->deliver list, add a
    separate spinlock, nested under the mutex, to do the job.
    iommufd_fault_iopf_handler() would no longer be blocked by
    copy_from/to_user().
    
    Add a free_list in iommufd_auto_response_faults(), so the spinlock can
    simply fence a fast list_for_each_entry_safe routine.
    
    Provide two deliver list helpers for iommufd_fault_fops_read() to use:
     - Fetch the first iopf_group out of the fault->deliver list
     - Restore an iopf_group back to the head of the fault->deliver list
    
    Lastly, move the mutex closer to the response in the fault structure,
    and update its kdoc accordingly.
    
    Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
    Link: https://patch.msgid.link/r/20250117192901.79491-1-nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    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: Fix struct iommu_hwpt_pgfault init and padding [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jan 20 11:50:51 2025 -0800

    iommufd: Fix struct iommu_hwpt_pgfault init and padding
    
    commit e721f619e3ec9bae08bf419c3944cf1e6966c821 upstream.
    
    The iommu_hwpt_pgfault is used to report IO page fault data to userspace,
    but iommufd_fault_fops_read was never zeroing its padding. This leaks the
    content of the kernel stack memory to userspace.
    
    Also, the iommufd uAPI requires explicit padding and use of __aligned_u64
    to ensure ABI compatibility's with 32 bit.
    
    pahole result, before:
    struct iommu_hwpt_pgfault {
            __u32     flags;                /*     0     4 */
            __u32     dev_id;               /*     4     4 */
            __u32     pasid;                /*     8     4 */
            __u32     grpid;                /*    12     4 */
            __u32     perm;                 /*    16     4 */
    
            /* XXX 4 bytes hole, try to pack */
    
            __u64     addr;                 /*    24     8 */
            __u32     length;               /*    32     4 */
            __u32     cookie;               /*    36     4 */
    
            /* size: 40, cachelines: 1, members: 8 */
            /* sum members: 36, holes: 1, sum holes: 4 */
            /* last cacheline: 40 bytes */
    };
    
    pahole result, after:
    struct iommu_hwpt_pgfault {
            __u32      flags;                /*     0     4 */
            __u32      dev_id;               /*     4     4 */
            __u32      pasid;                /*     8     4 */
            __u32      grpid;                /*    12     4 */
            __u32      perm;                 /*    16     4 */
            __u32      __reserved;           /*    20     4 */
            __u64      addr __attribute__((__aligned__(8))); /*    24     8 */
            __u32      length;               /*    32     4 */
            __u32      cookie;               /*    36     4 */
    
            /* size: 40, cachelines: 1, members: 9 */
            /* forced alignments: 1 */
            /* last cacheline: 40 bytes */
    } __attribute__((__aligned__(8)));
    
    Fixes: c714f15860fc ("iommufd: Add fault and response message definitions")
    Link: https://patch.msgid.link/r/20250120195051.2450-1-nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so [+ + +]
Author: Nick Chan <towinchenmi@gmail.com>
Date:   Sun Jan 19 00:31:42 2025 +0800

    irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so
    
    commit 698244bbb3bfd32ddf9a0b70a12b1c7d69056497 upstream.
    
    The CPU PMU in Apple SoCs can be configured to fire its interrupt in one of
    several ways, and since Apple A11 one of the methods is FIQ, but the check
    of the configuration register fails to test explicitely for FIQ mode. It
    tests whether the IMODE bitfield is zero or not and the PMCRO_IACT bit is
    set. That results in false positives when the IMODE bitfield is not zero,
    but does not have the mode PMCR0_IMODE_FIQ.
    
    Only handle the PMC interrupt as a FIQ when the CPU PMU has been configured
    to fire FIQs, i.e. the IMODE bitfield value is PMCR0_IMODE_FIQ and
    PMCR0_IACT is set.
    
    Fixes: c7708816c944 ("irqchip/apple-aic: Wire PMU interrupts")
    Signed-off-by: Nick Chan <towinchenmi@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250118163554.16733-1-towinchenmi@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data [+ + +]
Author: Stefan Eichenberger <eichest@gmail.com>
Date:   Fri Jan 24 09:50:39 2025 +0100

    irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data
    
    commit 987f379b54091cc1b1db986bde71cee1081350b3 upstream.
    
    mvebu_icu_translate() incorrectly casts irq_domain::host_data directly to
    mvebu_icu_msi_data. However, host_data actually points to a structure of
    type msi_domain_info.
    
    This incorrect cast causes issues such as the thermal sensors of the
    CP110 platform malfunctioning. Specifically, the translation of the SEI
    interrupt to IRQ_TYPE_EDGE_RISING fails, preventing proper interrupt
    handling. The following error was observed:
    
      genirq: Setting trigger mode 4 for irq 85 failed (irq_chip_set_type_parent+0x0/0x34)
      armada_thermal f2400000.system-controller:thermal-sensor@70: Cannot request threaded IRQ 85
    
    Resolve the issue by first casting host_data to msi_domain_info and then
    accessing mvebu_icu_msi_data through msi_domain_info::chip_data.
    
    Fixes: d929e4db22b6 ("irqchip/irq-mvebu-icu: Prepare for real per device MSI")
    Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250124085140.44792-1-eichest@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
irqchip/lan966x-oic: Make CONFIG_LAN966X_OIC depend on CONFIG_MCHP_LAN966X_PCI [+ + +]
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Mon Jan 20 15:35:02 2025 +0100

    irqchip/lan966x-oic: Make CONFIG_LAN966X_OIC depend on CONFIG_MCHP_LAN966X_PCI
    
    [ Upstream commit e06c9e3682f58fbeb632b7b866bb4fe66a4a4b42 ]
    
    The Microchip LAN966x outband interrupt controller is only present on
    Microchip LAN966x SoCs, and only used in PCI endpoint mode.  Hence add a
    dependency on MCHP_LAN966X_PCI, to prevent asking the user about this
    driver when configuring a kernel without Microchip LAN966x PCIe support.
    
    Fixes: 3e3a7b35332924c8 ("irqchip: Add support for LAN966x OIC")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Herve Codina <herve.codina@bootlin.com>
    Link: https://lore.kernel.org/all/28e8a605e72ee45e27f0d06b2b71366159a9c782.1737383314.git.geert+renesas@glider.be
    Signed-off-by: Sasha Levin <sashal@kernel.org>
 
kbuild: Move -Wenum-enum-conversion to W=2 [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Thu Oct 17 10:09:22 2024 -0700

    kbuild: Move -Wenum-enum-conversion to W=2
    
    commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
    
    -Wenum-enum-conversion was strengthened in clang-19 to warn for C, which
    caused the kernel to move it to W=1 in commit 75b5ab134bb5 ("kbuild:
    Move -Wenum-{compare-conditional,enum-conversion} into W=1") because
    there were numerous instances that would break builds with -Werror.
    Unfortunately, this is not a full solution, as more and more developers,
    subsystems, and distributors are building with W=1 as well, so they
    continue to see the numerous instances of this warning.
    
    Since the move to W=1, there have not been many new instances that have
    appeared through various build reports and the ones that have appeared
    seem to be following similar existing patterns, suggesting that most
    instances of this warning will not be real issues. The only alternatives
    for silencing this warning are adding casts (which is generally seen as
    an ugly practice) or refactoring the enums to macro defines or a unified
    enum (which may be undesirable because of type safety in other parts of
    the code).
    
    Move the warning to W=2, where warnings that occur frequently but may be
    relevant should reside.
    
    Cc: stable@vger.kernel.org
    Fixes: 75b5ab134bb5 ("kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1")
    Link: https://lore.kernel.org/ZwRA9SOcOjjLJcpi@google.com/
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KEYS: trusted: dcp: fix improper sg use with CONFIG_VMAP_STACK=y [+ + +]
Author: David Gstir <david@sigma-star.at>
Date:   Wed Nov 13 22:27:54 2024 +0100

    KEYS: trusted: dcp: fix improper sg use with CONFIG_VMAP_STACK=y
    
    commit e8d9fab39d1f87b52932646b2f1e7877aa3fc0f4 upstream.
    
    With vmalloc stack addresses enabled (CONFIG_VMAP_STACK=y) DCP trusted
    keys can crash during en- and decryption of the blob encryption key via
    the DCP crypto driver. This is caused by improperly using sg_init_one()
    with vmalloc'd stack buffers (plain_key_blob).
    
    Fix this by always using kmalloc() for buffers we give to the DCP crypto
    driver.
    
    Cc: stable@vger.kernel.org # v6.10+
    Fixes: 0e28bf61a5f9 ("KEYS: trusted: dcp: fix leak of blob encryption key")
    Signed-off-by: David Gstir <david@sigma-star.at>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kfence: skip __GFP_THISNODE allocations on NUMA systems [+ + +]
Author: Marco Elver <elver@google.com>
Date:   Fri Jan 24 13:01:38 2025 +0100

    kfence: skip __GFP_THISNODE allocations on NUMA systems
    
    commit e64f81946adf68cd75e2207dd9a51668348a4af8 upstream.
    
    On NUMA systems, __GFP_THISNODE indicates that an allocation _must_ be on
    a particular node, and failure to allocate on the desired node will result
    in a failed allocation.
    
    Skip __GFP_THISNODE allocations if we are running on a NUMA system, since
    KFENCE can't guarantee which node its pool pages are allocated on.
    
    Link: https://lkml.kernel.org/r/20250124120145.410066-1-elver@google.com
    Fixes: 236e9f153852 ("kfence: skip all GFP_ZONEMASK allocations")
    Signed-off-by: Marco Elver <elver@google.com>
    Reported-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Chistoph Lameter <cl@linux.com>
    Cc: Dmitriy Vyukov <dvyukov@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ksmbd: fix integer overflows on 32 bit systems [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Jan 15 09:28:35 2025 +0900

    ksmbd: fix integer overflows on 32 bit systems
    
    commit aab98e2dbd648510f8f51b83fbf4721206ccae45 upstream.
    
    On 32bit systems the addition operations in ipc_msg_alloc() can
    potentially overflow leading to memory corruption.
    Add bounds checking using KSMBD_IPC_MAX_PAYLOAD to avoid overflow.
    
    Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: arm64: timer: Always evaluate the need for a soft timer [+ + +]
Author: Marc Zyngier <maz@kernel.org>
Date:   Tue Feb 4 11:00:48 2025 +0000

    KVM: arm64: timer: Always evaluate the need for a soft timer
    
    commit b450dcce93bc2cf6d2bfaf5a0de88a94ebad8f89 upstream.
    
    When updating the interrupt state for an emulated timer, we return
    early and skip the setup of a soft timer that runs in parallel
    with the guest.
    
    While this is OK if we have set the interrupt pending, it is pretty
    wrong if the guest moved CVAL into the future.  In that case,
    no timer is armed and the guest can wait for a very long time
    (it will take a full put/load cycle for the situation to resolve).
    
    This is specially visible with EDK2 running at EL2, but still
    using the EL1 virtual timer, which in that case is fully emulated.
    Any key-press takes ages to be captured, as there is no UART
    interrupt and EDK2 relies on polling from a timer...
    
    The fix is simply to drop the early return. If the timer interrupt
    is pending, we will still return early, and otherwise arm the soft
    timer.
    
    Fixes: 4d74ecfa6458b ("KVM: arm64: Don't arm a hrtimer for an already pending timer")
    Cc: stable@vger.kernel.org
    Tested-by: Dmytro Terletskyi <dmytro_terletskyi@epam.com>
    Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
    Link: https://lore.kernel.org/r/20250204110050.150560-2-maz@kernel.org
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kvm: defer huge page recovery vhost task to later [+ + +]
Author: Keith Busch <kbusch@kernel.org>
Date:   Thu Jan 23 07:35:43 2025 -0800

    kvm: defer huge page recovery vhost task to later
    
    commit 931656b9e2ff7029aee0b36e17780621948a6ac1 upstream.
    
    Some libraries want to ensure they are single threaded before forking,
    so making the kernel's kvm huge page recovery process a vhost task of
    the user process breaks those. The minijail library used by crosvm is
    one such affected application.
    
    Defer the task to after the first VM_RUN call, which occurs after the
    parent process has forked all its jailed processes. This needs to happen
    only once for the kvm instance, so introduce some general-purpose
    infrastructure for that, too.  It's similar in concept to pthread_once;
    except it is actually usable, because the callback takes a parameter.
    
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Tested-by: Alyssa Ross <hi@alyssa.is>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Message-ID: <20250123153543.2769928-1-kbusch@meta.com>
    [Move call_once API to include/linux. - Paolo]
    Cc: stable@vger.kernel.org
    Fixes: d96c77bd4eeb ("KVM: x86: switch hugepage recovery thread to vhost_task")
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: e500: always restore irqs [+ + +]
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Sun Jan 12 10:34:44 2025 +0100

    KVM: e500: always restore irqs
    
    [ Upstream commit 87ecfdbc699cc95fac73291b52650283ddcf929d ]
    
    If find_linux_pte fails, IRQs will not be restored.  This is unlikely
    to happen in practice since it would have been reported as hanging
    hosts, but it should of course be fixed anyway.
    
    Cc: stable@vger.kernel.org
    Reported-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: Explicitly verify target vCPU is online in kvm_get_vcpu() [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed Oct 9 08:04:50 2024 -0700

    KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
    
    commit 1e7381f3617d14b3c11da80ff5f8a93ab14cfc46 upstream.
    
    Explicitly verify the target vCPU is fully online _prior_ to clamping the
    index in kvm_get_vcpu().  If the index is "bad", the nospec clamping will
    generate '0', i.e. KVM will return vCPU0 instead of NULL.
    
    In practice, the bug is unlikely to cause problems, as it will only come
    into play if userspace or the guest is buggy or misbehaving, e.g. KVM may
    send interrupts to vCPU0 instead of dropping them on the floor.
    
    However, returning vCPU0 when it shouldn't exist per online_vcpus is
    problematic now that KVM uses an xarray for the vCPUs array, as KVM needs
    to insert into the xarray before publishing the vCPU to userspace (see
    commit c5b077549136 ("KVM: Convert the kvm->vcpus array to a xarray")),
    i.e. before vCPU creation is guaranteed to succeed.
    
    As a result, incorrectly providing access to vCPU0 will trigger a
    use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu()
    bails out of vCPU creation due to an error and frees vCPU0.  Commit
    afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but
    in doing so introduced an unsolvable teardown conundrum.  Preventing
    accesses to vCPU0 before it's fully online will allow reverting commit
    afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.
    
    Fixes: 1d487e9bf8ba ("KVM: fix spectrev1 gadgets")
    Cc: stable@vger.kernel.org
    Cc: Will Deacon <will@kernel.org>
    Cc: Michal Luczaj <mhal@rbox.co>
    Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
    Acked-by: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20241009150455.1057573-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: PPC: e500: Mark "struct page" dirty in kvmppc_e500_shadow_map() [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Oct 10 11:23:54 2024 -0700

    KVM: PPC: e500: Mark "struct page" dirty in kvmppc_e500_shadow_map()
    
    [ Upstream commit c9be85dabb376299504e0d391d15662c0edf8273 ]
    
    Mark the underlying page as dirty in kvmppc_e500_ref_setup()'s sole
    caller, kvmppc_e500_shadow_map(), which will allow converting e500 to
    __kvm_faultin_pfn() + kvm_release_faultin_page() without having to do
    a weird dance between ref_setup() and shadow_map().
    
    Opportunistically drop the redundant kvm_set_pfn_accessed(), as
    shadow_map() puts the page via kvm_release_pfn_clean().
    
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-ID: <20241010182427.1434605-53-seanjc@google.com>
    Stable-dep-of: 87ecfdbc699c ("KVM: e500: always restore irqs")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: PPC: e500: Mark "struct page" pfn accessed before dropping mmu_lock [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Oct 10 11:23:55 2024 -0700

    KVM: PPC: e500: Mark "struct page" pfn accessed before dropping mmu_lock
    
    [ Upstream commit 84cf78dcd9d65c45ab73998d4ad50f433d53fb93 ]
    
    Mark pages accessed before dropping mmu_lock when faulting in guest memory
    so that shadow_map() can convert to kvm_release_faultin_page() without
    tripping its lockdep assertion on mmu_lock being held.  Marking pages
    accessed outside of mmu_lock is ok (not great, but safe), but marking
    pages _dirty_ outside of mmu_lock can make filesystems unhappy.
    
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-ID: <20241010182427.1434605-54-seanjc@google.com>
    Stable-dep-of: 87ecfdbc699c ("KVM: e500: always restore irqs")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: PPC: e500: Use __kvm_faultin_pfn() to handle page faults [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Oct 10 11:23:56 2024 -0700

    KVM: PPC: e500: Use __kvm_faultin_pfn() to handle page faults
    
    [ Upstream commit 419cfb983ca93e75e905794521afefcfa07988bb ]
    
    Convert PPC e500 to use __kvm_faultin_pfn()+kvm_release_faultin_page(),
    and continue the inexorable march towards the demise of
    kvm_pfn_to_refcounted_page().
    
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-ID: <20241010182427.1434605-55-seanjc@google.com>
    Stable-dep-of: 87ecfdbc699c ("KVM: e500: always restore irqs")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: vsie: fix some corner-cases when grabbing vsie pages [+ + +]
Author: David Hildenbrand <david@redhat.com>
Date:   Tue Jan 7 16:43:41 2025 +0100

    KVM: s390: vsie: fix some corner-cases when grabbing vsie pages
    
    commit 5f230f41fdd9e799f43a699348dc572bca7159aa upstream.
    
    We try to reuse the same vsie page when re-executing the vsie with a
    given SCB address. The result is that we use the same shadow SCB --
    residing in the vsie page -- and can avoid flushing the TLB when
    re-running the vsie on a CPU.
    
    So, when we allocate a fresh vsie page, or when we reuse a vsie page for
    a different SCB address -- reusing the shadow SCB in different context --
    we set ihcpu=0xffff to trigger the flush.
    
    However, after we looked up the SCB address in the radix tree, but before
    we grabbed the vsie page by raising the refcount to 2, someone could reuse
    the vsie page for a different SCB address, adjusting page->index and the
    radix tree. In that case, we would be reusing the vsie page with a
    wrong page->index.
    
    Another corner case is that we might set the SCB address for a vsie
    page, but fail the insertion into the radix tree. Whoever would reuse
    that page would remove the corresponding radix tree entry -- which might
    now be a valid entry pointing at another page, resulting in the wrong
    vsie page getting removed from the radix tree.
    
    Let's handle such races better, by validating that the SCB address of a
    vsie page didn't change after we grabbed it (not reuse for a different
    SCB; the alternative would be performing another tree lookup), and by
    setting the SCB address to invalid until the insertion in the tree
    succeeded (SCB addresses are aligned to 512, so ULONG_MAX is invalid).
    
    These scenarios are rare, the effects a bit unclear, and these issues were
    only found by code inspection. Let's CC stable to be safe.
    
    Fixes: a3508fbe9dc6 ("KVM: s390: vsie: initial support for nested virtualization")
    Cc: stable@vger.kernel.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
    Tested-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
    Message-ID: <20250107154344.1003072-2-david@redhat.com>
    Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86/mmu: Ensure NX huge page recovery thread is alive before waking [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Jan 24 15:46:23 2025 -0800

    KVM: x86/mmu: Ensure NX huge page recovery thread is alive before waking
    
    commit 43fb96ae78551d7bfa4ecca956b258f085d67c40 upstream.
    
    When waking a VM's NX huge page recovery thread, ensure the thread is
    actually alive before trying to wake it.  Now that the thread is spawned
    on-demand during KVM_RUN, a VM without a recovery thread is reachable via
    the related module params.
    
      BUG: kernel NULL pointer dereference, address: 0000000000000040
      #PF: supervisor read access in kernel mode
      #PF: error_code(0x0000) - not-present page
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      RIP: 0010:vhost_task_wake+0x5/0x10
      Call Trace:
       <TASK>
       set_nx_huge_pages+0xcc/0x1e0 [kvm]
       param_attr_store+0x8a/0xd0
       module_attr_store+0x1a/0x30
       kernfs_fop_write_iter+0x12f/0x1e0
       vfs_write+0x233/0x3e0
       ksys_write+0x60/0xd0
       do_syscall_64+0x5b/0x160
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
      RIP: 0033:0x7f3b52710104
       </TASK>
      Modules linked in: kvm_intel kvm
      CR2: 0000000000000040
    
    Fixes: 931656b9e2ff ("kvm: defer huge page recovery vhost task to later")
    Cc: stable@vger.kernel.org
    Cc: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20250124234623.3609069-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
leds: lp8860: Write full EEPROM, not only half of it [+ + +]
Author: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Date:   Thu Nov 14 11:13:59 2024 +0100

    leds: lp8860: Write full EEPROM, not only half of it
    
    commit 0d2e820a86793595e2a776855d04701109e46663 upstream.
    
    I struggle to explain dividing an ARRAY_SIZE() by the size of an element
    once again. As the latter equals to 2, only the half of EEPROM was ever
    written. Drop the unexplainable division and write full ARRAY_SIZE().
    
    Cc: stable@vger.kernel.org
    Fixes: 7a8685accb95 ("leds: lp8860: Introduce TI lp8860 4 channel LED driver")
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
    Link: https://lore.kernel.org/r/20241114101402.2562878-1-alexander.sverdlin@siemens.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.12.14 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Feb 17 10:05:48 2025 +0100

    Linux 6.12.14
    
    Link: https://lore.kernel.org/r/20250213142436.408121546@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Link: https://lore.kernel.org/r/20250214133845.788244691@linuxfoundation.org
    Tested-by: Slade Watkins <srw@sladewatkins.net>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Link: https://lore.kernel.org/r/20250215075701.840225877@linuxfoundation.org
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Slade Watkins <srw@sladewatkins.net>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Kexy Biscuit <kexybiscuit@aosc.io>
    Tested-by: MArk Brown <broonie@kernel.org>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
lockdep: Fix upper limit for LOCKDEP_*_BITS configs [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Thu Oct 24 18:36:26 2024 +0000

    lockdep: Fix upper limit for LOCKDEP_*_BITS configs
    
    [ Upstream commit e638072e61726cae363d48812815197a2a0e097f ]
    
    Lockdep has a set of configs used to determine the size of the static
    arrays that it uses. However, the upper limit that was initially setup
    for these configs is too high (30 bit shift). This equates to several
    GiB of static memory for individual symbols. Using such high values
    leads to linker errors:
    
      $ make defconfig
      $ ./scripts/config -e PROVE_LOCKING --set-val LOCKDEP_BITS 30
      $ make olddefconfig all
      [...]
      ld: kernel image bigger than KERNEL_IMAGE_SIZE
      ld: section .bss VMA wraps around address space
    
    Adjust the upper limits to the maximum values that avoid these issues.
    The need for anything more, likely points to a problem elsewhere. Note
    that LOCKDEP_CHAINS_BITS was intentionally left out as its upper limit
    had a different symptom and has already been fixed [1].
    
    Reported-by: J. R. Okajima <hooanon05g@gmail.com>
    Closes: https://lore.kernel.org/all/30795.1620913191@jrobl/ [1]
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Waiman Long <longman@redhat.com>
    Cc: Will Deacon <will@kernel.org>
    Acked-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Link: https://lore.kernel.org/r/20241024183631.643450-2-cmllamas@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
locking/ww_mutex/test: Use swap() macro [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Wed Jul 31 15:58:51 2024 +0200

    locking/ww_mutex/test: Use swap() macro
    
    [ Upstream commit 0d3547df6934b8f9600630322799a2a76b4567d8 ]
    
    Fixes the following Coccinelle/coccicheck warning reported by
    swap.cocci:
    
      WARNING opportunity for swap()
    
    Compile-tested only.
    
    [Boqun: Add the report tags from Jiapeng and Abaci Robot [1].]
    
    Reported-by: Abaci Robot <abaci@linux.alibaba.com>
    Reported-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
    Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11531
    Link: https://lore.kernel.org/r/20241025081455.55089-1-jiapeng.chong@linux.alibaba.com [1]
    Acked-by: Waiman Long <longman@redhat.com>
    Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
    Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
    Link: https://lore.kernel.org/r/20240731135850.81018-2-thorsten.blum@toblux.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
LoongArch: Extend the maximum number of watchpoints [+ + +]
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
Date:   Sun Jan 26 21:49:59 2025 +0800

    LoongArch: Extend the maximum number of watchpoints
    
    commit 531936dee53e471a3ec668de3c94ca357f54b7e8 upstream.
    
    The maximum number of load/store watchpoints and fetch instruction
    watchpoints is 14 each according to LoongArch Reference Manual, so
    extend the maximum number of watchpoints from 8 to 14 for ptrace.
    
    By the way, just simply change 8 to 14 for the definition in struct
    user_watch_state at the beginning, but it may corrupt uapi, then add
    a new struct user_watch_state_v2 directly.
    
    As far as I can tell, the only users for this struct in the userspace
    are GDB and LLDB, there are no any problems of software compatibility
    between the application and kernel according to the analysis.
    
    The compatibility problem has been considered while developing and
    testing. When the applications in the userspace get watchpoint state,
    the length will be specified which is no bigger than the sizeof struct
    user_watch_state or user_watch_state_v2, the actual length is assigned
    as the minimal value of the application and kernel in the generic code
    of ptrace:
    
    kernel/ptrace.c: ptrace_regset():
    
            kiov->iov_len = min(kiov->iov_len,
                               (__kernel_size_t) (regset->n * regset->size));
    
            if (req == PTRACE_GETREGSET)
                    return copy_regset_to_user(task, view, regset_no, 0,
                                              kiov->iov_len, kiov->iov_base);
            else
                    return copy_regset_from_user(task, view, regset_no, 0,
                                              kiov->iov_len, kiov->iov_base);
    
    For example, there are four kind of combinations, all of them work well.
    
    (1) "older kernel + older gdb", the actual length is 8+(8+8+4+4)*8=200;
    (2) "newer kernel + newer gdb", the actual length is 8+(8+8+4+4)*14=344;
    (3) "older kernel + newer gdb", the actual length is 8+(8+8+4+4)*8=200;
    (4) "newer kernel + older gdb", the actual length is 8+(8+8+4+4)*8=200.
    
    Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers-related-to-watchpoints
    Cc: stable@vger.kernel.org
    Fixes: 1a69f7a161a7 ("LoongArch: ptrace: Expose hardware breakpoints to debuggers")
    Reviewed-by: WANG Xuerui <git@xen0n.name>
    Reviewed-by: Xi Ruoyao <xry111@xry111.site>
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
m68k: vga: Fix I/O defines [+ + +]
Author: Thomas Zimmermann <tzimmermann@suse.de>
Date:   Tue Jan 7 10:58:56 2025 +0100

    m68k: vga: Fix I/O defines
    
    commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
    
    Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results
    in conflicting defines with io_no.h for various I/O macros from the
    __raw_read and __raw_write families. An example error is
    
       In file included from arch/m68k/include/asm/vga.h:12,
                     from include/video/vga.h:22,
                     from include/linux/vgaarb.h:34,
                     from drivers/video/aperture.c:12:
    >> arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
          39 | #define __raw_readb in_8
             |
       In file included from arch/m68k/include/asm/io.h:6,
                        from include/linux/io.h:13,
                        from include/linux/irq.h:20,
                        from include/asm-generic/hardirq.h:17,
                        from ./arch/m68k/include/generated/asm/hardirq.h:1,
                        from include/linux/hardirq.h:11,
                        from include/linux/interrupt.h:11,
                        from include/linux/trace_recursion.h:5,
                        from include/linux/ftrace.h:10,
                        from include/linux/kprobes.h:28,
                        from include/linux/kgdb.h:19,
                        from include/linux/fb.h:6,
                        from drivers/video/aperture.c:5:
       arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
          16 | #define __raw_readb(addr) \
             |
    
    Include <asm/io.h>, which avoids raw_io.h on nommu platforms.
    Also change the defined values of some of the read/write symbols in
    vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not
    generally available.
    
    Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501071629.DNEswlm8-lkp@intel.com/
    Fixes: 5c3f968712ce ("m68k/video: Create <asm/vga.h>")
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: linux-fbdev@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Cc: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org # v3.5+
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/20250107095912.130530-1-tzimmermann@suse.de
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mailbox: tegra-hsp: Clear mailbox before using message [+ + +]
Author: Pekka Pessi <ppessi@nvidia.com>
Date:   Mon Dec 2 15:35:59 2024 +0530

    mailbox: tegra-hsp: Clear mailbox before using message
    
    commit 0b7f8328f988178b55ee11d772a6e1238c04d29d upstream.
    
    The Tegra RCE (Camera) driver expects the mailbox to be empty before
    processing the IVC messages. On RT kernel, the threads processing the
    IVC messages (which are invoked after `mbox_chan_received_data()` is
    called) may be on a different CPU or running with a higher priority
    than the HSP interrupt handler thread. This can cause it to act on the
    message before the mailbox gets cleared in the HSP interrupt handler
    resulting in a loss of IVC notification.
    
    Fix this by clearing the mailbox data register before calling
    `mbox_chan_received_data()`.
    
    Fixes: 8f585d14030d ("mailbox: tegra-hsp: Add tegra_hsp_sm_ops")
    Fixes: 74c20dd0f892 ("mailbox: tegra-hsp: Add 128-bit shared mailbox support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
    Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
    Acked-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mailbox: zynqmp: Remove invalid __percpu annotation in zynqmp_ipi_probe() [+ + +]
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Sat Dec 14 10:12:59 2024 +0100

    mailbox: zynqmp: Remove invalid __percpu annotation in zynqmp_ipi_probe()
    
    commit 170a264d2611a0bfa96b7818730473db5e7546fc upstream.
    
    struct zynqmp_ipi_pdata __percpu *pdata is not a per-cpu variable,
    so it should not be annotated with __percpu annotation.
    
    Remove invalid __percpu annotation to fix several
    
    zynqmp-ipi-mailbox.c:920:15: warning: incorrect type in assignment (different address spaces)
    zynqmp-ipi-mailbox.c:920:15:    expected struct zynqmp_ipi_pdata [noderef] __percpu *pdata
    zynqmp-ipi-mailbox.c:920:15:    got void *
    zynqmp-ipi-mailbox.c:927:56: warning: incorrect type in argument 3 (different address spaces)
    zynqmp-ipi-mailbox.c:927:56:    expected unsigned int [usertype] *out_value
    zynqmp-ipi-mailbox.c:927:56:    got unsigned int [noderef] __percpu *
    ...
    
    and several
    
    drivers/mailbox/zynqmp-ipi-mailbox.c:924:9: warning: dereference of noderef expression
    ...
    
    sparse warnings.
    
    There were no changes in the resulting object file.
    
    Cc: stable@vger.kernel.org
    Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI")
    Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
    Reviewed-by: Michal Simek <michal.simek@amd.com>
    Reviewed-by: Tanmay Shah <tanmay.shah@amd.com>
    Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
maple_tree: simplify split calculation [+ + +]
Author: Wei Yang <richard.weiyang@gmail.com>
Date:   Wed Nov 13 03:16:14 2024 +0000

    maple_tree: simplify split calculation
    
    commit 4f6a6bed0bfef4b966f076f33eb4f5547226056a upstream.
    
    Patch series "simplify split calculation", v3.
    
    
    This patch (of 3):
    
    The current calculation for splitting nodes tries to enforce a minimum
    span on the leaf nodes.  This code is complex and never worked correctly
    to begin with, due to the min value being passed as 0 for all leaves.
    
    The calculation should just split the data as equally as possible
    between the new nodes.  Note that b_end will be one more than the data,
    so the left side is still favoured in the calculation.
    
    The current code may also lead to a deficient node by not leaving enough
    data for the right side of the split. This issue is also addressed with
    the split calculation change.
    
    [Liam.Howlett@Oracle.com: rephrase the change log]
    Link: https://lkml.kernel.org/r/20241113031616.10530-1-richard.weiyang@gmail.com
    Link: https://lkml.kernel.org/r/20241113031616.10530-2-richard.weiyang@gmail.com
    Fixes: 54a611b60590 ("Maple Tree: add new data structure")
    Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
    Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
    Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
    Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Jan 15 09:53:52 2025 +0300

    md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add()
    
    commit 62c552070a980363d55a6082b432ebd1cade7a6e upstream.
    
    The linear_conf() returns error pointers, it doesn't return NULL.  Update
    the error checking to match.
    
    Fixes: 127186cfb184 ("md: reintroduce md-linear")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/add654be-759f-4b2d-93ba-a3726dae380c@stanley.mountain
    Signed-off-by: Song Liu <song@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
md: Fix linear_set_limits() [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Wed Jan 29 14:56:35 2025 -0800

    md: Fix linear_set_limits()
    
    commit a572593ac80e51eb69ecede7e614289fcccdbf8d upstream.
    
    queue_limits_cancel_update() must only be called if
    queue_limits_start_update() is called first. Remove the
    queue_limits_cancel_update() call from linear_set_limits() because
    there is no corresponding queue_limits_start_update() call.
    
    This bug was discovered by annotating all mutex operations with clang
    thread-safety attributes and by building the kernel with clang and
    -Wthread-safety.
    
    Cc: Yu Kuai <yukuai3@huawei.com>
    Cc: Coly Li <colyli@kernel.org>
    Cc: Mike Snitzer <snitzer@kernel.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Fixes: 127186cfb184 ("md: reintroduce md-linear")
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250129225636.2667932-1-bvanassche@acm.org
    Signed-off-by: Song Liu <song@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

md: reintroduce md-linear [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Thu Jan 2 19:28:41 2025 +0800

    md: reintroduce md-linear
    
    commit 127186cfb184eaccdfe948e6da66940cfa03efc5 upstream.
    
    THe md-linear is removed by commit 849d18e27be9 ("md: Remove deprecated
    CONFIG_MD_LINEAR") because it has been marked as deprecated for a long
    time.
    
    However, md-linear is used widely for underlying disks with different size,
    sadly we didn't know this until now, and it's true useful to create
    partitions and assemble multiple raid and then append one to the other.
    
    People have to use dm-linear in this case now, however, they will prefer
    to minimize the number of involved modules.
    
    Fixes: 849d18e27be9 ("md: Remove deprecated CONFIG_MD_LINEAR")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Acked-by: Coly Li <colyli@kernel.org>
    Acked-by: Mike Snitzer <snitzer@kernel.org>
    Link: https://lore.kernel.org/r/20250102112841.1227111-1-yukuai1@huaweicloud.com
    Signed-off-by: Song Liu <song@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
media: ccs: Clean up parsed CCS static data on parse failure [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Tue Dec 3 12:23:01 2024 +0200

    media: ccs: Clean up parsed CCS static data on parse failure
    
    commit da73efa8e675a2b58f1c7ae61201acfe57714bf7 upstream.
    
    ccs_data_parse() releases the allocated in-memory data structure when the
    parser fails, but it does not clean up parsed metadata that is there to
    help access the actual data. Do that, in order to return the data
    structure in a sane state.
    
    Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: ccs: Fix CCS static data parsing for large block sizes [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Tue Dec 3 10:10:23 2024 +0200

    media: ccs: Fix CCS static data parsing for large block sizes
    
    commit 82b696750f0b60e7513082a10ad42786854f59f8 upstream.
    
    The length field of the CCS static data blocks was mishandled, leading to
    wrong interpretation of the length header for blocks that are 16 kiB in
    size. Such large blocks are very, very rare and so this wasn't found
    earlier.
    
    As the length is used as part of input validation, the issue has no
    security implications.
    
    Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: ccs: Fix cleanup order in ccs_probe() [+ + +]
Author: Mehdi Djait <mehdi.djait@linux.intel.com>
Date:   Wed Dec 11 14:30:45 2024 +0100

    media: ccs: Fix cleanup order in ccs_probe()
    
    commit 6fdbff0f54786e94f0f630ff200ec1d666b1633e upstream.
    
    ccs_limits is allocated in ccs_read_all_limits() after the allocation of
    mdata.backing. Ensure that resources are freed in the reverse order of
    their allocation by moving out_free_ccs_limits up.
    
    Fixes: a11d3d6891f0 ("media: ccs: Read CCS static data from firmware binaries")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702 [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Fri Dec 6 10:26:40 2024 +0200

    media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702
    
    commit 42d0ec194aa12e9b97f09a94fe565ba2e5f631a2 upstream.
    
    UB9702 does not have SP and EQ registers, but the driver uses them in
    log_status(). Fix this by separating the SP and EQ related log_status()
    work into a separate function (for clarity) and calling that function
    only for UB960.
    
    Cc: stable@vger.kernel.org
    Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
    Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ds90ub960: Fix UB9702 refclk register access [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Fri Dec 6 10:26:38 2024 +0200

    media: i2c: ds90ub960: Fix UB9702 refclk register access
    
    commit ba3bdb93947c90f098061de1fb2458e2ca040093 upstream.
    
    UB9702 has the refclk freq register at a different offset than UB960,
    but the code uses the UB960's offset for both chips. Fix this.
    
    The refclk freq is only used for a debug print, so there's no functional
    change here.
    
    Cc: stable@vger.kernel.org
    Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
    Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ds90ub960: Fix UB9702 VC map [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Fri Dec 6 10:26:41 2024 +0200

    media: i2c: ds90ub960: Fix UB9702 VC map
    
    commit 5dbbd0609b83f6eb72c005e2e5979d0cd25243c8 upstream.
    
    The driver uses a static CSI-2 virtual channel mapping where all virtual
    channels from an RX port are mapped to a virtual channel number matching
    the RX port number.
    
    The UB960 and UB9702 have different registers for the purpose, and the
    UB9702 version is not correct. Each of the VC_ID_MAP registers do not
    contain a single mapping, as the driver currently thinks, but two.
    
    This can cause received VCs other than 0 to be mapped in a wrong way.
    
    Fix this by writing both mappings to each register.
    
    Cc: stable@vger.kernel.org
    Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
    Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ds90ub960: Fix use of non-existing registers on UB9702 [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Fri Dec 6 10:26:39 2024 +0200

    media: i2c: ds90ub960: Fix use of non-existing registers on UB9702
    
    commit 698cf6df87ffa83f259703e7443c15a4c5ceae86 upstream.
    
    UB9702 doesn't have the registers for SP and EQ. Adjust the code in
    ub960_rxport_wait_locks() to not use those registers for UB9702. As
    these values are only used for a debug print here, there's no functional
    change.
    
    Cc: stable@vger.kernel.org
    Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
    Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: i2c: ds90ub9x3: Fix extra fwnode_handle_put() [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Fri Dec 6 10:26:37 2024 +0200

    media: i2c: ds90ub9x3: Fix extra fwnode_handle_put()
    
    commit 60b45ece41c5632a3a3274115a401cb244180646 upstream.
    
    The ub913 and ub953 drivers call fwnode_handle_put(priv->sd.fwnode) as
    part of their remove process, and if the driver is removed multiple
    times, eventually leads to put "overflow", possibly causing memory
    corruption or crash.
    
    The fwnode_handle_put() is a leftover from commit 905f88ccebb1 ("media:
    i2c: ds90ub9x3: Fix sub-device matching"), which changed the code
    related to the sd.fwnode, but missed removing these fwnode_handle_put()
    calls.
    
    Cc: stable@vger.kernel.org
    Fixes: 905f88ccebb1 ("media: i2c: ds90ub9x3: Fix sub-device matching")
    Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: imx296: Add standby delay during probe [+ + +]
Author: Naushir Patuck <naush@raspberrypi.com>
Date:   Fri Nov 15 20:07:17 2024 +0200

    media: imx296: Add standby delay during probe
    
    commit 57d10bcac67707caaa542e09dee86e13ea85defc upstream.
    
    Add a 2-5ms delay when coming out of standby and before reading the
    sensor info register durning probe, as instructed by the datasheet. This
    standby delay is already present when the sensor starts streaming.
    
    During a cold-boot, reading the IMX296_SENSOR_INFO register would often
    return a value of 0x0000, if this delay is not present before.
    
    Fixes: cb33db2b6ccf ("media: i2c: IMX296 camera sensor driver")
    Cc: stable@vger.kernel.org
    Tested-by: Alexandru Ardelean <aardelean@baylibre.com>
    Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
    Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: intel/ipu6: remove cpu latency qos request on error [+ + +]
Author: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Date:   Wed Dec 11 12:49:05 2024 +0100

    media: intel/ipu6: remove cpu latency qos request on error
    
    commit facb541ff0805314e0b56e508f7d3cbd07af513c upstream.
    
    Fix cpu latency qos list corruption like below. It happens when
    we do not remove cpu latency request on error path and free
    corresponding memory.
    
    [   30.634378] l7 kernel: list_add corruption. prev->next should be next (ffffffff9645e960), but was 0000000100100001. (prev=ffff8e9e877e20a8).
    [   30.634388] l7 kernel: WARNING: CPU: 2 PID: 2008 at lib/list_debug.c:32 __list_add_valid_or_report+0x83/0xa0
    <snip>
    [   30.634640] l7 kernel: Call Trace:
    [   30.634650] l7 kernel:  <TASK>
    [   30.634659] l7 kernel:  ? __list_add_valid_or_report+0x83/0xa0
    [   30.634669] l7 kernel:  ? __warn.cold+0x93/0xf6
    [   30.634678] l7 kernel:  ? __list_add_valid_or_report+0x83/0xa0
    [   30.634690] l7 kernel:  ? report_bug+0xff/0x140
    [   30.634702] l7 kernel:  ? handle_bug+0x58/0x90
    [   30.634712] l7 kernel:  ? exc_invalid_op+0x17/0x70
    [   30.634723] l7 kernel:  ? asm_exc_invalid_op+0x1a/0x20
    [   30.634733] l7 kernel:  ? __list_add_valid_or_report+0x83/0xa0
    [   30.634742] l7 kernel:  plist_add+0xdd/0x140
    [   30.634754] l7 kernel:  pm_qos_update_target+0xa0/0x1f0
    [   30.634764] l7 kernel:  cpu_latency_qos_update_request+0x61/0xc0
    [   30.634773] l7 kernel:  intel_dp_aux_xfer+0x4c7/0x6e0 [i915 1f824655ed04687c2b0d23dbce759fa785f6d033]
    
    Reported-by: Genes Lists <lists@sapience.com>
    Closes: https://lore.kernel.org/linux-media/c0e94be466b367f1a3cfdc3cb7b1a4f47e5953ae.camel@sapience.com/
    Fixes: f50c4ca0a820 ("media: intel/ipu6: add the main input system driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: mc: fix endpoint iteration [+ + +]
Author: Cosmin Tanislav <demonsingur@gmail.com>
Date:   Fri Nov 22 16:55:24 2024 +0200

    media: mc: fix endpoint iteration
    
    commit fb2bd86270cd0ad004f4c614ba4f8c63a5720e25 upstream.
    
    When creating links from a subdev to a sink, the current logic tries to
    iterate over the endpoints of dev's fwnode.
    
    This might not be correct when the subdev uses a different fwnode
    compared to the dev's fwnode.
    
    If, when registering, the subdev's fwnode is not set, the code inside
    v4l2_async_register_subdev will set it to the dev's fwnode.
    
    To fix this, just use the subdev's fwnode.
    
    Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
    Fixes: 0d3c81e82da9 ("media: v4l2-mc: add v4l2_create_fwnode_links helpers")
    Cc: stable@vger.kernel.org
    Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: mmp: Bring back registration of the device [+ + +]
Author: Lubomir Rintel <lkundrak@v3.sk>
Date:   Tue Dec 31 20:04:34 2024 +0100

    media: mmp: Bring back registration of the device
    
    commit fbb5298bf1a7b71723cd2bb193642429ceb0fb84 upstream.
    
    In commit 4af65141e38e ("media: marvell: cafe: Register V4L2 device
    earlier"), a call to v4l2_device_register() was moved away from
    mccic_register() into its caller, marvell/cafe's cafe_pci_probe().
    This is not the only caller though -- there's also marvell/mmp.
    
    Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera
    driver, in a fashion analogous to what's been done to the Cafe driver.
    Same for the teardown path.
    
    Fixes: 4af65141e38e ("media: marvell: cafe: Register V4L2 device earlier")
    Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
    Cc: stable@vger.kernel.org # v6.6+
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: nuvoton: Fix an error check in npcm_video_ece_init() [+ + +]
Author: Zhen Lei <thunder.leizhen@huawei.com>
Date:   Tue Oct 15 09:40:53 2024 +0800

    media: nuvoton: Fix an error check in npcm_video_ece_init()
    
    commit c4b7779abc6633677e6edb79e2809f4f61fde157 upstream.
    
    When function of_find_device_by_node() fails, it returns NULL instead of
    an error code. So the corresponding error check logic should be modified
    to check whether the return value is NULL and set the error code to be
    returned as -ENODEV.
    
    Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
    Link: https://lore.kernel.org/r/20241015014053.669-1-thunder.leizhen@huawei.com
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: ov5640: fix get_light_freq on auto [+ + +]
Author: Sam Bobrowicz <sam@elite-embedded.com>
Date:   Fri Nov 22 09:28:01 2024 +0100

    media: ov5640: fix get_light_freq on auto
    
    commit 001d3753538d26ddcbef011f5643cfff58a7f672 upstream.
    
    Light frequency was not properly returned when in auto
    mode and the detected frequency was 60Hz.
    
    Fixes: 19a81c1426c1 ("[media] add Omnivision OV5640 sensor driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
    Signed-off-by: Michal Simek <michal.simek@amd.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: stm32: dcmipp: correct dma_set_mask_and_coherent mask value [+ + +]
Author: Alain Volmat <alain.volmat@foss.st.com>
Date:   Thu Dec 12 10:17:25 2024 +0100

    media: stm32: dcmipp: correct dma_set_mask_and_coherent mask value
    
    commit b36077ba289b827b4e76e25e8d8e0cc90fa09186 upstream.
    
    Correct the call to dma_set_mask_and_coherent which should be set
    to DMA_BIT_MASK(32).
    
    Fixes: 28e0f3772296 ("media: stm32-dcmipp: STM32 DCMIPP camera interface driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Fix crash during unbind if gpio unit is in use [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Wed Nov 6 20:36:07 2024 +0000

    media: uvcvideo: Fix crash during unbind if gpio unit is in use
    
    commit a9ea1a3d88b7947ce8cadb2afceee7a54872bbc5 upstream.
    
    We used the wrong device for the device managed functions. We used the
    usb device, when we should be using the interface device.
    
    If we unbind the driver from the usb interface, the cleanup functions
    are never called. In our case, the IRQ is never disabled.
    
    If an IRQ is triggered, it will try to access memory sections that are
    already free, causing an OOPS.
    
    We cannot use the function devm_request_threaded_irq here. The devm_*
    clean functions may be called after the main structure is released by
    uvc_delete.
    
    Luckily this bug has small impact, as it is only affected by devices
    with gpio units and the user has to unbind the device, a disconnect will
    not trigger this error.
    
    Cc: stable@vger.kernel.org
    Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
    Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20241106-uvc-crashrmmod-v6-1-fbf9781c6e83@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Fix event flags in uvc_ctrl_send_events [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Thu Nov 14 19:10:30 2024 +0000

    media: uvcvideo: Fix event flags in uvc_ctrl_send_events
    
    commit c31cffd5ae2c3d7ef21d9008977a9d117ce7a64e upstream.
    
    If there is an event that needs the V4L2_EVENT_CTRL_CH_FLAGS flag, all
    the following events will have that flag, regardless if they need it or
    not.
    
    This is because we keep using the same variable all the time and we do
    not reset its original value.
    
    Cc: stable@vger.kernel.org
    Fixes: 805e9b4a06bf ("[media] uvcvideo: Send control change events for slave ctrls when the master changes")
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20241114-uvc-roi-v15-1-64cfeb56b6f8@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Only save async fh if success [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 3 21:20:08 2024 +0000

    media: uvcvideo: Only save async fh if success
    
    commit d9fecd096f67a4469536e040a8a10bbfb665918b upstream.
    
    Now we keep a reference to the active fh for any call to uvc_ctrl_set,
    regardless if it is an actual set or if it is a just a try or if the
    device refused the operation.
    
    We should only keep the file handle if the device actually accepted
    applying the operation.
    
    Cc: stable@vger.kernel.org
    Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
    Suggested-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-1-26c867231118@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Remove dangling pointers [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 3 21:20:10 2024 +0000

    media: uvcvideo: Remove dangling pointers
    
    commit 221cd51efe4565501a3dbf04cc011b537dcce7fb upstream.
    
    When an async control is written, we copy a pointer to the file handle
    that started the operation. That pointer will be used when the device is
    done. Which could be anytime in the future.
    
    If the user closes that file descriptor, its structure will be freed,
    and there will be one dangling pointer per pending async control, that
    the driver will try to use.
    
    Clean all the dangling pointers during release().
    
    To avoid adding a performance penalty in the most common case (no async
    operation), a counter has been introduced with some logic to make sure
    that it is properly handled.
    
    Cc: stable@vger.kernel.org
    Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-3-26c867231118@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Remove redundant NULL assignment [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 3 21:20:09 2024 +0000

    media: uvcvideo: Remove redundant NULL assignment
    
    commit 04d3398f66d2d31c4b8caea88f051a4257b7a161 upstream.
    
    ctrl->handle will only be different than NULL for controls that have
    mappings. This is because that assignment is only done inside
    uvc_ctrl_set() for mapped controls.
    
    Cc: stable@vger.kernel.org
    Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-2-26c867231118@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Support partial control reads [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Thu Nov 28 20:53:41 2024 +0000

    media: uvcvideo: Support partial control reads
    
    commit f00ee2ca8da25ebccb8e19956d853c9055e2c8d0 upstream.
    
    Some cameras, like the ELMO MX-P3, do not return all the bytes
    requested from a control if it can fit in less bytes.
    Eg: Returning 0xab instead of 0x00ab.
    usb 3-9: Failed to query (GET_DEF) UVC control 3 on unit 2: 1 (exp. 2).
    
    Extend the returned value from the camera and return it.
    
    Cc: stable@vger.kernel.org
    Fixes: a763b9fb58be ("media: uvcvideo: Do not return positive errors in uvc_query_ctrl()")
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20241128-uvc-readless-v5-1-cf16ed282af8@chromium.org
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu Nov 14 20:38:08 2024 +0100

    mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id
    
    [ Upstream commit 1e89d21f8189d286f80b900e1b7cf57cb1f3037e ]
    
    On N4100 / N4120 Gemini Lake SoCs the ISA bridge PCI device-id is 31e8
    rather the 3197 found on e.g. the N4000 / N4020.
    
    While at fix the existing GLK PCI-id table entry breaking the table
    being sorted by device-id.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Link: https://lore.kernel.org/r/20241114193808.110132-1-hdegoede@redhat.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mips/math-emu: fix emulation of the prefx instruction [+ + +]
Author: Mateusz Jończyk <mat.jonczyk@o2.pl>
Date:   Sun Jan 5 22:18:06 2025 +0100

    mips/math-emu: fix emulation of the prefx instruction
    
    commit 42a39e4aa59a10aa4afdc14194f3ee63d2db94e1 upstream.
    
    Currently, installation of Debian 12.8 for mipsel fails on machines
    without an FPU [1]. This is caused by the fact that zstd (which is used
    for initramfs compression) executes the prefx instruction, which is not
    emulated properly by the kernel.
    
    The prefx (Prefetch Indexed) instruction fetches data from memory into
    the cache without any side effects. Though functionally unrelated, it
    requires an FPU [2].
    
    Bytecode format of this instruction ends on "001111" binary:
    
            (prefx instruction format) & 0x0000003f = 0x0000000f
    
    The code in fpux_emu() runs like so:
    
            #define MIPSInst(x) x
            #define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000007)
            #define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
            enum cop1x_func { ..., pfetch_op = 0x0f, ... };
    
            ...
    
            switch (MIPSInst_FMA_FFMT(ir)) {
            ...
    
            case 0x3:
                    if (MIPSInst_FUNC(ir) != pfetch_op)
                            return SIGILL;
    
                    /* ignore prefx operation */
                    break;
    
            default:
                    return SIGILL;
            }
    
    That snippet above contains a logic error and the
            if (MIPSInst_FUNC(ir) != pfetch_op)
    comparison always fires.
    
    When MIPSInst_FUNC(ir) is equal to pfetch_op, ir must end on 001111
    binary. In this case, MIPSInst_FMA_FFMT(ir) must be equal to 0x7, which
    does not match that case label.
    
    This causes emulation failure for the prefx instruction. Fix it.
    
    This has been broken by
    commit 919af8b96c89 ("MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manual")
    which modified the MIPSInst_FMA_FFMT macro without updating the users.
    
    Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
    Cc: stable@vger.kernel.org # after 3 weeks
    Cc: Dengcheng Zhu <dzhu@wavecomp.com>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Ming Wang <wangming01@loongson.cn>
    Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
    Fixes: 919af8b96c89 ("MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manual")
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1091858
    [2] MIPS Architecture For Programmers Volume II-A: The MIPS32 Instruction Set
    
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

 
MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static [+ + +]
Author: WangYuli <wangyuli@uniontech.com>
Date:   Sat Jan 4 22:47:08 2025 +0800

    MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
    
    commit ddd068d81445b17ac0bed084dfeb9e58b4df3ddd upstream.
    
    Declare ftrace_get_parent_ra_addr() as static to suppress clang
    compiler warning that 'no previous prototype'. This function is
    not intended to be called from other parts.
    
    Fix follow error with clang-19:
    
    arch/mips/kernel/ftrace.c:251:15: error: no previous prototype for function 'ftrace_get_parent_ra_addr' [-Werror,-Wmissing-prototypes]
      251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
          |               ^
    arch/mips/kernel/ftrace.c:251:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
      251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
          | ^
          | static
    1 error generated.
    
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

MIPS: Loongson64: remove ROM Size unit in boardinfo [+ + +]
Author: Kexy Biscuit <kexybiscuit@aosc.io>
Date:   Sat Jan 11 01:22:08 2025 +0800

    MIPS: Loongson64: remove ROM Size unit in boardinfo
    
    commit bd2212d658d7659b9d83c7e2f3a06789d4db1e90 upstream.
    
    Per Appendix A.7 in Q/LS 0013-2014 (龙芯CPU开发系统固件与内核接口规范 V2.2,
    lit. Loongson DevSys Firmware Kernel Interface Specification V2.2),
    interface_info.size is size of this interface, not size of the LEFI BIOS
    ROM.
    
    In any case, the BIOS ROM Size just cannot be several kilobytes (KB) on
    Loongson64 LEFI platforms.
    
    Reported-by: Mingcong Bai <jeffbai@aosc.io>
    Suggested-by: Icenowy Zheng <uwu@icenowy.me>
    Fixes: 6c1bfbd9df8c ("MIPS: Loongson64: Add /sys/firmware/lefi/boardinfo")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kexy Biscuit <kexybiscuit@aosc.io>
    Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

MIPS: pci-legacy: Override pci_address_to_pio [+ + +]
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date:   Tue Jan 14 18:11:58 2025 +0000

    MIPS: pci-legacy: Override pci_address_to_pio
    
    commit df1b8d6e89db0edd572a1e375f5d3dd5575b9a9b upstream.
    
    pci-legacy systems are not using logic_pio to managed PIO
    allocations, thus the generic pci_address_to_pio won't work
    when PCI_IOBASE is defined.
    
    Override the function to use architecture implementation to
    fix the problem.
    
    Cc: stable@vger.kernel.org
    Fixes: 4bfb53e7d317 ("mips: add <asm-generic/io.h> including")
    Reported-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
    Closes: https://lore.kernel.org/r/99f75c66-4c2d-45dc-a808-b5ba440c7551@app.fastmail.com/
    Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
misc: fastrpc: Deregister device nodes properly in error scenarios [+ + +]
Author: Anandu Krishnan E <quic_anane@quicinc.com>
Date:   Fri Jan 10 13:42:37 2025 +0000

    misc: fastrpc: Deregister device nodes properly in error scenarios
    
    commit 637c20002dc8c347001292664055bfbf56544ec6 upstream.
    
    During fastrpc_rpmsg_probe, if secure device node registration
    succeeds but non-secure device node registration fails, the secure
    device node deregister is not called during error cleanup. Add proper
    exit paths to ensure proper cleanup in case of error.
    
    Fixes: 3abe3ab3cdab ("misc: fastrpc: add secure domain support")
    Cc: stable@kernel.org
    Signed-off-by: Anandu Krishnan E <quic_anane@quicinc.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20250110134239.123603-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: Fix copy buffer page size [+ + +]
Author: Ekansh Gupta <quic_ekangupt@quicinc.com>
Date:   Fri Jan 10 13:42:39 2025 +0000

    misc: fastrpc: Fix copy buffer page size
    
    commit e966eae72762ecfdbdb82627e2cda48845b9dd66 upstream.
    
    For non-registered buffer, fastrpc driver copies the buffer and
    pass it to the remote subsystem. There is a problem with current
    implementation of page size calculation which is not considering
    the offset in the calculation. This might lead to passing of
    improper and out-of-bounds page size which could result in
    memory issue. Calculate page start and page end using the offset
    adjusted address instead of absolute address.
    
    Fixes: 02b45b47fbe8 ("misc: fastrpc: fix remote page size calculation")
    Cc: stable@kernel.org
    Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20250110134239.123603-4-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: Fix registered buffer page address [+ + +]
Author: Ekansh Gupta <quic_ekangupt@quicinc.com>
Date:   Fri Jan 10 13:42:38 2025 +0000

    misc: fastrpc: Fix registered buffer page address
    
    commit 6ca4ea1f88a06a04ed7b2c9c6bf9f00833b68214 upstream.
    
    For registered  buffers, fastrpc driver sends the buffer information
    to remote subsystem. There is a problem with current implementation
    where the page address is being sent with an offset leading to
    improper buffer address on DSP. This is leads to functional failures
    as DSP expects base address in page information and extracts offset
    information from remote arguments. Mask the offset and pass the base
    page address to DSP.
    
    This issue is observed is a corner case when some buffer which is registered
    with fastrpc framework is passed with some offset by user and then the DSP
    implementation tried to read the data. As DSP expects base address and takes
    care of offsetting with remote arguments, passing an offsetted address will
    result in some unexpected data read in DSP.
    
    All generic usecases usually pass the buffer as it is hence is problem is
    not usually observed. If someone tries to pass offsetted buffer and then
    tries to compare data at HLOS and DSP end, then the ambiguity will be observed.
    
    Fixes: 80f3afd72bd4 ("misc: fastrpc: consider address offset before sending to DSP")
    Cc: stable@kernel.org
    Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20250110134239.123603-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors [+ + +]
Author: Vimal Agrawal <vimal.agrawal@sophos.com>
Date:   Mon Oct 21 13:38:12 2024 +0000

    misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors
    
    commit 6d04d2b554b14ae6c428a9c60b6c85f1e5c89f68 upstream.
    
    misc_minor_alloc was allocating id using ida for minor only in case of
    MISC_DYNAMIC_MINOR but misc_minor_free was always freeing ids
    using ida_free causing a mismatch and following warn:
    > > WARNING: CPU: 0 PID: 159 at lib/idr.c:525 ida_free+0x3e0/0x41f
    > > ida_free called for id=127 which is not allocated.
    > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ...
    > > [<60941eb4>] ida_free+0x3e0/0x41f
    > > [<605ac993>] misc_minor_free+0x3e/0xbc
    > > [<605acb82>] misc_deregister+0x171/0x1b3
    
    misc_minor_alloc is changed to allocate id from ida for all minors
    falling in the range of dynamic/ misc dynamic minors
    
    Fixes: ab760791c0cf ("char: misc: Increase the maximum number of dynamic misc devices to 1048448")
    Signed-off-by: Vimal Agrawal <vimal.agrawal@sophos.com>
    Reviewed-by: Dirk VanDerMerwe <dirk.vandermerwe@sophos.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241021133812.23703-1-vimal.agrawal@sophos.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/compaction: fix UBSAN shift-out-of-bounds warning [+ + +]
Author: Liu Shixin <liushixin2@huawei.com>
Date:   Thu Jan 23 10:10:29 2025 +0800

    mm/compaction: fix UBSAN shift-out-of-bounds warning
    
    commit d1366e74342e75555af2648a2964deb2d5c92200 upstream.
    
    syzkaller reported a UBSAN shift-out-of-bounds warning of (1UL << order)
    in isolate_freepages_block().  The bogus compound_order can be any value
    because it is union with flags.  Add back the MAX_PAGE_ORDER check to fix
    the warning.
    
    Link: https://lkml.kernel.org/r/20250123021029.2826736-1-liushixin2@huawei.com
    Fixes: 3da0272a4c7d ("mm/compaction: correctly return failure with bogus compound_order in strict mode")
    Signed-off-by: Liu Shixin <liushixin2@huawei.com>
    Reviewed-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Kemeng Shi <shikemeng@huaweicloud.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Nanyong Sun <sunnanyong@huawei.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/hugetlb: fix avoid_reserve to allow taking folio from subpool [+ + +]
Author: Peter Xu <peterx@redhat.com>
Date:   Tue Jan 7 15:39:56 2025 -0500

    mm/hugetlb: fix avoid_reserve to allow taking folio from subpool
    
    commit 58db7c5fbe7daa42098d4965133a864f98ba90ba upstream.
    
    Patch series "mm/hugetlb: Refactor hugetlb allocation resv accounting",
    v2.
    
    This is a follow up on Ackerley's series here as replacement:
    
    https://lore.kernel.org/r/cover.1728684491.git.ackerleytng@google.com
    
    The goal of this series is to cleanup hugetlb resv accounting, especially
    during folio allocation, to decouple a few things:
    
      - Hugetlb folios v.s. Hugetlbfs: IOW, the hope is in the future hugetlb
        folios can be allocated completely without hugetlbfs.
    
      - Decouple VMA v.s. hugetlb folio allocations: allocating a hugetlb folio
        should not always require a hugetlbfs VMA.  For example, either it got
        allocated from the inode level (see hugetlbfs_fallocate() where it used
        a pesudo VMA for allocation), or it can be allocated by other kernel
        subsystems.
    
    It paves way for other users to allocate hugetlb folios out of either
    system reservations, or subpools (instead of hugetlbfs, as a file system).
    For longer term, this prepares hugetlb as a separate concept versus
    hugetlbfs, so that hugetlb folios can be allocated by not only hugetlbfs
    and other things.
    
    Tests I've done:
    
    - I had a reproducer in patch 1 for the bug I found, this will start to
      work after patch 1 or the whole set applied.
    
    - Hugetlb regression tests (on x86_64 2MBs), includes:
    
      - All vmtests on hugetlbfs
    
      - libhugetlbfs test suite (which may fail some tests, but no new failures
        will be introduced by this series, so all such failures happen before
        this series so shouldn't be relevant).
    
    
    This patch (of 7):
    
    Since commit 04f2cbe35699 ("hugetlb: guarantee that COW faults for a
    process that called mmap(MAP_PRIVATE) on hugetlbfs will succeed"),
    avoid_reserve was introduced for a special case of CoW on hugetlb private
    mappings, and only if the owner VMA is trying to allocate yet another
    hugetlb folio that is not reserved within the private vma reserved map.
    
    Later on, in commit d85f69b0b533 ("mm/hugetlb: alloc_huge_page handle
    areas hole punched by fallocate"), alloc_huge_page() enforced to not
    consume any global reservation as long as avoid_reserve=true.  This
    operation doesn't look correct, because even if it will enforce the
    allocation to not use global reservation at all, it will still try to take
    one reservation from the spool (if the subpool existed).  Then since the
    spool reserved pages take from global reservation, it'll also take one
    reservation globally.
    
    Logically it can cause global reservation to go wrong.
    
    I wrote a reproducer below, trigger this special path, and every run of
    such program will cause global reservation count to increment by one, until
    it hits the number of free pages:
    
      #define _GNU_SOURCE             /* See feature_test_macros(7) */
      #include <stdio.h>
      #include <fcntl.h>
      #include <errno.h>
      #include <unistd.h>
      #include <stdlib.h>
      #include <sys/mman.h>
    
      #define  MSIZE  (2UL << 20)
    
      int main(int argc, char *argv[])
      {
          const char *path;
          int *buf;
          int fd, ret;
          pid_t child;
    
          if (argc < 2) {
              printf("usage: %s <hugetlb_file>\n", argv[0]);
              return -1;
          }
    
          path = argv[1];
    
          fd = open(path, O_RDWR | O_CREAT, 0666);
          if (fd < 0) {
              perror("open failed");
              return -1;
          }
    
          ret = fallocate(fd, 0, 0, MSIZE);
          if (ret != 0) {
              perror("fallocate");
              return -1;
          }
    
          buf = mmap(NULL, MSIZE, PROT_READ|PROT_WRITE,
                     MAP_PRIVATE, fd, 0);
    
          if (buf == MAP_FAILED) {
              perror("mmap() failed");
              return -1;
          }
    
          /* Allocate a page */
          *buf = 1;
    
          child = fork();
          if (child == 0) {
              /* child doesn't need to do anything */
              exit(0);
          }
    
          /* Trigger CoW from owner */
          *buf = 2;
    
          munmap(buf, MSIZE);
          close(fd);
          unlink(path);
    
          return 0;
      }
    
    It can only reproduce with a sub-mount when there're reserved pages on the
    spool, like:
    
      # sysctl vm.nr_hugepages=128
      # mkdir ./hugetlb-pool
      # mount -t hugetlbfs -o min_size=8M,pagesize=2M none ./hugetlb-pool
    
    Then run the reproducer on the mountpoint:
    
      # ./reproducer ./hugetlb-pool/test
    
    Fix it by taking the reservation from spool if available.  In general,
    avoid_reserve is IMHO more about "avoid vma resv map", not spool's.
    
    I copied stable, however I have no intention for backporting if it's not a
    clean cherry-pick, because private hugetlb mapping, and then fork() on top
    is too rare to hit.
    
    Link: https://lkml.kernel.org/r/20250107204002.2683356-1-peterx@redhat.com
    Link: https://lkml.kernel.org/r/20250107204002.2683356-2-peterx@redhat.com
    Fixes: d85f69b0b533 ("mm/hugetlb: alloc_huge_page handle areas hole punched by fallocate")
    Signed-off-by: Peter Xu <peterx@redhat.com>
    Reviewed-by: Ackerley Tng <ackerleytng@google.com>
    Tested-by: Ackerley Tng <ackerleytng@google.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Breno Leitao <leitao@debian.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Roman Gushchin <roman.gushchin@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/hugetlb: fix hugepage allocation for interleaved memory nodes [+ + +]
Author: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Date:   Sat Jan 11 16:36:55 2025 +0530

    mm/hugetlb: fix hugepage allocation for interleaved memory nodes
    
    commit 76e961157e078bc5d3cd2df08317e00b00a829eb upstream.
    
    gather_bootmem_prealloc() assumes the start nid as 0 and size as
    num_node_state(N_MEMORY).  That means in case if memory attached numa
    nodes are interleaved, then gather_bootmem_prealloc_parallel() will fail
    to scan few of these nodes.
    
    Since memory attached numa nodes can be interleaved in any fashion, hence
    ensure that the current code checks for all numa node ids
    (.size = nr_node_ids). Let's still keep max_threads as N_MEMORY, so that
    it can distributes all nr_node_ids among the these many no. threads.
    
    e.g. qemu cmdline
    ========================
    numa_cmd="-numa node,nodeid=1,memdev=mem1,cpus=2-3 -numa node,nodeid=0,cpus=0-1 -numa dist,src=0,dst=1,val=20"
    mem_cmd="-object memory-backend-ram,id=mem1,size=16G"
    
    w/o this patch for cmdline (default_hugepagesz=1GB hugepagesz=1GB hugepages=2):
    ==========================
    ~ # cat /proc/meminfo  |grep -i huge
    AnonHugePages:         0 kB
    ShmemHugePages:        0 kB
    FileHugePages:         0 kB
    HugePages_Total:       0
    HugePages_Free:        0
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:    1048576 kB
    Hugetlb:               0 kB
    
    with this patch for cmdline (default_hugepagesz=1GB hugepagesz=1GB hugepages=2):
    ===========================
    ~ # cat /proc/meminfo |grep -i huge
    AnonHugePages:         0 kB
    ShmemHugePages:        0 kB
    FileHugePages:         0 kB
    HugePages_Total:       2
    HugePages_Free:        2
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:    1048576 kB
    Hugetlb:         2097152 kB
    
    Link: https://lkml.kernel.org/r/f8d8dad3a5471d284f54185f65d575a6aaab692b.1736592534.git.ritesh.list@gmail.com
    Fixes: b78b27d02930 ("hugetlb: parallelize 1G hugetlb initialization")
    Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Reported-by: Pavithra Prakash <pavrampu@linux.ibm.com>
    Suggested-by: Muchun Song <muchun.song@linux.dev>
    Tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Reviewed-by: Luiz Capitulino <luizcap@redhat.com>
    Acked-by: David Rientjes <rientjes@google.com>
    Cc: Donet Tom <donettom@linux.ibm.com>
    Cc: Gang Li <gang.li@linux.dev>
    Cc: Daniel Jordan <daniel.m.jordan@oracle.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/vmscan: accumulate nr_demoted for accurate demotion statistics [+ + +]
Author: Li Zhijian <lizhijian@fujitsu.com>
Date:   Fri Jan 10 20:21:32 2025 +0800

    mm/vmscan: accumulate nr_demoted for accurate demotion statistics
    
    commit a479b078fddb0ad7f9e3c6da22d9cf8f2b5c7799 upstream.
    
    In shrink_folio_list(), demote_folio_list() can be called 2 times.
    Currently stat->nr_demoted will only store the last nr_demoted( the later
    nr_demoted is always zero, the former nr_demoted will get lost), as a
    result number of demoted pages is not accurate.
    
    Accumulate the nr_demoted count across multiple calls to
    demote_folio_list(), ensuring accurate reporting of demotion statistics.
    
    [lizhijian@fujitsu.com: introduce local nr_demoted to fix nr_reclaimed double counting]
      Link: https://lkml.kernel.org/r/20250111015253.425693-1-lizhijian@fujitsu.com
    Link: https://lkml.kernel.org/r/20250110122133.423481-1-lizhijian@fujitsu.com
    Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
    Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
    Acked-by: Kaiyang Zhao <kaiyang2@cs.cmu.edu>
    Tested-by: Donet Tom <donettom@linux.ibm.com>
    Reviewed-by: Donet Tom <donettom@linux.ibm.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: gup: fix infinite loop within __get_longterm_locked [+ + +]
Author: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
Date:   Tue Jan 21 10:01:59 2025 +0800

    mm: gup: fix infinite loop within __get_longterm_locked
    
    commit 1aaf8c122918aa8897605a9aa1e8ed6600d6f930 upstream.
    
    We can run into an infinite loop in __get_longterm_locked() when
    collect_longterm_unpinnable_folios() finds only folios that are isolated
    from the LRU or were never added to the LRU.  This can happen when all
    folios to be pinned are never added to the LRU, for example when
    vm_ops->fault allocated pages using cma_alloc() and never added them to
    the LRU.
    
    Fix it by simply taking a look at the list in the single caller, to see if
    anything was added.
    
    [zhaoyang.huang@unisoc.com: move definition of local]
      Link: https://lkml.kernel.org/r/20250122012604.3654667-1-zhaoyang.huang@unisoc.com
    Link: https://lkml.kernel.org/r/20250121020159.3636477-1-zhaoyang.huang@unisoc.com
    Fixes: 67e139b02d99 ("mm/gup.c: refactor check_and_migrate_movable_pages()")
    Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
    Reviewed-by: John Hubbard <jhubbard@nvidia.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Suggested-by: David Hildenbrand <david@redhat.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Cc: Aijun Sun <aijun.sun@unisoc.com>
    Cc: Alistair Popple <apopple@nvidia.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: kmemleak: fix upper boundary check for physical address objects [+ + +]
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Mon Jan 27 18:42:33 2025 +0000

    mm: kmemleak: fix upper boundary check for physical address objects
    
    commit 488b5b9eca68497b533ced059be5eff19578bbca upstream.
    
    Memblock allocations are registered by kmemleak separately, based on their
    physical address.  During the scanning stage, it checks whether an object
    is within the min_low_pfn and max_low_pfn boundaries and ignores it
    otherwise.
    
    With the recent addition of __percpu pointer leak detection (commit
    6c99d4eb7c5e ("kmemleak: enable tracking for percpu pointers")), kmemleak
    started reporting leaks in setup_zone_pageset() and
    setup_per_cpu_pageset().  These were caused by the node_data[0] object
    (initialised in alloc_node_data()) ending on the PFN_PHYS(max_low_pfn)
    boundary.  The non-strict upper boundary check introduced by commit
    84c326299191 ("mm: kmemleak: check physical address when scan") causes the
    pg_data_t object to be ignored (not scanned) and the __percpu pointers it
    contains to be reported as leaks.
    
    Make the max_low_pfn upper boundary check strict when deciding whether to
    ignore a physical address object and not scan it.
    
    Link: https://lkml.kernel.org/r/20250127184233.2974311-1-catalin.marinas@arm.com
    Fixes: 84c326299191 ("mm: kmemleak: check physical address when scan")
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Reported-by: Jakub Kicinski <kuba@kernel.org>
    Tested-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Cc: Patrick Wang <patrick.wang.shcn@gmail.com>
    Cc: <stable@vger.kernel.org>    [6.0.x]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mmc: core: Respect quirk_max_rate for non-UHS SDIO card [+ + +]
Author: Shawn Lin <shawn.lin@rock-chips.com>
Date:   Fri Nov 22 17:37:22 2024 +0800

    mmc: core: Respect quirk_max_rate for non-UHS SDIO card
    
    [ Upstream commit a2a44f8da29352f76c99c6904ee652911b8dc7dd ]
    
    The card-quirk was added to limit the clock-rate for a card with UHS-mode
    support, although let's respect the quirk for non-UHS mode too, to make the
    behaviour consistent.
    
    Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
    Message-ID: <1732268242-72799-1-git-send-email-shawn.lin@rock-chips.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-esdhc-imx: enable 'SDHCI_QUIRK_NO_LED' quirk for S32G [+ + +]
Author: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
Date:   Mon Nov 25 10:33:56 2024 +0200

    mmc: sdhci-esdhc-imx: enable 'SDHCI_QUIRK_NO_LED' quirk for S32G
    
    [ Upstream commit 0202dfbdc5dea70e213205aa42ab49a1a08aad3a ]
    
    Enable SDHCI_QUIRK_NO_LED quirk for S32G2/S32G3 variants as the controller
    does not have a LED signal line.
    
    Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
    Message-ID: <20241125083357.1041949-1-ciprianmarian.costea@oss.nxp.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-msm: Correctly set the load for the regulator [+ + +]
Author: Yuanjie Yang <quic_yuanjiey@quicinc.com>
Date:   Tue Jan 14 16:35:14 2025 +0800

    mmc: sdhci-msm: Correctly set the load for the regulator
    
    [ Upstream commit 20a0c37e44063997391430c4ae09973e9cbc3911 ]
    
    Qualcomm regulator supports two power supply modes: HPM and LPM.
    Currently, the sdhci-msm.c driver does not set the load to adjust
    the current for eMMC and SD. If the regulator dont't set correct
    load in LPM state, it will lead to the inability to properly
    initialize eMMC and SD.
    
    Set the correct regulator current for eMMC and SD to ensure that the
    device can work normally even when the regulator is in LPM.
    
    Signed-off-by: Yuanjie Yang <quic_yuanjiey@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20250114083514.258379-1-quic_yuanjiey@quicinc.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mptcp: prevent excessive coalescing on receive [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Mon Dec 30 19:12:32 2024 +0100

    mptcp: prevent excessive coalescing on receive
    
    commit 56b824eb49d6258aa0bad09a406ceac3f643cdae upstream.
    
    Currently the skb size after coalescing is only limited by the skb
    layout (the skb must not carry frag_list). A single coalesced skb
    covering several MSS can potentially fill completely the receive
    buffer. In such a case, the snd win will zero until the receive buffer
    will be empty again, affecting tput badly.
    
    Fixes: 8268ed4c9d19 ("mptcp: introduce and use mptcp_try_coalesce()")
    Cc: stable@vger.kernel.org # please delay 2 weeks after 6.13-final release
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241230-net-mptcp-rbuf-fixes-v1-3-8608af434ceb@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mtd: onenand: Fix uninitialized retlen in do_otp_read() [+ + +]
Author: Ivan Stepchenko <sid@itb.spb.ru>
Date:   Thu Nov 14 16:29:51 2024 +0300

    mtd: onenand: Fix uninitialized retlen in do_otp_read()
    
    commit 70a71f8151b9879b0950668ce3ad76263261fee0 upstream.
    
    The function do_otp_read() does not set the output parameter *retlen,
    which is expected to contain the number of bytes actually read.
    As a result, in onenand_otp_walk(), the tmp_retlen variable remains
    uninitialized after calling do_otp_walk() and used to change
    the values of the buf, len and retlen variables.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 49dc08eeda70 ("[MTD] [OneNAND] fix numerous races")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/mlx5: use do_aux_work for PHC overflow checks [+ + +]
Author: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Date:   Tue Jan 7 02:48:12 2025 -0800

    net/mlx5: use do_aux_work for PHC overflow checks
    
    [ Upstream commit e61e6c415ba9ff2b32bb6780ce1b17d1d76238f1 ]
    
    The overflow_work is using system wq to do overflow checks and updates
    for PHC device timecounter, which might be overhelmed by other tasks.
    But there is dedicated kthread in PTP subsystem designed for such
    things. This patch changes the work queue to proper align with PTP
    subsystem and to avoid overloading system work queue.
    The adjfine() function acts the same way as overflow check worker,
    we can postpone ptp aux worker till the next overflow period after
    adjfine() was called.
    
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
    Acked-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://patch.msgid.link/20250107104812.380225-1-vadfed@meta.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/ncsi: wait for the last response to Deselect Package before configuring channel [+ + +]
Author: Paul Fertser <fercerpav@gmail.com>
Date:   Thu Jan 16 18:29:00 2025 +0300

    net/ncsi: wait for the last response to Deselect Package before configuring channel
    
    commit 6bb194d036c6e1b329dcdff459338cdd9a54802a upstream.
    
    The NCSI state machine as it's currently implemented assumes that
    transition to the next logical state is performed either explicitly by
    calling `schedule_work(&ndp->work)` to re-queue itself or implicitly
    after processing the predefined (ndp->pending_req_num) number of
    replies. Thus to avoid the configuration FSM from advancing prematurely
    and getting out of sync with the process it's essential to not skip
    waiting for a reply.
    
    This patch makes the code wait for reception of the Deselect Package
    response for the last package probed before proceeding to channel
    configuration.
    
    Thanks go to Potin Lai and Cosmo Chou for the initial investigation and
    testing.
    
    Fixes: 8e13f70be05e ("net/ncsi: Probe single packages to avoid conflict")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Fertser <fercerpav@gmail.com>
    Link: https://patch.msgid.link/20250116152900.8656-1-fercerpav@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net: atlantic: fix warning during hot unplug [+ + +]
Author: Jacob Moroni <mail@jakemoroni.com>
Date:   Mon Feb 3 09:36:05 2025 -0500

    net: atlantic: fix warning during hot unplug
    
    [ Upstream commit 028676bb189ed6d1b550a0fc570a9d695b6acfd3 ]
    
    Firmware deinitialization performs MMIO accesses which are not
    necessary if the device has already been removed. In some cases,
    these accesses happen via readx_poll_timeout_atomic which ends up
    timing out, resulting in a warning at hw_atl2_utils_fw.c:112:
    
    [  104.595913] Call Trace:
    [  104.595915]  <TASK>
    [  104.595918]  ? show_regs+0x6c/0x80
    [  104.595923]  ? __warn+0x8d/0x150
    [  104.595925]  ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic]
    [  104.595934]  ? report_bug+0x182/0x1b0
    [  104.595938]  ? handle_bug+0x6e/0xb0
    [  104.595940]  ? exc_invalid_op+0x18/0x80
    [  104.595942]  ? asm_exc_invalid_op+0x1b/0x20
    [  104.595944]  ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic]
    [  104.595952]  ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic]
    [  104.595959]  aq_nic_deinit.part.0+0xbd/0xf0 [atlantic]
    [  104.595964]  aq_nic_deinit+0x17/0x30 [atlantic]
    [  104.595970]  aq_ndev_close+0x2b/0x40 [atlantic]
    [  104.595975]  __dev_close_many+0xad/0x160
    [  104.595978]  dev_close_many+0x99/0x170
    [  104.595979]  unregister_netdevice_many_notify+0x18b/0xb20
    [  104.595981]  ? __call_rcu_common+0xcd/0x700
    [  104.595984]  unregister_netdevice_queue+0xc6/0x110
    [  104.595986]  unregister_netdev+0x1c/0x30
    [  104.595988]  aq_pci_remove+0xb1/0xc0 [atlantic]
    
    Fix this by skipping firmware deinitialization altogether if the
    PCI device is no longer present.
    
    Tested with an AQC113 attached via Thunderbolt by performing
    repeated unplug cycles while traffic was running via iperf.
    
    Fixes: 97bde5c4f909 ("net: ethernet: aquantia: Support for NIC-specific code")
    Signed-off-by: Jacob Moroni <mail@jakemoroni.com>
    Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250203143604.24930-3-mail@jakemoroni.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: bcmgenet: Correct overlaying of PHY and MAC Wake-on-LAN [+ + +]
Author: Florian Fainelli <florian.fainelli@broadcom.com>
Date:   Wed Jan 29 15:13:42 2025 -0800

    net: bcmgenet: Correct overlaying of PHY and MAC Wake-on-LAN
    
    [ Upstream commit 46ded709232344b5750a852747a8881763c721ab ]
    
    Some Wake-on-LAN modes such as WAKE_FILTER may only be supported by the MAC,
    while others might be only supported by the PHY. Make sure that the .get_wol()
    returns the union of both rather than only that of the PHY if the PHY supports
    Wake-on-LAN.
    
    When disabling Wake-on-LAN, make sure that this is done at both the PHY
    and MAC level, rather than doing an early return from the PHY driver.
    
    Fixes: 7e400ff35cbe ("net: bcmgenet: Add support for PHY-based Wake-on-LAN")
    Fixes: 9ee09edc05f2 ("net: bcmgenet: Properly overlay PHY and MAC Wake-on-LAN capabilities")
    Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Link: https://patch.msgid.link/20250129231342.35013-1-florian.fainelli@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: ti: am65-cpsw: ensure proper channel cleanup in error path [+ + +]
Author: Roger Quadros <rogerq@kernel.org>
Date:   Fri Jan 17 16:06:33 2025 +0200

    net: ethernet: ti: am65-cpsw: ensure proper channel cleanup in error path
    
    [ Upstream commit 681eb2beb3efe21e630bcc4881595e3b42dd7948 ]
    
    We are missing netif_napi_del() and am65_cpsw_nuss_free_tx/rx_chns()
    in error path when am65_cpsw_nuss_init_tx/rx_chns() is used anywhere
    other than at probe(). i.e. am65_cpsw_nuss_update_tx_rx_chns and
    am65_cpsw_nuss_resume()
    
    As reported, in am65_cpsw_nuss_update_tx_rx_chns(),
    if am65_cpsw_nuss_init_tx_chns() partially fails then
    devm_add_action(dev, am65_cpsw_nuss_free_tx_chns,..) is added
    but the cleanup via am65_cpsw_nuss_free_tx_chns() will not run.
    
    Same issue exists for am65_cpsw_nuss_init_tx/rx_chns() failures
    in am65_cpsw_nuss_resume() as well.
    
    This would otherwise require more instances of devm_add/remove_action
    and is clearly more of a distraction than any benefit.
    
    So, drop devm_add/remove_action for am65_cpsw_nuss_free_tx/rx_chns()
    and call am65_cpsw_nuss_free_tx/rx_chns() and netif_napi_del()
    where required.
    
    Reported-by: Siddharth Vadapalli <s-vadapalli@ti.com>
    Closes: https://lore.kernel.org/all/m4rhkzcr7dlylxr54udyt6lal5s2q4krrvmyay6gzgzhcu4q2c@r34snfumzqxy/
    Signed-off-by: Roger Quadros <rogerq@kernel.org>
    Link: https://patch.msgid.link/20250117-am65-cpsw-streamline-v2-1-91a29c97e569@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset [+ + +]
Author: Milos Reljin <milos_reljin@outlook.com>
Date:   Fri Jan 24 10:41:02 2025 +0000

    net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
    
    commit bd1bbab717608757cccbbe08b0d46e6c3ed0ced5 upstream.
    
    In application note (AN13663) for TJA1120, on page 30, there's a figure
    with average PHY startup timing values following software reset.
    The time it takes for SMI to become operational after software reset
    ranges roughly from 500 us to 1500 us.
    
    This commit adds 2000 us delay after MDIO write which triggers software
    reset. Without this delay, soft_reset function returns an error and
    prevents successful PHY init.
    
    Cc: stable@vger.kernel.org
    Fixes: b050f2f15e04 ("phy: nxp-c45: add driver for tja1103")
    Signed-off-by: Milos Reljin <milos_reljin@outlook.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/AM8P250MB0124D258E5A71041AF2CC322E1E32@AM8P250MB0124.EURP250.PROD.OUTLOOK.COM
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: rose: lock the socket in rose_bind() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Feb 3 17:08:38 2025 +0000

    net: rose: lock the socket in rose_bind()
    
    [ Upstream commit a1300691aed9ee852b0a9192e29e2bdc2411a7e6 ]
    
    syzbot reported a soft lockup in rose_loopback_timer(),
    with a repro calling bind() from multiple threads.
    
    rose_bind() must lock the socket to avoid this issue.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+7ff41b5215f0c534534e@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/67a0f78d.050a0220.d7c5a.00a0.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Link: https://patch.msgid.link/20250203170838.3521361-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sched: Fix truncation of offloaded action statistics [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Tue Feb 4 14:38:39 2025 +0200

    net: sched: Fix truncation of offloaded action statistics
    
    [ Upstream commit 811b8f534fd85e17077bd2ac0413bcd16cc8fb9b ]
    
    In case of tc offload, when user space queries the kernel for tc action
    statistics, tc will query the offloaded statistics from device drivers.
    Among other statistics, drivers are expected to pass the number of
    packets that hit the action since the last query as a 64-bit number.
    
    Unfortunately, tc treats the number of packets as a 32-bit number,
    leading to truncation and incorrect statistics when the number of
    packets since the last query exceeds 0xffffffff:
    
    $ tc -s filter show dev swp2 ingress
    filter protocol all pref 1 flower chain 0
    filter protocol all pref 1 flower chain 0 handle 0x1
      skip_sw
      in_hw in_hw_count 1
            action order 1: mirred (Egress Redirect to device swp1) stolen
            index 1 ref 1 bind 1 installed 58 sec used 0 sec
            Action statistics:
            Sent 1133877034176 bytes 536959475 pkt (dropped 0, overlimits 0 requeues 0)
    [...]
    
    According to the above, 2111-byte packets were redirected which is
    impossible as only 64-byte packets were transmitted and the MTU was
    1500.
    
    Fix by treating packets as a 64-bit number:
    
    $ tc -s filter show dev swp2 ingress
    filter protocol all pref 1 flower chain 0
    filter protocol all pref 1 flower chain 0 handle 0x1
      skip_sw
      in_hw in_hw_count 1
            action order 1: mirred (Egress Redirect to device swp1) stolen
            index 1 ref 1 bind 1 installed 61 sec used 0 sec
            Action statistics:
            Sent 1370624380864 bytes 21416005951 pkt (dropped 0, overlimits 0 requeues 0)
    [...]
    
    Which shows that only 64-byte packets were redirected (1370624380864 /
    21416005951 = 64).
    
    Fixes: 380407023526 ("net/sched: Enable netdev drivers to update statistics of offloaded actions")
    Reported-by: Joe Botha <joe@atomic.ac>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250204123839.1151804-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: wwan: iosm: Fix hibernation by re-binding the driver around it [+ + +]
Author: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Date:   Thu Jan 9 00:33:50 2025 +0100

    net: wwan: iosm: Fix hibernation by re-binding the driver around it
    
    [ Upstream commit 0b6f6593aa8c3a05f155c12fd0e7ad33a5149c31 ]
    
    Currently, the driver is seriously broken with respect to the
    hibernation (S4): after image restore the device is back into
    IPC_MEM_EXEC_STAGE_BOOT (which AFAIK means bootloader stage) and needs
    full re-launch of the rest of its firmware, but the driver restore
    handler treats the device as merely sleeping and just sends it a
    wake-up command.
    
    This wake-up command times out but device nodes (/dev/wwan*) remain
    accessible.
    However attempting to use them causes the bootloader to crash and
    enter IPC_MEM_EXEC_STAGE_CD_READY stage (which apparently means "a crash
    dump is ready").
    
    It seems that the device cannot be re-initialized from this crashed
    stage without toggling some reset pin (on my test platform that's
    apparently what the device _RST ACPI method does).
    
    While it would theoretically be possible to rewrite the driver to tear
    down the whole MUX / IPC layers on hibernation (so the bootloader does
    not crash from improper access) and then re-launch the device on
    restore this would require significant refactoring of the driver
    (believe me, I've tried), since there are quite a few assumptions
    hard-coded in the driver about the device never being partially
    de-initialized (like channels other than devlink cannot be closed,
    for example).
    Probably this would also need some programming guide for this hardware.
    
    Considering that the driver seems orphaned [1] and other people are
    hitting this issue too [2] fix it by simply unbinding the PCI driver
    before hibernation and re-binding it after restore, much like
    USB_QUIRK_RESET_RESUME does for USB devices that exhibit a similar
    problem.
    
    Tested on XMM7360 in HP EliteBook 855 G7 both with s2idle (which uses
    the existing suspend / resume handlers) and S4 (which uses the new code).
    
    [1]: https://lore.kernel.org/all/c248f0b4-2114-4c61-905f-466a786bdebb@leemhuis.info/
    [2]:
    https://github.com/xmm7360/xmm7360-pci/issues/211#issuecomment-1804139413
    
    Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
    Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
    Link: https://patch.msgid.link/e60287ebdb0ab54c4075071b72568a40a75d0205.1736372610.git.mail@maciej.szmigiero.name
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netem: Update sch->q.qlen before qdisc_tree_reduce_backlog() [+ + +]
Author: Cong Wang <cong.wang@bytedance.com>
Date:   Mon Feb 3 16:58:40 2025 -0800

    netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
    
    [ Upstream commit 638ba5089324796c2ee49af10427459c2de35f71 ]
    
    qdisc_tree_reduce_backlog() notifies parent qdisc only if child
    qdisc becomes empty, therefore we need to reduce the backlog of the
    child qdisc before calling it. Otherwise it would miss the opportunity
    to call cops->qlen_notify(), in the case of DRR, it resulted in UAF
    since DRR uses ->qlen_notify() to maintain its active list.
    
    Fixes: f8d4bc455047 ("net/sched: netem: account for backlog updates from child qdisc")
    Cc: Martin Ottens <martin.ottens@fau.de>
    Reported-by: Mingi Cho <mincho@theori.io>
    Signed-off-by: Cong Wang <cong.wang@bytedance.com>
    Link: https://patch.msgid.link/20250204005841.223511-4-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFC: nci: Add bounds checking in nci_hci_create_pipe() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Fri Jan 17 12:38:41 2025 +0300

    NFC: nci: Add bounds checking in nci_hci_create_pipe()
    
    commit 110b43ef05342d5a11284cc8b21582b698b4ef1c upstream.
    
    The "pipe" variable is a u8 which comes from the network.  If it's more
    than 127, then it results in memory corruption in the caller,
    nci_hci_connect_gate().
    
    Cc: stable@vger.kernel.org
    Fixes: a1b0b9415817 ("NFC: nci: Create pipe on specific gate in nci_hci_connect_gate")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://patch.msgid.link/bcf5453b-7204-4297-9c20-4d8c7dacf586@stanley.mountain
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nfs: Make NFS_FSCACHE select NETFS_SUPPORT instead of depending on it [+ + +]
Author: Dragan Simic <dsimic@manjaro.org>
Date:   Fri Dec 27 20:17:58 2024 +0100

    nfs: Make NFS_FSCACHE select NETFS_SUPPORT instead of depending on it
    
    commit 90190ba1c3b11687e2c251fda1f5d9893b4bab17 upstream.
    
    Having the NFS_FSCACHE option depend on the NETFS_SUPPORT options makes
    selecting NFS_FSCACHE impossible unless another option that additionally
    selects NETFS_SUPPORT is already selected.
    
    As a result, for example, being able to reach and select the NFS_FSCACHE
    option requires the CEPH_FS or CIFS option to be selected beforehand, which
    obviously doesn't make much sense.
    
    Let's correct this by making the NFS_FSCACHE option actually select the
    NETFS_SUPPORT option, instead of depending on it.
    
    Fixes: 915cd30cdea8 ("netfs, fscache: Combine fscache with netfs")
    Cc: stable@vger.kernel.org
    Reported-by: Diederik de Haas <didi.debian@cknow.org>
    Signed-off-by: Dragan Simic <dsimic@manjaro.org>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NFSD: Encode COMPOUND operation status on page boundaries [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon Dec 30 19:28:52 2024 -0500

    NFSD: Encode COMPOUND operation status on page boundaries
    
    commit ef3675b45bcb6c17cabbbde620c6cea52ffb21ac upstream.
    
    J. David reports an odd corruption of a READDIR reply sent to a
    FreeBSD client.
    
    xdr_reserve_space() has to do a special trick when the @nbytes value
    requests more space than there is in the current page of the XDR
    buffer.
    
    In that case, xdr_reserve_space() returns a pointer to the start of
    the next page, and then the next call to xdr_reserve_space() invokes
    __xdr_commit_encode() to copy enough of the data item back into the
    previous page to make that data item contiguous across the page
    boundary.
    
    But we need to be careful in the case where buffer space is reserved
    early for a data item whose value will be inserted into the buffer
    later.
    
    One such caller, nfsd4_encode_operation(), reserves 8 bytes in the
    encoding buffer for each COMPOUND operation. However, a READDIR
    result can sometimes encode file names so that there are only 4
    bytes left at the end of the current XDR buffer page (though plenty
    of pages are left to handle the remaining encoding tasks).
    
    If a COMPOUND operation follows the READDIR result (say, a GETATTR),
    then nfsd4_encode_operation() will reserve 8 bytes for the op number
    (9) and the op status (usually NFS4_OK). In this weird case,
    xdr_reserve_space() returns a pointer to byte zero of the next buffer
    page, as it assumes the data item will be copied back into place (in
    the previous page) on the next call to xdr_reserve_space().
    
    nfsd4_encode_operation() writes the op num into the buffer, then
    saves the next 4-byte location for the op's status code. The next
    xdr_reserve_space() call is part of GETATTR encoding, so the op num
    gets copied back into the previous page, but the saved location for
    the op status continues to point to the wrong spot in the current
    XDR buffer page because __xdr_commit_encode() moved that data item.
    
    After GETATTR encoding is complete, nfsd4_encode_operation() writes
    the op status over the first XDR data item in the GETATTR result.
    The NFS4_OK status code (0) makes it look like there are zero items
    in the GETATTR's attribute bitmask.
    
    The patch description of commit 2825a7f90753 ("nfsd4: allow encoding
    across page boundaries") [2014] remarks that NFSD "can't handle a
    new operation starting close to the end of a page." This bug appears
    to be one reason for that remark.
    
    Reported-by: J David <j.david.lists@gmail.com>
    Closes: https://lore.kernel.org/linux-nfs/3998d739-c042-46b4-8166-dbd6c5f0e804@oracle.com/T/#t
    Tested-by: Rick Macklem <rmacklem@uoguelph.ca>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nilfs2: fix possible int overflows in nilfs_fiemap() [+ + +]
Author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Date:   Sat Jan 25 07:20:53 2025 +0900

    nilfs2: fix possible int overflows in nilfs_fiemap()
    
    commit 6438ef381c183444f7f9d1de18f22661cba1e946 upstream.
    
    Since nilfs_bmap_lookup_contig() in nilfs_fiemap() calculates its result
    by being prepared to go through potentially maxblocks == INT_MAX blocks,
    the value in n may experience an overflow caused by left shift of blkbits.
    
    While it is extremely unlikely to occur, play it safe and cast right hand
    expression to wider type to mitigate the issue.
    
    Found by Linux Verification Center (linuxtesting.org) with static analysis
    tool SVACE.
    
    Link: https://lkml.kernel.org/r/20250124222133.5323-1-konishi.ryusuke@gmail.com
    Fixes: 622daaff0a89 ("nilfs2: fiemap support")
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@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>

 
nvkm/gsp: correctly advance the read pointer of GSP message queue [+ + +]
Author: Zhi Wang <zhiw@nvidia.com>
Date:   Thu Oct 17 00:19:20 2024 -0700

    nvkm/gsp: correctly advance the read pointer of GSP message queue
    
    [ Upstream commit 8d9beb4aebc02c4bd09e1d39c9c5f1c68c786dbc ]
    
    A GSP event message consists three parts: message header, RPC header,
    message body. GSP calculates the number of pages to write from the
    total size of a GSP message. This behavior can be observed from the
    movement of the write pointer.
    
    However, nvkm takes only the size of RPC header and message body as
    the message size when advancing the read pointer. When handling a
    two-page GSP message in the non rollback case, It wrongly takes the
    message body of the previous message as the message header of the next
    message. As the "message length" tends to be zero, in the calculation of
    size needs to be copied (0 - size of (message header)), the size needs to
    be copied will be "0xffffffxx". It also triggers a kernel panic due to a
    NULL pointer error.
    
    [  547.614102] msg: 00000f90: ff ff ff ff ff ff ff ff 40 d7 18 fb 8b 00 00 00  ........@.......
    [  547.622533] msg: 00000fa0: 00 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00  ................
    [  547.630965] msg: 00000fb0: ff ff ff ff ff ff ff ff 00 00 00 00 ff ff ff ff  ................
    [  547.639397] msg: 00000fc0: ff ff ff ff 00 00 00 00 ff ff ff ff ff ff ff ff  ................
    [  547.647832] nvkm 0000:c1:00.0: gsp: peek msg rpc fn:0 len:0x0/0xffffffffffffffe0
    [  547.655225] nvkm 0000:c1:00.0: gsp: get msg rpc fn:0 len:0x0/0xffffffffffffffe0
    [  547.662532] BUG: kernel NULL pointer dereference, address: 0000000000000020
    [  547.669485] #PF: supervisor read access in kernel mode
    [  547.674624] #PF: error_code(0x0000) - not-present page
    [  547.679755] PGD 0 P4D 0
    [  547.682294] Oops: 0000 [#1] PREEMPT SMP NOPTI
    [  547.686643] CPU: 22 PID: 322 Comm: kworker/22:1 Tainted: G            E      6.9.0-rc6+ #1
    [  547.694893] Hardware name: ASRockRack 1U1G-MILAN/N/ROMED8-NL, BIOS L3.12E 09/06/2022
    [  547.702626] Workqueue: events r535_gsp_msgq_work [nvkm]
    [  547.707921] RIP: 0010:r535_gsp_msg_recv+0x87/0x230 [nvkm]
    [  547.713375] Code: 00 8b 70 08 48 89 e1 31 d2 4c 89 f7 e8 12 f5 ff ff 48 89 c5 48 85 c0 0f 84 cf 00 00 00 48 81 fd 00 f0 ff ff 0f 87 c4 00 00 00 <8b> 55 10 41 8b 46 30 85 d2 0f 85 f6 00 00 00 83 f8 04 76 10 ba 05
    [  547.732119] RSP: 0018:ffffabe440f87e10 EFLAGS: 00010203
    [  547.737335] RAX: 0000000000000010 RBX: 0000000000000008 RCX: 000000000000003f
    [  547.744461] RDX: 0000000000000000 RSI: ffffabe4480a8030 RDI: 0000000000000010
    [  547.751585] RBP: 0000000000000010 R08: 0000000000000000 R09: ffffabe440f87bb0
    [  547.758707] R10: ffffabe440f87dc8 R11: 0000000000000010 R12: 0000000000000000
    [  547.765834] R13: 0000000000000000 R14: ffff9351df1e5000 R15: 0000000000000000
    [  547.772958] FS:  0000000000000000(0000) GS:ffff93708eb00000(0000) knlGS:0000000000000000
    [  547.781035] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  547.786771] CR2: 0000000000000020 CR3: 00000003cc220002 CR4: 0000000000770ef0
    [  547.793896] PKRU: 55555554
    [  547.796600] Call Trace:
    [  547.799046]  <TASK>
    [  547.801152]  ? __die+0x20/0x70
    [  547.804211]  ? page_fault_oops+0x75/0x170
    [  547.808221]  ? print_hex_dump+0x100/0x160
    [  547.812226]  ? exc_page_fault+0x64/0x150
    [  547.816152]  ? asm_exc_page_fault+0x22/0x30
    [  547.820341]  ? r535_gsp_msg_recv+0x87/0x230 [nvkm]
    [  547.825184]  r535_gsp_msgq_work+0x42/0x50 [nvkm]
    [  547.829845]  process_one_work+0x196/0x3d0
    [  547.833861]  worker_thread+0x2fc/0x410
    [  547.837613]  ? __pfx_worker_thread+0x10/0x10
    [  547.841885]  kthread+0xdf/0x110
    [  547.845031]  ? __pfx_kthread+0x10/0x10
    [  547.848775]  ret_from_fork+0x30/0x50
    [  547.852354]  ? __pfx_kthread+0x10/0x10
    [  547.856097]  ret_from_fork_asm+0x1a/0x30
    [  547.860019]  </TASK>
    [  547.862208] Modules linked in: nvkm(E) gsp_log(E) snd_seq_dummy(E) snd_hrtimer(E) snd_seq(E) snd_timer(E) snd_seq_device(E) snd(E) soundcore(E) rfkill(E) qrtr(E) vfat(E) fat(E) ipmi_ssif(E) amd_atl(E) intel_rapl_msr(E) intel_rapl_common(E) amd64_edac(E) mlx5_ib(E) edac_mce_amd(E) kvm_amd(E) ib_uverbs(E) kvm(E) ib_core(E) acpi_ipmi(E) ipmi_si(E) ipmi_devintf(E) mxm_wmi(E) joydev(E) rapl(E) ptdma(E) i2c_piix4(E) acpi_cpufreq(E) wmi_bmof(E) pcspkr(E) k10temp(E) ipmi_msghandler(E) xfs(E) libcrc32c(E) ast(E) i2c_algo_bit(E) drm_shmem_helper(E) crct10dif_pclmul(E) drm_kms_helper(E) ahci(E) crc32_pclmul(E) nvme_tcp(E) libahci(E) nvme(E) crc32c_intel(E) nvme_fabrics(E) cdc_ether(E) nvme_core(E) usbnet(E) mlx5_core(E) ghash_clmulni_intel(E) drm(E) libata(E) ccp(E) mii(E) t10_pi(E) mlxfw(E) sp5100_tco(E) psample(E) pci_hyperv_intf(E) wmi(E) dm_multipath(E) sunrpc(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) be2iscsi(E) bnx2i(E) cnic(E) uio(E) cxgb4i(E) cxgb4(E) tls(E) libcxgbi(E) libcxgb(E) qla4xxx(E)
    [  547.862283]  iscsi_boot_sysfs(E) iscsi_tcp(E) libiscsi_tcp(E) libiscsi(E) scsi_transport_iscsi(E) fuse(E) [last unloaded: gsp_log(E)]
    [  547.962691] CR2: 0000000000000020
    [  547.966003] ---[ end trace 0000000000000000 ]---
    [  549.012012] clocksource: Long readout interval, skipping watchdog check: cs_nsec: 1370499158 wd_nsec: 1370498904
    [  549.043676] pstore: backend (erst) writing error (-28)
    [  549.050924] RIP: 0010:r535_gsp_msg_recv+0x87/0x230 [nvkm]
    [  549.056389] Code: 00 8b 70 08 48 89 e1 31 d2 4c 89 f7 e8 12 f5 ff ff 48 89 c5 48 85 c0 0f 84 cf 00 00 00 48 81 fd 00 f0 ff ff 0f 87 c4 00 00 00 <8b> 55 10 41 8b 46 30 85 d2 0f 85 f6 00 00 00 83 f8 04 76 10 ba 05
    [  549.075138] RSP: 0018:ffffabe440f87e10 EFLAGS: 00010203
    [  549.080361] RAX: 0000000000000010 RBX: 0000000000000008 RCX: 000000000000003f
    [  549.087484] RDX: 0000000000000000 RSI: ffffabe4480a8030 RDI: 0000000000000010
    [  549.094609] RBP: 0000000000000010 R08: 0000000000000000 R09: ffffabe440f87bb0
    [  549.101733] R10: ffffabe440f87dc8 R11: 0000000000000010 R12: 0000000000000000
    [  549.108857] R13: 0000000000000000 R14: ffff9351df1e5000 R15: 0000000000000000
    [  549.115982] FS:  0000000000000000(0000) GS:ffff93708eb00000(0000) knlGS:0000000000000000
    [  549.124061] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  549.129807] CR2: 0000000000000020 CR3: 00000003cc220002 CR4: 0000000000770ef0
    [  549.136940] PKRU: 55555554
    [  549.139653] Kernel panic - not syncing: Fatal exception
    [  549.145054] Kernel Offset: 0x18c00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
    [  549.165074] ---[ end Kernel panic - not syncing: Fatal exception ]---
    
    Also, nvkm wrongly advances the read pointer when handling a two-page GSP
    message in the rollback case. In the rollback case, the GSP message will
    be copied in two rounds. When handling a two-page GSP message, nvkm first
    copies amount of (GSP_PAGE_SIZE - header) data into the buffer, then
    advances the read pointer by the result of DIV_ROUND_UP(size,
    GSP_PAGE_SIZE). Thus, the read pointer is advanced by 1.
    
    Next, nvkm copies the amount of (total size - (GSP_PAGE_SIZE -
    header)) data into the buffer. The left amount of the data will be always
    larger than one page since the message header is not taken into account
    in the first copy. Thus, the read pointer is advanced by DIV_ROUND_UP(
    size(larger than one page), GSP_PAGE_SIZE) = 2.
    
    In the end, the read pointer is wrongly advanced by 3 when handling a
    two-page GSP message in the rollback case.
    
    Fix the problems by taking the total size of the message into account
    when advancing the read pointer and calculate the read pointer in the end
    of the all copies for the rollback case.
    
    BTW: the two-page GSP message can be observed in the msgq when vGPU is
    enabled.
    
    Signed-off-by: Zhi Wang <zhiw@nvidia.com>
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241017071922.2518724-2-zhiw@nvidia.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvkm: correctly calculate the available space of the GSP cmdq buffer [+ + +]
Author: Zhi Wang <zhiw@nvidia.com>
Date:   Thu Oct 17 00:19:21 2024 -0700

    nvkm: correctly calculate the available space of the GSP cmdq buffer
    
    [ Upstream commit 01ed662bdd6fce4f59c1804b334610d710d79fa0 ]
    
    r535_gsp_cmdq_push() waits for the available page in the GSP cmdq
    buffer when handling a large RPC request. When it sees at least one
    available page in the cmdq, it quits the waiting with the amount of
    free buffer pages in the queue.
    
    Unfortunately, it always takes the [write pointer, buf_size) as
    available buffer pages before rolling back and wrongly calculates the
    size of the data should be copied. Thus, it can overwrite the RPC
    request that GSP is currently reading, which causes GSP hang due
    to corrupted RPC request:
    
    [  549.209389] ------------[ cut here ]------------
    [  549.214010] WARNING: CPU: 8 PID: 6314 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:116 r535_gsp_msgq_wait+0xd0/0x190 [nvkm]
    [  549.225678] Modules linked in: nvkm(E+) gsp_log(E) snd_seq_dummy(E) snd_hrtimer(E) snd_seq(E) snd_timer(E) snd_seq_device(E) snd(E) soundcore(E) rfkill(E) qrtr(E) vfat(E) fat(E) ipmi_ssif(E) amd_atl(E) intel_rapl_msr(E) intel_rapl_common(E) mlx5_ib(E) amd64_edac(E) edac_mce_amd(E) kvm_amd(E) ib_uverbs(E) kvm(E) ib_core(E) acpi_ipmi(E) ipmi_si(E) mxm_wmi(E) ipmi_devintf(E) rapl(E) i2c_piix4(E) wmi_bmof(E) joydev(E) ptdma(E) acpi_cpufreq(E) k10temp(E) pcspkr(E) ipmi_msghandler(E) xfs(E) libcrc32c(E) ast(E) i2c_algo_bit(E) crct10dif_pclmul(E) drm_shmem_helper(E) nvme_tcp(E) crc32_pclmul(E) ahci(E) drm_kms_helper(E) libahci(E) nvme_fabrics(E) crc32c_intel(E) nvme(E) cdc_ether(E) mlx5_core(E) nvme_core(E) usbnet(E) drm(E) libata(E) ccp(E) ghash_clmulni_intel(E) mii(E) t10_pi(E) mlxfw(E) sp5100_tco(E) psample(E) pci_hyperv_intf(E) wmi(E) dm_multipath(E) sunrpc(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) be2iscsi(E) bnx2i(E) cnic(E) uio(E) cxgb4i(E) cxgb4(E) tls(E) libcxgbi(E) libcxgb(E) qla4xxx(E)
    [  549.225752]  iscsi_boot_sysfs(E) iscsi_tcp(E) libiscsi_tcp(E) libiscsi(E) scsi_transport_iscsi(E) fuse(E) [last unloaded: gsp_log(E)]
    [  549.326293] CPU: 8 PID: 6314 Comm: insmod Tainted: G            E      6.9.0-rc6+ #1
    [  549.334039] Hardware name: ASRockRack 1U1G-MILAN/N/ROMED8-NL, BIOS L3.12E 09/06/2022
    [  549.341781] RIP: 0010:r535_gsp_msgq_wait+0xd0/0x190 [nvkm]
    [  549.347343] Code: 08 00 00 89 da c1 e2 0c 48 8d ac 11 00 10 00 00 48 8b 0c 24 48 85 c9 74 1f c1 e0 0c 4c 8d 6d 30 83 e8 30 89 01 e9 68 ff ff ff <0f> 0b 49 c7 c5 92 ff ff ff e9 5a ff ff ff ba ff ff ff ff be c0 0c
    [  549.366090] RSP: 0018:ffffacbccaaeb7d0 EFLAGS: 00010246
    [  549.371315] RAX: 0000000000000000 RBX: 0000000000000012 RCX: 0000000000923e28
    [  549.378451] RDX: 0000000000000000 RSI: 0000000055555554 RDI: ffffacbccaaeb730
    [  549.385590] RBP: 0000000000000001 R08: ffff8bd14d235f70 R09: ffff8bd14d235f70
    [  549.392721] R10: 0000000000000002 R11: ffff8bd14d233864 R12: 0000000000000020
    [  549.399854] R13: ffffacbccaaeb818 R14: 0000000000000020 R15: ffff8bb298c67000
    [  549.406988] FS:  00007f5179244740(0000) GS:ffff8bd14d200000(0000) knlGS:0000000000000000
    [  549.415076] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  549.420829] CR2: 00007fa844000010 CR3: 00000001567dc005 CR4: 0000000000770ef0
    [  549.427963] PKRU: 55555554
    [  549.430672] Call Trace:
    [  549.433126]  <TASK>
    [  549.435233]  ? __warn+0x7f/0x130
    [  549.438473]  ? r535_gsp_msgq_wait+0xd0/0x190 [nvkm]
    [  549.443426]  ? report_bug+0x18a/0x1a0
    [  549.447098]  ? handle_bug+0x3c/0x70
    [  549.450589]  ? exc_invalid_op+0x14/0x70
    [  549.454430]  ? asm_exc_invalid_op+0x16/0x20
    [  549.458619]  ? r535_gsp_msgq_wait+0xd0/0x190 [nvkm]
    [  549.463565]  r535_gsp_msg_recv+0x46/0x230 [nvkm]
    [  549.468257]  r535_gsp_rpc_push+0x106/0x160 [nvkm]
    [  549.473033]  r535_gsp_rpc_rm_ctrl_push+0x40/0x130 [nvkm]
    [  549.478422]  nvidia_grid_init_vgpu_types+0xbc/0xe0 [nvkm]
    [  549.483899]  nvidia_grid_init+0xb1/0xd0 [nvkm]
    [  549.488420]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  549.493213]  nvkm_device_pci_probe+0x305/0x420 [nvkm]
    [  549.498338]  local_pci_probe+0x46/0xa0
    [  549.502096]  pci_call_probe+0x56/0x170
    [  549.505851]  pci_device_probe+0x79/0xf0
    [  549.509690]  ? driver_sysfs_add+0x59/0xc0
    [  549.513702]  really_probe+0xd9/0x380
    [  549.517282]  __driver_probe_device+0x78/0x150
    [  549.521640]  driver_probe_device+0x1e/0x90
    [  549.525746]  __driver_attach+0xd2/0x1c0
    [  549.529594]  ? __pfx___driver_attach+0x10/0x10
    [  549.534045]  bus_for_each_dev+0x78/0xd0
    [  549.537893]  bus_add_driver+0x112/0x210
    [  549.541750]  driver_register+0x5c/0x120
    [  549.545596]  ? __pfx_nvkm_init+0x10/0x10 [nvkm]
    [  549.550224]  do_one_initcall+0x44/0x300
    [  549.554063]  ? do_init_module+0x23/0x240
    [  549.557989]  do_init_module+0x64/0x240
    
    Calculate the available buffer page before rolling back based on
    the result from the waiting.
    
    Signed-off-by: Zhi Wang <zhiw@nvidia.com>
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241017071922.2518724-3-zhiw@nvidia.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-fc: use ctrl state getter [+ + +]
Author: Daniel Wagner <wagi@kernel.org>
Date:   Tue Jan 28 17:34:47 2025 +0100

    nvme-fc: use ctrl state getter
    
    [ Upstream commit c8ed6cb5d37bc09c7e25e49a670e9fd1a3bd1dfa ]
    
    Do not access the state variable directly, instead use proper
    synchronization so not stale data is read.
    
    Fixes: e6e7f7ac03e4 ("nvme: ensure reset state check ordering")
    Signed-off-by: Daniel Wagner <wagi@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-pci: Add TUXEDO IBP Gen9 to Samsung sleep quirk [+ + +]
Author: Georg Gottleuber <ggo@tuxedocomputers.com>
Date:   Mon Dec 16 23:28:04 2024 +0100

    nvme-pci: Add TUXEDO IBP Gen9 to Samsung sleep quirk
    
    commit 11cb3529d18514f7d28ad2190533192aedefd761 upstream.
    
    On the TUXEDO InfinityBook Pro Gen9 Intel, a Samsung 990 Evo NVMe leads to
    a high power consumption in s2idle sleep (4 watts).
    
    This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with
    a lower power consumption, typically around 1.2 watts.
    
    Signed-off-by: Georg Gottleuber <ggo@tuxedocomputers.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvme-pci: Add TUXEDO InfinityFlex to Samsung sleep quirk [+ + +]
Author: Georg Gottleuber <ggo@tuxedocomputers.com>
Date:   Mon Dec 16 23:28:03 2024 +0100

    nvme-pci: Add TUXEDO InfinityFlex to Samsung sleep quirk
    
    commit dbf2bb1a1319b7c7d8828905378a6696cca6b0f2 upstream.
    
    On the TUXEDO InfinityFlex, a Samsung 990 Evo NVMe leads to a high power
    consumption in s2idle sleep (4 watts).
    
    This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with
    a lower power consumption, typically around 1.4 watts.
    
    Signed-off-by: Georg Gottleuber <ggo@tuxedocomputers.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvme: handle connectivity loss in nvme_set_queue_count [+ + +]
Author: Daniel Wagner <wagi@kernel.org>
Date:   Thu Jan 9 14:30:48 2025 +0100

    nvme: handle connectivity loss in nvme_set_queue_count
    
    [ Upstream commit 294b2b7516fd06a8dd82e4a6118f318ec521e706 ]
    
    When the set feature attempts fails with any NVME status code set in
    nvme_set_queue_count, the function still report success. Though the
    numbers of queues set to 0. This is done to support controllers in
    degraded state (the admin queue is still up and running but no IO
    queues).
    
    Though there is an exception. When nvme_set_features reports an host
    path error, nvme_set_queue_count should propagate this error as the
    connectivity is lost, which means also the admin queue is not working
    anymore.
    
    Fixes: 9a0be7abb62f ("nvme: refactor set_queue_count")
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Daniel Wagner <wagi@kernel.org>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nvme: make nvme_tls_attrs_group static [+ + +]
Author: Keith Busch <kbusch@kernel.org>
Date:   Tue Jan 28 07:22:31 2025 -0800

    nvme: make nvme_tls_attrs_group static
    
    [ Upstream commit 2d1a2dab95cdc6f2e0c6af3c0514b0bea94af482 ]
    
    To suppress the compiler "warning: symbol 'nvme_tls_attrs_group' was not
    declared. Should it be static?"
    
    Fixes: 1e48b34c9bc79a ("nvme: split off TLS sysfs attributes into a separate group")
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvmem: core: improve range check for nvmem_cell_write() [+ + +]
Author: Jennifer Berringer <jberring@redhat.com>
Date:   Mon Dec 30 14:19:01 2024 +0000

    nvmem: core: improve range check for nvmem_cell_write()
    
    commit 31507fc2ad36e0071751a710449db19c85d82a7f upstream.
    
    When __nvmem_cell_entry_write() is called for an nvmem cell that does
    not need bit shifting, it requires that the len parameter exactly
    matches the nvmem cell size. However, when the nvmem cell has a nonzero
    bit_offset, it was skipping this check.
    
    Accepting values of len larger than the cell size results in
    nvmem_cell_prepare_write_buffer() trying to write past the end of a heap
    buffer that it allocates. Add a check to avoid that problem and instead
    return -EINVAL when len doesn't match the number of bits expected by the
    nvmem cell when bit_offset is nonzero.
    
    This check uses cell->nbits in order to allow providing the smaller size
    to cells that are shifted into another byte by bit_offset. For example,
    a cell with nbits=8 and nonzero bit_offset would have bytes=2 but should
    accept a 1-byte write here, although no current callers depend on this.
    
    Fixes: 69aba7948cbe ("nvmem: Add a simple NVMEM framework for consumers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jennifer Berringer <jberring@redhat.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-7-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvmem: imx-ocotp-ele: fix MAC address byte order [+ + +]
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Dec 30 14:18:58 2024 +0000

    nvmem: imx-ocotp-ele: fix MAC address byte order
    
    commit 391b06ecb63e6eacd054582cb4eb738dfbf5eb77 upstream.
    
    According to the i.MX93 Fusemap the two MAC addresses are stored in
    words 315 to 317 like this:
    
    315     MAC1_ADDR_31_0[31:0]
    316     MAC1_ADDR_47_32[47:32]
            MAC2_ADDR_15_0[15:0]
    317     MAC2_ADDR_47_16[31:0]
    
    This means the MAC addresses are stored in reverse byte order. We have
    to swap the bytes before passing them to the upper layers. The storage
    format is consistent to the one used on i.MX6 using imx-ocotp driver
    which does the same byte swapping as introduced here.
    
    With this patch the MAC address on my i.MX93 TQ board correctly reads as
    00:d0:93:6b:27:b8 instead of b8:27:6b:93:d0:00.
    
    Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-4-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvmem: imx-ocotp-ele: fix reading from non zero offset [+ + +]
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Dec 30 14:18:57 2024 +0000

    nvmem: imx-ocotp-ele: fix reading from non zero offset
    
    commit 3c9e2cb6cecf65f7501004038c5d1ed85fb7db84 upstream.
    
    In imx_ocotp_reg_read() the offset comes in as bytes and not as words.
    This means we have to divide offset by 4 to get to the correct word
    offset.
    
    Also the incoming offset might not be word aligned. In order to read
    from the OCOTP the driver aligns down the previous word boundary and
    reads from there. This means we have to skip this alignment offset from
    the temporary buffer when copying the data to the output buffer.
    
    Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvmem: imx-ocotp-ele: set word length to 1 [+ + +]
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Dec 30 14:18:59 2024 +0000

    nvmem: imx-ocotp-ele: set word length to 1
    
    commit 1b2cb4d0b5b6a9d9fe78470704309ec75f8a1c3a upstream.
    
    The ELE hardware internally has a word length of 4. However, among other
    things we store MAC addresses in the ELE OCOTP. With a length of 6 bytes
    these are naturally unaligned to the word length. Therefore we must
    support unaligned reads in reg_read() and indeed it works properly when
    reg_read() is called via nvmem_reg_read(). Setting the word size to 4
    has the only visible effect that doing unaligned reads from userspace
    via bin_attr_nvmem_read() do not work because they are rejected by that
    function.
    
    Given that we have to abstract from word accesses to byte accesses in
    the driver, set the word size to 1. This allows bytewise accesses from
    userspace to be able to test what the driver has to support anyway.
    
    Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-5-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvmem: imx-ocotp-ele: simplify read beyond device check [+ + +]
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Dec 30 14:18:56 2024 +0000

    nvmem: imx-ocotp-ele: simplify read beyond device check
    
    commit 343aa1e289e8e3dba5e3d054c4eb27da7b4e1ecc upstream.
    
    Do the read beyond device check on function entry in bytes instead of
    32bit words which is easier to follow.
    
    Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nvmem: qcom-spmi-sdam: Set size in struct nvmem_config [+ + +]
Author: Luca Weiss <luca.weiss@fairphone.com>
Date:   Mon Dec 30 14:19:00 2024 +0000

    nvmem: qcom-spmi-sdam: Set size in struct nvmem_config
    
    commit e88f516ea417c71bb3702603ac6af9e95338cfa6 upstream.
    
    Let the nvmem core know what size the SDAM is, most notably this fixes
    the size of /sys/bus/nvmem/devices/spmi_sdam*/nvmem being '0' and makes
    user space work with that file.
    
      ~ # hexdump -C -s 64 /sys/bus/nvmem/devices/spmi_sdam2/nvmem
      00000040  02 01 00 00 04 00 00 00  00 00 00 00 00 00 00 00  |................|
      00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
      *
      00000080
    
    Fixes: 40ce9798794f ("nvmem: add QTI SDAM driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
    Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20241230141901.263976-6-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ocfs2: check dir i_size in ocfs2_find_entry [+ + +]
Author: Su Yue <glass.su@suse.com>
Date:   Mon Jan 6 22:06:40 2025 +0800

    ocfs2: check dir i_size in ocfs2_find_entry
    
    commit b0fce54b8c0d8e5f2b4c243c803c5996e73baee8 upstream.
    
    syz reports an out of bounds read:
    
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334
    [inline]
    BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0
    fs/ocfs2/dir.c:367
    Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802
    
    CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1
    04/01/2014
    Sched_ext: serialise (enabled+all), task: runnable_at=-10ms
    Call Trace:
    <TASK>
    __dump_stack lib/dump_stack.c:94 [inline]
    dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120
    print_address_description mm/kasan/report.c:378 [inline]
    print_report+0x164/0x530 mm/kasan/report.c:489
    kasan_report+0x147/0x180 mm/kasan/report.c:602
    ocfs2_match fs/ocfs2/dir.c:334 [inline]
    ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367
    ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline]
    ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078
    ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981
    ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003
    ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122
    lookup_open fs/namei.c:3627 [inline]
    open_last_lookups fs/namei.c:3748 [inline]
    path_openat+0x145a/0x3870 fs/namei.c:3984
    do_filp_open+0xe9/0x1c0 fs/namei.c:4014
    do_sys_openat2+0x135/0x1d0 fs/open.c:1402
    do_sys_open fs/open.c:1417 [inline]
    __do_sys_openat fs/open.c:1433 [inline]
    __se_sys_openat fs/open.c:1428 [inline]
    __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428
    do_syscall_x64 arch/x86/entry/common.c:52 [inline]
    do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83
    entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7f01076903ad
    Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89
    f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
    f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
    RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
    RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
    RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
    R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
    R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
    </TASK>
    ==================================================================
    
    And a general protection fault in ocfs2_prepare_dir_for_insert:
    
    ==================================================================
    loop0: detected capacity change from 0 to 32768
    JBD2: Ignoring recovery information on journal
    ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data
    mode.
    Oops: general protection fault, probably for non-canonical address
    0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI
    KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
    CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted
    6.11.0-rc4-syzkaller-00002-gb0da640826ba #0
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
    1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
    RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline]
    RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280
    Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00
    e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6
    04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f
    RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202
    RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440
    RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008
    RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7
    R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000
    R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000
    FS:  000055555a677380(0000) GS:ffff888020800000(0000)
    knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292
    vfs_mknod+0x36d/0x3b0 fs/namei.c:4088
    do_mknodat+0x3ec/0x5b0
    __do_sys_mknodat fs/namei.c:4166 [inline]
    __se_sys_mknodat fs/namei.c:4163 [inline]
    __x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163
    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:0x7f2dafda3a99
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89
    f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08
    0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8
    64 89 01 48
    RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
    0000000000000103
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX:
    00007f2dafda3a99
    RDX: 00000000000021c0 RSI: 0000000020000040 RDI:
    00000000ffffff9c
    RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:
    000055555a6784c0
    R10: 0000000000000103 R11: 0000000000000246 R12:
    00007ffe336a6680
    R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:
    00007f2dafdec03b
    </TASK>
    ==================================================================
    
    The two reports are all caused invalid negative i_size of dir inode.  For
    ocfs2, dir_inode can't be negative or zero.
    
    Here add a check in which is called by ocfs2_check_dir_for_entry().  It
    fixes the second report as ocfs2_check_dir_for_entry() must be called
    before ocfs2_prepare_dir_for_insert().  Also set a up limit for dir with
    OCFS2_INLINE_DATA_FL.  The i_size can't be great than blocksize.
    
    Link: https://lkml.kernel.org/r/20250106140640.92260-1-glass.su@suse.com
    Reported-by: Jiacheng Xu <stitch@zju.edu.cn>
    Link: https://lore.kernel.org/ocfs2-devel/17a04f01.1ae74.19436d003fc.Coremail.stitch@zju.edu.cn/T/#u
    Reported-by: syzbot+5a64828fcc4c2ad9b04f@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/all/0000000000005894f3062018caf1@google.com/T/
    Signed-off-by: Su Yue <glass.su@suse.com>
    Reviewed-by: Heming Zhao <heming.zhao@suse.com>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Jun Piao <piaojun@huawei.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ocfs2: fix incorrect CPU endianness conversion causing mount failure [+ + +]
Author: Heming Zhao <heming.zhao@suse.com>
Date:   Tue Jan 21 19:22:03 2025 +0800

    ocfs2: fix incorrect CPU endianness conversion causing mount failure
    
    commit f921da2c34692dfec5f72b5ae347b1bea22bb369 upstream.
    
    Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
    introduced a regression bug.  The blksz_bits value is already converted to
    CPU endian in the previous code; therefore, the code shouldn't use
    le32_to_cpu() anymore.
    
    Link: https://lkml.kernel.org/r/20250121112204.12834-1-heming.zhao@suse.com
    Fixes: 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
    Signed-off-by: Heming Zhao <heming.zhao@suse.com>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ocfs2: handle a symlink read error correctly [+ + +]
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Thu Dec 5 17:16:29 2024 +0000

    ocfs2: handle a symlink read error correctly
    
    commit 2b4c2094da6d84e69b843dd3317902e977bf64bd upstream.
    
    Patch series "Convert ocfs2 to use folios".
    
    Mark did a conversion of ocfs2 to use folios and sent it to me as a
    giant patch for review ;-)
    
    So I've redone it as individual patches, and credited Mark for the patches
    where his code is substantially the same.  It's not a bad way to do it;
    his patch had some bugs and my patches had some bugs.  Hopefully all our
    bugs were different from each other.  And hopefully Mark likes all the
    changes I made to his code!
    
    
    This patch (of 23):
    
    If we can't read the buffer, be sure to unlock the page before returning.
    
    Link: https://lkml.kernel.org/r/20241205171653.3179945-1-willy@infradead.org
    Link: https://lkml.kernel.org/r/20241205171653.3179945-2-willy@infradead.org
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: Mark Tinguely <mark.tinguely@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
octeon_ep: update tx/rx stats locally for persistence [+ + +]
Author: Shinas Rasheed <srasheed@marvell.com>
Date:   Fri Jan 17 01:46:51 2025 -0800

    octeon_ep: update tx/rx stats locally for persistence
    
    [ Upstream commit 10fad79846e49f67ad1a0a05910837125c6ca9ad ]
    
    Update tx/rx stats locally, so that ndo_get_stats64()
    can use that and not rely on per queue resources to obtain statistics.
    The latter used to cause race conditions when the device stopped.
    
    Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
    Link: https://patch.msgid.link/20250117094653.2588578-3-srasheed@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeon_ep_vf: update tx/rx stats locally for persistence [+ + +]
Author: Shinas Rasheed <srasheed@marvell.com>
Date:   Fri Jan 17 01:46:53 2025 -0800

    octeon_ep_vf: update tx/rx stats locally for persistence
    
    [ Upstream commit f84039939512e6d88b0f2f353695530f123be789 ]
    
    Update tx/rx stats locally, so that ndo_get_stats64()
    can use that and not rely on per queue resources to obtain statistics.
    The latter used to cause race conditions when the device stopped.
    
    Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
    Link: https://patch.msgid.link/20250117094653.2588578-5-srasheed@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
of: address: Fix empty resource handling in __of_address_resource_bounds() [+ + +]
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Date:   Mon Jan 20 15:09:40 2025 +0100

    of: address: Fix empty resource handling in __of_address_resource_bounds()
    
    commit 15e2f65f2ecfeb8e39315522e2b5cfdc5651fc10 upstream.
    
    "resource->end" needs to always be equal to "resource->start + size - 1".
    The previous version of the function did not perform the "- 1" in case
    of an empty resource.
    
    Also make sure to allow an empty resource at address 0.
    
    Reported-by: Basharath Hussain Khaja <basharath@couthit.com>
    Closes: https://lore.kernel.org/lkml/20250108140414.13530-1-basharath@couthit.com/
    Fixes: 1a52a094c2f0 ("of: address: Unify resource bounds overflow checking")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
    Link: https://lore.kernel.org/r/20250120-of-address-overflow-v1-1-dd68dbf47bce@linutronix.de
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

of: Correct child specifier used as input of the 2nd nexus node [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Thu Jan 9 21:26:52 2025 +0800

    of: Correct child specifier used as input of the 2nd nexus node
    
    commit e4c00c9b1f70cd11792ff5b825899a6ee0234a62 upstream.
    
    API of_parse_phandle_with_args_map() will use wrong input for nexus node
    Nexus_2 as shown below:
    
        Node_1              Nexus_1                              Nexus_2
    &Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
                      map-pass-thru=<...>
    
    Nexus_1's output arg_2 should be used as input of Nexus_2, but the API
    wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.
    
    Fix by always making @match_array point to @initial_match_array into
    which to store nexus output.
    
    Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-1-db8a72415b8c@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

of: Fix of_find_node_opts_by_path() handling of alias+path+options [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Mon Dec 16 08:40:40 2024 +0800

    of: Fix of_find_node_opts_by_path() handling of alias+path+options
    
    commit b9e58c934c56aa35b0fb436d9afd86ef326bae0e upstream.
    
    of_find_node_opts_by_path() fails to find OF device node when its
    @path parameter have pattern below:
    
    "alias-name/node-name-1/.../node-name-N:options".
    
    The reason is that alias name length calculated by the API is wrong, as
    explained by example below:
    
    "testcase-alias/phandle-tests/consumer-a:testaliasoption".
     ^             ^                        ^
     0             14                       39
    
    The right length of alias 'testcase-alias' is 14, but the result worked
    out by the API is 39 which is obvious wrong.
    
    Fix by using index of either '/' or ':' as the length who comes earlier.
    
    Fixes: 75c28c09af99 ("of: add optional options parameter to of_find_node_by_path()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20241216-of_core_fix-v2-1-e69b8f60da63@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

of: reserved-memory: Fix using wrong number of cells to get property 'alignment' [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Thu Jan 9 21:27:00 2025 +0800

    of: reserved-memory: Fix using wrong number of cells to get property 'alignment'
    
    commit 267b21d0bef8e67dbe6c591c9991444e58237ec9 upstream.
    
    According to DT spec, size of property 'alignment' is based on parent
    node’s #size-cells property.
    
    But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get
    the property obviously.
    
    Fix by using @dt_root_size_cells instead of @dt_root_addr_cells.
    
    Fixes: 3f0c82066448 ("drivers: of: add initialization code for dynamic reserved memory")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-9-db8a72415b8c@quicinc.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
parisc: Temporarily disable jump label support [+ + +]
Author: Helge Deller <deller@kernel.org>
Date:   Thu Jan 16 21:17:47 2025 +0100

    parisc: Temporarily disable jump label support
    
    commit 3599bae489d86fbabe039f9a2ab5472ffb04f7f1 upstream.
    
    The 32-bit Debian kernel 6.12 fails to boot and crashes like this:
    
     init (pid 65): Protection id trap (code 7)
     CPU: 0 UID: 0 PID: 65 Comm: init Not tainted 6.12.9 #2
     Hardware name: 9000/778/B160L
    
          YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
     PSW: 00000000000001000000000000001111 Not tainted
     r00-03  0004000f 110d39d0 109a6558 12974400
     r04-07  12a810e0 12a810e0 00000000 12a81144
     r08-11  12a81174 00000007 00000000 00000002
     r12-15  f8c55c08 0000006c 00000001 f8c55c08
     r16-19  00000002 f8c58620 002da3a8 0000004e
     r20-23  00001a46 0000000f 10754f84 00000000
     r24-27  00000000 00000003 12ae6980 1127b9d0
     r28-31  00000000 00000000 12974440 109a6558
     sr00-03  00000000 00000000 00000000 00000010
     sr04-07  00000000 00000000 00000000 00000000
    
     IASQ: 00000000 00000000 IAOQ: 110d39d0 110d39d4
      IIR: baadf00d    ISR: 00000000  IOR: 110d39d0
      CPU:        0   CR30: 128740c0 CR31: 00000000
      ORIG_R28: 000003f3
      IAOQ[0]: 0x110d39d0
      IAOQ[1]: 0x110d39d4
      RP(r2): security_sk_free+0x70/0x1a4
     Backtrace:
      [<10d8c844>] __sk_destruct+0x2bc/0x378
      [<10d8e33c>] sk_destruct+0x68/0x8c
      [<10d8e3dc>] __sk_free+0x7c/0x148
      [<10d8e560>] sk_free+0xb8/0xf0
      [<10f6420c>] unix_release_sock+0x3ac/0x50c
      [<10f643b8>] unix_release+0x4c/0x7c
      [<10d832f8>] __sock_release+0x5c/0xf8
      [<10d833b4>] sock_close+0x20/0x44
      [<107ba52c>] __fput+0xf8/0x468
      [<107baa08>] __fput_sync+0xb4/0xd4
      [<107b471c>] sys_close+0x44/0x94
      [<10405334>] syscall_exit+0x0/0x10
    
    Bisecting points to this commit which triggers the issue:
            commit  417c5643cd67a55f424b203b492082035d0236c3
            Author: KP Singh <kpsingh@kernel.org>
            Date:   Fri Aug 16 17:43:07 2024 +0200
                    lsm: replace indirect LSM hook calls with static calls
    
    After more analysis it seems that we don't fully implement the static calls
    and jump tables yet. Additionally the functions which mark kernel memory
    read-only or read-write-executable needs to be further enhanced to be able to
    fully support static calls.
    
    Enabling CONFIG_SECURITY_YAMA=y was one possibility to trigger the issue,
    although YAMA isn't the reason for the fault.
    
    As a temporary solution disable JUMP_LABEL functionality to
    avoid the crashes.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Cc: <stable@vger.kernel.org> # v6.12+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI: Avoid putting some root ports into D3 on TUXEDO Sirius Gen1 [+ + +]
Author: Werner Sembach <wse@tuxedocomputers.com>
Date:   Tue Jan 14 23:23:54 2025 +0100

    PCI: Avoid putting some root ports into D3 on TUXEDO Sirius Gen1
    
    commit b1049f2d68693c80a576c4578d96774a68df2bad upstream.
    
    commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") sets the
    policy that all PCIe ports are allowed to use D3.  When the system is
    suspended if the port is not power manageable by the platform and won't be
    used for wakeup via a PME this sets up the policy for these ports to go
    into D3hot.
    
    This policy generally makes sense from an OSPM perspective but it leads to
    problems with wakeup from suspend on the TUXEDO Sirius 16 Gen 1 with a
    specific old BIOS. This manifests as a system hang.
    
    On the affected Device + BIOS combination, add a quirk for the root port of
    the problematic controller to ensure that these root ports are not put into
    D3hot at suspend.
    
    This patch is based on
    
      https://lore.kernel.org/linux-pci/20230708214457.1229-2-mario.limonciello@amd.com
    
    but with the added condition both in the documentation and in the code to
    apply only to the TUXEDO Sirius 16 Gen 1 with a specific old BIOS and only
    the affected root ports.
    
    Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
    Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://lore.kernel.org/r/20250114222436.1075456-1-wse@tuxedocomputers.com
    Co-developed-by: Georg Gottleuber <ggo@tuxedocomputers.com>
    Signed-off-by: Georg Gottleuber <ggo@tuxedocomputers.com>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Cc: <stable@vger.kernel.org> # 6.1+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: dwc: ep: Prevent changing BAR size/flags in pci_epc_set_bar() [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
Date:   Fri Dec 13 15:33:03 2024 +0100

    PCI: dwc: ep: Prevent changing BAR size/flags in pci_epc_set_bar()
    
    commit 3708acbd5f169ebafe1faa519cb28adc56295546 upstream.
    
    In commit 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update
    inbound map address") set_bar() was modified to support dynamically
    changing the backing physical address of a BAR that was already configured.
    
    This means that set_bar() can be called twice, without ever calling
    clear_bar() (as calling clear_bar() would clear the BAR's PCI address
    assigned by the host).
    
    This can only be done if the new BAR size/flags does not differ from the
    existing BAR configuration. Add these missing checks.
    
    If we allow set_bar() to set e.g. a new BAR size that differs from the
    existing BAR size, the new address translation range will be smaller than
    the BAR size already determined by the host, which would mean that a read
    past the new BAR size would pass the iATU untranslated, which could allow
    the host to read memory not belonging to the new struct pci_epf_bar.
    
    While at it, add comments which clarifies the support for dynamically
    changing the physical address of a BAR. (Which was also missing.)
    
    Fixes: 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update inbound map address")
    Link: https://lore.kernel.org/r/20241213143301.4158431-10-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: dwc: ep: Write BAR_MASK before iATU registers in pci_epc_set_bar() [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
Date:   Fri Dec 13 15:33:02 2024 +0100

    PCI: dwc: ep: Write BAR_MASK before iATU registers in pci_epc_set_bar()
    
    commit 33a6938e0c3373f2d11f92d098f337668cd64fdd upstream.
    
    The "DesignWare Cores PCI Express Controller Register Descriptions,
    Version 4.60a", section "1.21.70 IATU_LWR_TARGET_ADDR_OFF_INBOUND_i",
    fields LWR_TARGET_RW and LWR_TARGET_HW both state that:
    "Field size depends on log2(BAR_MASK+1) in BAR match mode."
    
    I.e. only the upper bits are writable, and the number of writable bits is
    dependent on the configured BAR_MASK.
    
    If we do not write the BAR_MASK before writing the iATU registers, we are
    relying the reset value of the BAR_MASK being larger than the requested
    BAR size (which is supplied in the struct pci_epf_bar which is passed to
    pci_epc_set_bar()). The reset value of the BAR_MASK is SoC dependent.
    
    Thus, if the struct pci_epf_bar requests a BAR size that is larger than the
    reset value of the BAR_MASK, the iATU will try to write to read-only bits,
    which will cause the iATU to end up redirecting to a physical address that
    is different from the address that was intended.
    
    Thus, we should always write the iATU registers after writing the BAR_MASK.
    
    Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support")
    Link: https://lore.kernel.org/r/20241213143301.4158431-9-cassel@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf() [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Tue Dec 10 22:00:20 2024 +0800

    PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf()
    
    commit 3b9f942eb21c92041905e3943a8d5177c9a9d89d upstream.
    
    When removing a virtual Endpoint, pci_epf_remove_vepf() failed to clear
    epf_vf->epf_pf, which caused a subsequent pci_epf_add_vepf() to incorrectly
    return -EBUSY:
    
      pci_epf_add_vepf(epf_pf, epf_vf)      // add
      pci_epf_remove_vepf(epf_pf, epf_vf)   // remove
      pci_epf_add_vepf(epf_pf, epf_vf)      // add again, -EBUSY error
    
    Fix by clearing epf_vf->epf_pf in pci_epf_remove_vepf().
    
    Link: https://lore.kernel.org/r/20241210-pci-epc-core_fix-v3-3-4d86dd573e4b@quicinc.com
    Fixes: 1cf362e907f3 ("PCI: endpoint: Add support to add virtual function in endpoint core")
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf bench: Fix undefined behavior in cmpworker() [+ + +]
Author: Kuan-Wei Chiu <visitorckw@gmail.com>
Date:   Thu Jan 16 19:08:42 2025 +0800

    perf bench: Fix undefined behavior in cmpworker()
    
    commit 62892e77b8a64b9dc0e1da75980aa145347b6820 upstream.
    
    The comparison function cmpworker() violates the C standard's
    requirements for qsort() comparison functions, which mandate symmetry
    and transitivity:
    
    Symmetry: If x < y, then y > x.
    Transitivity: If x < y and y < z, then x < z.
    
    In its current implementation, cmpworker() incorrectly returns 0 when
    w1->tid < w2->tid, which breaks both symmetry and transitivity. This
    violation causes undefined behavior, potentially leading to issues such
    as memory corruption in glibc [1].
    
    Fix the issue by returning -1 when w1->tid < w2->tid, ensuring
    compliance with the C standard and preventing undefined behavior.
    
    Link: https://www.qualys.com/2024/01/30/qsort.txt [1]
    Fixes: 121dd9ea0116 ("perf bench: Add epoll parallel epoll_wait benchmark")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
    Reviewed-by: James Clark <james.clark@linaro.org>
    Link: https://lore.kernel.org/r/20250116110842.4087530-1-visitorckw@gmail.com
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pfifo_tail_enqueue: Drop new packet when sch->limit == 0 [+ + +]
Author: Quang Le <quanglex97@gmail.com>
Date:   Mon Feb 3 16:58:38 2025 -0800

    pfifo_tail_enqueue: Drop new packet when sch->limit == 0
    
    [ Upstream commit 647cef20e649c576dff271e018d5d15d998b629d ]
    
    Expected behaviour:
    In case we reach scheduler's limit, pfifo_tail_enqueue() will drop a
    packet in scheduler's queue and decrease scheduler's qlen by one.
    Then, pfifo_tail_enqueue() enqueue new packet and increase
    scheduler's qlen by one. Finally, pfifo_tail_enqueue() return
    `NET_XMIT_CN` status code.
    
    Weird behaviour:
    In case we set `sch->limit == 0` and trigger pfifo_tail_enqueue() on a
    scheduler that has no packet, the 'drop a packet' step will do nothing.
    This means the scheduler's qlen still has value equal 0.
    Then, we continue to enqueue new packet and increase scheduler's qlen by
    one. In summary, we can leverage pfifo_tail_enqueue() to increase qlen by
    one and return `NET_XMIT_CN` status code.
    
    The problem is:
    Let's say we have two qdiscs: Qdisc_A and Qdisc_B.
     - Qdisc_A's type must have '->graft()' function to create parent/child relationship.
       Let's say Qdisc_A's type is `hfsc`. Enqueue packet to this qdisc will trigger `hfsc_enqueue`.
     - Qdisc_B's type is pfifo_head_drop. Enqueue packet to this qdisc will trigger `pfifo_tail_enqueue`.
     - Qdisc_B is configured to have `sch->limit == 0`.
     - Qdisc_A is configured to route the enqueued's packet to Qdisc_B.
    
    Enqueue packet through Qdisc_A will lead to:
     - hfsc_enqueue(Qdisc_A) -> pfifo_tail_enqueue(Qdisc_B)
     - Qdisc_B->q.qlen += 1
     - pfifo_tail_enqueue() return `NET_XMIT_CN`
     - hfsc_enqueue() check for `NET_XMIT_SUCCESS` and see `NET_XMIT_CN` => hfsc_enqueue() don't increase qlen of Qdisc_A.
    
    The whole process lead to a situation where Qdisc_A->q.qlen == 0 and Qdisc_B->q.qlen == 1.
    Replace 'hfsc' with other type (for example: 'drr') still lead to the same problem.
    This violate the design where parent's qlen should equal to the sum of its childrens'qlen.
    
    Bug impact: This issue can be used for user->kernel privilege escalation when it is reachable.
    
    Fixes: 57dbb2d83d10 ("sched: add head drop fifo queue")
    Reported-by: Quang Le <quanglex97@gmail.com>
    Signed-off-by: Quang Le <quanglex97@gmail.com>
    Signed-off-by: Cong Wang <cong.wang@bytedance.com>
    Link: https://patch.msgid.link/20250204005841.223511-2-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pinctrl: renesas: rzg2l: Fix PFC_MASK for RZ/V2H and RZ/G3E [+ + +]
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Date:   Fri Jan 10 22:10:45 2025 +0000

    pinctrl: renesas: rzg2l: Fix PFC_MASK for RZ/V2H and RZ/G3E
    
    commit accabfaae0940f9427c782bfee7340ce4c15151c upstream.
    
    The PFC_MASK value for the PFC_mx registers is currently hardcoded to
    0x07, which is correct for SoCs in the RZ/G2L family, but insufficient
    for RZ/V2H and RZ/G3E, where the mask value should be 0x0f.  This
    discrepancy causes incorrect PFC register configuration on RZ/V2H and
    RZ/G3E SoCs.
    
    On RZ/G2L, the PFC_mx bitfields are also 4 bits wide, with bit 4 marked
    as reserved.  The reserved bits are documented to read as zero and be
    ignored when written.  Updating the PFC_MASK definition from 0x07 to
    0x0f ensures compatibility with both SoC families while maintaining
    correct behavior on RZ/G2L.
    
    Fixes: 9bd95ac86e70 ("pinctrl: renesas: rzg2l: Add support for RZ/V2H 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/20250110221045.594596-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>

pinctrl: samsung: fix fwnode refcount cleanup if platform_get_irq_optional() fails [+ + +]
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Date:   Wed Nov 6 23:04:39 2024 +0100

    pinctrl: samsung: fix fwnode refcount cleanup if platform_get_irq_optional() fails
    
    commit 459915f55509f4bfd6076daa1428e28490ddee3b upstream.
    
    Commit 50ebd19e3585 ("pinctrl: samsung: drop pin banks references on
    error paths") fixed the pin bank references on the error paths of the
    probe function, but there is still an error path where this is not done.
    
    If samsung_pinctrl_get_soc_data() does not fail, the child references
    will have acquired, and they will need to be released in the error path
    of platform_get_irq_optional(), as it is done in the following error
    paths within the probe function.
    
    Replace the direct return in the error path with a goto instruction to
    the cleanup function.
    
    Cc: stable@vger.kernel.org
    Fixes: a382d568f144 ("pinctrl: samsung: Use platform_get_irq_optional() to get the interrupt")
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Link: https://lore.kernel.org/r/20241106-samsung-pinctrl-put-v1-1-de854e26dd03@gmail.com
    [krzysztof: change Fixes SHA to point to commit introducing the return
     leading to OF node leak]
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
platform/x86: acer-wmi: add support for Acer Nitro AN515-58 [+ + +]
Author: Hridesh MG <hridesh699@gmail.com>
Date:   Mon Jan 13 18:44:13 2025 +0530

    platform/x86: acer-wmi: add support for Acer Nitro AN515-58
    
    [ Upstream commit 549fcf58cf5837d401d0de906093169b05365609 ]
    
    Add predator_v4 quirk for the Acer Nitro AN515-58 to enable fan speed
    monitoring and platform_profile handling.
    
    Signed-off-by: Hridesh MG <hridesh699@gmail.com>
    Reviewed-by: Kurt Borja <kuurtb@gmail.com>
    Link: https://lore.kernel.org/r/20250113-platform_profile-v4-5-23be0dff19f1@gmail.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>

platform/x86: acer-wmi: Add support for Acer PH14-51 [+ + +]
Author: Armin Wolf <W_Armin@gmx.de>
Date:   Tue Dec 10 01:16:53 2024 +0100

    platform/x86: acer-wmi: Add support for Acer PH14-51
    
    [ Upstream commit 9741f9aa13f6dc3ff24e1d006b2ced5f460e6b6f ]
    
    Add the Acer Predator PT14-51 to acer_quirks to provide support
    for the turbo button and predator_v4 hwmon interface.
    
    Reported-by: Rayan Margham <rayanmargham4@gmail.com>
    Closes: https://lore.kernel.org/platform-driver-x86/CACzB==6tUsCnr5musVMz-EymjTUCJfNtKzhMFYqMRU_h=kydXA@mail.gmail.com
    Tested-by: Rayan Margham <rayanmargham4@gmail.com>
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Reviewed-by: Kurt Borja <kuurtb@gmail.com>
    Link: https://lore.kernel.org/r/20241210001657.3362-2-W_Armin@gmx.de
    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>

platform/x86: acer-wmi: Add support for Acer Predator PH16-72 [+ + +]
Author: Armin Wolf <W_Armin@gmx.de>
Date:   Tue Jan 7 18:56:52 2025 +0100

    platform/x86: acer-wmi: Add support for Acer Predator PH16-72
    
    [ Upstream commit c85b516b44d21e9cf751c4f73a6c235ed170d887 ]
    
    Add the Acer Predator PT16-72 to acer_quirks to provide support
    for the turbo button and predator_v4 interfaces.
    
    Tested-by: Eric Johnsten <ejohnsten@gmail.com>
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Link: https://lore.kernel.org/r/20250107175652.3171-1-W_Armin@gmx.de
    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>

platform/x86: acer-wmi: Ignore AC events [+ + +]
Author: Armin Wolf <W_Armin@gmx.de>
Date:   Sun Jan 19 21:17:22 2025 +0100

    platform/x86: acer-wmi: Ignore AC events
    
    [ Upstream commit f6bfa25c6665f8721421ea94fe506cc22f1d4b43 ]
    
    On the Acer Swift SFG14-41, the events 8 - 1 and 8 - 0 are printed on
    AC connect/disconnect. Ignore those events to avoid spamming the
    kernel log with error messages.
    
    Reported-by: Farhan Anwar <farhan.anwar8@gmail.com>
    Closes: https://lore.kernel.org/platform-driver-x86/2ffb529d-e7c8-4026-a3b8-120c8e7afec8@gmail.com
    Tested-by: Rayan Margham <rayanmargham4@gmail.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Link: https://lore.kernel.org/r/20250119201723.11102-2-W_Armin@gmx.de
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

platform/x86: int3472: Check for adev == NULL [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Dec 9 23:05:19 2024 +0100

    platform/x86: int3472: Check for adev == NULL
    
    [ Upstream commit cd2fd6eab480dfc247b737cf7a3d6b009c4d0f1c ]
    
    Not all devices have an ACPI companion fwnode, so adev might be NULL. This
    can e.g. (theoretically) happen when a user manually binds one of
    the int3472 drivers to another i2c/platform device through sysfs.
    
    Add a check for adev not being set and return -ENODEV in that case to
    avoid a possible NULL pointer deref in skl_int3472_get_acpi_buffer().
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20241209220522.25288-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>

platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL [+ + +]
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Wed Dec 4 21:42:14 2024 +0100

    platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
    
    commit 478b00a623d6c8ae23a1be7bcc96cb5497045cef upstream.
    
    dell_uart_bl_pdev_probe() calls get_serdev_controller() with the
    serial_ctrl_uid parameter set to NULL.
    
    In case of errors this NULL parameter then gets passed to pr_err()
    as argument matching a "%s" conversion specification. This leads to
    compiler warnings when building with "make W=1".
    
    Check serial_ctrl_uid before passing it to pr_err() to avoid these.
    
    Fixes: dc5afd720f84 ("platform/x86: Add new get_serdev_controller() helper")
    Cc: stable@vger.kernel.org
    Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Link: https://lore.kernel.org/r/20241204204227.95757-4-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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pnfs/flexfiles: retry getting layout segment for reads [+ + +]
Author: Mike Snitzer <snitzer@kernel.org>
Date:   Thu Jan 16 20:05:39 2025 -0500

    pnfs/flexfiles: retry getting layout segment for reads
    
    commit eb3fabde15bccdf34f1c9b35a83aa4c0dacbb4ca upstream.
    
    If ff_layout_pg_get_read()'s attempt to get a layout segment results
    in -EAGAIN have ff_layout_pg_init_read() retry it after sleeping.
    
    If "softerr" mount is used, use 'io_maxretrans' to limit the number of
    attempts to get a layout segment.
    
    This fixes a long-standing issue of O_DIRECT reads failing with
    -EAGAIN (11) when using flexfiles Client Side Mirroring (CSM).
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
powerpc/pseries/eeh: Fix get PE state translation [+ + +]
Author: Narayana Murty N <nnmlinux@linux.ibm.com>
Date:   Thu Jan 16 04:39:54 2025 -0600

    powerpc/pseries/eeh: Fix get PE state translation
    
    commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream.
    
    The PE Reset State "0" returned by RTAS calls
    "ibm_read_slot_reset_[state|state2]" indicates that the reset is
    deactivated and the PE is in a state where MMIO and DMA are allowed.
    However, the current implementation of "pseries_eeh_get_state()" does
    not reflect this, causing drivers to incorrectly assume that MMIO and
    DMA operations cannot be resumed.
    
    The userspace drivers as a part of EEH recovery using VFIO ioctls fail
    to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE
    ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing
    userspace drivers from functioning properly on pseries systems.
    
    The patch addresses this issue by updating 'pseries_eeh_get_state()'
    to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in
    the result mask for PE Reset State "0". This ensures correct state
    reporting to the callers, aligning the behavior with the PAPR specification
    and fixing the bug in EEH recovery for VFIO user workflows.
    
    Fixes: 00ba05a12b3c ("powerpc/pseries: Cleanup on pseries_eeh_get_state()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
    Link: https://lore.kernel.org/stable/20241212075044.10563-1-nnmlinux%40linux.ibm.com
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250116103954.17324-1-nnmlinux@linux.ibm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX [+ + +]
Author: Kuan-Wei Chiu <visitorckw@gmail.com>
Date:   Sat Sep 28 19:36:08 2024 +0800

    printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
    
    [ Upstream commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a ]
    
    Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which
    leads to undefined behavior. To prevent this, cast 1 to u32 before
    performing the shift, ensuring well-defined behavior.
    
    This change explicitly avoids any potential overflow by ensuring that
    the shift occurs on an unsigned 32-bit integer.
    
    Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
    Acked-by: Petr Mladek <pmladek@suse.com>
    Link: https://lore.kernel.org/r/20240928113608.1438087-1-visitorckw@gmail.com
    Signed-off-by: Petr Mladek <pmladek@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ptp: Ensure info->enable callback is always set [+ + +]
Author: Thomas Weißschuh <linux@weissschuh.net>
Date:   Thu Jan 23 08:22:40 2025 +0100

    ptp: Ensure info->enable callback is always set
    
    commit fd53aa40e65f518453115b6f56183b0c201db26b upstream.
    
    The ioctl and sysfs handlers unconditionally call the ->enable callback.
    Not all drivers implement that callback, leading to NULL dereferences.
    Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c.
    
    Instead use a dummy callback if no better was specified by the driver.
    
    Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Acked-by: Richard Cochran <richardcochran@gmail.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Link: https://patch.msgid.link/20250123-ptp-enable-v1-1-b015834d3a47@weissschuh.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pwm: microchip-core: fix incorrect comparison with max period [+ + +]
Author: Conor Dooley <conor.dooley@microchip.com>
Date:   Wed Jan 22 14:42:56 2025 +0000

    pwm: microchip-core: fix incorrect comparison with max period
    
    commit 752b6e3af374460a2de18f0c10bfa06bf844dbe8 upstream.
    
    In mchp_core_pwm_apply_locked(), if hw_period_steps is equal to its max,
    an error is reported and .apply fails. The max value is actually a
    permitted value however, and so this check can fail where multiple
    channels are enabled.
    
    For example, the first channel to be configured requests a period that
    sets hw_period_steps to the maximum value, and when a second channel
    is enabled the driver reads hw_period_steps back from the hardware and
    finds it to be the maximum possible value, triggering the warning on a
    permitted value. The value to be avoided is 255 (PERIOD_STEPS_MAX + 1),
    as that will produce undesired behaviour, so test for greater than,
    rather than equal to.
    
    Fixes: 2bf7ecf7b4ff ("pwm: add microchip soft ip corePWM driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Link: https://lore.kernel.org/r/20250122-pastor-fancied-0b993da2d2d2@spud
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/mlx5: Fix a race for an ODP MR which leads to CQE with error [+ + +]
Author: Yishai Hadas <yishaih@nvidia.com>
Date:   Sun Jan 19 14:38:25 2025 +0200

    RDMA/mlx5: Fix a race for an ODP MR which leads to CQE with error
    
    commit abb604a1a9c87255c7a6f3b784410a9707baf467 upstream.
    
    This patch addresses a race condition for an ODP MR that can result in a
    CQE with an error on the UMR QP.
    
    During the __mlx5_ib_dereg_mr() flow, the following sequence of calls
    occurs:
    
    mlx5_revoke_mr()
     mlx5r_umr_revoke_mr()
     mlx5r_umr_post_send_wait()
    
    At this point, the lkey is freed from the hardware's perspective.
    
    However, concurrently, mlx5_ib_invalidate_range() might be triggered by
    another task attempting to invalidate a range for the same freed lkey.
    
    This task will:
     - Acquire the umem_odp->umem_mutex lock.
     - Call mlx5r_umr_update_xlt() on the UMR QP.
     - Since the lkey has already been freed, this can lead to a CQE error,
       causing the UMR QP to enter an error state [1].
    
    To resolve this race condition, the umem_odp->umem_mutex lock is now also
    acquired as part of the mlx5_revoke_mr() scope.  Upon successful revoke,
    we set umem_odp->private which points to that MR to NULL, preventing any
    further invalidation attempts on its lkey.
    
    [1] From dmesg:
    
       infiniband rocep8s0f0: dump_cqe:277:(pid 0): WC error: 6, Message: memory bind operation error
       cqe_dump: 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       cqe_dump: 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       cqe_dump: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       cqe_dump: 00000030: 00 00 00 00 08 00 78 06 25 00 11 b9 00 0e dd d2
    
       WARNING: CPU: 15 PID: 1506 at drivers/infiniband/hw/mlx5/umr.c:394 mlx5r_umr_post_send_wait+0x15a/0x2b0 [mlx5_ib]
       Modules linked in: ip6table_mangle ip6table_natip6table_filter ip6_tables iptable_mangle xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_umad ib_ipoib ib_cm mlx5_ib ib_uverbs ib_core fuse mlx5_core
       CPU: 15 UID: 0 PID: 1506 Comm: ibv_rc_pingpong Not tainted 6.12.0-rc7+ #1626
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
       RIP: 0010:mlx5r_umr_post_send_wait+0x15a/0x2b0 [mlx5_ib]
       [..]
       Call Trace:
       <TASK>
       mlx5r_umr_update_xlt+0x23c/0x3e0 [mlx5_ib]
       mlx5_ib_invalidate_range+0x2e1/0x330 [mlx5_ib]
       __mmu_notifier_invalidate_range_start+0x1e1/0x240
       zap_page_range_single+0xf1/0x1a0
       madvise_vma_behavior+0x677/0x6e0
       do_madvise+0x1a2/0x4b0
       __x64_sys_madvise+0x25/0x30
       do_syscall_64+0x6b/0x140
       entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    Fixes: e6fb246ccafb ("RDMA/mlx5: Consolidate MR destruction to mlx5_ib_dereg_mr()")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/r/68a1e007c25b2b8fe5d625f238cc3b63e5341f77.1737290229.git.leon@kernel.org
    Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
    Reviewed-by: Artemy Kovalyov <artemyko@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
remoteproc: omap: Handle ARM dma_iommu_mapping [+ + +]
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Mon Oct 28 17:58:35 2024 +0000

    remoteproc: omap: Handle ARM dma_iommu_mapping
    
    commit 1dc7c8ed7cb378dd3974387692dfa833aee718d4 upstream.
    
    It's no longer practical for the OMAP IOMMU driver to trick
    arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the
    same tactic as other IOMMU API users on 32-bit ARM and explicitly kick
    the arch code's dma_iommu_mapping out of the way to avoid problems.
    
    Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()")
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Tested-by: Beleswar Padhi <b-padhi@ti.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/6186e311cb6f64a787f87fd41e49a73f409b789c.1730136799.git.robin.murphy@arm.com
    [Fixed changelog title]
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "btrfs: avoid monopolizing a core when activating a swap file" [+ + +]
Author: Koichiro Den <koichiro.den@canonical.com>
Date:   Fri Feb 7 01:22:16 2025 +0900

    Revert "btrfs: avoid monopolizing a core when activating a swap file"
    
    This reverts commit 9f372e86b9bd1914df58c8f6e30939b7a224c6b0.
    
    The backport for linux-6.12.y, commit 9f372e86b9bd ("btrfs: avoid
    monopolizing a core when activating a swap file"), inserted
    cond_resched() in the wrong location.
    
    Revert it now; a subsequent commit will re-backport the original patch.
    
    Fixes: 9f372e86b9bd ("btrfs: avoid monopolizing a core when activating a swap file") # linux-6.12.y
    Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "drm/amd/display: Fix green screen issue after suspend" [+ + +]
Author: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Date:   Thu Nov 14 15:32:52 2024 -0700

    Revert "drm/amd/display: Fix green screen issue after suspend"
    
    commit 04d6273faed083e619fc39a738ab0372b6a4db20 upstream.
    
    This reverts commit 87b7ebc2e16c14d32a912f18206a4d6cc9abc3e8.
    
    A long time ago, we had an issue with the Raven system when it was
    connected to two displays: one with DP and another with HDMI. After the
    system woke up from suspension, we saw a solid green screen caused by an
    underflow generated by bad DCC metadata. To workaround this issue, the
    'commit 87b7ebc2e16c ("drm/amd/display: Fix green screen issue after
    suspend")' was introduced to disable the DCC for a few frames after in
    the resume phase. However, in hindsight, this solution was probably a
    workaround at the kernel level for some issues from another part
    (probably other driver components or user space). After applying this
    patch and trying to reproduce the green issue in a similar hardware
    system but using the latest kernel and userspace, we cannot see the
    issue, which makes this workaround obsolete and creates extra
    unnecessary complexity to the code; for all of this reason, this commit
    reverts the original change.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "drm/amd/display: Use HW lock mgr for PSR1" [+ + +]
Author: Tom Chung <chiahsuan.chung@amd.com>
Date:   Tue Feb 4 15:07:44 2025 +0800

    Revert "drm/amd/display: Use HW lock mgr for PSR1"
    
    commit f245b400a223a71d6d5f4c72a2cb9b573a7fc2b6 upstream.
    
    This reverts commit
    a2b5a9956269 ("drm/amd/display: Use HW lock mgr for PSR1")
    
    Because it may cause system hang while connect with two edp panel.
    
    Acked-by: Wayne Lin <wayne.lin@amd.com>
    Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "media: uvcvideo: Require entities to have a non-zero unique ID" [+ + +]
Author: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Date:   Tue Jan 14 17:00:45 2025 -0300

    Revert "media: uvcvideo: Require entities to have a non-zero unique ID"
    
    commit 8004d635f27bbccaa5c083c50d4d5302a6ffa00e upstream.
    
    This reverts commit 3dd075fe8ebbc6fcbf998f81a75b8c4b159a6195.
    
    Tomasz has reported that his device, Generalplus Technology Inc. 808 Camera,
    with ID 1b3f:2002, stopped being detected:
    
    $ ls -l /dev/video*
    zsh: no matches found: /dev/video*
    [    7.230599] usb 3-2: Found multiple Units with ID 5
    
    This particular device is non-compliant, having both the Output Terminal
    and Processing Unit with ID 5. uvc_scan_fallback, though, is able to build
    a chain. However, when media elements are added and uvc_mc_create_links
    call uvc_entity_by_id, it will get the incorrect entity,
    media_create_pad_link will WARN, and it will fail to register the entities.
    
    In order to reinstate support for such devices in a timely fashion,
    reverting the fix for these warnings is appropriate. A proper fix that
    considers the existence of such non-compliant devices will be submitted in
    a later development cycle.
    
    Reported-by: Tomasz Sikora <sikora.tomus@gmail.com>
    Fixes: 3dd075fe8ebb ("media: uvcvideo: Require entities to have a non-zero unique ID")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20250114200045.1401644-1-cascardo@igalia.com
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "MIPS: csrc-r4k: Select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT" [+ + +]
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Mon Dec 23 17:20:41 2024 +0800

    Revert "MIPS: csrc-r4k: Select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT"
    
    commit 078b831638e1aa06dd7ffa9f244c8ac6b2995561 upstream.
    
    This reverts commit 426fa8e4fe7bb914b5977cbce453a9926bf5b2e6.
    
    The commit has caused two issues on Loongson 3A4000:
    
    1. The timestamp in dmesg become erratic, like:
    
        [3.736957] amdgpu 0000:04:00.0: ... ...
        [3.748895] [drm] Initialized amdgpu ... ...
        [18446744073.381141] amdgpu 0000:04:00:0: ... ...
        [1.613326] igb 0000:03:00.0 enp3s0: ... ...
    
    2. More seriously, some workloads (for example, the test
       stdlib/test-cxa_atexit2 in the Glibc test suite) triggers an RCU
       stall and hang the system with a high probably (4 hangs out of 5
       tests).
    
    Revert this commit to use jiffie on Loongson MIPS systems and fix these
    issues for now.  The root cause may need more investigation.
    
    Cc: stable@vger.kernel.org # 6.11+
    Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Cc: Icenowy Zheng <icenowy@aosc.io>
    Signed-off-by: Xi Ruoyao <xry111@xry111.site>
    Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "selftests/sched_ext: fix build after renames in sched_ext API" [+ + +]
Author: Libo Chen <libo.chen@oracle.com>
Date:   Tue Feb 11 17:11:37 2025 -0800

    Revert "selftests/sched_ext: fix build after renames in sched_ext API"
    
    This reverts commit fc20e87419e59d86f3bbcee2d4506bcd01c6450a which is
    commit ef7009decc30eb2515a64253791d61b72229c119 upstream.
    
    Commit "selftests/sched_ext: fix build after renames in sched_ext API”
    was pulled into 6.12.y without the sched_ext API renames it depends on.
    The prereqs can be found in
    https://lore.kernel.org/lkml/20241110200308.103681-1-tj@kernel.org/
    As a result, sched_ext selftests fail to compile.
    
    Cc: stable@vger.kernel.org
    Fixes: fc20e87419e59 ("selftests/sched_ext: fix build after renames in sched_ext API")
    Signed-off-by: Libo Chen <libo.chen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ring-buffer: Do not allow events in NMI with generic atomic64 cmpxchg() [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Mon Jan 20 18:56:56 2025 -0500

    ring-buffer: Do not allow events in NMI with generic atomic64 cmpxchg()
    
    commit cd2375a3567fd3d93aa6c68e0027a5756213bda0 upstream.
    
    Some architectures can not safely do atomic64 operations in NMI context.
    Since the ring buffer relies on atomic64 operations to do its time
    keeping, if an event is requested in NMI context, reject it for these
    architectures.
    
    Cc: stable@vger.kernel.org
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Andreas Larsson <andreas@gaisler.com>
    Link: https://lore.kernel.org/20250120235721.407068250@goodmis.org
    Fixes: c84897c0ff592 ("ring-buffer: Remove 32bit timestamp logic")
    Closes: https://lore.kernel.org/all/86fb4f86-a0e4-45a2-a2df-3154acc4f086@gaisler.com/
    Reported-by: Ludwig Rydberg <ludwig.rydberg@gaisler.com>
    Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ring-buffer: Make reading page consistent with the code logic [+ + +]
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Sat Jan 11 01:26:12 2025 +0900

    ring-buffer: Make reading page consistent with the code logic
    
    [ Upstream commit 6e31b759b076eebb4184117234f0c4eb9e4bc460 ]
    
    In the loop of __rb_map_vma(), the 's' variable is calculated from the
    same logic that nr_pages is and they both come from nr_subbufs. But the
    relationship is not obvious and there's a WARN_ON_ONCE() around the 's'
    variable to make sure it never becomes equal to nr_subbufs within the
    loop. If that happens, then the code is buggy and needs to be fixed.
    
    The 'page' variable is calculated from cpu_buffer->subbuf_ids[s] which is
    an array of 'nr_subbufs' entries. If the code becomes buggy and 's'
    becomes equal to or greater than 'nr_subbufs' then this will be an out of
    bounds hit before the WARN_ON() is triggered and the code exiting safely.
    
    Make the 'page' initialization consistent with the code logic and assign
    it after the out of bounds check.
    
    Link: https://lore.kernel.org/20250110162612.13983-1-aha310510@gmail.com
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    [ sdr: rewrote change log ]
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rtc: zynqmp: Fix optional clock name property [+ + +]
Author: Michal Simek <michal.simek@amd.com>
Date:   Wed Nov 27 17:01:22 2024 +0100

    rtc: zynqmp: Fix optional clock name property
    
    commit 2a388ff22d2cbfc5cbd628ef085bdcd3b7dc64f5 upstream.
    
    Clock description in DT binding introduced by commit f69060c14431
    ("dt-bindings: rtc: zynqmp: Add clock information") is talking about "rtc"
    clock name but driver is checking "rtc_clk" name instead.
    Because clock is optional property likely in was never handled properly by
    the driver.
    
    Fixes: 07dcc6f9c762 ("rtc: zynqmp: Add calibration set and get support")
    Signed-off-by: Michal Simek <michal.simek@amd.com>
    Cc: stable@kernel.org
    Reviewed-by: Peter Korsgaard <peter@korsgaard.com>
    Link: https://lore.kernel.org/r/cd5f0c9d01ec1f5a240e37a7e0d85b8dacb3a869.1732723280.git.michal.simek@amd.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rtla/osnoise: Distinguish missing workload option [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Tue Jan 7 15:48:21 2025 +0100

    rtla/osnoise: Distinguish missing workload option
    
    commit 80d3ba1cf51bfbbb3b098434f2b2c95cd7c0ae5c upstream.
    
    osnoise_set_workload returns -1 for both missing OSNOISE_WORKLOAD option
    and failure in setting the option.
    
    Return -1 for missing and -2 for failure to distinguish them.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Link: https://lore.kernel.org/20250107144823.239782-2-tglozar@redhat.com
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Tue Jan 7 15:48:22 2025 +0100

    rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
    
    commit d8d866171a414ed88bd0d720864095fd75461134 upstream.
    
    When using rtla timerlat with userspace threads (-u or -U), rtla
    disables the OSNOISE_WORKLOAD option in
    /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a
    subsequent run with kernel-space threads, leading to rtla collecting no
    results if the previous run exited abnormally:
    
    $ rtla timerlat hist -u
    ^\Quit (core dumped)
    $ rtla timerlat hist -k -d 1s
    Index
    over:
    count:
    min:
    avg:
    max:
    ALL:        IRQ       Thr       Usr
    count:        0         0         0
    min:          -         -         -
    avg:          -         -         -
    max:          -         -         -
    
    The issue persists until OSNOISE_WORKLOAD is set manually by running:
    $ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
    
    Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if
    available to fix the issue.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Link: https://lore.kernel.org/20250107144823.239782-3-tglozar@redhat.com
    Fixes: ed774f7481fa ("rtla/timerlat_hist: Add timerlat user-space support")
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rtla/timerlat_hist: Stop timerlat tracer on signal [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Thu Jan 16 15:49:28 2025 +0100

    rtla/timerlat_hist: Stop timerlat tracer on signal
    
    commit c73cab9dbed04d8f65ca69177b4b21ed3e09dfa7 upstream.
    
    Currently, when either SIGINT from the user or SIGALRM from the duration
    timer is caught by rtla-timerlat, stop_tracing is set to break out of
    the main loop. This is not sufficient for cases where the timerlat
    tracer is producing more data than rtla can consume, since in that case,
    rtla is looping indefinitely inside tracefs_iterate_raw_events, never
    reaches the check of stop_tracing and hangs.
    
    In addition to setting stop_tracing, also stop the timerlat tracer on
    received signal (SIGINT or SIGALRM). This will stop new samples so that
    the existing samples may be processed and tracefs_iterate_raw_events
    eventually exits.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Cc: Gabriele Monaco <gmonaco@redhat.com>
    Link: https://lore.kernel.org/20250116144931.649593-3-tglozar@redhat.com
    Fixes: 1eeb6328e8b3 ("rtla/timerlat: Add timerlat hist mode")
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Tue Jan 7 15:48:23 2025 +0100

    rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
    
    commit 217f0b1e990e30a1f06f6d531fdb4530f4788d48 upstream.
    
    When using rtla timerlat with userspace threads (-u or -U), rtla
    disables the OSNOISE_WORKLOAD option in
    /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a
    subsequent run with kernel-space threads, leading to rtla collecting no
    results if the previous run exited abnormally:
    
    $ rtla timerlat top -u
    ^\Quit (core dumped)
    $ rtla timerlat top -k -d 1s
                                         Timer Latency
      0 00:00:01   |          IRQ Timer Latency (us)        |         Thread Timer Latency (us)
    CPU COUNT      |      cur       min       avg       max |      cur       min       avg       max
    
    The issue persists until OSNOISE_WORKLOAD is set manually by running:
    $ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
    
    Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if
    available to fix the issue.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Link: https://lore.kernel.org/20250107144823.239782-4-tglozar@redhat.com
    Fixes: cdca4f4e5e8e ("rtla/timerlat_top: Add timerlat user-space support")
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rtla/timerlat_top: Stop timerlat tracer on signal [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Thu Jan 16 15:49:29 2025 +0100

    rtla/timerlat_top: Stop timerlat tracer on signal
    
    commit a4dfce7559d75430c464294ddee554be2a413c4a upstream.
    
    Currently, when either SIGINT from the user or SIGALRM from the duration
    timer is caught by rtla-timerlat, stop_tracing is set to break out of
    the main loop. This is not sufficient for cases where the timerlat
    tracer is producing more data than rtla can consume, since in that case,
    rtla is looping indefinitely inside tracefs_iterate_raw_events, never
    reaches the check of stop_tracing and hangs.
    
    In addition to setting stop_tracing, also stop the timerlat tracer on
    received signal (SIGINT or SIGALRM). This will stop new samples so that
    the existing samples may be processed and tracefs_iterate_raw_events
    eventually exits.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Cc: Gabriele Monaco <gmonaco@redhat.com>
    Link: https://lore.kernel.org/20250116144931.649593-4-tglozar@redhat.com
    Fixes: a828cd18bc4a ("rtla: Add timerlat tool and timelart top mode")
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rtla: Add trace_instance_stop [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Thu Jan 16 15:49:27 2025 +0100

    rtla: Add trace_instance_stop
    
    commit e879b5dcf8d044f3865a32d95cc5b213f314c54f upstream.
    
    Support not only turning trace on for the timerlat tracer, but also
    turning it off.
    
    This will be used in subsequent patches to stop the timerlat tracer
    without also wiping the trace buffer.
    
    Cc: stable@vger.kernel.org
    Cc: John Kacur <jkacur@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Cc: Gabriele Monaco <gmonaco@redhat.com>
    Link: https://lore.kernel.org/20250116144931.649593-2-tglozar@redhat.com
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rust: init: use explicit ABI to clean warning in future compilers [+ + +]
Author: Miguel Ojeda <ojeda@kernel.org>
Date:   Tue Jan 21 21:09:34 2025 +0100

    rust: init: use explicit ABI to clean warning in future compilers
    
    commit c21bdb3d8a850afdfa4afe77eea39ae9533629b0 upstream.
    
    Starting with Rust 1.86.0 (currently in nightly, to be released on
    2025-04-03), the `missing_abi` lint is warn-by-default [1]:
    
        error: extern declarations without an explicit ABI are deprecated
            --> rust/doctests_kernel_generated.rs:3158:1
             |
        3158 | extern {
             | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
             |
             = note: `-D missing-abi` implied by `-D warnings`
             = help: to override `-D warnings` add `#[allow(missing_abi)]`
    
    Thus clean it up.
    
    Cc: <stable@vger.kernel.org> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs).
    Fixes: 7f8977a7fe6d ("rust: init: add `{pin_}chain` functions to `{Pin}Init<T, E>`")
    Link: https://github.com/rust-lang/rust/pull/132397 [1]
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Reviewed-by: Fiona Behrens <me@kloenk.dev>
    Link: https://lore.kernel.org/r/20250121200934.222075-1-ojeda@kernel.org
    [ Added 6.13.y to Cc: stable tag. - Miguel ]
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rv: Reset per-task monitors also for idle tasks [+ + +]
Author: Gabriele Monaco <gmonaco@redhat.com>
Date:   Wed Jan 15 16:15:48 2025 +0100

    rv: Reset per-task monitors also for idle tasks
    
    commit 8259cb14a70680553d5e82d65d1302fe589e9b39 upstream.
    
    RV per-task monitors are implemented through a monitor structure
    available for each task_struct. This structure is reset every time the
    monitor is (re-)started, to avoid inconsistencies if the monitor was
    activated previously.
    To do so, we reset the monitor on all threads using the macro
    for_each_process_thread. However, this macro excludes the idle tasks on
    each CPU. Idle tasks could be considered tasks on their own right and it
    should be up to the model whether to ignore them or not.
    
    Reset monitors also on the idle tasks for each present CPU whenever we
    reset all per-task monitors.
    
    Cc: stable@vger.kernel.org
    Cc: Juri Lelli <juri.lelli@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: John Kacur <jkacur@redhat.com>
    Link: https://lore.kernel.org/20250115151547.605750-2-gmonaco@redhat.com
    Fixes: 792575348ff7 ("rv/include: Add deterministic automata monitor definition via C macros")
    Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rxrpc: Fix call state set to not include the SERVER_SECURING state [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Feb 4 23:05:53 2025 +0000

    rxrpc: Fix call state set to not include the SERVER_SECURING state
    
    [ Upstream commit 41b996ce83bf944de5569d6263c8dbd5513e7ed0 ]
    
    The RXRPC_CALL_SERVER_SECURING state doesn't really belong with the other
    states in the call's state set as the other states govern the call's Rx/Tx
    phase transition and govern when packets can and can't be received or
    transmitted.  The "Securing" state doesn't actually govern the reception of
    packets and would need to be split depending on whether or not we've
    received the last packet yet (to mirror RECV_REQUEST/ACK_REQUEST).
    
    The "Securing" state is more about whether or not we can start forwarding
    packets to the application as recvmsg will need to decode them and the
    decoding can't take place until the challenge/response exchange has
    completed.
    
    Fix this by removing the RXRPC_CALL_SERVER_SECURING state from the state
    set and, instead, using a flag, RXRPC_CALL_CONN_CHALLENGING, to track
    whether or not we can queue the call for reception by recvmsg() or notify
    the kernel app that data is ready.  In the event that we've already
    received all the packets, the connection event handler will poke the app
    layer in the appropriate manner.
    
    Also there's a race whereby the app layer sees the last packet before rxrpc
    has managed to end the rx phase and change the state to one amenable to
    allowing a reply.  Fix this by queuing the packet after calling
    rxrpc_end_rx_phase().
    
    Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Simon Horman <horms@kernel.org>
    cc: linux-afs@lists.infradead.org
    Link: https://patch.msgid.link/20250204230558.712536-2-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rxrpc: Fix the rxrpc_connection attend queue handling [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Mon Feb 3 11:03:04 2025 +0000

    rxrpc: Fix the rxrpc_connection attend queue handling
    
    [ Upstream commit 4241a702e0d0c2ca9364cfac08dbf134264962de ]
    
    The rxrpc_connection attend queue is never used because conn::attend_link
    is never initialised and so is always NULL'd out and thus always appears to
    be busy.  This requires the following fix:
    
     (1) Fix this the attend queue problem by initialising conn::attend_link.
    
    And, consequently, two further fixes for things masked by the above bug:
    
     (2) Fix rxrpc_input_conn_event() to handle being invoked with a NULL
         sk_buff pointer - something that can now happen with the above change.
    
     (3) Fix the RXRPC_SKB_MARK_SERVICE_CONN_SECURED message to carry a pointer
         to the connection and a ref on it.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Jakub Kicinski <kuba@kernel.org>
    cc: "David S. Miller" <davem@davemloft.net>
    cc: Eric Dumazet <edumazet@google.com>
    cc: Paolo Abeni <pabeni@redhat.com>
    cc: Simon Horman <horms@kernel.org>
    cc: linux-afs@lists.infradead.org
    cc: netdev@vger.kernel.org
    Fixes: f2cce89a074e ("rxrpc: Implement a mechanism to send an event notification to a connection")
    Link: https://patch.msgid.link/20250203110307.7265-3-dhowells@redhat.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/fpu: Add fpc exception handler / remove fixup section again [+ + +]
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Fri Jan 10 11:52:17 2025 +0100

    s390/fpu: Add fpc exception handler / remove fixup section again
    
    commit ae02615b7fcea9ce9a4ec40b3c5b5dafd322b179 upstream.
    
    The fixup section was added again by mistake when test_fp_ctl() was
    removed. The reason for the removal of the fixup section is described in
    commit 484a8ed8b7d1 ("s390/extable: add dedicated uaccess handler").
    Remove it again for the same reason.
    
    Add an exception handler which handles exceptions when the floating point
    control register is attempted to be set to invalid values. The exception
    handler sets the floating point control register to zero and continues
    execution at the specified address.
    
    The new sfpc inline assembly is open-coded to make back porting a bit
    easier.
    
    Fixes: 702644249d3e ("s390/fpu: get rid of test_fp_ctl()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/futex: Fix FUTEX_OP_ANDN implementation [+ + +]
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Jan 7 11:28:58 2025 +0100

    s390/futex: Fix FUTEX_OP_ANDN implementation
    
    commit 26701574cee6777f867f89b4a5c667817e1ee0dd upstream.
    
    The futex operation FUTEX_OP_ANDN is supposed to implement
    
    *(int *)UADDR2 &= ~OPARG;
    
    The s390 implementation just implements an AND instead of ANDN.
    Add the missing bitwise not operation to oparg to fix this.
    
    This is broken since nearly 19 years, so it looks like user space is
    not making use of this operation.
    
    Fixes: 3363fbdd6fb4 ("[PATCH] s390: futex atomic operations")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/pci: Fix SR-IOV for PFs initially in standby [+ + +]
Author: Niklas Schnelle <schnelle@linux.ibm.com>
Date:   Wed Jan 22 14:36:01 2025 +0100

    s390/pci: Fix SR-IOV for PFs initially in standby
    
    commit dc287e4c9149ab54a5003b4d4da007818b5fda3d upstream.
    
    Since commit 25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs") PFs
    which are not initially configured but in standby are considered
    isolated. That is they create only a single function PCI domain. Due to
    the PCI domains being created on discovery, this means that even if they
    are configured later on, sibling PFs and their child VFs will not be
    added to their PCI domain breaking SR-IOV expectations.
    
    The reason the referenced commit ignored standby PFs for the creation of
    multi-function PCI subhierarchies, was to work around a PCI domain
    renumbering scenario on reboot. The renumbering would occur after
    removing a previously in standby PF, whose domain number is used for its
    configured sibling PFs and their child VFs, but which itself remained in
    standby. When this is followed by a reboot, the sibling PF is used
    instead to determine the PCI domain number of it and its child VFs.
    
    In principle it is not possible to know which standby PFs will be
    configured later and which may be removed. The PCI domain and root bus
    are pre-requisites for hotplug slots so the decision of which functions
    belong to which domain can not be postponed. With the renumbering
    occurring only in rare circumstances and being generally benign, accept
    it as an oddity and fix SR-IOV for initially standby PFs simply by
    allowing them to create PCI domains.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
    Fixes: 25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs")
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/stackleak: Use exrl instead of ex in __stackleak_poison() [+ + +]
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Wed Jan 8 15:27:02 2025 +0100

    s390/stackleak: Use exrl instead of ex in __stackleak_poison()
    
    [ Upstream commit a88c26bb8e04ee5f2678225c0130a5fbc08eef85 ]
    
    exrl is present in all machines currently supported, therefore prefer
    it over ex. This saves one instruction and doesn't need an additional
    register to hold the address of the target instruction.
    
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
safesetid: check size of policy writes [+ + +]
Author: Leo Stone <leocstone@gmail.com>
Date:   Tue Dec 17 10:26:57 2024 -0800

    safesetid: check size of policy writes
    
    [ Upstream commit f09ff307c7299392f1c88f763299e24bc99811c7 ]
    
    syzbot attempts to write a buffer with a large size to a sysfs entry
    with writes handled by handle_policy_update(), triggering a warning
    in kmalloc.
    
    Check the size specified for write buffers before allocating.
    
    Reported-by: syzbot+4eb7a741b3216020043a@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4eb7a741b3216020043a
    Signed-off-by: Leo Stone <leocstone@gmail.com>
    [PM: subject tweak]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sched/fair: Fix inaccurate h_nr_runnable accounting with delayed dequeue [+ + +]
Author: K Prateek Nayak <kprateek.nayak@amd.com>
Date:   Fri Jan 17 10:58:52 2025 +0000

    sched/fair: Fix inaccurate h_nr_runnable accounting with delayed dequeue
    
    [ Upstream commit 3429dd57f0deb1a602c2624a1dd7c4c11b6c4734 ]
    
    set_delayed() adjusts cfs_rq->h_nr_runnable for the hierarchy when an
    entity is delayed irrespective of whether the entity corresponds to a
    task or a cfs_rq.
    
    Consider the following scenario:
    
            root
           /    \
          A      B (*) delayed since B is no longer eligible on root
          |      |
        Task0  Task1 <--- dequeue_task_fair() - task blocks
    
    When Task1 blocks (dequeue_entity() for task's se returns true),
    dequeue_entities() will continue adjusting cfs_rq->h_nr_* for the
    hierarchy of Task1. However, when the sched_entity corresponding to
    cfs_rq B is delayed, set_delayed() will adjust the h_nr_runnable for the
    hierarchy too leading to both dequeue_entity() and set_delayed()
    decrementing h_nr_runnable for the dequeue of the same task.
    
    A SCHED_WARN_ON() to inspect h_nr_runnable post its update in
    dequeue_entities() like below:
    
        cfs_rq->h_nr_runnable -= h_nr_runnable;
        SCHED_WARN_ON(((int) cfs_rq->h_nr_runnable) < 0);
    
    is consistently tripped when running wakeup intensive workloads like
    hackbench in a cgroup.
    
    This error is self correcting since cfs_rq are per-cpu and cannot
    migrate. The entitiy is either picked for full dequeue or is requeued
    when a task wakes up below it. Both those paths call clear_delayed()
    which again increments h_nr_runnable of the hierarchy without
    considering if the entity corresponds to a task or not.
    
    h_nr_runnable will eventually reflect the correct value however in the
    interim, the incorrect values can still influence PELT calculation which
    uses se->runnable_weight or cfs_rq->h_nr_runnable.
    
    Since only delayed tasks take the early return path in
    dequeue_entities() and enqueue_task_fair(), adjust the
    h_nr_runnable in {set,clear}_delayed() only when a task is delayed as
    this path skips the h_nr_* update loops and returns early.
    
    For entities corresponding to cfs_rq, the h_nr_* update loop in the
    caller will do the right thing.
    
    Fixes: 76f2f783294d ("sched/eevdf: More PELT vs DELAYED_DEQUEUE")
    Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
    Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
    Link: https://lkml.kernel.org/r/20250117105852.23908-1-kprateek.nayak@amd.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sched: Don't try to catch up excess steal time. [+ + +]
Author: Suleiman Souhlal <suleiman@google.com>
Date:   Mon Nov 18 13:37:45 2024 +0900

    sched: Don't try to catch up excess steal time.
    
    [ Upstream commit 108ad0999085df2366dd9ef437573955cb3f5586 ]
    
    When steal time exceeds the measured delta when updating clock_task, we
    currently try to catch up the excess in future updates.
    However, this results in inaccurate run times for the future things using
    clock_task, in some situations, as they end up getting additional steal
    time that did not actually happen.
    This is because there is a window between reading the elapsed time in
    update_rq_clock() and sampling the steal time in update_rq_clock_task().
    If the VCPU gets preempted between those two points, any additional
    steal time is accounted to the outgoing task even though the calculated
    delta did not actually contain any of that "stolen" time.
    When this race happens, we can end up with steal time that exceeds the
    calculated delta, and the previous code would try to catch up that excess
    steal time in future clock updates, which is given to the next,
    incoming task, even though it did not actually have any time stolen.
    
    This behavior is particularly bad when steal time can be very long,
    which we've seen when trying to extend steal time to contain the duration
    that the host was suspended [0]. When this happens, clock_task stays
    frozen, during which the running task stays running for the whole
    duration, since its run time doesn't increase.
    However the race can happen even under normal operation.
    
    Ideally we would read the elapsed cpu time and the steal time atomically,
    to prevent this race from happening in the first place, but doing so
    is non-trivial.
    
    Since the time between those two points isn't otherwise accounted anywhere,
    neither to the outgoing task nor the incoming task (because the "end of
    outgoing task" and "start of incoming task" timestamps are the same),
    I would argue that the right thing to do is to simply drop any excess steal
    time, in order to prevent these issues.
    
    [0] https://lore.kernel.org/kvm/20240820043543.837914-1-suleiman@google.com/
    
    Signed-off-by: Suleiman Souhlal <suleiman@google.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20241118043745.1857272-1-suleiman@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scripts/gdb: fix aarch64 userspace detection in get_current_task [+ + +]
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Fri Jan 10 11:36:33 2025 +0100

    scripts/gdb: fix aarch64 userspace detection in get_current_task
    
    commit 4ebc417ef9cb34010a71270421fe320ec5d88aa2 upstream.
    
    At least recent gdb releases (seen with 14.2) return SP_EL0 as signed long
    which lets the right-shift always return 0.
    
    Link: https://lkml.kernel.org/r/dcd2fabc-9131-4b48-8419-6444e2d67454@siemens.com
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Kieran Bingham <kbingham@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>

 
scsi: core: Do not retry I/Os during depopulation [+ + +]
Author: Igor Pylypiv <ipylypiv@google.com>
Date:   Fri Jan 31 10:44:07 2025 -0800

    scsi: core: Do not retry I/Os during depopulation
    
    commit 9ff7c383b8ac0c482a1da7989f703406d78445c6 upstream.
    
    Fail I/Os instead of retry to prevent user space processes from being
    blocked on the I/O completion for several minutes.
    
    Retrying I/Os during "depopulation in progress" or "depopulation restore in
    progress" results in a continuous retry loop until the depopulation
    completes or until the I/O retry loop is aborted due to a timeout by the
    scsi_cmd_runtime_exceeced().
    
    Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs.
    Most I/Os in the depopulation retry loop end up taking several minutes
    before returning the failure to user space.
    
    Cc: stable@vger.kernel.org # 4.18.x: 2bbeb8d scsi: core: Handle depopulation and restoration in progress
    Cc: stable@vger.kernel.org # 4.18.x
    Fixes: e37c7d9a0341 ("scsi: core: sanitize++ in progress")
    Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
    Link: https://lore.kernel.org/r/20250131184408.859579-1-ipylypiv@google.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: qla2xxx: Move FCE Trace buffer allocation to user control [+ + +]
Author: Quinn Tran <qutran@marvell.com>
Date:   Fri Nov 15 18:33:09 2024 +0530

    scsi: qla2xxx: Move FCE Trace buffer allocation to user control
    
    commit 841df27d619ee1f5ca6473e15227b39d6136562d upstream.
    
    Currently FCE Tracing is enabled to log additional ELS events. Instead,
    user will enable or disable this feature through debugfs.
    
    Modify existing DFS knob to allow user to enable or disable this
    feature.
    
    echo [1 | 0] > /sys/kernel/debug/qla2xxx/qla2xxx_??/fce
    cat  /sys/kernel/debug/qla2xxx/qla2xxx_??/fce
    
    Cc: stable@vger.kernel.org
    Fixes: df613b96077c ("[SCSI] qla2xxx: Add Fibre Channel Event (FCE) tracing support.")
    Signed-off-by: Quinn Tran <qutran@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Link: https://lore.kernel.org/r/20241115130313.46826-4-njavali@marvell.com
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: st: Don't set pos_unknown just after device recognition [+ + +]
Author: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Date:   Mon Dec 16 13:37:55 2024 +0200

    scsi: st: Don't set pos_unknown just after device recognition
    
    commit 98b37881b7492ae9048ad48260cc8a6ee9eb39fd upstream.
    
    Commit 9604eea5bd3a ("scsi: st: Add third party poweron reset handling") in
    v6.6 added new code to handle the Power On/Reset Unit Attention (POR UA)
    sense data. This was in addition to the existing method. When this Unit
    Attention is received, the driver blocks attempts to read, write and some
    other operations because the reset may have rewinded the tape. Because of
    the added code, also the initial POR UA resulted in blocking operations,
    including those that are used to set the driver options after the device is
    recognized. Also, reading and writing are refused, whereas they succeeded
    before this commit.
    
    Add code to not set pos_unknown to block operations if the POR UA is
    received from the first test_ready() call after the st device has been
    created. This restores the behavior before v6.6.
    
    Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
    Link: https://lore.kernel.org/r/20241216113755.30415-1-Kai.Makisara@kolumbus.fi
    Fixes: 9604eea5bd3a ("scsi: st: Add third party poweron reset handling")
    CC: stable@vger.kernel.org
    Closes: https://lore.kernel.org/linux-scsi/2201CF73-4795-4D3B-9A79-6EE5215CF58D@kolumbus.fi/
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: storvsc: Set correct data length for sending SCSI command without payload [+ + +]
Author: Long Li <longli@microsoft.com>
Date:   Wed Jan 22 19:07:22 2025 -0800

    scsi: storvsc: Set correct data length for sending SCSI command without payload
    
    commit 87c4b5e8a6b65189abd9ea5010ab308941f964a4 upstream.
    
    In StorVSC, payload->range.len is used to indicate if this SCSI command
    carries payload. This data is allocated as part of the private driver data
    by the upper layer and may get passed to lower driver uninitialized.
    
    For example, the SCSI error handling mid layer may send TEST_UNIT_READY or
    REQUEST_SENSE while reusing the buffer from a failed command. The private
    data section may have stale data from the previous command.
    
    If the SCSI command doesn't carry payload, the driver may use this value as
    is for communicating with host, resulting in possible corruption.
    
    Fix this by always initializing this value.
    
    Fixes: be0cf6ca301c ("scsi: storvsc: Set the tablesize based on the information given by the host")
    Cc: stable@kernel.org
    Tested-by: Roman Kisel <romank@linux.microsoft.com>
    Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
    Reviewed-by: Michael Kelley <mhklinux@outlook.com>
    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://lore.kernel.org/r/1737601642-7759-1-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: ufs: core: Fix the HIGH/LOW_TEMP Bit Definitions [+ + +]
Author: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Date:   Mon Jan 13 10:32:07 2025 -0800

    scsi: ufs: core: Fix the HIGH/LOW_TEMP Bit Definitions
    
    commit 1b3e2d4ec0c5848776cc56d2624998aa5b2f0d27 upstream.
    
    According to the UFS Device Specification, the dExtendedUFSFeaturesSupport
    defines the support for TOO_HIGH_TEMPERATURE as bit[4] and the
    TOO_LOW_TEMPERATURE as bit[5]. Correct the code to match with
    the UFS device specification definition.
    
    Cc: stable@vger.kernel.org
    Fixes: e88e2d32200a ("scsi: ufs: core: Probe for temperature notification support")
    Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
    Link: https://lore.kernel.org/r/69992b3e3e3434a5c7643be5a64de48be892ca46.1736793068.git.quic_nguyenb@quicinc.com
    Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
    Reviewed-by: Peter Wang <peter.wang@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: ufs: core: Fix use-after free in init error and remove paths [+ + +]
Author: André Draszik <andre.draszik@linaro.org>
Date:   Fri Jan 24 15:09:00 2025 +0000

    scsi: ufs: core: Fix use-after free in init error and remove paths
    
    commit f8fb2403ddebb5eea0033d90d9daae4c88749ada upstream.
    
    devm_blk_crypto_profile_init() registers a cleanup handler to run when
    the associated (platform-) device is being released. For UFS, the
    crypto private data and pointers are stored as part of the ufs_hba's
    data structure 'struct ufs_hba::crypto_profile'. This structure is
    allocated as part of the underlying ufshcd and therefore Scsi_host
    allocation.
    
    During driver release or during error handling in ufshcd_pltfrm_init(),
    this structure is released as part of ufshcd_dealloc_host() before the
    (platform-) device associated with the crypto call above is released.
    Once this device is released, the crypto cleanup code will run, using
    the just-released 'struct ufs_hba::crypto_profile'. This causes a
    use-after-free situation:
    
      Call trace:
       kfree+0x60/0x2d8 (P)
       kvfree+0x44/0x60
       blk_crypto_profile_destroy_callback+0x28/0x70
       devm_action_release+0x1c/0x30
       release_nodes+0x6c/0x108
       devres_release_all+0x98/0x100
       device_unbind_cleanup+0x20/0x70
       really_probe+0x218/0x2d0
    
    In other words, the initialisation code flow is:
    
      platform-device probe
        ufshcd_pltfrm_init()
          ufshcd_alloc_host()
            scsi_host_alloc()
              allocation of struct ufs_hba
              creation of scsi-host devices
        devm_blk_crypto_profile_init()
          devm registration of cleanup handler using platform-device
    
    and during error handling of ufshcd_pltfrm_init() or during driver
    removal:
    
      ufshcd_dealloc_host()
        scsi_host_put()
          put_device(scsi-host)
            release of struct ufs_hba
      put_device(platform-device)
        crypto cleanup handler
    
    To fix this use-after free, change ufshcd_alloc_host() to register a
    devres action to automatically cleanup the underlying SCSI device on
    ufshcd destruction, without requiring explicit calls to
    ufshcd_dealloc_host(). This way:
    
        * the crypto profile and all other ufs_hba-owned resources are
          destroyed before SCSI (as they've been registered after)
        * a memleak is plugged in tc-dwc-g210-pci.c remove() as a
          side-effect
        * EXPORT_SYMBOL_GPL(ufshcd_dealloc_host) can be removed fully as
          it's not needed anymore
        * no future drivers using ufshcd_alloc_host() could ever forget
          adding the cleanup
    
    Fixes: cb77cb5abe1f ("blk-crypto: rename blk_keyslot_manager to blk_crypto_profile")
    Fixes: d76d9d7d1009 ("scsi: ufs: use devm_blk_ksm_init()")
    Cc: stable@vger.kernel.org
    Signed-off-by: André Draszik <andre.draszik@linaro.org>
    Link: https://lore.kernel.org/r/20250124-ufshcd-fix-v4-1-c5d0144aae59@linaro.org
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Acked-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: ufs: qcom: Fix crypto key eviction [+ + +]
Author: Eric Biggers <ebiggers@google.com>
Date:   Mon Dec 9 19:08:39 2024 -0800

    scsi: ufs: qcom: Fix crypto key eviction
    
    commit 7a0905caf5665be41094a6ceb5e9d2524de4627a upstream.
    
    Commit 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API")
    introduced an incorrect check of the algorithm ID into the key eviction
    path, and thus qcom_ice_evict_key() is no longer ever called.  Fix it.
    
    Fixes: 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API")
    Cc: stable@vger.kernel.org
    Cc: Abel Vesa <abel.vesa@linaro.org>
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Link: https://lore.kernel.org/r/20241210030839.1118805-1-ebiggers@kernel.org
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
seccomp: passthrough uretprobe systemcall without filtering [+ + +]
Author: Eyal Birger <eyal.birger@gmail.com>
Date:   Sun Feb 2 08:29:20 2025 -0800

    seccomp: passthrough uretprobe systemcall without filtering
    
    commit cf6cb56ef24410fb5308f9655087f1eddf4452e6 upstream.
    
    When attaching uretprobes to processes running inside docker, the attached
    process is segfaulted when encountering the retprobe.
    
    The reason is that now that uretprobe is a system call the default seccomp
    filters in docker block it as they only allow a specific set of known
    syscalls. This is true for other userspace applications which use seccomp
    to control their syscall surface.
    
    Since uretprobe is a "kernel implementation detail" system call which is
    not used by userspace application code directly, it is impractical and
    there's very little point in forcing all userspace applications to
    explicitly allow it in order to avoid crashing tracked processes.
    
    Pass this systemcall through seccomp without depending on configuration.
    
    Note: uretprobe is currently only x86_64 and isn't expected to ever be
    supported in i386.
    
    Fixes: ff474a78cef5 ("uprobe: Add uretprobe syscall to speed up return probe")
    Reported-by: Rafael Buchbinder <rafi@rbk.io>
    Closes: https://lore.kernel.org/lkml/CAHsH6Gs3Eh8DFU0wq58c_LF8A4_+o6z456J7BidmcVY2AqOnHQ@mail.gmail.com/
    Link: https://lore.kernel.org/lkml/20250121182939.33d05470@gandalf.local.home/T/#me2676c378eff2d6a33f3054fed4a5f3afa64e65b
    Link: https://lore.kernel.org/lkml/20250128145806.1849977-1-eyal.birger@gmail.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
    Link: https://lore.kernel.org/r/20250202162921.335813-2-eyal.birger@gmail.com
    [kees: minimized changes for easier backporting, tweaked commit log]
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/net/ipsec: Fix Null pointer dereference in rtattr_pack() [+ + +]
Author: Liu Ye <liuye@kylinos.cn>
Date:   Thu Jan 16 09:30:37 2025 +0800

    selftests/net/ipsec: Fix Null pointer dereference in rtattr_pack()
    
    [ Upstream commit 3a0b7fa095212b51ed63892540c4f249991a2d74 ]
    
    Address Null pointer dereference / undefined behavior in rtattr_pack
    (note that size is 0 in the bad case).
    
    Flagged by cppcheck as:
        tools/testing/selftests/net/ipsec.c:230:25: warning: Possible null pointer
        dereference: payload [nullPointer]
        memcpy(RTA_DATA(attr), payload, size);
                               ^
        tools/testing/selftests/net/ipsec.c:1618:54: note: Calling function 'rtattr_pack',
        4th argument 'NULL' value is 0
        if (rtattr_pack(&req.nh, sizeof(req), XFRMA_IF_ID, NULL, 0)) {
                                                           ^
        tools/testing/selftests/net/ipsec.c:230:25: note: Null pointer dereference
        memcpy(RTA_DATA(attr), payload, size);
                               ^
    Signed-off-by: Liu Ye <liuye@kylinos.cn>
    
    Link: https://patch.msgid.link/20250116013037.29470-1-liuye@kylinos.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests: mptcp: connect: -f: no reconnect [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Tue Feb 4 23:19:53 2025 +0100

    selftests: mptcp: connect: -f: no reconnect
    
    commit 5368a67307b3b2c347dc8965ac55b888be665934 upstream.
    
    The '-f' parameter is there to force the kernel to emit MPTCP FASTCLOSE
    by closing the connection with unread bytes in the receive queue.
    
    The xdisconnect() helper was used to stop the connection, but it does
    more than that: it will shut it down, then wait before reconnecting to
    the same address. This causes the mptcp_join's "fastclose test" to fail
    all the time.
    
    This failure is due to a recent change, with commit 218cc166321f
    ("selftests: mptcp: avoid spurious errors on disconnect"), but that went
    unnoticed because the test is currently ignored. The recent modification
    only shown an existing issue: xdisconnect() doesn't need to be used
    here, only the shutdown() part is needed.
    
    Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
    Cc: stable@vger.kernel.org
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250204-net-mptcp-sft-conn-f-v1-1-6b470c72fffa@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use [+ + +]
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Thu Jan 16 20:22:47 2025 +0200

    serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
    
    commit 9f7dea875cc7f9c1a56a5c688290634a59cd1420 upstream.
    
    In the sh-sci driver, sci_ports[0] is used by earlycon. If the earlycon is
    still active when sci_probe() is called and the new serial port is supposed
    to map to sci_ports[0], return -EBUSY to prevent breaking the earlycon.
    
    This situation should occurs in debug scenarios, and users should be
    aware of the potential conflict.
    
    Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20250116182249.3828577-4-claudiu.beznea.uj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: sh-sci: Drop __initdata macro for port_cfg [+ + +]
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Thu Jan 16 20:22:45 2025 +0200

    serial: sh-sci: Drop __initdata macro for port_cfg
    
    commit eaeee4225dba30bef4d424bdf134a07b7f423e8b upstream.
    
    The port_cfg object is used by serial_console_write(), which serves as
    the write function for the earlycon device. Marking port_cfg as __initdata
    causes it to be freed after kernel initialization, resulting in earlycon
    becoming unavailable thereafter. Remove the __initdata macro from port_cfg
    to resolve this issue.
    
    Fixes: 0b0cced19ab1 ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Fixes: 0b0cced19ab15c9e ("serial: sh-sci: Add CONFIG_SERIAL_EARLYCON support")
    Link: https://lore.kernel.org/r/20250116182249.3828577-2-claudiu.beznea.uj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb: client: change lease epoch type from unsigned int to __u16 [+ + +]
Author: Meetakshi Setiya <msetiya@microsoft.com>
Date:   Thu Feb 6 01:50:41 2025 -0500

    smb: client: change lease epoch type from unsigned int to __u16
    
    commit 57e4a9bd61c308f607bc3e55e8fa02257b06b552 upstream.
    
    MS-SMB2 section 2.2.13.2.10 specifies that 'epoch' should be a 16-bit
    unsigned integer used to track lease state changes. Change the data
    type of all instances of 'epoch' from unsigned int to __u16. This
    simplifies the epoch change comparisons and makes the code more
    compliant with the protocol spec.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix order of arguments of tracepoints [+ + +]
Author: Ruben Devos <devosruben6@gmail.com>
Date:   Sat Jan 18 21:03:30 2025 +0100

    smb: client: fix order of arguments of tracepoints
    
    commit 11f8b80ab9f99291dc88d09855b9f8f43b772335 upstream.
    
    The tracepoints based on smb3_inf_compound_*_class have tcon id and
    session id swapped around. This results in incorrect output in
    `trace-cmd report`.
    
    Fix the order of arguments to resolve this issue. The trace-cmd output
    below shows the before and after of the smb3_delete_enter and
    smb3_delete_done events as an example. The smb3_cmd_* events show the
    correct session and tcon id for reference.
    
    Also fix tracepoint set -> get in the SMB2_OP_GET_REPARSE case.
    
    BEFORE:
    rm-2211  [001] .....  1839.550888: smb3_delete_enter:    xid=281 sid=0x5 tid=0x3d path=\hello2.txt
    rm-2211  [001] .....  1839.550894: smb3_cmd_enter:        sid=0x1ac000000003d tid=0x5 cmd=5 mid=61
    rm-2211  [001] .....  1839.550896: smb3_cmd_enter:        sid=0x1ac000000003d tid=0x5 cmd=6 mid=62
    rm-2211  [001] .....  1839.552091: smb3_cmd_done:         sid=0x1ac000000003d tid=0x5 cmd=5 mid=61
    rm-2211  [001] .....  1839.552093: smb3_cmd_done:         sid=0x1ac000000003d tid=0x5 cmd=6 mid=62
    rm-2211  [001] .....  1839.552103: smb3_delete_done:     xid=281 sid=0x5 tid=0x3d
    
    AFTER:
    rm-2501  [001] .....  3237.656110: smb3_delete_enter:    xid=88 sid=0x1ac0000000041 tid=0x5 path=\hello2.txt
    rm-2501  [001] .....  3237.656122: smb3_cmd_enter:        sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84
    rm-2501  [001] .....  3237.656123: smb3_cmd_enter:        sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85
    rm-2501  [001] .....  3237.657909: smb3_cmd_done:         sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84
    rm-2501  [001] .....  3237.657909: smb3_cmd_done:         sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85
    rm-2501  [001] .....  3237.657922: smb3_delete_done:     xid=88 sid=0x1ac0000000041 tid=0x5
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ruben Devos <devosruben6@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sat Jan 4 15:20:12 2025 +0100

    soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
    
    commit c9c0036c1990da8d2dd33563e327e05a775fcf10 upstream.
    
    Driver removal should fully clean up - unmap the memory.
    
    Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250104142012.115974-2-krzysztof.kozlowski@linaro.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: mediatek: mtk-devapc: Fix leaking IO map on error paths [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sat Jan 4 15:20:11 2025 +0100

    soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
    
    commit c0eb059a4575ed57f265d9883a5203799c19982c upstream.
    
    Error paths of mtk_devapc_probe() should unmap the memory.  Reported by
    Smatch:
    
      drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
    
    Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250104142012.115974-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: qcom: llcc: Enable LLCC_WRCACHE at boot on X1 [+ + +]
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Date:   Thu Dec 19 19:53:29 2024 +0100

    soc: qcom: llcc: Enable LLCC_WRCACHE at boot on X1
    
    commit 35d8bc131de0f0f280f0db42499512d79f05f456 upstream.
    
    The Last Level Cache is split into many slices, each one of which can
    be toggled on or off.
    
    Only certain slices are recommended to be turned on unconditionally,
    in order to reach optimal performance/latency/power levels.
    
    Enable WRCACHE on X1 at boot, in accordance with internal
    recommendations.
    
    No significant performance difference is expected.
    
    Fixes: b3cf69a43502 ("soc: qcom: llcc: Add configuration data for X1E80100")
    Cc: stable@vger.kernel.org
    Reviewed-by: Rajendra Nayak <quic_rjendra@quicinc.com>
    Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241219-topic-llcc_x1e_wrcache-v3-1-b9848d9c3d63@oss.qualcomm.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: qcom: smem_state: fix missing of_node_put in error path [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Thu Aug 22 18:48:51 2024 +0200

    soc: qcom: smem_state: fix missing of_node_put in error path
    
    commit 70096b4990848229d0784c5e51dc3c7c072f1111 upstream.
    
    If of_parse_phandle_with_args() succeeds, the OF node reference should
    be dropped, regardless of number of phandle arguments.
    
    Cc: stable@vger.kernel.org
    Fixes: 9460ae2ff308 ("soc: qcom: Introduce common SMEM state machine code")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20240822164853.231087-2-krzysztof.kozlowski@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: qcom: socinfo: Avoid out of bounds read of serial number [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Mon Dec 30 20:59:35 2024 +0100

    soc: qcom: socinfo: Avoid out of bounds read of serial number
    
    commit 22cf4fae6660b6e1a583a41cbf84e3046ca9ccd0 upstream.
    
    On MSM8916 devices, the serial number exposed in sysfs is constant and does
    not change across individual devices. It's always:
    
      db410c:/sys/devices/soc0$ cat serial_number
      2644893864
    
    The firmware used on MSM8916 exposes SOCINFO_VERSION(0, 8), which does not
    have support for the serial_num field in the socinfo struct. There is an
    existing check to avoid exposing the serial number in that case, but it's
    not correct: When checking the item_size returned by SMEM, we need to make
    sure the *end* of the serial_num is within bounds, instead of comparing
    with the *start* offset. The serial_number currently exposed on MSM8916
    devices is just an out of bounds read of whatever comes after the socinfo
    struct in SMEM.
    
    Fix this by changing offsetof() to offsetofend(), so that the size of the
    field is also taken into account.
    
    Cc: stable@vger.kernel.org
    Fixes: efb448d0a3fc ("soc: qcom: Add socinfo driver")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241230-qcom-socinfo-serialno-oob-v1-1-9b7a890da3da@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: samsung: exynos-pmu: Fix uninitialized ret in tensor_set_bits_atomic() [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sat Jan 4 14:56:05 2025 +0100

    soc: samsung: exynos-pmu: Fix uninitialized ret in tensor_set_bits_atomic()
    
    commit eca836dfd8386b32f1aae60f8e323218ac6a0b75 upstream.
    
    If tensor_set_bits_atomic() is called with a mask of 0 the function will
    just iterate over its bit, not perform any updates and return stack
    value of 'ret'.
    
    Also reported by smatch:
    
      drivers/soc/samsung/exynos-pmu.c:129 tensor_set_bits_atomic() error: uninitialized symbol 'ret'.
    
    Fixes: 0b7c6075022c ("soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250104135605.109209-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
spi: atmel-qspi: Memory barriers after memory-mapped I/O [+ + +]
Author: Bence Csókás <csokas.bence@prolan.hu>
Date:   Thu Dec 19 10:12:58 2024 +0100

    spi: atmel-qspi: Memory barriers after memory-mapped I/O
    
    commit be92ab2de0ee1a13291c3b47b2d7eb24d80c0a2c upstream.
    
    The QSPI peripheral control and status registers are
    accessible via the SoC's APB bus, whereas MMIO transactions'
    data travels on the AHB bus.
    
    Microchip documentation and even sample code from Atmel
    emphasises the need for a memory barrier before the first
    MMIO transaction to the AHB-connected QSPI, and before the
    last write to its registers via APB. This is achieved by
    the following lines in `atmel_qspi_transfer()`:
    
            /* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */
            (void)atmel_qspi_read(aq, QSPI_IFR);
    
    However, the current documentation makes no mention to
    synchronization requirements in the other direction, i.e.
    after the last data written via AHB, and before the first
    register access on APB.
    
    In our case, we were facing an issue where the QSPI peripheral
    would cease to send any new CSR (nCS Rise) interrupts,
    leading to a timeout in `atmel_qspi_wait_for_completion()`
    and ultimately this panic in higher levels:
    
            ubi0 error: ubi_io_write: error -110 while writing 63108 bytes
     to PEB 491:128, written 63104 bytes
    
    After months of extensive research of the codebase, fiddling
    around the debugger with kgdb, and back-and-forth with
    Microchip, we came to the conclusion that the issue is
    probably that the peripheral is still busy receiving on AHB
    when the LASTXFER bit is written to its Control Register
    on APB, therefore this write gets lost, and the peripheral
    still thinks there is more data to come in the MMIO transfer.
    This was first formulated when we noticed that doubling the
    write() of QSPI_CR_LASTXFER seemed to solve the problem.
    
    Ultimately, the solution is to introduce memory barriers
    after the AHB-mapped MMIO transfers, to ensure ordering.
    
    Fixes: d5433def3153 ("mtd: spi-nor: atmel-quadspi: Add spi-mem support to atmel-quadspi")
    Cc: Hari.PrasathGE@microchip.com
    Cc: Mahesh.Abotula@microchip.com
    Cc: Marco.Cardellini@microchip.com
    Cc: stable@vger.kernel.org # c0a0203cf579: ("spi: atmel-quadspi: Create `atmel_qspi_ops`"...)
    Cc: stable@vger.kernel.org # 6.x.y
    Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
    Link: https://patch.msgid.link/20241219091258.395187-1-csokas.bence@prolan.hu
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

spi: atmel-quadspi: Create `atmel_qspi_ops` to support newer SoC families [+ + +]
Author: Csókás, Bence <csokas.bence@prolan.hu>
Date:   Thu Nov 28 18:43:14 2024 +0100

    spi: atmel-quadspi: Create `atmel_qspi_ops` to support newer SoC families
    
    commit c0a0203cf57963792d59b3e4317a1d07b73df42a upstream.
    
    Refactor the code to introduce an ops struct, to prepare for merging
    support for later SoCs, such as SAMA7G5. This code was based on the
    vendor's kernel (linux4microchip). Cc'ing original contributors.
    
    Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
    Link: https://patch.msgid.link/20241128174316.3209354-2-csokas.bence@prolan.hu
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
statmount: let unset strings be empty [+ + +]
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Thu Jan 30 13:15:00 2025 +0100

    statmount: let unset strings be empty
    
    commit e52e97f09fb66fd868260d05bd6b74a9a3db39ee upstream.
    
    Just like it's normal for unset values to be zero, unset strings should be
    empty instead of containing random values.
    
    It seems to be a typical mistake that the mask returned by statmount is not
    checked, which can result in various bugs.
    
    With this fix, these bugs are prevented, since it is highly likely that
    userspace would just want to turn the missing mask case into an empty
    string anyway (most of the recently found cases are of this type).
    
    Link: https://lore.kernel.org/all/CAJfpegsVCPfCn2DpM8iiYSS5DpMsLB8QBUCHecoj6s0Vxf4jzg@mail.gmail.com/
    Fixes: 68385d77c05b ("statmount: simplify string option retrieval")
    Fixes: 46eae99ef733 ("add statmount(2) syscall")
    Cc: stable@vger.kernel.org # v6.8
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Link: https://lore.kernel.org/r/20250130121500.113446-1-mszeredi@redhat.com
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tg3: Disable tg3 PCIe AER on system reboot [+ + +]
Author: Lenny Szubowicz <lszubowi@redhat.com>
Date:   Thu Jan 30 16:57:54 2025 -0500

    tg3: Disable tg3 PCIe AER on system reboot
    
    [ Upstream commit e0efe83ed325277bb70f9435d4d9fc70bebdcca8 ]
    
    Disable PCIe AER on the tg3 device on system reboot on a limited
    list of Dell PowerEdge systems. This prevents a fatal PCIe AER event
    on the tg3 device during the ACPI _PTS (prepare to sleep) method for
    S5 on those systems. The _PTS is invoked by acpi_enter_sleep_state_prep()
    as part of the kernel's reboot sequence as a result of commit
    38f34dba806a ("PM: ACPI: reboot: Reinstate S5 for reboot").
    
    There was an earlier fix for this problem by commit 2ca1c94ce0b6
    ("tg3: Disable tg3 device on system reboot to avoid triggering AER").
    But it was discovered that this earlier fix caused a reboot hang
    when some Dell PowerEdge servers were booted via ipxe. To address
    this reboot hang, the earlier fix was essentially reverted by commit
    9fc3bc764334 ("tg3: power down device only on SYSTEM_POWER_OFF").
    This re-exposed the tg3 PCIe AER on reboot problem.
    
    This fix is not an ideal solution because the root cause of the AER
    is in system firmware. Instead, it's a targeted work-around in the
    tg3 driver.
    
    Note also that the PCIe AER must be disabled on the tg3 device even
    if the system is configured to use "firmware first" error handling.
    
    V3:
       - Fix sparse warning on improper comparison of pdev->current_state
       - Adhere to netdev comment style
    
    Fixes: 9fc3bc764334 ("tg3: power down device only on SYSTEM_POWER_OFF")
    Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
timers/migration: Fix off-by-one root mis-connection [+ + +]
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Wed Feb 5 17:02:20 2025 +0100

    timers/migration: Fix off-by-one root mis-connection
    
    commit 868c9037df626b3c245ee26a290a03ae1f9f58d3 upstream.
    
    Before attaching a new root to the old root, the children counter of the
    new root is checked to verify that only the upcoming CPU's top group have
    been connected to it. However since the recently added commit b729cc1ec21a
    ("timers/migration: Fix another race between hotplug and idle entry/exit")
    this check is not valid anymore because the old root is pre-accounted
    as a child to the new root. Therefore after connecting the upcoming
    CPU's top group to the new root, the children count to be expected must
    be 2 and not 1 anymore.
    
    This omission results in the old root to not be connected to the new
    root. Then eventually the system may run with more than one top level,
    which defeats the purpose of a single idle migrator.
    
    Also the old root is pre-accounted but not connected upon the new root
    creation. But it can be connected to the new root later on. Therefore
    the old root may be accounted twice to the new root. The propagation of
    such overcommit can end up creating a double final top-level root with a
    groupmask incorrectly initialized. Although harmless given that the final
    top level roots will never have a parent to walk up to, this oddity
    opportunistically reported the core issue:
    
      WARNING: CPU: 8 PID: 0 at kernel/time/timer_migration.c:543 tmigr_requires_handle_remote
      CPU: 8 UID: 0 PID: 0 Comm: swapper/8
      RIP: 0010:tmigr_requires_handle_remote
      Call Trace:
       <IRQ>
       ? tmigr_requires_handle_remote
       ? hrtimer_run_queues
       update_process_times
       tick_periodic
       tick_handle_periodic
       __sysvec_apic_timer_interrupt
       sysvec_apic_timer_interrupt
      </IRQ>
    
    Fix the problem by taking the old root into account in the children count
    of the new root so the connection is not omitted.
    
    Also warn when more than one top level group exists to better detect
    similar issues in the future.
    
    Fixes: b729cc1ec21a ("timers/migration: Fix another race between hotplug and idle entry/exit")
    Reported-by: Matt Fleming <mfleming@cloudflare.com>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250205160220.39467-1-frederic@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tipc: re-order conditions in tipc_crypto_key_rcv() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Fri Jan 17 12:36:14 2025 +0300

    tipc: re-order conditions in tipc_crypto_key_rcv()
    
    [ Upstream commit 5fe71fda89745fc3cd95f70d06e9162b595c3702 ]
    
    On a 32bit system the "keylen + sizeof(struct tipc_aead_key)" math could
    have an integer wrapping issue.  It doesn't matter because the "keylen"
    is checked on the next line, but just to make life easier for static
    analysis tools, let's re-order these conditions and avoid the integer
    overflow.
    
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tomoyo: don't emit warning in tomoyo_write_control() [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Mon Dec 16 19:38:40 2024 +0900

    tomoyo: don't emit warning in tomoyo_write_control()
    
    [ Upstream commit 3df7546fc03b8f004eee0b9e3256369f7d096685 ]
    
    syzbot is reporting too large allocation warning at tomoyo_write_control(),
    for one can write a very very long line without new line character. To fix
    this warning, I use __GFP_NOWARN rather than checking for KMALLOC_MAX_SIZE,
    for practically a valid line should be always shorter than 32KB where the
    "too small to fail" memory-allocation rule applies.
    
    One might try to write a valid line that is longer than 32KB, but such
    request will likely fail with -ENOMEM. Therefore, I feel that separately
    returning -EINVAL when a line is longer than KMALLOC_MAX_SIZE is redundant.
    There is no need to distinguish over-32KB and over-KMALLOC_MAX_SIZE.
    
    Reported-by: syzbot+7536f77535e5210a5c76@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=7536f77535e5210a5c76
    Reported-by: Leo Stone <leocstone@gmail.com>
    Closes: https://lkml.kernel.org/r/20241216021459.178759-2-leocstone@gmail.com
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tpm: Change to kvalloc() in eventlog/acpi.c [+ + +]
Author: Jarkko Sakkinen <jarkko@kernel.org>
Date:   Fri Dec 27 17:39:09 2024 +0200

    tpm: Change to kvalloc() in eventlog/acpi.c
    
    commit a3a860bc0fd6c07332e4911cf9a238d20de90173 upstream.
    
    The following failure was reported on HPE ProLiant D320:
    
    [   10.693310][    T1] tpm_tis STM0925:00: 2.0 TPM (device-id 0x3, rev-id 0)
    [   10.848132][    T1] ------------[ cut here ]------------
    [   10.853559][    T1] WARNING: CPU: 59 PID: 1 at mm/page_alloc.c:4727 __alloc_pages_noprof+0x2ca/0x330
    [   10.862827][    T1] Modules linked in:
    [   10.866671][    T1] CPU: 59 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-lp155.2.g52785e2-default #1 openSUSE Tumbleweed (unreleased) 588cd98293a7c9eba9013378d807364c088c9375
    [   10.882741][    T1] Hardware name: HPE ProLiant DL320 Gen12/ProLiant DL320 Gen12, BIOS 1.20 10/28/2024
    [   10.892170][    T1] RIP: 0010:__alloc_pages_noprof+0x2ca/0x330
    [   10.898103][    T1] Code: 24 08 e9 4a fe ff ff e8 34 36 fa ff e9 88 fe ff ff 83 fe 0a 0f 86 b3 fd ff ff 80 3d 01 e7 ce 01 00 75 09 c6 05 f8 e6 ce 01 01 <0f> 0b 45 31 ff e9 e5 fe ff ff f7 c2 00 00 08 00 75 42 89 d9 80 e1
    [   10.917750][    T1] RSP: 0000:ffffb7cf40077980 EFLAGS: 00010246
    [   10.923777][    T1] RAX: 0000000000000000 RBX: 0000000000040cc0 RCX: 0000000000000000
    [   10.931727][    T1] RDX: 0000000000000000 RSI: 000000000000000c RDI: 0000000000040cc0
    
    The above transcript shows that ACPI pointed a 16 MiB buffer for the log
    events because RSI maps to the 'order' parameter of __alloc_pages_noprof().
    Address the bug by moving from devm_kmalloc() to devm_add_action() and
    kvmalloc() and devm_add_action().
    
    Suggested-by: Ard Biesheuvel <ardb@kernel.org>
    Cc: stable@vger.kernel.org # v2.6.16+
    Fixes: 55a82ab3181b ("[PATCH] tpm: add bios measurement log")
    Reported-by: Andy Liang <andy.liang@hpe.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219495
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Takashi Iwai <tiwai@suse.de>
    Tested-by: Andy Liang <andy.liang@hpe.com>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing/osnoise: Fix resetting of tracepoints [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Thu Jan 23 20:41:59 2025 -0500

    tracing/osnoise: Fix resetting of tracepoints
    
    commit e3ff4245928f948f3eb2e852aa350b870421c358 upstream.
    
    If a timerlat tracer is started with the osnoise option OSNOISE_WORKLOAD
    disabled, but then that option is enabled and timerlat is removed, the
    tracepoints that were enabled on timerlat registration do not get
    disabled. If the option is disabled again and timelat is started, then it
    triggers a warning in the tracepoint code due to registering the
    tracepoint again without ever disabling it.
    
    Do not use the same user space defined options to know to disable the
    tracepoints when timerlat is removed. Instead, set a global flag when it
    is enabled and use that flag to know to disable the events.
    
     ~# echo NO_OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
     ~# echo timerlat > /sys/kernel/tracing/current_tracer
     ~# echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
     ~# echo nop > /sys/kernel/tracing/current_tracer
     ~# echo NO_OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
     ~# echo timerlat > /sys/kernel/tracing/current_tracer
    
    Triggers:
    
     ------------[ cut here ]------------
     WARNING: CPU: 6 PID: 1337 at kernel/tracepoint.c:294 tracepoint_add_func+0x3b6/0x3f0
     Modules linked in:
     CPU: 6 UID: 0 PID: 1337 Comm: rtla Not tainted 6.13.0-rc4-test-00018-ga867c441128e-dirty #73
     Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
     RIP: 0010:tracepoint_add_func+0x3b6/0x3f0
     Code: 48 8b 53 28 48 8b 73 20 4c 89 04 24 e8 23 59 11 00 4c 8b 04 24 e9 36 fe ff ff 0f 0b b8 ea ff ff ff 45 84 e4 0f 84 68 fe ff ff <0f> 0b e9 61 fe ff ff 48 8b 7b 18 48 85 ff 0f 84 4f ff ff ff 49 8b
     RSP: 0018:ffffb9b003a87ca0 EFLAGS: 00010202
     RAX: 00000000ffffffef RBX: ffffffff92f30860 RCX: 0000000000000000
     RDX: 0000000000000000 RSI: ffff9bf59e91ccd0 RDI: ffffffff913b6410
     RBP: 000000000000000a R08: 00000000000005c7 R09: 0000000000000002
     R10: ffffb9b003a87ce0 R11: 0000000000000002 R12: 0000000000000001
     R13: ffffb9b003a87ce0 R14: ffffffffffffffef R15: 0000000000000008
     FS:  00007fce81209240(0000) GS:ffff9bf6fdd00000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 000055e99b728000 CR3: 00000001277c0002 CR4: 0000000000172ef0
     Call Trace:
      <TASK>
      ? __warn.cold+0xb7/0x14d
      ? tracepoint_add_func+0x3b6/0x3f0
      ? report_bug+0xea/0x170
      ? handle_bug+0x58/0x90
      ? exc_invalid_op+0x17/0x70
      ? asm_exc_invalid_op+0x1a/0x20
      ? __pfx_trace_sched_migrate_callback+0x10/0x10
      ? tracepoint_add_func+0x3b6/0x3f0
      ? __pfx_trace_sched_migrate_callback+0x10/0x10
      ? __pfx_trace_sched_migrate_callback+0x10/0x10
      tracepoint_probe_register+0x78/0xb0
      ? __pfx_trace_sched_migrate_callback+0x10/0x10
      osnoise_workload_start+0x2b5/0x370
      timerlat_tracer_init+0x76/0x1b0
      tracing_set_tracer+0x244/0x400
      tracing_set_trace_write+0xa0/0xe0
      vfs_write+0xfc/0x570
      ? do_sys_openat2+0x9c/0xe0
      ksys_write+0x72/0xf0
      do_syscall_64+0x79/0x1c0
      entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Tomas Glozar <tglozar@redhat.com>
    Cc: Gabriele Monaco <gmonaco@redhat.com>
    Cc: Luis Goncalves <lgoncalv@redhat.com>
    Cc: John Kacur <jkacur@redhat.com>
    Link: https://lore.kernel.org/20250123204159.4450c88e@gandalf.local.home
    Fixes: e88ed227f639e ("tracing/timerlat: Add user-space interface")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN [+ + +]
Author: Günther Noack <gnoack@google.com>
Date:   Fri Jan 10 14:21:22 2025 +0000

    tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN
    
    commit 2f83e38a095f8bf7c6029883d894668b03b9bd93 upstream.
    
    With this, processes without CAP_SYS_ADMIN are able to use TIOCLINUX with
    subcode TIOCL_SETSEL, in the selection modes TIOCL_SETPOINTER,
    TIOCL_SELCLEAR and TIOCL_SELMOUSEREPORT.
    
    TIOCL_SETSEL was previously changed to require CAP_SYS_ADMIN, as this IOCTL
    let callers change the selection buffer and could be used to simulate
    keypresses.  These three TIOCL_SETSEL selection modes, however, are safe to
    use, as they do not modify the selection buffer.
    
    This fixes a mouse support regression that affected Emacs (invisible mouse
    cursor).
    
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/ee3ec63269b43b34e1c90dd8c9743bf8@finder.org
    Fixes: 8d1b43f6a6df ("tty: Restrict access to TIOCLINUX' copy-and-paste subcommands")
    Signed-off-by: Günther Noack <gnoack@google.com>
    Reviewed-by: Kees Cook <kees@kernel.org>
    Link: https://lore.kernel.org/r/20250110142122.1013222-1-gnoack@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tty: xilinx_uartps: split sysrq handling [+ + +]
Author: Sean Anderson <sean.anderson@linux.dev>
Date:   Fri Jan 10 16:38:22 2025 -0500

    tty: xilinx_uartps: split sysrq handling
    
    commit b06f388994500297bb91be60ffaf6825ecfd2afe upstream.
    
    lockdep detects the following circular locking dependency:
    
    CPU 0                      CPU 1
    ========================== ============================
    cdns_uart_isr()            printk()
      uart_port_lock(port)       console_lock()
                                 cdns_uart_console_write()
                                   if (!port->sysrq)
                                     uart_port_lock(port)
      uart_handle_break()
        port->sysrq = ...
      uart_handle_sysrq_char()
        printk()
          console_lock()
    
    The fixed commit attempts to avoid this situation by only taking the
    port lock in cdns_uart_console_write if port->sysrq unset. However, if
    (as shown above) cdns_uart_console_write runs before port->sysrq is set,
    then it will try to take the port lock anyway. This may result in a
    deadlock.
    
    Fix this by splitting sysrq handling into two parts. We use the prepare
    helper under the port lock and defer handling until we release the lock.
    
    Fixes: 74ea66d4ca06 ("tty: xuartps: Improve sysrq handling")
    Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
    Cc: stable@vger.kernel.org # c980248179d: serial: xilinx_uartps: Use port lock wrappers
    Acked-by: John Ogness <john.ogness@linutronix.de>
    Link: https://lore.kernel.org/r/20250110213822.2107462-1-sean.anderson@linux.dev
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tun: fix group permission check [+ + +]
Author: Stas Sergeev <stsp2@yandex.ru>
Date:   Thu Dec 5 10:36:14 2024 +0300

    tun: fix group permission check
    
    [ Upstream commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3 ]
    
    Currently tun checks the group permission even if the user have matched.
    Besides going against the usual permission semantic, this has a
    very interesting implication: if the tun group is not among the
    supplementary groups of the tun user, then effectively no one can
    access the tun device. CAP_SYS_ADMIN still can, but its the same as
    not setting the tun ownership.
    
    This patch relaxes the group checking so that either the user match
    or the group match is enough. This avoids the situation when no one
    can access the device even though the ownership is properly set.
    
    Also I simplified the logic by removing the redundant inversions:
    tun_not_capable() --> !tun_capable()
    
    Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Link: https://patch.msgid.link/20241205073614.294773-1-stsp2@yandex.ru
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tun: revert fix group permission check [+ + +]
Author: Willem de Bruijn <willemb@google.com>
Date:   Tue Feb 4 11:10:06 2025 -0500

    tun: revert fix group permission check
    
    [ Upstream commit a70c7b3cbc0688016810bb2e0b9b8a0d6a530045 ]
    
    This reverts commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3.
    
    The blamed commit caused a regression when neither tun->owner nor
    tun->group is set. This is intended to be allowed, but now requires
    CAP_NET_ADMIN.
    
    Discussion in the referenced thread pointed out that the original
    issue that prompted this patch can be resolved in userspace.
    
    The relaxed access control may also make a device accessible when it
    previously wasn't, while existing users may depend on it to not be.
    
    This is a clean pure git revert, except for fixing the indentation on
    the gid_valid line that checkpatch correctly flagged.
    
    Fixes: 3ca459eaba1b ("tun: fix group permission check")
    Link: https://lore.kernel.org/netdev/CAFqZXNtkCBT4f+PwyVRmQGoT3p1eVa01fCG_aNtpt6dakXncUg@mail.gmail.com/
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Cc: Ondrej Mosnacek <omosnace@redhat.com>
    Cc: Stas Sergeev <stsp2@yandex.ru>
    Link: https://patch.msgid.link/20250204161015.739430-1-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ubi: Add a check for ubi_num [+ + +]
Author: Denis Arefev <arefev@swemel.ru>
Date:   Mon Dec 2 12:36:52 2024 +0300

    ubi: Add a check for ubi_num
    
    commit 97bbf9e312c3fbaf0baa56120238825d2eb23b8a upstream.
    
    Added a check for ubi_num for negative numbers
    If the variable ubi_num takes negative values then we get:
    
    qemu-system-arm ... -append "ubi.mtd=0,0,0,-22222345" ...
    [    0.745065]  ubi_attach_mtd_dev from ubi_init+0x178/0x218
    [    0.745230]  ubi_init from do_one_initcall+0x70/0x1ac
    [    0.745344]  do_one_initcall from kernel_init_freeable+0x198/0x224
    [    0.745474]  kernel_init_freeable from kernel_init+0x18/0x134
    [    0.745600]  kernel_init from ret_from_fork+0x14/0x28
    [    0.745727] Exception stack(0x90015fb0 to 0x90015ff8)
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 83ff59a06663 ("UBI: support ubi_num on mtd.ubi command line")
    Cc: stable@vger.kernel.org
    Signed-off-by: Denis Arefev <arefev@swemel.ru>
    Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
udp: gso: do not drop small packets when PMTU reduces [+ + +]
Author: Yan Zhai <yan@cloudflare.com>
Date:   Fri Jan 31 00:31:39 2025 -0800

    udp: gso: do not drop small packets when PMTU reduces
    
    [ Upstream commit 235174b2bed88501fda689c113c55737f99332d8 ]
    
    Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO
    for small packets. But the kernel currently dismisses GSO requests only
    after checking MTU/PMTU on gso_size. This means any packets, regardless
    of their payload sizes, could be dropped when PMTU becomes smaller than
    requested gso_size. We encountered this issue in production and it
    caused a reliability problem that new QUIC connection cannot be
    established before PMTU cache expired, while non GSO sockets still
    worked fine at the same time.
    
    Ideally, do not check any GSO related constraints when payload size is
    smaller than requested gso_size, and return EMSGSIZE instead of EINVAL
    on MTU/PMTU check failure to be more specific on the error cause.
    
    Fixes: 4094871db1d6 ("udp: only do GSO if # of segs > 1")
    Signed-off-by: Yan Zhai <yan@cloudflare.com>
    Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: gadget: f_tcm: Decrement command ref count on cleanup [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Wed Dec 11 00:31:48 2024 +0000

    usb: gadget: f_tcm: Decrement command ref count on cleanup
    
    commit 3b2a52e88ab0c9469eaadd4d4c8f57d072477820 upstream.
    
    We submitted the command with TARGET_SCF_ACK_KREF, which requires
    acknowledgment of command completion. If the command fails, make sure to
    decrement the ref count.
    
    Fixes: cff834c16d23 ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/3c667b4d9c8b0b580346a69ff53616b6a74cfea2.1733876548.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_tcm: Don't prepare BOT write request twice [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Wed Dec 11 00:32:07 2024 +0000

    usb: gadget: f_tcm: Don't prepare BOT write request twice
    
    commit 94d9bf671ae314cacc2d7bf96bd233b4abc7cede upstream.
    
    The duplicate kmalloc here is causing memory leak. The request
    preparation in bot_send_write_request is also done in
    usbg_prepare_w_request. Remove the duplicate work.
    
    Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/f4f26c3d586cde0d46f8c3bcb4e8ae32311b650d.1733876548.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Wed Dec 11 00:32:01 2024 +0000

    usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
    
    commit 25224c1f07d31c261d04dfbc705a7a0f314a825d upstream.
    
    Match usb endpoint using fullspeed endpoint descriptor to make sure the
    wMaxPacketSize for fullspeed descriptors is automatically configured.
    
    Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/e4507bc824aed6e7c7f5a718392ab6a7c1480a7f.1733876548.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_tcm: Translate error to sense [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Wed Dec 11 00:31:43 2024 +0000

    usb: gadget: f_tcm: Translate error to sense
    
    commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream.
    
    When respond with check_condition error status, clear from_transport
    input so the target layer can translate the sense reason reported by
    f_tcm.
    
    Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/b2a5577efe7abd0af0051229622cf7d3be5cdcd0.1733876548.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usbnet: ipheth: break up NCM header size computation [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:07 2025 +0100

    usbnet: ipheth: break up NCM header size computation
    
    commit efcbc678a14be268040ffc1fa33c98faf2d55141 upstream.
    
    Originally, the total NCM header size was computed as the sum of two
    vaguely labelled constants. While accurate, it wasn't particularly clear
    where they were coming from.
    
    Use sizes of existing NCM structs where available. Define the total
    NDP16 size based on the maximum amount of DPEs that can fit into the
    iOS-specific fixed-size header.
    
    This change does not fix any particular issue. Rather, it introduces
    intermediate constants that will simplify subsequent commits.
    It should also make it clearer for the reader where the constant values
    come from.
    
    Cc: stable@vger.kernel.org # 6.5.x
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: check that DPE points past NCM header [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:04 2025 +0100

    usbnet: ipheth: check that DPE points past NCM header
    
    commit 429fa68b58cefb9aa9de27e4089637298b46b757 upstream.
    
    By definition, a DPE points at the start of a network frame/datagram.
    Thus it makes no sense for it to point at anything that's part of the
    NCM header. It is not a security issue, but merely an indication of
    a malformed DPE.
    
    Enforce that all DPEs point at the data portion of the URB, past the
    NCM header.
    
    Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: document scope of NCM implementation [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:09 2025 +0100

    usbnet: ipheth: document scope of NCM implementation
    
    commit be154b598fa54136e2be17d6dd13c8a8bc0078ce upstream.
    
    Clarify that the "NCM" implementation in `ipheth` is very limited, as
    iOS devices aren't compatible with the CDC NCM specification in regular
    tethering mode.
    
    For a standards-compliant implementation, one shall turn to
    the `cdc_ncm` module.
    
    Cc: stable@vger.kernel.org # 6.5.x
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: fix DPE OoB read [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:08 2025 +0100

    usbnet: ipheth: fix DPE OoB read
    
    commit ee591f2b281721171896117f9946fced31441418 upstream.
    
    Fix an out-of-bounds DPE read, limit the number of processed DPEs to
    the amount that fits into the fixed-size NDP16 header.
    
    Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: fix possible overflow in DPE length check [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:03 2025 +0100

    usbnet: ipheth: fix possible overflow in DPE length check
    
    commit c219427ed296f94bb4b91d08626776dc7719ee27 upstream.
    
    Originally, it was possible for the DPE length check to overflow if
    wDatagramIndex + wDatagramLength > U16_MAX. This could lead to an OoB
    read.
    
    Move the wDatagramIndex term to the other side of the inequality.
    
    An existing condition ensures that wDatagramIndex < urb->actual_length.
    
    Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: refactor NCM datagram loop [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:06 2025 +0100

    usbnet: ipheth: refactor NCM datagram loop
    
    commit 2a9a196429e98fcc64078366c2679bc40aba5466 upstream.
    
    Introduce an rx_error label to reduce repetitions in the header
    signature checks.
    
    Store wDatagramIndex and wDatagramLength after endianness conversion to
    avoid repeated le16_to_cpu() calls.
    
    Rewrite the loop to return on a null trailing DPE, which is required
    by the CDC NCM spec. In case it is missing, fall through to rx_error.
    
    This change does not fix any particular issue. Its purpose is to
    simplify a subsequent commit that fixes a potential OoB read by limiting
    the maximum amount of processed DPEs.
    
    Cc: stable@vger.kernel.org # 6.5.x
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbnet: ipheth: use static NDP16 location in URB [+ + +]
Author: Foster Snowhill <forst@pen.gy>
Date:   Sun Jan 26 00:54:05 2025 +0100

    usbnet: ipheth: use static NDP16 location in URB
    
    commit 86586dcb75cb8fd062a518aca8ee667938b91efb upstream.
    
    Original code allowed for the start of NDP16 to be anywhere within the
    URB based on the `wNdpIndex` value in NTH16. Only the start position of
    NDP16 was checked, so it was possible for even the fixed-length part
    of NDP16 to extend past the end of URB, leading to an out-of-bounds
    read.
    
    On iOS devices, the NDP16 header always directly follows NTH16. Rely on
    and check for this specific format.
    
    This, along with NCM-specific minimal URB length check that already
    exists, will ensure that the fixed-length part of NDP16 plus a set
    amount of DPEs fit within the URB.
    
    Note that this commit alone does not fully address the OoB read.
    The limit on the amount of DPEs needs to be enforced separately.
    
    Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Foster Snowhill <forst@pen.gy>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vfio/platform: check the bounds of read/write syscalls [+ + +]
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Wed Jan 22 10:38:30 2025 -0700

    vfio/platform: check the bounds of read/write syscalls
    
    commit ce9ff21ea89d191e477a02ad7eabf4f996b80a69 upstream.
    
    count and offset are passed from user space and not checked, only
    offset is capped to 40 bits, which can be used to read/write out of
    bounds of the device.
    
    Fixes: 6e3f26456009 (“vfio/platform: read and write support for the device fd”)
    Cc: stable@vger.kernel.org
    Reported-by: Mostafa Saleh <smostafa@google.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Mostafa Saleh <smostafa@google.com>
    Tested-by: Mostafa Saleh <smostafa@google.com>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vmxnet3: Fix tx queue race condition with XDP [+ + +]
Author: Sankararaman Jayaraman <sankararaman.jayaraman@broadcom.com>
Date:   Fri Jan 31 09:53:41 2025 +0530

    vmxnet3: Fix tx queue race condition with XDP
    
    [ Upstream commit 3f1baa91a1fdf3de9dbad4bd615b35fab347874b ]
    
    If XDP traffic runs on a CPU which is greater than or equal to
    the number of the Tx queues of the NIC, then vmxnet3_xdp_get_tq()
    always picks up queue 0 for transmission as it uses reciprocal scale
    instead of simple modulo operation.
    
    vmxnet3_xdp_xmit() and vmxnet3_xdp_xmit_frame() use the above
    returned queue without any locking which can lead to race conditions
    when multiple XDP xmits run in parallel on different CPU's.
    
    This patch uses a simple module scheme when the current CPU equals or
    exceeds the number of Tx queues on the NIC. It also adds locking in
    vmxnet3_xdp_xmit() and vmxnet3_xdp_xmit_frame() functions.
    
    Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.")
    Signed-off-by: Sankararaman Jayaraman <sankararaman.jayaraman@broadcom.com>
    Signed-off-by: Ronak Doshi <ronak.doshi@broadcom.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250131042340.156547-1-sankararaman.jayaraman@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: brcmfmac: Check the return value of of_property_read_string_index() [+ + +]
Author: Stefan Dösinger <stefan@codeweavers.com>
Date:   Mon Jan 6 20:09:58 2025 +0300

    wifi: brcmfmac: Check the return value of of_property_read_string_index()
    
    [ Upstream commit 082d9e263af8de68f0c34f67b251818205160f6e ]
    
    Somewhen between 6.10 and 6.11 the driver started to crash on my
    MacBookPro14,3. The property doesn't exist and 'tmp' remains
    uninitialized, so we pass a random pointer to devm_kstrdup().
    
    The crash I am getting looks like this:
    
    BUG: unable to handle page fault for address: 00007f033c669379
    PF: supervisor read access in kernel mode
    PF: error_code(0x0001) - permissions violation
    PGD 8000000101341067 P4D 8000000101341067 PUD 101340067 PMD 1013bb067 PTE 800000010aee9025
    Oops: Oops: 0001 [#1] SMP PTI
    CPU: 4 UID: 0 PID: 827 Comm: (udev-worker) Not tainted 6.11.8-gentoo #1
    Hardware name: Apple Inc. MacBookPro14,3/Mac-551B86E5744E2388, BIOS 529.140.2.0.0 06/23/2024
    RIP: 0010:strlen+0x4/0x30
    Code: f7 75 ec 31 c0 c3 cc cc cc cc 48 89 f8 c3 cc cc cc cc 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa <80> 3f 00 74 14 48 89 f8 48 83 c0 01 80 38 00 75 f7 48 29 f8 c3 cc
    RSP: 0018:ffffb4aac0683ad8 EFLAGS: 00010202
    RAX: 00000000ffffffea RBX: 00007f033c669379 RCX: 0000000000000001
    RDX: 0000000000000cc0 RSI: 00007f033c669379 RDI: 00007f033c669379
    RBP: 00000000ffffffea R08: 0000000000000000 R09: 00000000c0ba916a
    R10: ffffffffffffffff R11: ffffffffb61ea260 R12: ffff91f7815b50c8
    R13: 0000000000000cc0 R14: ffff91fafefffe30 R15: ffffb4aac0683b30
    FS:  00007f033ccbe8c0(0000) GS:ffff91faeed00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f033c669379 CR3: 0000000107b1e004 CR4: 00000000003706f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     ? __die+0x23/0x70
     ? page_fault_oops+0x149/0x4c0
     ? raw_spin_rq_lock_nested+0xe/0x20
     ? sched_balance_newidle+0x22b/0x3c0
     ? update_load_avg+0x78/0x770
     ? exc_page_fault+0x6f/0x150
     ? asm_exc_page_fault+0x26/0x30
     ? __pfx_pci_conf1_write+0x10/0x10
     ? strlen+0x4/0x30
     devm_kstrdup+0x25/0x70
     brcmf_of_probe+0x273/0x350 [brcmfmac]
    
    Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://patch.msgid.link/20250106170958.3595-1-stefan@codeweavers.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize() [+ + +]
Author: Marcel Hamer <marcel.hamer@windriver.com>
Date:   Thu Jan 16 14:22:40 2025 +0100

    wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
    
    commit 68abd0c4ebf24cd499841a488b97a6873d5efabb upstream.
    
    On removal of the device or unloading of the kernel module a potential NULL
    pointer dereference occurs.
    
    The following sequence deletes the interface:
    
      brcmf_detach()
        brcmf_remove_interface()
          brcmf_del_if()
    
    Inside the brcmf_del_if() function the drvr->if2bss[ifidx] is updated to
    BRCMF_BSSIDX_INVALID (-1) if the bsscfgidx matches.
    
    After brcmf_remove_interface() call the brcmf_proto_detach() function is
    called providing the following sequence:
    
      brcmf_detach()
        brcmf_proto_detach()
          brcmf_proto_msgbuf_detach()
            brcmf_flowring_detach()
              brcmf_msgbuf_delete_flowring()
                brcmf_msgbuf_remove_flowring()
                  brcmf_flowring_delete()
                    brcmf_get_ifp()
                    brcmf_txfinalize()
    
    Since brcmf_get_ip() can and actually will return NULL in this case the
    call to brcmf_txfinalize() will result in a NULL pointer dereference inside
    brcmf_txfinalize() when trying to update ifp->ndev->stats.tx_errors.
    
    This will only happen if a flowring still has an skb.
    
    Although the NULL pointer dereference has only been seen when trying to
    update the tx statistic, all other uses of the ifp pointer have been
    guarded as well with an early return if ifp is NULL.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Marcel Hamer <marcel.hamer@windriver.com>
    Link: https://lore.kernel.org/all/b519e746-ddfd-421f-d897-7620d229e4b2@gmail.com/
    Acked-by: Arend van Spriel  <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://patch.msgid.link/20250116132240.731039-1-marcel.hamer@windriver.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy() [+ + +]
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Dec 10 10:04:41 2024 +0300

    wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy()
    
    [ Upstream commit 3f4a0948c3524ae50f166dbc6572a3296b014e62 ]
    
    In 'wlc_phy_iqcal_gainparams_nphy()', add gain range check to WARN()
    instead of possible out-of-bounds 'tbl_iqcal_gainparams_nphy' access.
    Compile tested only.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://patch.msgid.link/20241210070441.836362-1-dmantipov@yandex.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: avoid memory leak [+ + +]
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Sat Dec 28 22:34:15 2024 +0200

    wifi: iwlwifi: avoid memory leak
    
    [ Upstream commit 80e96206a3ef348fbd658d98f2f43149c36df8bc ]
    
    A caller of iwl_acpi_get_dsm_object must free the returned object.
    iwl_acpi_get_dsm_integer returns immediately without freeing
    it if the expected size is more than 8 bytes. Fix that.
    
    Note that with the current code this will never happen, since the caller
    of iwl_acpi_get_dsm_integer already checks that the expected size if
    either 1 or 4 bytes, so it can't exceed 8 bytes.
    
    While at it, print the DSM value instead of the return value, as this
    was the intention in the first place.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20241228223206.bf61eaab99f8.Ibdc5df02f885208c222456d42c889c43b7e3b2f7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: pcie: Add support for new device ids [+ + +]
Author: Somashekhar(Som) <somashekhar.puttagangaiah@intel.com>
Date:   Thu Dec 26 17:44:53 2024 +0200

    wifi: iwlwifi: pcie: Add support for new device ids
    
    [ Upstream commit 9b45ba3976945e8d53f2dd40541a66c690f12286 ]
    
    Add support for new device-ids 0x2730 and 0x272F.
    
    Signed-off-by: Somashekhar(Som) <somashekhar.puttagangaiah@intel.com>
    Reviewed-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://patch.msgid.link/20241226174257.6a0db60436e7.I50a66544dde6c88acd9abe4b31badab96ef04cfc@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mt76: mt7915: add module param to select 5 GHz or 6 GHz on MT7916 [+ + +]
Author: Shayne Chen <shayne.chen@mediatek.com>
Date:   Thu Oct 10 10:38:16 2024 +0200

    wifi: mt76: mt7915: add module param to select 5 GHz or 6 GHz on MT7916
    
    commit 57af267d2b8f5d88485c6372761386d79c5e6a1a upstream.
    
    Due to a limitation in available memory, the MT7916 firmware can only
    handle either 5 GHz or 6 GHz at a time. It does not support runtime
    switching without a full restart.
    
    On older firmware, this accidentally worked to some degree due to missing
    checks, but couldn't be supported properly, because it left the 6 GHz
    channels uncalibrated.
    Newer firmware refuses to start on either band if the passed EEPROM
    data indicates support for both.
    
    Deal with this limitation by using a module parameter to specify the
    preferred band in case both are supported.
    
    Fixes: b4d093e321bd ("mt76: mt7915: add 6 GHz support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
    Link: https://patch.msgid.link/20241010083816.51880-1-nbd@nbd.name
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH [+ + +]
Author: Nick Morrow <usbwifi2024@gmail.com>
Date:   Thu Dec 19 08:12:14 2024 -0600

    wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH
    
    commit 47d9a8ba1d7f31c674b6936b3c34ee934aa9b420 upstream.
    
    Add VID/PID 35bc/0107 for recently released TP-Link TXE50UH USB WiFi adapter.
    
    Tested-by: Shang Chieh Tseng <shangchieh.tseng@tsengsy.com>
    Signed-off-by: Nick Morrow <usbwifi2024@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/e797f105-9ca8-41e9-96de-7d25dec09943@gmail.com
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: rtlwifi: rtl8821ae: Fix media status report [+ + +]
Author: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Date:   Wed Dec 18 00:53:11 2024 +0200

    wifi: rtlwifi: rtl8821ae: Fix media status report
    
    commit 66ef0289ac99e155d206ddaa0fdfad09ae3cd007 upstream.
    
    RTL8821AE is stuck transmitting at the lowest rate allowed by the rate
    mask. This is because the firmware doesn't know the device is connected
    to a network.
    
    Fix the macros SET_H2CCMD_MSRRPT_PARM_OPMODE and
    SET_H2CCMD_MSRRPT_PARM_MACID_IND to work on the first byte of __cmd,
    not the second. Now the firmware is correctly notified when the device
    is connected to a network and it activates the rate control.
    
    Before (MCS3):
    
    [  5]   0.00-1.00   sec  12.5 MBytes   105 Mbits/sec    0    339 KBytes
    [  5]   1.00-2.00   sec  10.6 MBytes  89.1 Mbits/sec    0    339 KBytes
    [  5]   2.00-3.00   sec  10.6 MBytes  89.1 Mbits/sec    0    386 KBytes
    [  5]   3.00-4.00   sec  10.6 MBytes  89.1 Mbits/sec    0    386 KBytes
    [  5]   4.00-5.00   sec  10.2 MBytes  86.0 Mbits/sec    0    427 KBytes
    
    After (MCS9):
    
    [  5]   0.00-1.00   sec  33.9 MBytes   284 Mbits/sec    0    771 KBytes
    [  5]   1.00-2.00   sec  31.6 MBytes   265 Mbits/sec    0    865 KBytes
    [  5]   2.00-3.00   sec  29.9 MBytes   251 Mbits/sec    0    963 KBytes
    [  5]   3.00-4.00   sec  28.2 MBytes   237 Mbits/sec    0    963 KBytes
    [  5]   4.00-5.00   sec  26.8 MBytes   224 Mbits/sec    0    963 KBytes
    
    Fixes: 39f40710d0b5 ("rtlwifi: rtl88821ae: Remove usage of private bit manipulation macros")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
    Acked-by: Ping-Ke Shih <pkshih@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/754785b3-8a78-4554-b80d-de5f603b410b@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: rtw88: 8703b: Fix RX/TX issues [+ + +]
Author: Vasily Khoruzhick <anarsoul@gmail.com>
Date:   Thu Jan 2 23:50:53 2025 -0800

    wifi: rtw88: 8703b: Fix RX/TX issues
    
    commit a806a8160a0fcaff368bb510c8a52eff37faf727 upstream.
    
    Fix 3 typos in 8703b driver. 2 typos in calibration routines are not
    fatal and do not seem to have any impact, just fix them to match vendor
    driver.
    
    However the last one in rtw8703b_set_channel_bb() clears too many bits
    in REG_OFDM0_TX_PSD_NOISE, causing TX and RX issues (neither rate goes
    above MCS0-MCS1). Vendor driver clears only 2 most significant bits.
    
    With the last typo fixed, the driver is able to reach MCS7 on Pinebook
    
    Cc: stable@vger.kernel.org
    Fixes: 9bb762b3a957 ("wifi: rtw88: Add definitions for 8703b chip")
    Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
    Acked-by: Ping-Ke Shih <pkshih@realtek.com>
    Tested-by: Fiona Klute <fiona.klute@gmx.de>
    Tested-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250103075107.1337533-1-anarsoul@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: rtw88: add __packed attribute to efuse layout struct [+ + +]
Author: Ping-Ke Shih <pkshih@realtek.com>
Date:   Thu Dec 12 13:42:03 2024 +0800

    wifi: rtw88: add __packed attribute to efuse layout struct
    
    [ Upstream commit 0daa521a1c8c29ffbefe6530f0d276e74e2749d0 ]
    
    The layout struct of efuse should not do address alignment by compiler.
    Otherwise it leads unexpected layout and size for certain arch suc as arm.
    In x86-64, the results are identical before and after this patch.
    
    Also adjust bit-field to prevent over adjacent byte to avoid warning:
      rtw88/rtw8822b.h:66:1: note: offset of packed bit-field `res2` has changed in GCC 4.4
       66 | } __packed;
          | ^
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202412120131.qk0x6OhE-lkp@intel.com/
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20241212054203.135046-1-pkshih@realtek.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtw88: sdio: Fix disconnection after beacon loss [+ + +]
Author: Fiona Klute <fiona.klute@gmx.de>
Date:   Mon Jan 6 15:54:34 2025 +0200

    wifi: rtw88: sdio: Fix disconnection after beacon loss
    
    commit fb2fcfbe5eef9ae26b0425978435ae1308951e51 upstream.
    
    This is the equivalent of commit 28818b4d871b ("wifi: rtw88: usb: Fix
    disconnection after beacon loss") for SDIO chips.
    Tested on Pinephone (RTL8723CS), random disconnections became rare,
    instead of a frequent nuisance.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
    Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> # Tested on Pinebook
    Acked-by: Ping-Ke Shih <pkshih@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250106135434.35936-1-fiona.klute@gmx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: rtw89: add crystal_cap check to avoid setting as overflow value [+ + +]
Author: Chih-Kang Chang <gary.chang@realtek.com>
Date:   Thu Nov 28 13:54:33 2024 +0800

    wifi: rtw89: add crystal_cap check to avoid setting as overflow value
    
    [ Upstream commit 7b98caea39676561f22db58752551161bb36462b ]
    
    In the original flow, the crystal_cap might be calculated as a negative
    value and set as an overflow value. Therefore, we added a check to limit
    the calculated crystal_cap value. Additionally, we shrank the crystal_cap
    adjustment according to specific CFO.
    
    Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20241128055433.11851-7-pkshih@realtek.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/acpi: Fix LAPIC/x2APIC parsing order [+ + +]
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Fri Jan 17 16:14:20 2025 +0800

    x86/acpi: Fix LAPIC/x2APIC parsing order
    
    commit 0141978ae75bd48bac13fca6de131a5071c32011 upstream.
    
    On some systems, the same CPU (with the same APIC ID) is assigned a
    different logical CPU id after commit ec9aedb2aa1a ("x86/acpi: Ignore
    invalid x2APIC entries").
    
    This means that Linux enumerates the CPUs in a different order, which
    violates ACPI specification[1] that states:
    
      "OSPM should initialize processors in the order that they appear in
       the MADT"
    
    The problematic commit parses all LAPIC entries before any x2APIC
    entries, aiming to ignore x2APIC entries with APIC ID < 255 when valid
    LAPIC entries exist. However, it disrupts the CPU enumeration order on
    systems where x2APIC entries precede LAPIC entries in the MADT.
    
    Fix this problem by:
    
     1) Parsing LAPIC entries first without registering them in the
        topology to evaluate whether valid LAPIC entries exist.
    
     2) Restoring the MADT in order parser which invokes either the LAPIC
        or the X2APIC parser function depending on the entry type.
    
    The X2APIC parser still ignores entries < 0xff in case that #1 found
    valid LAPIC entries independent of their position in the MADT table.
    
    Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#madt-processor-local-apic-sapic-structure-entry-order
    Cc: All applicable <stable@vger.kernel.org>
    Reported-by: Jim Mattson <jmattson@google.com>
    Closes: https://lore.kernel.org/all/20241010213136.668672-1-jmattson@google.com/
    Fixes: ec9aedb2aa1a ("x86/acpi: Ignore invalid x2APIC entries")
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Reviewed-by: Jim Mattson <jmattson@google.com>
    Tested-by: Jim Mattson <jmattson@google.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://patch.msgid.link/20250117081420.4046737-1-rui.zhang@intel.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/amd_nb: Restrict init function to AMD-based systems [+ + +]
Author: Yazen Ghannam <yazen.ghannam@amd.com>
Date:   Fri Dec 6 16:11:55 2024 +0000

    x86/amd_nb: Restrict init function to AMD-based systems
    
    [ Upstream commit bee9e840609cc67d0a7d82f22a2130fb7a0a766d ]
    
    The code implicitly operates on AMD-based systems by matching on PCI
    IDs. However, the use of these IDs is going away.
    
    Add an explicit CPU vendor check instead of relying on PCI IDs.
    
    Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20241206161210.163701-3-yazen.ghannam@amd.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/boot: Use '-std=gnu11' to fix build with GCC 15 [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jan 21 18:11:33 2025 -0700

    x86/boot: Use '-std=gnu11' to fix build with GCC 15
    
    commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream.
    
    GCC 15 changed the default C standard version to C23, which should not
    have impacted the kernel because it requests the gnu11 standard via
    '-std=' in the main Makefile. However, the x86 compressed boot Makefile
    uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using
    the default), resulting in errors from the kernel's definitions of bool,
    true, and false in stddef.h, which are reserved keywords under C23.
    
      ./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
         11 |         false   = 0,
      ./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
         35 | typedef _Bool                   bool;
    
    Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the
    error and consistently use the same C standard version for the entire
    kernel.
    
    Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/
    Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/
    Reported-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
    Reported-by: Jakub Jelinek <jakub@redhat.com>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250121-x86-use-std-consistently-gcc-15-v1-1-8ab0acf645cb%40kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/kexec: Allocate PGD for x86_64 transition page tables separately [+ + +]
Author: David Woodhouse <dwmw@amazon.co.uk>
Date:   Thu Dec 5 15:05:11 2024 +0000

    x86/kexec: Allocate PGD for x86_64 transition page tables separately
    
    [ Upstream commit 4b5bc2ec9a239bce261ffeafdd63571134102323 ]
    
    Now that the following fix:
    
      d0ceea662d45 ("x86/mm: Add _PAGE_NOPTISHADOW bit to avoid updating userspace page tables")
    
    stops kernel_ident_mapping_init() from scribbling over the end of a
    4KiB PGD by assuming the following 4KiB will be a userspace PGD,
    there's no good reason for the kexec PGD to be part of a single
    8KiB allocation with the control_code_page.
    
    ( It's not clear that that was the reason for x86_64 kexec doing it that
      way in the first place either; there were no comments to that effect and
      it seems to have been the case even before PTI came along. It looks like
      it was just a happy accident which prevented memory corruption on kexec. )
    
    Either way, it definitely isn't needed now. Just allocate the PGD
    separately on x86_64, like i386 already does.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Cc: Dave Young <dyoung@redhat.com>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Link: https://lore.kernel.org/r/20241205153343.3275139-6-dwmw2@infradead.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/mm: Convert unreachable() to BUG() [+ + +]
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon Dec 16 11:08:12 2024 +0100

    x86/mm: Convert unreachable() to BUG()
    
    commit 41a1e976623eb430f7b5a8619d3810b44e6235ad upstream.
    
    Commit 2190966fbc14 ("x86: Convert unreachable() to BUG()") missed
    one.
    
    And after commit 06e24745985c ("objtool: Remove
    annotate_{,un}reachable()") the invalid use of unreachable()
    (rightfully) triggers warnings:
    
      vmlinux.o: warning: objtool: page_fault_oops() falls through to next function is_prefetch()
    
    Fixes: 2190966fbc14 ("x86: Convert unreachable() to BUG()")
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20241216093215.GD12338@noisy.programming.kicks-ass.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/xen: add FRAME_END to xen_hypercall_hvm() [+ + +]
Author: Juergen Gross <jgross@suse.com>
Date:   Wed Feb 5 10:07:56 2025 +0100

    x86/xen: add FRAME_END to xen_hypercall_hvm()
    
    [ Upstream commit 0bd797b801bd8ee06c822844e20d73aaea0878dd ]
    
    xen_hypercall_hvm() is missing a FRAME_END at the end, add it.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202502030848.HTNTTuo9-lkp@intel.com/
    Fixes: b4845bb63838 ("x86/xen: add central hypercall functions")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

x86/xen: fix xen_hypercall_hvm() to not clobber %rbx [+ + +]
Author: Juergen Gross <jgross@suse.com>
Date:   Wed Feb 5 09:43:31 2025 +0100

    x86/xen: fix xen_hypercall_hvm() to not clobber %rbx
    
    [ Upstream commit 98a5cfd2320966f40fe049a9855f8787f0126825 ]
    
    xen_hypercall_hvm(), which is used when running as a Xen PVH guest at
    most only once during early boot, is clobbering %rbx. Depending on
    whether the caller relies on %rbx to be preserved across the call or
    not, this clobbering might result in an early crash of the system.
    
    This can be avoided by using an already saved register instead of %rbx.
    
    Fixes: b4845bb63838 ("x86/xen: add central hypercall functions")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86: Convert unreachable() to BUG() [+ + +]
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Thu Nov 28 10:39:02 2024 +0100

    x86: Convert unreachable() to BUG()
    
    [ Upstream commit 2190966fbc14ca2cd4ea76eefeb96a47d8e390df ]
    
    Avoid unreachable() as it can (and will in the absence of UBSAN)
    generate fallthrough code. Use BUG() so we get a UD2 trap (with
    unreachable annotation).
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Link: https://lore.kernel.org/r/20241128094312.028316261@infradead.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0 [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Mon Feb 3 08:40:57 2025 +0000

    x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0
    
    commit 6273a058383e05465083b535ed9469f2c8a48321 upstream.
    
    When using Rust on the x86 architecture, we are currently using the
    unstable target.json feature to specify the compilation target. Rustc is
    going to change how softfloat is specified in the target.json file on
    x86, thus update generate_rust_target.rs to specify softfloat using the
    new option.
    
    Note that if you enable this parameter with a compiler that does not
    recognize it, then that triggers a warning but it does not break the
    build.
    
    [ For future reference, this solves the following error:
    
            RUSTC L rust/core.o
          error: Error loading target specification: target feature
          `soft-float` is incompatible with the ABI but gets enabled in
          target spec. Run `rustc --print target-list` for a list of
          built-in targets
    
      - Miguel ]
    
    Cc: <stable@vger.kernel.org> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs).
    Link: https://github.com/rust-lang/rust/pull/136146
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Acked-by: Dave Hansen <dave.hansen@linux.intel.com> # for x86
    Link: https://lore.kernel.org/r/20250203-rustc-1-86-x86-softfloat-v1-1-220a72a5003e@google.com
    [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid
      over-backporting. - Miguel ]
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xfs: Add error handling for xfs_reflink_cancel_cow_range [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Fri Jan 24 11:45:09 2025 +0800

    xfs: Add error handling for xfs_reflink_cancel_cow_range
    
    commit 26b63bee2f6e711c5a169997fd126fddcfb90848 upstream.
    
    In xfs_inactive(), xfs_reflink_cancel_cow_range() is called
    without error handling, risking unnoticed failures and
    inconsistent behavior compared to other parts of the code.
    
    Fix this issue by adding an error handling for the
    xfs_reflink_cancel_cow_range(), improving code robustness.
    
    Fixes: 6231848c3aa5 ("xfs: check for cow blocks before trying to clear them")
    Cc: stable@vger.kernel.org # v4.17
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: attach dquot buffer to dquot log item buffer [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:27:51 2025 -0800

    xfs: attach dquot buffer to dquot log item buffer
    
    commit acc8f8628c3737108f36e5637f4d5daeaf96d90e upstream
    
    Ever since 6.12-rc1, I've observed a pile of warnings from the kernel
    when running fstests with quotas enabled:
    
    WARNING: CPU: 1 PID: 458580 at mm/page_alloc.c:4221 __alloc_pages_noprof+0xc9c/0xf18
    CPU: 1 UID: 0 PID: 458580 Comm: xfsaild/sda3 Tainted: G        W          6.12.0-rc6-djwa #rc6 6ee3e0e531f6457e2d26aa008a3b65ff184b377c
    <snip>
    Call trace:
     __alloc_pages_noprof+0xc9c/0xf18
     alloc_pages_mpol_noprof+0x94/0x240
     alloc_pages_noprof+0x68/0xf8
     new_slab+0x3e0/0x568
     ___slab_alloc+0x5a0/0xb88
     __slab_alloc.constprop.0+0x7c/0xf8
     __kmalloc_noprof+0x404/0x4d0
     xfs_buf_get_map+0x594/0xde0 [xfs 384cb02810558b4c490343c164e9407332118f88]
     xfs_buf_read_map+0x64/0x2e0 [xfs 384cb02810558b4c490343c164e9407332118f88]
     xfs_trans_read_buf_map+0x1dc/0x518 [xfs 384cb02810558b4c490343c164e9407332118f88]
     xfs_qm_dqflush+0xac/0x468 [xfs 384cb02810558b4c490343c164e9407332118f88]
     xfs_qm_dquot_logitem_push+0xe4/0x148 [xfs 384cb02810558b4c490343c164e9407332118f88]
     xfsaild+0x3f4/0xde8 [xfs 384cb02810558b4c490343c164e9407332118f88]
     kthread+0x110/0x128
     ret_from_fork+0x10/0x20
    ---[ end trace 0000000000000000 ]---
    
    This corresponds to the line:
    
            WARN_ON_ONCE(current->flags & PF_MEMALLOC);
    
    within the NOFAIL checks.  What's happening here is that the XFS AIL is
    trying to write a disk quota update back into the filesystem, but for
    that it needs to read the ondisk buffer for the dquot.  The buffer is
    not in memory anymore, probably because it was evicted.  Regardless, the
    buffer cache tries to allocate a new buffer, but those allocations are
    NOFAIL.  The AIL thread has marked itself PF_MEMALLOC (aka noreclaim)
    since commit 43ff2122e6492b ("xfs: on-stack delayed write buffer lists")
    presumably because reclaim can push on XFS to push on the AIL.
    
    An easy way to fix this probably would have been to drop the NOFAIL flag
    from the xfs_buf allocation and open code a retry loop, but then there's
    still the problem that for bs>ps filesystems, the buffer itself could
    require up to 64k worth of pages.
    
    Inode items had similar behavior (multi-page cluster buffers that we
    don't want to allocate in the AIL) which we solved by making transaction
    precommit attach the inode cluster buffers to the dirty log item.  Let's
    solve the dquot problem in the same way.
    
    So: Make a real precommit handler to read the dquot buffer and attach it
    to the log item; pass it to dqflush in the push method; and have the
    iodone function detach the buffer once we've flushed everything.  Add a
    state flag to the log item to track when a thread has entered the
    precommit -> push mechanism to skip the detaching if it turns out that
    the dquot is very busy, as we don't hold the dquot lock between log item
    commit and AIL push).
    
    Reading and attaching the dquot buffer in the precommit hook is inspired
    by the work done for inode cluster buffers some time ago.
    
    Cc: <stable@vger.kernel.org> # v6.12
    Fixes: 903edea6c53f09 ("mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and manner")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: avoid nested calls to __xfs_trans_commit [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:26:33 2025 -0800

    xfs: avoid nested calls to __xfs_trans_commit
    
    commit e96c1e2f262e0993859e266e751977bfad3ca98a upstream
    
    Currently, __xfs_trans_commit calls xfs_defer_finish_noroll, which calls
    __xfs_trans_commit again on the same transaction.  In other words,
    there's function recursion that has caused minor amounts of confusion in
    the past.  There's no reason to keep this around, since there's only one
    place where we actually want the xfs_defer_finish_noroll, and that is in
    the top level xfs_trans_commit call.
    
    Fixes: 98719051e75ccf ("xfs: refactor internal dfops initialization")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: clean up log item accesses in xfs_qm_dqflush{,_done} [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:27:35 2025 -0800

    xfs: clean up log item accesses in xfs_qm_dqflush{,_done}
    
    commit ec88b41b932d5731291dcc0d0d63ea13ab8e07d5 upstream
    
    Clean up these functions a little bit before we move on to the real
    modifications, and make the variable naming consistent for dquot log items.
    
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: convert quotacheck to attach dquot buffers [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:28:07 2025 -0800

    xfs: convert quotacheck to attach dquot buffers
    
    commit ca378189fdfa890a4f0622f85ee41b710bbac271 upstream
    
    Now that we've converted the dquot logging machinery to attach the dquot
    buffer to the li_buf pointer so that the AIL dqflush doesn't have to
    allocate or read buffers in a reclaim path, do the same for the
    quotacheck code so that the reclaim shrinker dqflush call doesn't have
    to do that either.
    
    Cc: <stable@vger.kernel.org> # v6.12
    Fixes: 903edea6c53f09 ("mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and manner")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't call remap_verify_area with sb write protection held [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Jan 22 06:43:21 2025 +0100

    xfs: don't call remap_verify_area with sb write protection held
    
    commit f5f0ed89f13e3e5246404a322ee85169a226bfb5 upstream.
    
    The XFS_IOC_EXCHANGE_RANGE ioctl with the XFS_EXCHANGE_RANGE_TO_EOF flag
    operates on a range bounded by the end of the file.  This means the
    actual amount of blocks exchanged is derived from the inode size, which
    is only stable with the IOLOCK (i_rwsem) held.  Do that, it currently
    calls remap_verify_area from inside the sb write protection which nests
    outside the IOLOCK.  But this makes fsnotify_file_area_perm which is
    called from remap_verify_area unhappy when the kernel is built with
    lockdep and the recently added CONFIG_FANOTIFY_ACCESS_PERMISSIONS
    option.
    
    Fix this by always calling remap_verify_area before taking the write
    protection, and passing a 0 size to remap_verify_area similar to
    the FICLONE/FICLONERANGE ioctls when they are asked to clone until
    the file end.
    
    (Note: the size argument gets passed to fsnotify_file_area_perm, but
    then isn't actually used there).
    
    Fixes: 9a64d9b3109d ("xfs: introduce new file range exchange ioctl")
    Cc: <stable@vger.kernel.org> # v6.10
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't lose solo superblock counter update transactions [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:26:48 2025 -0800

    xfs: don't lose solo superblock counter update transactions
    
    commit c817aabd3b08e8770d89a9a29ae80fead561a1a1 upstream
    
    Superblock counter updates are tracked via per-transaction counters in
    the xfs_trans object.  These changes are then turned into dirty log
    items in xfs_trans_apply_sb_deltas just prior to commiting the log items
    to the CIL.
    
    However, updating the per-transaction counter deltas do not cause
    XFS_TRANS_DIRTY to be set on the transaction.  In other words, a pure sb
    counter update will be silently discarded if there are no other dirty
    log items attached to the transaction.
    
    This is currently not the case anywhere in the filesystem because sb
    counter updates always dirty at least one other metadata item, but let's
    not leave a logic bomb.
    
    Cc: <stable@vger.kernel.org> # v2.6.35
    Fixes: 0924378a689ccb ("xfs: split out iclog writing from xfs_trans_commit()")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't over-report free space or inodes in statvfs [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Thu Dec 12 14:37:56 2024 -0800

    xfs: don't over-report free space or inodes in statvfs
    
    [ Upstream commit 4b8d867ca6e2fc6d152f629fdaf027053b81765a ]
    
    Emmanual Florac reports a strange occurrence when project quota limits
    are enabled, free space is lower than the remaining quota, and someone
    runs statvfs:
    
      # mkfs.xfs -f /dev/sda
      # mount /dev/sda /mnt -o prjquota
      # xfs_quota  -x -c 'limit -p bhard=2G 55' /mnt
      # mkdir /mnt/dir
      # xfs_io -c 'chproj 55' -c 'chattr +P' -c 'stat -vvvv' /mnt/dir
      # fallocate -l 19g /mnt/a
      # df /mnt /mnt/dir
      Filesystem      Size  Used Avail Use% Mounted on
      /dev/sda         20G   20G  345M  99% /mnt
      /dev/sda        2.0G     0  2.0G   0% /mnt
    
    I think the bug here is that xfs_fill_statvfs_from_dquot unconditionally
    assigns to f_bfree without checking that the filesystem has enough free
    space to fill the remaining project quota.  However, this is a
    longstanding behavior of xfs so it's unclear what to do here.
    
    Cc: <stable@vger.kernel.org> # v2.6.18
    Fixes: 932f2c323196c2 ("[XFS] statvfs component of directory/project quota support, code originally by Glen.")
    Reported-by: Emmanuel Florac <eflorac@intellique.com>
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfs: fix mount hang during primary superblock recovery failure [+ + +]
Author: Long Li <leo.lilong@huawei.com>
Date:   Fri Feb 7 11:29:09 2025 -0800

    xfs: fix mount hang during primary superblock recovery failure
    
    commit efebe42d95fbba91dca6e3e32cb9e0612eb56de5 upstream
    
    When mounting an image containing a log with sb modifications that require
    log replay, the mount process hang all the time and stack as follows:
    
      [root@localhost ~]# cat /proc/557/stack
      [<0>] xfs_buftarg_wait+0x31/0x70
      [<0>] xfs_buftarg_drain+0x54/0x350
      [<0>] xfs_mountfs+0x66e/0xe80
      [<0>] xfs_fs_fill_super+0x7f1/0xec0
      [<0>] get_tree_bdev_flags+0x186/0x280
      [<0>] get_tree_bdev+0x18/0x30
      [<0>] xfs_fs_get_tree+0x1d/0x30
      [<0>] vfs_get_tree+0x2d/0x110
      [<0>] path_mount+0xb59/0xfc0
      [<0>] do_mount+0x92/0xc0
      [<0>] __x64_sys_mount+0xc2/0x160
      [<0>] x64_sys_call+0x2de4/0x45c0
      [<0>] do_syscall_64+0xa7/0x240
      [<0>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    During log recovery, while updating the in-memory superblock from the
    primary SB buffer, if an error is encountered, such as superblock
    corruption occurs or some other reasons, we will proceed to out_release
    and release the xfs_buf. However, this is insufficient because the
    xfs_buf's log item has already been initialized and the xfs_buf is held
    by the buffer log item as follows, the xfs_buf will not be released,
    causing the mount thread to hang.
    
      xlog_recover_do_primary_sb_buffer
        xlog_recover_do_reg_buffer
          xlog_recover_validate_buf_type
            xfs_buf_item_init(bp, mp)
    
    The solution is straightforward, we simply need to allow it to be
    handled by the normal buffer write process. The filesystem will be
    shutdown before the submission of buffer_list in xlog_do_recovery_pass(),
    ensuring the correct release of the xfs_buf as follows:
    
      xlog_do_recovery_pass
        error = xlog_recover_process
          xlog_recover_process_data
            xlog_recover_process_ophdr
              xlog_recovery_process_trans
                ...
                  xlog_recover_buf_commit_pass2
                    error = xlog_recover_do_primary_sb_buffer
                      //Encounter error and return
                    if (error)
                      goto out_writebuf
                    ...
                  out_writebuf:
                    xfs_buf_delwri_queue(bp, buffer_list) //add bp to list
                    return  error
                ...
        if (!list_empty(&buffer_list))
          if (error)
            xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR); //shutdown first
          xfs_buf_delwri_submit(&buffer_list); //submit buffers in list
            __xfs_buf_submit
              if (bp->b_mount->m_log && xlog_is_shutdown(bp->b_mount->m_log))
                xfs_buf_ioend_fail(bp)  //release bp correctly
    
    Fixes: 6a18765b54e2 ("xfs: update the file system geometry after recoverying superblock buffers")
    Cc: stable@vger.kernel.org # v6.12
    Signed-off-by: Long Li <leo.lilong@huawei.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: lock dquot buffer before detaching dquot from b_li_list [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:28:54 2025 -0800

    xfs: lock dquot buffer before detaching dquot from b_li_list
    
    commit 111d36d6278756128b7d7fab787fdcbf8221cd98 upstream
    
    We have to lock the buffer before we can delete the dquot log item from
    the buffer's log item list.
    
    Cc: <stable@vger.kernel.org> # v6.13-rc3
    Fixes: acc8f8628c3737 ("xfs: attach dquot buffer to dquot log item buffer")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Fri Jan 24 11:22:28 2025 +0800

    xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
    
    commit fb95897b8c60653805aa09daec575ca30983f768 upstream.
    
    In xfs_dax_write_iomap_end(), directly return the result of
    xfs_reflink_cancel_cow_range() when !written, ensuring proper
    error propagation and improving code robustness.
    
    Fixes: ea6c49b784f0 ("xfs: support CoW in fsdax mode")
    Cc: stable@vger.kernel.org # v6.0
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: release the dquot buf outside of qli_lock [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:28:38 2025 -0800

    xfs: release the dquot buf outside of qli_lock
    
    commit 1aacd3fac248902ea1f7607f2d12b93929a4833b upstream
    
    Lai Yi reported a lockdep complaint about circular locking:
    
     Chain exists of:
       &lp->qli_lock --> &bch->bc_lock --> &l->lock
    
      Possible unsafe locking scenario:
    
            CPU0                    CPU1
            ----                    ----
       lock(&l->lock);
                                    lock(&bch->bc_lock);
                                    lock(&l->lock);
       lock(&lp->qli_lock);
    
    I /think/ the problem here is that xfs_dquot_attach_buf during
    quotacheck will release the buffer while it's holding the qli_lock.
    Because this is a cached buffer, xfs_buf_rele_cached takes b_lock before
    decrementing b_hold.  Other threads have taught lockdep that a locking
    dependency chain is bp->b_lock -> bch->bc_lock -> l(ru)->lock; and that
    another chain is l(ru)->lock -> lp->qli_lock.  Hence we do not want to
    take b_lock while holding qli_lock.
    
    Reported-by: syzbot+3126ab3db03db42e7a31@syzkaller.appspotmail.com
    Cc: <stable@vger.kernel.org> # v6.13-rc3
    Fixes: ca378189fdfa89 ("xfs: convert quotacheck to attach dquot buffers")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: report realtime block quota limits on realtime directories [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Sun Nov 3 20:19:40 2024 -0800

    xfs: report realtime block quota limits on realtime directories
    
    [ Upstream commit 9a17ebfea9d0c7e0bb7409dcf655bf982a5d6e52 ]
    
    On the data device, calling statvfs on a projinherit directory results
    in the block and avail counts being curtailed to the project quota block
    limits, if any are set.  Do the same for realtime files or directories,
    only use the project quota rt block limits.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Stable-dep-of: 4b8d867ca6e2 ("xfs: don't over-report free space or inodes in statvfs")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfs: separate dquot buffer reads from xfs_dqflush [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Feb 7 11:27:20 2025 -0800

    xfs: separate dquot buffer reads from xfs_dqflush
    
    commit a40fe30868ba433ac08376e30132400bec067583 upstream
    
    The first step towards holding the dquot buffer in the li_buf instead of
    reading it in the AIL is to separate the part that reads the buffer from
    the actual flush code.  There should be no functional changes.
    
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>