Changelog in Linux kernel 6.6.90

 
ALSA: ump: Fix buffer overflow at UMP SysEx message conversion [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Apr 29 14:48:41 2025 +0200

    ALSA: ump: Fix buffer overflow at UMP SysEx message conversion
    
    [ Upstream commit 56f1f30e6795b890463d9b20b11e576adf5a2f77 ]
    
    The conversion function from MIDI 1.0 to UMP packet contains an
    internal buffer to keep the incoming MIDI bytes, and its size is 4, as
    it was supposed to be the max size for a MIDI1 UMP packet data.
    However, the implementation overlooked that SysEx is handled in a
    different format, and it can be up to 6 bytes, as found in
    do_convert_to_ump().  It leads eventually to a buffer overflow, and
    may corrupt the memory when a longer SysEx message is received.
    
    The fix is simply to extend the buffer size to 6 to fit with the SysEx
    UMP message.
    
    Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
    Reported-by: Argusee <vr@darknavy.com>
    Link: https://patch.msgid.link/20250429124845.25128-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface() [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Thu Apr 17 04:19:23 2025 +0930

    ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface()
    
    commit f406005e162b660dc405b4f18bf7bcb93a515608 upstream.
    
    During initialisation of Focusrite USB audio interfaces, -EPROTO is
    sometimes returned from usb_set_interface(), which sometimes prevents
    the device from working: subsequent usb_set_interface() and
    uac_clock_source_is_valid() calls fail.
    
    This patch adds up to 5 retries in endpoint_set_interface(), with a
    delay starting at 5ms and doubling each time. 5 retries was chosen to
    allow for longer than expected waits for the interface to start
    responding correctly; in testing, a single 5ms delay was sufficient to
    fix the issue.
    
    Closes: https://github.com/geoffreybennett/fcp-support/issues/2
    Cc: stable@vger.kernel.org
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://patch.msgid.link/Z//7s9dKsmVxHzY2@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Add second USB ID for Jabra Evolve 65 headset [+ + +]
Author: Joachim Priesner <joachim.priesner@web.de>
Date:   Mon Apr 28 07:36:06 2025 +0200

    ALSA: usb-audio: Add second USB ID for Jabra Evolve 65 headset
    
    commit 1149719442d28c96dc63cad432b5a6db7c300e1a upstream.
    
    There seem to be multiple USB device IDs used for these;
    the one I have reports as 0b0e:030c when powered on.
    (When powered off, it reports as 0b0e:0311.)
    
    Signed-off-by: Joachim Priesner <joachim.priesner@web.de>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250428053606.9237-1-joachim.priesner@web.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
amd-xgbe: Fix to ensure dependent features are toggled with RX checksum offload [+ + +]
Author: Vishal Badole <Vishal.Badole@amd.com>
Date:   Thu Apr 24 18:32:48 2025 +0530

    amd-xgbe: Fix to ensure dependent features are toggled with RX checksum offload
    
    commit f04dd30f1bef1ed2e74a4050af6e5e5e3869bac3 upstream.
    
    According to the XGMAC specification, enabling features such as Layer 3
    and Layer 4 Packet Filtering, Split Header and Virtualized Network support
    automatically selects the IPC Full Checksum Offload Engine on the receive
    side.
    
    When RX checksum offload is disabled, these dependent features must also
    be disabled to prevent abnormal behavior caused by mismatched feature
    dependencies.
    
    Ensure that toggling RX checksum offload (disabling or enabling) properly
    disables or enables all dependent features, maintaining consistent and
    expected behavior in the network device.
    
    Cc: stable@vger.kernel.org
    Fixes: 1a510ccf5869 ("amd-xgbe: Add support for VXLAN offload capabilities")
    Signed-off-by: Vishal Badole <Vishal.Badole@amd.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250424130248.428865-1-Vishal.Badole@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: dts: st: Adjust interrupt-controller for stm32mp25 SoCs [+ + +]
Author: Christian Bruel <christian.bruel@foss.st.com>
Date:   Mon Apr 28 14:06:58 2025 +0200

    arm64: dts: st: Adjust interrupt-controller for stm32mp25 SoCs
    
    [ Upstream commit de2b2107d5a41a91ab603e135fb6e408abbee28e ]
    
    Use gic-400 compatible and remove address-cells = <1> on aarch64
    
    Fixes: 5d30d03aaf785 ("arm64: dts: st: introduce stm32mp25 SoCs family")
    Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
    Link: https://lore.kernel.org/r/20250415111654.2103767-2-christian.bruel@foss.st.com
    Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: dts: st: Use 128kB size for aliased GIC400 register access on stm32mp25 SoCs [+ + +]
Author: Christian Bruel <christian.bruel@foss.st.com>
Date:   Mon Apr 28 14:06:59 2025 +0200

    arm64: dts: st: Use 128kB size for aliased GIC400 register access on stm32mp25 SoCs
    
    [ Upstream commit 06c231fe953a26f4bc9d7a37ba1b9b288a59c7c2 ]
    
    Adjust the size of 8kB GIC regions to 128kB so that each 4kB is mapped 16
    times over a 64kB region.
    The offset is then adjusted in the irq-gic driver.
    
    see commit 12e14066f4835 ("irqchip/GIC: Add workaround for aliased GIC400")
    
    Fixes: 5d30d03aaf785 ("arm64: dts: st: introduce stm32mp25 SoCs family")
    Suggested-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
    Acked-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20250415111654.2103767-3-christian.bruel@foss.st.com
    Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: errata: Add missing sentinels to Spectre-BHB MIDR arrays [+ + +]
Author: Will Deacon <will@kernel.org>
Date:   Thu May 1 11:47:47 2025 +0100

    arm64: errata: Add missing sentinels to Spectre-BHB MIDR arrays
    
    commit fee4d171451c1ad9e8aaf65fc0ab7d143a33bd72 upstream.
    
    Commit a5951389e58d ("arm64: errata: Add newer ARM cores to the
    spectre_bhb_loop_affected() lists") added some additional CPUs to the
    Spectre-BHB workaround, including some new arrays for designs that
    require new 'k' values for the workaround to be effective.
    
    Unfortunately, the new arrays omitted the sentinel entry and so
    is_midr_in_range_list() will walk off the end when it doesn't find a
    match. With UBSAN enabled, this leads to a crash during boot when
    is_midr_in_range_list() is inlined (which was more common prior to
    c8c2647e69be ("arm64: Make  _midr_in_range_list() an exported
    function")):
    
     |  Internal error: aarch64 BRK: 00000000f2000001 [#1] PREEMPT SMP
     |  pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
     |  pc : spectre_bhb_loop_affected+0x28/0x30
     |  lr : is_spectre_bhb_affected+0x170/0x190
     | [...]
     |  Call trace:
     |   spectre_bhb_loop_affected+0x28/0x30
     |   update_cpu_capabilities+0xc0/0x184
     |   init_cpu_features+0x188/0x1a4
     |   cpuinfo_store_boot_cpu+0x4c/0x60
     |   smp_prepare_boot_cpu+0x38/0x54
     |   start_kernel+0x8c/0x478
     |   __primary_switched+0xc8/0xd4
     |  Code: 6b09011f 54000061 52801080 d65f03c0 (d4200020)
     |  ---[ end trace 0000000000000000 ]---
     |  Kernel panic - not syncing: aarch64 BRK: Fatal exception
    
    Add the missing sentinel entries.
    
    Cc: Lee Jones <lee@kernel.org>
    Cc: James Morse <james.morse@arm.com>
    Cc: Doug Anderson <dianders@chromium.org>
    Cc: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
    Cc: <stable@vger.kernel.org>
    Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Fixes: a5951389e58d ("arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists")
    Signed-off-by: Will Deacon <will@kernel.org>
    Reviewed-by: Lee Jones <lee@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250501104747.28431-1-will@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ARM: dts: opos6ul: add ksz8081 phy properties [+ + +]
Author: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Date:   Fri Mar 14 17:20:38 2025 +0100

    ARM: dts: opos6ul: add ksz8081 phy properties
    
    [ Upstream commit 6e1a7bc8382b0d4208258f7d2a4474fae788dd90 ]
    
    Commit c7e73b5051d6 ("ARM: imx: mach-imx6ul: remove 14x14 EVK specific
    PHY fixup") removed a PHY fixup that setted the clock mode and the LED
    mode.
    Make the Ethernet interface work again by doing as advised in the
    commit's log, set clock mode and the LED mode in the device tree.
    
    Fixes: c7e73b5051d6 ("ARM: imx: mach-imx6ul: remove 14x14 EVK specific PHY fixup")
    Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
    Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties [+ + +]
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Wed Jan 22 09:21:27 2025 +0100

    ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties
    
    commit 6eab7034579917f207ca6d8e3f4e11e85e0ab7d5 upstream.
    
    On R-Car:
    
        OF: /sound: Read of boolean property 'simple-audio-card,bitclock-master' with a value.
        OF: /sound: Read of boolean property 'simple-audio-card,frame-master' with a value.
    
    or:
    
        OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'bitclock-master' with a value.
        OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'frame-master' with a value.
    
    The use of of_property_read_bool() for non-boolean properties is
    deprecated in favor of of_property_present() when testing for property
    presence.
    
    Replace testing for presence before calling of_property_read_u32() by
    testing for an -EINVAL return value from the latter, to simplify the
    code.
    
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://patch.msgid.link/db10e96fbda121e7456d70e97a013cbfc9755f4d.1737533954.git.geert+renesas@glider.be
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: soc-pcm: Fix hw_params() and DAPM widget sequence [+ + +]
Author: Sheetal <sheetal@nvidia.com>
Date:   Fri Apr 4 10:59:53 2025 +0000

    ASoC: soc-pcm: Fix hw_params() and DAPM widget sequence
    
    [ Upstream commit 9aff2e8df240e84a36f2607f98a0a9924a24e65d ]
    
    Issue:
     When multiple audio streams share a common BE DAI, the BE DAI
     widget can be powered up before its hardware parameters are configured.
     This incorrect sequence leads to intermittent pcm_write errors.
    
     For example, the below Tegra use-case throws an error:
      aplay(2 streams) -> AMX(mux) -> ADX(demux) -> arecord(2 streams),
      here, 'AMX TX' and 'ADX RX' are common BE DAIs.
    
    For above usecase when failure happens below sequence is observed:
     aplay(1) FE open()
      - BE DAI callbacks added to the list
      - BE DAI state = SND_SOC_DPCM_STATE_OPEN
     aplay(2) FE open()
      - BE DAI callbacks are not added to the list as the state is
        already SND_SOC_DPCM_STATE_OPEN during aplay(1) FE open().
     aplay(2) FE hw_params()
      - BE DAI hw_params() callback ignored
     aplay(2) FE prepare()
      - Widget is powered ON without BE DAI hw_params() call
     aplay(1) FE hw_params()
      - BE DAI hw_params() is now called
    
    Fix:
     Add BE DAIs in the list if its state is either SND_SOC_DPCM_STATE_OPEN
     or SND_SOC_DPCM_STATE_HW_PARAMS as well.
    
    It ensures the widget is powered ON after BE DAI hw_params() callback.
    
    Fixes: 0c25db3f7621 ("ASoC: soc-pcm: Don't reconnect an already active BE")
    Signed-off-by: Sheetal <sheetal@nvidia.com>
    Link: https://patch.msgid.link/20250404105953.2784819-1-sheetal@nvidia.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Use of_property_read_bool() [+ + +]
Author: Rob Herring (Arm) <robh@kernel.org>
Date:   Wed Jul 31 13:12:58 2024 -0600

    ASoC: Use of_property_read_bool()
    
    commit 69dd15a8ef0ae494179fd15023aa8172188db6b7 upstream.
    
    Use of_property_read_bool() to read boolean properties rather than
    of_get_property(). This is part of a larger effort to remove callers
    of of_get_property() and similar functions. of_get_property() leaks
    the DT property data pointer which is a problem for dynamically
    allocated nodes which may be freed.
    
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Link: https://patch.msgid.link/20240731191312.1710417-20-robh@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: btusb: avoid NULL pointer dereference in skb_dequeue() [+ + +]
Author: En-Wei Wu <en-wei.wu@canonical.com>
Date:   Mon Apr 21 21:00:37 2025 +0800

    Bluetooth: btusb: avoid NULL pointer dereference in skb_dequeue()
    
    [ Upstream commit 0317b033abcd1d8dd2798f0e2de5e84543d0bd22 ]
    
    A NULL pointer dereference can occur in skb_dequeue() when processing a
    QCA firmware crash dump on WCN7851 (0489:e0f3).
    
    [ 93.672166] Bluetooth: hci0: ACL memdump size(589824)
    
    [ 93.672475] BUG: kernel NULL pointer dereference, address: 0000000000000008
    [ 93.672517] Workqueue: hci0 hci_devcd_rx [bluetooth]
    [ 93.672598] RIP: 0010:skb_dequeue+0x50/0x80
    
    The issue stems from handle_dump_pkt_qca() returning 0 even when a dump
    packet is successfully processed. This is because it incorrectly
    forwards the return value of hci_devcd_init() (which returns 0 on
    success). As a result, the caller (btusb_recv_acl_qca() or
    btusb_recv_evt_qca()) assumes the packet was not handled and passes it
    to hci_recv_frame(), leading to premature kfree() of the skb.
    
    Later, hci_devcd_rx() attempts to dequeue the same skb from the dump
    queue, resulting in a NULL pointer dereference.
    
    Fix this by:
    1. Making handle_dump_pkt_qca() return 0 on success and negative errno
       on failure, consistent with kernel conventions.
    2. Splitting dump packet detection into separate functions for ACL
       and event packets for better structure and readability.
    
    This ensures dump packets are properly identified and consumed, avoiding
    double handling and preventing NULL pointer access.
    
    Fixes: 20981ce2d5a5 ("Bluetooth: btusb: Add WCN6855 devcoredump support")
    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: copy RX timestamp to new fragments [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Thu Apr 24 22:51:03 2025 +0300

    Bluetooth: L2CAP: copy RX timestamp to new fragments
    
    [ Upstream commit 3908feb1bd7f319a10e18d84369a48163264cc7d ]
    
    Copy timestamp too when allocating new skb for received fragment.
    Fixes missing RX timestamps with fragmentation.
    
    Fixes: 4d7ea8ee90e4 ("Bluetooth: L2CAP: Fix handling fragmented length")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bnxt_en: Fix coredump logic to free allocated buffer [+ + +]
Author: Shruti Parab <shruti.parab@broadcom.com>
Date:   Mon Apr 28 15:59:01 2025 -0700

    bnxt_en: Fix coredump logic to free allocated buffer
    
    [ Upstream commit ea9376cf68230e05492f22ca45d329f16e262c7b ]
    
    When handling HWRM_DBG_COREDUMP_LIST FW command in
    bnxt_hwrm_dbg_dma_data(), the allocated buffer info->dest_buf is
    not freed in the error path.  In the normal path, info->dest_buf
    is assigned to coredump->data and it will eventually be freed after
    the coredump is collected.
    
    Free info->dest_buf immediately inside bnxt_hwrm_dbg_dma_data() in
    the error path.
    
    Fixes: c74751f4c392 ("bnxt_en: Return error if FW returns more data than dump length")
    Reported-by: Michael Chan <michael.chan@broadcom.com>
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Shruti Parab <shruti.parab@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bnxt_en: Fix ethtool -d byte order for 32-bit values [+ + +]
Author: Michael Chan <michael.chan@broadcom.com>
Date:   Mon Apr 28 15:59:03 2025 -0700

    bnxt_en: Fix ethtool -d byte order for 32-bit values
    
    [ Upstream commit 02e8be5a032cae0f4ca33c6053c44d83cf4acc93 ]
    
    For version 1 register dump that includes the PCIe stats, the existing
    code incorrectly assumes that all PCIe stats are 64-bit values.  Fix it
    by using an array containing the starting and ending index of the 32-bit
    values.  The loop in bnxt_get_regs() will use the array to do proper
    endian swap for the 32-bit values.
    
    Fixes: b5d600b027eb ("bnxt_en: Add support for 'ethtool -d'")
    Reviewed-by: Shruti Parab <shruti.parab@broadcom.com>
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bnxt_en: Fix out-of-bound memcpy() during ethtool -w [+ + +]
Author: Shruti Parab <shruti.parab@broadcom.com>
Date:   Mon Apr 28 15:59:02 2025 -0700

    bnxt_en: Fix out-of-bound memcpy() during ethtool -w
    
    [ Upstream commit 6b87bd94f34370bbf1dfa59352bed8efab5bf419 ]
    
    When retrieving the FW coredump using ethtool, it can sometimes cause
    memory corruption:
    
    BUG: KFENCE: memory corruption in __bnxt_get_coredump+0x3ef/0x670 [bnxt_en]
    Corrupted memory at 0x000000008f0f30e8 [ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ] (in kfence-#45):
    __bnxt_get_coredump+0x3ef/0x670 [bnxt_en]
    ethtool_get_dump_data+0xdc/0x1a0
    __dev_ethtool+0xa1e/0x1af0
    dev_ethtool+0xa8/0x170
    dev_ioctl+0x1b5/0x580
    sock_do_ioctl+0xab/0xf0
    sock_ioctl+0x1ce/0x2e0
    __x64_sys_ioctl+0x87/0xc0
    do_syscall_64+0x5c/0xf0
    entry_SYSCALL_64_after_hwframe+0x78/0x80
    
    ...
    
    This happens when copying the coredump segment list in
    bnxt_hwrm_dbg_dma_data() with the HWRM_DBG_COREDUMP_LIST FW command.
    The info->dest_buf buffer is allocated based on the number of coredump
    segments returned by the FW.  The segment list is then DMA'ed by
    the FW and the length of the DMA is returned by FW.  The driver then
    copies this DMA'ed segment list to info->dest_buf.
    
    In some cases, this DMA length may exceed the info->dest_buf length
    and cause the above BUG condition.  Fix it by capping the copy
    length to not exceed the length of info->dest_buf.  The extra
    DMA data contains no useful information.
    
    This code path is shared for the HWRM_DBG_COREDUMP_LIST and the
    HWRM_DBG_COREDUMP_RETRIEVE FW commands.  The buffering is different
    for these 2 FW commands.  To simplify the logic, we need to move
    the line to adjust the buffer length for HWRM_DBG_COREDUMP_RETRIEVE
    up, so that the new check to cap the copy length will work for both
    commands.
    
    Fixes: c74751f4c392 ("bnxt_en: Return error if FW returns more data than dump length")
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Shruti Parab <shruti.parab@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
book3s64/radix : Align section vmemmap start address to PAGE_SIZE [+ + +]
Author: Donet Tom <donettom@linux.ibm.com>
Date:   Mon Mar 10 07:44:10 2025 -0500

    book3s64/radix : Align section vmemmap start address to PAGE_SIZE
    
    [ Upstream commit 9cf7e13fecbab0894f6986fc6986ab2eba8de52e ]
    
    A vmemmap altmap is a device-provided region used to provide
    backing storage for struct pages. For each namespace, the altmap
    should belong to that same namespace. If the namespaces are
    created unaligned, there is a chance that the section vmemmap
    start address could also be unaligned. If the section vmemmap
    start address is unaligned, the altmap page allocated from the
    current namespace might be used by the previous namespace also.
    During the free operation, since the altmap is shared between two
    namespaces, the previous namespace may detect that the page does
    not belong to its altmap and incorrectly assume that the page is a
    normal page. It then attempts to free the normal page, which leads
    to a kernel crash.
    
    Kernel attempted to read user page (18) - exploit attempt? (uid: 0)
    BUG: Kernel NULL pointer dereference on read at 0x00000018
    Faulting instruction address: 0xc000000000530c7c
    Oops: Kernel access of bad area, sig: 11 [#1]
    LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
    CPU: 32 PID: 2104 Comm: ndctl Kdump: loaded Tainted: G        W
    NIP:  c000000000530c7c LR: c000000000530e00 CTR: 0000000000007ffe
    REGS: c000000015e57040 TRAP: 0300   Tainted: G        W
    MSR:  800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 84482404
    CFAR: c000000000530dfc DAR: 0000000000000018 DSISR: 40000000 IRQMASK: 0
    GPR00: c000000000530e00 c000000015e572e0 c000000002c5cb00 c00c000101008040
    GPR04: 0000000000000000 0000000000000007 0000000000000001 000000000000001f
    GPR08: 0000000000000005 0000000000000000 0000000000000018 0000000000002000
    GPR12: c0000000001d2fb0 c0000060de6b0080 0000000000000000 c0000060dbf90020
    GPR16: c00c000101008000 0000000000000001 0000000000000000 c000000125b20f00
    GPR20: 0000000000000001 0000000000000000 ffffffffffffffff c00c000101007fff
    GPR24: 0000000000000001 0000000000000000 0000000000000000 0000000000000000
    GPR28: 0000000004040201 0000000000000001 0000000000000000 c00c000101008040
    NIP [c000000000530c7c] get_pfnblock_flags_mask+0x7c/0xd0
    LR [c000000000530e00] free_unref_page_prepare+0x130/0x4f0
    Call Trace:
    free_unref_page+0x50/0x1e0
    free_reserved_page+0x40/0x68
    free_vmemmap_pages+0x98/0xe0
    remove_pte_table+0x164/0x1e8
    remove_pmd_table+0x204/0x2c8
    remove_pud_table+0x1c4/0x288
    remove_pagetable+0x1c8/0x310
    vmemmap_free+0x24/0x50
    section_deactivate+0x28c/0x2a0
    __remove_pages+0x84/0x110
    arch_remove_memory+0x38/0x60
    memunmap_pages+0x18c/0x3d0
    devm_action_release+0x30/0x50
    release_nodes+0x68/0x140
    devres_release_group+0x100/0x190
    dax_pmem_compat_release+0x44/0x80 [dax_pmem_compat]
    device_for_each_child+0x8c/0x100
    [dax_pmem_compat_remove+0x2c/0x50 [dax_pmem_compat]
    nvdimm_bus_remove+0x78/0x140 [libnvdimm]
    device_remove+0x70/0xd0
    
    Another issue is that if there is no altmap, a PMD-sized vmemmap
    page will be allocated from RAM, regardless of the alignment of
    the section start address. If the section start address is not
    aligned to the PMD size, a VM_BUG_ON will be triggered when
    setting the PMD-sized page to page table.
    
    In this patch, we are aligning the section vmemmap start address
    to PAGE_SIZE. After alignment, the start address will not be
    part of the current namespace, and a normal page will be allocated
    for the vmemmap mapping of the current section. For the remaining
    sections, altmaps will be allocated. During the free operation,
    the normal page will be correctly freed.
    
    In the same way, a PMD_SIZE vmemmap page will be allocated only if
    the section start address is PMD_SIZE-aligned; otherwise, it will
    fall back to a PAGE-sized vmemmap allocation.
    
    Without this patch
    ==================
    NS1 start               NS2 start
     _________________________________________________________
    |         NS1               |            NS2              |
     ---------------------------------------------------------
    | Altmap| Altmap | .....|Altmap| Altmap | ...........
    |  NS1  |  NS1   |      | NS2  |  NS2   |
    
    In the above scenario, NS1 and NS2 are two namespaces. The vmemmap
    for NS1 comes from Altmap NS1, which belongs to NS1, and the
    vmemmap for NS2 comes from Altmap NS2, which belongs to NS2.
    
    The vmemmap start for NS2 is not aligned, so Altmap NS2 is shared
    by both NS1 and NS2. During the free operation in NS1, Altmap NS2
    is not part of NS1's altmap, causing it to attempt to free an
    invalid page.
    
    With this patch
    ===============
    NS1 start               NS2 start
     _________________________________________________________
    |         NS1               |            NS2              |
     ---------------------------------------------------------
    | Altmap| Altmap | .....| Normal | Altmap | Altmap |.......
    |  NS1  |  NS1   |      |  Page  |  NS2   |  NS2   |
    
    If the vmemmap start for NS2 is not aligned then we are allocating
    a normal page. NS1 and NS2 vmemmap will be freed correctly.
    
    Fixes: 368a0590d954 ("powerpc/book3s64/vmemmap: switch radix to use a different vmemmap handling function")
    Co-developed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Donet Tom <donettom@linux.ibm.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/8f98ec2b442977c618f7256cec88eb17dde3f2b9.1741609795.git.donettom@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf: add find_containing_subprog() utility function [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:43 2025 +0800

    bpf: add find_containing_subprog() utility function
    
    commit 27e88bc4df1d80888fe1aaca786a7cc6e69587e2 upstream.
    
    Add a utility function, looking for a subprogram containing a given
    instruction index, rewrite find_subprog() to use this function.
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-2-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: check changes_pkt_data property for extension programs [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:47 2025 +0800

    bpf: check changes_pkt_data property for extension programs
    
    commit 81f6d0530ba031b5f038a091619bf2ff29568852 upstream.
    
    When processing calls to global sub-programs, verifier decides whether
    to invalidate all packet pointers in current state depending on the
    changes_pkt_data property of the global sub-program.
    
    Because of this, an extension program replacing a global sub-program
    must be compatible with changes_pkt_data property of the sub-program
    being replaced.
    
    This commit:
    - adds changes_pkt_data flag to struct bpf_prog_aux:
      - this flag is set in check_cfg() for main sub-program;
      - in jit_subprogs() for other sub-programs;
    - modifies bpf_check_attach_btf_id() to check changes_pkt_data flag;
    - moves call to check_attach_btf_id() after the call to check_cfg(),
      because it needs changes_pkt_data flag to be set:
    
        bpf_check:
          ...                             ...
        - check_attach_btf_id             resolve_pseudo_ldimm64
          resolve_pseudo_ldimm64   -->    bpf_prog_is_offloaded
          bpf_prog_is_offloaded           check_cfg
          check_cfg                     + check_attach_btf_id
          ...                             ...
    
    The following fields are set by check_attach_btf_id():
    - env->ops
    - prog->aux->attach_btf_trace
    - prog->aux->attach_func_name
    - prog->aux->attach_func_proto
    - prog->aux->dst_trampoline
    - prog->aux->mod
    - prog->aux->saved_dst_attach_type
    - prog->aux->saved_dst_prog_type
    - prog->expected_attach_type
    
    Neither of these fields are used by resolve_pseudo_ldimm64() or
    bpf_prog_offload_verifier_prep() (for netronome and netdevsim
    drivers), so the reordering is safe.
    
    Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-6-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    [ shung-hsi.yu: adapt to missing fields in "struct bpf_prog_aux". Context
    difference in jit_subprogs() because BPF Exception is not supported. Context
    difference in bpf_check() because commit 5b5f51bff1b6 "bpf:
    no_caller_saved_registers attribute for helper calls" is not present. ]
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: consider that tail calls invalidate packet pointers [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:49 2025 +0800

    bpf: consider that tail calls invalidate packet pointers
    
    commit 1a4607ffba35bf2a630aab299e34dd3f6e658d70 upstream.
    
    Tail-called programs could execute any of the helpers that invalidate
    packet pointers. Hence, conservatively assume that each tail call
    invalidates packet pointers.
    
    Making the change in bpf_helper_changes_pkt_data() automatically makes
    use of check_cfg() logic that computes 'changes_pkt_data' effect for
    global sub-programs, such that the following program could be
    rejected:
    
        int tail_call(struct __sk_buff *sk)
        {
            bpf_tail_call_static(sk, &jmp_table, 0);
            return 0;
        }
    
        SEC("tc")
        int not_safe(struct __sk_buff *sk)
        {
            int *p = (void *)(long)sk->data;
            ... make p valid ...
            tail_call(sk);
            *p = 42; /* this is unsafe */
            ...
        }
    
    The tc_bpf2bpf.c:subprog_tc() needs change: mark it as a function that
    can invalidate packet pointers. Otherwise, it can't be freplaced with
    tailcall_freplace.c:entry_freplace() that does a tail call.
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-8-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    [ shung-hsi.yu: drop changes to tools/testing/selftests/bpf/progs/tc_bpf2bpf.c
    because it is not present. ]
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: fix null dereference when computing changes_pkt_data of prog w/o subprogs [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:51 2025 +0800

    bpf: fix null dereference when computing changes_pkt_data of prog w/o subprogs
    
    commit ac6542ad92759cda383ad62b4e4cbfc28136abc1 upstream.
    
    bpf_prog_aux->func field might be NULL if program does not have
    subprograms except for main sub-program. The fixed commit does
    bpf_prog_aux->func access unconditionally, which might lead to null
    pointer dereference.
    
    The bug could be triggered by replacing the following BPF program:
    
        SEC("tc")
        int main_changes(struct __sk_buff *sk)
        {
            bpf_skb_pull_data(sk, 0);
            return 0;
        }
    
    With the following BPF program:
    
        SEC("freplace")
        long changes_pkt_data(struct __sk_buff *sk)
        {
            return bpf_skb_pull_data(sk, 0);
        }
    
    bpf_prog_aux instance itself represents the main sub-program,
    use this property to fix the bug.
    
    Fixes: 81f6d0530ba0 ("bpf: check changes_pkt_data property for extension programs")
    Reported-by: kernel test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Closes: https://lore.kernel.org/r/202412111822.qGw6tOyB-lkp@intel.com/
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241212070711.427443-1-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: refactor bpf_helper_changes_pkt_data to use helper number [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:44 2025 +0800

    bpf: refactor bpf_helper_changes_pkt_data to use helper number
    
    commit b238e187b4a2d3b54d80aec05a9cab6466b79dde upstream.
    
    Use BPF helper number instead of function pointer in
    bpf_helper_changes_pkt_data(). This would simplify usage of this
    function in verifier.c:check_cfg() (in a follow-up patch),
    where only helper number is easily available and there is no real need
    to lookup helper proto.
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-3-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: track changes_pkt_data property for global functions [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:45 2025 +0800

    bpf: track changes_pkt_data property for global functions
    
    commit 51081a3f25c742da5a659d7fc6fd77ebfdd555be upstream.
    
    When processing calls to certain helpers, verifier invalidates all
    packet pointers in a current state. For example, consider the
    following program:
    
        __attribute__((__noinline__))
        long skb_pull_data(struct __sk_buff *sk, __u32 len)
        {
            return bpf_skb_pull_data(sk, len);
        }
    
        SEC("tc")
        int test_invalidate_checks(struct __sk_buff *sk)
        {
            int *p = (void *)(long)sk->data;
            if ((void *)(p + 1) > (void *)(long)sk->data_end) return TCX_DROP;
            skb_pull_data(sk, 0);
            *p = 42;
            return TCX_PASS;
        }
    
    After a call to bpf_skb_pull_data() the pointer 'p' can't be used
    safely. See function filter.c:bpf_helper_changes_pkt_data() for a list
    of such helpers.
    
    At the moment verifier invalidates packet pointers when processing
    helper function calls, and does not traverse global sub-programs when
    processing calls to global sub-programs. This means that calls to
    helpers done from global sub-programs do not invalidate pointers in
    the caller state. E.g. the program above is unsafe, but is not
    rejected by verifier.
    
    This commit fixes the omission by computing field
    bpf_subprog_info->changes_pkt_data for each sub-program before main
    verification pass.
    changes_pkt_data should be set if:
    - subprogram calls helper for which bpf_helper_changes_pkt_data
      returns true;
    - subprogram calls a global function,
      for which bpf_subprog_info->changes_pkt_data should be set.
    
    The verifier.c:check_cfg() pass is modified to compute this
    information. The commit relies on depth first instruction traversal
    done by check_cfg() and absence of recursive function calls:
    - check_cfg() would eventually visit every call to subprogram S in a
      state when S is fully explored;
    - when S is fully explored:
      - every direct helper call within S is explored
        (and thus changes_pkt_data is set if needed);
      - every call to subprogram S1 called by S was visited with S1 fully
        explored (and thus S inherits changes_pkt_data from S1).
    
    The downside of such approach is that dead code elimination is not
    taken into account: if a helper call inside global function is dead
    because of current configuration, verifier would conservatively assume
    that the call occurs for the purpose of the changes_pkt_data
    computation.
    
    Reported-by: Nick Zavaritsky <mejedi@gmail.com>
    Closes: https://lore.kernel.org/bpf/0498CA22-5779-4767-9C0C-A9515CEA711F@gmail.com/
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-4-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    [shung-hsi.yu: do not use bitfield in "struct bpf_subprog_info" because commit
    406a6fa44bfb ("bpf: use bitfields for simple per-subprog bool flags") is not
    present and minor context difference in check_func_call() because commit
    491dd8edecbc ("bpf: Emit global subprog name in verifier logs") is not present. ]
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
btrfs: fix COW handling in run_delalloc_nocow() [+ + +]
Author: Dave Chen <davechen@synology.com>
Date:   Tue Apr 15 14:33:42 2025 +0800

    btrfs: fix COW handling in run_delalloc_nocow()
    
    commit be3f1938d3e6ea8186f0de3dd95245dda4f22c1e upstream.
    
    In run_delalloc_nocow(), when the found btrfs_key's offset > cur_offset,
    it indicates a gap between the current processing region and
    the next file extent. The original code would directly jump to
    the "must_cow" label, which increments the slot and forces a fallback
    to COW. This behavior might skip an extent item and result in an
    overestimated COW fallback range.
    
    This patch modifies the logic so that when a gap is detected:
    
    - If no COW range is already being recorded (cow_start is unset),
      cow_start is set to cur_offset.
    
    - cur_offset is then advanced to the beginning of the next extent.
    
    - Instead of jumping to "must_cow", control flows directly to
      "next_slot" so that the same extent item can be reexamined properly.
    
    The change ensures that we accurately account for the extent gap and
    avoid accidentally extending the range that needs to fallback to COW.
    
    CC: stable@vger.kernel.org # 6.6+
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Dave Chen <davechen@synology.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cpufreq: Avoid using inconsistent policy->min and policy->max [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Apr 16 16:12:37 2025 +0200

    cpufreq: Avoid using inconsistent policy->min and policy->max
    
    commit 7491cdf46b5cbdf123fc84fbe0a07e9e3d7b7620 upstream.
    
    Since cpufreq_driver_resolve_freq() can run in parallel with
    cpufreq_set_policy() and there is no synchronization between them,
    the former may access policy->min and policy->max while the latter
    is updating them and it may see intermediate values of them due
    to the way the update is carried out.  Also the compiler is free
    to apply any optimizations it wants both to the stores in
    cpufreq_set_policy() and to the loads in cpufreq_driver_resolve_freq()
    which may result in additional inconsistencies.
    
    To address this, use WRITE_ONCE() when updating policy->min and
    policy->max in cpufreq_set_policy() and use READ_ONCE() for reading
    them in cpufreq_driver_resolve_freq().  Moreover, rearrange the update
    in cpufreq_set_policy() to avoid storing intermediate values in
    policy->min and policy->max with the help of the observation that
    their new values are expected to be properly ordered upfront.
    
    Also modify cpufreq_driver_resolve_freq() to take the possible reverse
    ordering of policy->min and policy->max, which may happen depending on
    the ordering of operations when this function and cpufreq_set_policy()
    run concurrently, into account by always honoring the max when it
    turns out to be less than the min (in case it comes from thermal
    throttling or similar).
    
    Fixes: 151717690694 ("cpufreq: Make policy min/max hard requirements")
    Cc: 5.16+ <stable@vger.kernel.org> # 5.16+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Christian Loehle <christian.loehle@arm.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Link: https://patch.msgid.link/5907080.DvuYhMxLoT@rjwysocki.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: Fix setting policy limits when frequency tables are used [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Apr 25 13:36:21 2025 +0200

    cpufreq: Fix setting policy limits when frequency tables are used
    
    commit b79028039f440e7d2c4df6ab243060c4e3803e84 upstream.
    
    Commit 7491cdf46b5c ("cpufreq: Avoid using inconsistent policy->min and
    policy->max") overlooked the fact that policy->min and policy->max were
    accessed directly in cpufreq_frequency_table_target() and in the
    functions called by it.  Consequently, the changes made by that commit
    led to problems with setting policy limits.
    
    Address this by passing the target frequency limits to __resolve_freq()
    and cpufreq_frequency_table_target() and propagating them to the
    functions called by the latter.
    
    Fixes: 7491cdf46b5c ("cpufreq: Avoid using inconsistent policy->min and policy->max")
    Cc: 5.16+ <stable@vger.kernel.org> # 5.16+
    Closes: https://lore.kernel.org/linux-pm/aAplED3IA_J0eZN0@linaro.org/
    Reported-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://patch.msgid.link/5896780.DvuYhMxLoT@rjwysocki.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-bufio: don't schedule in atomic context [+ + +]
Author: LongPing Wei <weilongping@oppo.com>
Date:   Thu Apr 17 11:07:38 2025 +0800

    dm-bufio: don't schedule in atomic context
    
    commit a3d8f0a7f5e8b193db509c7191fefeed3533fc44 upstream.
    
    A BUG was reported as below when CONFIG_DEBUG_ATOMIC_SLEEP and
    try_verify_in_tasklet are enabled.
    [  129.444685][  T934] BUG: sleeping function called from invalid context at drivers/md/dm-bufio.c:2421
    [  129.444723][  T934] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 934, name: kworker/1:4
    [  129.444740][  T934] preempt_count: 201, expected: 0
    [  129.444756][  T934] RCU nest depth: 0, expected: 0
    [  129.444781][  T934] Preemption disabled at:
    [  129.444789][  T934] [<ffffffd816231900>] shrink_work+0x21c/0x248
    [  129.445167][  T934] kernel BUG at kernel/sched/walt/walt_debug.c:16!
    [  129.445183][  T934] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
    [  129.445204][  T934] Skip md ftrace buffer dump for: 0x1609e0
    [  129.447348][  T934] CPU: 1 PID: 934 Comm: kworker/1:4 Tainted: G        W  OE      6.6.56-android15-8-o-g6f82312b30b9-debug #1 1400000003000000474e5500b3187743670464e8
    [  129.447362][  T934] Hardware name: Qualcomm Technologies, Inc. Parrot QRD, Alpha-M (DT)
    [  129.447373][  T934] Workqueue: dm_bufio_cache shrink_work
    [  129.447394][  T934] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [  129.447406][  T934] pc : android_rvh_schedule_bug+0x0/0x8 [sched_walt_debug]
    [  129.447435][  T934] lr : __traceiter_android_rvh_schedule_bug+0x44/0x6c
    [  129.447451][  T934] sp : ffffffc0843dbc90
    [  129.447459][  T934] x29: ffffffc0843dbc90 x28: ffffffffffffffff x27: 0000000000000c8b
    [  129.447479][  T934] x26: 0000000000000040 x25: ffffff804b3d6260 x24: ffffffd816232b68
    [  129.447497][  T934] x23: ffffff805171c5b4 x22: 0000000000000000 x21: ffffffd816231900
    [  129.447517][  T934] x20: ffffff80306ba898 x19: 0000000000000000 x18: ffffffc084159030
    [  129.447535][  T934] x17: 00000000d2b5dd1f x16: 00000000d2b5dd1f x15: ffffffd816720358
    [  129.447554][  T934] x14: 0000000000000004 x13: ffffff89ef978000 x12: 0000000000000003
    [  129.447572][  T934] x11: ffffffd817a823c4 x10: 0000000000000202 x9 : 7e779c5735de9400
    [  129.447591][  T934] x8 : ffffffd81560d004 x7 : 205b5d3938373434 x6 : ffffffd8167397c8
    [  129.447610][  T934] x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffffffc0843db9e0
    [  129.447629][  T934] x2 : 0000000000002f15 x1 : 0000000000000000 x0 : 0000000000000000
    [  129.447647][  T934] Call trace:
    [  129.447655][  T934]  android_rvh_schedule_bug+0x0/0x8 [sched_walt_debug 1400000003000000474e550080cce8a8a78606b6]
    [  129.447681][  T934]  __might_resched+0x190/0x1a8
    [  129.447694][  T934]  shrink_work+0x180/0x248
    [  129.447706][  T934]  process_one_work+0x260/0x624
    [  129.447718][  T934]  worker_thread+0x28c/0x454
    [  129.447729][  T934]  kthread+0x118/0x158
    [  129.447742][  T934]  ret_from_fork+0x10/0x20
    [  129.447761][  T934] Code: ???????? ???????? ???????? d2b5dd1f (d4210000)
    [  129.447772][  T934] ---[ end trace 0000000000000000 ]---
    
    dm_bufio_lock will call spin_lock_bh when try_verify_in_tasklet
    is enabled, and __scan will be called in atomic context.
    
    Fixes: 7cd326747f46 ("dm bufio: remove dm_bufio_cond_resched()")
    Signed-off-by: LongPing Wei <weilongping@oppo.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-integrity: fix a warning on invalid table line [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Tue Apr 22 21:18:33 2025 +0200

    dm-integrity: fix a warning on invalid table line
    
    commit 0a533c3e4246c29d502a7e0fba0e86d80a906b04 upstream.
    
    If we use the 'B' mode and we have an invalit table line,
    cancel_delayed_work_sync would trigger a warning. This commit avoids the
    warning.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm: always update the array size in realloc_argv on success [+ + +]
Author: Benjamin Marzinski <bmarzins@redhat.com>
Date:   Tue Apr 15 00:17:16 2025 -0400

    dm: always update the array size in realloc_argv on success
    
    commit 5a2a6c428190f945c5cbf5791f72dbea83e97f66 upstream.
    
    realloc_argv() was only updating the array size if it was called with
    old_argv already allocated. The first time it was called to create an
    argv array, it would allocate the array but return the array size as
    zero. dm_split_args() would think that it couldn't store any arguments
    in the array and would call realloc_argv() again, causing it to
    reallocate the initial slots (this time using GPF_KERNEL) and finally
    return a size. Aside from being wasteful, this could cause deadlocks on
    targets that need to process messages without starting new IO. Instead,
    realloc_argv should always update the allocated array size on success.
    
    Fixes: a0651926553c ("dm table: don't copy from a NULL pointer in realloc_argv()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dm: fix copying after src array boundaries [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Tue May 6 11:31:50 2025 +0000

    dm: fix copying after src array boundaries
    
    commit f1aff4bc199cb92c055668caed65505e3b4d2656 upstream.
    
    The blammed commit copied to argv the size of the reallocated argv,
    instead of the size of the old_argv, thus reading and copying from
    past the old_argv allocated memory.
    
    Following BUG_ON was hit:
    [    3.038929][    T1] kernel BUG at lib/string_helpers.c:1040!
    [    3.039147][    T1] Internal error: Oops - BUG: 00000000f2000800 [#1]  SMP
    ...
    [    3.056489][    T1] Call trace:
    [    3.056591][    T1]  __fortify_panic+0x10/0x18 (P)
    [    3.056773][    T1]  dm_split_args+0x20c/0x210
    [    3.056942][    T1]  dm_table_add_target+0x13c/0x360
    [    3.057132][    T1]  table_load+0x110/0x3ac
    [    3.057292][    T1]  dm_ctl_ioctl+0x424/0x56c
    [    3.057457][    T1]  __arm64_sys_ioctl+0xa8/0xec
    [    3.057634][    T1]  invoke_syscall+0x58/0x10c
    [    3.057804][    T1]  el0_svc_common+0xa8/0xdc
    [    3.057970][    T1]  do_el0_svc+0x1c/0x28
    [    3.058123][    T1]  el0_svc+0x50/0xac
    [    3.058266][    T1]  el0t_64_sync_handler+0x60/0xc4
    [    3.058452][    T1]  el0t_64_sync+0x1b0/0x1b4
    [    3.058620][    T1] Code: f800865e a9bf7bfd 910003fd 941f48aa (d4210000)
    [    3.058897][    T1] ---[ end trace 0000000000000000 ]---
    [    3.059083][    T1] Kernel panic - not syncing: Oops - BUG: Fatal exception
    
    Fix it by copying the size of src, and not the size of dst, as it was.
    
    Fixes: 5a2a6c428190 ("dm: always update the array size in realloc_argv on success")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drivers: base: handle module_kobject creation [+ + +]
Author: Shyam Saini <shyamsaini@linux.microsoft.com>
Date:   Thu Feb 27 10:49:30 2025 -0800

    drivers: base: handle module_kobject creation
    
    [ Upstream commit f95bbfe18512c5c018720468959edac056a17196 ]
    
    module_add_driver() relies on module_kset list for
    /sys/module/<built-in-module>/drivers directory creation.
    
    Since,
    commit 96a1a2412acba ("kernel/params.c: defer most of param_sysfs_init() to late_initcall time")
    drivers which are initialized from subsys_initcall() or any other
    higher precedence initcall couldn't find the related kobject entry
    in the module_kset list because module_kset is not fully populated
    by the time module_add_driver() refers it. As a consequence,
    module_add_driver() returns early without calling make_driver_name().
    Therefore, /sys/module/<built-in-module>/drivers is never created.
    
    Fix this issue by letting module_add_driver() handle module_kobject
    creation itself.
    
    Fixes: 96a1a2412acb ("kernel/params.c: defer most of param_sysfs_init() to late_initcall time")
    Cc: stable@vger.kernel.org # requires all other patches from the series
    Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250227184930.34163-5-shyamsaini@linux.microsoft.com
    Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Add scoped mutexes for amdgpu_dm_dhcp [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Fri Feb 28 13:30:01 2025 -0600

    drm/amd/display: Add scoped mutexes for amdgpu_dm_dhcp
    
    [ Upstream commit 6b675ab8efbf2bcee25be29e865455c56e246401 ]
    
    [Why]
    Guards automatically release mutex when it goes out of scope making
    code easier to follow.
    
    [How]
    Replace all use of mutex_lock()/mutex_unlock() with guard(mutex).
    
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@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>
    Stable-dep-of: be593d9d91c5 ("drm/amd/display: Fix slab-use-after-free in hdcp")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Fix slab-use-after-free in hdcp [+ + +]
Author: Chris Bainbridge <chris.bainbridge@gmail.com>
Date:   Thu Apr 17 16:50:05 2025 -0500

    drm/amd/display: Fix slab-use-after-free in hdcp
    
    [ Upstream commit be593d9d91c5a3a363d456b9aceb71029aeb3f1d ]
    
    The HDCP code in amdgpu_dm_hdcp.c copies pointers to amdgpu_dm_connector
    objects without incrementing the kref reference counts. When using a
    USB-C dock, and the dock is unplugged, the corresponding
    amdgpu_dm_connector objects are freed, creating dangling pointers in the
    HDCP code. When the dock is plugged back, the dangling pointers are
    dereferenced, resulting in a slab-use-after-free:
    
    [   66.775837] BUG: KASAN: slab-use-after-free in event_property_validate+0x42f/0x6c0 [amdgpu]
    [   66.776171] Read of size 4 at addr ffff888127804120 by task kworker/0:1/10
    
    [   66.776179] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.14.0-rc7-00180-g54505f727a38-dirty #233
    [   66.776183] Hardware name: HP HP Pavilion Aero Laptop 13-be0xxx/8916, BIOS F.17 12/18/2024
    [   66.776186] Workqueue: events event_property_validate [amdgpu]
    [   66.776494] Call Trace:
    [   66.776496]  <TASK>
    [   66.776497]  dump_stack_lvl+0x70/0xa0
    [   66.776504]  print_report+0x175/0x555
    [   66.776507]  ? __virt_addr_valid+0x243/0x450
    [   66.776510]  ? kasan_complete_mode_report_info+0x66/0x1c0
    [   66.776515]  kasan_report+0xeb/0x1c0
    [   66.776518]  ? event_property_validate+0x42f/0x6c0 [amdgpu]
    [   66.776819]  ? event_property_validate+0x42f/0x6c0 [amdgpu]
    [   66.777121]  __asan_report_load4_noabort+0x14/0x20
    [   66.777124]  event_property_validate+0x42f/0x6c0 [amdgpu]
    [   66.777342]  ? __lock_acquire+0x6b40/0x6b40
    [   66.777347]  ? enable_assr+0x250/0x250 [amdgpu]
    [   66.777571]  process_one_work+0x86b/0x1510
    [   66.777575]  ? pwq_dec_nr_in_flight+0xcf0/0xcf0
    [   66.777578]  ? assign_work+0x16b/0x280
    [   66.777580]  ? lock_is_held_type+0xa3/0x130
    [   66.777583]  worker_thread+0x5c0/0xfa0
    [   66.777587]  ? process_one_work+0x1510/0x1510
    [   66.777588]  kthread+0x3a2/0x840
    [   66.777591]  ? kthread_is_per_cpu+0xd0/0xd0
    [   66.777594]  ? trace_hardirqs_on+0x4f/0x60
    [   66.777597]  ? _raw_spin_unlock_irq+0x27/0x60
    [   66.777599]  ? calculate_sigpending+0x77/0xa0
    [   66.777602]  ? kthread_is_per_cpu+0xd0/0xd0
    [   66.777605]  ret_from_fork+0x40/0x90
    [   66.777607]  ? kthread_is_per_cpu+0xd0/0xd0
    [   66.777609]  ret_from_fork_asm+0x11/0x20
    [   66.777614]  </TASK>
    
    [   66.777643] Allocated by task 10:
    [   66.777646]  kasan_save_stack+0x39/0x60
    [   66.777649]  kasan_save_track+0x14/0x40
    [   66.777652]  kasan_save_alloc_info+0x37/0x50
    [   66.777655]  __kasan_kmalloc+0xbb/0xc0
    [   66.777658]  __kmalloc_cache_noprof+0x1c8/0x4b0
    [   66.777661]  dm_dp_add_mst_connector+0xdd/0x5c0 [amdgpu]
    [   66.777880]  drm_dp_mst_port_add_connector+0x47e/0x770 [drm_display_helper]
    [   66.777892]  drm_dp_send_link_address+0x1554/0x2bf0 [drm_display_helper]
    [   66.777901]  drm_dp_check_and_send_link_address+0x187/0x1f0 [drm_display_helper]
    [   66.777909]  drm_dp_mst_link_probe_work+0x2b8/0x410 [drm_display_helper]
    [   66.777917]  process_one_work+0x86b/0x1510
    [   66.777919]  worker_thread+0x5c0/0xfa0
    [   66.777922]  kthread+0x3a2/0x840
    [   66.777925]  ret_from_fork+0x40/0x90
    [   66.777927]  ret_from_fork_asm+0x11/0x20
    
    [   66.777932] Freed by task 1713:
    [   66.777935]  kasan_save_stack+0x39/0x60
    [   66.777938]  kasan_save_track+0x14/0x40
    [   66.777940]  kasan_save_free_info+0x3b/0x60
    [   66.777944]  __kasan_slab_free+0x52/0x70
    [   66.777946]  kfree+0x13f/0x4b0
    [   66.777949]  dm_dp_mst_connector_destroy+0xfa/0x150 [amdgpu]
    [   66.778179]  drm_connector_free+0x7d/0xb0
    [   66.778184]  drm_mode_object_put.part.0+0xee/0x160
    [   66.778188]  drm_mode_object_put+0x37/0x50
    [   66.778191]  drm_atomic_state_default_clear+0x220/0xd60
    [   66.778194]  __drm_atomic_state_free+0x16e/0x2a0
    [   66.778197]  drm_mode_atomic_ioctl+0x15ed/0x2ba0
    [   66.778200]  drm_ioctl_kernel+0x17a/0x310
    [   66.778203]  drm_ioctl+0x584/0xd10
    [   66.778206]  amdgpu_drm_ioctl+0xd2/0x1c0 [amdgpu]
    [   66.778375]  __x64_sys_ioctl+0x139/0x1a0
    [   66.778378]  x64_sys_call+0xee7/0xfb0
    [   66.778381]  do_syscall_64+0x87/0x140
    [   66.778385]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
    
    Fix this by properly incrementing and decrementing the reference counts
    when making and deleting copies of the amdgpu_dm_connector pointers.
    
    (Mario: rebase on current code and update fixes tag)
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4006
    Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
    Fixes: da3fd7ac0bcf3 ("drm/amd/display: Update CP property based on HW query")
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Link: https://lore.kernel.org/r/20250417215005.37964-1-mario.limonciello@amd.com
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit d4673f3c3b3dcb74e36e53cdfc880baa7a87b330)
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/fdinfo: Protect against driver unbind [+ + +]
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Date:   Fri Apr 18 17:25:12 2025 +0100

    drm/fdinfo: Protect against driver unbind
    
    commit 5b1834d6202f86180e451ad1a2a8a193a1da18fc upstream.
    
    If we unbind a driver from the PCI device with an active DRM client,
    subsequent read of the fdinfo data associated with the file descriptor in
    question will not end well.
    
    Protect the path with a drm_dev_enter/exit() pair.
    
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Lucas De Marchi <lucas.demarchi@intel.com>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Fixes: 3f09a0cd4ea3 ("drm: Add common fdinfo helper")
    Cc: <stable@vger.kernel.org> # v6.5+
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Link: https://lore.kernel.org/r/20250418162512.72324-1-tvrtko.ursulin@igalia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915/pxp: fix undefined reference to `intel_pxp_gsccs_is_ready_for_sessions' [+ + +]
Author: Chen Linxuan <chenlinxuan@uniontech.com>
Date:   Tue Apr 15 12:06:16 2025 +0300

    drm/i915/pxp: fix undefined reference to `intel_pxp_gsccs_is_ready_for_sessions'
    
    [ Upstream commit 7e21ea8149a0e41c3666ee52cc063a6f797a7a2a ]
    
    On x86_64 with gcc version 13.3.0, I compile kernel with:
    
      make defconfig
      ./scripts/kconfig/merge_config.sh .config <(
        echo CONFIG_COMPILE_TEST=y
      )
      make KCFLAGS="-fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once"
    
    Then I get a linker error:
    
      ld: vmlinux.o: in function `pxp_fw_dependencies_completed':
      kintel_pxp.c:(.text+0x95728f): undefined reference to `intel_pxp_gsccs_is_ready_for_sessions'
    
    This is caused by not having a intel_pxp_gsccs_is_ready_for_sessions()
    header stub for CONFIG_DRM_I915_PXP=n. Add it.
    
    Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
    Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup")
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://lore.kernel.org/r/20250415090616.2649889-1-jani.nikula@intel.com
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    (cherry picked from commit b484c1e225a6a582fc78c4d7af7b286408bb7d41)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill() [+ + +]
Author: Philipp Stanner <phasta@kernel.org>
Date:   Tue Apr 15 14:19:00 2025 +0200

    drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill()
    
    commit bbe5679f30d7690a9b6838a583b9690ea73fe0e9 upstream.
    
    Nouveau is mostly designed in a way that it's expected that fences only
    ever get signaled through nouveau_fence_signal(). However, in at least
    one other place, nouveau_fence_done(), can signal fences, too. If that
    happens (race) a signaled fence remains in the pending list for a while,
    until it gets removed by nouveau_fence_update().
    
    Should nouveau_fence_context_kill() run in the meantime, this would be
    a bug because the function would attempt to set an error code on an
    already signaled fence.
    
    Have nouveau_fence_context_kill() check for a fence being signaled.
    
    Cc: stable@vger.kernel.org # v5.10+
    Fixes: ea13e5abf807 ("drm/nouveau: signal pending fences when channel has been killed")
    Suggested-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Philipp Stanner <phasta@kernel.org>
    Link: https://lore.kernel.org/r/20250415121900.55719-3-phasta@kernel.org
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
EDAC/altera: Set DDR and SDMMC interrupt mask before registration [+ + +]
Author: Niravkumar L Rabara <niravkumar.l.rabara@altera.com>
Date:   Fri Apr 25 07:26:40 2025 -0700

    EDAC/altera: Set DDR and SDMMC interrupt mask before registration
    
    commit 6dbe3c5418c4368e824bff6ae4889257dd544892 upstream.
    
    Mask DDR and SDMMC in probe function to avoid spurious interrupts before
    registration.  Removed invalid register write to system manager.
    
    Fixes: 1166fde93d5b ("EDAC, altera: Add Arria10 ECC memory init functions")
    Signed-off-by: Niravkumar L Rabara <niravkumar.l.rabara@altera.com>
    Signed-off-by: Matthew Gerlach <matthew.gerlach@altera.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Dinh Nguyen <dinguyen@kernel.org>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/20250425142640.33125-3-matthew.gerlach@altera.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

EDAC/altera: Test the correct error reg offset [+ + +]
Author: Niravkumar L Rabara <niravkumar.l.rabara@altera.com>
Date:   Fri Apr 25 07:26:39 2025 -0700

    EDAC/altera: Test the correct error reg offset
    
    commit 4fb7b8fceb0beebbe00712c3daf49ade0386076a upstream.
    
    Test correct structure member, ecc_cecnt_offset, before using it.
    
      [ bp: Massage commit message. ]
    
    Fixes: 73bcc942f427 ("EDAC, altera: Add Arria10 EDAC support")
    Signed-off-by: Niravkumar L Rabara <niravkumar.l.rabara@altera.com>
    Signed-off-by: Matthew Gerlach <matthew.gerlach@altera.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Dinh Nguyen <dinguyen@kernel.org>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/20250425142640.33125-2-matthew.gerlach@altera.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
firmware: arm_ffa: Skip Rx buffer ownership release if not acquired [+ + +]
Author: Sudeep Holla <sudeep.holla@arm.com>
Date:   Fri Mar 21 11:57:00 2025 +0000

    firmware: arm_ffa: Skip Rx buffer ownership release if not acquired
    
    [ Upstream commit 4567bdaaaaa1744da3d7da07d9aca2f941f5b4e5 ]
    
    Completion of the FFA_PARTITION_INFO_GET ABI transfers the ownership of
    the caller’s Rx buffer from the producer(typically partition mnager) to
    the consumer(this driver/OS). FFA_RX_RELEASE transfers the ownership
    from the consumer back to the producer.
    
    However, when we set the flag to just return the count of partitions
    deployed in the system corresponding to the specified UUID while
    invoking FFA_PARTITION_INFO_GET, the Rx buffer ownership shouldn't be
    transferred to this driver. We must be able to skip transferring back
    the ownership to the partition manager when we request just to get the
    count of the partitions as the buffers are not acquired in this case.
    
    Firmware may return FFA_RET_DENIED or other error for the ffa_rx_release()
    in such cases.
    
    Fixes: bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support")
    Message-Id: <20250321115700.3525197-1-sudeep.holla@arm.com>
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

firmware: arm_scmi: Balance device refcount when destroying devices [+ + +]
Author: Cristian Marussi <cristian.marussi@arm.com>
Date:   Thu Mar 6 18:54:47 2025 +0000

    firmware: arm_scmi: Balance device refcount when destroying devices
    
    [ Upstream commit 9ca67840c0ddf3f39407339624cef824a4f27599 ]
    
    Using device_find_child() to lookup the proper SCMI device to destroy
    causes an unbalance in device refcount, since device_find_child() calls an
    implicit get_device(): this, in turns, inhibits the call of the provided
    release methods upon devices destruction.
    
    As a consequence, one of the structures that is not freed properly upon
    destruction is the internal struct device_private dev->p populated by the
    drivers subsystem core.
    
    KMemleak detects this situation since loading/unloding some SCMI driver
    causes related devices to be created/destroyed without calling any
    device_release method.
    
    unreferenced object 0xffff00000f583800 (size 512):
      comm "insmod", pid 227, jiffies 4294912190
      hex dump (first 32 bytes):
        00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
        ff ff ff ff ff ff ff ff 60 36 1d 8a 00 80 ff ff  ........`6......
      backtrace (crc 114e2eed):
        kmemleak_alloc+0xbc/0xd8
        __kmalloc_cache_noprof+0x2dc/0x398
        device_add+0x954/0x12d0
        device_register+0x28/0x40
        __scmi_device_create.part.0+0x1bc/0x380
        scmi_device_create+0x2d0/0x390
        scmi_create_protocol_devices+0x74/0xf8
        scmi_device_request_notifier+0x1f8/0x2a8
        notifier_call_chain+0x110/0x3b0
        blocking_notifier_call_chain+0x70/0xb0
        scmi_driver_register+0x350/0x7f0
        0xffff80000a3b3038
        do_one_initcall+0x12c/0x730
        do_init_module+0x1dc/0x640
        load_module+0x4b20/0x5b70
        init_module_from_file+0xec/0x158
    
    $ ./scripts/faddr2line ./vmlinux device_add+0x954/0x12d0
    device_add+0x954/0x12d0:
    kmalloc_noprof at include/linux/slab.h:901
    (inlined by) kzalloc_noprof at include/linux/slab.h:1037
    (inlined by) device_private_init at drivers/base/core.c:3510
    (inlined by) device_add at drivers/base/core.c:3561
    
    Balance device refcount by issuing a put_device() on devices found via
    device_find_child().
    
    Reported-by: Alice Ryhl <aliceryhl@google.com>
    Closes: https://lore.kernel.org/linux-arm-kernel/Z8nK3uFkspy61yjP@arm.com/T/#mc1f73a0ea5e41014fa145147b7b839fc988ada8f
    CC: Sudeep Holla <sudeep.holla@arm.com>
    CC: Catalin Marinas <catalin.marinas@arm.com>
    Fixes: d4f9dddd21f3 ("firmware: arm_scmi: Add dynamic scmi devices creation")
    Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Message-Id: <20250306185447.2039336-1-cristian.marussi@arm.com>
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i2c: imx-lpi2c: Fix clock count when probe defers [+ + +]
Author: Clark Wang <xiaoning.wang@nxp.com>
Date:   Mon Apr 21 14:23:41 2025 +0800

    i2c: imx-lpi2c: Fix clock count when probe defers
    
    commit b1852c5de2f2a37dd4462f7837c9e3e678f9e546 upstream.
    
    Deferred probe with pm_runtime_put() may delay clock disable, causing
    incorrect clock usage count. Use pm_runtime_put_sync() to ensure the
    clock is disabled immediately.
    
    Fixes: 13d6eb20fc79 ("i2c: imx-lpi2c: add runtime pm support")
    Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
    Signed-off-by: Carlos Song <carlos.song@nxp.com>
    Cc: <stable@vger.kernel.org> # v4.16+
    Link: https://lore.kernel.org/r/20250421062341.2471922-1-carlos.song@nxp.com
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() [+ + +]
Author: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Date:   Fri Apr 25 15:26:32 2025 -0700

    ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
    
    [ Upstream commit 425c5f266b2edeee0ce16fedd8466410cdcfcfe3 ]
    
    As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
    pointer values"), we need to perform a null pointer check on the return
    value of ice_get_vf_vsi() before using it.
    
    Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
    Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://patch.msgid.link/20250425222636.3188441-3-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
igc: fix lock order in igc_ptp_reset [+ + +]
Author: Jacob Keller <jacob.e.keller@intel.com>
Date:   Tue Apr 22 14:03:09 2025 -0700

    igc: fix lock order in igc_ptp_reset
    
    [ Upstream commit c7d6cb96d5c33b5148f3dc76fcd30a9b8cd9e973 ]
    
    Commit 1a931c4f5e68 ("igc: add lock preventing multiple simultaneous PTM
    transactions") added a new mutex to protect concurrent PTM transactions.
    This lock is acquired in igc_ptp_reset() in order to ensure the PTM
    registers are properly disabled after a device reset.
    
    The flow where the lock is acquired already holds a spinlock, so acquiring
    a mutex leads to a sleep-while-locking bug, reported both by smatch,
    and the kernel test robot.
    
    The critical section in igc_ptp_reset() does correctly use the
    readx_poll_timeout_atomic variants, but the standard PTM flow uses regular
    sleeping variants. This makes converting the mutex to a spinlock a bit
    tricky.
    
    Instead, re-order the locking in igc_ptp_reset. Acquire the mutex first,
    and then the tmreg_lock spinlock. This is safe because there is no other
    ordering dependency on these locks, as this is the only place where both
    locks were acquired simultaneously. Indeed, any other flow acquiring locks
    in that order would be wrong regardless.
    
    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
    Fixes: 1a931c4f5e68 ("igc: add lock preventing multiple simultaneous PTM transactions")
    Link: https://lore.kernel.org/intel-wired-lan/Z_-P-Hc1yxcw0lTB@stanley.mountain/
    Link: https://lore.kernel.org/intel-wired-lan/202504211511.f7738f5d-lkp@intel.com/T/#u
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Reviewed-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
    Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/amd: Fix potential buffer overflow in parse_ivrs_acpihid [+ + +]
Author: Pavel Paklov <Pavel.Paklov@cyberprotect.ru>
Date:   Tue Mar 25 09:22:44 2025 +0000

    iommu/amd: Fix potential buffer overflow in parse_ivrs_acpihid
    
    commit 8dee308e4c01dea48fc104d37f92d5b58c50b96c upstream.
    
    There is a string parsing logic error which can lead to an overflow of hid
    or uid buffers. Comparing ACPIID_LEN against a total string length doesn't
    take into account the lengths of individual hid and uid buffers so the
    check is insufficient in some cases. For example if the length of hid
    string is 4 and the length of the uid string is 260, the length of str
    will be equal to ACPIID_LEN + 1 but uid string will overflow uid buffer
    which size is 256.
    
    The same applies to the hid string with length 13 and uid string with
    length 250.
    
    Check the length of hid and uid strings separately to prevent
    buffer overflow.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: ca3bf5d47cec ("iommu/amd: Introduces ivrs_acpihid kernel parameter")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pavel Paklov <Pavel.Paklov@cyberprotect.ru>
    Link: https://lore.kernel.org/r/20250325092259.392844-1-Pavel.Paklov@cyberprotect.ru
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Tue Apr 15 11:56:20 2025 -0700

    iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids
    
    [ Upstream commit b00d24997a11c10d3e420614f0873b83ce358a34 ]
    
    ASPEED VGA card has two built-in devices:
     0008:06:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 06)
     0008:07:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 52)
    
    Its toplogy looks like this:
     +-[0008:00]---00.0-[01-09]--+-00.0-[02-09]--+-00.0-[03]----00.0  Sandisk Corp Device 5017
                                 |               +-01.0-[04]--
                                 |               +-02.0-[05]----00.0  NVIDIA Corporation Device
                                 |               +-03.0-[06-07]----00.0-[07]----00.0  ASPEED Technology, Inc. ASPEED Graphics Family
                                 |               +-04.0-[08]----00.0  Renesas Technology Corp. uPD720201 USB 3.0 Host Controller
                                 |               \-05.0-[09]----00.0  Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
                                 \-00.1  PMC-Sierra Inc. Device 4028
    
    The IORT logic populaties two identical IDs into the fwspec->ids array via
    DMA aliasing in iort_pci_iommu_init() called by pci_for_each_dma_alias().
    
    Though the SMMU driver had been able to handle this situation since commit
    563b5cbe334e ("iommu/arm-smmu-v3: Cope with duplicated Stream IDs"), that
    got broken by the later commit cdf315f907d4 ("iommu/arm-smmu-v3: Maintain
    a SID->device structure"), which ended up with allocating separate streams
    with the same stuffing.
    
    On a kernel prior to v6.15-rc1, there has been an overlooked warning:
      pci 0008:07:00.0: vgaarb: setting as boot VGA device
      pci 0008:07:00.0: vgaarb: bridge control possible
      pci 0008:07:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
      pcieport 0008:06:00.0: Adding to iommu group 14
      ast 0008:07:00.0: stream 67328 already in tree   <===== WARNING
      ast 0008:07:00.0: enabling device (0002 -> 0003)
      ast 0008:07:00.0: Using default configuration
      ast 0008:07:00.0: AST 2600 detected
      ast 0008:07:00.0: [drm] Using analog VGA
      ast 0008:07:00.0: [drm] dram MCLK=396 Mhz type=1 bus_width=16
      [drm] Initialized ast 0.1.0 for 0008:07:00.0 on minor 0
      ast 0008:07:00.0: [drm] fb0: astdrmfb frame buffer device
    
    With v6.15-rc, since the commit bcb81ac6ae3c ("iommu: Get DT/ACPI parsing
    into the proper probe path"), the error returned with the warning is moved
    to the SMMU device probe flow:
      arm_smmu_probe_device+0x15c/0x4c0
      __iommu_probe_device+0x150/0x4f8
      probe_iommu_group+0x44/0x80
      bus_for_each_dev+0x7c/0x100
      bus_iommu_probe+0x48/0x1a8
      iommu_device_register+0xb8/0x178
      arm_smmu_device_probe+0x1350/0x1db0
    which then fails the entire SMMU driver probe:
      pci 0008:06:00.0: Adding to iommu group 21
      pci 0008:07:00.0: stream 67328 already in tree
      arm-smmu-v3 arm-smmu-v3.9.auto: Failed to register iommu
      arm-smmu-v3 arm-smmu-v3.9.auto: probe with driver arm-smmu-v3 failed with error -22
    
    Since SMMU driver had been already expecting a potential duplicated Stream
    ID in arm_smmu_install_ste_for_dev(), change the arm_smmu_insert_master()
    routine to ignore a duplicated ID from the fwspec->sids array as well.
    
    Note: this has been failing the iommu_device_probe() since 2021, although a
    recent iommu commit in v6.15-rc1 that moves iommu_device_probe() started to
    fail the SMMU driver probe. Since nobody has cared about DMA Alias support,
    leave that as it was but fix the fundamental iommu_device_probe() breakage.
    
    Fixes: cdf315f907d4 ("iommu/arm-smmu-v3: Maintain a SID->device structure")
    Cc: stable@vger.kernel.org
    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/20250415185620.504299-1-nicolinc@nvidia.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

iommu/arm-smmu-v3: Use the new rb tree helpers [+ + +]
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date:   Tue Aug 6 20:31:15 2024 -0300

    iommu/arm-smmu-v3: Use the new rb tree helpers
    
    [ Upstream commit a2bb820e862d61f9ca1499e500915f9f505a2655 ]
    
    Since v5.12 the rbtree has gained some simplifying helpers aimed at making
    rb tree users write less convoluted boiler plate code. Instead the caller
    provides a single comparison function and the helpers generate the prior
    open-coded stuff.
    
    Update smmu->streams to use rb_find_add() and rb_find().
    
    Tested-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Mostafa Saleh <smostafa@google.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/1-v3-9fef8cdc2ff6+150d1-smmuv3_tidy_jgg@nvidia.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Stable-dep-of: b00d24997a11 ("iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/vt-d: Apply quirk_iommu_igfx for 8086:0044 (QM57/QS57) [+ + +]
Author: Mingcong Bai <jeffbai@aosc.io>
Date:   Fri Apr 18 11:16:42 2025 +0800

    iommu/vt-d: Apply quirk_iommu_igfx for 8086:0044 (QM57/QS57)
    
    commit 2c8a7c66c90832432496616a9a3c07293f1364f3 upstream.
    
    On the Lenovo ThinkPad X201, when Intel VT-d is enabled in the BIOS, the
    kernel boots with errors related to DMAR, the graphical interface appeared
    quite choppy, and the system resets erratically within a minute after it
    booted:
    
    DMAR: DRHD: handling fault status reg 3
    DMAR: [DMA Write NO_PASID] Request device [00:02.0] fault addr 0xb97ff000
    [fault reason 0x05] PTE Write access is not set
    
    Upon comparing boot logs with VT-d on/off, I found that the Intel Calpella
    quirk (`quirk_calpella_no_shadow_gtt()') correctly applied the igfx IOMMU
    disable/quirk correctly:
    
    pci 0000:00:00.0: DMAR: BIOS has allocated no shadow GTT; disabling IOMMU
    for graphics
    
    Whereas with VT-d on, it went into the "else" branch, which then
    triggered the DMAR handling fault above:
    
    ... else if (!disable_igfx_iommu) {
            /* we have to ensure the gfx device is idle before we flush */
            pci_info(dev, "Disabling batched IOTLB flush on Ironlake\n");
            iommu_set_dma_strict();
    }
    
    Now, this is not exactly scientific, but moving 0x0044 to quirk_iommu_igfx
    seems to have fixed the aforementioned issue. Running a few `git blame'
    runs on the function, I have found that the quirk was originally
    introduced as a fix specific to ThinkPad X201:
    
    commit 9eecabcb9a92 ("intel-iommu: Abort IOMMU setup for igfx if BIOS gave
    no shadow GTT space")
    
    Which was later revised twice to the "else" branch we saw above:
    
    - 2011: commit 6fbcfb3e467a ("intel-iommu: Workaround IOTLB hang on
      Ironlake GPU")
    - 2024: commit ba00196ca41c ("iommu/vt-d: Decouple igfx_off from graphic
      identity mapping")
    
    I'm uncertain whether further testings on this particular laptops were
    done in 2011 and (honestly I'm not sure) 2024, but I would be happy to do
    some distro-specific testing if that's what would be required to verify
    this patch.
    
    P.S., I also see IDs 0x0040, 0x0062, and 0x006a listed under the same
    `quirk_calpella_no_shadow_gtt()' quirk, but I'm not sure how similar these
    chipsets are (if they share the same issue with VT-d or even, indeed, if
    this issue is specific to a bug in the Lenovo BIOS). With regards to
    0x0062, it seems to be a Centrino wireless card, but not a chipset?
    
    I have also listed a couple (distro and kernel) bug reports below as
    references (some of them are from 7-8 years ago!), as they seem to be
    similar issue found on different Westmere/Ironlake, Haswell, and Broadwell
    hardware setups.
    
    Cc: stable@vger.kernel.org
    Fixes: 6fbcfb3e467a ("intel-iommu: Workaround IOTLB hang on Ironlake GPU")
    Fixes: ba00196ca41c ("iommu/vt-d: Decouple igfx_off from graphic identity mapping")
    Link: https://groups.google.com/g/qubes-users/c/4NP4goUds2c?pli=1
    Link: https://bugs.archlinux.org/task/65362
    Link: https://bbs.archlinux.org/viewtopic.php?id=230323
    Reported-by: Wenhao Sun <weiguangtwk@outlook.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=197029
    Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
    Link: https://lore.kernel.org/r/20250415133330.12528-1-jeffbai@aosc.io
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu: Handle race with default domain setup [+ + +]
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Fri Feb 28 15:46:30 2025 +0000

    iommu: Handle race with default domain setup
    
    commit b46064a18810bad3aea089a79993ca5ea7a3d2b2 upstream.
    
    It turns out that deferred default domain creation leaves a subtle
    race window during iommu_device_register() wherein a client driver may
    asynchronously probe in parallel and get as far as performing DMA API
    operations with dma-direct, only to be switched to iommu-dma underfoot
    once the default domain attachment finally happens, with obviously
    disastrous consequences. Even the wonky of_iommu_configure() path is at
    risk, since iommu_fwspec_init() will no longer defer client probe as the
    instance ops are (necessarily) already registered, and the "replay"
    iommu_probe_device() call can see dev->iommu_group already set and so
    think there's nothing to do either.
    
    Fortunately we already have the right tool in the right place in the
    form of iommu_device_use_default_domain(), which just needs to ensure
    that said default domain is actually ready to *be* used. Deferring the
    client probe shouldn't have too much impact, given that this only
    happens while the IOMMU driver is probing, and thus due to kick the
    deferred probe list again once it finishes.
    
    Reported-by: Charan Teja Kalla <quic_charante@quicinc.com>
    Fixes: 98ac73f99bc4 ("iommu: Require a default_domain for all iommu drivers")
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Link: https://lore.kernel.org/r/e88b94c9b575034a2c98a48b3d383654cbda7902.1740753261.git.robin.murphy@arm.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>

 
irqchip/qcom-mpm: Prevent crash when trying to handle non-wake GPIOs [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Fri May 2 13:22:28 2025 +0200

    irqchip/qcom-mpm: Prevent crash when trying to handle non-wake GPIOs
    
    commit 38a05c0b87833f5b188ae43b428b1f792df2b384 upstream.
    
    On Qualcomm chipsets not all GPIOs are wakeup capable. Those GPIOs do not
    have a corresponding MPM pin and should not be handled inside the MPM
    driver. The IRQ domain hierarchy is always applied, so it's required to
    explicitly disconnect the hierarchy for those. The pinctrl-msm driver marks
    these with GPIO_NO_WAKE_IRQ. qcom-pdc has a check for this, but
    irq-qcom-mpm is currently missing the check. This is causing crashes when
    setting up interrupts for non-wake GPIOs:
    
     root@rb1:~# gpiomon -c gpiochip1 10
       irq: IRQ159: trimming hierarchy from :soc@0:interrupt-controller@f200000-1
       Unable to handle kernel paging request at virtual address ffff8000a1dc3820
       Hardware name: Qualcomm Technologies, Inc. Robotics RB1 (DT)
       pc : mpm_set_type+0x80/0xcc
       lr : mpm_set_type+0x5c/0xcc
       Call trace:
        mpm_set_type+0x80/0xcc (P)
        qcom_mpm_set_type+0x64/0x158
        irq_chip_set_type_parent+0x20/0x38
        msm_gpio_irq_set_type+0x50/0x530
        __irq_set_trigger+0x60/0x184
        __setup_irq+0x304/0x6bc
        request_threaded_irq+0xc8/0x19c
        edge_detector_setup+0x260/0x364
        linereq_create+0x420/0x5a8
        gpio_ioctl+0x2d4/0x6c0
    
    Fix this by copying the check for GPIO_NO_WAKE_IRQ from qcom-pdc.c, so that
    MPM is removed entirely from the hierarchy for non-wake GPIOs.
    
    Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver")
    Reported-by: Alexey Klimov <alexey.klimov@linaro.org>
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Alexey Klimov <alexey.klimov@linaro.org>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250502-irq-qcom-mpm-fix-no-wake-v1-1-8a1eafcd28d4@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kernel: globalize lookup_or_create_module_kobject() [+ + +]
Author: Shyam Saini <shyamsaini@linux.microsoft.com>
Date:   Thu Feb 27 10:49:29 2025 -0800

    kernel: globalize lookup_or_create_module_kobject()
    
    [ Upstream commit 7c76c813cfc42a7376378a0c4b7250db2eebab81 ]
    
    lookup_or_create_module_kobject() is marked as static and __init,
    to make it global drop static keyword.
    Since this function can be called from non-init code, use __modinit
    instead of __init, __modinit marker will make it __init if
    CONFIG_MODULES is not defined.
    
    Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
    Link: https://lore.kernel.org/r/20250227184930.34163-4-shyamsaini@linux.microsoft.com
    Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
    Stable-dep-of: f95bbfe18512 ("drivers: base: handle module_kobject creation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kernel: param: rename locate_module_kobject [+ + +]
Author: Shyam Saini <shyamsaini@linux.microsoft.com>
Date:   Thu Feb 27 10:49:27 2025 -0800

    kernel: param: rename locate_module_kobject
    
    [ Upstream commit bbc9462f0cb0c8917a4908e856731708f0cee910 ]
    
    The locate_module_kobject() function looks up an existing
    module_kobject for a given module name. If it cannot find the
    corresponding module_kobject, it creates one for the given name.
    
    This commit renames locate_module_kobject() to
    lookup_or_create_module_kobject() to better describe its operations.
    
    This doesn't change anything functionality wise.
    
    Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
    Link: https://lore.kernel.org/r/20250227184930.34163-2-shyamsaini@linux.microsoft.com
    Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
    Stable-dep-of: f95bbfe18512 ("drivers: base: handle module_kobject creation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ksmbd: fix use-after-free in kerberos authentication [+ + +]
Author: Sean Heelan <seanheelan@gmail.com>
Date:   Sat Apr 19 19:59:28 2025 +0100

    ksmbd: fix use-after-free in kerberos authentication
    
    commit e86e9134e1d1c90a960dd57f59ce574d27b9a124 upstream.
    
    Setting sess->user = NULL was introduced to fix the dangling pointer
    created by ksmbd_free_user. However, it is possible another thread could
    be operating on the session and make use of sess->user after it has been
    passed to ksmbd_free_user but before sess->user is set to NULL.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Heelan <seanheelan@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Jan 24 17:18:33 2025 -0800

    KVM: x86: Load DR6 with guest value only before entering .vcpu_run() loop
    
    commit c2fee09fc167c74a64adb08656cb993ea475197e upstream.
    
    Move the conditional loading of hardware DR6 with the guest's DR6 value
    out of the core .vcpu_run() loop to fix a bug where KVM can load hardware
    with a stale vcpu->arch.dr6.
    
    When the guest accesses a DR and host userspace isn't debugging the guest,
    KVM disables DR interception and loads the guest's values into hardware on
    VM-Enter and saves them on VM-Exit.  This allows the guest to access DRs
    at will, e.g. so that a sequence of DR accesses to configure a breakpoint
    only generates one VM-Exit.
    
    For DR0-DR3, the logic/behavior is identical between VMX and SVM, and also
    identical between KVM_DEBUGREG_BP_ENABLED (userspace debugging the guest)
    and KVM_DEBUGREG_WONT_EXIT (guest using DRs), and so KVM handles loading
    DR0-DR3 in common code, _outside_ of the core kvm_x86_ops.vcpu_run() loop.
    
    But for DR6, the guest's value doesn't need to be loaded into hardware for
    KVM_DEBUGREG_BP_ENABLED, and SVM provides a dedicated VMCB field whereas
    VMX requires software to manually load the guest value, and so loading the
    guest's value into DR6 is handled by {svm,vmx}_vcpu_run(), i.e. is done
    _inside_ the core run loop.
    
    Unfortunately, saving the guest values on VM-Exit is initiated by common
    x86, again outside of the core run loop.  If the guest modifies DR6 (in
    hardware, when DR interception is disabled), and then the next VM-Exit is
    a fastpath VM-Exit, KVM will reload hardware DR6 with vcpu->arch.dr6 and
    clobber the guest's actual value.
    
    The bug shows up primarily with nested VMX because KVM handles the VMX
    preemption timer in the fastpath, and the window between hardware DR6
    being modified (in guest context) and DR6 being read by guest software is
    orders of magnitude larger in a nested setup.  E.g. in non-nested, the
    VMX preemption timer would need to fire precisely between #DB injection
    and the #DB handler's read of DR6, whereas with a KVM-on-KVM setup, the
    window where hardware DR6 is "dirty" extends all the way from L1 writing
    DR6 to VMRESUME (in L1).
    
        L1's view:
        ==========
        <L1 disables DR interception>
               CPU 0/KVM-7289    [023] d....  2925.640961: kvm_entry: vcpu 0
     A:  L1 Writes DR6
               CPU 0/KVM-7289    [023] d....  2925.640963: <hack>: Set DRs, DR6 = 0xffff0ff1
    
     B:        CPU 0/KVM-7289    [023] d....  2925.640967: kvm_exit: vcpu 0 reason EXTERNAL_INTERRUPT intr_info 0x800000ec
    
     D: L1 reads DR6, arch.dr6 = 0
               CPU 0/KVM-7289    [023] d....  2925.640969: <hack>: Sync DRs, DR6 = 0xffff0ff0
    
               CPU 0/KVM-7289    [023] d....  2925.640976: kvm_entry: vcpu 0
        L2 reads DR6, L1 disables DR interception
               CPU 0/KVM-7289    [023] d....  2925.640980: kvm_exit: vcpu 0 reason DR_ACCESS info1 0x0000000000000216
               CPU 0/KVM-7289    [023] d....  2925.640983: kvm_entry: vcpu 0
    
               CPU 0/KVM-7289    [023] d....  2925.640983: <hack>: Set DRs, DR6 = 0xffff0ff0
    
        L2 detects failure
               CPU 0/KVM-7289    [023] d....  2925.640987: kvm_exit: vcpu 0 reason HLT
        L1 reads DR6 (confirms failure)
               CPU 0/KVM-7289    [023] d....  2925.640990: <hack>: Sync DRs, DR6 = 0xffff0ff0
    
        L0's view:
        ==========
        L2 reads DR6, arch.dr6 = 0
              CPU 23/KVM-5046    [001] d....  3410.005610: kvm_exit: vcpu 23 reason DR_ACCESS info1 0x0000000000000216
              CPU 23/KVM-5046    [001] .....  3410.005610: kvm_nested_vmexit: vcpu 23 reason DR_ACCESS info1 0x0000000000000216
    
        L2 => L1 nested VM-Exit
              CPU 23/KVM-5046    [001] .....  3410.005610: kvm_nested_vmexit_inject: reason: DR_ACCESS ext_inf1: 0x0000000000000216
    
              CPU 23/KVM-5046    [001] d....  3410.005610: kvm_entry: vcpu 23
              CPU 23/KVM-5046    [001] d....  3410.005611: kvm_exit: vcpu 23 reason VMREAD
              CPU 23/KVM-5046    [001] d....  3410.005611: kvm_entry: vcpu 23
              CPU 23/KVM-5046    [001] d....  3410.005612: kvm_exit: vcpu 23 reason VMREAD
              CPU 23/KVM-5046    [001] d....  3410.005612: kvm_entry: vcpu 23
    
        L1 writes DR7, L0 disables DR interception
              CPU 23/KVM-5046    [001] d....  3410.005612: kvm_exit: vcpu 23 reason DR_ACCESS info1 0x0000000000000007
              CPU 23/KVM-5046    [001] d....  3410.005613: kvm_entry: vcpu 23
    
        L0 writes DR6 = 0 (arch.dr6)
              CPU 23/KVM-5046    [001] d....  3410.005613: <hack>: Set DRs, DR6 = 0xffff0ff0
    
     A: <L1 writes DR6 = 1, no interception, arch.dr6 is still '0'>
    
     B:       CPU 23/KVM-5046    [001] d....  3410.005614: kvm_exit: vcpu 23 reason PREEMPTION_TIMER
              CPU 23/KVM-5046    [001] d....  3410.005614: kvm_entry: vcpu 23
    
     C: L0 writes DR6 = 0 (arch.dr6)
              CPU 23/KVM-5046    [001] d....  3410.005614: <hack>: Set DRs, DR6 = 0xffff0ff0
    
        L1 => L2 nested VM-Enter
              CPU 23/KVM-5046    [001] d....  3410.005616: kvm_exit: vcpu 23 reason VMRESUME
    
        L0 reads DR6, arch.dr6 = 0
    
    Reported-by: John Stultz <jstultz@google.com>
    Closes: https://lkml.kernel.org/r/CANDhNCq5_F3HfFYABqFGCA1bPd_%2BxgNj-iDQhH4tDk%2Bwi8iZZg%40mail.gmail.com
    Fixes: 375e28ffc0cf ("KVM: X86: Set host DR6 only on VMX and for KVM_DEBUGREG_WONT_EXIT")
    Fixes: d67668e9dd76 ("KVM: x86, SVM: isolate vcpu->arch.dr6 from vmcb->save.dr6")
    Cc: stable@vger.kernel.org
    Cc: Jim Mattson <jmattson@google.com>
    Tested-by: John Stultz <jstultz@google.com>
    Link: https://lore.kernel.org/r/20250125011833.3644371-1-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    [jth: Handled conflicts with kvm_x86_ops reshuffle]
    Signed-off-by: James Houghton <jthoughton@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.6.90 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri May 9 09:44:08 2025 +0200

    Linux 6.6.90
    
    Link: https://lore.kernel.org/r/20250507183813.500572371@linuxfoundation.org
    Tested-by: Nam Cao <namcao@linutronix.de>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Link: https://lore.kernel.org/r/20250508112618.875786933@linuxfoundation.org
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Ryan Matthews <ryanmatthews@fastmail.com>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/memblock: pass size instead of end to memblock_set_node() [+ + +]
Author: Wei Yang <richard.weiyang@gmail.com>
Date:   Tue Mar 18 07:19:46 2025 +0000

    mm/memblock: pass size instead of end to memblock_set_node()
    
    commit 06eaa824fd239edd1eab2754f29b2d03da313003 upstream.
    
    The second parameter of memblock_set_node() is size instead of end.
    
    Since it iterates from lower address to higher address, finally the node
    id is correct. But during the process, some of them are wrong.
    
    Pass size instead of end.
    
    Fixes: 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()")
    Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
    CC: Mike Rapoport <rppt@kernel.org>
    CC: Yajun Deng <yajun.deng@linux.dev>
    CC: stable@vger.kernel.org
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Link: https://lore.kernel.org/r/20250318071948.23854-2-richard.weiyang@gmail.com
    Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm/memblock: repeat setting reserved region nid if array is doubled [+ + +]
Author: Wei Yang <richard.weiyang@gmail.com>
Date:   Tue Mar 18 07:19:47 2025 +0000

    mm/memblock: repeat setting reserved region nid if array is doubled
    
    commit eac8ea8736ccc09513152d970eb2a42ed78e87e8 upstream.
    
    Commit 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()") introduce
    a way to set nid to all reserved region.
    
    But there is a corner case it will leave some region with invalid nid.
    When memblock_set_node() doubles the array of memblock.reserved, it may
    lead to a new reserved region before current position. The new region
    will be left with an invalid node id.
    
    Repeat the process when detecting it.
    
    Fixes: 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()")
    Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
    CC: Mike Rapoport <rppt@kernel.org>
    CC: Yajun Deng <yajun.deng@linux.dev>
    CC: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250318071948.23854-3-richard.weiyang@gmail.com
    Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mmc: renesas_sdhi: Fix error handling in renesas_sdhi_probe [+ + +]
Author: Ruslan Piasetskyi <ruslan.piasetskyi@gmail.com>
Date:   Wed Mar 26 23:06:38 2025 +0100

    mmc: renesas_sdhi: Fix error handling in renesas_sdhi_probe
    
    commit 649b50a82f09fa44c2f7a65618e4584072145ab7 upstream.
    
    After moving tmio_mmc_host_probe down, error handling has to be
    adjusted.
    
    Fixes: 74f45de394d9 ("mmc: renesas_sdhi: register irqs before registering controller")
    Reviewed-by: Ihar Salauyou <salauyou.ihar@gmail.com>
    Signed-off-by: Ruslan Piasetskyi <ruslan.piasetskyi@gmail.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250326220638.460083-1-ruslan.piasetskyi@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/mlx5: E-switch, Fix error handling for enabling roce [+ + +]
Author: Chris Mi <cmi@nvidia.com>
Date:   Wed Apr 23 11:36:11 2025 +0300

    net/mlx5: E-switch, Fix error handling for enabling roce
    
    [ Upstream commit 90538d23278a981e344d364e923162fce752afeb ]
    
    The cited commit assumes enabling roce always succeeds. But it is
    not true. Add error handling for it.
    
    Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic")
    Signed-off-by: Chris Mi <cmi@nvidia.com>
    Reviewed-by: Roi Dayan <roid@nvidia.com>
    Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
    Signed-off-by: Mark Bloch <mbloch@nvidia.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Link: https://patch.msgid.link/20250423083611.324567-6-mbloch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/mlx5: E-Switch, Initialize MAC Address for Default GID [+ + +]
Author: Maor Gottlieb <maorg@nvidia.com>
Date:   Wed Apr 23 11:36:08 2025 +0300

    net/mlx5: E-Switch, Initialize MAC Address for Default GID
    
    [ Upstream commit 5d1a04f347e6cbf5ffe74da409a5d71fbe8c5f19 ]
    
    Initialize the source MAC address when creating the default GID entry.
    Since this entry is used only for loopback traffic, it only needs to
    be a unicast address. A zeroed-out MAC address is sufficient for this
    purpose.
    Without this fix, random bits would be assigned as the source address.
    If these bits formed a multicast address, the firmware would return an
    error, preventing the user from switching to switchdev mode:
    
    Error: mlx5_core: Failed setting eswitch to offloads.
    kernel answers: Invalid argument
    
    Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic")
    Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
    Signed-off-by: Mark Bloch <mbloch@nvidia.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Link: https://patch.msgid.link/20250423083611.324567-3-mbloch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: dlink: Correct endianness handling of led_mode [+ + +]
Author: Simon Horman <horms@kernel.org>
Date:   Fri Apr 25 16:50:47 2025 +0100

    net: dlink: Correct endianness handling of led_mode
    
    [ Upstream commit e7e5ae71831c44d58627a991e603845a2fed2cab ]
    
    As it's name suggests, parse_eeprom() parses EEPROM data.
    
    This is done by reading data, 16 bits at a time as follows:
    
            for (i = 0; i < 128; i++)
                    ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom(np, i));
    
    sromdata is at the same memory location as psrom.
    And the type of psrom is a pointer to struct t_SROM.
    
    As can be seen in the loop above, data is stored in sromdata, and thus psrom,
    as 16-bit little-endian values.
    
    However, the integer fields of t_SROM are host byte order integers.
    And in the case of led_mode this leads to a little endian value
    being incorrectly treated as host byte order.
    
    Looking at rio_set_led_mode, this does appear to be a bug as that code
    masks led_mode with 0x1, 0x2 and 0x8. Logic that would be effected by a
    reversed byte order.
    
    This problem would only manifest on big endian hosts.
    
    Found by inspection while investigating a sparse warning
    regarding the crc field of t_SROM.
    
    I believe that warning is a false positive. And although I plan
    to send a follow-up to use little-endian types for other the integer
    fields of PSROM_t I do not believe that will involve any bug fixes.
    
    Compile tested only.
    
    Fixes: c3f45d322cbd ("dl2k: Add support for IP1000A-based cards")
    Signed-off-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250425-dlink-led-mode-v1-1-6bae3c36e736@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: felix: fix broken taprio gate states after clock jump [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Sat Apr 26 17:48:55 2025 +0300

    net: dsa: felix: fix broken taprio gate states after clock jump
    
    [ Upstream commit 426d487bca38b34f39c483edfc6313a036446b33 ]
    
    Simplest setup to reproduce the issue: connect 2 ports of the
    LS1028A-RDB together (eno0 with swp0) and run:
    
    $ ip link set eno0 up && ip link set swp0 up
    $ tc qdisc replace dev swp0 parent root handle 100 taprio num_tc 8 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 map 0 1 2 3 4 5 6 7 \
            base-time 0 sched-entry S 20 300000 sched-entry S 10 200000 \
            sched-entry S 20 300000 sched-entry S 48 200000 \
            sched-entry S 20 300000 sched-entry S 83 200000 \
            sched-entry S 40 300000 sched-entry S 00 200000 flags 2
    $ ptp4l -i eno0 -f /etc/linuxptp/configs/gPTP.cfg -m &
    $ ptp4l -i swp0 -f /etc/linuxptp/configs/gPTP.cfg -m
    
    One will observe that the PTP state machine on swp0 starts
    synchronizing, then it attempts to do a clock step, and after that, it
    never fails to recover from the condition below.
    
    ptp4l[82.427]: selected best master clock 00049f.fffe.05f627
    ptp4l[82.428]: port 1 (swp0): MASTER to UNCALIBRATED on RS_SLAVE
    ptp4l[83.252]: port 1 (swp0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
    ptp4l[83.886]: rms 4537731277 max 9075462553 freq -18518 +/- 11467 delay   818 +/-   0
    ptp4l[84.170]: timed out while polling for tx timestamp
    ptp4l[84.171]: increasing tx_timestamp_timeout or increasing kworker priority may correct this issue, but a driver bug likely causes it
    ptp4l[84.172]: port 1 (swp0): send peer delay request failed
    ptp4l[84.173]: port 1 (swp0): clearing fault immediately
    ptp4l[84.269]: port 1 (swp0): SLAVE to LISTENING on INIT_COMPLETE
    ptp4l[85.303]: timed out while polling for tx timestamp
    ptp4l[84.171]: increasing tx_timestamp_timeout or increasing kworker priority may correct this issue, but a driver bug likely causes it
    ptp4l[84.172]: port 1 (swp0): send peer delay request failed
    ptp4l[84.173]: port 1 (swp0): clearing fault immediately
    ptp4l[84.269]: port 1 (swp0): SLAVE to LISTENING on INIT_COMPLETE
    ptp4l[85.303]: timed out while polling for tx timestamp
    ptp4l[85.304]: increasing tx_timestamp_timeout or increasing kworker priority may correct this issue, but a driver bug likely causes it
    ptp4l[85.305]: port 1 (swp0): send peer delay response failed
    ptp4l[85.306]: port 1 (swp0): clearing fault immediately
    ptp4l[86.304]: timed out while polling for tx timestamp
    
    A hint is given by the non-zero statistics for dropped packets which
    were expecting hardware TX timestamps:
    
    $ ethtool --include-statistics -T swp0
    (...)
    Statistics:
      tx_pkts: 30
      tx_lost: 11
      tx_err: 0
    
    We know that when PTP clock stepping takes place (from ocelot_ptp_settime64()
    or from ocelot_ptp_adjtime()), vsc9959_tas_clock_adjust() is called.
    
    Another interesting hint is that placing an early return in
    vsc9959_tas_clock_adjust(), so as to neutralize this function, fixes the
    issue and TX timestamps are no longer dropped.
    
    The debugging function written by me and included below is intended to
    read the GCL RAM, after the admin schedule became operational, through
    the two status registers available for this purpose:
    QSYS_GCL_STATUS_REG_1 and QSYS_GCL_STATUS_REG_2.
    
    static void vsc9959_print_tas_gcl(struct ocelot *ocelot)
    {
            u32 val, list_length, interval, gate_state;
            int i, err;
    
            err = read_poll_timeout(ocelot_read, val,
                                    !(val & QSYS_PARAM_STATUS_REG_8_CONFIG_PENDING),
                                    10, 100000, false, ocelot, QSYS_PARAM_STATUS_REG_8);
            if (err) {
                    dev_err(ocelot->dev,
                            "Failed to wait for TAS config pending bit to clear: %pe\n",
                            ERR_PTR(err));
                    return;
            }
    
            val = ocelot_read(ocelot, QSYS_PARAM_STATUS_REG_3);
            list_length = QSYS_PARAM_STATUS_REG_3_LIST_LENGTH_X(val);
    
            dev_info(ocelot->dev, "GCL length: %u\n", list_length);
    
            for (i = 0; i < list_length; i++) {
                    ocelot_rmw(ocelot,
                               QSYS_GCL_STATUS_REG_1_GCL_ENTRY_NUM(i),
                               QSYS_GCL_STATUS_REG_1_GCL_ENTRY_NUM_M,
                               QSYS_GCL_STATUS_REG_1);
                    interval = ocelot_read(ocelot, QSYS_GCL_STATUS_REG_2);
                    val = ocelot_read(ocelot, QSYS_GCL_STATUS_REG_1);
                    gate_state = QSYS_GCL_STATUS_REG_1_GATE_STATE_X(val);
    
                    dev_info(ocelot->dev, "GCL entry %d: states 0x%x interval %u\n",
                             i, gate_state, interval);
            }
    }
    
    Calling it from two places: after the initial QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE
    performed by vsc9959_qos_port_tas_set(), and after the one done by
    vsc9959_tas_clock_adjust(), I notice the following difference.
    
    From the tc-taprio process context, where the schedule was initially
    configured, the GCL looks like this:
    
    mscc_felix 0000:00:00.5: GCL length: 8
    mscc_felix 0000:00:00.5: GCL entry 0: states 0x20 interval 300000
    mscc_felix 0000:00:00.5: GCL entry 1: states 0x10 interval 200000
    mscc_felix 0000:00:00.5: GCL entry 2: states 0x20 interval 300000
    mscc_felix 0000:00:00.5: GCL entry 3: states 0x48 interval 200000
    mscc_felix 0000:00:00.5: GCL entry 4: states 0x20 interval 300000
    mscc_felix 0000:00:00.5: GCL entry 5: states 0x83 interval 200000
    mscc_felix 0000:00:00.5: GCL entry 6: states 0x40 interval 300000
    mscc_felix 0000:00:00.5: GCL entry 7: states 0x0 interval 200000
    
    But from the ptp4l clock stepping process context, when the
    vsc9959_tas_clock_adjust() hook is called, the GCL RAM of the
    operational schedule now looks like this:
    
    mscc_felix 0000:00:00.5: GCL length: 8
    mscc_felix 0000:00:00.5: GCL entry 0: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 1: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 2: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 3: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 4: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 5: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 6: states 0x0 interval 0
    mscc_felix 0000:00:00.5: GCL entry 7: states 0x0 interval 0
    
    I do not have a formal explanation, just experimental conclusions.
    It appears that after triggering QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE
    for a port's TAS, the GCL entry RAM is updated anyway, despite what the
    documentation claims: "Specify the time interval in
    QSYS::GCL_CFG_REG_2.TIME_INTERVAL. This triggers the actual RAM
    write with the gate state and the time interval for the entry number
    specified". We don't touch that register (through vsc9959_tas_gcl_set())
    from vsc9959_tas_clock_adjust(), yet the GCL RAM is updated anyway.
    
    It seems to be updated with effectively stale memory, which in my
    testing can hold a variety of things, including even pieces of the
    previously applied schedule, for particular schedule lengths.
    
    As such, in most circumstances it is very difficult to pinpoint this
    issue, because the newly updated schedule would "behave strangely",
    but ultimately might still pass traffic to some extent, due to some
    gate entries still being present in the stale GCL entry RAM. It is easy
    to miss.
    
    With the particular schedule given at the beginning, the GCL RAM
    "happens" to be reproducibly rewritten with all zeroes, and this is
    consistent with what we see: when the time-aware shaper has gate entries
    with all gates closed, traffic is dropped on TX, no wonder we can't
    retrieve TX timestamps.
    
    Rewriting the GCL entry RAM when reapplying the new base time fixes the
    observed issue.
    
    Fixes: 8670dc33f48b ("net: dsa: felix: update base time of time-aware shaper when adjusting PTP time")
    Reported-by: Richie Pearn <richard.pearn@nxp.com>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://patch.msgid.link/20250426144859.3128352-2-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: mtk-star-emac: fix spinlock recursion issues on rx/tx poll [+ + +]
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Date:   Thu Apr 24 10:38:48 2025 +0200

    net: ethernet: mtk-star-emac: fix spinlock recursion issues on rx/tx poll
    
    [ Upstream commit 6fe0866014486736cc3ba1c6fd4606d3dbe55c9c ]
    
    Use spin_lock_irqsave and spin_unlock_irqrestore instead of spin_lock
    and spin_unlock in mtk_star_emac driver to avoid spinlock recursion
    occurrence that can happen when enabling the DMA interrupts again in
    rx/tx poll.
    
    ```
    BUG: spinlock recursion on CPU#0, swapper/0/0
     lock: 0xffff00000db9cf20, .magic: dead4ead, .owner: swapper/0/0,
        .owner_cpu: 0
    CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted
        6.15.0-rc2-next-20250417-00001-gf6a27738686c-dirty #28 PREEMPT
    Hardware name: MediaTek MT8365 Open Platform EVK (DT)
    Call trace:
     show_stack+0x18/0x24 (C)
     dump_stack_lvl+0x60/0x80
     dump_stack+0x18/0x24
     spin_dump+0x78/0x88
     do_raw_spin_lock+0x11c/0x120
     _raw_spin_lock+0x20/0x2c
     mtk_star_handle_irq+0xc0/0x22c [mtk_star_emac]
     __handle_irq_event_percpu+0x48/0x140
     handle_irq_event+0x4c/0xb0
     handle_fasteoi_irq+0xa0/0x1bc
     handle_irq_desc+0x34/0x58
     generic_handle_domain_irq+0x1c/0x28
     gic_handle_irq+0x4c/0x120
     do_interrupt_handler+0x50/0x84
     el1_interrupt+0x34/0x68
     el1h_64_irq_handler+0x18/0x24
     el1h_64_irq+0x6c/0x70
     regmap_mmio_read32le+0xc/0x20 (P)
     _regmap_bus_reg_read+0x6c/0xac
     _regmap_read+0x60/0xdc
     regmap_read+0x4c/0x80
     mtk_star_rx_poll+0x2f4/0x39c [mtk_star_emac]
     __napi_poll+0x38/0x188
     net_rx_action+0x164/0x2c0
     handle_softirqs+0x100/0x244
     __do_softirq+0x14/0x20
     ____do_softirq+0x10/0x20
     call_on_irq_stack+0x24/0x64
     do_softirq_own_stack+0x1c/0x40
     __irq_exit_rcu+0xd4/0x10c
     irq_exit_rcu+0x10/0x1c
     el1_interrupt+0x38/0x68
     el1h_64_irq_handler+0x18/0x24
     el1h_64_irq+0x6c/0x70
     cpuidle_enter_state+0xac/0x320 (P)
     cpuidle_enter+0x38/0x50
     do_idle+0x1e4/0x260
     cpu_startup_entry+0x34/0x3c
     rest_init+0xdc/0xe0
     console_on_rootfs+0x0/0x6c
     __primary_switched+0x88/0x90
    ```
    
    Fixes: 0a8bd81fd6aa ("net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs")
    Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Link: https://patch.msgid.link/20250424-mtk_star_emac-fix-spinlock-recursion-issue-v2-1-f3fde2e529d8@collabora.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: mtk-star-emac: rearm interrupts in rx_poll only when advised [+ + +]
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Date:   Thu Apr 24 10:38:49 2025 +0200

    net: ethernet: mtk-star-emac: rearm interrupts in rx_poll only when advised
    
    [ Upstream commit e54b4db35e201a9173da9cb7abc8377e12abaf87 ]
    
    In mtk_star_rx_poll function, on event processing completion, the
    mtk_star_emac driver calls napi_complete_done but ignores its return
    code and enable RX DMA interrupts inconditionally. This return code
    gives the info if a device should avoid rearming its interrupts or not,
    so fix this behaviour by taking it into account.
    
    Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
    Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
    Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Link: https://patch.msgid.link/20250424-mtk_star_emac-fix-spinlock-recursion-issue-v2-2-f3fde2e529d8@collabora.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM [+ + +]
Author: Chad Monroe <chad@monroe.io>
Date:   Sun Apr 27 02:05:44 2025 +0100

    net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM
    
    [ Upstream commit 6e0490fc36cdac696f96e57b61d93b9ae32e0f4c ]
    
    If the mtk_poll_rx() function detects the MTK_RESETTING flag, it will
    jump to release_desc and refill the high word of the SDP on the 4GB RFB.
    Subsequently, mtk_rx_clean will process an incorrect SDP, leading to a
    panic.
    
    Add patch from MediaTek's SDK to resolve this.
    
    Fixes: 2d75891ebc09 ("net: ethernet: mtk_eth_soc: support 36-bit DMA addressing on MT7988")
    Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/71f47ea785699c6aa3b922d66c2bdc1a43da25b1
    Signed-off-by: Chad Monroe <chad@monroe.io>
    Link: https://patch.msgid.link/4adc2aaeb0fb1b9cdc56bf21cf8e7fa328daa345.1745715843.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: fec: ERR007885 Workaround for conventional TX [+ + +]
Author: Mattias Barthel <mattias.barthel@atlascopco.com>
Date:   Tue Apr 29 11:08:26 2025 +0200

    net: fec: ERR007885 Workaround for conventional TX
    
    [ Upstream commit a179aad12badc43201cbf45d1e8ed2c1383c76b9 ]
    
    Activate TX hang workaround also in
    fec_enet_txq_submit_skb() when TSO is not enabled.
    
    Errata: ERR007885
    
    Symptoms: NETDEV WATCHDOG: eth0 (fec): transmit queue 0 timed out
    
    commit 37d6017b84f7 ("net: fec: Workaround for imx6sx enet tx hang when enable three queues")
    There is a TDAR race condition for mutliQ when the software sets TDAR
    and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles).
    This will cause the udma_tx and udma_tx_arbiter state machines to hang.
    
    So, the Workaround is checking TDAR status four time, if TDAR cleared by
        hardware and then write TDAR, otherwise don't set TDAR.
    
    Fixes: 53bb20d1faba ("net: fec: add variable reg_desc_active to speed things up")
    Signed-off-by: Mattias Barthel <mattias.barthel@atlascopco.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250429090826.3101258-1-mattiasbarthel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: defer calling ptp_clock_register() [+ + +]
Author: Jian Shen <shenjian15@huawei.com>
Date:   Wed Apr 30 17:30:52 2025 +0800

    net: hns3: defer calling ptp_clock_register()
    
    [ Upstream commit 4971394d9d624f91689d766f31ce668d169d9959 ]
    
    Currently the ptp_clock_register() is called before relative
    ptp resource ready. It may cause unexpected result when upper
    layer called the ptp API during the timewindow. Fix it by
    moving the ptp_clock_register() to the function end.
    
    Fixes: 0bf5eb788512 ("net: hns3: add support for PTP")
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20250430093052.2400464-5-shaojijie@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: fix an interrupt residual problem [+ + +]
Author: Yonglong Liu <liuyonglong@huawei.com>
Date:   Wed Apr 30 17:30:50 2025 +0800

    net: hns3: fix an interrupt residual problem
    
    [ Upstream commit 8e6b9c6ea5a55045eed6526d8ee49e93192d1a58 ]
    
    When a VF is passthrough to a VM, and the VM is killed, the reported
    interrupt may not been handled, it will remain, and won't be clear by
    the nic engine even with a flr or tqp reset. When the VM restart, the
    interrupt of the first vector may be dropped by the second enable_irq
    in vfio, see the issue below:
    https://gitlab.com/qemu-project/qemu/-/issues/2884#note_2423361621
    
    We notice that the vfio has always behaved this way, and the interrupt
    is a residue of the nic engine, so we fix the problem by moving the
    vector enable process out of the enable_irq loop.
    
    Fixes: 08a100689d4b ("net: hns3: re-organize vector handle")
    Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Link: https://patch.msgid.link/20250430093052.2400464-3-shaojijie@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: fixed debugfs tm_qset size [+ + +]
Author: Hao Lan <lanhao@huawei.com>
Date:   Wed Apr 30 17:30:51 2025 +0800

    net: hns3: fixed debugfs tm_qset size
    
    [ Upstream commit e317aebeefcb3b0c71f2305af3c22871ca6b3833 ]
    
    The size of the tm_qset file of debugfs is limited to 64 KB,
    which is too small in the scenario with 1280 qsets.
    The size needs to be expanded to 1 MB.
    
    Fixes: 5e69ea7ee2a6 ("net: hns3: refactor the debugfs process")
    Signed-off-by: Hao Lan <lanhao@huawei.com>
    Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Link: https://patch.msgid.link/20250430093052.2400464-4-shaojijie@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: store rx VLAN tag offload state for VF [+ + +]
Author: Jian Shen <shenjian15@huawei.com>
Date:   Wed Apr 30 17:30:49 2025 +0800

    net: hns3: store rx VLAN tag offload state for VF
    
    [ Upstream commit ef2383d078edcbe3055032436b16cdf206f26de2 ]
    
    The VF driver missed to store the rx VLAN tag strip state when
    user change the rx VLAN tag offload state. And it will default
    to enable the rx vlan tag strip when re-init VF device after
    reset. So if user disable rx VLAN tag offload, and trig reset,
    then the HW will still strip the VLAN tag from packet nad fill
    into RX BD, but the VF driver will ignore it for rx VLAN tag
    offload disabled. It may cause the rx VLAN tag dropped.
    
    Fixes: b2641e2ad456 ("net: hns3: Add support of hardware rx-vlan-offload to HNS3 VF driver")
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250430093052.2400464-2-shaojijie@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv6: fix UDPv6 GSO segmentation with NAT [+ + +]
Author: Felix Fietkau <nbd@nbd.name>
Date:   Sat Apr 26 17:32:09 2025 +0200

    net: ipv6: fix UDPv6 GSO segmentation with NAT
    
    [ Upstream commit b936a9b8d4a585ccb6d454921c36286bfe63e01d ]
    
    If any address or port is changed, update it in all packets and recalculate
    checksum.
    
    Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20250426153210.14044-1-nbd@nbd.name
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: lan743x: Fix memleak issue when GSO enabled [+ + +]
Author: Thangaraj Samynathan <thangaraj.s@microchip.com>
Date:   Tue Apr 29 10:55:27 2025 +0530

    net: lan743x: Fix memleak issue when GSO enabled
    
    [ Upstream commit 2d52e2e38b85c8b7bc00dca55c2499f46f8c8198 ]
    
    Always map the `skb` to the LS descriptor. Previously skb was
    mapped to EXT descriptor when the number of fragments is zero with
    GSO enabled. Mapping the skb to EXT descriptor prevents it from
    being freed, leading to a memory leak
    
    Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
    Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://patch.msgid.link/20250429052527.10031-1-thangaraj.s@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mdio: mux-meson-gxl: set reversed bit when using internal phy [+ + +]
Author: Da Xue <da@libre.computer>
Date:   Fri Apr 25 15:20:09 2025 -0400

    net: mdio: mux-meson-gxl: set reversed bit when using internal phy
    
    [ Upstream commit b23285e93bef729e67519a5209d5b7fde3b4af50 ]
    
    This bit is necessary to receive packets from the internal PHY.
    Without this bit set, no activity occurs on the interface.
    
    Normally u-boot sets this bit, but if u-boot is compiled without
    net support, the interface will be up but without any activity.
    If bit is set once, it will work until the IP is powered down or reset.
    
    The vendor SDK sets this bit along with the PHY_ID bits.
    
    Signed-off-by: Da Xue <da@libre.computer>
    Fixes: 9a24e1ff4326 ("net: mdio: add amlogic gxl mdio mux support")
    Link: https://patch.msgid.link/20250425192009.1439508-1-da@libre.computer
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mscc: ocelot: delete PVID VLAN when readding it as non-PVID [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Fri Apr 25 01:37:33 2025 +0300

    net: mscc: ocelot: delete PVID VLAN when readding it as non-PVID
    
    [ Upstream commit 5ec6d7d737a491256cd37e33910f7ac1978db591 ]
    
    The following set of commands:
    
    ip link add br0 type bridge vlan_filtering 1 # vlan_default_pvid 1 is implicit
    ip link set swp0 master br0
    bridge vlan add dev swp0 vid 1
    
    should result in the dropping of untagged and 802.1p-tagged traffic, but
    we see that it continues to be accepted. Whereas, had we deleted VID 1
    instead, the aforementioned dropping would have worked
    
    This is because the ANA_PORT_DROP_CFG update logic doesn't run, because
    ocelot_vlan_add() only calls ocelot_port_set_pvid() if the new VLAN has
    the BRIDGE_VLAN_INFO_PVID flag.
    
    Similar to other drivers like mt7530_port_vlan_add() which handle this
    case correctly, we need to test whether the VLAN we're changing used to
    have the BRIDGE_VLAN_INFO_PVID flag, but lost it now. That amounts to a
    PVID deletion and should be treated as such.
    
    Regarding blame attribution: this never worked properly since the
    introduction of bridge VLAN filtering in commit 7142529f1688 ("net:
    mscc: ocelot: add VLAN filtering"). However, there was a significant
    paradigm shift which aligned the ANA_PORT_DROP_CFG register with the
    PVID concept rather than with the native VLAN concept, and that change
    wasn't targeted for 'stable'. Realistically, that is as far as this fix
    needs to be propagated to.
    
    Fixes: be0576fed6d3 ("net: mscc: ocelot: move the logic to drop 802.1p traffic to the pvid deletion")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://patch.msgid.link/20250424223734.3096202-1-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mscc: ocelot: treat 802.1ad tagged traffic as 802.1Q-untagged [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Thu Aug 15 03:07:07 2024 +0300

    net: mscc: ocelot: treat 802.1ad tagged traffic as 802.1Q-untagged
    
    [ Upstream commit 36dd1141be70b5966906919714dc504a24c65ddf ]
    
    I was revisiting the topic of 802.1ad treatment in the Ocelot switch [0]
    and realized that not only is its basic VLAN classification pipeline
    improper for offloading vlan_protocol 802.1ad bridges, but also improper
    for offloading regular 802.1Q bridges already.
    
    Namely, 802.1ad-tagged traffic should be treated as VLAN-untagged by
    bridged ports, but this switch treats it as if it was 802.1Q-tagged with
    the same VID as in the 802.1ad header. This is markedly different to
    what the Linux bridge expects; see the "other_tpid()" function in
    tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh.
    
    An idea came to me that the VCAP IS1 TCAM is more powerful than I'm
    giving it credit for, and that it actually overwrites the classified VID
    before the VLAN Table lookup takes place. In other words, it can be
    used even to save a packet from being dropped on ingress due to VLAN
    membership.
    
    Add a sophisticated TCAM rule hardcoded into the driver to force the
    switch to behave like a Linux bridge with vlan_filtering 1 vlan_protocol
    802.1Q.
    
    Regarding the lifetime of the filter: eventually the bridge will
    disappear, and vlan_filtering on the port will be restored to 0 for
    standalone mode. Then the filter will be deleted.
    
    [0]: https://lore.kernel.org/netdev/20201009122947.nvhye4hvcha3tljh@skbuf/
    
    Fixes: 7142529f1688 ("net: mscc: ocelot: add VLAN filtering")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 5ec6d7d737a4 ("net: mscc: ocelot: delete PVID VLAN when readding it as non-PVID")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: Rename mono_delivery_time to tstamp_type for scalabilty [+ + +]
Author: Abhishek Chauhan <quic_abchauha@quicinc.com>
Date:   Thu May 9 14:18:32 2024 -0700

    net: Rename mono_delivery_time to tstamp_type for scalabilty
    
    [ Upstream commit 4d25ca2d6801cfcf26f7f39c561611ba5be99bf8 ]
    
    mono_delivery_time was added to check if skb->tstamp has delivery
    time in mono clock base (i.e. EDT) otherwise skb->tstamp has
    timestamp in ingress and delivery_time at egress.
    
    Renaming the bitfield from mono_delivery_time to tstamp_type is for
    extensibilty for other timestamps such as userspace timestamp
    (i.e. SO_TXTIME) set via sock opts.
    
    As we are renaming the mono_delivery_time to tstamp_type, it makes
    sense to start assigning tstamp_type based on enum defined
    in this commit.
    
    Earlier we used bool arg flag to check if the tstamp is mono in
    function skb_set_delivery_time, Now the signature of the functions
    accepts tstamp_type to distinguish between mono and real time.
    
    Also skb_set_delivery_type_by_clockid is a new function which accepts
    clockid to determine the tstamp_type.
    
    In future tstamp_type:1 can be extended to support userspace timestamp
    by increasing the bitfield.
    
    Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Reviewed-by: Martin KaFai Lau <martin.lau@kernel.org>
    Link: https://lore.kernel.org/r/20240509211834.3235191-2-quic_abchauha@quicinc.com
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Stable-dep-of: 3908feb1bd7f ("Bluetooth: L2CAP: copy RX timestamp to new fragments")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vertexcom: mse102x: Add range check for CMD_RTS [+ + +]
Author: Stefan Wahren <wahrenst@gmx.net>
Date:   Wed Apr 30 15:30:42 2025 +0200

    net: vertexcom: mse102x: Add range check for CMD_RTS
    
    [ Upstream commit d4dda902dac194e3231a1ed0f76c6c3b6340ba8a ]
    
    Since there is no protection in the SPI protocol against electrical
    interferences, the driver shouldn't blindly trust the length payload
    of CMD_RTS. So introduce a bounds check for incoming frames.
    
    Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support")
    Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250430133043.7722-4-wahrenst@gmx.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vertexcom: mse102x: Fix LEN_MASK [+ + +]
Author: Stefan Wahren <wahrenst@gmx.net>
Date:   Wed Apr 30 15:30:41 2025 +0200

    net: vertexcom: mse102x: Fix LEN_MASK
    
    [ Upstream commit 74987089ec678b4018dba0a609e9f4bf6ef7f4ad ]
    
    The LEN_MASK for CMD_RTS doesn't cover the whole parameter mask.
    The Bit 11 is reserved, so adjust LEN_MASK accordingly.
    
    Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support")
    Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250430133043.7722-3-wahrenst@gmx.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vertexcom: mse102x: Fix possible stuck of SPI interrupt [+ + +]
Author: Stefan Wahren <wahrenst@gmx.net>
Date:   Wed Apr 30 15:30:40 2025 +0200

    net: vertexcom: mse102x: Fix possible stuck of SPI interrupt
    
    [ Upstream commit 55f362885951b2d00fd7fbb02ef0227deea572c2 ]
    
    The MSE102x doesn't provide any SPI commands for interrupt handling.
    So in case the interrupt fired before the driver requests the IRQ,
    the interrupt will never fire again. In order to fix this always poll
    for pending packets after opening the interface.
    
    Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support")
    Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250430133043.7722-2-wahrenst@gmx.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vertexcom: mse102x: Fix RX error handling [+ + +]
Author: Stefan Wahren <wahrenst@gmx.net>
Date:   Wed Apr 30 15:30:43 2025 +0200

    net: vertexcom: mse102x: Fix RX error handling
    
    [ Upstream commit ee512922ddd7d64afe2b28830a88f19063217649 ]
    
    In case the CMD_RTS got corrupted by interferences, the MSE102x
    doesn't allow a retransmission of the command. Instead the Ethernet
    frame must be shifted out of the SPI FIFO. Since the actual length is
    unknown, assume the maximum possible value.
    
    Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support")
    Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250430133043.7722-5-wahrenst@gmx.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net_sched: drr: Fix double list add in class with netem as child qdisc [+ + +]
Author: Victor Nogueira <victor@mojatatu.com>
Date:   Fri Apr 25 19:07:05 2025 -0300

    net_sched: drr: Fix double list add in class with netem as child qdisc
    
    [ Upstream commit f99a3fbf023e20b626be4b0f042463d598050c9a ]
    
    As described in Gerrard's report [1], there are use cases where a netem
    child qdisc will make the parent qdisc's enqueue callback reentrant.
    In the case of drr, there won't be a UAF, but the code will add the same
    classifier to the list twice, which will cause memory corruption.
    
    In addition to checking for qlen being zero, this patch checks whether the
    class was already added to the active_list (cl_is_active) before adding
    to the list to cover for the reentrant case.
    
    [1] https://lore.kernel.org/netdev/CAHcdcOm+03OD2j6R0=YHKqmy=VgJ8xEOKuP6c7mSgnp-TEJJbw@mail.gmail.com/
    
    Fixes: 37d9cf1a3ce3 ("sched: Fix detection of empty queues in child qdiscs")
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20250425220710.3964791-2-victor@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net_sched: ets: Fix double list add in class with netem as child qdisc [+ + +]
Author: Victor Nogueira <victor@mojatatu.com>
Date:   Fri Apr 25 19:07:07 2025 -0300

    net_sched: ets: Fix double list add in class with netem as child qdisc
    
    [ Upstream commit 1a6d0c00fa07972384b0c308c72db091d49988b6 ]
    
    As described in Gerrard's report [1], there are use cases where a netem
    child qdisc will make the parent qdisc's enqueue callback reentrant.
    In the case of ets, there won't be a UAF, but the code will add the same
    classifier to the list twice, which will cause memory corruption.
    
    In addition to checking for qlen being zero, this patch checks whether
    the class was already added to the active_list (cl_is_active) before
    doing the addition to cater for the reentrant case.
    
    [1] https://lore.kernel.org/netdev/CAHcdcOm+03OD2j6R0=YHKqmy=VgJ8xEOKuP6c7mSgnp-TEJJbw@mail.gmail.com/
    
    Fixes: 37d9cf1a3ce3 ("sched: Fix detection of empty queues in child qdiscs")
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20250425220710.3964791-4-victor@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net_sched: hfsc: Fix a UAF vulnerability in class with netem as child qdisc [+ + +]
Author: Victor Nogueira <victor@mojatatu.com>
Date:   Fri Apr 25 19:07:06 2025 -0300

    net_sched: hfsc: Fix a UAF vulnerability in class with netem as child qdisc
    
    [ Upstream commit 141d34391abbb315d68556b7c67ad97885407547 ]
    
    As described in Gerrard's report [1], we have a UAF case when an hfsc class
    has a netem child qdisc. The crux of the issue is that hfsc is assuming
    that checking for cl->qdisc->q.qlen == 0 guarantees that it hasn't inserted
    the class in the vttree or eltree (which is not true for the netem
    duplicate case).
    
    This patch checks the n_active class variable to make sure that the code
    won't insert the class in the vttree or eltree twice, catering for the
    reentrant case.
    
    [1] https://lore.kernel.org/netdev/CAHcdcOm+03OD2j6R0=YHKqmy=VgJ8xEOKuP6c7mSgnp-TEJJbw@mail.gmail.com/
    
    Fixes: 37d9cf1a3ce3 ("sched: Fix detection of empty queues in child qdiscs")
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20250425220710.3964791-3-victor@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net_sched: qfq: Fix double list add in class with netem as child qdisc [+ + +]
Author: Victor Nogueira <victor@mojatatu.com>
Date:   Fri Apr 25 19:07:08 2025 -0300

    net_sched: qfq: Fix double list add in class with netem as child qdisc
    
    [ Upstream commit f139f37dcdf34b67f5bf92bc8e0f7f6b3ac63aa4 ]
    
    As described in Gerrard's report [1], there are use cases where a netem
    child qdisc will make the parent qdisc's enqueue callback reentrant.
    In the case of qfq, there won't be a UAF, but the code will add the same
    classifier to the list twice, which will cause memory corruption.
    
    This patch checks whether the class was already added to the agg->active
    list (cl_is_active) before doing the addition to cater for the reentrant
    case.
    
    [1] https://lore.kernel.org/netdev/CAHcdcOm+03OD2j6R0=YHKqmy=VgJ8xEOKuP6c7mSgnp-TEJJbw@mail.gmail.com/
    
    Fixes: 37d9cf1a3ce3 ("sched: Fix detection of empty queues in child qdiscs")
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20250425220710.3964791-5-victor@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-pci: fix queue unquiesce check on slot_reset [+ + +]
Author: Keith Busch <kbusch@kernel.org>
Date:   Thu Apr 24 10:18:01 2025 -0700

    nvme-pci: fix queue unquiesce check on slot_reset
    
    [ Upstream commit a75401227eeb827b1a162df1aa9d5b33da921c43 ]
    
    A zero return means the reset was successfully scheduled. We don't want
    to unquiesce the queues while the reset_work is pending, as that will
    just flush out requeued requests to a failed completion.
    
    Fixes: 71a5bb153be104 ("nvme: ensure disabling pairs with unquiesce")
    Reported-by: Dhankaran Singh Ajravat <dhankaran@meta.com>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-tcp: fix premature queue removal and I/O failover [+ + +]
Author: Michael Liang <mliang@purestorage.com>
Date:   Tue Apr 29 10:42:01 2025 -0600

    nvme-tcp: fix premature queue removal and I/O failover
    
    [ Upstream commit 77e40bbce93059658aee02786a32c5c98a240a8a ]
    
    This patch addresses a data corruption issue observed in nvme-tcp during
    testing.
    
    In an NVMe native multipath setup, when an I/O timeout occurs, all
    inflight I/Os are canceled almost immediately after the kernel socket is
    shut down. These canceled I/Os are reported as host path errors,
    triggering a failover that succeeds on a different path.
    
    However, at this point, the original I/O may still be outstanding in the
    host's network transmission path (e.g., the NIC’s TX queue). From the
    user-space app's perspective, the buffer associated with the I/O is
    considered completed since they're acked on the different path and may
    be reused for new I/O requests.
    
    Because nvme-tcp enables zero-copy by default in the transmission path,
    this can lead to corrupted data being sent to the original target,
    ultimately causing data corruption.
    
    We can reproduce this data corruption by injecting delay on one path and
    triggering i/o timeout.
    
    To prevent this issue, this change ensures that all inflight
    transmissions are fully completed from host's perspective before
    returning from queue stop. To handle concurrent I/O timeout from multiple
    namespaces under the same controller, always wait in queue stop
    regardless of queue's state.
    
    This aligns with the behavior of queue stopping in other NVMe fabric
    transports.
    
    Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
    Signed-off-by: Michael Liang <mliang@purestorage.com>
    Reviewed-by: Mohamed Khalfella <mkhalfella@purestorage.com>
    Reviewed-by: Randy Jennings <randyj@purestorage.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeon_ep: Fix host hang issue during device reboot [+ + +]
Author: Sathesh B Edara <sedara@marvell.com>
Date:   Tue Apr 29 04:46:24 2025 -0700

    octeon_ep: Fix host hang issue during device reboot
    
    [ Upstream commit 34f42736b325287a7b2ce37e415838f539767bda ]
    
    When the host loses heartbeat messages from the device,
    the driver calls the device-specific ndo_stop function,
    which frees the resources. If the driver is unloaded in
    this scenario, it calls ndo_stop again, attempting to free
    resources that have already been freed, leading to a host
    hang issue. To resolve this, dev_close should be called
    instead of the device-specific stop function.dev_close
    internally calls ndo_stop to stop the network interface
    and performs additional cleanup tasks. During the driver
    unload process, if the device is already down, ndo_stop
    is not called.
    
    Fixes: 5cb96c29aa0e ("octeon_ep: add heartbeat monitor")
    Signed-off-by: Sathesh B Edara <sedara@marvell.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250429114624.19104-1-sedara@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
parisc: Fix double SIGFPE crash [+ + +]
Author: Helge Deller <deller@gmx.de>
Date:   Sat May 3 18:24:01 2025 +0200

    parisc: Fix double SIGFPE crash
    
    commit de3629baf5a33af1919dec7136d643b0662e85ef upstream.
    
    Camm noticed that on parisc a SIGFPE exception will crash an application with
    a second SIGFPE in the signal handler.  Dave analyzed it, and it happens
    because glibc uses a double-word floating-point store to atomically update
    function descriptors. As a result of lazy binding, we hit a floating-point
    store in fpe_func almost immediately.
    
    When the T bit is set, an assist exception trap occurs when when the
    co-processor encounters *any* floating-point instruction except for a double
    store of register %fr0.  The latter cancels all pending traps.  Let's fix this
    by clearing the Trap (T) bit in the FP status register before returning to the
    signal handler in userspace.
    
    The issue can be reproduced with this test program:
    
    root@parisc:~# cat fpe.c
    
    static void fpe_func(int sig, siginfo_t *i, void *v) {
            sigset_t set;
            sigemptyset(&set);
            sigaddset(&set, SIGFPE);
            sigprocmask(SIG_UNBLOCK, &set, NULL);
            printf("GOT signal %d with si_code %ld\n", sig, i->si_code);
    }
    
    int main() {
            struct sigaction action = {
                    .sa_sigaction = fpe_func,
                    .sa_flags = SA_RESTART|SA_SIGINFO };
            sigaction(SIGFPE, &action, 0);
            feenableexcept(FE_OVERFLOW);
            return printf("%lf\n",1.7976931348623158E308*1.7976931348623158E308);
    }
    
    root@parisc:~# gcc fpe.c -lm
    root@parisc:~# ./a.out
     Floating point exception
    
    root@parisc:~# strace -f ./a.out
     execve("./a.out", ["./a.out"], 0xf9ac7034 /* 20 vars */) = 0
     getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
     ...
     rt_sigaction(SIGFPE, {sa_handler=0x1110a, sa_mask=[], sa_flags=SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
     --- SIGFPE {si_signo=SIGFPE, si_code=FPE_FLTOVF, si_addr=0x1078f} ---
     --- SIGFPE {si_signo=SIGFPE, si_code=FPE_FLTOVF, si_addr=0xf8f21237} ---
     +++ killed by SIGFPE +++
     Floating point exception
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Suggested-by: John David Anglin <dave.anglin@bell.net>
    Reported-by: Camm Maguire <camm@maguirefamily.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI: imx6: Skip controller_id generation logic for i.MX7D [+ + +]
Author: Richard Zhu <hongxing.zhu@nxp.com>
Date:   Sun May 4 15:13:56 2025 -0400

    PCI: imx6: Skip controller_id generation logic for i.MX7D
    
    [ Upstream commit f068ffdd034c93f0c768acdc87d4d2d7023c1379 ]
    
    The i.MX7D only has one PCIe controller, so controller_id should always be
    0. The previous code is incorrect although yielding the correct result.
    
    Fix by removing "IMX7D" from the switch case branch.
    
    Fixes: 2d8ed461dbc9 ("PCI: imx6: Add support for i.MX8MQ")
    Link: https://lore.kernel.org/r/20241126075702.4099164-5-hongxing.zhu@nxp.com
    Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    [Because this switch case does more than just controller_id
     logic, move the "IMX7D" case label instead of removing it entirely.]
    Signed-off-by: Ryan Matthews <ryanmatthews@fastmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pds_core: check health in devcmd wait [+ + +]
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Thu Sep 14 15:31:57 2023 -0700

    pds_core: check health in devcmd wait
    
    [ Upstream commit f7b5bd725b737de3f2c4a836e07c82ba156d75df ]
    
    Similar to what we do in the AdminQ, check for devcmd health
    while waiting for an answer.
    
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Reviewed-by: Brett Creeley <brett.creeley@amd.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: dfd76010f8e8 ("pds_core: remove write-after-free of client_id")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pds_core: delete VF dev on reset [+ + +]
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Fri Feb 16 14:29:51 2024 -0800

    pds_core: delete VF dev on reset
    
    [ Upstream commit 2dac60e062340c1e5c975ad6465192d11c40d47a ]
    
    When the VF is hit with a reset, remove the aux device in
    the prepare for reset and try to restore it after the reset.
    The userland mechanics will need to recover and rebuild whatever
    uses the device afterwards.
    
    Reviewed-by: Brett Creeley <brett.creeley@amd.com>
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: dfd76010f8e8 ("pds_core: remove write-after-free of client_id")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pds_core: make pdsc_auxbus_dev_del() void [+ + +]
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Thu Mar 20 12:44:07 2025 -0700

    pds_core: make pdsc_auxbus_dev_del() void
    
    [ Upstream commit e8562da829432d04a0de1830146984c89844f35e ]
    
    Since there really is no useful return, advertising a return value
    is rather misleading.  Make pdsc_auxbus_dev_del() a void function.
    
    Link: https://patch.msgid.link/r/20250320194412.67983-2-shannon.nelson@amd.com
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Stable-dep-of: dfd76010f8e8 ("pds_core: remove write-after-free of client_id")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pds_core: remove write-after-free of client_id [+ + +]
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Fri Apr 25 13:38:57 2025 -0700

    pds_core: remove write-after-free of client_id
    
    [ Upstream commit dfd76010f8e821b66116dec3c7d90dd2403d1396 ]
    
    A use-after-free error popped up in stress testing:
    
    [Mon Apr 21 21:21:33 2025] BUG: KFENCE: use-after-free write in pdsc_auxbus_dev_del+0xef/0x160 [pds_core]
    [Mon Apr 21 21:21:33 2025] Use-after-free write at 0x000000007013ecd1 (in kfence-#47):
    [Mon Apr 21 21:21:33 2025]  pdsc_auxbus_dev_del+0xef/0x160 [pds_core]
    [Mon Apr 21 21:21:33 2025]  pdsc_remove+0xc0/0x1b0 [pds_core]
    [Mon Apr 21 21:21:33 2025]  pci_device_remove+0x24/0x70
    [Mon Apr 21 21:21:33 2025]  device_release_driver_internal+0x11f/0x180
    [Mon Apr 21 21:21:33 2025]  driver_detach+0x45/0x80
    [Mon Apr 21 21:21:33 2025]  bus_remove_driver+0x83/0xe0
    [Mon Apr 21 21:21:33 2025]  pci_unregister_driver+0x1a/0x80
    
    The actual device uninit usually happens on a separate thread
    scheduled after this code runs, but there is no guarantee of order
    of thread execution, so this could be a problem.  There's no
    actual need to clear the client_id at this point, so simply
    remove the offending code.
    
    Fixes: 10659034c622 ("pds_core: add the aux client API")
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250425203857.71547-1-shannon.nelson@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pds_core: specify auxiliary_device to be created [+ + +]
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Thu Mar 20 12:44:08 2025 -0700

    pds_core: specify auxiliary_device to be created
    
    [ Upstream commit b699bdc720c0255d1bb76cecba7382c1f2107af5 ]
    
    In preparation for adding a new auxiliary_device for the PF,
    make the vif type an argument to pdsc_auxbus_dev_add().  Pass in
    the address of the padev pointer so that the caller can specify
    where to save it and keep the mutex usage within the function.
    
    Link: https://patch.msgid.link/r/20250320194412.67983-3-shannon.nelson@amd.com
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Stable-dep-of: dfd76010f8e8 ("pds_core: remove write-after-free of client_id")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/x86/intel: KVM: Mask PEBS_ENABLE loaded for guest with vCPU's value. [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Apr 25 17:13:55 2025 -0700

    perf/x86/intel: KVM: Mask PEBS_ENABLE loaded for guest with vCPU's value.
    
    commit 58f6217e5d0132a9f14e401e62796916aa055c1b upstream.
    
    When generating the MSR_IA32_PEBS_ENABLE value that will be loaded on
    VM-Entry to a KVM guest, mask the value with the vCPU's desired PEBS_ENABLE
    value.  Consulting only the host kernel's host vs. guest masks results in
    running the guest with PEBS enabled even when the guest doesn't want to use
    PEBS.  Because KVM uses perf events to proxy the guest virtual PMU, simply
    looking at exclude_host can't differentiate between events created by host
    userspace, and events created by KVM on behalf of the guest.
    
    Running the guest with PEBS unexpectedly enabled typically manifests as
    crashes due to a near-infinite stream of #PFs.  E.g. if the guest hasn't
    written MSR_IA32_DS_AREA, the CPU will hit page faults on address '0' when
    trying to record PEBS events.
    
    The issue is most easily reproduced by running `perf kvm top` from before
    commit 7b100989b4f6 ("perf evlist: Remove __evlist__add_default") (after
    which, `perf kvm top` effectively stopped using PEBS).  The userspace side
    of perf creates a guest-only PEBS event, which intel_guest_get_msrs()
    misconstrues a guest-*owned* PEBS event.
    
    Arguably, this is a userspace bug, as enabling PEBS on guest-only events
    simply cannot work, and userspace can kill VMs in many other ways (there
    is no danger to the host).  However, even if this is considered to be bad
    userspace behavior, there's zero downside to perf/KVM restricting PEBS to
    guest-owned events.
    
    Note, commit 854250329c02 ("KVM: x86/pmu: Disable guest PEBS temporarily
    in two rare situations") fixed the case where host userspace is profiling
    KVM *and* userspace, but missed the case where userspace is profiling only
    KVM.
    
    Fixes: c59a1f106f5c ("KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS")
    Closes: https://lore.kernel.org/all/Z_VUswFkWiTYI0eD@do-x1carbon
    Reported-by: Seth Forshee <sforshee@kernel.org>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
    Tested-by: "Seth Forshee (DigitalOcean)" <sforshee@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250426001355.1026530-1-seanjc@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Mon Apr 14 11:24:00 2025 -0500

    platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles
    
    commit 9f5595d5f03fd4dc640607a71e89a1daa68fd19d upstream.
    
    When an APU exits HW sleep with no active wake sources the Linux kernel will
    rapidly assert that the APU can enter back into HW sleep. This happens in a
    few ms. Contrasting this to Windows, Windows can take 10s of seconds to
    enter back into the resiliency phase for Modern Standby.
    
    For some situations this can be problematic because it can cause leakage
    from VDDCR_SOC to VDD_MISC and force VDD_MISC outside of the electrical
    design guide specifications. On some designs this will trip the over
    voltage protection feature (OVP) of the voltage regulator module, but it
    could cause APU damage as well.
    
    To prevent this risk, add an explicit sleep call so that future attempts
    to enter into HW sleep will have enough time to settle. This will occur
    while the screen is dark and only on cases that the APU should enter HW
    sleep again, so it shouldn't be noticeable to any user.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    Link: https://lore.kernel.org/r/20250414162446.3853194-1-superm1@kernel.org
    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>

 
platform/x86/intel-uncore-freq: Fix missing uncore sysfs during CPU hotplug [+ + +]
Author: Shouye Liu <shouyeliu@tencent.com>
Date:   Thu Apr 17 11:23:21 2025 +0800

    platform/x86/intel-uncore-freq: Fix missing uncore sysfs during CPU hotplug
    
    commit 8d6955ed76e8a47115f2ea1d9c263ee6f505d737 upstream.
    
    In certain situations, the sysfs for uncore may not be present when all
    CPUs in a package are offlined and then brought back online after boot.
    
    This issue can occur if there is an error in adding the sysfs entry due
    to a memory allocation failure. Retrying to bring the CPUs online will
    not resolve the issue, as the uncore_cpu_mask is already set for the
    package before the failure condition occurs.
    
    This issue does not occur if the failure happens during module
    initialization, as the module will fail to load in the event of any
    error.
    
    To address this, ensure that the uncore_cpu_mask is not set until the
    successful return of uncore_freq_add_entry().
    
    Fixes: dbce412a7733 ("platform/x86/intel-uncore-freq: Split common and enumeration part")
    Signed-off-by: Shouye Liu <shouyeliu@tencent.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250417032321.75580-1-shouyeliu@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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
powerpc/boot: Check for ld-option support [+ + +]
Author: Madhavan Srinivasan <maddy@linux.ibm.com>
Date:   Tue Apr 1 06:12:18 2025 +0530

    powerpc/boot: Check for ld-option support
    
    [ Upstream commit b2accfe7ca5bc9f9af28e603b79bdd5ad8df5c0b ]
    
    Commit 579aee9fc594 ("powerpc: suppress some linker warnings in recent linker versions")
    enabled support to add linker option "--no-warn-rwx-segments",
    if the version is greater than 2.39. Similar build warning were
    reported recently from linker version 2.35.2.
    
    ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
    ld: warning: arch/powerpc/boot/zImage.pseries has a LOAD segment with RWX permissions
    
    Fix the warning by checking for "--no-warn-rwx-segments"
    option support in linker to enable it, instead of checking
    for the version range.
    
    Fixes: 579aee9fc594 ("powerpc: suppress some linker warnings in recent linker versions")
    Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
    Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
    Closes: https://lore.kernel.org/linuxppc-dev/61cf556c-4947-4bd6-af63-892fc0966dad@linux.ibm.com/
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250401004218.24869-1-maddy@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

powerpc/boot: Fix dash warning [+ + +]
Author: Madhavan Srinivasan <maddy@linux.ibm.com>
Date:   Wed Apr 23 13:51:54 2025 +0530

    powerpc/boot: Fix dash warning
    
    [ Upstream commit e3f506b78d921e48a00d005bea5c45ec36a99240 ]
    
    'commit b2accfe7ca5b ("powerpc/boot: Check for ld-option support")' suppressed
    linker warnings, but the expressed used did not go well with POSIX shell (dash)
    resulting with this warning
    
    arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
    ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
    
    Fix the check to handle the reported warning. Patch also fixes
    couple of shellcheck reported errors for the same line.
    
    In arch/powerpc/boot/wrapper line 237:
    if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
         ^-- SC2046 (warning): Quote this to prevent word splitting.
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                ^---------^ SC3020 (warning): In POSIX sh, &> is undefined.
    
    Fixes: b2accfe7ca5b ("powerpc/boot: Check for ld-option support")
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
    Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250423082154.30625-1-maddy@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "drm/meson: vclk: fix calculation of 59.94 fractional rates" [+ + +]
Author: Christian Hewitt <christianshewitt@gmail.com>
Date:   Mon Apr 21 22:12:59 2025 +0200

    Revert "drm/meson: vclk: fix calculation of 59.94 fractional rates"
    
    [ Upstream commit f37bb5486ea536c1d61df89feeaeff3f84f0b560 ]
    
    This reverts commit bfbc68e.
    
    The patch does permit the offending YUV420 @ 59.94 phy_freq and
    vclk_freq mode to match in calculations. It also results in all
    fractional rates being unavailable for use. This was unintended
    and requires the patch to be reverted.
    
    Fixes: bfbc68e4d869 ("drm/meson: vclk: fix calculation of 59.94 fractional rates")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://lore.kernel.org/r/20250421201300.778955-2-martin.blumenstingl@googlemail.com
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://lore.kernel.org/r/20250421201300.778955-2-martin.blumenstingl@googlemail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "PCI: imx6: Skip controller_id generation logic for i.MX7D" [+ + +]
Author: Ryan Matthews <ryanmatthews@fastmail.com>
Date:   Sun May 4 15:13:55 2025 -0400

    Revert "PCI: imx6: Skip controller_id generation logic for i.MX7D"
    
    This reverts commit 2a12efc567a270a155e3b886258297abd79cdea0 which is
    commit f068ffdd034c93f0c768acdc87d4d2d7023c1379 upstream.
    
    This is a backport mistake.
    
    Deleting "IMX7D" here skips more than just controller_id logic. It skips
    reset assignments too, which causes:
    
     imx6q-pcie 33800000.pcie: PCIe PLL lock timeout
    
    In my case, in addition to broken PCIe, kernel boot hangs entirely.
    
    This isn't a problem upstream because before this, they moved the rest of
    the code out of the switch case.
    
    Signed-off-by: Ryan Matthews <ryanmatthews@fastmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "rndis_host: Flag RNDIS modems as WWAN devices" [+ + +]
Author: Christian Heusel <christian@heusel.eu>
Date:   Thu Apr 24 16:00:28 2025 +0200

    Revert "rndis_host: Flag RNDIS modems as WWAN devices"
    
    commit 765f253e28909f161b0211f85cf0431cfee7d6df upstream.
    
    This reverts commit 67d1a8956d2d62fe6b4c13ebabb57806098511d8. Since this
    commit has been proven to be problematic for the setup of USB-tethered
    ethernet connections and the related breakage is very noticeable for
    users it should be reverted until a fixed version of the change can be
    rolled out.
    
    Closes: https://lore.kernel.org/all/e0df2d85-1296-4317-b717-bd757e3ab928@heusel.eu/
    Link: https://chaos.social/@gromit/114377862699921553
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=220002
    Link: https://bugs.gentoo.org/953555
    Link: https://bbs.archlinux.org/viewtopic.php?id=304892
    Cc: stable@vger.kernel.org
    Acked-by: Lubomir Rintel <lkundrak@v3.sk>
    Signed-off-by: Christian Heusel <christian@heusel.eu>
    Link: https://patch.msgid.link/20250424-usb-tethering-fix-v1-1-b65cf97c740e@heusel.eu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
riscv: Pass patch_text() the length in bytes [+ + +]
Author: Samuel Holland <samuel.holland@sifive.com>
Date:   Wed Mar 27 09:04:44 2024 -0700

    riscv: Pass patch_text() the length in bytes
    
    commit 51781ce8f4486c3738a6c85175b599ad1be71f89 upstream.
    
    patch_text_nosync() already handles an arbitrary length of code, so this
    removes a superfluous loop and reduces the number of icache flushes.
    
    Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
    Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Link: https://lore.kernel.org/r/20240327160520.791322-6-samuel.holland@sifive.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    [apply to v6.6]
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_drr: make drr_qlen_notify() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Thu Apr 3 14:10:24 2025 -0700

    sch_drr: make drr_qlen_notify() idempotent
    
    commit df008598b3a00be02a8051fde89ca0fbc416bd55 upstream.
    
    drr_qlen_notify() always deletes the DRR class from its active list
    with list_del(), therefore, it is not idempotent and not friendly
    to its callers, like fq_codel_dequeue().
    
    Let's make it idempotent to ease qdisc_tree_reduce_backlog() callers'
    life. Also change other list_del()'s to list_del_init() just to be
    extra safe.
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250403211033.166059-3-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_ets: make est_qlen_notify() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Thu Apr 3 14:10:27 2025 -0700

    sch_ets: make est_qlen_notify() idempotent
    
    commit a7a15f39c682ac4268624da2abdb9114bdde96d5 upstream.
    
    est_qlen_notify() deletes its class from its active list with
    list_del() when qlen is 0, therefore, it is not idempotent and
    not friendly to its callers, like fq_codel_dequeue().
    
    Let's make it idempotent to ease qdisc_tree_reduce_backlog() callers'
    life. Also change other list_del()'s to list_del_init() just to be
    extra safe.
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Link: https://patch.msgid.link/20250403211033.166059-6-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_hfsc: make hfsc_qlen_notify() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Thu Apr 3 14:10:25 2025 -0700

    sch_hfsc: make hfsc_qlen_notify() idempotent
    
    commit 51eb3b65544c9efd6a1026889ee5fb5aa62da3bb upstream.
    
    hfsc_qlen_notify() is not idempotent either and not friendly
    to its callers, like fq_codel_dequeue(). Let's make it idempotent
    to ease qdisc_tree_reduce_backlog() callers' life:
    
    1. update_vf() decreases cl->cl_nactive, so we can check whether it is
    non-zero before calling it.
    
    2. eltree_remove() always removes RB node cl->el_node, but we can use
       RB_EMPTY_NODE() + RB_CLEAR_NODE() to make it safe.
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250403211033.166059-4-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_htb: make htb_qlen_notify() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Thu Apr 3 14:10:23 2025 -0700

    sch_htb: make htb_qlen_notify() idempotent
    
    commit 5ba8b837b522d7051ef81bacf3d95383ff8edce5 upstream.
    
    htb_qlen_notify() always deactivates the HTB class and in fact could
    trigger a warning if it is already deactivated. Therefore, it is not
    idempotent and not friendly to its callers, like fq_codel_dequeue().
    
    Let's make it idempotent to ease qdisc_tree_reduce_backlog() callers'
    life.
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250403211033.166059-2-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_qfq: make qfq_qlen_notify() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Thu Apr 3 14:10:26 2025 -0700

    sch_qfq: make qfq_qlen_notify() idempotent
    
    commit 55f9eca4bfe30a15d8656f915922e8c98b7f0728 upstream.
    
    qfq_qlen_notify() always deletes its class from its active list
    with list_del_init() _and_ calls qfq_deactivate_agg() when the whole list
    becomes empty.
    
    To make it idempotent, just skip everything when it is not in the active
    list.
    
    Also change other list_del()'s to list_del_init() just to be extra safe.
    
    Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250403211033.166059-5-xiyou.wangcong@gmail.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/bpf: extend changes_pkt_data with cases w/o subprograms [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:52 2025 +0800

    selftests/bpf: extend changes_pkt_data with cases w/o subprograms
    
    commit 04789af756a4a43e72986185f66f148e65b32fed upstream.
    
    Extend changes_pkt_data tests with test cases freplacing the main
    program that does not have subprograms. Try four combinations when
    both main program and replacement do and do not change packet data.
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241212070711.427443-2-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/bpf: freplace tests for tracking of changes_packet_data [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:48 2025 +0800

    selftests/bpf: freplace tests for tracking of changes_packet_data
    
    commit 89ff40890d8f12a7d7e93fb602cc27562f3834f0 upstream.
    
    Try different combinations of global functions replacement:
    - replace function that changes packet data with one that doesn't;
    - replace function that changes packet data with one that does;
    - replace function that doesn't change packet data with one that does;
    - replace function that doesn't change packet data with one that doesn't;
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-7-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/bpf: test for changing packet data from global functions [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:46 2025 +0800

    selftests/bpf: test for changing packet data from global functions
    
    commit 3f23ee5590d9605dbde9a5e1d4b97637a4803329 upstream.
    
    Check if verifier is aware of packet pointers invalidation done in
    global functions. Based on a test shared by Nick Zavaritsky in [0].
    
    [0] https://lore.kernel.org/bpf/0498CA22-5779-4767-9C0C-A9515CEA711F@gmail.com/
    
    Suggested-by: Nick Zavaritsky <mejedi@gmail.com>
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-5-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/bpf: validate that tail call invalidates packet pointers [+ + +]
Author: Eduard Zingerman <eddyz87@gmail.com>
Date:   Wed Apr 30 16:19:50 2025 +0800

    selftests/bpf: validate that tail call invalidates packet pointers
    
    commit d9706b56e13b7916461ca6b4b731e169ed44ed09 upstream.
    
    Add a test case with a tail call done from a global sub-program. Such
    tails calls should be considered as invalidating packet pointers.
    
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20241210041100.1898468-9-eddyz87@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb: client: fix zero length for mkdir POSIX create context [+ + +]
Author: Jethro Donaldson <devel@jro.nz>
Date:   Wed Apr 30 00:59:15 2025 +1200

    smb: client: fix zero length for mkdir POSIX create context
    
    commit 74c72419ec8da5cbc9c49410d3c44bb954538bdd upstream.
    
    SMB create requests issued via smb311_posix_mkdir() have an incorrect
    length of zero bytes for the POSIX create context data. ksmbd server
    rejects such requests and logs "cli req too short" causing mkdir to fail
    with "invalid argument" on the client side.  It also causes subsequent
    rmmod to crash in cifs_destroy_request_bufs()
    
    Inspection of packets sent by cifs.ko using wireshark show valid data for
    the SMB2_POSIX_CREATE_CONTEXT is appended with the correct offset, but
    with an incorrect length of zero bytes. Fails with ksmbd+cifs.ko only as
    Windows server/client does not use POSIX extensions.
    
    Fix smb311_posix_mkdir() to set req->CreateContextsLength as part of
    appending the POSIX creation context to the request.
    
    Signed-off-by: Jethro Donaldson <devel@jro.nz>
    Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
    Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
spi: tegra114: Don't fail set_cs_timing when delays are zero [+ + +]
Author: Aaron Kling <webgeek1234@gmail.com>
Date:   Wed Apr 23 21:03:03 2025 -0500

    spi: tegra114: Don't fail set_cs_timing when delays are zero
    
    commit 4426e6b4ecf632bb75d973051e1179b8bfac2320 upstream.
    
    The original code would skip null delay pointers, but when the pointers
    were converted to point within the spi_device struct, the check was not
    updated to skip delays of zero. Hence all spi devices that didn't set
    delays would fail to probe.
    
    Fixes: 04e6bb0d6bb1 ("spi: modify set_cs_timing parameter")
    Cc: stable@vger.kernel.org
    Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
    Link: https://patch.msgid.link/20250423-spi-tegra114-v1-1-2d608bcc12f9@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing: Do not take trace_event_sem in print_event_fields() [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Thu May 1 22:41:28 2025 -0400

    tracing: Do not take trace_event_sem in print_event_fields()
    
    commit 0a8f11f8569e7ed16cbcedeb28c4350f6378fea6 upstream.
    
    On some paths in print_event_fields() it takes the trace_event_sem for
    read, even though it should always be held when the function is called.
    
    Remove the taking of that mutex and add a lockdep_assert_held_read() to
    make sure the trace_event_sem is held when print_event_fields() is called.
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Link: https://lore.kernel.org/20250501224128.0b1f0571@batman.local.home
    Fixes: 80a76994b2d88 ("tracing: Add "fields" option to show raw trace event fields")
    Reported-by: syzbot+441582c1592938fccf09@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/6813ff5e.050a0220.14dd7d.001b.GAE@google.com/
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tracing: Fix oob write in trace_seq_to_buffer() [+ + +]
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Tue Apr 22 20:30:25 2025 +0900

    tracing: Fix oob write in trace_seq_to_buffer()
    
    commit f5178c41bb43444a6008150fe6094497135d07cb upstream.
    
    syzbot reported this bug:
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in trace_seq_to_buffer kernel/trace/trace.c:1830 [inline]
    BUG: KASAN: slab-out-of-bounds in tracing_splice_read_pipe+0x6be/0xdd0 kernel/trace/trace.c:6822
    Write of size 4507 at addr ffff888032b6b000 by task syz.2.320/7260
    
    CPU: 1 UID: 0 PID: 7260 Comm: syz.2.320 Not tainted 6.15.0-rc1-syzkaller-00301-g3bde70a2c827 #0 PREEMPT(full)
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:408 [inline]
     print_report+0xc3/0x670 mm/kasan/report.c:521
     kasan_report+0xe0/0x110 mm/kasan/report.c:634
     check_region_inline mm/kasan/generic.c:183 [inline]
     kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
     __asan_memcpy+0x3c/0x60 mm/kasan/shadow.c:106
     trace_seq_to_buffer kernel/trace/trace.c:1830 [inline]
     tracing_splice_read_pipe+0x6be/0xdd0 kernel/trace/trace.c:6822
     ....
    ==================================================================
    
    It has been reported that trace_seq_to_buffer() tries to copy more data
    than PAGE_SIZE to buf. Therefore, to prevent this, we should use the
    smaller of trace_seq_used(&iter->seq) and PAGE_SIZE as an argument.
    
    Link: https://lore.kernel.org/20250422113026.13308-1-aha310510@gmail.com
    Reported-by: syzbot+c8cd2d2c412b868263fb@syzkaller.appspotmail.com
    Fixes: 3c56819b14b0 ("tracing: splice support for tracing_pipe")
    Suggested-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: xhci: Check for xhci->interrupters being allocated in xhci_mem_clearup() [+ + +]
Author: Marc Zyngier <maz@kernel.org>
Date:   Fri Aug 9 15:44:07 2024 +0300

    usb: xhci: Check for xhci->interrupters being allocated in xhci_mem_clearup()
    
    commit dcdb52d948f3a17ccd3fce757d9bd981d7c32039 upstream.
    
    If xhci_mem_init() fails, it calls into xhci_mem_cleanup() to mop
    up the damage. If it fails early enough, before xhci->interrupters
    is allocated but after xhci->max_interrupters has been set, which
    happens in most (all?) cases, things get uglier, as xhci_mem_cleanup()
    unconditionally derefences xhci->interrupters. With prejudice.
    
    Gate the interrupt freeing loop with a check on xhci->interrupters
    being non-NULL.
    
    Found while debugging a DMA allocation issue that led the XHCI driver
    on this exact path.
    
    Fixes: c99b38c41234 ("xhci: add support to allocate several interrupters")
    Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
    Cc: Wesley Cheng <quic_wcheng@quicinc.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Cc: stable@vger.kernel.org # 6.8+
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20240809124408.505786-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: xhci: check if 'requested segments' exceeds ERST capacity [+ + +]
Author: Niklas Neronin <niklas.neronin@linux.intel.com>
Date:   Mon Apr 29 17:02:30 2024 +0300

    usb: xhci: check if 'requested segments' exceeds ERST capacity
    
    [ Upstream commit db4460b6ecf07574d580f01cd88054a62607068c ]
    
    Check if requested segments ('segs' or 'ERST_DEFAULT_SEGS') exceeds the
    maximum amount ERST supports.
    
    When 'segs' is '0', 'ERST_DEFAULT_SEGS' is used instead. But both values
    may not exceed ERST max.
    
    Macro 'ERST_MAX_SEGS' is renamed to 'ERST_DEFAULT_SEGS'. The new name
    better represents the macros, which is the number of Event Ring segments
    to allocate, when the amount is not specified.
    
    Additionally, rename and change xhci_create_secondary_interrupter()'s
    argument 'int num_segs' to 'unsigned int segs'. This makes it the same
    as its counter part in xhci_alloc_interrupter().
    
    Fixes: c99b38c41234 ("xhci: add support to allocate several interrupters")
    Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20240429140245.3955523-4-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vxlan: vnifilter: Fix unlocked deletion of default FDB entry [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Wed Apr 23 17:51:31 2025 +0300

    vxlan: vnifilter: Fix unlocked deletion of default FDB entry
    
    [ Upstream commit 087a9eb9e5978e3ba362e1163691e41097e8ca20 ]
    
    When a VNI is deleted from a VXLAN device in 'vnifilter' mode, the FDB
    entry associated with the default remote (assuming one was configured)
    is deleted without holding the hash lock. This is wrong and will result
    in a warning [1] being generated by the lockdep annotation that was
    added by commit ebe642067455 ("vxlan: Create wrappers for FDB lookup").
    
    Reproducer:
    
     # ip link add vx0 up type vxlan dstport 4789 external vnifilter local 192.0.2.1
     # bridge vni add vni 10010 remote 198.51.100.1 dev vx0
     # bridge vni del vni 10010 dev vx0
    
    Fix by acquiring the hash lock before the deletion and releasing it
    afterwards. Blame the original commit that introduced the issue rather
    than the one that exposed it.
    
    [1]
    WARNING: CPU: 3 PID: 392 at drivers/net/vxlan/vxlan_core.c:417 vxlan_find_mac+0x17f/0x1a0
    [...]
    RIP: 0010:vxlan_find_mac+0x17f/0x1a0
    [...]
    Call Trace:
     <TASK>
     __vxlan_fdb_delete+0xbe/0x560
     vxlan_vni_delete_group+0x2ba/0x940
     vxlan_vni_del.isra.0+0x15f/0x580
     vxlan_process_vni_filter+0x38b/0x7b0
     vxlan_vnifilter_process+0x3bb/0x510
     rtnetlink_rcv_msg+0x2f7/0xb70
     netlink_rcv_skb+0x131/0x360
     netlink_unicast+0x426/0x710
     netlink_sendmsg+0x75a/0xc20
     __sock_sendmsg+0xc1/0x150
     ____sys_sendmsg+0x5aa/0x7b0
     ___sys_sendmsg+0xfc/0x180
     __sys_sendmsg+0x121/0x1b0
     do_syscall_64+0xbb/0x1d0
     entry_SYSCALL_64_after_hwframe+0x4b/0x53
    
    Fixes: f9c4bb0b245c ("vxlan: vni filtering support on collect metadata device")
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/20250423145131.513029-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: brcm80211: fmac: Add error handling for brcmf_usb_dl_writeimage() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Tue Apr 22 12:22:02 2025 +0800

    wifi: brcm80211: fmac: Add error handling for brcmf_usb_dl_writeimage()
    
    commit 8e089e7b585d95122c8122d732d1d5ef8f879396 upstream.
    
    The function brcmf_usb_dl_writeimage() calls the function
    brcmf_usb_dl_cmd() but dose not check its return value. The
    'state.state' and the 'state.bytes' are uninitialized if the
    function brcmf_usb_dl_cmd() fails. It is dangerous to use
    uninitialized variables in the conditions.
    
    Add error handling for brcmf_usb_dl_cmd() to jump to error
    handling path if the brcmf_usb_dl_cmd() fails and the
    'state.state' and the 'state.bytes' are uninitialized.
    
    Improve the error message to report more detailed error
    information.
    
    Fixes: 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")
    Cc: stable@vger.kernel.org # v3.4+
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Link: https://patch.msgid.link/20250422042203.2259-1-vulab@iscas.ac.cn
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: plfxlc: Remove erroneous assert in plfxlc_mac_release [+ + +]
Author: Murad Masimov <m.masimov@mt-integration.ru>
Date:   Fri Mar 21 21:52:25 2025 +0300

    wifi: plfxlc: Remove erroneous assert in plfxlc_mac_release
    
    [ Upstream commit 0fb15ae3b0a9221be01715dac0335647c79f3362 ]
    
    plfxlc_mac_release() asserts that mac->lock is held. This assertion is
    incorrect, because even if it was possible, it would not be the valid
    behaviour. The function is used when probe fails or after the device is
    disconnected. In both cases mac->lock can not be held as the driver is
    not working with the device at the moment. All functions that use mac->lock
    unlock it just after it was held. There is also no need to hold mac->lock
    for plfxlc_mac_release() itself, as mac data is not affected, except for
    mac->flags, which is modified atomically.
    
    This bug leads to the following warning:
    ================================================================
    WARNING: CPU: 0 PID: 127 at drivers/net/wireless/purelifi/plfxlc/mac.c:106 plfxlc_mac_release+0x7d/0xa0
    Modules linked in:
    CPU: 0 PID: 127 Comm: kworker/0:2 Not tainted 6.1.124-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
    Workqueue: usb_hub_wq hub_event
    RIP: 0010:plfxlc_mac_release+0x7d/0xa0 drivers/net/wireless/purelifi/plfxlc/mac.c:106
    Call Trace:
     <TASK>
     probe+0x941/0xbd0 drivers/net/wireless/purelifi/plfxlc/usb.c:694
     usb_probe_interface+0x5c0/0xaf0 drivers/usb/core/driver.c:396
     really_probe+0x2ab/0xcb0 drivers/base/dd.c:639
     __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785
     driver_probe_device+0x50/0x420 drivers/base/dd.c:815
     __device_attach_driver+0x2cf/0x510 drivers/base/dd.c:943
     bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
     __device_attach+0x359/0x570 drivers/base/dd.c:1015
     bus_probe_device+0xba/0x1e0 drivers/base/bus.c:489
     device_add+0xb48/0xfd0 drivers/base/core.c:3696
     usb_set_configuration+0x19dd/0x2020 drivers/usb/core/message.c:2165
     usb_generic_driver_probe+0x84/0x140 drivers/usb/core/generic.c:238
     usb_probe_device+0x130/0x260 drivers/usb/core/driver.c:293
     really_probe+0x2ab/0xcb0 drivers/base/dd.c:639
     __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785
     driver_probe_device+0x50/0x420 drivers/base/dd.c:815
     __device_attach_driver+0x2cf/0x510 drivers/base/dd.c:943
     bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
     __device_attach+0x359/0x570 drivers/base/dd.c:1015
     bus_probe_device+0xba/0x1e0 drivers/base/bus.c:489
     device_add+0xb48/0xfd0 drivers/base/core.c:3696
     usb_new_device+0xbdd/0x18f0 drivers/usb/core/hub.c:2620
     hub_port_connect drivers/usb/core/hub.c:5477 [inline]
     hub_port_connect_change drivers/usb/core/hub.c:5617 [inline]
     port_event drivers/usb/core/hub.c:5773 [inline]
     hub_event+0x2efe/0x5730 drivers/usb/core/hub.c:5855
     process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
     worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
     kthread+0x28d/0x320 kernel/kthread.c:376
     ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
     </TASK>
    ================================================================
    
    Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
    
    Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices")
    Reported-by: syzbot+7d4f142f6c288de8abfe@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=7d4f142f6c288de8abfe
    Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
    Link: https://patch.msgid.link/20250321185226.71-2-m.masimov@mt-integration.ru
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xhci: Add helper to set an interrupters interrupt moderation interval [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Feb 16 16:09:28 2024 -0800

    xhci: Add helper to set an interrupters interrupt moderation interval
    
    [ Upstream commit ace21625878f78708b75b7a872ec7a0e2ed15ca4 ]
    
    Add a helper to set the interrupt moderation interval for an interrupter.
    Each interrupter can have its own moderation value.
    
    Hardware has a 16bit register for the moderation value, each step is 250ns.
    
    Helper function imod_interval argument is in nanoseconds.
    
    Values from 0 to 16383750 (250 x 0xffff) are accepted.
    0 means no interrupt throttling.
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20240217001017.29969-3-quic_wcheng@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: add support to allocate several interrupters [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Tue Jan 2 13:45:09 2024 -0800

    xhci: add support to allocate several interrupters
    
    [ Upstream commit c99b38c412343053e9af187e595793c8805bb9b8 ]
    
    Modify the XHCI drivers to accommodate for handling multiple event rings in
    case there are multiple interrupters.  Add the required APIs so clients are
    able to allocate/request for an interrupter ring, and pass this information
    back to the client driver.  This allows for users to handle the resource
    accordingly, such as passing the event ring base address to an audio DSP.
    There is no actual support for multiple MSI/MSI-X vectors.
    
    [export xhci_initialize_ring_info() -wcheng]
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20240102214549.22498-2-quic_wcheng@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: Clean up stale comment on ERST_SIZE macro [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Thu Oct 19 13:29:15 2023 +0300

    xhci: Clean up stale comment on ERST_SIZE macro
    
    [ Upstream commit c087fada0a6180ab5b88b11c1776eef02f8d556f ]
    
    Commit ebd88cf50729 ("xhci: Remove unused defines for ERST_SIZE and
    ERST_ENTRIES") removed the ERST_SIZE macro but retained a code comment
    explaining the quantity chosen in the macro.
    
    Remove the code comment as well.
    
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-11-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: fix possible null pointer dereference at secondary interrupter removal [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Jan 25 17:27:34 2024 +0200

    xhci: fix possible null pointer dereference at secondary interrupter removal
    
    commit a54a594d72f25b08f39d743880a76721fba9ae77 upstream.
    
    Don't try to remove a secondary interrupter that is known to be invalid.
    Also check if the interrupter is valid inside the spinlock that protects
    the array of interrupters.
    
    Found by smatch static checker
    
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Closes: https://lore.kernel.org/linux-usb/ffaa0a1b-5984-4a1f-bfd3-9184630a97b9@moroto.mountain/
    Fixes: c99b38c41234 ("xhci: add support to allocate several interrupters")
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20240125152737.2983959-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xhci: Limit time spent with xHC interrupts disabled during bus resume [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Apr 10 18:18:27 2025 +0300

    xhci: Limit time spent with xHC interrupts disabled during bus resume
    
    [ Upstream commit bea5892d0ed274e03655223d1977cf59f9aff2f2 ]
    
    Current xhci bus resume implementation prevents xHC host from generating
    interrupts during high-speed USB 2 and super-speed USB 3 bus resume.
    
    Only reason to disable interrupts during bus resume would be to prevent
    the interrupt handler from interfering with the resume process of USB 2
    ports.
    
    Host initiated resume of USB 2 ports is done in two stages.
    
    The xhci driver first transitions the port from 'U3' to 'Resume' state,
    then wait in Resume for 20ms, and finally moves port to U0 state.
    xhci driver can't prevent interrupts by keeping the xhci spinlock
    due to this 20ms sleep.
    
    Limit interrupt disabling to the USB 2 port resume case only.
    resuming USB 2 ports in bus resume is only done in special cases where
    USB 2 ports had to be forced to suspend during bus suspend.
    
    The current way of preventing interrupts by clearing the 'Interrupt
    Enable' (INTE) bit in USBCMD register won't prevent the Interrupter
    registers 'Interrupt Pending' (IP), 'Event Handler Busy' (EHB) and
    USBSTS register Event Interrupt (EINT) bits from being set.
    
    New interrupts can't be issued before those bits are properly clered.
    
    Disable interrupts by clearing the interrupter register 'Interrupt
    Enable' (IE) bit instead. This way IP, EHB and INTE won't be set
    before IE is enabled again and a new interrupt is triggered.
    
    Reported-by: Devyn Liu <liudingyuan@huawei.com>
    Closes: https://lore.kernel.org/linux-usb/b1a9e2d51b4d4ff7a304f77c5be8164e@huawei.com/
    Cc: stable@vger.kernel.org
    Tested-by: Devyn Liu <liudingyuan@huawei.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250410151828.2868740-6-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: Set DESI bits in ERDP register correctly [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Thu Oct 19 13:29:09 2023 +0300

    xhci: Set DESI bits in ERDP register correctly
    
    [ Upstream commit 044818a6cd808b38a5d179a5fb9940417de4ba24 ]
    
    When using more than one Event Ring segment (ERSTSZ > 1), software shall
    set the DESI bits in the ERDP register to the number of the segment to
    which the upper ERDP bits are pointing.  The xHC may use the DESI bits
    as a shortcut to determine whether it needs to check for an Event Ring
    Full condition:  If it's enqueueing events in a different segment, it
    need not compare its internal Enqueue Pointer with the Dequeue Pointer
    in the upper bits of the ERDP register (sec 5.5.2.3.3).
    
    Not setting the DESI bits correctly can result in the xHC enqueueing
    events past the Dequeue Pointer.  On Renesas uPD720201 host controllers,
    incorrect DESI bits cause an interrupt storm.  For comparison, VIA VL805
    host controllers do not exhibit such problems.  Perhaps they do not take
    advantage of the optimization afforded by the DESI bits.
    
    To fix the issue, assign the segment number to each struct xhci_segment
    in xhci_segment_alloc().  When advancing the Dequeue Pointer in
    xhci_update_erst_dequeue(), write the segment number to the DESI bits.
    
    On driver probe, set the DESI bits to zero in xhci_set_hc_event_deq() as
    processing starts in segment 0.  Likewise on driver teardown, clear the
    DESI bits to zero in xhci_free_interrupter() when clearing the upper
    bits of the ERDP register.  Previously those functions (incorrectly)
    treated the DESI bits as if they're declared RsvdP.
    
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-5-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: split free interrupter into separate remove and free parts [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Oct 19 13:29:21 2023 +0300

    xhci: split free interrupter into separate remove and free parts
    
    [ Upstream commit 47f503cf5f799ec02e5f4b7c3b9afe145eca2aef ]
    
    The current function that both removes and frees an interrupter isn't
    optimal when using several interrupters. The array of interrupters need
    to be protected with a lock while removing interrupters, but the default
    xhci spin lock can't be used while freeing the interrupters event ring
    segment table as dma_free_coherent() should be called with IRQs enabled.
    
    There is no need to free the interrupter under the lock, so split this
    code into separate unlocked free part, and a lock protected remove part.
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-17-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: support setting interrupt moderation IMOD for secondary interrupters [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Sep 5 17:33:00 2024 +0300

    xhci: support setting interrupt moderation IMOD for secondary interrupters
    
    [ Upstream commit 9c0c11bb87b09a8b7cdc21ca1090e7b36abe9d09 ]
    
    Allow creators of seconday interrupters to specify the interrupt
    moderation interval value in nanoseconds when creating the interrupter.
    
    If not sure what value to use then use the xhci driver default
    xhci->imod_interval
    
    Suggested-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20240905143300.1959279-13-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xhci: Use more than one Event Ring segment [+ + +]
Author: Jonathan Bell <jonathan@raspberrypi.com>
Date:   Thu Oct 19 13:29:10 2023 +0300

    xhci: Use more than one Event Ring segment
    
    [ Upstream commit 28084d3fcc3c8445542917f32e382c45b5343cc2 ]
    
    Users have reported log spam created by "Event Ring Full" xHC event
    TRBs.  These are caused by interrupt latency in conjunction with a very
    busy set of devices on the bus.  The errors are benign, but throughput
    will suffer as the xHC will pause processing of transfers until the
    Event Ring is drained by the kernel.
    
    Commit dc0ffbea5729 ("usb: host: xhci: update event ring dequeue pointer
    on purpose") mitigated the issue by advancing the Event Ring Dequeue
    Pointer already after half a segment has been processed.  Nevertheless,
    providing a larger Event Ring would be useful to cope with load peaks.
    
    Expand the number of event TRB slots available by increasing the number
    of Event Ring segments in the ERST.
    
    Controllers have a hardware-defined limit as to the number of ERST
    entries they can process, but with up to 32k it can be excessively high
    (sec 5.3.4).  So cap the actual number at 2 (configurable through the
    ERST_MAX_SEGS macro), which seems like a reasonable quantity.  It is
    supported by any xHC because the limit in the HCSPARAMS2 register is
    defined as a power of 2.  Renesas uPD720201 and VIA VL805 controllers
    do not support more than 2 ERST entries.
    
    An alternative to increasing the number of Event Ring segments would be
    an increase of the segment size.  But that requires allocating multiple
    contiguous pages, which may be impossible if memory is fragmented.
    
    Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-6-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: bea5892d0ed2 ("xhci: Limit time spent with xHC interrupts disabled during bus resume")
    Signed-off-by: Sasha Levin <sashal@kernel.org>