Changelog in Linux kernel 5.10.241

 
Linux: (powerpc/512) Fix possible `dma_unmap_single()` on uninitialized pointer [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Tue Jun 10 16:29:11 2025 +0200

    (powerpc/512) Fix possible `dma_unmap_single()` on uninitialized pointer
    
    [ Upstream commit 760b9b4f6de9a33ca56a05f950cabe82138d25bd ]
    
    If the device configuration fails (if `dma_dev->device_config()`),
    `sg_dma_address(&sg)` is not initialized and the jump to `err_dma_prep`
    leads to calling `dma_unmap_single()` on `sg_dma_address(&sg)`.
    
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250610142918.169540-2-fourier.thomas@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ACPI: APEI: GHES: add TAINT_MACHINE_CHECK on GHES panic path [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Wed Jul 2 08:39:51 2025 -0700

    ACPI: APEI: GHES: add TAINT_MACHINE_CHECK on GHES panic path
    
    [ Upstream commit 4734c8b46b901cff2feda8b82abc710b65dc31c1 ]
    
    When a GHES (Generic Hardware Error Source) triggers a panic, add the
    TAINT_MACHINE_CHECK taint flag to the kernel. This explicitly marks the
    kernel as tainted due to a machine check event, improving diagnostics
    and post-mortem analysis. The taint is set with LOCKDEP_STILL_OK to
    indicate lockdep remains valid.
    
    At large scale deployment, this helps to quickly determine panics that
    are coming due to hardware failures.
    
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Reviewed-by: Tony Luck <tony.luck@intel.com>
    Link: https://patch.msgid.link/20250702-add_tain-v1-1-9187b10914b9@debian.org
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ACPI: processor: fix acpi_object initialization [+ + +]
Author: Sebastian Ott <sebott@redhat.com>
Date:   Thu Jul 3 14:42:15 2025 +0200

    ACPI: processor: fix acpi_object initialization
    
    [ Upstream commit 13edf7539211d8f7d0068ce3ed143005f1da3547 ]
    
    Initialization of the local acpi_object in acpi_processor_get_info()
    only sets the first 4 bytes to zero and is thus incomplete. This is
    indicated by messages like:
            acpi ACPI0007:be: Invalid PBLK length [166288104]
    
    Fix this by initializing all 16 bytes of the processor member of that
    union.
    
    Signed-off-by: Sebastian Ott <sebott@redhat.com>
    Link: https://patch.msgid.link/20250703124215.12522-1-sebott@redhat.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ACPI: processor: idle: Check acpi_fetch_acpi_dev() return value [+ + +]
Author: Li Zhong <floridsleeves@gmail.com>
Date:   Fri Sep 2 00:37:30 2022 -0700

    ACPI: processor: idle: Check acpi_fetch_acpi_dev() return value
    
    commit 2437513a814b3e93bd02879740a8a06e52e2cf7d upstream.
    
    The return value of acpi_fetch_acpi_dev() could be NULL, which would
    cause a NULL pointer dereference to occur in acpi_device_hid().
    
    Signed-off-by: Li Zhong <floridsleeves@gmail.com>
    [ rjw: Subject and changelog edits, added empty line after if () ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Yann Sionneau <yann.sionneau@vates.tech>
    Reported-by: Dillon C <dchan@dchan.tech>
    Tested-by: Dillon C <dchan@dchan.tech>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: processor: perflib: Fix initial _PPC limit application [+ + +]
Author: Jiayi Li <lijiayi@kylinos.cn>
Date:   Mon Jul 21 11:26:06 2025 +0800

    ACPI: processor: perflib: Fix initial _PPC limit application
    
    commit d33bd88ac0ebb49e7f7c8f29a8c7ee9eae85d765 upstream.
    
    If the BIOS sets a _PPC frequency limit upfront, it will fail to take
    effect due to a call ordering issue.  Namely, freq_qos_update_request()
    is called before freq_qos_add_request() for the given request causing
    the constraint update to be ignored.  The call sequence in question is
    as follows:
    
    cpufreq_policy_online()
      acpi_cpufreq_cpu_init()
        acpi_processor_register_performance()
          acpi_processor_get_performance_info()
            acpi_processor_get_platform_limit()
             freq_qos_update_request(&perflib_req) <- inactive QoS request
      blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
                                   CPUFREQ_CREATE_POLICY)
        acpi_processor_notifier()
          acpi_processor_ppc_init()
            freq_qos_add_request(&perflib_req) <- QoS request activation
    
    Address this by adding an acpi_processor_get_platform_limit() call
    to acpi_processor_ppc_init(), after the perflib_req activation via
    freq_qos_add_request(), which causes the initial _PPC limit to be
    picked up as appropriate.  However, also ensure that the _PPC limit
    will not be picked up in the cases when the cpufreq driver does not
    call acpi_processor_register_performance() by adding a pr->performance
    check to the related_cpus loop in acpi_processor_ppc_init().
    
    Fixes: d15ce412737a ("ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier")
    Signed-off-by: Jiayi Li <lijiayi@kylinos.cn>
    Link: https://patch.msgid.link/20250721032606.3459369-1-lijiayi@kylinos.cn
    [ rjw: Consolidate pr-related checks in acpi_processor_ppc_init() ]
    [ rjw: Subject and changelog adjustments ]
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: 2d8b39a62a5d ACPI: processor: Avoid NULL pointer dereferences at init time
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: 3000ce3c52f8 cpufreq: Use per-policy frequency QoS
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: a1bb46c36ce3 ACPI: processor: Add QoS requests for all CPUs
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: processor: perflib: Move problematic pr->performance check [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Tue Aug 12 14:57:06 2025 +0200

    ACPI: processor: perflib: Move problematic pr->performance check
    
    commit d405ec23df13e6df599f5bd965a55d13420366b8 upstream.
    
    Commit d33bd88ac0eb ("ACPI: processor: perflib: Fix initial _PPC limit
    application") added a pr->performance check that prevents the frequency
    QoS request from being added when the given processor has no performance
    object.  Unfortunately, this causes a WARN() in freq_qos_remove_request()
    to trigger on an attempt to take the given CPU offline later because the
    frequency QoS object has not been added for it due to the missing
    performance object.
    
    Address this by moving the pr->performance check before calling
    acpi_processor_get_platform_limit() so it only prevents a limit from
    being set for the CPU if the performance object is not present.  This
    way, the frequency QoS request is added as it was before the above
    commit and it is present all the time along with the CPU's cpufreq
    policy regardless of whether or not the CPU is online.
    
    Fixes: d33bd88ac0eb ("ACPI: processor: perflib: Fix initial _PPC limit application")
    Tested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://patch.msgid.link/2801421.mvXUDI8C0e@rafael.j.wysocki
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
af_packet: fix soft lockup issue caused by tpacket_snd() [+ + +]
Author: Yun Lu <luyun@kylinos.cn>
Date:   Fri Jul 11 17:33:00 2025 +0800

    af_packet: fix soft lockup issue caused by tpacket_snd()
    
    commit 55f0bfc0370539213202f4ce1a07615327ac4713 upstream.
    
    When MSG_DONTWAIT is not set, the tpacket_snd operation will wait for
    pending_refcnt to decrement to zero before returning. The pending_refcnt
    is decremented by 1 when the skb->destructor function is called,
    indicating that the skb has been successfully sent and needs to be
    destroyed.
    
    If an error occurs during this process, the tpacket_snd() function will
    exit and return error, but pending_refcnt may not yet have decremented to
    zero. Assuming the next send operation is executed immediately, but there
    are no available frames to be sent in tx_ring (i.e., packet_current_frame
    returns NULL), and skb is also NULL, the function will not execute
    wait_for_completion_interruptible_timeout() to yield the CPU. Instead, it
    will enter a do-while loop, waiting for pending_refcnt to be zero. Even
    if the previous skb has completed transmission, the skb->destructor
    function can only be invoked in the ksoftirqd thread (assuming NAPI
    threading is enabled). When both the ksoftirqd thread and the tpacket_snd
    operation happen to run on the same CPU, and the CPU trapped in the
    do-while loop without yielding, the ksoftirqd thread will not get
    scheduled to run. As a result, pending_refcnt will never be reduced to
    zero, and the do-while loop cannot exit, eventually leading to a CPU soft
    lockup issue.
    
    In fact, skb is true for all but the first iterations of that loop, and
    as long as pending_refcnt is not zero, even if incremented by a previous
    call, wait_for_completion_interruptible_timeout() should be executed to
    yield the CPU, allowing the ksoftirqd thread to be scheduled. Therefore,
    the execution condition of this function should be modified to check if
    pending_refcnt is not zero, instead of check skb.
    
    -       if (need_wait && skb) {
    +       if (need_wait && packet_read_pending(&po->tx_ring)) {
    
    As a result, the judgment conditions are duplicated with the end code of
    the while loop, and packet_read_pending() is a very expensive function.
    Actually, this loop can only exit when ph is NULL, so the loop condition
    can be changed to while (1), and in the "ph = NULL" branch, if the
    subsequent condition of if is not met,  the loop can break directly. Now,
    the loop logic remains the same as origin but is clearer and more obvious.
    
    Fixes: 89ed5b519004 ("af_packet: Block execution of tasks waiting for transmit to complete in AF_PACKET")
    Cc: stable@kernel.org
    Suggested-by: LongJun Tang <tanglongjun@kylinos.cn>
    Signed-off-by: Yun Lu <luyun@kylinos.cn>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd() [+ + +]
Author: Yun Lu <luyun@kylinos.cn>
Date:   Fri Jul 11 17:32:59 2025 +0800

    af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd()
    
    commit c1ba3c0cbdb5e53a8ec5d708e99cd4c497028a13 upstream.
    
    Due to the changes in commit 581073f626e3 ("af_packet: do not call
    packet_read_pending() from tpacket_destruct_skb()"), every time
    tpacket_destruct_skb() is executed, the skb_completion is marked as
    completed. When wait_for_completion_interruptible_timeout() returns
    completed, the pending_refcnt has not yet been reduced to zero.
    Therefore, when ph is NULL, the wait function may need to be called
    multiple times until packet_read_pending() finally returns zero.
    
    We should call sock_sndtimeo() only once, otherwise the SO_SNDTIMEO
    constraint could be way off.
    
    Fixes: 581073f626e3 ("af_packet: do not call packet_read_pending() from tpacket_destruct_skb()")
    Cc: stable@kernel.org
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Yun Lu <luyun@kylinos.cn>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
alloc_fdtable(): change calling conventions. [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Tue Aug 26 17:27:47 2025 -0400

    alloc_fdtable(): change calling conventions.
    
    [ Upstream commit 1d3b4bec3ce55e0c46cdce7d0402dbd6b4af3a3d ]
    
    First of all, tell it how many slots do we want, not which slot
    is wanted.  It makes one caller (dup_fd()) more straightforward
    and doesn't harm another (expand_fdtable()).
    
    Furthermore, make it return ERR_PTR() on failure rather than
    returning NULL.  Simplifies the callers.
    
    Simplify the size calculation, while we are at it - note that we
    always have slots_wanted greater than BITS_PER_LONG.  What the
    rules boil down to is
            * use the smallest power of two large enough to give us
    that many slots
            * on 32bit skip 64 and 128 - the minimal capacity we want
    there is 256 slots (i.e. 1Kb fd array).
            * on 64bit don't skip anything, the minimal capacity is
    128 - and we'll never be asked for 64 or less.  128 slots means
    1Kb fd array, again.
            * on 128bit, if that ever happens, don't skip anything -
    we'll never be asked for 128 or less, so the fd array allocation
    will be at least 2Kb.
    
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control [+ + +]
Author: Lucy Thrun <lucy.thrun@digital-rabbithole.de>
Date:   Tue Jun 10 19:50:12 2025 +0200

    ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control
    
    [ Upstream commit a409c60111e6bb98fcabab2aeaa069daa9434ca0 ]
    
    The 'sprintf' call in 'add_tuning_control' may exceed the 44-byte
    buffer if either string argument is too long. This triggers a compiler
    warning.
    Replaced 'sprintf' with 'snprintf' to limit string lengths to prevent
    overflow.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202506100642.95jpuMY1-lkp@intel.com/
    Signed-off-by: Lucy Thrun <lucy.thrun@digital-rabbithole.de>
    Link: https://patch.msgid.link/20250610175012.918-3-lucy.thrun@digital-rabbithole.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda/ca0132: Fix missing error handling in ca0132_alt_select_out() [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Aug 6 11:44:22 2025 +0200

    ALSA: hda/ca0132: Fix missing error handling in ca0132_alt_select_out()
    
    [ Upstream commit 9f320dfb0ffc555aa2eac8331dee0c2c16f67633 ]
    
    There are a couple of cases where the error is ignored or the error
    code isn't propagated in ca0132_alt_select_out().  Fix those.
    
    Fixes: def3f0a5c700 ("ALSA: hda/ca0132 - Add quirk output selection structures.")
    Link: https://patch.msgid.link/20250806094423.8843-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda/realtek - Add mute LED support for HP Pavilion 15-eg0xxx [+ + +]
Author: Dawid Rezler <dawidrezler.patches@gmail.com>
Date:   Sun Jul 20 17:49:08 2025 +0200

    ALSA: hda/realtek - Add mute LED support for HP Pavilion 15-eg0xxx
    
    commit 9744ede7099e8a69c04aa23fbea44c15bc390c04 upstream.
    
    The mute LED on the HP Pavilion Laptop 15-eg0xxx,
    which uses the ALC287 codec, didn't work.
    This patch fixes the issue by enabling the ALC287_FIXUP_HP_GPIO_LED quirk.
    
    Tested on a physical device, the LED now works as intended.
    
    Signed-off-by: Dawid Rezler <dawidrezler.patches@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250720154907.80815-2-dawidrezler.patches@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Add support for HP EliteBook x360 830 G6 and EliteBook 830 G6 [+ + +]
Author: Evgeniy Harchenko <evgeniyharchenko.dev@gmail.com>
Date:   Fri Aug 15 12:58:14 2025 +0300

    ALSA: hda/realtek: Add support for HP EliteBook x360 830 G6 and EliteBook 830 G6
    
    commit eafae0fdd115a71b3a200ef1a31f86da04bac77f upstream.
    
    The HP EliteBook x360 830 G6 and HP EliteBook 830 G6 have
    Realtek HDA codec ALC215. It needs the ALC285_FIXUP_HP_GPIO_LED
    quirk to enable the mute LED.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Evgeniy Harchenko <evgeniyharchenko.dev@gmail.com>
    Link: https://patch.msgid.link/20250815095814.75845-1-evgeniyharchenko.dev@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda: Add missing NVIDIA HDA codec IDs [+ + +]
Author: Daniel Dadap <ddadap@nvidia.com>
Date:   Thu Jun 26 16:16:30 2025 -0500

    ALSA: hda: Add missing NVIDIA HDA codec IDs
    
    commit e0a911ac86857a73182edde9e50d9b4b949b7f01 upstream.
    
    Add codec IDs for several NVIDIA products with HDA controllers to the
    snd_hda_id_hdmi[] patch table.
    
    Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/aF24rqwMKFWoHu12@ddadap-lakeline.nvidia.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [ change patch_tegra234_hdmi function calls to patch_tegra_hdmi ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: intel8x0: Fix incorrect codec index usage in mixer for ICH4 [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Sat Jun 21 11:52:24 2025 -0700

    ALSA: intel8x0: Fix incorrect codec index usage in mixer for ICH4
    
    [ Upstream commit 87aafc8580acf87fcaf1a7e30ed858d8c8d37d81 ]
    
    code mistakenly used a hardcoded index (codec[1]) instead of
    iterating, over the codec array using the loop variable i.
    Use codec[i] instead of codec[1] to match the loop iteration.
    
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Link: https://patch.msgid.link/20250621185233.4081094-1-alok.a.tiwari@oracle.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: pcm: Rewrite recalculate_boundary() to avoid costly loop [+ + +]
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Fri Jun 6 11:44:02 2025 +0200

    ALSA: pcm: Rewrite recalculate_boundary() to avoid costly loop
    
    [ Upstream commit 92f59aeb13252265c20e7aef1379a8080c57e0a2 ]
    
    At the time being recalculate_boundary() is implemented with a
    loop which shows up as costly in a perf profile, as depicted by
    the annotate below:
    
        0.00 :   c057e934:       3d 40 7f ff     lis     r10,32767
        0.03 :   c057e938:       61 4a ff ff     ori     r10,r10,65535
        0.21 :   c057e93c:       7d 49 50 50     subf    r10,r9,r10
        5.39 :   c057e940:       7d 3c 4b 78     mr      r28,r9
        2.11 :   c057e944:       55 29 08 3c     slwi    r9,r9,1
        3.04 :   c057e948:       7c 09 50 40     cmplw   r9,r10
        2.47 :   c057e94c:       40 81 ff f4     ble     c057e940 <snd_pcm_ioctl+0xee0>
    
    Total: 13.2% on that simple loop.
    
    But what the loop does is to multiply the boundary by 2 until it is
    over the wanted border. This can be avoided by using fls() to get the
    boundary value order and shift it by the appropriate number of bits at
    once.
    
    This change provides the following profile:
    
        0.04 :   c057f6e8:       3d 20 7f ff     lis     r9,32767
        0.02 :   c057f6ec:       61 29 ff ff     ori     r9,r9,65535
        0.34 :   c057f6f0:       7d 5a 48 50     subf    r10,r26,r9
        0.23 :   c057f6f4:       7c 1a 50 40     cmplw   r26,r10
        0.02 :   c057f6f8:       41 81 00 20     bgt     c057f718 <snd_pcm_ioctl+0xf08>
        0.26 :   c057f6fc:       7f 47 00 34     cntlzw  r7,r26
        0.09 :   c057f700:       7d 48 00 34     cntlzw  r8,r10
        0.22 :   c057f704:       7d 08 38 50     subf    r8,r8,r7
        0.04 :   c057f708:       7f 5a 40 30     slw     r26,r26,r8
        0.35 :   c057f70c:       7c 0a d0 40     cmplw   r10,r26
        0.13 :   c057f710:       40 80 05 f8     bge     c057fd08 <snd_pcm_ioctl+0x14f8>
        0.00 :   c057f714:       57 5a f8 7e     srwi    r26,r26,1
    
    Total: 1.7% with that loopless alternative.
    
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Link: https://patch.msgid.link/4836e2cde653eebaf2709ebe30eec736bb8c67fd.1749202237.git.christophe.leroy@csgroup.eu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx() [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Wed Aug 13 11:55:06 2025 -0400

    ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx()
    
    [ Upstream commit 8a15ca0ca51399b652b1bbb23b590b220cf03d62 ]
    
    During communication with Focusrite Scarlett Gen 2/3/4 USB audio
    interfaces, -EPROTO is sometimes returned from scarlett2_usb_tx(),
    snd_usb_ctl_msg() which can cause initialisation and control
    operations to fail intermittently.
    
    This patch adds up to 5 retries in scarlett2_usb(), with a delay
    starting at 5ms and doubling each time. This follows the same approach
    as the fix for usb_set_interface() in endpoint.c (commit f406005e162b
    ("ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface()")),
    which resolved similar -EPROTO issues during device initialisation,
    and is the same approach as in fcp.c:fcp_usb().
    
    Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
    Closes: https://github.com/geoffreybennett/linux-fcp/issues/41
    Cc: stable@vger.kernel.org
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://patch.msgid.link/aIdDO6ld50WQwNim@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [ Applied retry logic directly in scarlett2_usb() instead of scarlett2_usb_tx() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Avoid precedence issues in mixer_quirks macros [+ + +]
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Date:   Mon May 26 17:07:42 2025 +0300

    ALSA: usb-audio: Avoid precedence issues in mixer_quirks macros
    
    [ Upstream commit fd3ab72e42e9871a9902b945a2bf8bb87b49c718 ]
    
    Fix all macro related issues identified by checkpatch.pl:
    
      CHECK: Macro argument 'x' may be better as '(x)' to avoid precedence issues
    
    Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20250526-dualsense-alsa-jack-v1-3-1a821463b632@collabora.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Fix size validation in convert_chmap_v3() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Mon Aug 18 12:59:45 2025 +0300

    ALSA: usb-audio: Fix size validation in convert_chmap_v3()
    
    [ Upstream commit 89f0addeee3cb2dc49837599330ed9c4612f05b0 ]
    
    The "p" pointer is void so sizeof(*p) is 1.  The intent was to check
    sizeof(*cs_desc), which is 3, instead.
    
    Fixes: ecfd41166b72 ("ALSA: usb-audio: Validate UAC3 cluster segment descriptors")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://patch.msgid.link/aKL5kftC1qGt6lpv@stanley.mountain
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Use correct sub-type for UAC3 feature unit validation [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 21 17:08:34 2025 +0200

    ALSA: usb-audio: Use correct sub-type for UAC3 feature unit validation
    
    [ Upstream commit 8410fe81093ff231e964891e215b624dabb734b0 ]
    
    The entry of the validators table for UAC3 feature unit is defined
    with a wrong sub-type UAC_FEATURE (= 0x06) while it should have been
    UAC3_FEATURE (= 0x07).  This patch corrects the entry value.
    
    Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units")
    Link: https://patch.msgid.link/20250821150835.8894-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Validate UAC3 cluster segment descriptors [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 14 10:12:43 2025 +0200

    ALSA: usb-audio: Validate UAC3 cluster segment descriptors
    
    commit ecfd41166b72b67d3bdeb88d224ff445f6163869 upstream.
    
    UAC3 class segment descriptors need to be verified whether their sizes
    match with the declared lengths and whether they fit with the
    allocated buffer sizes, too.  Otherwise malicious firmware may lead to
    the unexpected OOB accesses.
    
    Fixes: 11785ef53228 ("ALSA: usb-audio: Initial Power Domain support")
    Reported-and-tested-by: Youngjun Lee <yjjuny.lee@samsung.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250814081245.8902-2-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Validate UAC3 power domain descriptors, too [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 14 10:12:42 2025 +0200

    ALSA: usb-audio: Validate UAC3 power domain descriptors, too
    
    commit d832ccbc301fbd9e5a1d691bdcf461cdb514595f upstream.
    
    UAC3 power domain descriptors need to be verified with its variable
    bLength for avoiding the unexpected OOB accesses by malicious
    firmware, too.
    
    Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
    Reported-and-tested-by: Youngjun Lee <yjjuny.lee@samsung.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250814081245.8902-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
apparmor: ensure WB_HISTORY_SIZE value is a power of 2 [+ + +]
Author: Ryan Lee <ryan.lee@canonical.com>
Date:   Thu May 1 12:54:38 2025 -0700

    apparmor: ensure WB_HISTORY_SIZE value is a power of 2
    
    [ Upstream commit 6c055e62560b958354625604293652753d82bcae ]
    
    WB_HISTORY_SIZE was defined to be a value not a power of 2, despite a
    comment in the declaration of struct match_workbuf stating it is and a
    modular arithmetic usage in the inc_wb_pos macro assuming that it is. Bump
    WB_HISTORY_SIZE's value up to 32 and add a BUILD_BUG_ON_NOT_POWER_OF_2
    line to ensure that any future changes to the value of WB_HISTORY_SIZE
    respect this requirement.
    
    Fixes: 136db994852a ("apparmor: increase left match history buffer size")
    
    Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX [+ + +]
Author: Johan Korsnes <johan.korsnes@gmail.com>
Date:   Sun Mar 23 20:11:16 2025 +0100

    arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX
    
    [ Upstream commit 75cd37c5f28b85979fd5a65174013010f6b78f27 ]
    
    This option was removed from the Kconfig in commit
    8c710f75256b ("net/sched: Retire tcindex classifier") but it was not
    removed from the defconfigs.
    
    Fixes: 8c710f75256b ("net/sched: Retire tcindex classifier")
    Signed-off-by: Johan Korsnes <johan.korsnes@gmail.com>
    Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250323191116.113482-1-johan.korsnes@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64: dts: imx8mm-beacon: Fix HS400 USDHC clock speed [+ + +]
Author: Adam Ford <aford173@gmail.com>
Date:   Fri Jun 20 16:34:45 2025 -0500

    arm64: dts: imx8mm-beacon: Fix HS400 USDHC clock speed
    
    [ Upstream commit f83f69097a302ed2a2775975ddcf12e6a5ac6ec3 ]
    
    The reference manual for the i.MX8MM states the clock rate in
    MMC mode is 1/2 of the input clock, therefore to properly run
    at HS400 rates, the input clock must be 400MHz to operate at
    200MHz.  Currently the clock is set to 200MHz which is half the
    rate it should be, so the throughput is half of what it should be
    for HS400 operation.
    
    Fixes: 593816fa2f35 ("arm64: dts: imx: Add Beacon i.MX8m-Mini development kit")
    Signed-off-by: Adam Ford <aford173@gmail.com>
    Reviewed-by: Fabio Estevam <festevam@gmail.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: Handle KCOV __init vs inline mismatches [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Wed Jul 23 22:50:25 2025 -0700

    arm64: Handle KCOV __init vs inline mismatches
    
    [ Upstream commit 65c430906efffee9bd7551d474f01a6b1197df90 ]
    
    GCC appears to have kind of fragile inlining heuristics, in the
    sense that it can change whether or not it inlines something based on
    optimizations. It looks like the kcov instrumentation being added (or in
    this case, removed) from a function changes the optimization results,
    and some functions marked "inline" are _not_ inlined. In that case,
    we end up with __init code calling a function not marked __init, and we
    get the build warnings I'm trying to eliminate in the coming patch that
    adds __no_sanitize_coverage to __init functions:
    
    WARNING: modpost: vmlinux: section mismatch in reference: acpi_get_enable_method+0x1c (section: .text.unlikely) -> acpi_psci_present (section: .init.text)
    
    This problem is somewhat fragile (though using either __always_inline
    or __init will deterministically solve it), but we've tripped over
    this before with GCC and the solution has usually been to just use
    __always_inline and move on.
    
    For arm64 this requires forcing one ACPI function to be inlined with
    __always_inline.
    
    Link: https://lore.kernel.org/r/20250724055029.3623499-1-kees@kernel.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Mon Jul 28 11:00:44 2025 -0400

    ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS
    
    [ Upstream commit 87c4e1459e80bf65066f864c762ef4dc932fad4b ]
    
    After commit d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper
    flags and language target"), which updated as-instr to use the
    'assembler-with-cpp' language option, the Kbuild version of as-instr
    always fails internally for arch/arm with
    
      <command-line>: fatal error: asm/unified.h: No such file or directory
      compilation terminated.
    
    because '-include' flags are now taken into account by the compiler
    driver and as-instr does not have '$(LINUXINCLUDE)', so unified.h is not
    found.
    
    This went unnoticed at the time of the Kbuild change because the last
    use of as-instr in Kbuild that arch/arm could reach was removed in 5.7
    by commit 541ad0150ca4 ("arm: Remove 32bit KVM host support") but a
    stable backport of the Kbuild change to before that point exposed this
    potential issue if one were to be reintroduced.
    
    Follow the general pattern of '-include' paths throughout the tree and
    make unified.h absolute using '$(srctree)' to ensure KBUILD_AFLAGS can
    be used independently.
    
    Closes: https://lore.kernel.org/CACo-S-1qbCX4WAVFA63dWfHtrRHZBTyyr2js8Lx=Az03XHTTHg@mail.gmail.com/
    
    Cc: stable@vger.kernel.org
    Fixes: d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper flags and language target")
    Reported-by: KernelCI bot <bot@kernelci.org>
    Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    [ adapted to missing -Wa ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ARM: dts: imx6ul-kontron-bl-common: Fix RTS polarity for RS485 interface [+ + +]
Author: Annette Kobou <annette.kobou@kontron.de>
Date:   Tue Jul 8 14:24:41 2025 +0200

    ARM: dts: imx6ul-kontron-bl-common: Fix RTS polarity for RS485 interface
    
    [ Upstream commit 47ef5256124fb939d8157b13ca048c902435cf23 ]
    
    The polarity of the DE signal of the transceiver is active-high for
    sending. Therefore rs485-rts-active-low is wrong and needs to be
    removed to make RS485 transmissions work.
    
    Signed-off-by: Annette Kobou <annette.kobou@kontron.de>
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Fixes: 1ea4b76cdfde ("ARM: dts: imx6ul-kontron-n6310: Add Kontron i.MX6UL N6310 SoM and boards")
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: dts: vfxxx: Correctly use two tuples for timer address [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri May 23 09:19:22 2025 +0200

    ARM: dts: vfxxx: Correctly use two tuples for timer address
    
    [ Upstream commit f3440dcf8b994197c968fbafe047ce27eed226e8 ]
    
    Address and size-cells are 1 and the ftm timer node takes two address
    spaces in "reg" property, so this should be in two <> tuples.  Change
    has no functional impact, but original code is confusing/less readable.
    
    Fixes: 07513e1330a9 ("ARM: dts: vf610: Add Freescale FlexTimer Module timer node.")
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: rockchip: fix kernel hang during smp initialization [+ + +]
Author: Alexander Kochetkov <al.kochet@gmail.com>
Date:   Thu Jul 3 17:04:53 2025 +0300

    ARM: rockchip: fix kernel hang during smp initialization
    
    [ Upstream commit 7cdb433bb44cdc87dc5260cdf15bf03cc1cd1814 ]
    
    In order to bring up secondary CPUs main CPU write trampoline
    code to SRAM. The trampoline code is written while secondary
    CPUs are powered on (at least that true for RK3188 CPU).
    Sometimes that leads to kernel hang. Probably because secondary
    CPU execute trampoline code while kernel doesn't expect.
    
    The patch moves SRAM initialization step to the point where all
    secondary CPUs are powered down.
    
    That fixes rarely hangs on RK3188:
    [    0.091568] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [    0.091996] rockchip_smp_prepare_cpus: ncores 4
    
    Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
    Link: https://lore.kernel.org/r/20250703140453.1273027-1-al.kochet@gmail.com
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: tegra: Use I/O memcpy to write to IRAM [+ + +]
Author: Aaron Kling <webgeek1234@gmail.com>
Date:   Thu May 22 11:11:24 2025 -0500

    ARM: tegra: Use I/O memcpy to write to IRAM
    
    [ Upstream commit 398e67e0f5ae04b29bcc9cbf342e339fe9d3f6f1 ]
    
    Kasan crashes the kernel trying to check boundaries when using the
    normal memcpy.
    
    Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
    Link: https://lore.kernel.org/r/20250522-mach-tegra-kasan-v1-1-419041b8addb@gmail.com
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
asm-generic: Add memory barrier dma_mb() [+ + +]
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Fri Aug 22 15:53:29 2025 -0400

    asm-generic: Add memory barrier dma_mb()
    
    [ Upstream commit ed59dfd9509d172e4920994ed9cbebf93b0050cc ]
    
    The memory barrier dma_mb() is introduced by commit a76a37777f2c
    ("iommu/arm-smmu-v3: Ensure queue is read after updating prod pointer"),
    which is used to ensure that prior (both reads and writes) accesses
    to memory by a CPU are ordered w.r.t. a subsequent MMIO write.
    
    Reviewed-by: Arnd Bergmann <arnd@arndb.de> # for asm-generic
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Reviewed-by: Marco Elver <elver@google.com>
    Link: https://lore.kernel.org/r/20220523113126.171714-2-wangkefeng.wang@huawei.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Stable-dep-of: aa6956150f82 ("wifi: ath11k: fix dest ring-buffer corruption when ring is full")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: codecs: rt5640: Retry DEVICE_ID verification [+ + +]
Author: Xinxin Wan <xinxin.wan@intel.com>
Date:   Fri May 30 16:21:19 2025 +0200

    ASoC: codecs: rt5640: Retry DEVICE_ID verification
    
    [ Upstream commit 19f971057b2d7b99c80530ec1052b45de236a8da ]
    
    To be more resilient to codec-detection failures when the hardware
    powers on slowly, add retry mechanism to the device verification check.
    Similar pattern is found throughout a number of Realtek codecs. Our
    tests show that 60ms delay is sufficient to address readiness issues on
    rt5640 chip.
    
    Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
    Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
    Signed-off-by: Xinxin Wan <xinxin.wan@intel.com>
    Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
    Link: https://patch.msgid.link/20250530142120.2944095-3-cezary.rojewski@intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime() [+ + +]
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Thu Jun 19 11:42:20 2025 +0300

    ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime()
    
    [ Upstream commit 2d91cb261cac6d885954b8f5da28b5c176c18131 ]
    
    snd_soc_remove_pcm_runtime() might be called with rtd == NULL which will
    leads to null pointer dereference.
    This was reproduced with topology loading and marking a link as ignore
    due to missing hardware component on the system.
    On module removal the soc_tplg_remove_link() would call
    snd_soc_remove_pcm_runtime() with rtd == NULL since the link was ignored,
    no runtime was created.
    
    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
    Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Link: https://patch.msgid.link/20250619084222.559-3-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: fsl_sai: Force a software reset when starting in consumer mode [+ + +]
Author: Arun Raghavan <arun@asymptotic.io>
Date:   Thu Jun 26 09:08:25 2025 -0400

    ASoC: fsl_sai: Force a software reset when starting in consumer mode
    
    commit dc78f7e59169d3f0e6c3c95d23dc8e55e95741e2 upstream.
    
    On an imx8mm platform with an external clock provider, when running the
    receiver (arecord) and triggering an xrun with xrun_injection, we see a
    channel swap/offset. This happens sometimes when running only the
    receiver, but occurs reliably if a transmitter (aplay) is also
    concurrently running.
    
    It seems that the SAI loses track of frame sync during the trigger stop
    -> trigger start cycle that occurs during an xrun. Doing just a FIFO
    reset in this case does not suffice, and only a software reset seems to
    get it back on track.
    
    This looks like the same h/w bug that is already handled for the
    producer case, so we now do the reset unconditionally on config disable.
    
    Signed-off-by: Arun Raghavan <arun@asymptotic.io>
    Reported-by: Pieterjan Camerlynck <p.camerlynck@televic.com>
    Fixes: 3e3f8bd56955 ("ASoC: fsl_sai: fix no frame clk in master mode")
    Cc: stable@vger.kernel.org
    Reviewed-by: Fabio Estevam <festevam@gmail.com>
    Link: https://patch.msgid.link/20250626130858.163825-1-arun@arunraghavan.net
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: fsl_sai: replace regmap_write with regmap_update_bits [+ + +]
Author: Shengjiu Wang <shengjiu.wang@nxp.com>
Date:   Thu Aug 7 10:03:18 2025 +0800

    ASoC: fsl_sai: replace regmap_write with regmap_update_bits
    
    [ Upstream commit 0e270f32975fd21874185ba53653630dd40bf560 ]
    
    Use the regmap_write() for software reset in fsl_sai_config_disable would
    cause the FSL_SAI_CSR_BCE bit to be cleared. Refer to
    commit 197c53c8ecb34 ("ASoC: fsl_sai: Don't disable bitclock for i.MX8MP")
    FSL_SAI_CSR_BCE should not be cleared. So need to use regmap_update_bits()
    instead of regmap_write() for these bit operations.
    
    Fixes: dc78f7e59169d ("ASoC: fsl_sai: Force a software reset when starting in consumer mode")
    Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
    Link: https://patch.msgid.link/20250807020318.2143219-1-shengjiu.wang@nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: hdac_hdmi: Rate limit logging on connection and disconnection [+ + +]
Author: Mark Brown <broonie@kernel.org>
Date:   Fri Jun 13 17:41:04 2025 +0100

    ASoC: hdac_hdmi: Rate limit logging on connection and disconnection
    
    [ Upstream commit c4ca928a6db1593802cd945f075a7e21dd0430c1 ]
    
    We currently log parse failures for ELD data and some disconnection events
    as errors without rate limiting. These log messages can be triggered very
    frequently in some situations, especially ELD parsing when there is nothing
    connected to a HDMI port which will generate:
    
    hdmi-audio-codec hdmi-audio-codec.1.auto: HDMI: Unknown ELD version 0
    
    While there's doubtless work that could be done on reducing the number of
    connection notification callbacks it's possible these may be legitimately
    generated by poor quality physical connections so let's use rate limiting
    to mitigate the log spam for the parse errors and lower the severity for
    disconnect logging to debug level.
    
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Link: https://patch.msgid.link/20250613-asoc-hdmi-eld-logging-v1-1-76d64154d969@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Intel: fix SND_SOC_SOF dependencies [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Jul 9 16:56:07 2025 +0200

    ASoC: Intel: fix SND_SOC_SOF dependencies
    
    [ Upstream commit e837b59f8b411b5baf5e3de7a5aea10b1c545a63 ]
    
    It is currently possible to configure a kernel with all Intel SoC
    configs as loadable modules, but the board config as built-in. This
    causes a link failure in the reference to the snd_soc_sof.ko module:
    
    x86_64-linux-ld: sound/soc/intel/boards/sof_rt5682.o: in function `sof_rt5682_hw_params':
    sof_rt5682.c:(.text+0x1f9): undefined reference to `sof_dai_get_mclk'
    x86_64-linux-ld: sof_rt5682.c:(.text+0x234): undefined reference to `sof_dai_get_bclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_rt5682.o: in function `sof_rt5682_codec_init':
    sof_rt5682.c:(.text+0x3e0): undefined reference to `sof_dai_get_mclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_cs42l42.o: in function `sof_cs42l42_hw_params':
    sof_cs42l42.c:(.text+0x2a): undefined reference to `sof_dai_get_bclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_nau8825.o: in function `sof_nau8825_hw_params':
    sof_nau8825.c:(.text+0x7f): undefined reference to `sof_dai_get_bclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_da7219.o: in function `da7219_codec_init':
    sof_da7219.c:(.text+0xbf): undefined reference to `sof_dai_get_mclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_maxim_common.o: in function `max_98373_hw_params':
    sof_maxim_common.c:(.text+0x6f9): undefined reference to `sof_dai_get_tdm_slots'
    x86_64-linux-ld: sound/soc/intel/boards/sof_realtek_common.o: in function `rt1015_hw_params':
    sof_realtek_common.c:(.text+0x54c): undefined reference to `sof_dai_get_bclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_realtek_common.o: in function `rt1308_hw_params':
    sof_realtek_common.c:(.text+0x702): undefined reference to `sof_dai_get_mclk'
    x86_64-linux-ld: sound/soc/intel/boards/sof_cirrus_common.o: in function `cs35l41_hw_params':
    sof_cirrus_common.c:(.text+0x2f): undefined reference to `sof_dai_get_bclk'
    
    Add an optional dependency on SND_SOC_SOF_INTEL_COMMON, to ensure that whenever
    the SOF support is in a loadable module, none of the board code can be built-in.
    
    This may be be a little heavy-handed, but I also don't see a reason why one would
    want the boards to be built-in but not the SoC, so it shouldn't actually cause
    any usability problems.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20250709145626.64125-1-arnd@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: ops: dynamically allocate struct snd_ctl_elem_value [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Jun 10 11:30:53 2025 +0200

    ASoC: ops: dynamically allocate struct snd_ctl_elem_value
    
    [ Upstream commit 7e10d7242ea8a5947878880b912ffa5806520705 ]
    
    This structure is really too larget to be allocated on the stack:
    
    sound/soc/soc-ops.c:435:5: error: stack frame size (1296) exceeds limit (1280) in 'snd_soc_limit_volume' [-Werror,-Wframe-larger-than]
    
    Change the function to dynamically allocate it instead.
    
    There is probably a better way to do it since only two integer fields
    inside of that structure are actually used, but this is the simplest
    rework for the moment.
    
    Fixes: 783db6851c18 ("ASoC: ops: Enforce platform maximum on initial value")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20250610093057.2643233-1-arnd@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe() [+ + +]
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Mon Mar 6 01:43:30 2023 +0000

    ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe()
    
    [ Upstream commit 5c5a7521e9364a40fe2c1b67ab79991e3e9085df ]
    
    dai->probed is used at snd_soc_pcm_dai_probe/remove(),
    and used to call real remove() function only when it was probed.
    
            int snd_soc_pcm_dai_probe(...)
            {
                    ...
                    for_each_rtd_dais(rtd, i, dai) {
                            ...
    
                            if (dai->driver->probe) {
    (A)                             int ret = dai->driver->probe(dai);
    
                                    if (ret < 0)
                                            return soc_dai_ret(dai, ret);
                            }
    
    =>                      dai->probed = 1;
                    }
                    ...
            }
    
            int snd_soc_pcm_dai_remove(...)
            {
                    ...
                    for_each_rtd_dais(rtd, i, dai) {
                            ...
    =>                      if (dai->probed &&
                                ...) {
                                    ...
                            }
    
    =>                      dai->probed = 0;
                    }
                    ...
            }
    
    But on probe() case, we need to check dai->probed before calling
    real probe() function at (A), otherwise real probe() might be called
    multi times (but real remove() will be called only once).
    This patch checks it at probe().
    
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87wn3u64e6.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: 0e270f32975f ("ASoC: fsl_sai: replace regmap_write with regmap_update_bits")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: soc-dai: tidyup return value of snd_soc_xlate_tdm_slot_mask() [+ + +]
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri Jun 6 01:59:15 2025 +0000

    ASoC: soc-dai: tidyup return value of snd_soc_xlate_tdm_slot_mask()
    
    [ Upstream commit f4c77d5af0a9cd0ee22617baa8b49d0e151fbda7 ]
    
    commit 7f1186a8d738661 ("ASoC: soc-dai: check return value at
    snd_soc_dai_set_tdm_slot()") checks return value of
    xlate_tdm_slot_mask() (A1)(A2).
    
            /*
             * ...
    (Y)      * TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask,
             * @rx_mask and @slot_width will be ignored.
             * ...
             */
            int snd_soc_dai_set_tdm_slot(...)
            {
                    ...
                    if (...)
    (A1)                    ret = dai->driver->ops->xlate_tdm_slot_mask(...);
                    else
    (A2)                    ret = snd_soc_xlate_tdm_slot_mask(...);
                    if (ret)
                            goto err;
                    ...
            }
    
    snd_soc_xlate_tdm_slot_mask() (A2) will return -EINVAL if slots was 0 (X),
    but snd_soc_dai_set_tdm_slot() allow to use it (Y).
    
    (A)     static int snd_soc_xlate_tdm_slot_mask(...)
            {
                    ...
                    if (!slots)
    (X)                     return -EINVAL;
                    ...
            }
    
    Call xlate_tdm_slot_mask() only if slots was non zero.
    
    Reported-by: Giedrius Trainavičius <giedrius@blokas.io>
    Closes: https://lore.kernel.org/r/CAMONXLtSL7iKyvH6w=CzPTxQdBECf++hn8RKL6Y4=M_ou2YHow@mail.gmail.com
    Fixes: 7f1186a8d738661 ("ASoC: soc-dai: check return value at snd_soc_dai_set_tdm_slot()")
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://patch.msgid.link/8734cdfx59.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: soc-dapm: set bias_level if snd_soc_dapm_set_bias_level() was successed [+ + +]
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri Jul 11 02:26:39 2025 +0000

    ASoC: soc-dapm: set bias_level if snd_soc_dapm_set_bias_level() was successed
    
    [ Upstream commit f40ecc2743652c0b0f19935f81baf57c601eb7f0 ]
    
    ASoC has 2 functions to set bias level.
            (A) snd_soc_dapm_force_bias_level()
            (B) snd_soc_dapm_set_bias_level()
    
    snd_soc_dapm_force_bias_level() (A) will set dapm->bias_level (a) if
    successed.
    
    (A)     int snd_soc_dapm_force_bias_level(...)
            {
                    ...
                    if (ret == 0)
    (a)                     dapm->bias_level = level;
                    ...
            }
    
    snd_soc_dapm_set_bias_level() (B) is also a function that sets bias_level.
    It will call snd_soc_dapm_force_bias_level() (A) inside, but doesn't
    set dapm->bias_level by itself. One note is that (A) might not be called.
    
    (B)     static int snd_soc_dapm_set_bias_level(...)
            {
                    ...
                    ret = snd_soc_card_set_bias_level(...);
                    ...
                    if (dapm != &card->dapm)
    (A)                     ret = snd_soc_dapm_force_bias_level(...);
                    ...
                    ret = snd_soc_card_set_bias_level_post(...);
                    ...
            }
    
    dapm->bias_level will be set if (A) was called, but might not be set
    if (B) was called, even though it calles set_bias_level() function.
    
    We should set dapm->bias_level if we calls
    snd_soc_dapm_set_bias_level() (B), too.
    
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://patch.msgid.link/87qzyn4g4h.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: Fix SATA_MOBILE_LPM_POLICY description in Kconfig [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Aug 21 14:18:16 2025 -0400

    ata: Fix SATA_MOBILE_LPM_POLICY description in Kconfig
    
    [ Upstream commit ed62a62a18bc144f73eadf866ae46842e8f6606e ]
    
    Improve the description of the possible default SATA link power
    management policies and add the missing description for policy 5.
    No functional changes.
    
    Fixes: a5ec5a7bfd1f ("ata: ahci: Support state with min power but Partial low power state")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ata: libata-sata: Disallow changing LPM state if not supported [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Tue Jul 1 21:53:16 2025 +0900

    ata: libata-sata: Disallow changing LPM state if not supported
    
    [ Upstream commit 413e800cadbf67550d76c77c230b2ecd96bce83a ]
    
    Modify ata_scsi_lpm_store() to return an error if a user attempts to set
    a link power management policy for a port that does not support LPM,
    that is, ports flagged with ATA_FLAG_NO_LPM.
    
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Link: https://lore.kernel.org/r/20250701125321.69496-6-dlemoal@kernel.org
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: libata-scsi: Fix ata_to_sense_error() status handling [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Tue Jul 29 18:28:07 2025 +0900

    ata: libata-scsi: Fix ata_to_sense_error() status handling
    
    commit cf3fc037623c54de48d2ec1a1ee686e2d1de2d45 upstream.
    
    Commit 8ae720449fca ("libata: whitespace fixes in ata_to_sense_error()")
    inadvertantly added the entry 0x40 (ATA_DRDY) to the stat_table array in
    the function ata_to_sense_error(). This entry ties a failed qc which has
    a status filed equal to ATA_DRDY to the sense key ILLEGAL REQUEST with
    the additional sense code UNALIGNED WRITE COMMAND. This entry will be
    used to generate a failed qc sense key and sense code when the qc is
    missing sense data and there is no match for the qc error field in the
    sense_table array of ata_to_sense_error().
    
    As a result, for a failed qc for which we failed to get sense data (e.g.
    read log 10h failed if qc is an NCQ command, or REQUEST SENSE EXT
    command failed for the non-ncq case, the user very often end up seeing
    the completely misleading "unaligned write command" error, even if qc
    was not a write command. E.g.:
    
    sd 0:0:0:0: [sda] tag#12 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
    sd 0:0:0:0: [sda] tag#12 Sense Key : Illegal Request [current]
    sd 0:0:0:0: [sda] tag#12 Add. Sense: Unaligned write command
    sd 0:0:0:0: [sda] tag#12 CDB: Read(10) 28 00 00 00 10 00 00 00 08 00
    I/O error, dev sda, sector 4096 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
    
    Fix this by removing the ATA_DRDY entry from the stat_table array so
    that we default to always returning ABORTED COMMAND without any
    additional sense code, since we do not know any better. The entry 0x08
    (ATA_DRQ) is also removed since signaling ABORTED COMMAND with a parity
    error is also misleading (as a parity error would likely be signaled
    through a bus error). So for this case, also default to returning
    ABORTED COMMAND without any additional sense code. With this, the
    previous example error case becomes:
    
    sd 0:0:0:0: [sda] tag#17 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
    sd 0:0:0:0: [sda] tag#17 Sense Key : Aborted Command [current]
    sd 0:0:0:0: [sda] tag#17 Add. Sense: No additional sense information
    sd 0:0:0:0: [sda] tag#17 CDB: Read(10) 28 00 00 00 10 00 00 00 08 00
    I/O error, dev sda, sector 4096 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
    
    Together with these fixes, refactor stat_table to make it more readable
    by putting the entries comments in front of the entries and using the
    defined status bits macros instead of hardcoded values.
    
    Reported-by: Lorenz Brun <lorenz@brun.one>
    Reported-by: Brandon Schwartz <Brandon.Schwartz@wdc.com>
    Fixes: 8ae720449fca ("libata: whitespace fixes in ata_to_sense_error()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
be2net: Use correct byte order and format string for TCP seq and ack_seq [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Thu Jul 17 12:35:47 2025 -0700

    be2net: Use correct byte order and format string for TCP seq and ack_seq
    
    [ Upstream commit 4701ee5044fb3992f1c910630a9673c2dc600ce5 ]
    
    The TCP header fields seq and ack_seq are 32-bit values in network
    byte order as (__be32). these fields were earlier printed using
    ntohs(), which converts only 16-bit values and produces incorrect
    results for 32-bit fields. This patch is changeing the conversion
    to ntohl(), ensuring correct interpretation of these sequence numbers.
    
    Notably, the format specifier is updated from %d to %u to reflect the
    unsigned nature of these fields.
    
    improves the accuracy of debug log messages for TCP sequence and
    acknowledgment numbers during TX timeouts.
    
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250717193552.3648791-1-alok.a.tiwari@oracle.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
benet: fix BUG when creating VFs [+ + +]
Author: Michal Schmidt <mschmidt@redhat.com>
Date:   Fri Aug 1 12:13:37 2025 +0200

    benet: fix BUG when creating VFs
    
    [ Upstream commit 5a40f8af2ba1b9bdf46e2db10e8c9710538fbc63 ]
    
    benet crashes as soon as SRIOV VFs are created:
    
     kernel BUG at mm/vmalloc.c:3457!
     Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
     CPU: 4 UID: 0 PID: 7408 Comm: test.sh Kdump: loaded Not tainted 6.16.0+ #1 PREEMPT(voluntary)
     [...]
     RIP: 0010:vunmap+0x5f/0x70
     [...]
     Call Trace:
      <TASK>
      __iommu_dma_free+0xe8/0x1c0
      be_cmd_set_mac_list+0x3fe/0x640 [be2net]
      be_cmd_set_mac+0xaf/0x110 [be2net]
      be_vf_eth_addr_config+0x19f/0x330 [be2net]
      be_vf_setup+0x4f7/0x990 [be2net]
      be_pci_sriov_configure+0x3a1/0x470 [be2net]
      sriov_numvfs_store+0x20b/0x380
      kernfs_fop_write_iter+0x354/0x530
      vfs_write+0x9b9/0xf60
      ksys_write+0xf3/0x1d0
      do_syscall_64+0x8c/0x3d0
    
    be_cmd_set_mac_list() calls dma_free_coherent() under a spin_lock_bh.
    Fix it by freeing only after the lock has been released.
    
    Fixes: 1a82d19ca2d6 ("be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink")
    Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
    Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/20250801101338.72502-1-mschmidt@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: better lockdep annotations for simple_recursive_removal() [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Wed Jul 2 22:30:32 2025 -0400

    better lockdep annotations for simple_recursive_removal()
    
    [ Upstream commit 2a8061ee5e41034eb14170ec4517b5583dbeff9f ]
    
    We want a class that nests outside of I_MUTEX_NORMAL (for the sake of
    callbacks that might want to lock the victim) and inside I_MUTEX_PARENT
    (so that a variant of that could be used with parent of the victim
    held locked by the caller).
    
    In reality, simple_recursive_removal()
            * never holds two locks at once
            * holds the lock on parent of dentry passed to callback
            * is used only on the trees with fixed topology, so the depths
    are not changing.
    
    So the locking order is actually fine.
    
    AFAICS, the best solution is to assign I_MUTEX_CHILD to the locks
    grabbed by that thing.
    
    Reported-by: syzbot+169de184e9defe7fe709@syzkaller.appspotmail.com
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block: avoid possible overflow for chunk_sectors check in blk_stack_limits() [+ + +]
Author: John Garry <john.g.garry@oracle.com>
Date:   Tue Jul 29 09:14:47 2025 +0000

    block: avoid possible overflow for chunk_sectors check in blk_stack_limits()
    
    [ Upstream commit 448dfecc7ff807822ecd47a5c052acedca7d09e8 ]
    
    In blk_stack_limits(), we check that the t->chunk_sectors value is a
    multiple of the t->physical_block_size value.
    
    However, by finding the chunk_sectors value in bytes, we may overflow
    the unsigned int which holds chunk_sectors, so change the check to be
    based on sectors.
    
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: John Garry <john.g.garry@oracle.com>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Link: https://lore.kernel.org/r/20250729091448.1691334-2-john.g.garry@oracle.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

block: don't call rq_qos_ops->done_bio if the bio isn't tracked [+ + +]
Author: Ming Lei <ming.lei@redhat.com>
Date:   Fri Sep 24 19:07:04 2021 +0800

    block: don't call rq_qos_ops->done_bio if the bio isn't tracked
    
    commit a647a524a46736786c95cdb553a070322ca096e3 upstream.
    
    rq_qos framework is only applied on request based driver, so:
    
    1) rq_qos_done_bio() needn't to be called for bio based driver
    
    2) rq_qos_done_bio() needn't to be called for bio which isn't tracked,
    such as bios ended from error handling code.
    
    Especially in bio_endio():
    
    1) request queue is referred via bio->bi_bdev->bd_disk->queue, which
    may be gone since request queue refcount may not be held in above two
    cases
    
    2) q->rq_qos may be freed in blk_cleanup_queue() when calling into
    __rq_qos_done_bio()
    
    Fix the potential kernel panic by not calling rq_qos_ops->done_bio if
    the bio isn't tracked. This way is safe because both ioc_rqos_done_bio()
    and blkcg_iolatency_done_bio() are nop if the bio isn't tracked.
    
    Reported-by: Yu Kuai <yukuai3@huawei.com>
    Cc: tj@kernel.org
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Tejun Heo <tj@kernel.org>
    Link: https://lore.kernel.org/r/20210924110704.1541818-1-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    [ Shivani: Modified to apply on 5.10.y ]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

block: Make REQ_OP_ZONE_FINISH a write operation [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Sat Aug 16 21:49:28 2025 -0400

    block: Make REQ_OP_ZONE_FINISH a write operation
    
    [ Upstream commit 3f66ccbaaef3a0c5bd844eab04e3207b4061c546 ]
    
    REQ_OP_ZONE_FINISH is defined as "12", which makes
    op_is_write(REQ_OP_ZONE_FINISH) return false, despite the fact that a
    zone finish operation is an operation that modifies a zone (transition
    it to full) and so should be considered as a write operation (albeit
    one that does not transfer any data to the device).
    
    Fix this by redefining REQ_OP_ZONE_FINISH to be an odd number (13), and
    redefine REQ_OP_ZONE_RESET and REQ_OP_ZONE_RESET_ALL using sequential
    odd numbers from that new value.
    
    Fixes: 6c1b1da58f8c ("block: add zone open, close and finish operations")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250625093327.548866-2-dlemoal@kernel.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    [ Extra renames ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: Fix null-ptr-deref in l2cap_sock_resume_cb() [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Mon Jul 7 19:28:29 2025 +0000

    Bluetooth: Fix null-ptr-deref in l2cap_sock_resume_cb()
    
    [ Upstream commit a0075accbf0d76c2dad1ad3993d2e944505d99a0 ]
    
    syzbot reported null-ptr-deref in l2cap_sock_resume_cb(). [0]
    
    l2cap_sock_resume_cb() has a similar problem that was fixed by commit
    1bff51ea59a9 ("Bluetooth: fix use-after-free error in lock_sock_nested()").
    
    Since both l2cap_sock_kill() and l2cap_sock_resume_cb() are executed
    under l2cap_sock_resume_cb(), we can avoid the issue simply by checking
    if chan->data is NULL.
    
    Let's not access to the killed socket in l2cap_sock_resume_cb().
    
    [0]:
    BUG: KASAN: null-ptr-deref in instrument_atomic_write include/linux/instrumented.h:82 [inline]
    BUG: KASAN: null-ptr-deref in clear_bit include/asm-generic/bitops/instrumented-atomic.h:41 [inline]
    BUG: KASAN: null-ptr-deref in l2cap_sock_resume_cb+0xb4/0x17c net/bluetooth/l2cap_sock.c:1711
    Write of size 8 at addr 0000000000000570 by task kworker/u9:0/52
    
    CPU: 1 UID: 0 PID: 52 Comm: kworker/u9:0 Not tainted 6.16.0-rc4-syzkaller-g7482bb149b9f #0 PREEMPT
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
    Workqueue: hci0 hci_rx_work
    Call trace:
     show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:501 (C)
     __dump_stack+0x30/0x40 lib/dump_stack.c:94
     dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120
     print_report+0x58/0x84 mm/kasan/report.c:524
     kasan_report+0xb0/0x110 mm/kasan/report.c:634
     check_region_inline mm/kasan/generic.c:-1 [inline]
     kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:189
     __kasan_check_write+0x20/0x30 mm/kasan/shadow.c:37
     instrument_atomic_write include/linux/instrumented.h:82 [inline]
     clear_bit include/asm-generic/bitops/instrumented-atomic.h:41 [inline]
     l2cap_sock_resume_cb+0xb4/0x17c net/bluetooth/l2cap_sock.c:1711
     l2cap_security_cfm+0x524/0xea0 net/bluetooth/l2cap_core.c:7357
     hci_auth_cfm include/net/bluetooth/hci_core.h:2092 [inline]
     hci_auth_complete_evt+0x2e8/0xa4c net/bluetooth/hci_event.c:3514
     hci_event_func net/bluetooth/hci_event.c:7511 [inline]
     hci_event_packet+0x650/0xe9c net/bluetooth/hci_event.c:7565
     hci_rx_work+0x320/0xb18 net/bluetooth/hci_core.c:4070
     process_one_work+0x7e8/0x155c kernel/workqueue.c:3238
     process_scheduled_works kernel/workqueue.c:3321 [inline]
     worker_thread+0x958/0xed8 kernel/workqueue.c:3402
     kthread+0x5fc/0x75c kernel/kthread.c:464
     ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:847
    
    Fixes: d97c899bde33 ("Bluetooth: Introduce L2CAP channel callback for resuming")
    Reported-by: syzbot+e4d73b165c3892852d22@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/686c12bd.a70a0220.29fe6c.0b13.GAE@google.com/
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: L2CAP: Fix attempting to adjust outgoing MTU [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Jul 16 09:40:49 2025 -0400

    Bluetooth: L2CAP: Fix attempting to adjust outgoing MTU
    
    [ Upstream commit d24e4a7fedae121d33fb32ad785b87046527eedb ]
    
    Configuration request only configure the incoming direction of the peer
    initiating the request, so using the MTU is the other direction shall
    not be used, that said the spec allows the peer responding to adjust:
    
    Bluetooth Core 6.1, Vol 3, Part A, Section 4.5
    
     'Each configuration parameter value (if any is present) in an
     L2CAP_CONFIGURATION_RSP packet reflects an ‘adjustment’ to a
     configuration parameter value that has been sent (or, in case of
     default values, implied) in the corresponding
     L2CAP_CONFIGURATION_REQ packet.'
    
    That said adjusting the MTU in the response shall be limited to ERTM
    channels only as for older modes the remote stack may not be able to
    detect the adjustment causing it to silently drop packets.
    
    Link: https://github.com/bluez/bluez/issues/1422
    Link: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/149
    Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4793
    Fixes: 042bb9603c44 ("Bluetooth: L2CAP: Fix L2CAP MTU negotiation")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: SMP: Fix using HCI_ERROR_REMOTE_USER_TERM on timeout [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Jul 2 11:53:40 2025 -0400

    Bluetooth: SMP: Fix using HCI_ERROR_REMOTE_USER_TERM on timeout
    
    [ Upstream commit 6ef99c917688a8510259e565bd1b168b7146295a ]
    
    This replaces the usage of HCI_ERROR_REMOTE_USER_TERM, which as the name
    suggest is to indicate a regular disconnection initiated by an user,
    with HCI_ERROR_AUTH_FAILURE to indicate the session has timeout thus any
    pairing shall be considered as failed.
    
    Fixes: 1e91c29eb60c ("Bluetooth: Use hci_disconnect for immediate disconnection from SMP")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: SMP: If an unallowed command is received consider it a failure [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Mon Jun 30 14:42:23 2025 -0400

    Bluetooth: SMP: If an unallowed command is received consider it a failure
    
    [ Upstream commit fe4840df0bdf341f376885271b7680764fe6b34e ]
    
    If a command is received while a bonding is ongoing consider it a
    pairing failure so the session is cleanup properly and the device is
    disconnected immediately instead of continuing with other commands that
    may result in the session to get stuck without ever completing such as
    the case bellow:
    
    > ACL Data RX: Handle 2048 flags 0x02 dlen 21
          SMP: Identity Information (0x08) len 16
            Identity resolving key[16]: d7e08edef97d3e62cd2331f82d8073b0
    > ACL Data RX: Handle 2048 flags 0x02 dlen 21
          SMP: Signing Information (0x0a) len 16
            Signature key[16]: 1716c536f94e843a9aea8b13ffde477d
    Bluetooth: hci0: unexpected SMP command 0x0a from XX:XX:XX:XX:XX:XX
    > ACL Data RX: Handle 2048 flags 0x02 dlen 12
          SMP: Identity Address Information (0x09) len 7
            Address: XX:XX:XX:XX:XX:XX (Intel Corporate)
    
    While accourding to core spec 6.1 the expected order is always BD_ADDR
    first first then CSRK:
    
    When using LE legacy pairing, the keys shall be distributed in the
    following order:
    
        LTK by the Peripheral
    
        EDIV and Rand by the Peripheral
    
        IRK by the Peripheral
    
        BD_ADDR by the Peripheral
    
        CSRK by the Peripheral
    
        LTK by the Central
    
        EDIV and Rand by the Central
    
        IRK by the Central
    
        BD_ADDR by the Central
    
        CSRK by the Central
    
    When using LE Secure Connections, the keys shall be distributed in the
    following order:
    
        IRK by the Peripheral
    
        BD_ADDR by the Peripheral
    
        CSRK by the Peripheral
    
        IRK by the Central
    
        BD_ADDR by the Central
    
        CSRK by the Central
    
    According to the Core 6.1 for commands used for key distribution "Key
    Rejected" can be used:
    
      '3.6.1. Key distribution and generation
    
      A device may reject a distributed key by sending the Pairing Failed command
      with the reason set to "Key Rejected".
    
    Fixes: b28b4943660f ("Bluetooth: Add strict checks for allowed SMP PDUs")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf, ktls: Fix data corruption when using bpf_msg_pop_data() in ktls [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Mon Jun 9 10:08:52 2025 +0800

    bpf, ktls: Fix data corruption when using bpf_msg_pop_data() in ktls
    
    [ Upstream commit 178f6a5c8cb3b6be1602de0964cd440243f493c9 ]
    
    When sending plaintext data, we initially calculated the corresponding
    ciphertext length. However, if we later reduced the plaintext data length
    via socket policy, we failed to recalculate the ciphertext length.
    
    This results in transmitting buffers containing uninitialized data during
    ciphertext transmission.
    
    This causes uninitialized bytes to be appended after a complete
    "Application Data" packet, leading to errors on the receiving end when
    parsing TLS record.
    
    Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling")
    Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/bpf/20250609020910.397930-2-jiayuan.chen@linux.dev
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf: Check flow_dissector ctx accesses are aligned [+ + +]
Author: Paul Chaignon <paul.chaignon@gmail.com>
Date:   Fri Aug 1 11:47:23 2025 +0200

    bpf: Check flow_dissector ctx accesses are aligned
    
    [ Upstream commit ead3d7b2b6afa5ee7958620c4329982a7d9c2b78 ]
    
    flow_dissector_is_valid_access doesn't check that the context access is
    aligned. As a consequence, an unaligned access within one of the exposed
    field is considered valid and later rejected by
    flow_dissector_convert_ctx_access when we try to convert it.
    
    The later rejection is problematic because it's reported as a verifier
    bug with a kernel warning and doesn't point to the right instruction in
    verifier logs.
    
    Fixes: d58e468b1112 ("flow_dissector: implements flow dissector BPF hook")
    Reported-by: syzbot+ccac90e482b2a81d74aa@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=ccac90e482b2a81d74aa
    Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
    Acked-by: Yonghong Song <yonghong.song@linux.dev>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/cc1b036be484c99be45eddf48bd78cc6f72839b1.1754039605.git.paul.chaignon@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure [+ + +]
Author: Yuan Chen <chenyuan@kylinos.cn>
Date:   Fri Jun 20 09:21:33 2025 +0800

    bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure
    
    [ Upstream commit 99fe8af069a9fa5b09140518b1364e35713a642e ]
    
    In function dump_xx_nlmsg(), when realloc() fails to allocate memory,
    the original pointer to the buffer is overwritten with NULL. This causes
    a memory leak because the previously allocated buffer becomes unreachable
    without being freed.
    
    Fixes: 7900efc19214 ("tools/bpf: bpftool: improve output format for bpftool net")
    Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
    Reviewed-by: Quentin Monnet <qmo@kernel.org>
    Link: https://lore.kernel.org/r/20250620012133.14819-1-chenyuan_fl@163.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
btrfs: fix deadlock when cloning inline extents and using qgroups [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Thu Apr 22 12:08:05 2021 +0100

    btrfs: fix deadlock when cloning inline extents and using qgroups
    
    commit f9baa501b4fd6962257853d46ddffbc21f27e344 upstream.
    
    There are a few exceptional cases where cloning an inline extent needs to
    copy the inline extent data into a page of the destination inode.
    
    When this happens, we end up starting a transaction while having a dirty
    page for the destination inode and while having the range locked in the
    destination's inode iotree too. Because when reserving metadata space
    for a transaction we may need to flush existing delalloc in case there is
    not enough free space, we have a mechanism in place to prevent a deadlock,
    which was introduced in commit 3d45f221ce627d ("btrfs: fix deadlock when
    cloning inline extent and low on free metadata space").
    
    However when using qgroups, a transaction also reserves metadata qgroup
    space, which can also result in flushing delalloc in case there is not
    enough available space at the moment. When this happens we deadlock, since
    flushing delalloc requires locking the file range in the inode's iotree
    and the range was already locked at the very beginning of the clone
    operation, before attempting to start the transaction.
    
    When this issue happens, stack traces like the following are reported:
    
      [72747.556262] task:kworker/u81:9   state:D stack:    0 pid:  225 ppid:     2 flags:0x00004000
      [72747.556268] Workqueue: writeback wb_workfn (flush-btrfs-1142)
      [72747.556271] Call Trace:
      [72747.556273]  __schedule+0x296/0x760
      [72747.556277]  schedule+0x3c/0xa0
      [72747.556279]  io_schedule+0x12/0x40
      [72747.556284]  __lock_page+0x13c/0x280
      [72747.556287]  ? generic_file_readonly_mmap+0x70/0x70
      [72747.556325]  extent_write_cache_pages+0x22a/0x440 [btrfs]
      [72747.556331]  ? __set_page_dirty_nobuffers+0xe7/0x160
      [72747.556358]  ? set_extent_buffer_dirty+0x5e/0x80 [btrfs]
      [72747.556362]  ? update_group_capacity+0x25/0x210
      [72747.556366]  ? cpumask_next_and+0x1a/0x20
      [72747.556391]  extent_writepages+0x44/0xa0 [btrfs]
      [72747.556394]  do_writepages+0x41/0xd0
      [72747.556398]  __writeback_single_inode+0x39/0x2a0
      [72747.556403]  writeback_sb_inodes+0x1ea/0x440
      [72747.556407]  __writeback_inodes_wb+0x5f/0xc0
      [72747.556410]  wb_writeback+0x235/0x2b0
      [72747.556414]  ? get_nr_inodes+0x35/0x50
      [72747.556417]  wb_workfn+0x354/0x490
      [72747.556420]  ? newidle_balance+0x2c5/0x3e0
      [72747.556424]  process_one_work+0x1aa/0x340
      [72747.556426]  worker_thread+0x30/0x390
      [72747.556429]  ? create_worker+0x1a0/0x1a0
      [72747.556432]  kthread+0x116/0x130
      [72747.556435]  ? kthread_park+0x80/0x80
      [72747.556438]  ret_from_fork+0x1f/0x30
    
      [72747.566958] Workqueue: btrfs-flush_delalloc btrfs_work_helper [btrfs]
      [72747.566961] Call Trace:
      [72747.566964]  __schedule+0x296/0x760
      [72747.566968]  ? finish_wait+0x80/0x80
      [72747.566970]  schedule+0x3c/0xa0
      [72747.566995]  wait_extent_bit.constprop.68+0x13b/0x1c0 [btrfs]
      [72747.566999]  ? finish_wait+0x80/0x80
      [72747.567024]  lock_extent_bits+0x37/0x90 [btrfs]
      [72747.567047]  btrfs_invalidatepage+0x299/0x2c0 [btrfs]
      [72747.567051]  ? find_get_pages_range_tag+0x2cd/0x380
      [72747.567076]  __extent_writepage+0x203/0x320 [btrfs]
      [72747.567102]  extent_write_cache_pages+0x2bb/0x440 [btrfs]
      [72747.567106]  ? update_load_avg+0x7e/0x5f0
      [72747.567109]  ? enqueue_entity+0xf4/0x6f0
      [72747.567134]  extent_writepages+0x44/0xa0 [btrfs]
      [72747.567137]  ? enqueue_task_fair+0x93/0x6f0
      [72747.567140]  do_writepages+0x41/0xd0
      [72747.567144]  __filemap_fdatawrite_range+0xc7/0x100
      [72747.567167]  btrfs_run_delalloc_work+0x17/0x40 [btrfs]
      [72747.567195]  btrfs_work_helper+0xc2/0x300 [btrfs]
      [72747.567200]  process_one_work+0x1aa/0x340
      [72747.567202]  worker_thread+0x30/0x390
      [72747.567205]  ? create_worker+0x1a0/0x1a0
      [72747.567208]  kthread+0x116/0x130
      [72747.567211]  ? kthread_park+0x80/0x80
      [72747.567214]  ret_from_fork+0x1f/0x30
    
      [72747.569686] task:fsstress        state:D stack:    0 pid:841421 ppid:841417 flags:0x00000000
      [72747.569689] Call Trace:
      [72747.569691]  __schedule+0x296/0x760
      [72747.569694]  schedule+0x3c/0xa0
      [72747.569721]  try_flush_qgroup+0x95/0x140 [btrfs]
      [72747.569725]  ? finish_wait+0x80/0x80
      [72747.569753]  btrfs_qgroup_reserve_data+0x34/0x50 [btrfs]
      [72747.569781]  btrfs_check_data_free_space+0x5f/0xa0 [btrfs]
      [72747.569804]  btrfs_buffered_write+0x1f7/0x7f0 [btrfs]
      [72747.569810]  ? path_lookupat.isra.48+0x97/0x140
      [72747.569833]  btrfs_file_write_iter+0x81/0x410 [btrfs]
      [72747.569836]  ? __kmalloc+0x16a/0x2c0
      [72747.569839]  do_iter_readv_writev+0x160/0x1c0
      [72747.569843]  do_iter_write+0x80/0x1b0
      [72747.569847]  vfs_writev+0x84/0x140
      [72747.569869]  ? btrfs_file_llseek+0x38/0x270 [btrfs]
      [72747.569873]  do_writev+0x65/0x100
      [72747.569876]  do_syscall_64+0x33/0x40
      [72747.569879]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
      [72747.569899] task:fsstress        state:D stack:    0 pid:841424 ppid:841417 flags:0x00004000
      [72747.569903] Call Trace:
      [72747.569906]  __schedule+0x296/0x760
      [72747.569909]  schedule+0x3c/0xa0
      [72747.569936]  try_flush_qgroup+0x95/0x140 [btrfs]
      [72747.569940]  ? finish_wait+0x80/0x80
      [72747.569967]  __btrfs_qgroup_reserve_meta+0x36/0x50 [btrfs]
      [72747.569989]  start_transaction+0x279/0x580 [btrfs]
      [72747.570014]  clone_copy_inline_extent+0x332/0x490 [btrfs]
      [72747.570041]  btrfs_clone+0x5b7/0x7a0 [btrfs]
      [72747.570068]  ? lock_extent_bits+0x64/0x90 [btrfs]
      [72747.570095]  btrfs_clone_files+0xfc/0x150 [btrfs]
      [72747.570122]  btrfs_remap_file_range+0x3d8/0x4a0 [btrfs]
      [72747.570126]  do_clone_file_range+0xed/0x200
      [72747.570131]  vfs_clone_file_range+0x37/0x110
      [72747.570134]  ioctl_file_clone+0x7d/0xb0
      [72747.570137]  do_vfs_ioctl+0x138/0x630
      [72747.570140]  __x64_sys_ioctl+0x62/0xc0
      [72747.570143]  do_syscall_64+0x33/0x40
      [72747.570146]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    So fix this by skipping the flush of delalloc for an inode that is
    flagged with BTRFS_INODE_NO_DELALLOC_FLUSH, meaning it is currently under
    such a special case of cloning an inline extent, when flushing delalloc
    during qgroup metadata reservation.
    
    The special cases for cloning inline extents were added in kernel 5.7 by
    by commit 05a5a7621ce66c ("Btrfs: implement full reflink support for
    inline extents"), while having qgroup metadata space reservation flushing
    delalloc when low on space was added in kernel 5.9 by commit
    c53e9653605dbf ("btrfs: qgroup: try to flush qgroup space when we get
    -EDQUOT"). So use a "Fixes:" tag for the later commit to ease stable
    kernel backports.
    
    Reported-by: Wang Yugui <wangyugui@e16-tech.com>
    Link: https://lore.kernel.org/linux-btrfs/20210421083137.31E3.409509F4@e16-tech.com/
    Fixes: c53e9653605dbf ("btrfs: qgroup: try to flush qgroup space when we get -EDQUOT")
    CC: stable@vger.kernel.org # 5.9+
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    [ Shivani: Modified to apply on 5.10.y, Passed false to
      btrfs_start_delalloc_flush() in fs/btrfs/transaction.c file to
      maintain the default behaviour ]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: fix log tree replay failure due to file with 0 links and extents [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Wed Jul 30 19:18:37 2025 +0100

    btrfs: fix log tree replay failure due to file with 0 links and extents
    
    commit 0a32e4f0025a74c70dcab4478e9b29c22f5ecf2f upstream.
    
    If we log a new inode (not persisted in a past transaction) that has 0
    links and extents, then log another inode with an higher inode number, we
    end up with failing to replay the log tree with -EINVAL. The steps for
    this are:
    
    1) create new file A
    2) write some data to file A
    3) open an fd on file A
    4) unlink file A
    5) fsync file A using the previously open fd
    6) create file B (has higher inode number than file A)
    7) fsync file B
    8) power fail before current transaction commits
    
    Now when attempting to mount the fs, the log replay will fail with
    -ENOENT at replay_one_extent() when attempting to replay the first
    extent of file A. The failure comes when trying to open the inode for
    file A in the subvolume tree, since it doesn't exist.
    
    Before commit 5f61b961599a ("btrfs: fix inode lookup error handling
    during log replay"), the returned error was -EIO instead of -ENOENT,
    since we converted any errors when attempting to read an inode during
    log replay to -EIO.
    
    The reason for this is that the log replay procedure fails to ignore
    the current inode when we are at the stage LOG_WALK_REPLAY_ALL, our
    current inode has 0 links and last inode we processed in the previous
    stage has a non 0 link count. In other words, the issue is that at
    replay_one_extent() we only update wc->ignore_cur_inode if the current
    replay stage is LOG_WALK_REPLAY_INODES.
    
    Fix this by updating wc->ignore_cur_inode whenever we find an inode item
    regardless of the current replay stage. This is a simple solution and easy
    to backport, but later we can do other alternatives like avoid logging
    extents or inode items other than the inode item for inodes with a link
    count of 0.
    
    The problem with the wc->ignore_cur_inode logic has been around since
    commit f2d72f42d5fa ("Btrfs: fix warning when replaying log after fsync
    of a tmpfile") but it only became frequent to hit since the more recent
    commit 5e85262e542d ("btrfs: fix fsync of files with no hard links not
    persisting deletion"), because we stopped skipping inodes with a link
    count of 0 when logging, while before the problem would only be triggered
    if trying to replay a log tree created with an older kernel which has a
    logged inode with 0 links.
    
    A test case for fstests will be submitted soon.
    
    Reported-by: Peter Jung <ptr1337@cachyos.org>
    Link: https://lore.kernel.org/linux-btrfs/fce139db-4458-4788-bb97-c29acf6cb1df@cachyos.org/
    Reported-by: burneddi <burneddi@protonmail.com>
    Link: https://lore.kernel.org/linux-btrfs/lh4W-Lwc0Mbk-QvBhhQyZxf6VbM3E8VtIvU3fPIQgweP_Q1n7wtlUZQc33sYlCKYd-o6rryJQfhHaNAOWWRKxpAXhM8NZPojzsJPyHMf2qY=@protonmail.com/#t
    Reported-by: Russell Haley <yumpusamongus@gmail.com>
    Link: https://lore.kernel.org/linux-btrfs/598ecc75-eb80-41b3-83c2-f2317fbb9864@gmail.com/
    Fixes: f2d72f42d5fa ("Btrfs: fix warning when replaying log after fsync of a tmpfile")
    CC: stable@vger.kernel.org # 5.4+
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: populate otime when logging an inode item [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Tue Aug 19 10:33:27 2025 -0400

    btrfs: populate otime when logging an inode item
    
    [ Upstream commit 1ef94169db0958d6de39f9ea6e063ce887342e2d ]
    
    [TEST FAILURE WITH EXPERIMENTAL FEATURES]
    When running test case generic/508, the test case will fail with the new
    btrfs shutdown support:
    
    generic/508       - output mismatch (see /home/adam/xfstests/results//generic/508.out.bad)
    #    --- tests/generic/508.out  2022-05-11 11:25:30.806666664 +0930
    #    +++ /home/adam/xfstests/results//generic/508.out.bad       2025-07-02 14:53:22.401824212 +0930
    #    @@ -1,2 +1,6 @@
    #     QA output created by 508
    #     Silence is golden
    #    +Before:
    #    +After : stat.btime = Thu Jan  1 09:30:00 1970
    #    +Before:
    #    +After : stat.btime = Wed Jul  2 14:53:22 2025
    #    ...
    #    (Run 'diff -u /home/adam/xfstests/tests/generic/508.out /home/adam/xfstests/results//generic/508.out.bad'  to see the entire diff)
    Ran: generic/508
    Failures: generic/508
    Failed 1 of 1 tests
    
    Please note that the test case requires shutdown support, thus the test
    case will be skipped using the current upstream kernel, as it doesn't
    have shutdown ioctl support.
    
    [CAUSE]
    The direct cause the 0 time stamp in the log tree:
    
    leaf 30507008 items 2 free space 16057 generation 9 owner TREE_LOG
    leaf 30507008 flags 0x1(WRITTEN) backref revision 1
    checksum stored e522548d
    checksum calced e522548d
    fs uuid 57d45451-481e-43e4-aa93-289ad707a3a0
    chunk uuid d52bd3fd-5163-4337-98a7-7986993ad398
            item 0 key (257 INODE_ITEM 0) itemoff 16123 itemsize 160
                    generation 9 transid 9 size 0 nbytes 0
                    block group 0 mode 100644 links 1 uid 0 gid 0 rdev 0
                    sequence 1 flags 0x0(none)
                    atime 1751432947.492000000 (2025-07-02 14:39:07)
                    ctime 1751432947.492000000 (2025-07-02 14:39:07)
                    mtime 1751432947.492000000 (2025-07-02 14:39:07)
                    otime 0.0 (1970-01-01 09:30:00) <<<
    
    But the old fs tree has all the correct time stamp:
    
    btrfs-progs v6.12
    fs tree key (FS_TREE ROOT_ITEM 0)
    leaf 30425088 items 2 free space 16061 generation 5 owner FS_TREE
    leaf 30425088 flags 0x1(WRITTEN) backref revision 1
    checksum stored 48f6c57e
    checksum calced 48f6c57e
    fs uuid 57d45451-481e-43e4-aa93-289ad707a3a0
    chunk uuid d52bd3fd-5163-4337-98a7-7986993ad398
            item 0 key (256 INODE_ITEM 0) itemoff 16123 itemsize 160
                    generation 3 transid 0 size 0 nbytes 16384
                    block group 0 mode 40755 links 1 uid 0 gid 0 rdev 0
                    sequence 0 flags 0x0(none)
                    atime 1751432947.0 (2025-07-02 14:39:07)
                    ctime 1751432947.0 (2025-07-02 14:39:07)
                    mtime 1751432947.0 (2025-07-02 14:39:07)
                    otime 1751432947.0 (2025-07-02 14:39:07) <<<
    
    The root cause is that fill_inode_item() in tree-log.c is only
    populating a/c/m time, not the otime (or btime in statx output).
    
    Part of the reason is that, the vfs inode only has a/c/m time, no native
    btime support yet.
    
    [FIX]
    Thankfully btrfs has its otime stored in btrfs_inode::i_otime_sec and
    btrfs_inode::i_otime_nsec.
    
    So what we really need is just fill the otime time stamp in
    fill_inode_item() of tree-log.c
    
    There is another fill_inode_item() in inode.c, which is doing the proper
    otime population.
    
    Fixes: 94edf4ae43a5 ("Btrfs: don't bother committing delayed inode updates when fsyncing")
    CC: stable@vger.kernel.org
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    [ Adapted token-based API calls ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bus: mhi: host: Fix endianness of BHI vector table [+ + +]
Author: Alexander Wilhelm <alexander.wilhelm@westermo.com>
Date:   Mon May 19 16:58:37 2025 +0200

    bus: mhi: host: Fix endianness of BHI vector table
    
    commit f471578e8b1a90623674433a01a8845110bc76ce upstream.
    
    On big endian platform like PowerPC, the MHI bus (which is little endian)
    does not start properly. The following example shows the error messages by
    using QCN9274 WLAN device with ath12k driver:
    
        ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit]
        ath12k_pci 0001:01:00.0: MSI vectors: 1
        ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0
        ath12k_pci 0001:01:00.0: failed to set mhi state: POWER_ON(2)
        ath12k_pci 0001:01:00.0: failed to start mhi: -110
        ath12k_pci 0001:01:00.0: failed to power up :-110
        ath12k_pci 0001:01:00.0: failed to create soc core: -110
        ath12k_pci 0001:01:00.0: failed to init core: -110
        ath12k_pci: probe of 0001:01:00.0 failed with error -110
    
    The issue seems to be with the incorrect DMA address/size used for
    transferring the firmware image over BHI. So fix it by converting the DMA
    address and size of the BHI vector table to little endian format before
    sending them to the device.
    
    Fixes: 6cd330ae76ff ("bus: mhi: core: Add support for ringing channel/event ring doorbells")
    Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
    [mani: added stable tag and reworded commit message]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
    Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250519145837.958153-1-alexander.wilhelm@westermo.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
caif: reduce stack size, again [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Jun 20 13:22:39 2025 +0200

    caif: reduce stack size, again
    
    [ Upstream commit b630c781bcf6ff87657146661816d0d30a902139 ]
    
    I tried to fix the stack usage in this function a couple of years ago,
    but there is still a problem with the latest gcc versions in some
    configurations:
    
    net/caif/cfctrl.c:553:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
    
    Reduce this once again, with a separate cfctrl_link_setup() function that
    holds the bulk of all the local variables. It also turns out that the
    param[] array that takes up a large portion of the stack is write-only
    and can be left out here.
    
    Fixes: ce6289661b14 ("caif: reduce stack size with KASAN")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20250620112244.3425554-1-arnd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
can: kvaser_pciefd: Store device channel index [+ + +]
Author: Jimmy Assarsson <extja@kvaser.com>
Date:   Fri Jul 25 14:32:25 2025 +0200

    can: kvaser_pciefd: Store device channel index
    
    [ Upstream commit d54b16b40ddadb7d0a77fff48af7b319a0cd6aae ]
    
    Store device channel index in netdev.dev_port.
    
    Fixes: 26ad340e582d ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices")
    Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
    Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
    Link: https://patch.msgid.link/20250725123230.8-6-extja@kvaser.com
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

can: kvaser_usb: Assign netdev.dev_port based on device channel index [+ + +]
Author: Jimmy Assarsson <extja@kvaser.com>
Date:   Fri Jul 25 14:34:44 2025 +0200

    can: kvaser_usb: Assign netdev.dev_port based on device channel index
    
    [ Upstream commit c151b06a087a61c7a1790b75ee2f1d6edb6a8a45 ]
    
    Assign netdev.dev_port based on the device channel index, to indicate the
    port number of the network device.
    While this driver already uses netdev.dev_id for that purpose, dev_port is
    more appropriate. However, retain dev_id to avoid potential regressions.
    
    Fixes: 3e66d0138c05 ("can: populate netdev::dev_id for udev discrimination")
    Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
    Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
    Link: https://patch.msgid.link/20250725123452.41-4-extja@kvaser.com
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cdc-acm: fix race between initial clearing halt and open [+ + +]
Author: Oliver Neukum <oneukum@suse.com>
Date:   Mon Aug 18 19:08:39 2025 -0400

    cdc-acm: fix race between initial clearing halt and open
    
    [ Upstream commit 64690a90cd7c6db16d3af8616be1f4bf8d492850 ]
    
    On the devices that need their endpoints to get an
    initial clear_halt, this needs to be done before
    the devices can be opened. That means it needs to be
    before the devices are registered.
    
    Fixes: 15bf722e6f6c0 ("cdc-acm: Add support of ATOL FPrint fiscal printers")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    Link: https://lore.kernel.org/r/20250717141259.2345605-1-oneukum@suse.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Wed Aug 6 13:24:28 2025 -0400

    cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key
    
    [ Upstream commit 65f97cc81b0adc5f49cf6cff5d874be0058e3f41 ]
    
    The following lockdep splat was observed.
    
    [  812.359086] ============================================
    [  812.359089] WARNING: possible recursive locking detected
    [  812.359097] --------------------------------------------
    [  812.359100] runtest.sh/30042 is trying to acquire lock:
    [  812.359105] ffffffffa7f27420 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_enable+0xe/0x20
    [  812.359131]
    [  812.359131] but task is already holding lock:
    [  812.359134] ffffffffa7f27420 (cpu_hotplug_lock){++++}-{0:0}, at: cpuset_write_resmask+0x98/0xa70
         :
    [  812.359267] Call Trace:
    [  812.359272]  <TASK>
    [  812.359367]  cpus_read_lock+0x3c/0xe0
    [  812.359382]  static_key_enable+0xe/0x20
    [  812.359389]  check_insane_mems_config.part.0+0x11/0x30
    [  812.359398]  cpuset_write_resmask+0x9f2/0xa70
    [  812.359411]  cgroup_file_write+0x1c7/0x660
    [  812.359467]  kernfs_fop_write_iter+0x358/0x530
    [  812.359479]  vfs_write+0xabe/0x1250
    [  812.359529]  ksys_write+0xf9/0x1d0
    [  812.359558]  do_syscall_64+0x5f/0xe0
    
    Since commit d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem
    and hotplug lock order"), the ordering of cpu hotplug lock
    and cpuset_mutex had been reversed. That patch correctly
    used the cpuslocked version of the static branch API to enable
    cpusets_pre_enable_key and cpusets_enabled_key, but it didn't do the
    same for cpusets_insane_config_key.
    
    The cpusets_insane_config_key can be enabled in the
    check_insane_mems_config() which is called from update_nodemask()
    or cpuset_hotplug_update_tasks() with both cpu hotplug lock and
    cpuset_mutex held. Deadlock can happen with a pending hotplug event that
    tries to acquire the cpu hotplug write lock which will block further
    cpus_read_lock() attempt from check_insane_mems_config(). Fix that by
    switching to use static_branch_enable_cpuslocked().
    
    Fixes: d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and hotplug lock order")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cifs: Fix calling CIFSFindFirst() for root path without msearch [+ + +]
Author: Pali Rohár <pali@kernel.org>
Date:   Mon Dec 30 20:54:11 2024 +0100

    cifs: Fix calling CIFSFindFirst() for root path without msearch
    
    [ Upstream commit b460249b9a1dab7a9f58483e5349d045ad6d585c ]
    
    To query root path (without msearch wildcard) it is needed to
    send pattern '\' instead of '' (empty string).
    
    This allows to use CIFSFindFirst() to query information about root path
    which is being used in followup changes.
    
    This change fixes the stat() syscall called on the root path on the mount.
    It is because stat() syscall uses the cifs_query_path_info() function and
    it can fallback to the CIFSFindFirst() usage with msearch=false.
    
    Signed-off-by: Pali Rohár <pali@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
clk: davinci: Add NULL check in davinci_lpsc_clk_register() [+ + +]
Author: Henry Martin <bsdhenrymartin@gmail.com>
Date:   Tue Apr 1 21:13:41 2025 +0800

    clk: davinci: Add NULL check in davinci_lpsc_clk_register()
    
    [ Upstream commit 13de464f445d42738fe18c9a28bab056ba3a290a ]
    
    devm_kasprintf() returns NULL when memory allocation fails. Currently,
    davinci_lpsc_clk_register() does not check for this case, which results
    in a NULL pointer dereference.
    
    Add NULL check after devm_kasprintf() to prevent this issue and ensuring
    no resources are left allocated.
    
    Fixes: c6ed4d734bc7 ("clk: davinci: New driver for davinci PSC clocks")
    Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
    Link: https://lore.kernel.org/r/20250401131341.26800-1-bsdhenrymartin@gmail.com
    Reviewed-by: David Lechner <david@lechnology.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: sunxi-ng: v3s: Fix de clock definition [+ + +]
Author: Paul Kocialkowski <paulk@sys-base.io>
Date:   Fri Jul 4 17:40:07 2025 +0200

    clk: sunxi-ng: v3s: Fix de clock definition
    
    [ Upstream commit e8ab346f9907a1a3aa2f0e5decf849925c06ae2e ]
    
    The de clock is marked with CLK_SET_RATE_PARENT, which is really not
    necessary (as confirmed from experimentation) and significantly
    restricts flexibility for other clocks using the same parent.
    
    In addition the source selection (parent) field is marked as using
    2 bits, when it the documentation reports that it uses 3.
    
    Fix both issues in the de clock definition.
    
    Fixes: d0f11d14b0bc ("clk: sunxi-ng: add support for V3s CCU")
    Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
    Link: https://patch.msgid.link/20250704154008.3463257-1-paulk@sys-base.io
    Signed-off-by: Chen-Yu Tsai <wens@csie.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

 
comedi: aio_iiro_16: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 14:46:22 2025 +0100

    comedi: aio_iiro_16: Fix bit shift out of bounds
    
    commit 66acb1586737a22dd7b78abc63213b1bcaa100e4 upstream.
    
    When checking for a supported IRQ number, the following test is used:
    
            if ((1 << it->options[1]) & 0xdcfc) {
    
    However, `it->options[i]` is an unchecked `int` value from userspace, so
    the shift amount could be negative or out of bounds.  Fix the test by
    requiring `it->options[1]` to be within bounds before proceeding with
    the original test.  Valid `it->options[1]` values that select the IRQ
    will be in the range [1,15]. The value 0 explicitly disables the use of
    interrupts.
    
    Fixes: ad7a370c8be4 ("staging: comedi: aio_iiro_16: add command support for change of state detection")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707134622.75403-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: comedi_test: Fix possible deletion of uninitialized timers [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Tue Jul 8 14:06:27 2025 +0100

    comedi: comedi_test: Fix possible deletion of uninitialized timers
    
    commit 1b98304c09a0192598d0767f1eb8c83d7e793091 upstream.
    
    In `waveform_common_attach()`, the two timers `&devpriv->ai_timer` and
    `&devpriv->ao_timer` are initialized after the allocation of the device
    private data by `comedi_alloc_devpriv()` and the subdevices by
    `comedi_alloc_subdevices()`.  The function may return with an error
    between those function calls.  In that case, `waveform_detach()` will be
    called by the Comedi core to clean up.  The check that
    `waveform_detach()` uses to decide whether to delete the timers is
    incorrect.  It only checks that the device private data was allocated,
    but that does not guarantee that the timers were initialized.  It also
    needs to check that the subdevices were allocated.  Fix it.
    
    Fixes: 73e0e4dfed4c ("staging: comedi: comedi_test: fix timer lock-up")
    Cc: stable@vger.kernel.org # 6.15+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250708130627.21743-1-abbotti@mev.co.uk
    [ file location from drivers/comedi to drivers/staging/comedi and timer_delete_sync() to del_timer_sync(). ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: das16m1: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 14:09:08 2025 +0100

    comedi: das16m1: Fix bit shift out of bounds
    
    commit ed93c6f68a3be06e4e0c331c6e751f462dee3932 upstream.
    
    When checking for a supported IRQ number, the following test is used:
    
            /* only irqs 2, 3, 4, 5, 6, 7, 10, 11, 12, 14, and 15 are valid */
            if ((1 << it->options[1]) & 0xdcfc) {
    
    However, `it->options[i]` is an unchecked `int` value from userspace, so
    the shift amount could be negative or out of bounds.  Fix the test by
    requiring `it->options[1]` to be within bounds before proceeding with
    the original test.
    
    Reported-by: syzbot+c52293513298e0fd9a94@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=c52293513298e0fd9a94
    Fixes: 729988507680 ("staging: comedi: das16m1: tidy up the irq support in das16m1_attach()")
    Tested-by: syzbot+c52293513298e0fd9a94@syzkaller.appspotmail.com
    Suggested-by: "Enju, Kohei" <enjuk@amazon.co.jp>
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707130908.70758-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: das6402: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 14:57:37 2025 +0100

    comedi: das6402: Fix bit shift out of bounds
    
    commit 70f2b28b5243df557f51c054c20058ae207baaac upstream.
    
    When checking for a supported IRQ number, the following test is used:
    
            /* IRQs 2,3,5,6,7, 10,11,15 are valid for "enhanced" mode */
            if ((1 << it->options[1]) & 0x8cec) {
    
    However, `it->options[i]` is an unchecked `int` value from userspace, so
    the shift amount could be negative or out of bounds.  Fix the test by
    requiring `it->options[1]` to be within bounds before proceeding with
    the original test.  Valid `it->options[1]` values that select the IRQ
    will be in the range [1,15]. The value 0 explicitly disables the use of
    interrupts.
    
    Fixes: 79e5e6addbb1 ("staging: comedi: das6402: rewrite broken driver")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707135737.77448-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Thu Jul 24 19:12:49 2025 +0100

    comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large
    
    [ Upstream commit 08ae4b20f5e82101d77326ecab9089e110f224cc ]
    
    The handling of the `COMEDI_INSNLIST` ioctl allocates a kernel buffer to
    hold the array of `struct comedi_insn`, getting the length from the
    `n_insns` member of the `struct comedi_insnlist` supplied by the user.
    The allocation will fail with a WARNING and a stack dump if it is too
    large.
    
    Avoid that by failing with an `-EINVAL` error if the supplied `n_insns`
    value is unreasonable.
    
    Define the limit on the `n_insns` value in the `MAX_INSNS` macro.  Set
    this to the same value as `MAX_SAMPLES` (65536), which is the maximum
    allowed sum of the values of the member `n` in the array of `struct
    comedi_insn`, and sensible comedi instructions will have an `n` of at
    least 1.
    
    Reported-by: syzbot+d6995b62e5ac7d79557a@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d6995b62e5ac7d79557a
    Fixes: ed9eccbe8970 ("Staging: add comedi core")
    Tested-by: Ian Abbott <abbotti@mev.co.uk>
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250704120405.83028-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: Fix initialization of data for instructions that write to subdevice [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 17:14:39 2025 +0100

    comedi: Fix initialization of data for instructions that write to subdevice
    
    commit 46d8c744136ce2454aa4c35c138cc06817f92b8e upstream.
    
    Some Comedi subdevice instruction handlers are known to access
    instruction data elements beyond the first `insn->n` elements in some
    cases.  The `do_insn_ioctl()` and `do_insnlist_ioctl()` functions
    allocate at least `MIN_SAMPLES` (16) data elements to deal with this,
    but they do not initialize all of that.  For Comedi instruction codes
    that write to the subdevice, the first `insn->n` data elements are
    copied from user-space, but the remaining elements are left
    uninitialized.  That could be a problem if the subdevice instruction
    handler reads the uninitialized data.  Ensure that the first
    `MIN_SAMPLES` elements are initialized before calling these instruction
    handlers, filling the uncopied elements with 0.  For
    `do_insnlist_ioctl()`, the same data buffer elements are used for
    handling a list of instructions, so ensure the first `MIN_SAMPLES`
    elements are initialized for each instruction that writes to the
    subdevice.
    
    Fixes: ed9eccbe8970 ("Staging: add comedi core")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707161439.88385-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: fix race between polling and detaching [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Tue Jul 22 16:53:16 2025 +0100

    comedi: fix race between polling and detaching
    
    commit 35b6fc51c666fc96355be5cd633ed0fe4ccf68b2 upstream.
    
    syzbot reports a use-after-free in comedi in the below link, which is
    due to comedi gladly removing the allocated async area even though poll
    requests are still active on the wait_queue_head inside of it. This can
    cause a use-after-free when the poll entries are later triggered or
    removed, as the memory for the wait_queue_head has been freed.  We need
    to check there are no tasks queued on any of the subdevices' wait queues
    before allowing the device to be detached by the `COMEDI_DEVCONFIG`
    ioctl.
    
    Tasks will read-lock `dev->attach_lock` before adding themselves to the
    subdevice wait queue, so fix the problem in the `COMEDI_DEVCONFIG` ioctl
    handler by write-locking `dev->attach_lock` before checking that all of
    the subdevices are safe to be deleted.  This includes testing for any
    sleepers on the subdevices' wait queues.  It remains locked until the
    device has been detached.  This requires the `comedi_device_detach()`
    function to be refactored slightly, moving the bulk of it into new
    function `comedi_device_detach_locked()`.
    
    Note that the refactor of `comedi_device_detach()` results in
    `comedi_device_cancel_all()` now being called while `dev->attach_lock`
    is write-locked, which wasn't the case previously, but that does not
    matter.
    
    Thanks to Jens Axboe for diagnosing the problem and co-developing this
    patch.
    
    Cc: stable <stable@kernel.org>
    Fixes: 2f3fdcd7ce93 ("staging: comedi: add rw_semaphore to protect against device detachment")
    Link: https://lore.kernel.org/all/687bd5fe.a70a0220.693ce.0091.GAE@google.com/
    Reported-by: syzbot+01523a0ae5600aef5895@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=01523a0ae5600aef5895
    Co-developed-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Tested-by: Jens Axboe <axboe@kernel.dk>
    Link: https://lore.kernel.org/r/20250722155316.27432-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: Fix some signed shift left operations [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 13:15:55 2025 +0100

    comedi: Fix some signed shift left operations
    
    commit ab705c8c35e18652abc6239c07cf3441f03e2cda upstream.
    
    Correct some left shifts of the signed integer constant 1 by some
    unsigned number less than 32.  Change the constant to 1U to avoid
    shifting a 1 into the sign bit.
    
    The corrected functions are comedi_dio_insn_config(),
    comedi_dio_update_state(), and __comedi_device_postconfig().
    
    Fixes: e523c6c86232 ("staging: comedi: drivers: introduce comedi_dio_insn_config()")
    Fixes: 05e60b13a36b ("staging: comedi: drivers: introduce comedi_dio_update_state()")
    Fixes: 09567cb4373e ("staging: comedi: initialize subdevice s->io_bits in postconfig")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707121555.65424-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: Fix use of uninitialized data in insn_rw_emulate_bits() [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 16:33:54 2025 +0100

    comedi: Fix use of uninitialized data in insn_rw_emulate_bits()
    
    commit e9cb26291d009243a4478a7ffb37b3a9175bfce9 upstream.
    
    For Comedi `INSN_READ` and `INSN_WRITE` instructions on "digital"
    subdevices (subdevice types `COMEDI_SUBD_DI`, `COMEDI_SUBD_DO`, and
    `COMEDI_SUBD_DIO`), it is common for the subdevice driver not to have
    `insn_read` and `insn_write` handler functions, but to have an
    `insn_bits` handler function for handling Comedi `INSN_BITS`
    instructions.  In that case, the subdevice's `insn_read` and/or
    `insn_write` function handler pointers are set to point to the
    `insn_rw_emulate_bits()` function by `__comedi_device_postconfig()`.
    
    For `INSN_WRITE`, `insn_rw_emulate_bits()` currently assumes that the
    supplied `data[0]` value is a valid copy from user memory.  It will at
    least exist because `do_insnlist_ioctl()` and `do_insn_ioctl()` in
    "comedi_fops.c" ensure at lease `MIN_SAMPLES` (16) elements are
    allocated.  However, if `insn->n` is 0 (which is allowable for
    `INSN_READ` and `INSN_WRITE` instructions, then `data[0]` may contain
    uninitialized data, and certainly contains invalid data, possibly from a
    different instruction in the array of instructions handled by
    `do_insnlist_ioctl()`.  This will result in an incorrect value being
    written to the digital output channel (or to the digital input/output
    channel if configured as an output), and may be reflected in the
    internal saved state of the channel.
    
    Fix it by returning 0 early if `insn->n` is 0, before reaching the code
    that accesses `data[0]`.  Previously, the function always returned 1 on
    success, but it is supposed to be the number of data samples actually
    read or written up to `insn->n`, which is 0 in this case.
    
    Reported-by: syzbot+cb96ec476fb4914445c9@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=cb96ec476fb4914445c9
    Fixes: ed9eccbe8970 ("Staging: add comedi core")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707153355.82474-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: pcl812: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Mon Jul 7 14:34:29 2025 +0100

    comedi: pcl812: Fix bit shift out of bounds
    
    commit b14b076ce593f72585412fc7fd3747e03a5e3632 upstream.
    
    When checking for a supported IRQ number, the following test is used:
    
            if ((1 << it->options[1]) & board->irq_bits) {
    
    However, `it->options[i]` is an unchecked `int` value from userspace, so
    the shift amount could be negative or out of bounds.  Fix the test by
    requiring `it->options[1]` to be within bounds before proceeding with
    the original test.  Valid `it->options[1]` values that select the IRQ
    will be in the range [1,15]. The value 0 explicitly disables the use of
    interrupts.
    
    Reported-by: syzbot+32de323b0addb9e114ff@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=32de323b0addb9e114ff
    Fixes: fcdb427bc7cf ("Staging: comedi: add pcl821 driver")
    Cc: stable@vger.kernel.org # 5.13+
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://lore.kernel.org/r/20250707133429.73202-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
compiler: remove __ADDRESSABLE_ASM{_STR,}() again [+ + +]
Author: Jan Beulich <jbeulich@suse.com>
Date:   Sun Aug 24 14:30:52 2025 -0400

    compiler: remove __ADDRESSABLE_ASM{_STR,}() again
    
    [ Upstream commit 8ea815399c3fcce1889bd951fec25b5b9a3979c1 ]
    
    __ADDRESSABLE_ASM_STR() is where the necessary stringification happens.
    As long as "sym" doesn't contain any odd characters, no quoting is
    required for its use with .quad / .long. In fact the quotation gets in
    the way with gas 2.25; it's only from 2.26 onwards that quoted symbols
    are half-way properly supported.
    
    However, assembly being different from C anyway, drop
    __ADDRESSABLE_ASM_STR() and its helper macro altogether. A simple
    .global directive will suffice to get the symbol "declared", i.e. into
    the symbol table. While there also stop open-coding STATIC_CALL_TRAMP()
    and STATIC_CALL_KEY().
    
    Fixes: 0ef8047b737d ("x86/static-call: provide a way to do very early static-call updates")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Message-ID: <609d2c74-de13-4fae-ab1a-1ec44afb948d@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Tue Jul 1 17:30:01 2025 -0500

    cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table()
    
    commit 4a26df233266a628157d7f0285451d8655defdfc upstream.
    
    The freq_tables[] array has num_possible_cpus() elements so, to avoid an
    out of bounds access, this loop should be capped at "< nb_cpus" instead
    of "<= nb_cpus".  The freq_tables[] array is allocated in
    armada_8k_cpufreq_init().
    
    Cc: stable@vger.kernel.org
    Fixes: f525a670533d ("cpufreq: ap806: add cpufreq driver for Armada 8K")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag [+ + +]
Author: Prashant Malani <pmalani@google.com>
Date:   Tue Jul 22 05:55:40 2025 +0000

    cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag
    
    [ Upstream commit 0a1416a49e63c320f6e6c1c8d07e1b58c0d4a3f3 ]
    
    AMU counters on certain CPPC-based platforms tend to yield inaccurate
    delivered performance measurements on systems that are idle/mostly idle.
    This results in an inaccurate frequency being stored by cpufreq in its
    policy structure when the CPU is brought online. [1]
    
    Consequently, if the userspace governor tries to set the frequency to a
    new value, there is a possibility that it would be the erroneous value
    stored earlier. In such a scenario, cpufreq would assume that the
    requested frequency has already been set and return early, resulting in
    the correct/new frequency request never making it to the hardware.
    
    Since the operating frequency is liable to this sort of inconsistency,
    mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always
    invoked when a target frequency update is requested.
    
    Link: https://lore.kernel.org/linux-pm/20250619000925.415528-3-pmalani@google.com/ [1]
    Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Prashant Malani <pmalani@google.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Link: https://patch.msgid.link/20250722055611.130574-2-pmalani@google.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cpufreq: Exit governor when failed to start old governor [+ + +]
Author: Lifeng Zheng <zhenglifeng1@huawei.com>
Date:   Wed Jul 9 18:41:45 2025 +0800

    cpufreq: Exit governor when failed to start old governor
    
    [ Upstream commit 0ae204405095abfbc2d694ee0fbb49bcbbe55c57 ]
    
    Detect the result of starting old governor in cpufreq_set_policy(). If it
    fails, exit the governor and clear policy->governor.
    
    Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://patch.msgid.link/20250709104145.2348017-5-zhenglifeng1@huawei.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cpufreq: Init policy->rwsem before it may be possibly used [+ + +]
Author: Lifeng Zheng <zhenglifeng1@huawei.com>
Date:   Wed Jul 9 18:41:43 2025 +0800

    cpufreq: Init policy->rwsem before it may be possibly used
    
    [ Upstream commit d1378d1d7edb3a4c4935a44fe834ae135be03564 ]
    
    In cpufreq_policy_put_kobj(), policy->rwsem is used. But in
    cpufreq_policy_alloc(), if freq_qos_add_notifier() returns an error, error
    path via err_kobj_remove or err_min_qos_notifier will be reached and
    cpufreq_policy_put_kobj() will be called before policy->rwsem is
    initialized. Thus, the calling of init_rwsem() should be moved to where
    before these two error paths can be reached.
    
    Fixes: 67d874c3b2c6 ("cpufreq: Register notifiers with the PM QoS framework")
    Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://patch.msgid.link/20250709104145.2348017-3-zhenglifeng1@huawei.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

cpufreq: Initialize cpufreq-based frequency-invariance later [+ + +]
Author: Lifeng Zheng <zhenglifeng1@huawei.com>
Date:   Wed Jul 9 18:41:42 2025 +0800

    cpufreq: Initialize cpufreq-based frequency-invariance later
    
    [ Upstream commit 2a6c727387062a2ea79eb6cf5004820cb1b0afe2 ]
    
    The cpufreq-based invariance is enabled in cpufreq_register_driver(),
    but never disabled after registration fails. Move the invariance
    initialization to where all other initializations have been successfully
    done to solve this problem.
    
    Fixes: 874f63531064 ("cpufreq: report whether cpufreq supports Frequency Invariance (FI)")
    Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://patch.msgid.link/20250709104145.2348017-2-zhenglifeng1@huawei.com
    [ rjw: New subject ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cpuidle: governors: menu: Avoid using invalid recent intervals data [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Aug 11 17:03:11 2025 +0200

    cpuidle: governors: menu: Avoid using invalid recent intervals data
    
    [ Upstream commit fa3fa55de0d6177fdcaf6fc254f13cc8f33c3eed ]
    
    Marc has reported that commit 85975daeaa4d ("cpuidle: menu: Avoid
    discarding useful information") caused the number of wakeup interrupts
    to increase on an idle system [1], which was not expected to happen
    after merely allowing shallower idle states to be selected by the
    governor in some cases.
    
    However, on the system in question, all of the idle states deeper than
    WFI are rejected by the driver due to a firmware issue [2].  This causes
    the governor to only consider the recent interval duriation data
    corresponding to attempts to enter WFI that are successful and the
    recent invervals table is filled with values lower than the scheduler
    tick period.  Consequently, the governor predicts an idle duration
    below the scheduler tick period length and avoids stopping the tick
    more often which leads to the observed symptom.
    
    Address it by modifying the governor to update the recent intervals
    table also when entering the previously selected idle state fails, so
    it knows that the short idle intervals might have been the minority
    had the selected idle states been actually entered every time.
    
    Fixes: 85975daeaa4d ("cpuidle: menu: Avoid discarding useful information")
    Link: https://lore.kernel.org/linux-pm/86o6sv6n94.wl-maz@kernel.org/ [1]
    Link: https://lore.kernel.org/linux-pm/7ffcb716-9a1b-48c2-aaa4-469d0df7c792@arm.com/ [2]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Christian Loehle <christian.loehle@arm.com>
    Tested-by: Marc Zyngier <maz@kernel.org>
    Reviewed-by: Christian Loehle <christian.loehle@arm.com>
    Link: https://patch.msgid.link/2793874.mvXUDI8C0e@rafael.j.wysocki
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
crypto: ccp - Fix crash when rebind ccp device for ccp.ko [+ + +]
Author: Mengbiao Xiong <xisme1998@gmail.com>
Date:   Tue Jun 24 14:54:18 2025 +0800

    crypto: ccp - Fix crash when rebind ccp device for ccp.ko
    
    [ Upstream commit 181698af38d3f93381229ad89c09b5bd0496661a ]
    
    When CONFIG_CRYPTO_DEV_CCP_DEBUGFS is enabled, rebinding
    the ccp device causes the following crash:
    
    $ echo '0000:0a:00.2' > /sys/bus/pci/drivers/ccp/unbind
    $ echo '0000:0a:00.2' > /sys/bus/pci/drivers/ccp/bind
    
    [  204.976930] BUG: kernel NULL pointer dereference, address: 0000000000000098
    [  204.978026] #PF: supervisor write access in kernel mode
    [  204.979126] #PF: error_code(0x0002) - not-present page
    [  204.980226] PGD 0 P4D 0
    [  204.981317] Oops: Oops: 0002 [#1] SMP NOPTI
    ...
    [  204.997852] Call Trace:
    [  204.999074]  <TASK>
    [  205.000297]  start_creating+0x9f/0x1c0
    [  205.001533]  debugfs_create_dir+0x1f/0x170
    [  205.002769]  ? srso_return_thunk+0x5/0x5f
    [  205.004000]  ccp5_debugfs_setup+0x87/0x170 [ccp]
    [  205.005241]  ccp5_init+0x8b2/0x960 [ccp]
    [  205.006469]  ccp_dev_init+0xd4/0x150 [ccp]
    [  205.007709]  sp_init+0x5f/0x80 [ccp]
    [  205.008942]  sp_pci_probe+0x283/0x2e0 [ccp]
    [  205.010165]  ? srso_return_thunk+0x5/0x5f
    [  205.011376]  local_pci_probe+0x4f/0xb0
    [  205.012584]  pci_device_probe+0xdb/0x230
    [  205.013810]  really_probe+0xed/0x380
    [  205.015024]  __driver_probe_device+0x7e/0x160
    [  205.016240]  device_driver_attach+0x2f/0x60
    [  205.017457]  bind_store+0x7c/0xb0
    [  205.018663]  drv_attr_store+0x28/0x40
    [  205.019868]  sysfs_kf_write+0x5f/0x70
    [  205.021065]  kernfs_fop_write_iter+0x145/0x1d0
    [  205.022267]  vfs_write+0x308/0x440
    [  205.023453]  ksys_write+0x6d/0xe0
    [  205.024616]  __x64_sys_write+0x1e/0x30
    [  205.025778]  x64_sys_call+0x16ba/0x2150
    [  205.026942]  do_syscall_64+0x56/0x1e0
    [  205.028108]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
    [  205.029276] RIP: 0033:0x7fbc36f10104
    [  205.030420] Code: 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 8d 05 e1 08 2e 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 f3 c3 66 90 41 54 55 49 89 d4 53 48 89 f5
    
    This patch sets ccp_debugfs_dir to NULL after destroying it in
    ccp5_debugfs_destroy, allowing the directory dentry to be
    recreated when rebinding the ccp device.
    
    Tested on AMD Ryzen 7 1700X.
    
    Fixes: 3cdbe346ed3f ("crypto: ccp - Add debugfs entries for CCP information")
    Signed-off-by: Mengbiao Xiong <xisme1998@gmail.com>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: img-hash - Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jun 30 11:16:22 2025 +0200

    crypto: img-hash - Fix dma_unmap_sg() nents value
    
    [ Upstream commit 34b283636181ce02c52633551f594fec9876bec7 ]
    
    The dma_unmap_sg() functions should be called with the same nents as the
    dma_map_sg(), not the value the map function returned.
    
    Fixes: d358f1abbf71 ("crypto: img-hash - Add Imagination Technologies hw hash accelerator")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: inside-secure - Fix `dma_unmap_sg()` nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Fri Jun 20 09:29:26 2025 +0200

    crypto: inside-secure - Fix `dma_unmap_sg()` nents value
    
    [ Upstream commit cb7fa6b6fc71e0c801e271aa498e2f19e6df2931 ]
    
    The `dma_unmap_sg()` functions should be called with the same nents as the
    `dma_map_sg()`, not the value the map function returned.
    
    Fixes: c957f8b3e2e5 ("crypto: inside-secure - avoid unmapping DMA memory that was not mapped")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Reviewed-by: Antoine Tenart <atenart@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: marvell/cesa - Fix engine load inaccuracy [+ + +]
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Thu May 22 20:41:28 2025 +0800

    crypto: marvell/cesa - Fix engine load inaccuracy
    
    [ Upstream commit 442134ab30e75b7229c4bfc1ac5641d245cffe27 ]
    
    If an error occurs during queueing the engine load will never be
    decremented.  Fix this by moving the engine load adjustment into
    the cleanup function.
    
    Fixes: bf8f91e71192 ("crypto: marvell - Add load balancing between engines")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: qat - fix seq_file position update in adf_ring_next() [+ + +]
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Mon Jul 14 08:10:29 2025 +0100

    crypto: qat - fix seq_file position update in adf_ring_next()
    
    [ Upstream commit 6908c5f4f066a0412c3d9a6f543a09fa7d87824b ]
    
    The `adf_ring_next()` function in the QAT debug transport interface
    fails to correctly update the position index when reaching the end of
    the ring elements. This triggers the following kernel warning when
    reading ring files, such as
    /sys/kernel/debug/qat_c6xx_<D:B:D:F>/transport/bank_00/ring_00:
    
       [27725.022965] seq_file: buggy .next function adf_ring_next [intel_qat] did not update position index
    
    Ensure that the `*pos` index is incremented before returning NULL when
    after the last element in the ring is found, satisfying the seq_file API
    requirements and preventing the warning.
    
    Fixes: a672a9dc872e ("crypto: qat - Intel(R) QAT transport code")
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dm rq: don't queue request to blk-mq during DM suspend [+ + +]
Author: Ming Lei <ming.lei@redhat.com>
Date:   Thu Sep 23 17:11:31 2021 +0800

    dm rq: don't queue request to blk-mq during DM suspend
    
    commit b4459b11e84092658fa195a2587aff3b9637f0e7 upstream.
    
    DM uses blk-mq's quiesce/unquiesce to stop/start device mapper queue.
    
    But blk-mq's unquiesce may come from outside events, such as elevator
    switch, updating nr_requests or others, and request may come during
    suspend, so simply ask for blk-mq to requeue it.
    
    Fixes one kernel panic issue when running updating nr_requests and
    dm-mpath suspend/resume stress test.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-mpath: don't print the "loaded" message if registering fails [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon Jun 30 15:24:22 2025 +0200

    dm-mpath: don't print the "loaded" message if registering fails
    
    [ Upstream commit 6e11952a6abc4641dc8ae63f01b318b31b44e8db ]
    
    If dm_register_path_selector, don't print the "version X loaded" message.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dm: rearrange core declarations for extended use from dm-zone.c [+ + +]
Author: Damien Le Moal <damien.lemoal@wdc.com>
Date:   Wed May 26 06:24:59 2021 +0900

    dm: rearrange core declarations for extended use from dm-zone.c
    
    commit e2118b3c3d94289852417f70ec128c25f4833aad upstream.
    
    Move the definitions of struct dm_target_io, struct dm_io and the bits
    of the flags field of struct mapped_device from dm.c to dm-core.h to
    make them usable from dm-zone.c. For the same reason, declare
    dec_pending() in dm-core.h after renaming it to dm_io_dec_pending().
    And for symmetry of the function names, introduce the inline helper
    dm_io_inc_pending() instead of directly using atomic_inc() calls.
    
    Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dma-buf: insert memory barrier before updating num_fences [+ + +]
Author: Hyejeong Choi <hjeong.choi@samsung.com>
Date:   Fri Aug 8 18:05:37 2025 +0000

    dma-buf: insert memory barrier before updating num_fences
    
    commit 72c7d62583ebce7baeb61acce6057c361f73be4a upstream.
    
    smp_store_mb() inserts memory barrier after storing operation.
    It is different with what the comment is originally aiming so Null
    pointer dereference can be happened if memory update is reordered.
    
    Signed-off-by: Hyejeong Choi <hjeong.choi@samsung.com>
    Fixes: a590d0fdbaa5 ("dma-buf: Update reservation shared_count after adding the new fence")
    CC: stable@vger.kernel.org
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Link: https://lore.kernel.org/r/20250513020638.GA2329653@au1-maretx-p37.eng.sarc.samsung.com
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [Conflict resolved by applying changes from dma_resv_add_fence() in the original fix to dma_resv_add_shared_fence() in current code base]
    Signed-off-by: Jay Wang <wanjay@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dmaengine: mv_xor: Fix missing check after DMA map and missing unmap [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Tue Jul 1 14:37:52 2025 +0200

    dmaengine: mv_xor: Fix missing check after DMA map and missing unmap
    
    [ Upstream commit 60095aca6b471b7b7a79c80b7395f7e4e414b479 ]
    
    The DMA map functions can fail and should be tested for errors.
    
    In case of error, unmap the already mapped regions.
    
    Fixes: 22843545b200 ("dma: mv_xor: Add support for DMA_INTERRUPT")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://lore.kernel.org/r/20250701123753.46935-2-fourier.thomas@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: nbpfaxi: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jul 7 09:57:16 2025 +0200

    dmaengine: nbpfaxi: Add missing check after DMA map
    
    [ Upstream commit c6ee78fc8f3e653bec427cfd06fec7877ee782bd ]
    
    The DMA map functions can fail and should be tested for errors.
    If the mapping fails, unmap and return an error.
    
    Fixes: b45b262cefd5 ("dmaengine: add a driver for AMBA AXI NBPF DMAC IP cores")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://lore.kernel.org/r/20250707075752.28674-2-fourier.thomas@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: nbpfaxi: Fix memory corruption in probe() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Tue Jul 1 17:31:40 2025 -0500

    dmaengine: nbpfaxi: Fix memory corruption in probe()
    
    commit 188c6ba1dd925849c5d94885c8bbdeb0b3dcf510 upstream.
    
    The nbpf->chan[] array is allocated earlier in the nbpf_probe() function
    and it has "num_channels" elements.  These three loops iterate one
    element farther than they should and corrupt memory.
    
    The changes to the second loop are more involved.  In this case, we're
    copying data from the irqbuf[] array into the nbpf->chan[] array.  If
    the data in irqbuf[i] is the error IRQ then we skip it, so the iterators
    are not in sync.  I added a check to ensure that we don't go beyond the
    end of the irqbuf[] array.  I'm pretty sure this can't happen, but it
    seemed harmless to add a check.
    
    On the other hand, after the loop has ended there is a check to ensure
    that the "chan" iterator is where we expect it to be.  In the original
    code we went one element beyond the end of the array so the iterator
    wasn't in the correct place and it would always return -EINVAL.  However,
    now it will always be in the correct place.  I deleted the check since
    we know the result.
    
    Cc: stable@vger.kernel.org
    Fixes: b45b262cefd5 ("dmaengine: add a driver for AMBA AXI NBPF DMAC IP cores")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://lore.kernel.org/r/b13c5225-7eff-448c-badc-a2c98e9bcaca@sabinyo.mountain
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Documentation: ACPI: Fix parent device references [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Thu Jul 10 20:00:23 2025 +0300

    Documentation: ACPI: Fix parent device references
    
    commit e65cb011349e653ded541dddd6469c2ca813edcf upstream.
    
    The _CRS resources in many cases want to have ResourceSource field
    to be a type of ACPI String. This means that to compile properly
    we need to enclosure the name path into double quotes. This will
    in practice defer the interpretation to a run-time stage, However,
    this may be interpreted differently on different OSes and ACPI
    interpreter implementations. In particular ACPICA might not correctly
    recognize the leading '^' (caret) character and will not resolve
    the relative name path properly. On top of that, this piece may be
    used in SSDTs which are loaded after the DSDT and on itself may also
    not resolve relative name paths outside of their own scopes.
    With this all said, fix documentation to use fully-qualified name
    paths always to avoid any misinterpretations, which is proven to
    work.
    
    Fixes: 8eb5c87a92c0 ("i2c: add ACPI support for I2C mux ports")
    Reported-by: Yevhen Kondrashyn <e.kondrashyn@gmail.com>
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/20250710170225.961303-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dpaa2-eth: Fix device reference count leak in MAC endpoint handling [+ + +]
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Tue Jul 29 00:28:53 2025 -0400

    dpaa2-eth: Fix device reference count leak in MAC endpoint handling
    
    [ Upstream commit ee9f3a81ab08dfe0538dbd1746f81fd4d5147fdc ]
    
    The fsl_mc_get_endpoint() function uses device_find_child() for
    localization, which implicitly calls get_device() to increment the
    device's reference count before returning the pointer. However, the
    caller dpaa2_eth_connect_mac() fails to properly release this
    reference in multiple scenarios. We should call put_device() to
    decrement reference count properly.
    
    As comment of device_find_child() says, 'NOTE: you will need to drop
    the reference with put_device() after use'.
    
    Found by code review.
    
    Cc: stable@vger.kernel.org
    Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250717022309.3339976-2-make24@iscas.ac.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dpaa2-eth: retry the probe when the MAC is not yet discovered on the bus [+ + +]
Author: Ioana Ciornei <ioana.ciornei@nxp.com>
Date:   Tue Jul 29 00:28:52 2025 -0400

    dpaa2-eth: retry the probe when the MAC is not yet discovered on the bus
    
    [ Upstream commit 47325da28ef137fa04a0e5d6d244e9635184bf5e ]
    
    The fsl_mc_get_endpoint() function now returns -EPROBE_DEFER when the
    dpmac device was not yet discovered by the fsl-mc bus. When this
    happens, pass the error code up so that we can retry the probe at a
    later time.
    
    Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: ee9f3a81ab08 ("dpaa2-eth: Fix device reference count leak in MAC endpoint handling")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dpaa2-mac: export MAC counters even when in TYPE_FIXED [+ + +]
Author: Ioana Ciornei <ioana.ciornei@nxp.com>
Date:   Tue Jul 29 00:28:51 2025 -0400

    dpaa2-mac: export MAC counters even when in TYPE_FIXED
    
    [ Upstream commit d87e606373f641c58d5e8e4c48b3216fd9d1c78a ]
    
    If the network interface object is connected to a MAC of TYPE_FIXED, the
    link status management is handled exclusively by the firmware. This does
    not mean that the driver cannot access the MAC counters and export them
    in ethtool.
    
    For this to happen, we open the attached dpmac device and keep a pointer
    to it in priv->mac. Because of this, all the checks in the driver of the
    following form 'if (priv->mac)' have to be updated to actually check
    the dpmac attribute and not rely on the presence of a non-NULL value.
    
    Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: ee9f3a81ab08 ("dpaa2-eth: Fix device reference count leak in MAC endpoint handling")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dpaa2-mac: split up initializing the MAC object from connecting to it [+ + +]
Author: Ioana Ciornei <ioana.ciornei@nxp.com>
Date:   Tue Jul 29 00:28:50 2025 -0400

    dpaa2-mac: split up initializing the MAC object from connecting to it
    
    [ Upstream commit 095dca16d92f32150314ef47ea150ed83c5aacd9 ]
    
    Split up the initialization phase of the dpmac object from actually
    configuring the phylink instance, connecting to it and configuring the
    MAC. This is done so that even though the dpni object is connected to a
    dpmac which has link management handled by the firmware we are still
    able to export the MAC counters.
    
    Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: ee9f3a81ab08 ("dpaa2-eth: Fix device reference count leak in MAC endpoint handling")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drbd: add missing kref_get in handle_write_conflicts [+ + +]
Author: Sarah Newman <srn@prgmr.com>
Date:   Fri Jun 27 11:57:28 2025 +0200

    drbd: add missing kref_get in handle_write_conflicts
    
    [ Upstream commit 00c9c9628b49e368d140cfa61d7df9b8922ec2a8 ]
    
    With `two-primaries` enabled, DRBD tries to detect "concurrent" writes
    and handle write conflicts, so that even if you write to the same sector
    simultaneously on both nodes, they end up with the identical data once
    the writes are completed.
    
    In handling "superseeded" writes, we forgot a kref_get,
    resulting in a premature drbd_destroy_device and use after free,
    and further to kernel crashes with symptoms.
    
    Relevance: No one should use DRBD as a random data generator, and apparently
    all users of "two-primaries" handle concurrent writes correctly on layer up.
    That is cluster file systems use some distributed lock manager,
    and live migration in virtualization environments stops writes on one node
    before starting writes on the other node.
    
    Which means that other than for "test cases",
    this code path is never taken in real life.
    
    FYI, in DRBD 9, things are handled differently nowadays.  We still detect
    "write conflicts", but no longer try to be smart about them.
    We decided to disconnect hard instead: upper layers must not submit concurrent
    writes. If they do, that's their fault.
    
    Signed-off-by: Sarah Newman <srn@prgmr.com>
    Signed-off-by: Lars Ellenberg <lars@linbit.com>
    Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
    Link: https://lore.kernel.org/r/20250627095728.800688-1-christoph.boehmwalder@linbit.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Don't overclock DCE 6 by 15% [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Sat Aug 23 21:18:57 2025 -0400

    drm/amd/display: Don't overclock DCE 6 by 15%
    
    [ Upstream commit cb7b7ae53b557d168b4af5cd8549f3eff920bfb5 ]
    
    The extra 15% clock was added as a workaround for a Polaris issue
    which uses DCE 11, and should not have been used on DCE 6 which
    is already hardcoded to the highest possible display clock.
    Unfortunately, the extra 15% was mistakenly copied and kept
    even on code paths which don't affect Polaris.
    
    This commit fixes that and also adds a check to make sure
    not to exceed the maximum DCE 6 display clock.
    
    Fixes: 8cd61c313d8b ("drm/amd/display: Raise dispclk value for Polaris")
    Fixes: dc88b4a684d2 ("drm/amd/display: make clk mgr soc specific")
    Fixes: 3ecb3b794e2c ("drm/amd/display: dc/clk_mgr: add support for SI parts (v2)")
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Rodrigo Siqueira <siqueira@igalia.com>
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 427980c1cbd22bb256b9385f5ce73c0937562408)
    Cc: stable@vger.kernel.org
    [ `MIN` => `min` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Fill display clock and vblank time in dce110_fill_display_configs [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Thu Jul 31 11:43:49 2025 +0200

    drm/amd/display: Fill display clock and vblank time in dce110_fill_display_configs
    
    commit 7d07140d37f792f01cfdb8ca9a6a792ab1d29126 upstream.
    
    Also needed by DCE 6.
    This way the code that gathers this info can be shared between
    different DCE versions and doesn't have to be repeated.
    
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Rodrigo Siqueira <siqueira@igalia.com>
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 8107432dff37db26fcb641b6cebeae8981cd73a0)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Find first CRTC and its line time in dce110_fill_display_configs [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Thu Jul 31 11:43:48 2025 +0200

    drm/amd/display: Find first CRTC and its line time in dce110_fill_display_configs
    
    commit 669f73a26f6112eedbadac53a2f2707ac6d0b9c8 upstream.
    
    dce110_fill_display_configs is shared between DCE 6-11, and
    finding the first CRTC and its line time is relevant to DCE 6 too.
    Move the code to find it from DCE 11 specific code.
    
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Rodrigo Siqueira <siqueira@igalia.com>
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 4ab09785f8d5d03df052827af073d5c508ff5f63)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Fix 'failed to blank crtc!' [+ + +]
Author: Wen Chen <Wen.Chen3@amd.com>
Date:   Mon Jun 2 16:37:08 2025 -0400

    drm/amd/display: Fix 'failed to blank crtc!'
    
    [ Upstream commit 01f60348d8fb6b3fbcdfc7bdde5d669f95b009a4 ]
    
    [why]
    DCN35 is having “DC: failed to blank crtc!” when running HPO
    test cases. It's caused by not having sufficient udelay time.
    
    [how]
    Replace the old wait_for_blank_complete function with fsleep function to
    sleep just until the next frame should come up. This way it doesn't poll
    in case the pixel clock or other clock was bugged or until vactive and
    the vblank are hit again.
    
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: Wen Chen <Wen.Chen3@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Fix DP audio DTO1 clock source on DCE 6. [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Sat Aug 2 17:51:53 2025 +0200

    drm/amd/display: Fix DP audio DTO1 clock source on DCE 6.
    
    commit 297a4833a68aac3316eb808b4123eb016ef242d7 upstream.
    
    On DCE 6, DP audio was not working. However, it worked when an
    HDMI monitor was also plugged in.
    
    Looking at dce_aud_wall_dto_setup it seems that the main
    difference is that we use DTO1 when only DP is plugged in.
    
    When programming DTO1, it uses audio_dto_source_clock_in_khz
    which is set from get_dp_ref_freq_khz
    
    The dce60_get_dp_ref_freq_khz implementation looks incorrect,
    because DENTIST_DISPCLK_CNTL seems to be always zero on DCE 6,
    so it isn't usable.
    I compared dce60_get_dp_ref_freq_khz to the legacy display code,
    specifically dce_v6_0_audio_set_dto, and it turns out that in
    case of DCE 6, it needs to use the display clock. With that,
    DP audio started working on Pitcairn, Oland and Cape Verde.
    
    However, it still didn't work on Tahiti. Despite having the
    same DCE version, Tahiti seems to have a different audio device.
    After some trial and error I realized that it works with the
    default display clock as reported by the VBIOS, not the current
    display clock.
    
    The patch was tested on all four SI GPUs:
    
    * Pitcairn (DCE 6.0)
    * Oland (DCE 6.4)
    * Cape Verde (DCE 6.0)
    * Tahiti (DCE 6.0 but different)
    
    The testing was done on Samsung Odyssey G7 LS28BG700EPXEN on
    each of the above GPUs, at the following settings:
    
    * 4K 60 Hz
    * 1080p 60 Hz
    * 1080p 144 Hz
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Rodrigo Siqueira <siqueira@igalia.com>
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 645cc7863da5de700547d236697dffd6760cf051)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Fix fractional fb divider in set_pixel_clock_v3 [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Thu Jul 31 11:43:52 2025 +0200

    drm/amd/display: Fix fractional fb divider in set_pixel_clock_v3
    
    commit 10507478468f165ea681605d133991ed05cdff62 upstream.
    
    For later VBIOS versions, the fractional feedback divider is
    calculated as the remainder of dividing the feedback divider by
    a factor, which is set to 1000000. For reference, see:
    - calculate_fb_and_fractional_fb_divider
    - calc_pll_max_vco_construct
    
    However, in case of old VBIOS versions that have
    set_pixel_clock_v3, they only have 1 byte available for the
    fractional feedback divider, and it's expected to be set to the
    remainder from dividing the feedback divider by 10.
    For reference see the legacy display code:
    - amdgpu_pll_compute
    - amdgpu_atombios_crtc_program_pll
    
    This commit fixes set_pixel_clock_v3 by dividing the fractional
    feedback divider passed to the function by 100000.
    
    Fixes: 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)")
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Rodrigo Siqueira <siqueira@igalia.com>
    Reviewed-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 027e7acc7e17802ebf28e1edb88a404836ad50d6)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Separate set_gsl from set_gsl_source_select [+ + +]
Author: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
Date:   Wed Jun 18 13:07:14 2025 -0400

    drm/amd/display: Separate set_gsl from set_gsl_source_select
    
    [ Upstream commit 660a467a5e7366cd6642de61f1aaeaf0d253ee68 ]
    
    [Why/How]
    Separate the checks for set_gsl and set_gsl_source_select, since
    source_select may not be implemented/necessary.
    
    Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
    Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
    Signed-off-by: Ray Wu <ray.wu@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/pm/powerplay/hwmgr/smu_helper: fix order of mask and value [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
Date:   Mon Jun 30 23:26:17 2025 +0300

    drm/amd/pm/powerplay/hwmgr/smu_helper: fix order of mask and value
    
    [ Upstream commit a54e4639c4ef37a0241bac7d2a77f2e6ffb57099 ]
    
    There is a small typo in phm_wait_on_indirect_register().
    
    Swap mask and value arguments provided to phm_wait_on_register() so that
    they satisfy the function signature and actual usage scheme.
    
    Found by Linux Verification Center (linuxtesting.org) with Svace static
    analysis tool.
    
    In practice this doesn't fix any issues because the only place this
    function is used uses the same value for the value and mask.
    
    Fixes: 3bace3591493 ("drm/amd/powerplay: add hardware manager sub-component")
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd: Restore cached power limit during resume [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Thu Jul 24 22:12:21 2025 -0500

    drm/amd: Restore cached power limit during resume
    
    commit ed4efe426a49729952b3dc05d20e33b94409bdd1 upstream.
    
    The power limit will be cached in smu->current_power_limit but
    if the ASIC goes into S3 this value won't be restored.
    
    Restore the value during SMU resume.
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Link: https://lore.kernel.org/r/20250725031222.3015095-2-superm1@kernel.org
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 26a609e053a6fc494403e95403bc6a2470383bec)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdgpu: fix incorrect vm flags to map bo [+ + +]
Author: Jack Xiao <Jack.Xiao@amd.com>
Date:   Mon Aug 11 15:20:55 2025 +0800

    drm/amdgpu: fix incorrect vm flags to map bo
    
    [ Upstream commit 040bc6d0e0e9c814c9c663f6f1544ebaff6824a8 ]
    
    It should use vm flags instead of pte flags
    to specify bo vm attributes.
    
    Fixes: 7946340fa389 ("drm/amdgpu: Move csa related code to separate file")
    Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
    Reviewed-by: Likun Gao <Likun.Gao@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit b08425fa77ad2f305fe57a33dceb456be03b653f)
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amdgpu: handle the case of pci_channel_io_frozen only in amdgpu_pci_resume [+ + +]
Author: Guchun Chen <guchun.chen@amd.com>
Date:   Mon Aug 11 23:23:49 2025 -0700

    drm/amdgpu: handle the case of pci_channel_io_frozen only in amdgpu_pci_resume
    
    [ Upstream commit 248b061689a40f4fed05252ee2c89f87cf26d7d8 ]
    
    In current code, when a PCI error state pci_channel_io_normal is detectd,
    it will report PCI_ERS_RESULT_CAN_RECOVER status to PCI driver, and PCI
    driver will continue the execution of PCI resume callback report_resume by
    pci_walk_bridge, and the callback will go into amdgpu_pci_resume
    finally, where write lock is releasd unconditionally without acquiring
    such lock first. In this case, a deadlock will happen when other threads
    start to acquire the read lock.
    
    To fix this, add a member in amdgpu_device strucutre to cache
    pci_channel_state, and only continue the execution in amdgpu_pci_resume
    when it's pci_channel_io_frozen.
    
    Fixes: c9a6b82f45e2 ("drm/amdgpu: Implement DPC recovery")
    Suggested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
    Signed-off-by: Guchun Chen <guchun.chen@amd.com>
    Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS [+ + +]
Author: Imre Deak <imre.deak@intel.com>
Date:   Sat Aug 23 10:14:31 2025 -0400

    drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS
    
    [ Upstream commit a40c5d727b8111b5db424a1e43e14a1dcce1e77f ]
    
    Reading DPCD registers has side-effects in general. In particular
    accessing registers outside of the link training register range
    (0x102-0x106, 0x202-0x207, 0x200c-0x200f, 0x2216) is explicitly
    forbidden by the DP v2.1 Standard, see
    
    3.6.5.1 DPTX AUX Transaction Handling Mandates
    3.6.7.4 128b/132b DP Link Layer LTTPR Link Training Mandates
    
    Based on my tests, accessing the DPCD_REV register during the link
    training of an UHBR TBT DP tunnel sink leads to link training failures.
    
    Solve the above by using the DP_LANE0_1_STATUS (0x202) register for the
    DPCD register access quirk.
    
    Cc: <stable@vger.kernel.org>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Acked-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Link: https://lore.kernel.org/r/20250605082850.65136-2-imre.deak@intel.com
    [ call to drm_dp_dpcd_access() instead of drm_dp_dpcd_probe() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/rockchip: cleanup fb when drm_gem_fb_afbc_init failed [+ + +]
Author: Andy Yan <andy.yan@rock-chips.com>
Date:   Fri May 9 11:15:59 2025 +0800

    drm/rockchip: cleanup fb when drm_gem_fb_afbc_init failed
    
    [ Upstream commit 099593a28138b48feea5be8ce700e5bc4565e31d ]
    
    In the function drm_gem_fb_init_with_funcs, the framebuffer (fb)
    and its corresponding object ID have already been registered.
    
    So we need to cleanup the drm framebuffer if the subsequent
    execution of drm_gem_fb_afbc_init fails.
    
    Directly call drm_framebuffer_put to ensure that all fb related
    resources are cleanup.
    
    Fixes: 7707f7227f09 ("drm/rockchip: Add support for afbc")
    Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://lore.kernel.org/r/20250509031607.2542187-1-andyshrk@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/sched: Remove optimization that causes hang when killing dependent jobs [+ + +]
Author: Lin.Cao <lincao12@amd.com>
Date:   Tue Jul 29 12:44:08 2025 -0400

    drm/sched: Remove optimization that causes hang when killing dependent jobs
    
    [ Upstream commit 15f77764e90a713ee3916ca424757688e4f565b9 ]
    
    When application A submits jobs and application B submits a job with a
    dependency on A's fence, the normal flow wakes up the scheduler after
    processing each job. However, the optimization in
    drm_sched_entity_add_dependency_cb() uses a callback that only clears
    dependencies without waking up the scheduler.
    
    When application A is killed before its jobs can run, the callback gets
    triggered but only clears the dependency without waking up the scheduler,
    causing the scheduler to enter sleep state and application B to hang.
    
    Remove the optimization by deleting drm_sched_entity_clear_dep() and its
    usage, ensuring the scheduler is always woken up when dependencies are
    cleared.
    
    Fixes: 777dbd458c89 ("drm/amdgpu: drop a dummy wakeup scheduler")
    Cc: stable@vger.kernel.org # v4.6+
    Signed-off-by: Lin.Cao <lincao12@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Philipp Stanner <phasta@kernel.org>
    Link: https://lore.kernel.org/r/20250717084453.921097-1-lincao12@amd.com
    [ adjust context ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/ttm: Should to return the evict error [+ + +]
Author: Emily Deng <Emily.Deng@amd.com>
Date:   Tue Jun 3 17:11:54 2025 +0800

    drm/ttm: Should to return the evict error
    
    [ Upstream commit 4e16a9a00239db5d819197b9a00f70665951bf50 ]
    
    For the evict fail case, the evict error should be returned.
    
    v2: Consider ENOENT case.
    
    v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
     and not wait for the move to finish
    
    Signed-off-by: Emily Deng <Emily.Deng@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Link: https://lore.kernel.org/r/20250603091154.3472646-1-Emily.Deng@amd.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
e1000e: disregard NVM checksum on tgp when valid checksum bit is not set [+ + +]
Author: Jacek Kowalski <jacek@jacekk.info>
Date:   Mon Jun 30 10:33:39 2025 +0200

    e1000e: disregard NVM checksum on tgp when valid checksum bit is not set
    
    commit 536fd741c7ac907d63166cdae1081b1febfab613 upstream.
    
    As described by Vitaly Lifshits:
    
    > Starting from Tiger Lake, LAN NVM is locked for writes by SW, so the
    > driver cannot perform checksum validation and correction. This means
    > that all NVM images must leave the factory with correct checksum and
    > checksum valid bit set. Since Tiger Lake devices were the first to have
    > this lock, some systems in the field did not meet this requirement.
    > Therefore, for these transitional devices we skip checksum update and
    > verification, if the valid bit is not set.
    
    Signed-off-by: Jacek Kowalski <jacek@jacekk.info>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
    Fixes: 4051f68318ca9 ("e1000e: Do not take care about recovery NVM checksum")
    Cc: stable@vger.kernel.org
    Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

e1000e: ignore uninitialized checksum word on tgp [+ + +]
Author: Jacek Kowalski <jacek@jacekk.info>
Date:   Mon Jun 30 10:35:00 2025 +0200

    e1000e: ignore uninitialized checksum word on tgp
    
    commit 61114910a5f6a71d0b6ea3b95082dfe031b19dfe upstream.
    
    As described by Vitaly Lifshits:
    
    > Starting from Tiger Lake, LAN NVM is locked for writes by SW, so the
    > driver cannot perform checksum validation and correction. This means
    > that all NVM images must leave the factory with correct checksum and
    > checksum valid bit set.
    
    Unfortunately some systems have left the factory with an uninitialized
    value of 0xFFFF at register address 0x3F (checksum word location).
    So on Tiger Lake platform we ignore the computed checksum when such
    condition is encountered.
    
    Signed-off-by: Jacek Kowalski <jacek@jacekk.info>
    Tested-by: Vlad URSU <vlad@ursu.me>
    Fixes: 4051f68318ca9 ("e1000e: Do not take care about recovery NVM checksum")
    Cc: stable@vger.kernel.org
    Reviewed-by: Simon Horman <horms@kernel.org>
    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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
et131x: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Wed Jul 16 11:47:30 2025 +0200

    et131x: Add missing check after DMA map
    
    [ Upstream commit d61f6cb6f6ef3c70d2ccc0d9c85c508cb8017da9 ]
    
    The DMA map functions can fail and should be tested for errors.
    If the mapping fails, unmap and return an error.
    
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Acked-by: Mark Einon <mark.einon@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250716094733.28734-2-fourier.thomas@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ethernet: intel: fix building with large NR_CPUS [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Jun 20 19:31:24 2025 +0200

    ethernet: intel: fix building with large NR_CPUS
    
    [ Upstream commit 24171a5a4a952c26568ff0d2a0bc8c4708a95e1d ]
    
    With large values of CONFIG_NR_CPUS, three Intel ethernet drivers fail to
    compile like:
    
    In function ‘i40e_free_q_vector’,
        inlined from ‘i40e_vsi_alloc_q_vectors’ at drivers/net/ethernet/intel/i40e/i40e_main.c:12112:3:
      571 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
    include/linux/rcupdate.h:1084:17: note: in expansion of macro ‘BUILD_BUG_ON’
     1084 |                 BUILD_BUG_ON(offsetof(typeof(*(ptr)), rhf) >= 4096);    \
    drivers/net/ethernet/intel/i40e/i40e_main.c:5113:9: note: in expansion of macro ‘kfree_rcu’
     5113 |         kfree_rcu(q_vector, rcu);
          |         ^~~~~~~~~
    
    The problem is that the 'rcu' member in 'q_vector' is too far from the start
    of the structure. Move this member before the CPU mask instead, in all three
    drivers.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: David S. Miller <davem@davemloft.net>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ext4: check fast symlink for ea_inode correctly [+ + +]
Author: Andreas Dilger <adilger@dilger.ca>
Date:   Wed Jul 16 19:36:42 2025 -0600

    ext4: check fast symlink for ea_inode correctly
    
    commit b4cc4a4077268522e3d0d34de4b2dc144e2330fa upstream.
    
    The check for a fast symlink in the presence of only an
    external xattr inode is incorrect.  If a fast symlink does
    not have an xattr block (i_file_acl == 0), but does have
    an external xattr inode that increases inode i_blocks, then
    the check for a fast symlink will incorrectly fail and
    __ext4_iget()->ext4_ind_check_inode() will report the inode
    is corrupt when it "validates" i_data[] on the next read:
    
        # ln -s foo /mnt/tmp/bar
        # setfattr -h -n trusted.test \
                   -v "$(yes | head -n 4000)" /mnt/tmp/bar
        # umount /mnt/tmp
        # mount /mnt/tmp
        # ls -l /mnt/tmp
        ls: cannot access '/mnt/tmp/bar': Structure needs cleaning
        total 4
         ? l?????????? ? ?    ?        ?            ? bar
        # dmesg | tail -1
        EXT4-fs error (device dm-8): __ext4_iget:5098:
            inode #24578: block 7303014: comm ls: invalid block
    
    (note that "block 7303014" = 0x6f6f66 = "foo" in LE order).
    
    ext4_inode_is_fast_symlink() should check the superblock
    EXT4_FEATURE_INCOMPAT_EA_INODE feature flag, not the inode
    EXT4_EA_INODE_FL, since the latter is only set on the xattr
    inode itself, and not on the inode that uses this xattr.
    
    Cc: stable@vger.kernel.org
    Fixes: fc82228a5e38 ("ext4: support fast symlinks from ext3 file systems")
    Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
    Reviewed-by: Li Dongyang <dongyangli@ddn.com>
    Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
    Reviewed-by: Oleg Drokin <green@whamcloud.com>
    Reviewed-on: https://review.whamcloud.com/59879
    Lustre-bug-id: https://jira.whamcloud.com/browse/LU-19121
    Link: https://patch.msgid.link/20250717063709.757077-1-adilger@dilger.ca
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Jul 17 10:54:34 2025 -0400

    ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr
    
    [ Upstream commit 099b847ccc6c1ad2f805d13cfbcc83f5b6d4bc42 ]
    
    A syzbot fuzzed image triggered a BUG_ON in ext4_update_inline_data()
    when an inode had the INLINE_DATA_FL flag set but was missing the
    system.data extended attribute.
    
    Since this can happen due to a maiciouly fuzzed file system, we
    shouldn't BUG, but rather, report it as a corrupted file system.
    
    Add similar replacements of BUG_ON with EXT4_ERROR_INODE() ii
    ext4_create_inline_data() and ext4_inline_data_truncate().
    
    Reported-by: syzbot+544248a761451c0df72f@syzkaller.appspotmail.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ext4: fix fsmap end of range reporting with bigalloc [+ + +]
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Date:   Tue Aug 5 14:00:30 2025 +0530

    ext4: fix fsmap end of range reporting with bigalloc
    
    commit bae76c035bf0852844151e68098c9b7cd63ef238 upstream.
    
    With bigalloc enabled, the logic to report last extent has a bug since
    we try to use cluster units instead of block units. This can cause an
    issue where extra incorrect entries might be returned back to the
    user. This was flagged by generic/365 with 64k bs and -O bigalloc.
    
    ** Details of issue **
    
    The issue was noticed on 5G 64k blocksize FS with -O bigalloc which has
    only 1 bg.
    
    $ xfs_io -c "fsmap -d" /mnt/scratch
    
      0: 253:48 [0..127]: static fs metadata 128   /* sb */
      1: 253:48 [128..255]: special 102:1 128   /* gdt */
      3: 253:48 [256..383]: special 102:3 128   /* block bitmap */
      4: 253:48 [384..2303]: unknown 1920       /* flex bg empty space */
      5: 253:48 [2304..2431]: special 102:4 128   /* inode bitmap */
      6: 253:48 [2432..4351]: unknown 1920      /* flex bg empty space */
      7: 253:48 [4352..6911]: inodes 2560
      8: 253:48 [6912..538623]: unknown 531712
      9: 253:48 [538624..10485759]: free space 9947136
    
    The issue can be seen with:
    
    $ xfs_io -c "fsmap -d 0 3" /mnt/scratch
    
      0: 253:48 [0..127]: static fs metadata 128
      1: 253:48 [384..2047]: unknown 1664
    
    Only the first entry was expected to be returned but we get 2. This is
    because:
    
    ext4_getfsmap_datadev()
      first_cluster, last_cluster = 0
      ...
      info->gfi_last = true;
      ext4_getfsmap_datadev_helper(sb, end_ag, last_cluster + 1, 0, info);
        fsb = C2B(1) = 16
        fslen = 0
        ...
        /* Merge in any relevant extents from the meta_list */
        list_for_each_entry_safe(p, tmp, &info->gfi_meta_list, fmr_list) {
          ...
          // since fsb = 16, considers all metadata which starts before 16 blockno
          iter 1: error = ext4_getfsmap_helper(sb, info, p);  // p = sb (0,1), nop
            info->gfi_next_fsblk = 1
          iter 2: error = ext4_getfsmap_helper(sb, info, p);  // p = gdt (1,2), nop
            info->gfi_next_fsblk = 2
          iter 3: error = ext4_getfsmap_helper(sb, info, p);  // p = blk bitmap (2,3), nop
            info->gfi_next_fsblk = 3
          iter 4: error = ext4_getfsmap_helper(sb, info, p);  // p = ino bitmap (18,19)
            if (rec_blk > info->gfi_next_fsblk) { // (18 > 3)
              // emits an extra entry ** BUG **
            }
        }
    
    Fix this by directly calling ext4_getfsmap_datadev() with a dummy
    record that has fmr_physical set to (end_fsb + 1) instead of
    last_cluster + 1. By using the block instead of cluster we get the
    correct behavior.
    
    Replacing ext4_getfsmap_datadev_helper() with ext4_getfsmap_helper()
    is okay since the gfi_lastfree and metadata checks in
    ext4_getfsmap_datadev_helper() are anyways redundant when we only want
    to emit the last allocated block of the range, as we have already
    taken care of emitting metadata and any last free blocks.
    
    Cc: stable@kernel.org
    Reported-by: Disha Goel <disgoel@linux.ibm.com>
    Fixes: 4a622e4d477b ("ext4: fix FS_IOC_GETFSMAP handling")
    Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Link: https://patch.msgid.link/e7472c8535c9c5ec10f425f495366864ea12c9da.1754377641.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: fix hole length calculation overflow in non-extent inodes [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Fri Aug 22 00:16:40 2025 -0400

    ext4: fix hole length calculation overflow in non-extent inodes
    
    [ Upstream commit 02c7f7219ac0e2277b3379a3a0e9841ef464b6d4 ]
    
    In a filesystem with a block size larger than 4KB, the hole length
    calculation for a non-extent inode in ext4_ind_map_blocks() can easily
    exceed INT_MAX. Then it could return a zero length hole and trigger the
    following waring and infinite in the iomap infrastructure.
    
      ------------[ cut here ]------------
      WARNING: CPU: 3 PID: 434101 at fs/iomap/iter.c:34 iomap_iter_done+0x148/0x190
      CPU: 3 UID: 0 PID: 434101 Comm: fsstress Not tainted 6.16.0-rc7+ #128 PREEMPT(voluntary)
      Hardware name: QEMU KVM Virtual Machine, BIOS unknown 2/2/2022
      pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : iomap_iter_done+0x148/0x190
      lr : iomap_iter+0x174/0x230
      sp : ffff8000880af740
      x29: ffff8000880af740 x28: ffff0000db8e6840 x27: 0000000000000000
      x26: 0000000000000000 x25: ffff8000880af830 x24: 0000004000000000
      x23: 0000000000000002 x22: 000001bfdbfa8000 x21: ffffa6a41c002e48
      x20: 0000000000000001 x19: ffff8000880af808 x18: 0000000000000000
      x17: 0000000000000000 x16: ffffa6a495ee6cd0 x15: 0000000000000000
      x14: 00000000000003d4 x13: 00000000fa83b2da x12: 0000b236fc95f18c
      x11: ffffa6a4978b9c08 x10: 0000000000001da0 x9 : ffffa6a41c1a2a44
      x8 : ffff8000880af5c8 x7 : 0000000001000000 x6 : 0000000000000000
      x5 : 0000000000000004 x4 : 000001bfdbfa8000 x3 : 0000000000000000
      x2 : 0000000000000000 x1 : 0000004004030000 x0 : 0000000000000000
      Call trace:
       iomap_iter_done+0x148/0x190 (P)
       iomap_iter+0x174/0x230
       iomap_fiemap+0x154/0x1d8
       ext4_fiemap+0x110/0x140 [ext4]
       do_vfs_ioctl+0x4b8/0xbc0
       __arm64_sys_ioctl+0x8c/0x120
       invoke_syscall+0x6c/0x100
       el0_svc_common.constprop.0+0x48/0xf0
       do_el0_svc+0x24/0x38
       el0_svc+0x38/0x120
       el0t_64_sync_handler+0x10c/0x138
       el0t_64_sync+0x198/0x1a0
      ---[ end trace 0000000000000000 ]---
    
    Cc: stable@kernel.org
    Fixes: facab4d9711e ("ext4: return hole from ext4_map_blocks()")
    Reported-by: Qu Wenruo <wqu@suse.com>
    Closes: https://lore.kernel.org/linux-ext4/9b650a52-9672-4604-a765-bb6be55d1e4a@gmx.com/
    Tested-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Link: https://patch.msgid.link/20250811064532.1788289-1-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: fix reserved gdt blocks handling in fsmap [+ + +]
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Date:   Tue Aug 5 14:00:31 2025 +0530

    ext4: fix reserved gdt blocks handling in fsmap
    
    commit 3ffbdd1f1165f1b2d6a94d1b1aabef57120deaf7 upstream.
    
    In some cases like small FSes with no meta_bg and where the resize
    doesn't need extra gdt blocks as it can fit in the current one,
    s_reserved_gdt_blocks is set as 0, which causes fsmap to emit a 0
    length entry, which is incorrect.
    
      $ mkfs.ext4 -b 65536 -O bigalloc /dev/sda 5G
      $ mount /dev/sda /mnt/scratch
      $ xfs_io -c "fsmap -d" /mnt/scartch
    
            0: 253:48 [0..127]: static fs metadata 128
            1: 253:48 [128..255]: special 102:1 128
            2: 253:48 [256..255]: special 102:2 0     <---- 0 len entry
            3: 253:48 [256..383]: special 102:3 128
    
    Fix this by adding a check for this case.
    
    Cc: stable@kernel.org
    Fixes: 0c9ec4beecac ("ext4: support GETFSMAP ioctls")
    Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Link: https://patch.msgid.link/08781b796453a5770112aa96ad14c864fbf31935.1754377641.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
f2fs: doc: fix wrong quota mount option description [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Wed Jul 2 14:49:25 2025 +0800

    f2fs: doc: fix wrong quota mount option description
    
    [ Upstream commit 81b6ecca2f15922e8d653dc037df5871e754be6e ]
    
    We should use "{usr,grp,prj}jquota=" to disable journaled quota,
    rather than using off{usr,grp,prj}jquota.
    
    Fixes: 4b2414d04e99 ("f2fs: support journalled quota")
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

f2fs: fix to avoid out-of-boundary access in devs.path [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Fri Jul 11 15:14:50 2025 +0800

    f2fs: fix to avoid out-of-boundary access in devs.path
    
    [ Upstream commit 5661998536af52848cc4d52a377e90368196edea ]
    
    - touch /mnt/f2fs/012345678901234567890123456789012345678901234567890123
    - truncate -s $((1024*1024*1024)) \
      /mnt/f2fs/012345678901234567890123456789012345678901234567890123
    - touch /mnt/f2fs/file
    - truncate -s $((1024*1024*1024)) /mnt/f2fs/file
    - mkfs.f2fs /mnt/f2fs/012345678901234567890123456789012345678901234567890123 \
      -c /mnt/f2fs/file
    - mount /mnt/f2fs/012345678901234567890123456789012345678901234567890123 \
      /mnt/f2fs/loop
    
    [16937.192225] F2FS-fs (loop0): Mount Device [ 0]: /mnt/f2fs/012345678901234567890123456789012345678901234567890123\xff\x01,      511,        0 -    3ffff
    [16937.192268] F2FS-fs (loop0): Failed to find devices
    
    If device path length equals to MAX_PATH_LEN, sbi->devs.path[] may
    not end up w/ null character due to path array is fully filled, So
    accidently, fields locate after path[] may be treated as part of
    device path, result in parsing wrong device path.
    
    struct f2fs_dev_info {
    ...
            char path[MAX_PATH_LEN];
    ...
    };
    
    Let's add one byte space for sbi->devs.path[] to store null
    character of device path string.
    
    Fixes: 3c62be17d4f5 ("f2fs: support multiple devices")
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

f2fs: fix to avoid out-of-boundary access in dnode page [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Sat Aug 23 00:10:38 2025 -0400

    f2fs: fix to avoid out-of-boundary access in dnode page
    
    [ Upstream commit 77de19b6867f2740cdcb6c9c7e50d522b47847a4 ]
    
    As Jiaming Zhang reported:
    
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:378 [inline]
     print_report+0x17e/0x800 mm/kasan/report.c:480
     kasan_report+0x147/0x180 mm/kasan/report.c:593
     data_blkaddr fs/f2fs/f2fs.h:3053 [inline]
     f2fs_data_blkaddr fs/f2fs/f2fs.h:3058 [inline]
     f2fs_get_dnode_of_data+0x1a09/0x1c40 fs/f2fs/node.c:855
     f2fs_reserve_block+0x53/0x310 fs/f2fs/data.c:1195
     prepare_write_begin fs/f2fs/data.c:3395 [inline]
     f2fs_write_begin+0xf39/0x2190 fs/f2fs/data.c:3594
     generic_perform_write+0x2c7/0x910 mm/filemap.c:4112
     f2fs_buffered_write_iter fs/f2fs/file.c:4988 [inline]
     f2fs_file_write_iter+0x1ec8/0x2410 fs/f2fs/file.c:5216
     new_sync_write fs/read_write.c:593 [inline]
     vfs_write+0x546/0xa90 fs/read_write.c:686
     ksys_write+0x149/0x250 fs/read_write.c:738
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xf3/0x3d0 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    The root cause is in the corrupted image, there is a dnode has the same
    node id w/ its inode, so during f2fs_get_dnode_of_data(), it tries to
    access block address in dnode at offset 934, however it parses the dnode
    as inode node, so that get_dnode_addr() returns 360, then it tries to
    access page address from 360 + 934 * 4 = 4096 w/ 4 bytes.
    
    To fix this issue, let's add sanity check for node id of all direct nodes
    during f2fs_get_dnode_of_data().
    
    Cc: stable@kernel.org
    Reported-by: Jiaming Zhang <r772577952@gmail.com>
    Closes: https://groups.google.com/g/syzkaller/c/-ZnaaOOfO3M
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    [ replaced f2fs_err_ratelimited() with f2fs_err() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

f2fs: fix to avoid panic in f2fs_evict_inode [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Tue Jul 8 17:56:57 2025 +0800

    f2fs: fix to avoid panic in f2fs_evict_inode
    
    [ Upstream commit a509a55f8eecc8970b3980c6f06886bbff0e2f68 ]
    
    As syzbot [1] reported as below:
    
    R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffe17473450
    R13: 00007f28b1c10854 R14: 000000000000dae5 R15: 00007ffe17474520
     </TASK>
    ---[ end trace 0000000000000000 ]---
    ==================================================================
    BUG: KASAN: use-after-free in __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
    Read of size 8 at addr ffff88812d962278 by task syz-executor/564
    
    CPU: 1 PID: 564 Comm: syz-executor Tainted: G        W          6.1.129-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    Call Trace:
     <TASK>
     __dump_stack+0x21/0x24 lib/dump_stack.c:88
     dump_stack_lvl+0xee/0x158 lib/dump_stack.c:106
     print_address_description+0x71/0x210 mm/kasan/report.c:316
     print_report+0x4a/0x60 mm/kasan/report.c:427
     kasan_report+0x122/0x150 mm/kasan/report.c:531
     __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
     __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
     __list_del_entry include/linux/list.h:134 [inline]
     list_del_init include/linux/list.h:206 [inline]
     f2fs_inode_synced+0xf7/0x2e0 fs/f2fs/super.c:1531
     f2fs_update_inode+0x74/0x1c40 fs/f2fs/inode.c:585
     f2fs_update_inode_page+0x137/0x170 fs/f2fs/inode.c:703
     f2fs_write_inode+0x4ec/0x770 fs/f2fs/inode.c:731
     write_inode fs/fs-writeback.c:1460 [inline]
     __writeback_single_inode+0x4a0/0xab0 fs/fs-writeback.c:1677
     writeback_single_inode+0x221/0x8b0 fs/fs-writeback.c:1733
     sync_inode_metadata+0xb6/0x110 fs/fs-writeback.c:2789
     f2fs_sync_inode_meta+0x16d/0x2a0 fs/f2fs/checkpoint.c:1159
     block_operations fs/f2fs/checkpoint.c:1269 [inline]
     f2fs_write_checkpoint+0xca3/0x2100 fs/f2fs/checkpoint.c:1658
     kill_f2fs_super+0x231/0x390 fs/f2fs/super.c:4668
     deactivate_locked_super+0x98/0x100 fs/super.c:332
     deactivate_super+0xaf/0xe0 fs/super.c:363
     cleanup_mnt+0x45f/0x4e0 fs/namespace.c:1186
     __cleanup_mnt+0x19/0x20 fs/namespace.c:1193
     task_work_run+0x1c6/0x230 kernel/task_work.c:203
     exit_task_work include/linux/task_work.h:39 [inline]
     do_exit+0x9fb/0x2410 kernel/exit.c:871
     do_group_exit+0x210/0x2d0 kernel/exit.c:1021
     __do_sys_exit_group kernel/exit.c:1032 [inline]
     __se_sys_exit_group kernel/exit.c:1030 [inline]
     __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1030
     x64_sys_call+0x7b4/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:232
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x68/0xd2
    RIP: 0033:0x7f28b1b8e169
    Code: Unable to access opcode bytes at 0x7f28b1b8e13f.
    RSP: 002b:00007ffe174710a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
    RAX: ffffffffffffffda RBX: 00007f28b1c10879 RCX: 00007f28b1b8e169
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
    RBP: 0000000000000002 R08: 00007ffe1746ee47 R09: 00007ffe17472360
    R10: 0000000000000009 R11: 0000000000000246 R12: 00007ffe17472360
    R13: 00007f28b1c10854 R14: 000000000000dae5 R15: 00007ffe17474520
     </TASK>
    
    Allocated by task 569:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
     kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
     __kasan_slab_alloc+0x72/0x80 mm/kasan/common.c:328
     kasan_slab_alloc include/linux/kasan.h:201 [inline]
     slab_post_alloc_hook+0x4f/0x2c0 mm/slab.h:737
     slab_alloc_node mm/slub.c:3398 [inline]
     slab_alloc mm/slub.c:3406 [inline]
     __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
     kmem_cache_alloc_lru+0x104/0x220 mm/slub.c:3429
     alloc_inode_sb include/linux/fs.h:3245 [inline]
     f2fs_alloc_inode+0x2d/0x340 fs/f2fs/super.c:1419
     alloc_inode fs/inode.c:261 [inline]
     iget_locked+0x186/0x880 fs/inode.c:1373
     f2fs_iget+0x55/0x4c60 fs/f2fs/inode.c:483
     f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:487
     __lookup_slow+0x2a3/0x3d0 fs/namei.c:1690
     lookup_slow+0x57/0x70 fs/namei.c:1707
     walk_component+0x2e6/0x410 fs/namei.c:1998
     lookup_last fs/namei.c:2455 [inline]
     path_lookupat+0x180/0x490 fs/namei.c:2479
     filename_lookup+0x1f0/0x500 fs/namei.c:2508
     vfs_statx+0x10b/0x660 fs/stat.c:229
     vfs_fstatat fs/stat.c:267 [inline]
     vfs_lstat include/linux/fs.h:3424 [inline]
     __do_sys_newlstat fs/stat.c:423 [inline]
     __se_sys_newlstat+0xd5/0x350 fs/stat.c:417
     __x64_sys_newlstat+0x5b/0x70 fs/stat.c:417
     x64_sys_call+0x393/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:7
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x68/0xd2
    
    Freed by task 13:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
     kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516
     ____kasan_slab_free+0x132/0x180 mm/kasan/common.c:236
     __kasan_slab_free+0x11/0x20 mm/kasan/common.c:244
     kasan_slab_free include/linux/kasan.h:177 [inline]
     slab_free_hook mm/slub.c:1724 [inline]
     slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1750
     slab_free mm/slub.c:3661 [inline]
     kmem_cache_free+0x12d/0x2a0 mm/slub.c:3683
     f2fs_free_inode+0x24/0x30 fs/f2fs/super.c:1562
     i_callback+0x4c/0x70 fs/inode.c:250
     rcu_do_batch+0x503/0xb80 kernel/rcu/tree.c:2297
     rcu_core+0x5a2/0xe70 kernel/rcu/tree.c:2557
     rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2574
     handle_softirqs+0x178/0x500 kernel/softirq.c:578
     run_ksoftirqd+0x28/0x30 kernel/softirq.c:945
     smpboot_thread_fn+0x45a/0x8c0 kernel/smpboot.c:164
     kthread+0x270/0x310 kernel/kthread.c:376
     ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
    
    Last potentially related work creation:
     kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
     __kasan_record_aux_stack+0xb6/0xc0 mm/kasan/generic.c:486
     kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
     call_rcu+0xd4/0xf70 kernel/rcu/tree.c:2845
     destroy_inode fs/inode.c:316 [inline]
     evict+0x7da/0x870 fs/inode.c:720
     iput_final fs/inode.c:1834 [inline]
     iput+0x62b/0x830 fs/inode.c:1860
     do_unlinkat+0x356/0x540 fs/namei.c:4397
     __do_sys_unlink fs/namei.c:4438 [inline]
     __se_sys_unlink fs/namei.c:4436 [inline]
     __x64_sys_unlink+0x49/0x50 fs/namei.c:4436
     x64_sys_call+0x958/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x68/0xd2
    
    The buggy address belongs to the object at ffff88812d961f20
     which belongs to the cache f2fs_inode_cache of size 1200
    The buggy address is located 856 bytes inside of
     1200-byte region [ffff88812d961f20, ffff88812d9623d0)
    
    The buggy address belongs to the physical page:
    page:ffffea0004b65800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12d960
    head:ffffea0004b65800 order:2 compound_mapcount:0 compound_pincount:0
    flags: 0x4000000000010200(slab|head|zone=1)
    raw: 4000000000010200 0000000000000000 dead000000000122 ffff88810a94c500
    raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 569, tgid 568 (syz.2.16), ts 55943246141, free_ts 0
     set_page_owner include/linux/page_owner.h:31 [inline]
     post_alloc_hook+0x1d0/0x1f0 mm/page_alloc.c:2532
     prep_new_page mm/page_alloc.c:2539 [inline]
     get_page_from_freelist+0x2e63/0x2ef0 mm/page_alloc.c:4328
     __alloc_pages+0x235/0x4b0 mm/page_alloc.c:5605
     alloc_slab_page include/linux/gfp.h:-1 [inline]
     allocate_slab mm/slub.c:1939 [inline]
     new_slab+0xec/0x4b0 mm/slub.c:1992
     ___slab_alloc+0x6f6/0xb50 mm/slub.c:3180
     __slab_alloc+0x5e/0xa0 mm/slub.c:3279
     slab_alloc_node mm/slub.c:3364 [inline]
     slab_alloc mm/slub.c:3406 [inline]
     __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
     kmem_cache_alloc_lru+0x13f/0x220 mm/slub.c:3429
     alloc_inode_sb include/linux/fs.h:3245 [inline]
     f2fs_alloc_inode+0x2d/0x340 fs/f2fs/super.c:1419
     alloc_inode fs/inode.c:261 [inline]
     iget_locked+0x186/0x880 fs/inode.c:1373
     f2fs_iget+0x55/0x4c60 fs/f2fs/inode.c:483
     f2fs_fill_super+0x3ad7/0x6bb0 fs/f2fs/super.c:4293
     mount_bdev+0x2ae/0x3e0 fs/super.c:1443
     f2fs_mount+0x34/0x40 fs/f2fs/super.c:4642
     legacy_get_tree+0xea/0x190 fs/fs_context.c:632
     vfs_get_tree+0x89/0x260 fs/super.c:1573
     do_new_mount+0x25a/0xa20 fs/namespace.c:3056
    page_owner free stack trace missing
    
    Memory state around the buggy address:
     ffff88812d962100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff88812d962180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff88812d962200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                    ^
     ffff88812d962280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff88812d962300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================
    
    [1] https://syzkaller.appspot.com/x/report.txt?x=13448368580000
    
    This bug can be reproduced w/ the reproducer [2], once we enable
    CONFIG_F2FS_CHECK_FS config, the reproducer will trigger panic as below,
    so the direct reason of this bug is the same as the one below patch [3]
    fixed.
    
    kernel BUG at fs/f2fs/inode.c:857!
    RIP: 0010:f2fs_evict_inode+0x1204/0x1a20
    Call Trace:
     <TASK>
     evict+0x32a/0x7a0
     do_unlinkat+0x37b/0x5b0
     __x64_sys_unlink+0xad/0x100
     do_syscall_64+0x5a/0xb0
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    RIP: 0010:f2fs_evict_inode+0x1204/0x1a20
    
    [2] https://syzkaller.appspot.com/x/repro.c?x=17495ccc580000
    [3] https://lore.kernel.org/linux-f2fs-devel/20250702120321.1080759-1-chao@kernel.org
    
    Tracepoints before panic:
    
    f2fs_unlink_enter: dev = (7,0), dir ino = 3, i_size = 4096, i_blocks = 8, name = file1
    f2fs_unlink_exit: dev = (7,0), ino = 7, ret = 0
    f2fs_evict_inode: dev = (7,0), ino = 7, pino = 3, i_mode = 0x81ed, i_size = 10, i_nlink = 0, i_blocks = 0, i_advise = 0x0
    f2fs_truncate_node: dev = (7,0), ino = 7, nid = 8, block_address = 0x3c05
    
    f2fs_unlink_enter: dev = (7,0), dir ino = 3, i_size = 4096, i_blocks = 8, name = file3
    f2fs_unlink_exit: dev = (7,0), ino = 8, ret = 0
    f2fs_evict_inode: dev = (7,0), ino = 8, pino = 3, i_mode = 0x81ed, i_size = 9000, i_nlink = 0, i_blocks = 24, i_advise = 0x4
    f2fs_truncate: dev = (7,0), ino = 8, pino = 3, i_mode = 0x81ed, i_size = 0, i_nlink = 0, i_blocks = 24, i_advise = 0x4
    f2fs_truncate_blocks_enter: dev = (7,0), ino = 8, i_size = 0, i_blocks = 24, start file offset = 0
    f2fs_truncate_blocks_exit: dev = (7,0), ino = 8, ret = -2
    
    The root cause is: in the fuzzed image, dnode #8 belongs to inode #7,
    after inode #7 eviction, dnode #8 was dropped.
    
    However there is dirent that has ino #8, so, once we unlink file3, in
    f2fs_evict_inode(), both f2fs_truncate() and f2fs_update_inode_page()
    will fail due to we can not load node #8, result in we missed to call
    f2fs_inode_synced() to clear inode dirty status.
    
    Let's fix this by calling f2fs_inode_synced() in error path of
    f2fs_evict_inode().
    
    PS: As I verified, the reproducer [2] can trigger this bug in v6.1.129,
    but it failed in v6.16-rc4, this is because the testcase will stop due to
    other corruption has been detected by f2fs:
    
    F2FS-fs (loop0): inconsistent node block, node_type:2, nid:8, node_footer[nid:8,ino:8,ofs:0,cpver:5013063228981249506,blkaddr:15366]
    F2FS-fs (loop0): f2fs_lookup: inode (ino=9) has zero i_nlink
    
    Fixes: 0f18b462b2e5 ("f2fs: flush inode metadata when checkpoint is doing")
    Closes: https://syzkaller.appspot.com/x/report.txt?x=13448368580000
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

f2fs: fix to avoid UAF in f2fs_sync_inode_meta() [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Tue Jul 8 17:53:39 2025 +0800

    f2fs: fix to avoid UAF in f2fs_sync_inode_meta()
    
    [ Upstream commit 7c30d79930132466f5be7d0b57add14d1a016bda ]
    
    syzbot reported an UAF issue as below: [1] [2]
    
    [1] https://syzkaller.appspot.com/text?tag=CrashReport&x=16594c60580000
    
    ==================================================================
    BUG: KASAN: use-after-free in __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
    Read of size 8 at addr ffff888100567dc8 by task kworker/u4:0/8
    
    CPU: 1 PID: 8 Comm: kworker/u4:0 Tainted: G        W          6.1.129-syzkaller-00017-g642656a36791 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    Workqueue: writeback wb_workfn (flush-7:0)
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
     print_address_description mm/kasan/report.c:316 [inline]
     print_report+0x158/0x4e0 mm/kasan/report.c:427
     kasan_report+0x13c/0x170 mm/kasan/report.c:531
     __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
     __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
     __list_del_entry include/linux/list.h:134 [inline]
     list_del_init include/linux/list.h:206 [inline]
     f2fs_inode_synced+0x100/0x2e0 fs/f2fs/super.c:1553
     f2fs_update_inode+0x72/0x1c40 fs/f2fs/inode.c:588
     f2fs_update_inode_page+0x135/0x170 fs/f2fs/inode.c:706
     f2fs_write_inode+0x416/0x790 fs/f2fs/inode.c:734
     write_inode fs/fs-writeback.c:1460 [inline]
     __writeback_single_inode+0x4cf/0xb80 fs/fs-writeback.c:1677
     writeback_sb_inodes+0xb32/0x1910 fs/fs-writeback.c:1903
     __writeback_inodes_wb+0x118/0x3f0 fs/fs-writeback.c:1974
     wb_writeback+0x3da/0xa00 fs/fs-writeback.c:2081
     wb_check_background_flush fs/fs-writeback.c:2151 [inline]
     wb_do_writeback fs/fs-writeback.c:2239 [inline]
     wb_workfn+0xbba/0x1030 fs/fs-writeback.c:2266
     process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
     worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
     kthread+0x26d/0x300 kernel/kthread.c:386
     ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
     </TASK>
    
    Allocated by task 298:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
     kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
     __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:333
     kasan_slab_alloc include/linux/kasan.h:202 [inline]
     slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
     slab_alloc_node mm/slub.c:3421 [inline]
     slab_alloc mm/slub.c:3431 [inline]
     __kmem_cache_alloc_lru mm/slub.c:3438 [inline]
     kmem_cache_alloc_lru+0x102/0x270 mm/slub.c:3454
     alloc_inode_sb include/linux/fs.h:3255 [inline]
     f2fs_alloc_inode+0x2d/0x350 fs/f2fs/super.c:1437
     alloc_inode fs/inode.c:261 [inline]
     iget_locked+0x18c/0x7e0 fs/inode.c:1373
     f2fs_iget+0x55/0x4ca0 fs/f2fs/inode.c:486
     f2fs_lookup+0x3c1/0xb50 fs/f2fs/namei.c:484
     __lookup_slow+0x2b9/0x3e0 fs/namei.c:1689
     lookup_slow+0x5a/0x80 fs/namei.c:1706
     walk_component+0x2e7/0x410 fs/namei.c:1997
     lookup_last fs/namei.c:2454 [inline]
     path_lookupat+0x16d/0x450 fs/namei.c:2478
     filename_lookup+0x251/0x600 fs/namei.c:2507
     vfs_statx+0x107/0x4b0 fs/stat.c:229
     vfs_fstatat fs/stat.c:267 [inline]
     vfs_lstat include/linux/fs.h:3434 [inline]
     __do_sys_newlstat fs/stat.c:423 [inline]
     __se_sys_newlstat+0xda/0x7c0 fs/stat.c:417
     __x64_sys_newlstat+0x5b/0x70 fs/stat.c:417
     x64_sys_call+0x52/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:7
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x68/0xd2
    
    Freed by task 0:
     kasan_save_stack mm/kasan/common.c:45 [inline]
     kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
     kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
     ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
     __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
     kasan_slab_free include/linux/kasan.h:178 [inline]
     slab_free_hook mm/slub.c:1745 [inline]
     slab_free_freelist_hook mm/slub.c:1771 [inline]
     slab_free mm/slub.c:3686 [inline]
     kmem_cache_free+0x291/0x560 mm/slub.c:3711
     f2fs_free_inode+0x24/0x30 fs/f2fs/super.c:1584
     i_callback+0x4b/0x70 fs/inode.c:250
     rcu_do_batch+0x552/0xbe0 kernel/rcu/tree.c:2297
     rcu_core+0x502/0xf40 kernel/rcu/tree.c:2557
     rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2574
     handle_softirqs+0x1db/0x650 kernel/softirq.c:624
     __do_softirq kernel/softirq.c:662 [inline]
     invoke_softirq kernel/softirq.c:479 [inline]
     __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:711
     irq_exit_rcu+0x9/0x10 kernel/softirq.c:723
     instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
     sysvec_apic_timer_interrupt+0xa9/0xc0 arch/x86/kernel/apic/apic.c:1118
     asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:691
    
    Last potentially related work creation:
     kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
     __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
     kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
     __call_rcu_common kernel/rcu/tree.c:2807 [inline]
     call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
     destroy_inode fs/inode.c:316 [inline]
     evict+0x87d/0x930 fs/inode.c:720
     iput_final fs/inode.c:1834 [inline]
     iput+0x616/0x690 fs/inode.c:1860
     do_unlinkat+0x4e1/0x920 fs/namei.c:4396
     __do_sys_unlink fs/namei.c:4437 [inline]
     __se_sys_unlink fs/namei.c:4435 [inline]
     __x64_sys_unlink+0x49/0x50 fs/namei.c:4435
     x64_sys_call+0x289/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x68/0xd2
    
    The buggy address belongs to the object at ffff888100567a10
     which belongs to the cache f2fs_inode_cache of size 1360
    The buggy address is located 952 bytes inside of
     1360-byte region [ffff888100567a10, ffff888100567f60)
    
    The buggy address belongs to the physical page:
    page:ffffea0004015800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100560
    head:ffffea0004015800 order:3 compound_mapcount:0 compound_pincount:0
    flags: 0x4000000000010200(slab|head|zone=1)
    raw: 4000000000010200 0000000000000000 dead000000000122 ffff8881002c4d80
    raw: 0000000000000000 0000000080160016 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 298, tgid 298 (syz-executor330), ts 26489303743, free_ts 0
     set_page_owner include/linux/page_owner.h:33 [inline]
     post_alloc_hook+0x213/0x220 mm/page_alloc.c:2637
     prep_new_page+0x1b/0x110 mm/page_alloc.c:2644
     get_page_from_freelist+0x3a98/0x3b10 mm/page_alloc.c:4539
     __alloc_pages+0x234/0x610 mm/page_alloc.c:5837
     alloc_slab_page+0x6c/0xf0 include/linux/gfp.h:-1
     allocate_slab mm/slub.c:1962 [inline]
     new_slab+0x90/0x3e0 mm/slub.c:2015
     ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
     __slab_alloc+0x5d/0xa0 mm/slub.c:3302
     slab_alloc_node mm/slub.c:3387 [inline]
     slab_alloc mm/slub.c:3431 [inline]
     __kmem_cache_alloc_lru mm/slub.c:3438 [inline]
     kmem_cache_alloc_lru+0x149/0x270 mm/slub.c:3454
     alloc_inode_sb include/linux/fs.h:3255 [inline]
     f2fs_alloc_inode+0x2d/0x350 fs/f2fs/super.c:1437
     alloc_inode fs/inode.c:261 [inline]
     iget_locked+0x18c/0x7e0 fs/inode.c:1373
     f2fs_iget+0x55/0x4ca0 fs/f2fs/inode.c:486
     f2fs_fill_super+0x5360/0x6dc0 fs/f2fs/super.c:4488
     mount_bdev+0x282/0x3b0 fs/super.c:1445
     f2fs_mount+0x34/0x40 fs/f2fs/super.c:4743
     legacy_get_tree+0xf1/0x190 fs/fs_context.c:632
    page_owner free stack trace missing
    
    Memory state around the buggy address:
     ffff888100567c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888100567d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff888100567d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                  ^
     ffff888100567e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888100567e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================
    
    [2] https://syzkaller.appspot.com/text?tag=CrashLog&x=13654c60580000
    
    [   24.675720][   T28] audit: type=1400 audit(1745327318.732:72): avc:  denied  { write } for  pid=298 comm="syz-executor399" name="/" dev="loop0" ino=3 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:unlabeled_t tclass=dir permissive=1
    [   24.705426][  T296] ------------[ cut here ]------------
    [   24.706608][   T28] audit: type=1400 audit(1745327318.732:73): avc:  denied  { remove_name } for  pid=298 comm="syz-executor399" name="file0" dev="loop0" ino=4 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:unlabeled_t tclass=dir permissive=1
    [   24.711550][  T296] WARNING: CPU: 0 PID: 296 at fs/f2fs/inode.c:847 f2fs_evict_inode+0x1262/0x1540
    [   24.734141][   T28] audit: type=1400 audit(1745327318.732:74): avc:  denied  { rename } for  pid=298 comm="syz-executor399" name="file0" dev="loop0" ino=4 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:unlabeled_t tclass=dir permissive=1
    [   24.742969][  T296] Modules linked in:
    [   24.765201][   T28] audit: type=1400 audit(1745327318.732:75): avc:  denied  { add_name } for  pid=298 comm="syz-executor399" name="bus" scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:unlabeled_t tclass=dir permissive=1
    [   24.768847][  T296] CPU: 0 PID: 296 Comm: syz-executor399 Not tainted 6.1.129-syzkaller-00017-g642656a36791 #0
    [   24.799506][  T296] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
    [   24.809401][  T296] RIP: 0010:f2fs_evict_inode+0x1262/0x1540
    [   24.815018][  T296] Code: 34 70 4a ff eb 0d e8 2d 70 4a ff 4d 89 e5 4c 8b 64 24 18 48 8b 5c 24 28 4c 89 e7 e8 78 38 03 00 e9 84 fc ff ff e8 0e 70 4a ff <0f> 0b 4c 89 f7 be 08 00 00 00 e8 7f 21 92 ff f0 41 80 0e 04 e9 61
    [   24.834584][  T296] RSP: 0018:ffffc90000db7a40 EFLAGS: 00010293
    [   24.840465][  T296] RAX: ffffffff822aca42 RBX: 0000000000000002 RCX: ffff888110948000
    [   24.848291][  T296] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
    [   24.856064][  T296] RBP: ffffc90000db7bb0 R08: ffffffff822ac6a8 R09: ffffed10200b005d
    [   24.864073][  T296] R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888100580000
    [   24.871812][  T296] R13: dffffc0000000000 R14: ffff88810fef4078 R15: 1ffff920001b6f5c
    
    The root cause is w/ a fuzzed image, f2fs may missed to clear FI_DIRTY_INODE
    flag for target inode, after f2fs_evict_inode(), the inode is still linked in
    sbi->inode_list[DIRTY_META] global list, once it triggers checkpoint,
    f2fs_sync_inode_meta() may access the released inode.
    
    In f2fs_evict_inode(), let's always call f2fs_inode_synced() to clear
    FI_DIRTY_INODE flag and drop inode from global dirty list to avoid this
    UAF issue.
    
    Fixes: 0f18b462b2e5 ("f2fs: flush inode metadata when checkpoint is doing")
    Closes: https://syzkaller.appspot.com/bug?extid=849174b2efaf0d8be6ba
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

f2fs: fix to do sanity check on ino and xnid [+ + +]
Author: Chao Yu <chao@kernel.org>
Date:   Thu Jul 24 13:47:16 2025 -0400

    f2fs: fix to do sanity check on ino and xnid
    
    [ Upstream commit 061cf3a84bde038708eb0f1d065b31b7c2456533 ]
    
    syzbot reported a f2fs bug as below:
    
    INFO: task syz-executor140:5308 blocked for more than 143 seconds.
          Not tainted 6.14.0-rc7-syzkaller-00069-g81e4f8d68c66 #0
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    task:syz-executor140 state:D stack:24016 pid:5308  tgid:5308  ppid:5306   task_flags:0x400140 flags:0x00000006
    Call Trace:
     <TASK>
     context_switch kernel/sched/core.c:5378 [inline]
     __schedule+0x190e/0x4c90 kernel/sched/core.c:6765
     __schedule_loop kernel/sched/core.c:6842 [inline]
     schedule+0x14b/0x320 kernel/sched/core.c:6857
     io_schedule+0x8d/0x110 kernel/sched/core.c:7690
     folio_wait_bit_common+0x839/0xee0 mm/filemap.c:1317
     __folio_lock mm/filemap.c:1664 [inline]
     folio_lock include/linux/pagemap.h:1163 [inline]
     __filemap_get_folio+0x147/0xb40 mm/filemap.c:1917
     pagecache_get_page+0x2c/0x130 mm/folio-compat.c:87
     find_get_page_flags include/linux/pagemap.h:842 [inline]
     f2fs_grab_cache_page+0x2b/0x320 fs/f2fs/f2fs.h:2776
     __get_node_page+0x131/0x11b0 fs/f2fs/node.c:1463
     read_xattr_block+0xfb/0x190 fs/f2fs/xattr.c:306
     lookup_all_xattrs fs/f2fs/xattr.c:355 [inline]
     f2fs_getxattr+0x676/0xf70 fs/f2fs/xattr.c:533
     __f2fs_get_acl+0x52/0x870 fs/f2fs/acl.c:179
     f2fs_acl_create fs/f2fs/acl.c:375 [inline]
     f2fs_init_acl+0xd7/0x9b0 fs/f2fs/acl.c:418
     f2fs_init_inode_metadata+0xa0f/0x1050 fs/f2fs/dir.c:539
     f2fs_add_inline_entry+0x448/0x860 fs/f2fs/inline.c:666
     f2fs_add_dentry+0xba/0x1e0 fs/f2fs/dir.c:765
     f2fs_do_add_link+0x28c/0x3a0 fs/f2fs/dir.c:808
     f2fs_add_link fs/f2fs/f2fs.h:3616 [inline]
     f2fs_mknod+0x2e8/0x5b0 fs/f2fs/namei.c:766
     vfs_mknod+0x36d/0x3b0 fs/namei.c:4191
     unix_bind_bsd net/unix/af_unix.c:1286 [inline]
     unix_bind+0x563/0xe30 net/unix/af_unix.c:1379
     __sys_bind_socket net/socket.c:1817 [inline]
     __sys_bind+0x1e4/0x290 net/socket.c:1848
     __do_sys_bind net/socket.c:1853 [inline]
     __se_sys_bind net/socket.c:1851 [inline]
     __x64_sys_bind+0x7a/0x90 net/socket.c:1851
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Let's dump and check metadata of corrupted inode, it shows its xattr_nid
    is the same to its i_ino.
    
    dump.f2fs -i 3 chaseyu.img.raw
    i_xattr_nid                             [0x       3 : 3]
    
    So that, during mknod in the corrupted directory, it tries to get and
    lock inode page twice, result in deadlock.
    
    - f2fs_mknod
     - f2fs_add_inline_entry
      - f2fs_get_inode_page --- lock dir's inode page
       - f2fs_init_acl
        - f2fs_acl_create(dir,..)
         - __f2fs_get_acl
          - f2fs_getxattr
           - lookup_all_xattrs
            - __get_node_page --- try to lock dir's inode page
    
    In order to fix this, let's add sanity check on ino and xnid.
    
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+cc448dcdc7ae0b4e4ffa@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-f2fs-devel/67e06150.050a0220.21942d.0005.GAE@google.com
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    [ add set_sbi_flag(sbi, SBI_NEED_FSCK) to match error handling pattern ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fbdev: imxfb: Check fb_add_videomode to prevent null-ptr-deref [+ + +]
Author: Chenyuan Yang <chenyuan0y@gmail.com>
Date:   Wed Jul 23 22:25:34 2025 -0500

    fbdev: imxfb: Check fb_add_videomode to prevent null-ptr-deref
    
    [ Upstream commit da11e6a30e0bb8e911288bdc443b3dc8f6a7cac7 ]
    
    fb_add_videomode() can fail with -ENOMEM when its internal kmalloc() cannot
    allocate a struct fb_modelist.  If that happens, the modelist stays empty but
    the driver continues to register.  Add a check for its return value to prevent
    poteintial null-ptr-deref, which is similar to the commit 17186f1f90d3 ("fbdev:
    Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var").
    
    Fixes: 1b6c79361ba5 ("video: imxfb: Add DT support")
    Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable() [+ + +]
Author: Xu Yilun <yilun.xu@linux.intel.com>
Date:   Wed Aug 6 15:06:05 2025 +0800

    fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable()
    
    commit 1ca61060de92a4320d73adfe5dc8d335653907ac upstream.
    
    dma_map_sgtable() returns only 0 or the error code. Read sgt->nents to
    get the number of mapped segments.
    
    Fixes: 37e00703228a ("zynq_fpga: use sgtable-based scatterlist wrappers")
    Reported-by: Pavel Pisa <pisa@fel.cvut.cz>
    Closes: https://lore.kernel.org/linux-fpga/202508041548.22955.pisa@fel.cvut.cz/
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
    Tested-by: Pavel Pisa <pisa@fel.cvut.cz>
    Link: https://lore.kernel.org/r/20250806070605.1920909-2-yilun.xu@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs/buffer: fix use-after-free when call bh_read() helper [+ + +]
Author: Ye Bin <yebin10@huawei.com>
Date:   Mon Aug 11 22:18:30 2025 +0800

    fs/buffer: fix use-after-free when call bh_read() helper
    
    [ Upstream commit 7375f22495e7cd1c5b3b5af9dcc4f6dffe34ce49 ]
    
    There's issue as follows:
    BUG: KASAN: stack-out-of-bounds in end_buffer_read_sync+0xe3/0x110
    Read of size 8 at addr ffffc9000168f7f8 by task swapper/3/0
    CPU: 3 UID: 0 PID: 0 Comm: swapper/3 Not tainted 6.16.0-862.14.0.6.x86_64
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
    Call Trace:
     <IRQ>
     dump_stack_lvl+0x55/0x70
     print_address_description.constprop.0+0x2c/0x390
     print_report+0xb4/0x270
     kasan_report+0xb8/0xf0
     end_buffer_read_sync+0xe3/0x110
     end_bio_bh_io_sync+0x56/0x80
     blk_update_request+0x30a/0x720
     scsi_end_request+0x51/0x2b0
     scsi_io_completion+0xe3/0x480
     ? scsi_device_unbusy+0x11e/0x160
     blk_complete_reqs+0x7b/0x90
     handle_softirqs+0xef/0x370
     irq_exit_rcu+0xa5/0xd0
     sysvec_apic_timer_interrupt+0x6e/0x90
     </IRQ>
    
     Above issue happens when do ntfs3 filesystem mount, issue may happens
     as follows:
               mount                            IRQ
    ntfs_fill_super
      read_cache_page
        do_read_cache_folio
          filemap_read_folio
            mpage_read_folio
             do_mpage_readpage
              ntfs_get_block_vbo
               bh_read
                 submit_bh
                 wait_on_buffer(bh);
                                        blk_complete_reqs
                                         scsi_io_completion
                                          scsi_end_request
                                           blk_update_request
                                            end_bio_bh_io_sync
                                             end_buffer_read_sync
                                              __end_buffer_read_notouch
                                               unlock_buffer
    
                wait_on_buffer(bh);--> return will return to caller
    
                                              put_bh
                                                --> trigger stack-out-of-bounds
    In the mpage_read_folio() function, the stack variable 'map_bh' is
    passed to ntfs_get_block_vbo(). Once unlock_buffer() unlocks and
    wait_on_buffer() returns to continue processing, the stack variable
    is likely to be reclaimed. Consequently, during the end_buffer_read_sync()
    process, calling put_bh() may result in stack overrun.
    
    If the bh is not allocated on the stack, it belongs to a folio.  Freeing
    a buffer head which belongs to a folio is done by drop_buffers() which
    will fail to free buffers which are still locked.  So it is safe to call
    put_bh() before __end_buffer_read_notouch().
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Ye Bin <yebin10@huawei.com>
    Link: https://lore.kernel.org/20250811141830.343774-1-yebin@huaweicloud.com
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs/orangefs: Allow 2 more characters in do_c_string() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Sat Jul 19 09:19:10 2025 -0500

    fs/orangefs: Allow 2 more characters in do_c_string()
    
    [ Upstream commit 2138e89cb066b40386b1d9ddd61253347d356474 ]
    
    The do_k_string() and do_c_string() functions do essentially the same
    thing which is they add a string and a comma onto the end of an existing
    string.  At the end, the caller will overwrite the last comma with a
    newline.  Later, in orangefs_kernel_debug_init(), we add a newline to
    the string.
    
    The change to do_k_string() is just cosmetic.  I moved the "- 1" to
    the other side of the comparison and made it "+ 1".  This has no
    effect on runtime, I just wanted the functions to match each other
    and the rest of the file.
    
    However in do_c_string(), I removed the "- 2" which allows us to print
    two extra characters.  I noticed this issue while reviewing the code
    and I doubt affects anything in real life.  My guess is that this was
    double counting the comma and the newline.  The "+ 1" accounts for
    the newline, and the caller will delete the final comma which ensures
    there is enough space for the newline.
    
    Removing the "- 2" lets us print 2 more characters, but mainly it makes
    the code more consistent and understandable for reviewers.
    
    Fixes: 44f4641073f1 ("orangefs: clean up debugfs globals")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Mike Marshall <hubcap@omnibond.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fs/orangefs: use snprintf() instead of sprintf() [+ + +]
Author: Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
Date:   Sun Jun 8 20:05:59 2025 +0330

    fs/orangefs: use snprintf() instead of sprintf()
    
    [ Upstream commit cdfa1304657d6f23be8fd2bb0516380a3c89034e ]
    
    sprintf() is discouraged for use with bounded destination buffers
    as it does not prevent buffer overflows when the formatted output
    exceeds the destination buffer size. snprintf() is a safer
    alternative as it limits the number of bytes written and ensures
    NUL-termination.
    
    Replace sprintf() with snprintf() for copying the debug string
    into a temporary buffer, using ORANGEFS_MAX_DEBUG_STRING_LEN as
    the maximum size to ensure safe formatting and prevent memory
    corruption in edge cases.
    
    EDIT: After this patch sat on linux-next for a few days, Dan
    Carpenter saw it and suggested that I use scnprintf instead of
    snprintf. I made the change and retested.
    
    Signed-off-by: Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>
    Signed-off-by: Mike Marshall <hubcap@omnibond.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs: Prevent file descriptor table allocations exceeding INT_MAX [+ + +]
Author: Sasha Levin <sashal@kernel.org>
Date:   Sun Jun 29 03:40:21 2025 -0400

    fs: Prevent file descriptor table allocations exceeding INT_MAX
    
    commit 04a2c4b4511d186b0fce685da21085a5d4acd370 upstream.
    
    When sysctl_nr_open is set to a very high value (for example, 1073741816
    as set by systemd), processes attempting to use file descriptors near
    the limit can trigger massive memory allocation attempts that exceed
    INT_MAX, resulting in a WARNING in mm/slub.c:
    
      WARNING: CPU: 0 PID: 44 at mm/slub.c:5027 __kvmalloc_node_noprof+0x21a/0x288
    
    This happens because kvmalloc_array() and kvmalloc() check if the
    requested size exceeds INT_MAX and emit a warning when the allocation is
    not flagged with __GFP_NOWARN.
    
    Specifically, when nr_open is set to 1073741816 (0x3ffffff8) and a
    process calls dup2(oldfd, 1073741880), the kernel attempts to allocate:
    - File descriptor array: 1073741880 * 8 bytes = 8,589,935,040 bytes
    - Multiple bitmaps: ~400MB
    - Total allocation size: > 8GB (exceeding INT_MAX = 2,147,483,647)
    
    Reproducer:
    1. Set /proc/sys/fs/nr_open to 1073741816:
       # echo 1073741816 > /proc/sys/fs/nr_open
    
    2. Run a program that uses a high file descriptor:
       #include <unistd.h>
       #include <sys/resource.h>
    
       int main() {
           struct rlimit rlim = {1073741824, 1073741824};
           setrlimit(RLIMIT_NOFILE, &rlim);
           dup2(2, 1073741880);  // Triggers the warning
           return 0;
       }
    
    3. Observe WARNING in dmesg at mm/slub.c:5027
    
    systemd commit a8b627a introduced automatic bumping of fs.nr_open to the
    maximum possible value. The rationale was that systems with memory
    control groups (memcg) no longer need separate file descriptor limits
    since memory is properly accounted. However, this change overlooked
    that:
    
    1. The kernel's allocation functions still enforce INT_MAX as a maximum
       size regardless of memcg accounting
    2. Programs and tests that legitimately test file descriptor limits can
       inadvertently trigger massive allocations
    3. The resulting allocations (>8GB) are impractical and will always fail
    
    systemd's algorithm starts with INT_MAX and keeps halving the value
    until the kernel accepts it. On most systems, this results in nr_open
    being set to 1073741816 (0x3ffffff8), which is just under 1GB of file
    descriptors.
    
    While processes rarely use file descriptors near this limit in normal
    operation, certain selftests (like
    tools/testing/selftests/core/unshare_test.c) and programs that test file
    descriptor limits can trigger this issue.
    
    Fix this by adding a check in alloc_fdtable() to ensure the requested
    allocation size does not exceed INT_MAX. This causes the operation to
    fail with -EMFILE instead of triggering a kernel warning and avoids the
    impractical >8GB memory allocation request.
    
    Fixes: 9cfe015aa424 ("get rid of NR_OPEN and introduce a sysctl_nr_open")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Link: https://lore.kernel.org/20250629074021.1038845-1-sashal@kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs_context: fix parameter name in infofc() macro [+ + +]
Author: RubenKelevra <rubenkelevra@gmail.com>
Date:   Wed Jun 18 01:09:27 2025 +0200

    fs_context: fix parameter name in infofc() macro
    
    [ Upstream commit ffaf1bf3737f706e4e9be876de4bc3c8fc578091 ]
    
    The macro takes a parameter called "p" but references "fc" internally.
    This happens to compile as long as callers pass a variable named fc,
    but breaks otherwise. Rename the first parameter to “fc” to match the
    usage and to be consistent with warnfc() / errorfc().
    
    Fixes: a3ff937b33d9 ("prefix-handling analogues of errorf() and friends")
    Signed-off-by: RubenKelevra <rubenkelevra@gmail.com>
    Link: https://lore.kernel.org/20250617230927.1790401-1-rubenkelevra@gmail.com
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ftrace: Also allocate and copy hash for reading of filter files [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri Aug 22 18:36:06 2025 -0400

    ftrace: Also allocate and copy hash for reading of filter files
    
    commit bfb336cf97df7b37b2b2edec0f69773e06d11955 upstream.
    
    Currently the reader of set_ftrace_filter and set_ftrace_notrace just adds
    the pointer to the global tracer hash to its iterator. Unlike the writer
    that allocates a copy of the hash, the reader keeps the pointer to the
    filter hashes. This is problematic because this pointer is static across
    function calls that release the locks that can update the global tracer
    hashes. This can cause UAF and similar bugs.
    
    Allocate and copy the hash for reading the filter files like it is done
    for the writers. This not only fixes UAF bugs, but also makes the code a
    bit simpler as it doesn't have to differentiate when to free the
    iterator's hash between writers and readers.
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/20250822183606.12962cc3@batman.local.home
    Fixes: c20489dad156 ("ftrace: Assign iter->hash to filter or notrace hashes on seq read")
    Closes: https://lore.kernel.org/all/20250813023044.2121943-1-wutengda@huaweicloud.com/
    Closes: https://lore.kernel.org/all/20250822192437.GA458494@ax162/
    Reported-by: Tengda Wu <wutengda@huaweicloud.com>
    Tested-by: Tengda Wu <wutengda@huaweicloud.com>
    Tested-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: rcar: Use raw_spinlock to protect register access [+ + +]
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Date:   Tue Jan 21 14:58:33 2025 +0100

    gpio: rcar: Use raw_spinlock to protect register access
    
    commit f02c41f87cfe61440c18bf77d1ef0a884b9ee2b5 upstream.
    
    Use raw_spinlock in order to fix spurious messages about invalid context
    when spinlock debugging is enabled. The lock is only used to serialize
    register access.
    
        [    4.239592] =============================
        [    4.239595] [ BUG: Invalid wait context ]
        [    4.239599] 6.13.0-rc7-arm64-renesas-05496-gd088502a519f #35 Not tainted
        [    4.239603] -----------------------------
        [    4.239606] kworker/u8:5/76 is trying to lock:
        [    4.239609] ffff0000091898a0 (&p->lock){....}-{3:3}, at: gpio_rcar_config_interrupt_input_mode+0x34/0x164
        [    4.239641] other info that might help us debug this:
        [    4.239643] context-{5:5}
        [    4.239646] 5 locks held by kworker/u8:5/76:
        [    4.239651]  #0: ffff0000080fb148 ((wq_completion)async){+.+.}-{0:0}, at: process_one_work+0x190/0x62c
        [    4.250180] OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'frame-master' with a value.
        [    4.254094]  #1: ffff80008299bd80 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work+0x1b8/0x62c
        [    4.254109]  #2: ffff00000920c8f8
        [    4.258345] OF: /soc/sound@ec500000/ports/port@1/endpoint: Read of boolean property 'bitclock-master' with a value.
        [    4.264803]  (&dev->mutex){....}-{4:4}, at: __device_attach_async_helper+0x3c/0xdc
        [    4.264820]  #3: ffff00000a50ca40 (request_class#2){+.+.}-{4:4}, at: __setup_irq+0xa0/0x690
        [    4.264840]  #4:
        [    4.268872] OF: /soc/sound@ec500000/ports/port@1/endpoint: Read of boolean property 'frame-master' with a value.
        [    4.273275] ffff00000a50c8c8 (lock_class){....}-{2:2}, at: __setup_irq+0xc4/0x690
        [    4.296130] renesas_sdhi_internal_dmac ee100000.mmc: mmc1 base at 0x00000000ee100000, max clock rate 200 MHz
        [    4.304082] stack backtrace:
        [    4.304086] CPU: 1 UID: 0 PID: 76 Comm: kworker/u8:5 Not tainted 6.13.0-rc7-arm64-renesas-05496-gd088502a519f #35
        [    4.304092] Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT)
        [    4.304097] Workqueue: async async_run_entry_fn
        [    4.304106] Call trace:
        [    4.304110]  show_stack+0x14/0x20 (C)
        [    4.304122]  dump_stack_lvl+0x6c/0x90
        [    4.304131]  dump_stack+0x14/0x1c
        [    4.304138]  __lock_acquire+0xdfc/0x1584
        [    4.426274]  lock_acquire+0x1c4/0x33c
        [    4.429942]  _raw_spin_lock_irqsave+0x5c/0x80
        [    4.434307]  gpio_rcar_config_interrupt_input_mode+0x34/0x164
        [    4.440061]  gpio_rcar_irq_set_type+0xd4/0xd8
        [    4.444422]  __irq_set_trigger+0x5c/0x178
        [    4.448435]  __setup_irq+0x2e4/0x690
        [    4.452012]  request_threaded_irq+0xc4/0x190
        [    4.456285]  devm_request_threaded_irq+0x7c/0xf4
        [    4.459398] ata1: link resume succeeded after 1 retries
        [    4.460902]  mmc_gpiod_request_cd_irq+0x68/0xe0
        [    4.470660]  mmc_start_host+0x50/0xac
        [    4.474327]  mmc_add_host+0x80/0xe4
        [    4.477817]  tmio_mmc_host_probe+0x2b0/0x440
        [    4.482094]  renesas_sdhi_probe+0x488/0x6f4
        [    4.486281]  renesas_sdhi_internal_dmac_probe+0x60/0x78
        [    4.491509]  platform_probe+0x64/0xd8
        [    4.495178]  really_probe+0xb8/0x2a8
        [    4.498756]  __driver_probe_device+0x74/0x118
        [    4.503116]  driver_probe_device+0x3c/0x154
        [    4.507303]  __device_attach_driver+0xd4/0x160
        [    4.511750]  bus_for_each_drv+0x84/0xe0
        [    4.515588]  __device_attach_async_helper+0xb0/0xdc
        [    4.520470]  async_run_entry_fn+0x30/0xd8
        [    4.524481]  process_one_work+0x210/0x62c
        [    4.528494]  worker_thread+0x1ac/0x340
        [    4.532245]  kthread+0x10c/0x110
        [    4.535476]  ret_from_fork+0x10/0x20
    
    Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250121135833.3769310-1-niklas.soderlund+renesas@ragnatech.se
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    [PL: manullay applied the changes]
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Reviewed-by: Pavel Machek <pavel@denx.de> # for 5.10-stable
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

gpio: tps65912: check the return value of regmap_update_bits() [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date:   Mon Jul 7 09:50:15 2025 +0200

    gpio: tps65912: check the return value of regmap_update_bits()
    
    [ Upstream commit a0b2a6bbff8c26aafdecd320f38f52c341d5cafa ]
    
    regmap_update_bits() can fail, check its return value like we do
    elsewhere in the driver.
    
    Link: https://lore.kernel.org/r/20250707-gpiochip-set-rv-gpio-round4-v1-2-35668aaaf6d2@linaro.org
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

gpio: wcd934x: check the return value of regmap_update_bits() [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Date:   Wed Jul 9 08:41:39 2025 +0200

    gpio: wcd934x: check the return value of regmap_update_bits()
    
    [ Upstream commit ff0f0d7c6587e38c308be9905e36f86e98fb9c1f ]
    
    regmap_update_bits() can fail so check its return value in
    wcd_gpio_direction_output() for consistency with the rest of the code
    and propagate any errors.
    
    Link: https://lore.kernel.org/r/20250709-gpiochip-set-rv-gpio-remaining-v1-2-b8950f69618d@linaro.org
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gve: Fix stuck TX queue for DQ queue format [+ + +]
Author: Praveen Kaligineedi <pkaligineedi@google.com>
Date:   Thu Jul 17 19:20:24 2025 +0000

    gve: Fix stuck TX queue for DQ queue format
    
    commit b03f15c0192b184078206760c839054ae6eb4eaa upstream.
    
    gve_tx_timeout was calculating missed completions in a way that is only
    relevant in the GQ queue format. Additionally, it was attempting to
    disable device interrupts, which is not needed in either GQ or DQ queue
    formats.
    
    As a result, TX timeouts with the DQ queue format likely would have
    triggered early resets without kicking the queue at all.
    
    This patch drops the check for pending work altogether and always kicks
    the queue after validating the queue has not seen a TX timeout too
    recently.
    
    Cc: stable@vger.kernel.org
    Fixes: 87a7f321bb6a ("gve: Recover from queue stall due to missed IRQ")
    Co-developed-by: Tim Hostetler <thostet@google.com>
    Signed-off-by: Tim Hostetler <thostet@google.com>
    Signed-off-by: Praveen Kaligineedi <pkaligineedi@google.com>
    Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
    Link: https://patch.msgid.link/20250717192024.1820931-1-hramamurthy@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

gve: Return error for unknown admin queue command [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Sun Jun 15 22:45:01 2025 -0700

    gve: Return error for unknown admin queue command
    
    [ Upstream commit b11344f63fdd9e8c5121148a6965b41079071dd2 ]
    
    In gve_adminq_issue_cmd(), return -EINVAL instead of 0 when an unknown
    admin queue command opcode is encountered.
    
    This prevents the function from silently succeeding on invalid input
    and prevents undefined behavior by ensuring the function fails gracefully
    when an unrecognized opcode is provided.
    
    These changes improve error handling.
    
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Link: https://patch.msgid.link/20250616054504.1644770-2-alok.a.tiwari@oracle.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
hfs: fix not erasing deleted b-tree node issue [+ + +]
Author: Viacheslav Dubeyko <slava@dubeyko.com>
Date:   Tue Apr 29 17:12:11 2025 -0700

    hfs: fix not erasing deleted b-tree node issue
    
    [ Upstream commit d3ed6d6981f4756f145766753c872482bc3b28d3 ]
    
    The generic/001 test of xfstests suite fails and corrupts
    the HFS volume:
    
    sudo ./check generic/001
    FSTYP         -- hfs
    PLATFORM      -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc2+ #3 SMP PREEMPT_DYNAMIC Fri Apr 25 17:13:00 PDT 2>
    MKFS_OPTIONS  -- /dev/loop51
    MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
    
    generic/001 32s ... _check_generic_filesystem: filesystem on /dev/loop50 is inconsistent
    (see /home/slavad/XFSTESTS-2/xfstests-dev/results//generic/001.full for details)
    
    Ran: generic/001
    Failures: generic/001
    Failed 1 of 1 tests
    
    fsck.hfs -d -n ./test-image.bin
    ** ./test-image.bin (NO WRITE)
            Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
       Executing fsck_hfs (version 540.1-Linux).
    ** Checking HFS volume.
       The volume name is untitled
    ** Checking extents overflow file.
    ** Checking catalog file.
       Unused node is not erased (node = 2)
       Unused node is not erased (node = 4)
    <skipped>
       Unused node is not erased (node = 253)
       Unused node is not erased (node = 254)
       Unused node is not erased (node = 255)
       Unused node is not erased (node = 256)
    ** Checking catalog hierarchy.
    ** Checking volume bitmap.
    ** Checking volume information.
       Verify Status: VIStat = 0x0000, ABTStat = 0x0000 EBTStat = 0x0000
                      CBTStat = 0x0004 CatStat = 0x00000000
    ** The volume untitled was found corrupt and needs to be repaired.
            volume type is HFS
            primary MDB is at block 2 0x02
            alternate MDB is at block 20971518 0x13ffffe
            primary VHB is at block 0 0x00
            alternate VHB is at block 0 0x00
            sector size = 512 0x200
            VolumeObject flags = 0x19
            total sectors for volume = 20971520 0x1400000
            total sectors for embedded volume = 0 0x00
    
    This patch adds logic of clearing the deleted b-tree node.
    
    sudo ./check generic/001
    FSTYP         -- hfs
    PLATFORM      -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc2+ #3 SMP PREEMPT_DYNAMIC Fri Apr 25 17:13:00 PDT 2025
    MKFS_OPTIONS  -- /dev/loop51
    MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
    
    generic/001 9s ...  32s
    Ran: generic/001
    Passed all 1 tests
    
    fsck.hfs -d -n ./test-image.bin
    ** ./test-image.bin (NO WRITE)
            Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
       Executing fsck_hfs (version 540.1-Linux).
    ** Checking HFS volume.
       The volume name is untitled
    ** Checking extents overflow file.
    ** Checking catalog file.
    ** Checking catalog hierarchy.
    ** Checking volume bitmap.
    ** Checking volume information.
    ** The volume untitled appears to be OK.
    
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Link: https://lore.kernel.org/r/20250430001211.1912533-1-slava@dubeyko.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hfs: fix slab-out-of-bounds in hfs_bnode_read() [+ + +]
Author: Viacheslav Dubeyko <slava@dubeyko.com>
Date:   Thu Jul 3 14:49:12 2025 -0700

    hfs: fix slab-out-of-bounds in hfs_bnode_read()
    
    [ Upstream commit a431930c9bac518bf99d6b1da526a7f37ddee8d8 ]
    
    This patch introduces is_bnode_offset_valid() method that checks
    the requested offset value. Also, it introduces
    check_and_correct_requested_length() method that checks and
    correct the requested length (if it is necessary). These methods
    are used in hfs_bnode_read(), hfs_bnode_write(), hfs_bnode_clear(),
    hfs_bnode_copy(), and hfs_bnode_move() with the goal to prevent
    the access out of allocated memory and triggering the crash.
    
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/20250703214912.244138-1-slava@dubeyko.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Tue Jul 15 14:17:56 2025 +0900

    hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file()
    
    [ Upstream commit c7c6363ca186747ebc2df10c8a1a51e66e0e32d9 ]
    
    When the volume header contains erroneous values that do not reflect
    the actual state of the filesystem, hfsplus_fill_super() assumes that
    the attributes file is not yet created, which later results in hitting
    BUG_ON() when hfsplus_create_attributes_file() is called. Replace this
    BUG_ON() with -EIO error with a message to suggest running fsck tool.
    
    Reported-by: syzbot <syzbot+1107451c16b9eb9d29e6@syzkaller.appspotmail.com>
    Closes: https://syzkaller.appspot.com/bug?extid=1107451c16b9eb9d29e6
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/7b587d24-c8a1-4413-9b9a-00a33fbd849f@I-love.SAKURA.ne.jp
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hfsplus: fix slab-out-of-bounds in hfsplus_bnode_read() [+ + +]
Author: Viacheslav Dubeyko <slava@dubeyko.com>
Date:   Thu Jul 3 14:48:04 2025 -0700

    hfsplus: fix slab-out-of-bounds in hfsplus_bnode_read()
    
    [ Upstream commit c80aa2aaaa5e69d5219c6af8ef7e754114bd08d2 ]
    
    The hfsplus_bnode_read() method can trigger the issue:
    
    [  174.852007][ T9784] ==================================================================
    [  174.852709][ T9784] BUG: KASAN: slab-out-of-bounds in hfsplus_bnode_read+0x2f4/0x360
    [  174.853412][ T9784] Read of size 8 at addr ffff88810b5fc6c0 by task repro/9784
    [  174.854059][ T9784]
    [  174.854272][ T9784] CPU: 1 UID: 0 PID: 9784 Comm: repro Not tainted 6.16.0-rc3 #7 PREEMPT(full)
    [  174.854281][ T9784] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    [  174.854286][ T9784] Call Trace:
    [  174.854289][ T9784]  <TASK>
    [  174.854292][ T9784]  dump_stack_lvl+0x10e/0x1f0
    [  174.854305][ T9784]  print_report+0xd0/0x660
    [  174.854315][ T9784]  ? __virt_addr_valid+0x81/0x610
    [  174.854323][ T9784]  ? __phys_addr+0xe8/0x180
    [  174.854330][ T9784]  ? hfsplus_bnode_read+0x2f4/0x360
    [  174.854337][ T9784]  kasan_report+0xc6/0x100
    [  174.854346][ T9784]  ? hfsplus_bnode_read+0x2f4/0x360
    [  174.854354][ T9784]  hfsplus_bnode_read+0x2f4/0x360
    [  174.854362][ T9784]  hfsplus_bnode_dump+0x2ec/0x380
    [  174.854370][ T9784]  ? __pfx_hfsplus_bnode_dump+0x10/0x10
    [  174.854377][ T9784]  ? hfsplus_bnode_write_u16+0x83/0xb0
    [  174.854385][ T9784]  ? srcu_gp_start+0xd0/0x310
    [  174.854393][ T9784]  ? __mark_inode_dirty+0x29e/0xe40
    [  174.854402][ T9784]  hfsplus_brec_remove+0x3d2/0x4e0
    [  174.854411][ T9784]  __hfsplus_delete_attr+0x290/0x3a0
    [  174.854419][ T9784]  ? __pfx_hfs_find_1st_rec_by_cnid+0x10/0x10
    [  174.854427][ T9784]  ? __pfx___hfsplus_delete_attr+0x10/0x10
    [  174.854436][ T9784]  ? __asan_memset+0x23/0x50
    [  174.854450][ T9784]  hfsplus_delete_all_attrs+0x262/0x320
    [  174.854459][ T9784]  ? __pfx_hfsplus_delete_all_attrs+0x10/0x10
    [  174.854469][ T9784]  ? rcu_is_watching+0x12/0xc0
    [  174.854476][ T9784]  ? __mark_inode_dirty+0x29e/0xe40
    [  174.854483][ T9784]  hfsplus_delete_cat+0x845/0xde0
    [  174.854493][ T9784]  ? __pfx_hfsplus_delete_cat+0x10/0x10
    [  174.854507][ T9784]  hfsplus_unlink+0x1ca/0x7c0
    [  174.854516][ T9784]  ? __pfx_hfsplus_unlink+0x10/0x10
    [  174.854525][ T9784]  ? down_write+0x148/0x200
    [  174.854532][ T9784]  ? __pfx_down_write+0x10/0x10
    [  174.854540][ T9784]  vfs_unlink+0x2fe/0x9b0
    [  174.854549][ T9784]  do_unlinkat+0x490/0x670
    [  174.854557][ T9784]  ? __pfx_do_unlinkat+0x10/0x10
    [  174.854565][ T9784]  ? __might_fault+0xbc/0x130
    [  174.854576][ T9784]  ? getname_flags.part.0+0x1c5/0x550
    [  174.854584][ T9784]  __x64_sys_unlink+0xc5/0x110
    [  174.854592][ T9784]  do_syscall_64+0xc9/0x480
    [  174.854600][ T9784]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  174.854608][ T9784] RIP: 0033:0x7f6fdf4c3167
    [  174.854614][ T9784] Code: f0 ff ff 73 01 c3 48 8b 0d 26 0d 0e 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 08
    [  174.854622][ T9784] RSP: 002b:00007ffcb948bca8 EFLAGS: 00000206 ORIG_RAX: 0000000000000057
    [  174.854630][ T9784] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6fdf4c3167
    [  174.854636][ T9784] RDX: 00007ffcb948bcc0 RSI: 00007ffcb948bcc0 RDI: 00007ffcb948bd50
    [  174.854641][ T9784] RBP: 00007ffcb948cd90 R08: 0000000000000001 R09: 00007ffcb948bb40
    [  174.854645][ T9784] R10: 00007f6fdf564fc0 R11: 0000000000000206 R12: 0000561e1bc9c2d0
    [  174.854650][ T9784] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    [  174.854658][ T9784]  </TASK>
    [  174.854661][ T9784]
    [  174.879281][ T9784] Allocated by task 9784:
    [  174.879664][ T9784]  kasan_save_stack+0x20/0x40
    [  174.880082][ T9784]  kasan_save_track+0x14/0x30
    [  174.880500][ T9784]  __kasan_kmalloc+0xaa/0xb0
    [  174.880908][ T9784]  __kmalloc_noprof+0x205/0x550
    [  174.881337][ T9784]  __hfs_bnode_create+0x107/0x890
    [  174.881779][ T9784]  hfsplus_bnode_find+0x2d0/0xd10
    [  174.882222][ T9784]  hfsplus_brec_find+0x2b0/0x520
    [  174.882659][ T9784]  hfsplus_delete_all_attrs+0x23b/0x320
    [  174.883144][ T9784]  hfsplus_delete_cat+0x845/0xde0
    [  174.883595][ T9784]  hfsplus_rmdir+0x106/0x1b0
    [  174.884004][ T9784]  vfs_rmdir+0x206/0x690
    [  174.884379][ T9784]  do_rmdir+0x2b7/0x390
    [  174.884751][ T9784]  __x64_sys_rmdir+0xc5/0x110
    [  174.885167][ T9784]  do_syscall_64+0xc9/0x480
    [  174.885568][ T9784]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  174.886083][ T9784]
    [  174.886293][ T9784] The buggy address belongs to the object at ffff88810b5fc600
    [  174.886293][ T9784]  which belongs to the cache kmalloc-192 of size 192
    [  174.887507][ T9784] The buggy address is located 40 bytes to the right of
    [  174.887507][ T9784]  allocated 152-byte region [ffff88810b5fc600, ffff88810b5fc698)
    [  174.888766][ T9784]
    [  174.888976][ T9784] The buggy address belongs to the physical page:
    [  174.889533][ T9784] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b5fc
    [  174.890295][ T9784] flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
    [  174.890927][ T9784] page_type: f5(slab)
    [  174.891284][ T9784] raw: 057ff00000000000 ffff88801b4423c0 ffffea000426dc80 dead000000000002
    [  174.892032][ T9784] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
    [  174.892774][ T9784] page dumped because: kasan: bad access detected
    [  174.893327][ T9784] page_owner tracks the page as allocated
    [  174.893825][ T9784] page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52c00(GFP_NOIO|__GFP_NOWARN|__GFP_NO1
    [  174.895373][ T9784]  post_alloc_hook+0x1c0/0x230
    [  174.895801][ T9784]  get_page_from_freelist+0xdeb/0x3b30
    [  174.896284][ T9784]  __alloc_frozen_pages_noprof+0x25c/0x2460
    [  174.896810][ T9784]  alloc_pages_mpol+0x1fb/0x550
    [  174.897242][ T9784]  new_slab+0x23b/0x340
    [  174.897614][ T9784]  ___slab_alloc+0xd81/0x1960
    [  174.898028][ T9784]  __slab_alloc.isra.0+0x56/0xb0
    [  174.898468][ T9784]  __kmalloc_noprof+0x2b0/0x550
    [  174.898896][ T9784]  usb_alloc_urb+0x73/0xa0
    [  174.899289][ T9784]  usb_control_msg+0x1cb/0x4a0
    [  174.899718][ T9784]  usb_get_string+0xab/0x1a0
    [  174.900133][ T9784]  usb_string_sub+0x107/0x3c0
    [  174.900549][ T9784]  usb_string+0x307/0x670
    [  174.900933][ T9784]  usb_cache_string+0x80/0x150
    [  174.901355][ T9784]  usb_new_device+0x1d0/0x19d0
    [  174.901786][ T9784]  register_root_hub+0x299/0x730
    [  174.902231][ T9784] page last free pid 10 tgid 10 stack trace:
    [  174.902757][ T9784]  __free_frozen_pages+0x80c/0x1250
    [  174.903217][ T9784]  vfree.part.0+0x12b/0xab0
    [  174.903645][ T9784]  delayed_vfree_work+0x93/0xd0
    [  174.904073][ T9784]  process_one_work+0x9b5/0x1b80
    [  174.904519][ T9784]  worker_thread+0x630/0xe60
    [  174.904927][ T9784]  kthread+0x3a8/0x770
    [  174.905291][ T9784]  ret_from_fork+0x517/0x6e0
    [  174.905709][ T9784]  ret_from_fork_asm+0x1a/0x30
    [  174.906128][ T9784]
    [  174.906338][ T9784] Memory state around the buggy address:
    [  174.906828][ T9784]  ffff88810b5fc580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    [  174.907528][ T9784]  ffff88810b5fc600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [  174.908222][ T9784] >ffff88810b5fc680: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  174.908917][ T9784]                                            ^
    [  174.909481][ T9784]  ffff88810b5fc700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [  174.910432][ T9784]  ffff88810b5fc780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    [  174.911401][ T9784] ==================================================================
    
    The reason of the issue that code doesn't check the correctness
    of the requested offset and length. As a result, incorrect value
    of offset or/and length could result in access out of allocated
    memory.
    
    This patch introduces is_bnode_offset_valid() method that checks
    the requested offset value. Also, it introduces
    check_and_correct_requested_length() method that checks and
    correct the requested length (if it is necessary). These methods
    are used in hfsplus_bnode_read(), hfsplus_bnode_write(),
    hfsplus_bnode_clear(), hfsplus_bnode_copy(), and hfsplus_bnode_move()
    with the goal to prevent the access out of allocated memory
    and triggering the crash.
    
    Reported-by: Kun Hu <huk23@m.fudan.edu.cn>
    Reported-by: Jiaji Qin <jjtan24@m.fudan.edu.cn>
    Reported-by: Shuoran Bai <baishuoran@hrbeu.edu.cn>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/20250703214804.244077-1-slava@dubeyko.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hfsplus: fix slab-out-of-bounds read in hfsplus_uni2asc() [+ + +]
Author: Viacheslav Dubeyko <slava@dubeyko.com>
Date:   Thu Jul 10 16:08:30 2025 -0700

    hfsplus: fix slab-out-of-bounds read in hfsplus_uni2asc()
    
    [ Upstream commit 94458781aee6045bd3d0ad4b80b02886b9e2219b ]
    
    The hfsplus_readdir() method is capable to crash by calling
    hfsplus_uni2asc():
    
    [  667.121659][ T9805] ==================================================================
    [  667.122651][ T9805] BUG: KASAN: slab-out-of-bounds in hfsplus_uni2asc+0x902/0xa10
    [  667.123627][ T9805] Read of size 2 at addr ffff88802592f40c by task repro/9805
    [  667.124578][ T9805]
    [  667.124876][ T9805] CPU: 3 UID: 0 PID: 9805 Comm: repro Not tainted 6.16.0-rc3 #1 PREEMPT(full)
    [  667.124886][ T9805] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    [  667.124890][ T9805] Call Trace:
    [  667.124893][ T9805]  <TASK>
    [  667.124896][ T9805]  dump_stack_lvl+0x10e/0x1f0
    [  667.124911][ T9805]  print_report+0xd0/0x660
    [  667.124920][ T9805]  ? __virt_addr_valid+0x81/0x610
    [  667.124928][ T9805]  ? __phys_addr+0xe8/0x180
    [  667.124934][ T9805]  ? hfsplus_uni2asc+0x902/0xa10
    [  667.124942][ T9805]  kasan_report+0xc6/0x100
    [  667.124950][ T9805]  ? hfsplus_uni2asc+0x902/0xa10
    [  667.124959][ T9805]  hfsplus_uni2asc+0x902/0xa10
    [  667.124966][ T9805]  ? hfsplus_bnode_read+0x14b/0x360
    [  667.124974][ T9805]  hfsplus_readdir+0x845/0xfc0
    [  667.124984][ T9805]  ? __pfx_hfsplus_readdir+0x10/0x10
    [  667.124994][ T9805]  ? stack_trace_save+0x8e/0xc0
    [  667.125008][ T9805]  ? iterate_dir+0x18b/0xb20
    [  667.125015][ T9805]  ? trace_lock_acquire+0x85/0xd0
    [  667.125022][ T9805]  ? lock_acquire+0x30/0x80
    [  667.125029][ T9805]  ? iterate_dir+0x18b/0xb20
    [  667.125037][ T9805]  ? down_read_killable+0x1ed/0x4c0
    [  667.125044][ T9805]  ? putname+0x154/0x1a0
    [  667.125051][ T9805]  ? __pfx_down_read_killable+0x10/0x10
    [  667.125058][ T9805]  ? apparmor_file_permission+0x239/0x3e0
    [  667.125069][ T9805]  iterate_dir+0x296/0xb20
    [  667.125076][ T9805]  __x64_sys_getdents64+0x13c/0x2c0
    [  667.125084][ T9805]  ? __pfx___x64_sys_getdents64+0x10/0x10
    [  667.125091][ T9805]  ? __x64_sys_openat+0x141/0x200
    [  667.125126][ T9805]  ? __pfx_filldir64+0x10/0x10
    [  667.125134][ T9805]  ? do_user_addr_fault+0x7fe/0x12f0
    [  667.125143][ T9805]  do_syscall_64+0xc9/0x480
    [  667.125151][ T9805]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  667.125158][ T9805] RIP: 0033:0x7fa8753b2fc9
    [  667.125164][ T9805] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 48
    [  667.125172][ T9805] RSP: 002b:00007ffe96f8e0f8 EFLAGS: 00000217 ORIG_RAX: 00000000000000d9
    [  667.125181][ T9805] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa8753b2fc9
    [  667.125185][ T9805] RDX: 0000000000000400 RSI: 00002000000063c0 RDI: 0000000000000004
    [  667.125190][ T9805] RBP: 00007ffe96f8e110 R08: 00007ffe96f8e110 R09: 00007ffe96f8e110
    [  667.125195][ T9805] R10: 0000000000000000 R11: 0000000000000217 R12: 0000556b1e3b4260
    [  667.125199][ T9805] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    [  667.125207][ T9805]  </TASK>
    [  667.125210][ T9805]
    [  667.145632][ T9805] Allocated by task 9805:
    [  667.145991][ T9805]  kasan_save_stack+0x20/0x40
    [  667.146352][ T9805]  kasan_save_track+0x14/0x30
    [  667.146717][ T9805]  __kasan_kmalloc+0xaa/0xb0
    [  667.147065][ T9805]  __kmalloc_noprof+0x205/0x550
    [  667.147448][ T9805]  hfsplus_find_init+0x95/0x1f0
    [  667.147813][ T9805]  hfsplus_readdir+0x220/0xfc0
    [  667.148174][ T9805]  iterate_dir+0x296/0xb20
    [  667.148549][ T9805]  __x64_sys_getdents64+0x13c/0x2c0
    [  667.148937][ T9805]  do_syscall_64+0xc9/0x480
    [  667.149291][ T9805]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  667.149809][ T9805]
    [  667.150030][ T9805] The buggy address belongs to the object at ffff88802592f000
    [  667.150030][ T9805]  which belongs to the cache kmalloc-2k of size 2048
    [  667.151282][ T9805] The buggy address is located 0 bytes to the right of
    [  667.151282][ T9805]  allocated 1036-byte region [ffff88802592f000, ffff88802592f40c)
    [  667.152580][ T9805]
    [  667.152798][ T9805] The buggy address belongs to the physical page:
    [  667.153373][ T9805] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25928
    [  667.154157][ T9805] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
    [  667.154916][ T9805] anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
    [  667.155631][ T9805] page_type: f5(slab)
    [  667.155997][ T9805] raw: 00fff00000000040 ffff88801b442f00 0000000000000000 dead000000000001
    [  667.156770][ T9805] raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
    [  667.157536][ T9805] head: 00fff00000000040 ffff88801b442f00 0000000000000000 dead000000000001
    [  667.158317][ T9805] head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
    [  667.159088][ T9805] head: 00fff00000000003 ffffea0000964a01 00000000ffffffff 00000000ffffffff
    [  667.159865][ T9805] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
    [  667.160643][ T9805] page dumped because: kasan: bad access detected
    [  667.161216][ T9805] page_owner tracks the page as allocated
    [  667.161732][ T9805] page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN9
    [  667.163566][ T9805]  post_alloc_hook+0x1c0/0x230
    [  667.164003][ T9805]  get_page_from_freelist+0xdeb/0x3b30
    [  667.164503][ T9805]  __alloc_frozen_pages_noprof+0x25c/0x2460
    [  667.165040][ T9805]  alloc_pages_mpol+0x1fb/0x550
    [  667.165489][ T9805]  new_slab+0x23b/0x340
    [  667.165872][ T9805]  ___slab_alloc+0xd81/0x1960
    [  667.166313][ T9805]  __slab_alloc.isra.0+0x56/0xb0
    [  667.166767][ T9805]  __kmalloc_cache_noprof+0x255/0x3e0
    [  667.167255][ T9805]  psi_cgroup_alloc+0x52/0x2d0
    [  667.167693][ T9805]  cgroup_mkdir+0x694/0x1210
    [  667.168118][ T9805]  kernfs_iop_mkdir+0x111/0x190
    [  667.168568][ T9805]  vfs_mkdir+0x59b/0x8d0
    [  667.168956][ T9805]  do_mkdirat+0x2ed/0x3d0
    [  667.169353][ T9805]  __x64_sys_mkdir+0xef/0x140
    [  667.169784][ T9805]  do_syscall_64+0xc9/0x480
    [  667.170195][ T9805]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  667.170730][ T9805] page last free pid 1257 tgid 1257 stack trace:
    [  667.171304][ T9805]  __free_frozen_pages+0x80c/0x1250
    [  667.171770][ T9805]  vfree.part.0+0x12b/0xab0
    [  667.172182][ T9805]  delayed_vfree_work+0x93/0xd0
    [  667.172612][ T9805]  process_one_work+0x9b5/0x1b80
    [  667.173067][ T9805]  worker_thread+0x630/0xe60
    [  667.173486][ T9805]  kthread+0x3a8/0x770
    [  667.173857][ T9805]  ret_from_fork+0x517/0x6e0
    [  667.174278][ T9805]  ret_from_fork_asm+0x1a/0x30
    [  667.174703][ T9805]
    [  667.174917][ T9805] Memory state around the buggy address:
    [  667.175411][ T9805]  ffff88802592f300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [  667.176114][ T9805]  ffff88802592f380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [  667.176830][ T9805] >ffff88802592f400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  667.177547][ T9805]                       ^
    [  667.177933][ T9805]  ffff88802592f480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  667.178640][ T9805]  ffff88802592f500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  667.179350][ T9805] ==================================================================
    
    The hfsplus_uni2asc() method operates by struct hfsplus_unistr:
    
    struct hfsplus_unistr {
            __be16 length;
            hfsplus_unichr unicode[HFSPLUS_MAX_STRLEN];
    } __packed;
    
    where HFSPLUS_MAX_STRLEN is 255 bytes. The issue happens if length
    of the structure instance has value bigger than 255 (for example,
    65283). In such case, pointer on unicode buffer is going beyond of
    the allocated memory.
    
    The patch fixes the issue by checking the length value of
    hfsplus_unistr instance and using 255 value in the case if length
    value is bigger than HFSPLUS_MAX_STRLEN. Potential reason of such
    situation could be a corruption of Catalog File b-tree's node.
    
    Reported-by: Wenzhi Wang <wenzhi.wang@uwaterloo.ca>
    Signed-off-by: Liu Shixin <liushixin2@huawei.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    cc: Yangtao Li <frank.li@vivo.com>
    cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Yangtao Li <frank.li@vivo.com>
    Link: https://lore.kernel.org/r/20250710230830.110500-1-slava@dubeyko.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hfsplus: remove mutex_lock check in hfsplus_free_extents [+ + +]
Author: Yangtao Li <frank.li@vivo.com>
Date:   Thu May 29 00:18:06 2025 -0600

    hfsplus: remove mutex_lock check in hfsplus_free_extents
    
    [ Upstream commit fcb96956c921f1aae7e7b477f2435c56f77a31b4 ]
    
    Syzbot reported an issue in hfsplus filesystem:
    
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 4400 at fs/hfsplus/extents.c:346
            hfsplus_free_extents+0x700/0xad0
    Call Trace:
    <TASK>
    hfsplus_file_truncate+0x768/0xbb0 fs/hfsplus/extents.c:606
    hfsplus_write_begin+0xc2/0xd0 fs/hfsplus/inode.c:56
    cont_expand_zero fs/buffer.c:2383 [inline]
    cont_write_begin+0x2cf/0x860 fs/buffer.c:2446
    hfsplus_write_begin+0x86/0xd0 fs/hfsplus/inode.c:52
    generic_cont_expand_simple+0x151/0x250 fs/buffer.c:2347
    hfsplus_setattr+0x168/0x280 fs/hfsplus/inode.c:263
    notify_change+0xe38/0x10f0 fs/attr.c:420
    do_truncate+0x1fb/0x2e0 fs/open.c:65
    do_sys_ftruncate+0x2eb/0x380 fs/open.c:193
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    To avoid deadlock, Commit 31651c607151 ("hfsplus: avoid deadlock
    on file truncation") unlock extree before hfsplus_free_extents(),
    and add check wheather extree is locked in hfsplus_free_extents().
    
    However, when operations such as hfsplus_file_release,
    hfsplus_setattr, hfsplus_unlink, and hfsplus_get_block are executed
    concurrently in different files, it is very likely to trigger the
    WARN_ON, which will lead syzbot and xfstest to consider it as an
    abnormality.
    
    The comment above this warning also describes one of the easy
    triggering situations, which can easily trigger and cause
    xfstest&syzbot to report errors.
    
    [task A]                        [task B]
    ->hfsplus_file_release
      ->hfsplus_file_truncate
        ->hfs_find_init
          ->mutex_lock
        ->mutex_unlock
                                    ->hfsplus_write_begin
                                      ->hfsplus_get_block
                                        ->hfsplus_file_extend
                                          ->hfsplus_ext_read_extent
                                            ->hfs_find_init
                                              ->mutex_lock
        ->hfsplus_free_extents
          WARN_ON(mutex_is_locked) !!!
    
    Several threads could try to lock the shared extents tree.
    And warning can be triggered in one thread when another thread
    has locked the tree. This is the wrong behavior of the code and
    we need to remove the warning.
    
    Fixes: 31651c607151f ("hfsplus: avoid deadlock on file truncation")
    Reported-by: syzbot+8c0bc9f818702ff75b76@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/00000000000057fa4605ef101c4c@google.com/
    Signed-off-by: Yangtao Li <frank.li@vivo.com>
    Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/20250529061807.2213498-1-frank.li@vivo.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
HID: core: do not bypass hid_hw_raw_request [+ + +]
Author: Benjamin Tissoires <bentiss@kernel.org>
Date:   Thu Jul 10 16:01:35 2025 +0200

    HID: core: do not bypass hid_hw_raw_request
    
    commit c2ca42f190b6714d6c481dfd3d9b62ea091c946b upstream.
    
    hid_hw_raw_request() is actually useful to ensure the provided buffer
    and length are valid. Directly calling in the low level transport driver
    function bypassed those checks and allowed invalid paramto be used.
    
    Reported-by: Alan Stern <stern@rowland.harvard.edu>
    Closes: https://lore.kernel.org/linux-input/c75433e0-9b47-4072-bbe8-b1d14ea97b13@rowland.harvard.edu/
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250710-report-size-null-v2-3-ccf922b7c4e5@kernel.org
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: core: ensure __hid_request reserves the report ID as the first byte [+ + +]
Author: Benjamin Tissoires <bentiss@kernel.org>
Date:   Thu Jul 10 16:01:34 2025 +0200

    HID: core: ensure __hid_request reserves the report ID as the first byte
    
    commit 0d0777ccaa2d46609d05b66ba0096802a2746193 upstream.
    
    The low level transport driver expects the first byte to be the report
    ID, even when the report ID is not use (in which case they just shift
    the buffer).
    
    However, __hid_request() whas not offsetting the buffer it used by one
    in this case, meaning that the raw_request() callback emitted by the
    transport driver would be stripped of the first byte.
    
    Note: this changes the API for uhid devices when a request is made
    through hid_hw_request. However, several considerations makes me think
    this is fine:
    - every request to a HID device made through hid_hw_request() would see
      that change, but every request made through hid_hw_raw_request()
      already has the new behaviour. So that means that the users are
      already facing situations where they might have or not the first byte
      being the null report ID when it is 0. We are making things more
      straightforward in the end.
    - uhid is mainly used for BLE devices
    - uhid is also used for testing, but I don't see that change a big issue
    - for BLE devices, we can check which kernel module is calling
      hid_hw_request()
    - and in those modules, we can check which are using a Bluetooth device
    - and then we can check if the command is used with a report ID or not.
    - surprise: none of the kernel module are using a report ID 0
    - and finally, bluez, in its function set_report()[0], does the same
      shift if the report ID is 0 and the given buffer has a size > 0.
    
    [0] https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/profiles/input/hog-lib.c#n879
    
    Reported-by: Alan Stern <stern@rowland.harvard.edu>
    Closes: https://lore.kernel.org/linux-input/c75433e0-9b47-4072-bbe8-b1d14ea97b13@rowland.harvard.edu/
    Reported-by: syzbot+8258d5439c49d4c35f43@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8258d5439c49d4c35f43
    Tested-by: syzbot+8258d5439c49d4c35f43@syzkaller.appspotmail.com
    Fixes: 4fa5a7f76cc7 ("HID: core: implement generic .request()")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250710-report-size-null-v2-2-ccf922b7c4e5@kernel.org
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: core: ensure the allocated report buffer can contain the reserved report ID [+ + +]
Author: Benjamin Tissoires <bentiss@kernel.org>
Date:   Thu Jul 10 16:01:33 2025 +0200

    HID: core: ensure the allocated report buffer can contain the reserved report ID
    
    commit 4f15ee98304b96e164ff2340e1dfd6181c3f42aa upstream.
    
    When the report ID is not used, the low level transport drivers expect
    the first byte to be 0. However, currently the allocated buffer not
    account for that extra byte, meaning that instead of having 8 guaranteed
    bytes for implement to be working, we only have 7.
    
    Reported-by: Alan Stern <stern@rowland.harvard.edu>
    Closes: https://lore.kernel.org/linux-input/c75433e0-9b47-4072-bbe8-b1d14ea97b13@rowland.harvard.edu/
    Cc: stable@vger.kernel.org
    Suggested-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20250710-report-size-null-v2-1-ccf922b7c4e5@kernel.org
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hv_netvsc: Fix panic during namespace deletion with VF [+ + +]
Author: Haiyang Zhang <haiyangz@microsoft.com>
Date:   Tue Aug 19 08:01:27 2025 -0400

    hv_netvsc: Fix panic during namespace deletion with VF
    
    [ Upstream commit 33caa208dba6fa639e8a92fd0c8320b652e5550c ]
    
    The existing code move the VF NIC to new namespace when NETDEV_REGISTER is
    received on netvsc NIC. During deletion of the namespace,
    default_device_exit_batch() >> default_device_exit_net() is called. When
    netvsc NIC is moved back and registered to the default namespace, it
    automatically brings VF NIC back to the default namespace. This will cause
    the default_device_exit_net() >> for_each_netdev_safe loop unable to detect
    the list end, and hit NULL ptr:
    
    [  231.449420] mana 7870:00:00.0 enP30832s1: Moved VF to namespace with: eth0
    [  231.449656] BUG: kernel NULL pointer dereference, address: 0000000000000010
    [  231.450246] #PF: supervisor read access in kernel mode
    [  231.450579] #PF: error_code(0x0000) - not-present page
    [  231.450916] PGD 17b8a8067 P4D 0
    [  231.451163] Oops: Oops: 0000 [#1] SMP NOPTI
    [  231.451450] CPU: 82 UID: 0 PID: 1394 Comm: kworker/u768:1 Not tainted 6.16.0-rc4+ #3 VOLUNTARY
    [  231.452042] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 11/21/2024
    [  231.452692] Workqueue: netns cleanup_net
    [  231.452947] RIP: 0010:default_device_exit_batch+0x16c/0x3f0
    [  231.453326] Code: c0 0c f5 b3 e8 d5 db fe ff 48 85 c0 74 15 48 c7 c2 f8 fd ca b2 be 10 00 00 00 48 8d 7d c0 e8 7b 77 25 00 49 8b 86 28 01 00 00 <48> 8b 50 10 4c 8b 2a 4c 8d 62 f0 49 83 ed 10 4c 39 e0 0f 84 d6 00
    [  231.454294] RSP: 0018:ff75fc7c9bf9fd00 EFLAGS: 00010246
    [  231.454610] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 61c8864680b583eb
    [  231.455094] RDX: ff1fa9f71462d800 RSI: ff75fc7c9bf9fd38 RDI: 0000000030766564
    [  231.455686] RBP: ff75fc7c9bf9fd78 R08: 0000000000000000 R09: 0000000000000000
    [  231.456126] R10: 0000000000000001 R11: 0000000000000004 R12: ff1fa9f70088e340
    [  231.456621] R13: ff1fa9f70088e340 R14: ffffffffb3f50c20 R15: ff1fa9f7103e6340
    [  231.457161] FS:  0000000000000000(0000) GS:ff1faa6783a08000(0000) knlGS:0000000000000000
    [  231.457707] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  231.458031] CR2: 0000000000000010 CR3: 0000000179ab2006 CR4: 0000000000b73ef0
    [  231.458434] Call Trace:
    [  231.458600]  <TASK>
    [  231.458777]  ops_undo_list+0x100/0x220
    [  231.459015]  cleanup_net+0x1b8/0x300
    [  231.459285]  process_one_work+0x184/0x340
    
    To fix it, move the ns change to a workqueue, and take rtnl_lock to avoid
    changing the netdev list when default_device_exit_net() is using it.
    
    Cc: stable@vger.kernel.org
    Fixes: 4c262801ea60 ("hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event")
    Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
    Link: https://patch.msgid.link/1754511711-11188-1-git-send-email-haiyangz@linux.microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hwmon: (corsair-cpro) Validate the size of the received input buffer [+ + +]
Author: Marius Zachmann <mail@mariuszachmann.de>
Date:   Thu Jun 19 15:27:47 2025 +0200

    hwmon: (corsair-cpro) Validate the size of the received input buffer
    
    [ Upstream commit 495a4f0dce9c8c4478c242209748f1ee9e4d5820 ]
    
    Add buffer_recv_size to store the size of the received bytes.
    Validate buffer_recv_size in send_usb_cmd().
    
    Reported-by: syzbot+3bbbade4e1a7ab45ca3b@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-hwmon/61233ba1-e5ad-4d7a-ba31-3b5d0adcffcc@roeck-us.net
    Fixes: 40c3a4454225 ("hwmon: add Corsair Commander Pro driver")
    Signed-off-by: Marius Zachmann <mail@mariuszachmann.de>
    Link: https://lore.kernel.org/r/20250619132817.39764-5-mail@mariuszachmann.de
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (gsc-hwmon) fix fan pwm setpoint show functions [+ + +]
Author: Tim Harvey <tharvey@gateworks.com>
Date:   Fri Jul 18 13:02:59 2025 -0700

    hwmon: (gsc-hwmon) fix fan pwm setpoint show functions
    
    commit 9c62e2282900332c8b711d9f9e37af369a8ef71b upstream.
    
    The Linux hwmon sysfs API values for pwmX_auto_pointY_pwm represent an
    integer value between 0 (0%) to 255 (100%) and the pwmX_auto_pointY_temp
    represent millidegrees Celcius.
    
    Commit a6d80df47ee2 ("hwmon: (gsc-hwmon) fix fan pwm temperature
    scaling") properly addressed the incorrect scaling in the
    pwm_auto_point_temp_store implementation but erroneously scaled
    the pwm_auto_point_pwm_show (pwm value) instead of the
    pwm_auto_point_temp_show (temp value) resulting in:
     # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_pwm
     25500
     # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_temp
     4500
    
    Fix the scaling of these attributes:
     # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_pwm
     255
     # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_temp
     45000
    
    Fixes: a6d80df47ee2 ("hwmon: (gsc-hwmon) fix fan pwm temperature scaling")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tim Harvey <tharvey@gateworks.com>
    Link: https://lore.kernel.org/r/20250718200259.1840792-1-tharvey@gateworks.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hwrng: mtk - handle devm_pm_runtime_enable errors [+ + +]
Author: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Date:   Sun Jun 29 20:31:41 2025 +0300

    hwrng: mtk - handle devm_pm_runtime_enable errors
    
    [ Upstream commit 522a242a18adc5c63a24836715dbeec4dc3faee1 ]
    
    Although unlikely, devm_pm_runtime_enable() call might fail, so handle
    the return value.
    
    Fixes: 78cb66caa6ab ("hwrng: mtk - Use devm_pm_runtime_enable")
    Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i2c: Force DLL0945 touchpad i2c freq to 100khz [+ + +]
Author: fangzhong.zhou <myth5@myth5.com>
Date:   Sun Aug 3 07:15:54 2025 +0800

    i2c: Force DLL0945 touchpad i2c freq to 100khz
    
    [ Upstream commit 0b7c9528facdb5a73ad78fea86d2e95a6c48dbc4 ]
    
    This patch fixes an issue where the touchpad cursor movement becomes
    slow on the Dell Precision 5560. Force the touchpad freq to 100khz
    as a workaround.
    
    Tested on Dell Precision 5560 with 6.14 to 6.14.6. Cursor movement
    is now smooth and responsive.
    
    Signed-off-by: fangzhong.zhou <myth5@myth5.com>
    [wsa: kept sorting and removed unnecessary parts from commit msg]
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

i2c: qup: jump out of the loop in case of timeout [+ + +]
Author: Yang Xiwen <forbidden405@outlook.com>
Date:   Mon Jun 16 00:01:10 2025 +0800

    i2c: qup: jump out of the loop in case of timeout
    
    commit a7982a14b3012527a9583d12525cd0dc9f8d8934 upstream.
    
    Original logic only sets the return value but doesn't jump out of the
    loop if the bus is kept active by a client. This is not expected. A
    malicious or buggy i2c client can hang the kernel in this case and
    should be avoided. This is observed during a long time test with a
    PCA953x GPIO extender.
    
    Fix it by changing the logic to not only sets the return value, but also
    jumps out of the loop and return to the caller with -ETIMEDOUT.
    
    Fixes: fbfab1ab0658 ("i2c: qup: reorganization of driver code to remove polling for qup v1")
    Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
    Cc: <stable@vger.kernel.org> # v4.17+
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20250616-qca-i2c-v1-1-2a8d37ee0a30@outlook.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: stm32: fix the device used for the DMA map [+ + +]
Author: Clément Le Goffic <clement.legoffic@foss.st.com>
Date:   Fri Jul 4 10:39:14 2025 +0200

    i2c: stm32: fix the device used for the DMA map
    
    commit c870cbbd71fccda71d575f0acd4a8d2b7cd88861 upstream.
    
    If the DMA mapping failed, it produced an error log with the wrong
    device name:
    "stm32-dma3 40400000.dma-controller: rejecting DMA map of vmalloc memory"
    Fix this issue by replacing the dev with the I2C dev.
    
    Fixes: bb8822cbbc53 ("i2c: i2c-stm32: Add generic DMA API")
    Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
    Cc: <stable@vger.kernel.org> # v4.18+
    Acked-by: Alain Volmat <alain.volmat@foss.st.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20250704-i2c-upstream-v4-1-84a095a2c728@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
i3c: add missing include to internal header [+ + +]
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Thu Jul 17 14:00:47 2025 +0200

    i3c: add missing include to internal header
    
    [ Upstream commit 3b661ca549b9e5bb11d0bc97ada6110aac3282d2 ]
    
    LKP found a random config which failed to build because IO accessors
    were not defined:
    
       In file included from drivers/i3c/master.c:21:
       drivers/i3c/internals.h: In function 'i3c_writel_fifo':
    >> drivers/i3c/internals.h:35:9: error: implicit declaration of function 'writesl' [-Werror=implicit-function-declaration]
    
    Add the proper header to where the IO accessors are used.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202507150208.BZDzzJ5E-lkp@intel.com/
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20250717120046.9022-2-wsa+renesas@sang-engineering.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

i3c: don't fail if GETHDRCAP is unsupported [+ + +]
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Fri Jul 4 22:44:32 2025 +0200

    i3c: don't fail if GETHDRCAP is unsupported
    
    [ Upstream commit 447270cdb41b1c8c3621bb14b93a6749f942556e ]
    
    'I3C_BCR_HDR_CAP' is still spec v1.0 and has been renamed to 'advanced
    capabilities' in v1.1 onwards. The ST pressure sensor LPS22DF does not
    have HDR, but has the 'advanced cap' bit set. The core still wants to
    get additional information using the CCC 'GETHDRCAP' (or GETCAPS in v1.1
    onwards). Not all controllers support this CCC and will notify the upper
    layers about it. For instantiating the device, we can ignore this
    unsupported CCC as standard communication will work. Without this patch,
    the device will not be instantiated at all.
    
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20250704204524.6124-1-wsa+renesas@sang-engineering.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i40e: Add rx_missed_errors for buffer exhaustion [+ + +]
Author: Yajun Deng <yajun.deng@linux.dev>
Date:   Wed Sep 6 15:27:57 2023 +0800

    i40e: Add rx_missed_errors for buffer exhaustion
    
    [ Upstream commit 5337d294973331660e84e41836a54014de22e5b0 ]
    
    As the comment in struct rtnl_link_stats64, rx_dropped should not
    include packets dropped by the device due to buffer exhaustion.
    They are counted in rx_missed_errors, procfs folds those two counters
    together.
    
    Add rx_missed_errors for buffer exhaustion, rx_missed_errors corresponds
    to rx_discards, rx_dropped corresponds to rx_discards_other.
    
    Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
    Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Stable-dep-of: 50b2af451597 ("i40e: report VF tx_dropped with tx_errors instead of tx_discards")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

i40e: report VF tx_dropped with tx_errors instead of tx_discards [+ + +]
Author: Dennis Chen <dechen@redhat.com>
Date:   Wed Jun 18 15:52:40 2025 -0400

    i40e: report VF tx_dropped with tx_errors instead of tx_discards
    
    [ Upstream commit 50b2af451597ca6eefe9d4543f8bbf8de8aa00e7 ]
    
    Currently the tx_dropped field in VF stats is not updated correctly
    when reading stats from the PF. This is because it reads from
    i40e_eth_stats.tx_discards which seems to be unused for per VSI stats,
    as it is not updated by i40e_update_eth_stats() and the corresponding
    register, GLV_TDPC, is not implemented[1].
    
    Use i40e_eth_stats.tx_errors instead, which is actually updated by
    i40e_update_eth_stats() by reading from GLV_TEPC.
    
    To test, create a VF and try to send bad packets through it:
    
    $ echo 1 > /sys/class/net/enp2s0f0/device/sriov_numvfs
    $ cat test.py
    from scapy.all import *
    
    vlan_pkt = Ether(dst="ff:ff:ff:ff:ff:ff") / Dot1Q(vlan=999) / IP(dst="192.168.0.1") / ICMP()
    ttl_pkt = IP(dst="8.8.8.8", ttl=0) / ICMP()
    
    print("Send packet with bad VLAN tag")
    sendp(vlan_pkt, iface="enp2s0f0v0")
    print("Send packet with TTL=0")
    sendp(ttl_pkt, iface="enp2s0f0v0")
    $ ip -s link show dev enp2s0f0
    16: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
        link/ether 3c:ec:ef:b7:e0:ac brd ff:ff:ff:ff:ff:ff
        RX:  bytes packets errors dropped  missed   mcast
                 0       0      0       0       0       0
        TX:  bytes packets errors dropped carrier collsns
                 0       0      0       0       0       0
        vf 0     link/ether e2:c6:fd:c1:1e:92 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
        RX: bytes  packets  mcast   bcast   dropped
                 0        0       0       0        0
        TX: bytes  packets   dropped
                 0        0        0
    $ python test.py
    Send packet with bad VLAN tag
    .
    Sent 1 packets.
    Send packet with TTL=0
    .
    Sent 1 packets.
    $ ip -s link show dev enp2s0f0
    16: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
        link/ether 3c:ec:ef:b7:e0:ac brd ff:ff:ff:ff:ff:ff
        RX:  bytes packets errors dropped  missed   mcast
                 0       0      0       0       0       0
        TX:  bytes packets errors dropped carrier collsns
                 0       0      0       0       0       0
        vf 0     link/ether e2:c6:fd:c1:1e:92 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
        RX: bytes  packets  mcast   bcast   dropped
                 0        0       0       0        0
        TX: bytes  packets   dropped
                 0        0        0
    
    A packet with non-existent VLAN tag and a packet with TTL = 0 are sent,
    but tx_dropped is not incremented.
    
    After patch:
    
    $ ip -s link show dev enp2s0f0
    19: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
        link/ether 3c:ec:ef:b7:e0:ac brd ff:ff:ff:ff:ff:ff
        RX:  bytes packets errors dropped  missed   mcast
                 0       0      0       0       0       0
        TX:  bytes packets errors dropped carrier collsns
                 0       0      0       0       0       0
        vf 0     link/ether 4a:b7:3d:37:f7:56 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
        RX: bytes  packets  mcast   bcast   dropped
                 0        0       0       0        0
        TX: bytes  packets   dropped
                 0        0        2
    
    Fixes: dc645daef9af5bcbd9c ("i40e: implement VF stats NDO")
    Signed-off-by: Dennis Chen <dechen@redhat.com>
    Link: https://www.intel.com/content/www/us/en/content-details/596333/intel-ethernet-controller-x710-tm4-at2-carlsville-datasheet.html
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ice: Fix a null pointer dereference in ice_copy_and_init_pkg() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Tue Jul 29 15:25:14 2025 -0400

    ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
    
    [ Upstream commit 4ff12d82dac119b4b99b5a78b5af3bf2474c0a36 ]
    
    Add check for the return value of devm_kmemdup()
    to prevent potential null pointer dereference.
    
    Fixes: c76488109616 ("ice: Implement Dynamic Device Personalization (DDP) download")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    [ applied the patch to ice_flex_pipe.c instead of ice_ddp.c ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iio: adc: ad7768-1: Ensure SYNC_IN pulse minimum timing requirement [+ + +]
Author: Jonathan Santos <Jonathan.Santos@analog.com>
Date:   Wed Jun 4 16:35:21 2025 -0300

    iio: adc: ad7768-1: Ensure SYNC_IN pulse minimum timing requirement
    
    [ Upstream commit 7e54d932873d91a55d1b89b7389876d78aeeab32 ]
    
    The SYNC_IN pulse width must be at least 1.5 x Tmclk, corresponding to
    ~2.5 µs at the lowest supported MCLK frequency. Add a 3 µs delay to
    ensure reliable synchronization timing even for the worst-case scenario.
    
    Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/d3ee92a533cd1207cf5c5cc4d7bdbb5c6c267f68.1749063024.git.Jonathan.Santos@analog.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

iio: adc: ad_sigma_delta: change to buffer predisable [+ + +]
Author: David Lechner <dlechner@baylibre.com>
Date:   Fri Aug 22 13:55:16 2025 -0400

    iio: adc: ad_sigma_delta: change to buffer predisable
    
    [ Upstream commit 66d4374d97f85516b5a22418c5e798aed2606dec ]
    
    Change the buffer disable callback from postdisable to predisable.
    This balances the existing posteanble callback. Using postdisable
    with posteanble can be problematic, for example, if update_scan_mode
    fails, it would call postdisable without ever having called posteanble,
    so the drivers using this would be in an unexpected state when
    postdisable was called.
    
    Fixes: af3008485ea0 ("iio:adc: Add common code for ADI Sigma Delta devices")
    Signed-off-by: David Lechner <dlechner@baylibre.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Link: https://patch.msgid.link/20250703-iio-adc-ad_sigma_delta-buffer-predisable-v1-1-f2ab85138f1f@baylibre.com
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: max1363: Fix MAX1363_4X_CHANS/MAX1363_8X_CHANS[] [+ + +]
Author: Fabio Estevam <festevam@denx.de>
Date:   Fri May 16 14:38:59 2025 -0300

    iio: adc: max1363: Fix MAX1363_4X_CHANS/MAX1363_8X_CHANS[]
    
    commit 6d21f2c2dd843bceefd9455f2919f6bb526797f0 upstream.
    
    Since commit 2718f15403fb ("iio: sanity check available_scan_masks array"),
    booting a board populated with a MAX11601 results in a flood of warnings:
    
    max1363 1-0064: available_scan_mask 8 subset of 0. Never used
    max1363 1-0064: available_scan_mask 9 subset of 0. Never used
    max1363 1-0064: available_scan_mask 10 subset of 0. Never used
    max1363 1-0064: available_scan_mask 11 subset of 0. Never used
    max1363 1-0064: available_scan_mask 12 subset of 0. Never used
    max1363 1-0064: available_scan_mask 13 subset of 0. Never used
    ...
    
    These warnings are caused by incorrect offsets used for differential
    channels in the MAX1363_4X_CHANS() and MAX1363_8X_CHANS() macros.
    
    The max1363_mode_table[] defines the differential channel mappings as
    follows:
    
    MAX1363_MODE_DIFF_SINGLE(0, 1, 1 << 12),
    MAX1363_MODE_DIFF_SINGLE(2, 3, 1 << 13),
    MAX1363_MODE_DIFF_SINGLE(4, 5, 1 << 14),
    MAX1363_MODE_DIFF_SINGLE(6, 7, 1 << 15),
    MAX1363_MODE_DIFF_SINGLE(8, 9, 1 << 16),
    MAX1363_MODE_DIFF_SINGLE(10, 11, 1 << 17),
    MAX1363_MODE_DIFF_SINGLE(1, 0, 1 << 18),
    MAX1363_MODE_DIFF_SINGLE(3, 2, 1 << 19),
    MAX1363_MODE_DIFF_SINGLE(5, 4, 1 << 20),
    MAX1363_MODE_DIFF_SINGLE(7, 6, 1 << 21),
    MAX1363_MODE_DIFF_SINGLE(9, 8, 1 << 22),
    MAX1363_MODE_DIFF_SINGLE(11, 10, 1 << 23),
    
    Update the macros to follow this same pattern, ensuring that the scan masks
    are valid and preventing the warnings.
    
    Cc: stable@vger.kernel.org
    Suggested-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Fabio Estevam <festevam@denx.de>
    Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Link: https://patch.msgid.link/20250516173900.677821-1-festevam@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: max1363: Reorder mode_list[] entries [+ + +]
Author: Fabio Estevam <festevam@denx.de>
Date:   Fri May 16 14:39:00 2025 -0300

    iio: adc: max1363: Reorder mode_list[] entries
    
    commit 8d8d7c1dbc46aa07a76acab7336a42ddd900be10 upstream.
    
    The IIO core issues warnings when a scan mask is a subset of a previous
    entry in the available_scan_masks array.
    
    On a board using a MAX11601, the following warning is observed:
    
    max1363 1-0064: available_scan_mask 7 subset of 6. Never used
    
    This occurs because the entries in the max11607_mode_list[] array are not
    ordered correctly. To fix this, reorder the entries so that no scan mask is
    a subset of an earlier one.
    
    While at it, reorder the mode_list[] arrays for other supported chips as
    well, to prevent similar warnings on different variants.
    
    Note fixes tag dropped as these were introduced over many commits a long
    time back and the side effect until recently was a reduction in sampling
    rate due to reading too many channels when only a few were desired.
    Now we have a sanity check that reports this error but that is not
    where the issue was introduced.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Fabio Estevam <festevam@denx.de>
    Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Link: https://patch.msgid.link/20250516173900.677821-2-festevam@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: stm32-adc: Fix race in installing chained IRQ handler [+ + +]
Author: Chen Ni <nichen@iscas.ac.cn>
Date:   Thu May 15 16:31:01 2025 +0800

    iio: adc: stm32-adc: Fix race in installing chained IRQ handler
    
    commit e8ad595064f6ebd5d2d1a5d5d7ebe0efce623091 upstream.
    
    Fix a race where a pending interrupt could be received and the handler
    called before the handler's data has been setup, by converting to
    irq_set_chained_handler_and_data().
    
    Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core")
    Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Tested-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
    Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
    Link: https://patch.msgid.link/20250515083101.3811350-1-nichen@iscas.ac.cn
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: hid-sensor-prox: Fix incorrect OFFSET calculation [+ + +]
Author: Zhang Lixu <lixu.zhang@intel.com>
Date:   Thu Jul 24 12:39:37 2025 -0400

    iio: hid-sensor-prox: Fix incorrect OFFSET calculation
    
    [ Upstream commit 79dabbd505210e41c88060806c92c052496dd61c ]
    
    The OFFSET calculation in the prox_read_raw() was incorrectly using the
    unit exponent, which is intended for SCALE calculations.
    
    Remove the incorrect OFFSET calculation and set it to a fixed value of 0.
    
    Cc: stable@vger.kernel.org
    Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver")
    Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Link: https://patch.msgid.link/20250331055022.1149736-4-lixu.zhang@intel.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    [ adapted prox_attr array access to single structure member access ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: inv_icm42600: change invalid data error to -EBUSY [+ + +]
Author: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Date:   Sun Aug 24 12:39:29 2025 -0400

    iio: imu: inv_icm42600: change invalid data error to -EBUSY
    
    [ Upstream commit dfdc31e7ccf3ac1d5ec01d5120c71e14745e3dd8 ]
    
    Temperature sensor returns the temperature of the mechanical parts
    of the chip. If both accel and gyro are off, the temperature sensor is
    also automatically turned off and returns invalid data.
    
    In this case, returning -EBUSY error code is better then -EINVAL and
    indicates userspace that it needs to retry reading temperature in
    another context.
    
    Fixes: bc3eb0207fb5 ("iio: imu: inv_icm42600: add temperature sensor support")
    Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Reviewed-by: Sean Nyekjaer <sean@geanix.com>
    Link: https://patch.msgid.link/20250808-inv-icm42600-change-temperature-error-code-v1-1-986fbf63b77d@tdk.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: as73211: Ensure buffer holes are zeroed [+ + +]
Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date:   Sun Aug 24 09:39:06 2025 -0400

    iio: light: as73211: Ensure buffer holes are zeroed
    
    [ Upstream commit 433b99e922943efdfd62b9a8e3ad1604838181f2 ]
    
    Given that the buffer is copied to a kfifo that ultimately user space
    can read, ensure we zero it.
    
    Fixes: 403e5586b52e ("iio: light: as73211: New driver")
    Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Link: https://patch.msgid.link/20250802164436.515988-2-jic23@kernel.org
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe() [+ + +]
Author: Salah Triki <salah.triki@gmail.com>
Date:   Mon Aug 18 10:27:30 2025 +0100

    iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe()
    
    commit 43c0f6456f801181a80b73d95def0e0fd134e1cc upstream.
    
    `devm_gpiod_get_optional()` may return non-NULL error pointer on failure.
    Check its return value using `IS_ERR()` and propagate the error if
    necessary.
    
    Fixes: df6e71256c84 ("iio: pressure: bmp280: Explicitly mark GPIO optional")
    Signed-off-by: Salah Triki <salah.triki@gmail.com>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Link: https://patch.msgid.link/20250818092740.545379-2-salah.triki@gmail.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: proximity: isl29501: fix buffered read on big-endian systems [+ + +]
Author: David Lechner <dlechner@baylibre.com>
Date:   Tue Jul 22 15:54:21 2025 -0500

    iio: proximity: isl29501: fix buffered read on big-endian systems
    
    commit de18e978d0cda23e4c102e18092b63a5b0b3a800 upstream.
    
    Fix passing a u32 value as a u16 buffer scan item. This works on little-
    endian systems, but not on big-endian systems.
    
    A new local variable is introduced for getting the register value and
    the array is changed to a struct to make the data layout more explicit
    rather than just changing the type and having to recalculate the proper
    length needed for the timestamp.
    
    Fixes: 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")
    Signed-off-by: David Lechner <dlechner@baylibre.com>
    Link: https://patch.msgid.link/20250722-iio-use-more-iio_declare_buffer_with_ts-7-v2-1-d3ebeb001ed3@baylibre.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Input: xpad - set correct controller type for Acer NGR200 [+ + +]
Author: Nilton Perim Neto <niltonperimneto@gmail.com>
Date:   Sat Jul 19 22:07:36 2025 -0700

    Input: xpad - set correct controller type for Acer NGR200
    
    commit bcce05041b21888f10b80ea903dcfe51a25c586e upstream.
    
    The controller should have been set as XTYPE_XBOX360 and not XTYPE_XBOX.
    Also the entry is in the wrong place. Fix it.
    
    Reported-by: Vicki Pfau <vi@endrift.com>
    Signed-off-by: Nilton Perim Neto <niltonperimneto@gmail.com>
    Link: https://lore.kernel.org/r/20250708033126.26216-2-niltonperimneto@gmail.com
    Fixes: 22c69d786ef8 ("Input: xpad - support Acer NGR 200 Controller")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
intel_idle: Allow loading ACPI tables for any family [+ + +]
Author: Len Brown <len.brown@intel.com>
Date:   Fri Aug 8 15:37:14 2025 -0400

    intel_idle: Allow loading ACPI tables for any family
    
    [ Upstream commit e91a158b694d7f4bd937763dde79ed0afa472d8a ]
    
    There is no reason to limit intel_idle's loading of ACPI tables to
    family 6.  Upcoming Intel processors are not in family 6.
    
    Below "Fixes" really means "applies cleanly until".
    That syntax commit didn't change the previous logic,
    but shows this patch applies back 5-years.
    
    Fixes: 4a9f45a0533f ("intel_idle: Convert to new X86 CPU match macros")
    Signed-off-by: Len Brown <len.brown@intel.com>
    Link: https://patch.msgid.link/06101aa4fe784e5b0be1cb2c0bdd9afcf16bd9d4.1754681697.git.len.brown@intel.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
io_uring: don't use int for ABI [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Jul 2 21:31:54 2025 +0100

    io_uring: don't use int for ABI
    
    commit cf73d9970ea4f8cace5d8f02d2565a2723003112 upstream.
    
    __kernel_rwf_t is defined as int, the actual size of which is
    implementation defined. It won't go well if some compiler / archs
    ever defines it as i64, so replace it with __u32, hoping that
    there is no one using i16 for it.
    
    Cc: stable@vger.kernel.org
    Fixes: 2b188cc1bb857 ("Add io_uring IO interface")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/47c666c4ee1df2018863af3a2028af18feef11ed.1751412511.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/amd: Avoid stack buffer overflow from kernel cmdline [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Mon Aug 4 08:40:27 2025 -0700

    iommu/amd: Avoid stack buffer overflow from kernel cmdline
    
    [ Upstream commit 8503d0fcb1086a7cfe26df67ca4bd9bd9e99bdec ]
    
    While the kernel command line is considered trusted in most environments,
    avoid writing 1 byte past the end of "acpiid" if the "str" argument is
    maximum length.
    
    Reported-by: Simcha Kosman <simcha.kosman@cyberark.com>
    Closes: https://lore.kernel.org/all/AS8P193MB2271C4B24BCEDA31830F37AE84A52@AS8P193MB2271.EURP193.PROD.OUTLOOK.COM
    Fixes: b6b26d86c61c ("iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter")
    Signed-off-by: Kees Cook <kees@kernel.org>
    Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>
    Link: https://lore.kernel.org/r/20250804154023.work.970-kees@kernel.org
    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipmi: Fix strcpy source and destination the same [+ + +]
Author: Corey Minyard <corey@minyard.net>
Date:   Fri Jun 13 19:06:26 2025 -0500

    ipmi: Fix strcpy source and destination the same
    
    [ Upstream commit 8ffcb7560b4a15faf821df95e3ab532b2b020f8c ]
    
    The source and destination of some strcpy operations was the same.
    Split out the part of the operations that needed to be done for those
    particular calls so the unnecessary copy wasn't done.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202506140756.EFXXvIP4-lkp@intel.com/
    Signed-off-by: Corey Minyard <corey@minyard.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipmi: Use dev_warn_ratelimited() for incorrect message warnings [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Thu Jul 10 05:57:26 2025 -0700

    ipmi: Use dev_warn_ratelimited() for incorrect message warnings
    
    [ Upstream commit ec50ec378e3fd83bde9b3d622ceac3509a60b6b5 ]
    
    During BMC firmware upgrades on live systems, the ipmi_msghandler
    generates excessive "BMC returned incorrect response" warnings
    while the BMC is temporarily offline. This can flood system logs
    in large deployments.
    
    Replace dev_warn() with dev_warn_ratelimited() to throttle these
    warnings and prevent log spam during BMC maintenance operations.
    
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Message-ID: <20250710-ipmi_ratelimit-v1-1-6d417015ebe9@debian.org>
    Signed-off-by: Corey Minyard <corey@minyard.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipv6: reject malicious packets in ipv6_gso_segment() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Jul 30 13:17:38 2025 +0000

    ipv6: reject malicious packets in ipv6_gso_segment()
    
    [ Upstream commit d45cf1e7d7180256e17c9ce88e32e8061a7887fe ]
    
    syzbot was able to craft a packet with very long IPv6 extension headers
    leading to an overflow of skb->transport_header.
    
    This 16bit field has a limited range.
    
    Add skb_reset_transport_header_careful() helper and use it
    from ipv6_gso_segment()
    
    WARNING: CPU: 0 PID: 5871 at ./include/linux/skbuff.h:3032 skb_reset_transport_header include/linux/skbuff.h:3032 [inline]
    WARNING: CPU: 0 PID: 5871 at ./include/linux/skbuff.h:3032 ipv6_gso_segment+0x15e2/0x21e0 net/ipv6/ip6_offload.c:151
    Modules linked in:
    CPU: 0 UID: 0 PID: 5871 Comm: syz-executor211 Not tainted 6.16.0-rc6-syzkaller-g7abc678e3084 #0 PREEMPT(full)
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
     RIP: 0010:skb_reset_transport_header include/linux/skbuff.h:3032 [inline]
     RIP: 0010:ipv6_gso_segment+0x15e2/0x21e0 net/ipv6/ip6_offload.c:151
    Call Trace:
     <TASK>
      skb_mac_gso_segment+0x31c/0x640 net/core/gso.c:53
      nsh_gso_segment+0x54a/0xe10 net/nsh/nsh.c:110
      skb_mac_gso_segment+0x31c/0x640 net/core/gso.c:53
      __skb_gso_segment+0x342/0x510 net/core/gso.c:124
      skb_gso_segment include/net/gso.h:83 [inline]
      validate_xmit_skb+0x857/0x11b0 net/core/dev.c:3950
      validate_xmit_skb_list+0x84/0x120 net/core/dev.c:4000
      sch_direct_xmit+0xd3/0x4b0 net/sched/sch_generic.c:329
      __dev_xmit_skb net/core/dev.c:4102 [inline]
      __dev_queue_xmit+0x17b6/0x3a70 net/core/dev.c:4679
    
    Fixes: d1da932ed4ec ("ipv6: Separate ipv6 offload support")
    Reported-by: syzbot+af43e647fd835acc02df@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/688a1a05.050a0220.5d226.0008.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20250730131738.3385939-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add [+ + +]
Author: Minhong He <heminhong@kylinos.cn>
Date:   Fri Aug 15 14:38:45 2025 +0800

    ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add
    
    [ Upstream commit 84967deee9d9870b15bc4c3acb50f1d401807902 ]
    
    The seg6_genl_sethmac() directly uses the algorithm ID provided by the
    userspace without verifying whether it is an HMAC algorithm supported
    by the system.
    If an unsupported HMAC algorithm ID is configured, packets using SRv6 HMAC
    will be dropped during encapsulation or decapsulation.
    
    Fixes: 4f4853dc1c9c ("ipv6: sr: implement API to control SR HMAC structure")
    Signed-off-by: Minhong He <heminhong@kylinos.cn>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20250815063845.85426-1-heminhong@kylinos.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
isofs: Verify inode mode when loading from disk [+ + +]
Author: Jan Kara <jack@suse.cz>
Date:   Wed Jul 9 11:55:46 2025 +0200

    isofs: Verify inode mode when loading from disk
    
    commit 0a9e7405131380b57e155f10242b2e25d2e51852 upstream.
    
    Verify that the inode mode is sane when loading it from the disk to
    avoid complaints from VFS about setting up invalid inodes.
    
    Reported-by: syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com
    CC: stable@vger.kernel.org
    Signed-off-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/20250709095545.31062-2-jack@suse.cz
    Acked-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iwlwifi: Add missing check for alloc_ordered_workqueue [+ + +]
Author: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Date:   Tue Jan 10 09:48:48 2023 +0800

    iwlwifi: Add missing check for alloc_ordered_workqueue
    
    [ Upstream commit 90a0d9f339960448a3acc1437a46730f975efd6a ]
    
    Add check for the return value of alloc_ordered_workqueue since it may
    return NULL pointer.
    
    Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
    Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
    Link: https://patch.msgid.link/20230110014848.28226-1-jiasheng@iscas.ac.cn
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ixgbe: xsk: resolve the negative overflow of budget in ixgbe_xmit_zc [+ + +]
Author: Jason Xing <kernelxing@tencent.com>
Date:   Tue Aug 19 15:19:57 2025 -0700

    ixgbe: xsk: resolve the negative overflow of budget in ixgbe_xmit_zc
    
    [ Upstream commit 4d4d9ef9dfee877d494e5418f68a1016ef08cad6 ]
    
    Resolve the budget negative overflow which leads to returning true in
    ixgbe_xmit_zc even when the budget of descs are thoroughly consumed.
    
    Before this patch, when the budget is decreased to zero and finishes
    sending the last allowed desc in ixgbe_xmit_zc, it will always turn back
    and enter into the while() statement to see if it should keep processing
    packets, but in the meantime it unexpectedly decreases the value again to
    'unsigned int (0--)', namely, UINT_MAX. Finally, the ixgbe_xmit_zc returns
    true, showing 'we complete cleaning the budget'. That also means
    'clean_complete = true' in ixgbe_poll.
    
    The true theory behind this is if that budget number of descs are consumed,
    it implies that we might have more descs to be done. So we should return
    false in ixgbe_xmit_zc to tell napi poll to find another chance to start
    polling to handle the rest of descs. On the contrary, returning true here
    means job done and we know we finish all the possible descs this time and
    we don't intend to start a new napi poll.
    
    It is apparently against our expectations. Please also see how
    ixgbe_clean_tx_irq() handles the problem: it uses do..while() statement
    to make sure the budget can be decreased to zero at most and the negative
    overflow never happens.
    
    The patch adds 'likely' because we rarely would not hit the loop condition
    since the standard budget is 256.
    
    Fixes: 8221c5eba8c1 ("ixgbe: add AF_XDP zero-copy Tx support")
    Signed-off-by: Jason Xing <kernelxing@tencent.com>
    Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Tested-by: Priya Singh <priyax.singh@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://patch.msgid.link/20250819222000.3504873-4-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
jbd2: prevent softlockup in jbd2_log_do_checkpoint() [+ + +]
Author: Baokun Li <libaokun1@huawei.com>
Date:   Tue Aug 12 14:37:52 2025 +0800

    jbd2: prevent softlockup in jbd2_log_do_checkpoint()
    
    commit 9d98cf4632258720f18265a058e62fde120c0151 upstream.
    
    Both jbd2_log_do_checkpoint() and jbd2_journal_shrink_checkpoint_list()
    periodically release j_list_lock after processing a batch of buffers to
    avoid long hold times on the j_list_lock. However, since both functions
    contend for j_list_lock, the combined time spent waiting and processing
    can be significant.
    
    jbd2_journal_shrink_checkpoint_list() explicitly calls cond_resched() when
    need_resched() is true to avoid softlockups during prolonged operations.
    But jbd2_log_do_checkpoint() only exits its loop when need_resched() is
    true, relying on potentially sleeping functions like __flush_batch() or
    wait_on_buffer() to trigger rescheduling. If those functions do not sleep,
    the kernel may hit a softlockup.
    
    watchdog: BUG: soft lockup - CPU#3 stuck for 156s! [kworker/u129:2:373]
    CPU: 3 PID: 373 Comm: kworker/u129:2 Kdump: loaded Not tainted 6.6.0+ #10
    Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.27 06/13/2017
    Workqueue: writeback wb_workfn (flush-7:2)
    pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : native_queued_spin_lock_slowpath+0x358/0x418
    lr : jbd2_log_do_checkpoint+0x31c/0x438 [jbd2]
    Call trace:
     native_queued_spin_lock_slowpath+0x358/0x418
     jbd2_log_do_checkpoint+0x31c/0x438 [jbd2]
     __jbd2_log_wait_for_space+0xfc/0x2f8 [jbd2]
     add_transaction_credits+0x3bc/0x418 [jbd2]
     start_this_handle+0xf8/0x560 [jbd2]
     jbd2__journal_start+0x118/0x228 [jbd2]
     __ext4_journal_start_sb+0x110/0x188 [ext4]
     ext4_do_writepages+0x3dc/0x740 [ext4]
     ext4_writepages+0xa4/0x190 [ext4]
     do_writepages+0x94/0x228
     __writeback_single_inode+0x48/0x318
     writeback_sb_inodes+0x204/0x590
     __writeback_inodes_wb+0x54/0xf8
     wb_writeback+0x2cc/0x3d8
     wb_do_writeback+0x2e0/0x2f8
     wb_workfn+0x80/0x2a8
     process_one_work+0x178/0x3e8
     worker_thread+0x234/0x3b8
     kthread+0xf0/0x108
     ret_from_fork+0x10/0x20
    
    So explicitly call cond_resched() in jbd2_log_do_checkpoint() to avoid
    softlockup.
    
    Cc: stable@kernel.org
    Signed-off-by: Baokun Li <libaokun1@huawei.com>
    Link: https://patch.msgid.link/20250812063752.912130-1-libaokun@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
jfs: fix metapage reference count leak in dbAllocCtl [+ + +]
Author: Zheng Yu <zheng.yu@northwestern.edu>
Date:   Tue Jul 29 01:22:14 2025 +0000

    jfs: fix metapage reference count leak in dbAllocCtl
    
    [ Upstream commit 856db37592021e9155384094e331e2d4589f28b1 ]
    
    In dbAllocCtl(), read_metapage() increases the reference count of the
    metapage. However, when dp->tree.budmin < 0, the function returns -EIO
    without calling release_metapage() to decrease the reference count,
    leading to a memory leak.
    
    Add release_metapage(mp) before the error return to properly manage
    the metapage reference count and prevent the leak.
    
    Fixes: a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ("jfs: fix shift-out-of-bounds in dbSplit")
    
    Signed-off-by: Zheng Yu <zheng.yu@northwestern.edu>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: Regular file corruption check [+ + +]
Author: Edward Adam Davis <eadavis@qq.com>
Date:   Wed Jun 4 14:48:43 2025 +0800

    jfs: Regular file corruption check
    
    [ Upstream commit 2d04df8116426b6c7b9f8b9b371250f666a2a2fb ]
    
    The reproducer builds a corrupted file on disk with a negative i_size value.
    Add a check when opening this file to avoid subsequent operation failures.
    
    Reported-by: syzbot+630f6d40b3ccabc8e96e@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=630f6d40b3ccabc8e96e
    Tested-by: syzbot+630f6d40b3ccabc8e96e@syzkaller.appspotmail.com
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: truncate good inode pages when hard link is 0 [+ + +]
Author: Lizhi Xu <lizhi.xu@windriver.com>
Date:   Fri Jun 13 11:05:34 2025 +0800

    jfs: truncate good inode pages when hard link is 0
    
    [ Upstream commit 2d91b3765cd05016335cd5df5e5c6a29708ec058 ]
    
    The fileset value of the inode copy from the disk by the reproducer is
    AGGR_RESERVED_I. When executing evict, its hard link number is 0, so its
    inode pages are not truncated. This causes the bugon to be triggered when
    executing clear_inode() because nrpages is greater than 0.
    
    Reported-by: syzbot+6e516bb515d93230bc7b@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=6e516bb515d93230bc7b
    Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: upper bound check of tree index in dbAllocAG [+ + +]
Author: Arnaud Lecomte <contact@arnaud-lcm.com>
Date:   Thu Apr 24 00:13:51 2025 +0200

    jfs: upper bound check of tree index in dbAllocAG
    
    [ Upstream commit c214006856ff52a8ff17ed8da52d50601d54f9ce ]
    
    When computing the tree index in dbAllocAG, we never check if we are
    out of bounds realative to the size of the stree.
    This could happen in a scenario where the filesystem metadata are
    corrupted.
    
    Reported-by: syzbot+cffd18309153948f3c3e@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=cffd18309153948f3c3e
    Tested-by: syzbot+cffd18309153948f3c3e@syzkaller.appspotmail.com
    Signed-off-by: Arnaud Lecomte <contact@arnaud-lcm.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
kbuild: userprogs: use correct linker when mixing clang and GNU ld [+ + +]
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Date:   Thu Aug 21 11:31:06 2025 -0700

    kbuild: userprogs: use correct linker when mixing clang and GNU ld
    
    commit 936599ca514973d44a766b7376c6bbdc96b6a8cc upstream.
    
    The userprogs infrastructure does not expect clang being used with GNU ld
    and in that case uses /usr/bin/ld for linking, not the configured $(LD).
    This fallback is problematic as it will break when cross-compiling.
    Mixing clang and GNU ld is used for example when building for SPARC64,
    as ld.lld is not sufficient; see Documentation/kbuild/llvm.rst.
    
    Relax the check around --ld-path so it gets used for all linkers.
    
    Fixes: dfc1b168a8c4 ("kbuild: userprogs: use correct lld when linking through clang")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    [nathan: Work around wrapping '--ld-path' in cc-option in older stable
             branches due to older minimum LLVM version]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed() [+ + +]
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Wed Jun 25 00:05:20 2025 +0900

    kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
    
    [ Upstream commit cae9cdbcd9af044810bcceeb43a87accca47c71d ]
    
    The on_treeview2_cursor_changed() handler is connected to both the left
    and right tree views, but it hardcodes model2 (the GtkTreeModel of the
    right tree view). This is incorrect. Get the associated model from the
    view.
    
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kconfig: gconf: fix potential memory leak in renderer_edited() [+ + +]
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Wed Jun 25 00:04:55 2025 +0900

    kconfig: gconf: fix potential memory leak in renderer_edited()
    
    [ Upstream commit f72ed4c6a375e52a3f4b75615e4a89d29d8acea7 ]
    
    If gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.
    
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Acked-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kconfig: lxdialog: fix 'space' to (de)select options [+ + +]
Author: Yann E. MORIN <yann.morin.1998@free.fr>
Date:   Thu Nov 14 00:53:32 2013 +0100

    kconfig: lxdialog: fix 'space' to (de)select options
    
    [ Upstream commit 694174f94ebeeb5ec5cc0e9de9b40c82057e1d95 ]
    
    In case a menu has comment without letters/numbers (eg. characters
    matching the regexp '^[^[:alpha:][:digit:]]+$', for example - or *),
    hitting space will cycle through those comments, rather than
    selecting/deselecting the currently-highlighted option.
    
    This is the behaviour of hitting any letter/digit: jump to the next
    option which prompt starts with that letter. The only letters that
    do not behave as such are 'y' 'm' and 'n'. Prompts that start with
    one of those three letters are instead matched on the first letter
    that is not 'y', 'm' or 'n'.
    
    Fix that by treating 'space' as we treat y/m/n, ie. as an action key,
    not as shortcut to jump to  prompt.
    
    Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
    Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
    Signed-off-by: Cherniaev Andrei <dungeonlords789@naver.com>
    [masahiro: took from Buildroot, adjusted the commit subject]
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c [+ + +]
Author: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Date:   Sun Jul 27 22:14:33 2025 +0530

    kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c
    
    [ Upstream commit 5ac726653a1029a2eccba93bbe59e01fc9725828 ]
    
    strcpy() performs no bounds checking and can lead to buffer overflows if
    the input string exceeds the destination buffer size. This patch replaces
    it with strncpy(), and null terminates the input string.
    
    Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
    Reviewed-by: Nicolas Schier <nicolas.schier@linux.dev>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kconfig: nconf: Ensure null termination where strncpy is used [+ + +]
Author: Shankari Anand <shankari.ak0208@gmail.com>
Date:   Thu Jun 26 00:36:54 2025 +0530

    kconfig: nconf: Ensure null termination where strncpy is used
    
    [ Upstream commit f468992936894c9ce3b1659cf38c230d33b77a16 ]
    
    strncpy() does not guarantee null-termination if the source string is
    longer than the destination buffer.
    
    Ensure the buffer is explicitly null-terminated to prevent potential
    string overflows or undefined behavior.
    
    Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Acked-by: Randy Dunlap <rdunlap@infradead.org>
    Tested-by: Randy Dunlap <rdunlap@infradead.org>
    Tested-by: Nicolas Schier <n.schier@avm.de>
    Acked-by: Nicolas Schier <n.schier@avm.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kconfig: qconf: fix ConfigList::updateListAllforAll() [+ + +]
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Mon Jun 30 03:48:56 2025 +0900

    kconfig: qconf: fix ConfigList::updateListAllforAll()
    
    [ Upstream commit 721bfe583c52ba1ea74b3736a31a9dcfe6dd6d95 ]
    
    ConfigList::updateListForAll() and ConfigList::updateListAllforAll()
    are identical.
    
    Commit f9b918fae678 ("kconfig: qconf: move ConfigView::updateList(All)
    to ConfigList class") was a misconversion.
    
    Fixes: f9b918fae678 ("kconfig: qconf: move ConfigView::updateList(All) to ConfigList class")
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ktest.pl: Prevent recursion of default variable options [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri Jul 18 16:18:44 2025 -0400

    ktest.pl: Prevent recursion of default variable options
    
    [ Upstream commit 61f7e318e99d3b398670518dd3f4f8510d1800fc ]
    
    If a default variable contains itself, do not recurse on it.
    
    For example:
    
      ADD_CONFIG := ${CONFIG_DIR}/temp_config
      DEFAULTS
      ADD_CONFIG = ${CONFIG_DIR}/default_config ${ADD_CONFIG}
    
    The above works because the temp variable ADD_CONFIG (is a temp because it
    is created with ":=") is already defined, it will be substituted in the
    variable option. But if it gets commented out:
    
      # ADD_CONFIG := ${CONFIG_DIR}/temp_config
      DEFAULTS
      ADD_CONFIG = ${CONFIG_DIR}/default_config ${ADD_CONFIG}
    
    Then the above will go into a recursive loop where ${ADD_CONFIG} will
    get replaced with the current definition of ADD_CONFIG which contains the
    ${ADD_CONFIG} and that will also try to get converted. ktest.pl will error
    after 100 attempts of recursion and fail.
    
    When replacing a variable with the default variable, if the default
    variable contains itself, do not replace it.
    
    Cc: "John Warthog9 Hawley" <warthog9@kernel.org>
    Cc: Dhaval Giani <dhaval.giani@gmail.com>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/20250718202053.732189428@kernel.org
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
leds: leds-lp50xx: Handle reg to get correct multi_index [+ + +]
Author: Johan Adolfsson <johan.adolfsson@axis.com>
Date:   Tue Jun 17 12:23:54 2025 +0200

    leds: leds-lp50xx: Handle reg to get correct multi_index
    
    [ Upstream commit 2e84a5e5374232e6f356ce5c079a5658d7e4af2c ]
    
    mc_subled used for multi_index needs well defined array indexes,
    to guarantee the desired result, use reg for that.
    
    If devicetree child nodes is processed in random or reverse order
    you may end up with multi_index "blue green red" instead of the expected
    "red green blue".
    If user space apps uses multi_index to deduce how to control the leds
    they would most likely be broken without this patch if devicetree
    processing is reversed (which it appears to be).
    
    arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-fuji.dts has reg set
    but I don't see how it can have worked without this change.
    
    If reg is not set, an error is returned,
    If reg is out of range, an error is returned.
    reg within led child nodes starts with 0, to map to the iout in each bank.
    
    Signed-off-by: Johan Adolfsson <johan.adolfsson@axis.com>
    Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
    Link: https://lore.kernel.org/r/20250617-led-fix-v7-1-cdbe8efc88fa@axis.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Thu Jun 19 15:55:35 2025 -0700

    lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap
    
    commit 22375adaa0d9fbba9646c8e2b099c6e87c97bfae upstream.
    
    The MIPS32r2 ChaCha code has never been buildable with the clang
    assembler.  First, clang doesn't support the 'rotl' pseudo-instruction:
    
        error: unknown instruction, did you mean: rol, rotr?
    
    Second, clang requires that both operands of the 'wsbh' instruction be
    explicitly given:
    
        error: too few operands for instruction
    
    To fix this, align the code with the real instruction set by (1) using
    the real instruction 'rotr' instead of the nonstandard pseudo-
    instruction 'rotl', and (2) explicitly giving both operands to 'wsbh'.
    
    To make removing the use of 'rotl' a bit easier, also remove the
    unnecessary special-casing for big endian CPUs at
    .Lchacha_mips_xor_bytes.  The tail handling is actually
    endian-independent since it processes one byte at a time.  On big endian
    CPUs the old code byte-swapped SAVED_X, then iterated through it in
    reverse order.  But the byteswap and reverse iteration canceled out.
    
    Tested with chacha20poly1305-selftest in QEMU using "-M malta" with both
    little endian and big endian mips32r2 kernels.
    
    Fixes: 49aa7c00eddf ("crypto: mips/chacha - import 32r2 ChaCha code from Zinc")
    Cc: stable@vger.kernel.org
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202505080409.EujEBwA0-lkp@intel.com/
    Link: https://lore.kernel.org/r/20250619225535.679301-1-ebiggers@kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 5.10.241 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Aug 28 16:22:59 2025 +0200

    Linux 5.10.241
    
    Link: https://lore.kernel.org/r/20250826110924.562212281@linuxfoundation.org
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
locking/barriers, kcsan: Support generic instrumentation [+ + +]
Author: Marco Elver <elver@google.com>
Date:   Fri Aug 22 15:53:28 2025 -0400

    locking/barriers, kcsan: Support generic instrumentation
    
    [ Upstream commit 2505a51ac6f249956735e0a369e2404f96eebef0 ]
    
    Thus far only smp_*() barriers had been defined by asm-generic/barrier.h
    based on __smp_*() barriers, because the !SMP case is usually generic.
    
    With the introduction of instrumentation, it also makes sense to have
    asm-generic/barrier.h assist in the definition of instrumented versions
    of mb(), rmb(), wmb(), dma_rmb(), and dma_wmb().
    
    Because there is no requirement to distinguish the !SMP case, the
    definition can be simpler: we can avoid also providing fallbacks for the
    __ prefixed cases, and only check if `defined(__<barrier>)`, to finally
    define the KCSAN-instrumented versions.
    
    This also allows for the compiler to complain if an architecture
    accidentally defines both the normal and __ prefixed variant.
    
    Signed-off-by: Marco Elver <elver@google.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Stable-dep-of: aa6956150f82 ("wifi: ath11k: fix dest ring-buffer corruption when ring is full")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
m68k: Don't unregister boot console needlessly [+ + +]
Author: Finn Thain <fthain@linux-m68k.org>
Date:   Tue Apr 1 11:26:44 2025 +1100

    m68k: Don't unregister boot console needlessly
    
    [ Upstream commit 83f672a7f69ec38b1bbb27221e342937f68c11c7 ]
    
    When MACH_IS_MVME147, the boot console calls mvme147_scc_write() to
    generate console output. That will continue to work even after
    debug_cons_nputs() becomes unavailable so there's no need to
    unregister the boot console.
    
    Take the opportunity to remove a repeated MACH_IS_* test. Use the
    actual .write method (instead of a wrapper) and test that pointer
    instead. This means adding an unused parameter to debug_cons_nputs() for
    consistency with the struct console API.
    
    early_printk.c is only built when CONFIG_EARLY_PRINTK=y. As of late,
    head.S is only built when CONFIG_MMU_MOTOROLA=y. So let the former symbol
    depend on the latter, to obviate some ifdef conditionals.
    
    Cc: Daniel Palmer <daniel@0x0f.com>
    Fixes: 077b33b9e283 ("m68k: mvme147: Reinstate early console")
    Signed-off-by: Finn Thain <fthain@linux-m68k.org>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/d1d4328e5aa9a87bd8352529ce62b767731c0530.1743467205.git.fthain@linux-m68k.org
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

m68k: Fix lost column on framebuffer debug console [+ + +]
Author: Finn Thain <fthain@linux-m68k.org>
Date:   Fri Mar 28 09:39:55 2025 +1100

    m68k: Fix lost column on framebuffer debug console
    
    commit 210a1ce8ed4391b64a888b3fb4b5611a13f5ccc7 upstream.
    
    Move the cursor position rightward after rendering the character,
    not before. This avoids complications that arise when the recursive
    console_putc call has to wrap the line and/or scroll the display.
    This also fixes the linewrap bug that crops off the rightmost column.
    
    When the cursor is at the bottom of the display, a linefeed will not
    move the cursor position further downward. Instead, the display scrolls
    upward. Avoid the repeated add/subtract sequence by way of a single
    subtraction at the initialization of console_struct_num_rows.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Finn Thain <fthain@linux-m68k.org>
    Tested-by: Stan Johnson <userm57@yahoo.com>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/9d4e8c68a456d5f2bc254ac6f87a472d066ebd5e.1743115195.git.fthain@linux-m68k.org
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
md: dm-zoned-target: Initialize return variable r to avoid uninitialized use [+ + +]
Author: Purva Yeshi <purvayeshi550@gmail.com>
Date:   Thu Jul 10 13:11:57 2025 +0530

    md: dm-zoned-target: Initialize return variable r to avoid uninitialized use
    
    [ Upstream commit 487767bff572d46f7c37ad846c4078f6d6c9cc55 ]
    
    Fix Smatch-detected error:
    drivers/md/dm-zoned-target.c:1073 dmz_iterate_devices()
    error: uninitialized symbol 'r'.
    
    Smatch detects a possible use of the uninitialized variable 'r' in
    dmz_iterate_devices() because if dmz->nr_ddevs is zero, the loop is
    skipped and 'r' is returned without being set, leading to undefined
    behavior.
    
    Initialize 'r' to 0 before the loop. This ensures that if there are no
    devices to iterate over, the function still returns a defined value.
    
    Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
media: dvb-frontends: dib7090p: fix null-ptr-deref in dib7090p_rw_on_apb() [+ + +]
Author: Alex Guo <alexguo1023@gmail.com>
Date:   Sun Jun 15 21:32:31 2025 -0400

    media: dvb-frontends: dib7090p: fix null-ptr-deref in dib7090p_rw_on_apb()
    
    [ Upstream commit ce5cac69b2edac3e3246fee03e8f4c2a1075238b ]
    
    In dib7090p_rw_on_apb, msg is controlled by user. When msg[0].buf is null and
    msg[0].len is zero, former checks on msg[0].buf would be passed. If accessing
    msg[0].buf[2] without sanity check, null pointer deref would happen. We add
    check on msg[0].len to prevent crash. Similar issue occurs when access
    msg[1].buf[0] and msg[1].buf[1].
    
    Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Alex Guo <alexguo1023@gmail.com>
    Link: https://lore.kernel.org/r/20250616013231.730221-1-alexguo1023@gmail.com
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-frontends: w7090p: fix null-ptr-deref in w7090p_tuner_write_serpar and w7090p_tuner_read_serpar [+ + +]
Author: Alex Guo <alexguo1023@gmail.com>
Date:   Sun Jun 15 21:33:53 2025 -0400

    media: dvb-frontends: w7090p: fix null-ptr-deref in w7090p_tuner_write_serpar and w7090p_tuner_read_serpar
    
    [ Upstream commit ed0234c8458b3149f15e496b48a1c9874dd24a1b ]
    
    In w7090p_tuner_write_serpar, msg is controlled by user. When msg[0].buf is null and msg[0].len is zero, former checks on msg[0].buf would be passed. If accessing msg[0].buf[2] without sanity check, null pointer deref would happen. We add
    check on msg[0].len to prevent crash.
    
    Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Signed-off-by: Alex Guo <alexguo1023@gmail.com>
    Link: https://lore.kernel.org/r/20250616013353.738790-1-alexguo1023@gmail.com
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: gspca: Add bounds checking to firmware parser [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed May 28 23:22:14 2025 +0300

    media: gspca: Add bounds checking to firmware parser
    
    commit aef89c0b2417da79cb2062a95476288f9f203ab0 upstream.
    
    This sd_init() function reads the firmware.  The firmware data holds a
    series of records and the function reads each record and sends the data
    to the device.  The request_ihex_firmware() function
    calls ihex_validate_fw() which ensures that the total length of all the
    records won't read out of bounds of the fw->data[].
    
    However, a potential issue is if there is a single very large
    record (larger than PAGE_SIZE) and that would result in memory
    corruption.  Generally we trust the firmware, but it's always better to
    double check.
    
    Fixes: 49b61ec9b5af ("[media] gspca: Add new vicam subdriver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: hi556: correct the test pattern configuration [+ + +]
Author: Bingbu Cao <bingbu.cao@intel.com>
Date:   Mon Jun 30 17:04:20 2025 +0800

    media: hi556: correct the test pattern configuration
    
    commit 020f602b068c9ce18d5056d02c8302199377d98d upstream.
    
    Hynix hi556 support 8 test pattern modes:
    hi556_test_pattern_menu[] = {
    {
            "Disabled",
            "Solid Colour",
            "100% Colour Bars",
            "Fade To Grey Colour Bars",
            "PN9",
            "Gradient Horizontal",
            "Gradient Vertical",
            "Check Board",
            "Slant Pattern",
    }
    
    The test pattern is set by a 8-bit register according to the
    specification.
    +--------+-------------------------------+
    | BIT[0] |  Solid color                  |
    +--------+-------------------------------+
    | BIT[1] |  Color bar                    |
    +--------+-------------------------------+
    | BIT[2] |  Fade to grey color bar       |
    +--------+-------------------------------+
    | BIT[3] |  PN9                          |
    +--------+-------------------------------+
    | BIT[4] |  Gradient horizontal          |
    +--------+-------------------------------+
    | BIT[5] |  Gradient vertical            |
    +--------+-------------------------------+
    | BIT[6] |  Check board                  |
    +--------+-------------------------------+
    | BIT[7] |  Slant pattern                |
    +--------+-------------------------------+
    Based on function above, current test pattern programming is wrong.
    This patch fixes it by 'BIT(pattern - 1)'. If pattern is 0, driver
    will disable the test pattern generation and set the pattern to 0.
    
    Fixes: e62138403a84 ("media: hi556: Add support for Hi-556 sensor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: imx: fix a potential memory leak in imx_media_csc_scaler_device_init() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Thu Feb 27 15:44:51 2025 +0800

    media: imx: fix a potential memory leak in imx_media_csc_scaler_device_init()
    
    commit fc5f8aec77704373ee804b5dba0e0e5029c0f180 upstream.
    
    Add video_device_release() in label 'err_m2m' to release the memory
    allocated by video_device_alloc() and prevent potential memory leaks.
    Remove the reduntant code in label 'err_m2m'.
    
    Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: ov2659: Fix memory leaks in ov2659_probe() [+ + +]
Author: Zhang Shurong <zhang_shurong@foxmail.com>
Date:   Sun Jul 6 00:31:09 2025 +0800

    media: ov2659: Fix memory leaks in ov2659_probe()
    
    commit 76142b137b968d47b35cdd8d1dc924677d319c8b upstream.
    
    ov2659_probe() doesn't properly free control handler resources in failure
    paths, causing memory leaks. Add v4l2_ctrl_handler_free() to prevent these
    memory leaks and reorder the ctrl_handler assignment for better code flow.
    
    Fixes: c4c0283ab3cd ("[media] media: i2c: add support for omnivision's ov2659 sensor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: qcom: camss: cleanup media device allocated resource on error path [+ + +]
Author: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Date:   Sat Aug 23 00:23:52 2025 -0400

    media: qcom: camss: cleanup media device allocated resource on error path
    
    [ Upstream commit 69080ec3d0daba8a894025476c98ab16b5a505a4 ]
    
    A call to media_device_init() requires media_device_cleanup() counterpart
    to complete cleanup and release any allocated resources.
    
    This has been done in the driver .remove() right from the beginning, but
    error paths on .probe() shall also be fixed.
    
    Fixes: a1d7c116fcf7 ("media: camms: Add core files")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    [ err_genpd_cleanup => err_cleanup ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: rainshadow-cec: fix TOCTOU race condition in rain_interrupt() [+ + +]
Author: Gui-Dong Han <hanguidong02@gmail.com>
Date:   Fri Jun 6 03:04:59 2025 +0000

    media: rainshadow-cec: fix TOCTOU race condition in rain_interrupt()
    
    commit 7af160aea26c7dc9e6734d19306128cce156ec40 upstream.
    
    In the interrupt handler rain_interrupt(), the buffer full check on
    rain->buf_len is performed before acquiring rain->buf_lock. This
    creates a Time-of-Check to Time-of-Use (TOCTOU) race condition, as
    rain->buf_len is concurrently accessed and modified in the work
    handler rain_irq_work_handler() under the same lock.
    
    Multiple interrupt invocations can race, with each reading buf_len
    before it becomes full and then proceeding. This can lead to both
    interrupts attempting to write to the buffer, incrementing buf_len
    beyond its capacity (DATA_SIZE) and causing a buffer overflow.
    
    Fix this bug by moving the spin_lock() to before the buffer full
    check. This ensures that the check and the subsequent buffer modification
    are performed atomically, preventing the race condition. An corresponding
    spin_unlock() is added to the overflow path to correctly release the
    lock.
    
    This possible bug was found by an experimental static analysis tool
    developed by our team.
    
    Fixes: 0f314f6c2e77 ("[media] rainshadow-cec: new RainShadow Tech HDMI CEC driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: tc358743: Check I2C succeeded during probe [+ + +]
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date:   Wed Jun 11 19:37:15 2025 +0100

    media: tc358743: Check I2C succeeded during probe
    
    [ Upstream commit 303d81635e1d9c949b370215cc94526ed81f2e3d ]
    
    The probe for the TC358743 reads the CHIPID register from
    the device and compares it to the expected value of 0.
    If the I2C request fails then that also returns 0, so
    the driver loads thinking that the device is there.
    
    Generally I2C communications are reliable so there is
    limited need to check the return value on every transfer,
    therefore only amend the one read during probe to check
    for I2C errors.
    
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: tc358743: Increase FIFO trigger level to 374 [+ + +]
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date:   Wed Jun 11 19:37:14 2025 +0100

    media: tc358743: Increase FIFO trigger level to 374
    
    [ Upstream commit 86addd25314a1e77dbdcfddfeed0bab2f27da0e2 ]
    
    The existing fixed value of 16 worked for UYVY 720P60 over
    2 lanes at 594MHz, or UYVY 1080P60 over 4 lanes. (RGB888
    1080P60 needs 6 lanes at 594MHz).
    It doesn't allow for lower resolutions to work as the FIFO
    underflows.
    
    374 is required for 1080P24 or 1080P30 UYVY over 2 lanes @
    972Mbit/s, but >374 means that the FIFO underflows on 1080P50
    UYVY over 2 lanes @ 972Mbit/s.
    
    Whilst it would be nice to compute it, the required information
    isn't published by Toshiba.
    
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: tc358743: Return an appropriate colorspace from tc358743_set_fmt [+ + +]
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date:   Wed Jun 11 19:37:16 2025 +0100

    media: tc358743: Return an appropriate colorspace from tc358743_set_fmt
    
    [ Upstream commit 377cc006a364dfdab2f3f221cfad63a9265200b8 ]
    
    When calling tc358743_set_fmt, the code was calling tc358743_get_fmt
    to choose a valid format. However that sets the colorspace
    based on information read back from the chip, not the colour
    format requested.
    
    The result was that if you called try or set format for UYVY
    when the current format was RGB3 then you would get told SRGB,
    and try RGB3 when current was UYVY and you would get told
    SMPTE170M.
    
    The value programmed in the VI_REP register for the colorspace
    is always set by this driver, therefore there is no need to read
    back the value, and never set to REC709.
    Return the colorspace based on the format set/tried instead.
    
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: usb: hdpvr: disable zero-length read messages [+ + +]
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Thu May 22 10:09:54 2025 +0200

    media: usb: hdpvr: disable zero-length read messages
    
    [ Upstream commit b5ae5a79825ba8037b0be3ef677a24de8c063abf ]
    
    This driver passes the length of an i2c_msg directly to
    usb_control_msg(). If the message is now a read and of length 0, it
    violates the USB protocol and a warning will be printed. Enable the
    I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length
    read messages altogether.
    
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: usbtv: Lock resolution while streaming [+ + +]
Author: Ludwig Disterhof <ludwig@disterhof.eu>
Date:   Mon Apr 28 20:16:50 2025 +0200

    media: usbtv: Lock resolution while streaming
    
    commit 7e40e0bb778907b2441bff68d73c3eb6b6cd319f upstream.
    
    When an program is streaming (ffplay) and another program (qv4l2)
    changes the TV standard from NTSC to PAL, the kernel crashes due to trying
    to copy to unmapped memory.
    
    Changing from NTSC to PAL increases the resolution in the usbtv struct,
    but the video plane buffer isn't adjusted, so it overflows.
    
    Fixes: 0e0fe3958fdd13d ("[media] usbtv: Add support for PAL video source")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ludwig Disterhof <ludwig@disterhof.eu>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    [hverkuil: call vb2_is_busy instead of vb2_is_streaming]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Do not mark valid metadata as invalid [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Mon Jul 7 18:34:01 2025 +0000

    media: uvcvideo: Do not mark valid metadata as invalid
    
    commit bda2859bff0b9596a19648f3740c697ce4c71496 upstream.
    
    Currently, the driver performs a length check of the metadata buffer
    before the actual metadata size is known and before the metadata is
    decided to be copied. This results in valid metadata buffers being
    incorrectly marked as invalid.
    
    Move the length check to occur after the metadata size is determined and
    is decided to be copied.
    
    Cc: stable@vger.kernel.org
    Fixes: 088ead255245 ("media: uvcvideo: Add a metadata device node")
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Hans de Goede <hansg@kernel.org>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20250707-uvc-meta-v8-1-ed17f8b1218b@chromium.org
    Signed-off-by: Hans de Goede <hansg@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Fix 1-byte out-of-bounds read in uvc_parse_format() [+ + +]
Author: Youngjun Lee <yjjuny.lee@samsung.com>
Date:   Tue Jun 10 21:41:07 2025 +0900

    media: uvcvideo: Fix 1-byte out-of-bounds read in uvc_parse_format()
    
    commit 782b6a718651eda3478b1824b37a8b3185d2740c upstream.
    
    The buffer length check before calling uvc_parse_format() only ensured
    that the buffer has at least 3 bytes (buflen > 2), buf the function
    accesses buffer[3], requiring at least 4 bytes.
    
    This can lead to an out-of-bounds read if the buffer has exactly 3 bytes.
    
    Fix it by checking that the buffer has at least 4 bytes in
    uvc_parse_format().
    
    Signed-off-by: Youngjun Lee <yjjuny.lee@samsung.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20250610124107.37360-1-yjjuny.lee@samsung.com
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: uvcvideo: Fix bandwidth issue for Alcor camera [+ + +]
Author: chenchangcheng <chenchangcheng@kylinos.cn>
Date:   Sat May 10 14:18:03 2025 +0800

    media: uvcvideo: Fix bandwidth issue for Alcor camera
    
    [ Upstream commit 9764401bf6f8a20eb11c2e78470f20fee91a9ea7 ]
    
    Some broken device return wrong dwMaxPayloadTransferSize fields as
    follows:
    
    [  218.632537] uvcvideo: Device requested 2752512 B/frame bandwidth.
    [  218.632598] uvcvideo: No fast enough alt setting for requested bandwidth.
    
    When dwMaxPayloadTransferSize is greater than maxpsize, it will prevent
    the camera from starting. So use the bandwidth of maxpsize.
    
    Signed-off-by: chenchangcheng <chenchangcheng@kylinos.cn>
    Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20250510061803.811433-1-ccc194101@163.com
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: v4l2-ctrls: always copy the controls on completion [+ + +]
Author: Hans Verkuil <hverkuil@kernel.org>
Date:   Fri Aug 22 21:46:18 2025 -0400

    media: v4l2-ctrls: always copy the controls on completion
    
    [ Upstream commit c3bf5129f33923c92bf3bddaf4359b7b25ecb4ba ]
    
    When v4l2_ctrl_request_complete() is called and there is no control
    handler object found in the request, then create such an object so
    that all controls at completion state can be stored and are available
    to userspace.
    
    Otherwise any attempt by userspace to read the completed request data
    will fail.
    
    If allocating the control handler object failed, then indicate that
    by returning ENOMEM when attempting to get the controls from the
    completed request instead of returning ENOENT.
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Stable-dep-of: 5a0400aca5fa ("media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free() [+ + +]
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Fri Aug 22 21:46:19 2025 -0400

    media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free()
    
    [ Upstream commit 5a0400aca5fa7c6b8ba456c311a460e733571c88 ]
    
    It's a common pattern in drivers to free the control handler's resources
    and then return the handler's error code on drivers' error handling paths.
    Alas, the v4l2_ctrl_handler_free() function also zeroes the error field,
    effectively indicating successful return to the caller.
    
    There's no apparent need to touch the error field while releasing the
    control handler's resources and cleaning up stale pointers. Not touching
    the handler's error field is a more certain way to address this problem
    than changing all the users, in which case the pattern would be likely to
    re-emerge in new drivers.
    
    Do just that, don't touch the control handler's error field in
    v4l2_ctrl_handler_free().
    
    Fixes: 0996517cf8ea ("V4L/DVB: v4l2: Add new control handling framework")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    [ v4l2-ctrls.c => v4l2-ctrls-core.c ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: Add a check for packet size after reading from shared memory [+ + +]
Author: Vedang Nagar <quic_vnagar@quicinc.com>
Date:   Mon May 19 12:42:21 2025 +0530

    media: venus: Add a check for packet size after reading from shared memory
    
    commit 49befc830daa743e051a65468c05c2ff9e8580e6 upstream.
    
    Add a check to ensure that the packet size does not exceed the number of
    available words after reading the packet header from shared memory. This
    ensures that the size provided by the firmware is safe to process and
    prevent potential out-of-bounds memory access.
    
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
    Co-developed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
    Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: Add support for SSR trigger using fault injection [+ + +]
Author: Dikshita Agarwal <quic_dikshita@quicinc.com>
Date:   Fri Aug 22 23:54:47 2025 -0400

    media: venus: Add support for SSR trigger using fault injection
    
    [ Upstream commit 748b080f21678f2988b0da2d2b396a6f928d9b2c ]
    
    Here we introduce a new fault injection for SSR trigger.
    
    To trigger the SSR:
     echo 100 >  /sys/kernel/debug/venus/fail_ssr/probability
     echo 1 >  /sys/kernel/debug/venus/fail_ssr/times
    
    Co-developed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
    Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
    Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Stable-dep-of: 3200144a2fa4 ("media: venus: protect against spurious interrupts during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: don't de-reference NULL pointers at IRQ time [+ + +]
Author: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date:   Fri Aug 22 22:50:19 2025 -0400

    media: venus: don't de-reference NULL pointers at IRQ time
    
    [ Upstream commit 686ee9b6253f9b6d7f1151e73114698940cc0894 ]
    
    Smatch is warning that:
            drivers/media/platform/qcom/venus/hfi_venus.c:1100 venus_isr() warn: variable dereferenced before check 'hdev' (see line 1097)
    
    The logic basically does:
            hdev = to_hfi_priv(core);
    
    with is translated to:
            hdev = core->priv;
    
    If the IRQ code can receive a NULL pointer for hdev, there's
    a bug there, as it will first try to de-reference the pointer,
    and then check if it is null.
    
    After looking at the code, it seems that this indeed can happen:
    Basically, the venus IRQ thread is started with:
            devm_request_threaded_irq()
    So, it will only be freed after the driver unbinds.
    
    In order to prevent the IRQ code to work with freed data,
    the logic at venus_hfi_destroy() sets core->priv to NULL,
    which would make the IRQ code to ignore any pending IRQs.
    
    There is, however a race condition, as core->priv is set
    to NULL only after being freed. So, we need also to move the
    core->priv = NULL to happen earlier.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Stable-dep-of: 640803003cd9 ("media: venus: hfi: explicitly release IRQ during teardown")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: hfi: explicitly release IRQ during teardown [+ + +]
Author: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Date:   Fri Aug 22 22:50:20 2025 -0400

    media: venus: hfi: explicitly release IRQ during teardown
    
    [ Upstream commit 640803003cd903cea73dc6a86bf6963e238e2b3f ]
    
    Ensure the IRQ is disabled - and all pending handlers completed - before
    dismantling the interrupt routing and clearing related pointers.
    
    This prevents any possibility of the interrupt triggering after the
    handler context has been invalidated.
    
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
    Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
    Tested-by: Dikshita Agarwal <quic_dikshita@quicinc.com> # RB5
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: protect against spurious interrupts during probe [+ + +]
Author: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Date:   Fri Aug 22 23:54:48 2025 -0400

    media: venus: protect against spurious interrupts during probe
    
    [ Upstream commit 3200144a2fa4209dc084a19941b9b203b43580f0 ]
    
    Make sure the interrupt handler is initialized before the interrupt is
    registered.
    
    If the IRQ is registered before hfi_create(), it's possible that an
    interrupt fires before the handler setup is complete, leading to a NULL
    dereference.
    
    This error condition has been observed during system boot on Rb3Gen2.
    
    Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
    Tested-by: Dikshita Agarwal <quic_dikshita@quicinc.com> # RB5
    Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: venus: vdec: Clamp param smaller than 1fps and bigger than 240. [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Sat Aug 23 00:08:59 2025 -0400

    media: venus: vdec: Clamp param smaller than 1fps and bigger than 240.
    
    [ Upstream commit 377dc500d253f0b26732b2cb062e89668aef890a ]
    
    The driver uses "whole" fps in all its calculations (e.g. in
    load_per_instance()). Those calculation expect an fps bigger than 1, and
    not big enough to overflow.
    
    Clamp the value if the user provides a param that will result in an invalid
    fps.
    
    Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
    Closes: https://lore.kernel.org/linux-media/f11653a7-bc49-48cd-9cdb-1659147453e4@xs4all.nl/T/#m91cd962ac942834654f94c92206e2f85ff7d97f0
    Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")
    Cc: stable@vger.kernel.org
    Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # qrb5615-rb5
    Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    [bod: Change "parm" to "param"]
    Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
memstick: core: Zero initialize id_reg in h_memstick_read_dev_id() [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jul 15 15:56:05 2025 -0700

    memstick: core: Zero initialize id_reg in h_memstick_read_dev_id()
    
    commit 21b34a3a204ed616373a12ec17dc127ebe51eab3 upstream.
    
    A new warning in clang [1] points out that id_reg is uninitialized then
    passed to memstick_init_req() as a const pointer:
    
      drivers/memstick/core/memstick.c:330:59: error: variable 'id_reg' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
        330 |                 memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, &id_reg,
            |                                                                         ^~~~~~
    
    Commit de182cc8e882 ("drivers/memstick/core/memstick.c: avoid -Wnonnull
    warning") intentionally passed this variable uninitialized to avoid an
    -Wnonnull warning from a NULL value that was previously there because
    id_reg is never read from the call to memstick_init_req() in
    h_memstick_read_dev_id(). Just zero initialize id_reg to avoid the
    warning, which is likely happening in the majority of builds using
    modern compilers that support '-ftrivial-auto-var-init=zero'.
    
    Cc: stable@vger.kernel.org
    Fixes: de182cc8e882 ("drivers/memstick/core/memstick.c: avoid -Wnonnull warning")
    Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2105
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20250715-memstick-fix-uninit-const-pointer-v1-1-f6753829c27a@kernel.org
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

memstick: Fix deadlock by moving removing flag earlier [+ + +]
Author: Jiayi Li <lijiayi@kylinos.cn>
Date:   Mon Aug 4 09:36:04 2025 +0800

    memstick: Fix deadlock by moving removing flag earlier
    
    commit 99d7ab8db9d8230b243f5ed20ba0229e54cc0dfa upstream.
    
    The existing memstick core patch: commit 62c59a8786e6 ("memstick: Skip
    allocating card when removing host") sets host->removing in
    memstick_remove_host(),but still exists a critical time window where
    memstick_check can run after host->eject is set but before removing is set.
    
    In the rtsx_usb_ms driver, the problematic sequence is:
    
    rtsx_usb_ms_drv_remove:          memstick_check:
      host->eject = true
      cancel_work_sync(handle_req)     if(!host->removing)
      ...                              memstick_alloc_card()
                                         memstick_set_rw_addr()
                                           memstick_new_req()
                                             rtsx_usb_ms_request()
                                               if(!host->eject)
                                               skip schedule_work
                                           wait_for_completion()
      memstick_remove_host:                [blocks indefinitely]
        host->removing = true
        flush_workqueue()
        [block]
    
    1. rtsx_usb_ms_drv_remove sets host->eject = true
    2. cancel_work_sync(&host->handle_req) runs
    3. memstick_check work may be executed here <-- danger window
    4. memstick_remove_host sets removing = 1
    
    During this window (step 3), memstick_check calls memstick_alloc_card,
    which may indefinitely waiting for mrq_complete completion that will
    never occur because rtsx_usb_ms_request sees eject=true and skips
    scheduling work, memstick_set_rw_addr waits forever for completion.
    
    This causes a deadlock when memstick_remove_host tries to flush_workqueue,
    waiting for memstick_check to complete, while memstick_check is blocked
    waiting for mrq_complete completion.
    
    Fix this by setting removing=true at the start of rtsx_usb_ms_drv_remove,
    before any work cancellation. This ensures memstick_check will see the
    removing flag immediately and exit early, avoiding the deadlock.
    
    Fixes: 62c59a8786e6 ("memstick: Skip allocating card when removing host")
    Signed-off-by: Jiayi Li <lijiayi@kylinos.cn>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250804013604.1311218-1-lijiayi@kylinos.cn
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
minmax: add umin(a, b) and umax(a, b) [+ + +]
Author: David Laight <David.Laight@ACULAB.COM>
Date:   Fri Aug 22 00:16:39 2025 -0400

    minmax: add umin(a, b) and umax(a, b)
    
    [ Upstream commit 80fcac55385ccb710d33a20dc1caaef29bd5a921 ]
    
    Patch series "minmax: Relax type checks in min() and max()", v4.
    
    The min() (etc) functions in minmax.h require that the arguments have
    exactly the same types.
    
    However when the type check fails, rather than look at the types and fix
    the type of a variable/constant, everyone seems to jump on min_t().  In
    reality min_t() ought to be rare - when something unusual is being done,
    not normality.
    
    The orginal min() (added in 2.4.9) replaced several inline functions and
    included the type - so matched the implicit casting of the function call.
    This was renamed min_t() in 2.4.10 and the current min() added.  There is
    no actual indication that the conversion of negatve values to large
    unsigned values has ever been an actual problem.
    
    A quick grep shows 5734 min() and 4597 min_t().  Having the casts on
    almost half of the calls shows that something is clearly wrong.
    
    If the wrong type is picked (and it is far too easy to pick the type of
    the result instead of the larger input) then significant bits can get
    discarded.
    
    Pretty much the worst example is in the derived clamp_val(), consider:
            unsigned char x = 200u;
            y = clamp_val(x, 10u, 300u);
    
    I also suspect that many of the min_t(u16, ...) are actually wrong.  For
    example copy_data() in printk_ringbuffer.c contains:
    
            data_size = min_t(u16, buf_size, len);
    
    Here buf_size is 'unsigned int' and len 'u16', pass a 64k buffer (can you
    prove that doesn't happen?) and no data is returned.  Apparantly it did -
    and has since been fixed.
    
    The only reason that most of the min_t() are 'fine' is that pretty much
    all the values in the kernel are between 0 and INT_MAX.
    
    Patch 1 adds umin(), this uses integer promotions to convert both
    arguments to 'unsigned long long'.  It can be used to compare a signed
    type that is known to contain a non-negative value with an unsigned type.
    The compiler typically optimises it all away.  Added first so that it can
    be referred to in patch 2.
    
    Patch 2 replaces the 'same type' check with a 'same signedness' one.  This
    makes min(unsigned_int_var, sizeof()) be ok.  The error message is also
    improved and will contain the expanded form of both arguments (useful for
    seeing how constants are defined).
    
    Patch 3 just fixes some whitespace.
    
    Patch 4 allows comparisons of 'unsigned char' and 'unsigned short' to
    signed types.  The integer promotion rules convert them both to 'signed
    int' prior to the comparison so they can never cause a negative value be
    converted to a large positive one.
    
    Patch 5 (rewritted for v4) allows comparisons of unsigned values against
    non-negative constant integer expressions.  This makes
    min(unsigned_int_var, 4) be ok.
    
    The only common case that is still errored is the comparison of signed
    values against unsigned constant integer expressions below __INT_MAX__.
    Typcally min(int_val, sizeof (foo)), the real fix for this is casting the
    constant: min(int_var, (int)sizeof (foo)).
    
    With all the patches applied pretty much all the min_t() could be replaced
    by min(), and most of the rest by umin().  However they all need careful
    inspection due to code like:
    
            sz = min_t(unsigned char, sz - 1, LIM - 1) + 1;
    
    which converts 0 to LIM.
    
    This patch (of 6):
    
    umin() and umax() can be used when min()/max() errors a signed v unsigned
    compare when the signed value is known to be non-negative.
    
    Unlike min_t(some_unsigned_type, a, b) umin() will never mask off high
    bits if an inappropriate type is selected.
    
    The '+ 0u + 0ul + 0ull' may look strange.
    The '+ 0u' is needed for 'signed int' on 64bit systems.
    The '+ 0ul' is needed for 'signed long' on 32bit systems.
    The '+ 0ull' is needed for 'signed long long'.
    
    Link: https://lkml.kernel.org/r/b97faef60ad24922b530241c5d7c933c@AcuMS.aculab.com
    Link: https://lkml.kernel.org/r/41d93ca827a248698ec64bf57e0c05a5@AcuMS.aculab.com
    Signed-off-by: David Laight <david.laight@aculab.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Jason A. Donenfeld <Jason@zx2c4.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 02c7f7219ac0 ("ext4: fix hole length calculation overflow in non-extent inodes")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
MIPS: Don't crash in stack_top() for tasks without ABI or vDSO [+ + +]
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Date:   Wed Jun 11 13:28:26 2025 +0200

    MIPS: Don't crash in stack_top() for tasks without ABI or vDSO
    
    [ Upstream commit e9f4a6b3421e936c3ee9d74710243897d74dbaa2 ]
    
    Not all tasks have an ABI associated or vDSO mapped,
    for example kthreads never do.
    If such a task ever ends up calling stack_top(), it will derefence the
    NULL ABI pointer and crash.
    
    This can for example happen when using kunit:
    
        mips_stack_top+0x28/0xc0
        arch_pick_mmap_layout+0x190/0x220
        kunit_vm_mmap_init+0xf8/0x138
        __kunit_add_resource+0x40/0xa8
        kunit_vm_mmap+0x88/0xd8
        usercopy_test_init+0xb8/0x240
        kunit_try_run_case+0x5c/0x1a8
        kunit_generic_run_threadfn_adapter+0x28/0x50
        kthread+0x118/0x240
        ret_from_kernel_thread+0x14/0x1c
    
    Only dereference the ABI point if it is set.
    
    The GIC page is also included as it is specific to the vDSO.
    Also move the randomization adjustment into the same conditional.
    
    Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
    Reviewed-by: David Gow <davidgow@google.com>
    Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

MIPS: mm: tlb-r4k: Uniquify TLB entries on init [+ + +]
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date:   Sat Jun 7 13:43:56 2025 +0100

    MIPS: mm: tlb-r4k: Uniquify TLB entries on init
    
    commit 35ad7e181541aa5757f9f316768d3e64403ec843 upstream.
    
    Hardware or bootloader will initialize TLB entries to any value, which
    may collide with kernel's UNIQUE_ENTRYHI value. On MIPS microAptiv/M5150
    family of cores this will trigger machine check exception and cause boot
    failure. On M5150 simulation this could happen 7 times out of 1000 boots.
    
    Replace local_flush_tlb_all() with r4k_tlb_uniquify() which probes each
    TLB ENTRIHI unique value for collisions before it's written, and in case
    of collision try a different ASID.
    
    Cc: stable@kernel.org
    Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

MIPS: vpe-mt: add missing prototypes for vpe_{alloc,start,stop,free} [+ + +]
Author: Shiji Yang <yangshiji66@outlook.com>
Date:   Thu Jul 3 21:06:32 2025 +0800

    MIPS: vpe-mt: add missing prototypes for vpe_{alloc,start,stop,free}
    
    [ Upstream commit 844615dd0f2d95c018ec66b943e08af22b62aff3 ]
    
    These functions are exported but their prototypes are not defined.
    This patch adds the missing function prototypes to fix the following
    compilation warnings:
    
    arch/mips/kernel/vpe-mt.c:180:7: error: no previous prototype for 'vpe_alloc' [-Werror=missing-prototypes]
      180 | void *vpe_alloc(void)
          |       ^~~~~~~~~
    arch/mips/kernel/vpe-mt.c:198:5: error: no previous prototype for 'vpe_start' [-Werror=missing-prototypes]
      198 | int vpe_start(void *vpe, unsigned long start)
          |     ^~~~~~~~~
    arch/mips/kernel/vpe-mt.c:208:5: error: no previous prototype for 'vpe_stop' [-Werror=missing-prototypes]
      208 | int vpe_stop(void *vpe)
          |     ^~~~~~~~
    arch/mips/kernel/vpe-mt.c:229:5: error: no previous prototype for 'vpe_free' [-Werror=missing-prototypes]
      229 | int vpe_free(void *vpe)
          |     ^~~~~~~~
    
    Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
misc: rtsx: usb: Ensure mmc child device is active when card is present [+ + +]
Author: Ricky Wu <ricky_wu@realtek.com>
Date:   Fri Jul 11 22:01:43 2025 +0800

    misc: rtsx: usb: Ensure mmc child device is active when card is present
    
    commit 966c5cd72be8989c8a559ddef8e8ff07a37c5eb0 upstream.
    
    When a card is present in the reader, the driver currently defers
    autosuspend by returning -EAGAIN during the suspend callback to
    trigger USB remote wakeup signaling. However, this does not guarantee
    that the mmc child device has been resumed, which may cause issues if
    it remains suspended while the card is accessible.
    This patch ensures that all child devices, including the mmc host
    controller, are explicitly resumed before returning -EAGAIN. This
    fixes a corner case introduced by earlier remote wakeup handling,
    improving reliability of runtime PM when a card is inserted.
    
    Fixes: 883a87ddf2f1 ("misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20250711140143.2105224-1-ricky_wu@realtek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mlxsw: spectrum: Forward packets with an IPv4 link-local source IP [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Thu Aug 14 15:06:40 2025 +0200

    mlxsw: spectrum: Forward packets with an IPv4 link-local source IP
    
    [ Upstream commit f604d3aaf64ff0d90cc875295474d3abf4155629 ]
    
    By default, the device does not forward IPv4 packets with a link-local
    source IP (i.e., 169.254.0.0/16). This behavior does not align with the
    kernel which does forward them.
    
    Fix by instructing the device to forward such packets instead of
    dropping them.
    
    Fixes: ca360db4b825 ("mlxsw: spectrum: Disable DIP_LINK_LOCAL check in hardware pipeline")
    Reported-by: Zoey Mertes <zoey@cloudflare.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Signed-off-by: Petr Machata <petrm@nvidia.com>
    Link: https://patch.msgid.link/6721e6b2c96feb80269e72ce8d0b426e2f32d99c.1755174341.git.petrm@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Thu Jul 10 11:23:53 2025 +0300

    mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
    
    commit 188cb385bbf04d486df3e52f28c47b3961f5f0c0 upstream.
    
    When pmd_to_hmm_pfn_flags() is unused, it prevents kernel builds with
    clang, `make W=1` and CONFIG_TRANSPARENT_HUGEPAGE=n:
    
      mm/hmm.c:186:29: warning: unused function 'pmd_to_hmm_pfn_flags' [-Wunused-function]
    
    Fix this by moving the function to the respective existing ifdeffery
    for its the only user.
    
    See also:
    
      6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")
    
    Link: https://lkml.kernel.org/r/20250710082403.664093-1-andriy.shevchenko@linux.intel.com
    Fixes: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Cc: Andriy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Bill Wendling <morbo@google.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Justin Stitt <justinstitt@google.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Thu Jul 31 02:57:18 2025 -0700

    mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock
    
    commit 47b0f6d8f0d2be4d311a49e13d2fd5f152f492b2 upstream.
    
    When netpoll is enabled, calling pr_warn_once() while holding
    kmemleak_lock in mem_pool_alloc() can cause a deadlock due to lock
    inversion with the netconsole subsystem.  This occurs because
    pr_warn_once() may trigger netpoll, which eventually leads to
    __alloc_skb() and back into kmemleak code, attempting to reacquire
    kmemleak_lock.
    
    This is the path for the deadlock.
    
    mem_pool_alloc()
      -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
          -> pr_warn_once()
              -> netconsole subsystem
                 -> netpoll
                     -> __alloc_skb
                       -> __create_object
                         -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
    
    Fix this by setting a flag and issuing the pr_warn_once() after
    kmemleak_lock is released.
    
    Link: https://lkml.kernel.org/r/20250731-kmemleak_lock-v1-1-728fd470198f@debian.org
    Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Reported-by: Jakub Kicinski <kuba@kernel.org>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm/kmemleak: avoid soft lockup in __kmemleak_do_cleanup() [+ + +]
Author: Waiman Long <longman@redhat.com>
Date:   Mon Jul 28 15:02:48 2025 -0400

    mm/kmemleak: avoid soft lockup in __kmemleak_do_cleanup()
    
    commit d1534ae23c2b6be350c8ab060803fbf6e9682adc upstream.
    
    A soft lockup warning was observed on a relative small system x86-64
    system with 16 GB of memory when running a debug kernel with kmemleak
    enabled.
    
      watchdog: BUG: soft lockup - CPU#8 stuck for 33s! [kworker/8:1:134]
    
    The test system was running a workload with hot unplug happening in
    parallel.  Then kemleak decided to disable itself due to its inability to
    allocate more kmemleak objects.  The debug kernel has its
    CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE set to 40,000.
    
    The soft lockup happened in kmemleak_do_cleanup() when the existing
    kmemleak objects were being removed and deleted one-by-one in a loop via a
    workqueue.  In this particular case, there are at least 40,000 objects
    that need to be processed and given the slowness of a debug kernel and the
    fact that a raw_spinlock has to be acquired and released in
    __delete_object(), it could take a while to properly handle all these
    objects.
    
    As kmemleak has been disabled in this case, the object removal and
    deletion process can be further optimized as locking isn't really needed.
    However, it is probably not worth the effort to optimize for such an edge
    case that should rarely happen.  So the simple solution is to call
    cond_resched() at periodic interval in the iteration loop to avoid soft
    lockup.
    
    Link: https://lkml.kernel.org/r/20250728190248.605750-1-longman@redhat.com
    Signed-off-by: Waiman Long <longman@redhat.com>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/page_alloc: detect allocation forbidden by cpuset and bail out early [+ + +]
Author: Feng Tang <feng.79.tang@gmail.com>
Date:   Fri Nov 5 13:40:34 2021 -0700

    mm/page_alloc: detect allocation forbidden by cpuset and bail out early
    
    [ Upstream commit 8ca1b5a49885f0c0c486544da46a9e0ac790831d ]
    
    There was a report that starting an Ubuntu in docker while using cpuset
    to bind it to movable nodes (a node only has movable zone, like a node
    for hotplug or a Persistent Memory node in normal usage) will fail due
    to memory allocation failure, and then OOM is involved and many other
    innocent processes got killed.
    
    It can be reproduced with command:
    
        $ docker run -it --rm --cpuset-mems 4 ubuntu:latest bash -c "grep Mems_allowed /proc/self/status"
    
    (where node 4 is a movable node)
    
      runc:[2:INIT] invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0
      CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: G        W I E     5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased)
      Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS 2.6.4 04/09/2020
      Call Trace:
       dump_stack+0x6b/0x88
       dump_header+0x4a/0x1e2
       oom_kill_process.cold+0xb/0x10
       out_of_memory.part.0+0xaf/0x230
       out_of_memory+0x3d/0x80
       __alloc_pages_slowpath.constprop.0+0x954/0xa20
       __alloc_pages_nodemask+0x2d3/0x300
       pipe_write+0x322/0x590
       new_sync_write+0x196/0x1b0
       vfs_write+0x1c3/0x1f0
       ksys_write+0xa7/0xe0
       do_syscall_64+0x52/0xd0
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
      Mem-Info:
      active_anon:392832 inactive_anon:182 isolated_anon:0
       active_file:68130 inactive_file:151527 isolated_file:0
       unevictable:2701 dirty:0 writeback:7
       slab_reclaimable:51418 slab_unreclaimable:116300
       mapped:45825 shmem:735 pagetables:2540 bounce:0
       free:159849484 free_pcp:73 free_cma:0
      Node 4 active_anon:1448kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB all_unreclaimable? no
      Node 4 Movable free:130021408kB min:9140kB low:139160kB high:269180kB reserved_highatomic:0KB active_anon:1448kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:130023424kB managed:130023424kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:292kB local_pcp:84kB free_cma:0kB
      lowmem_reserve[]: 0 0 0 0 0
      Node 4 Movable: 1*4kB (M) 0*8kB 0*16kB 1*32kB (M) 0*64kB 0*128kB 1*256kB (M) 1*512kB (M) 1*1024kB (M) 0*2048kB 31743*4096kB (M) = 130021156kB
    
      oom-kill:constraint=CONSTRAINT_CPUSET,nodemask=(null),cpuset=docker-9976a269caec812c134fa317f27487ee36e1129beba7278a463dd53e5fb9997b.scope,mems_allowed=4,global_oom,task_memcg=/system.slice/containerd.service,task=containerd,pid=4100,uid=0
      Out of memory: Killed process 4100 (containerd) total-vm:4077036kB, anon-rss:51184kB, file-rss:26016kB, shmem-rss:0kB, UID:0 pgtables:676kB oom_score_adj:0
      oom_reaper: reaped process 8248 (docker), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
      oom_reaper: reaped process 2054 (node_exporter), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
      oom_reaper: reaped process 1452 (systemd-journal), now anon-rss:0kB, file-rss:8564kB, shmem-rss:4kB
      oom_reaper: reaped process 2146 (munin-node), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
      oom_reaper: reaped process 8291 (runc:[2:INIT]), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
    
    The reason is that in this case, the target cpuset nodes only have
    movable zone, while the creation of an OS in docker sometimes needs to
    allocate memory in non-movable zones (dma/dma32/normal) like
    GFP_HIGHUSER, and the cpuset limit forbids the allocation, then
    out-of-memory killing is involved even when normal nodes and movable
    nodes both have many free memory.
    
    The OOM killer cannot help to resolve the situation as there is no
    usable memory for the request in the cpuset scope.  The only reasonable
    measure to take is to fail the allocation right away and have the caller
    to deal with it.
    
    So add a check for cases like this in the slowpath of allocation, and
    bail out early returning NULL for the allocation.
    
    As page allocation is one of the hottest path in kernel, this check will
    hurt all users with sane cpuset configuration, add a static branch check
    and detect the abnormal config in cpuset memory binding setup so that
    the extra check cost in page allocation is not paid by everyone.
    
    [thanks to Micho Hocko and David Rientjes for suggesting not handling
     it inside OOM code, adding cpuset check, refining comments]
    
    Link: https://lkml.kernel.org/r/1632481657-68112-1-git-send-email-feng.tang@intel.com
    Signed-off-by: Feng Tang <feng.tang@intel.com>
    Suggested-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Zefan Li <lizefan.x@bytedance.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Stable-dep-of: 65f97cc81b0a ("cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/ptdump: take the memory hotplug lock inside ptdump_walk_pgd() [+ + +]
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date:   Tue Aug 19 11:09:21 2025 -0400

    mm/ptdump: take the memory hotplug lock inside ptdump_walk_pgd()
    
    [ Upstream commit 59305202c67fea50378dcad0cc199dbc13a0e99a ]
    
    Memory hot remove unmaps and tears down various kernel page table regions
    as required.  The ptdump code can race with concurrent modifications of
    the kernel page tables.  When leaf entries are modified concurrently, the
    dump code may log stale or inconsistent information for a VA range, but
    this is otherwise not harmful.
    
    But when intermediate levels of kernel page table are freed, the dump code
    will continue to use memory that has been freed and potentially
    reallocated for another purpose.  In such cases, the ptdump code may
    dereference bogus addresses, leading to a number of potential problems.
    
    To avoid the above mentioned race condition, platforms such as arm64,
    riscv and s390 take memory hotplug lock, while dumping kernel page table
    via the sysfs interface /sys/kernel/debug/kernel_page_tables.
    
    Similar race condition exists while checking for pages that might have
    been marked W+X via /sys/kernel/debug/kernel_page_tables/check_wx_pages
    which in turn calls ptdump_check_wx().  Instead of solving this race
    condition again, let's just move the memory hotplug lock inside generic
    ptdump_check_wx() which will benefit both the scenarios.
    
    Drop get_online_mems() and put_online_mems() combination from all existing
    platform ptdump code paths.
    
    Link: https://lkml.kernel.org/r/20250620052427.2092093-1-anshuman.khandual@arm.com
    Fixes: bbd6ec605c0f ("arm64/mm: Enable memory hot remove")
    Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Dev Jain <dev.jain@arm.com>
    Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>    [s390]
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Paul Walmsley <paul.walmsley@sifive.com>
    Cc: Palmer Dabbelt <palmer@dabbelt.com>
    Cc: Alexander Gordeev <agordeev@linux.ibm.com>
    Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/vmalloc: leave lazy MMU mode on PTE mapping error [+ + +]
Author: Alexander Gordeev <agordeev@linux.ibm.com>
Date:   Mon Jun 23 09:57:21 2025 +0200

    mm/vmalloc: leave lazy MMU mode on PTE mapping error
    
    commit fea18c686320a53fce7ad62a87a3e1d10ad02f31 upstream.
    
    vmap_pages_pte_range() enters the lazy MMU mode, but fails to leave it in
    case an error is encountered.
    
    Link: https://lkml.kernel.org/r/20250623075721.2817094-1-agordeev@linux.ibm.com
    Fixes: 2ba3e6947aed ("mm/vmalloc: track which page-table levels were modified")
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Closes: https://lore.kernel.org/r/202506132017.T1l1l6ME-lkp@intel.com/
    Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/zsmalloc.c: convert to use kmem_cache_zalloc in cache_alloc_zspage() [+ + +]
Author: Miaohe Lin <linmiaohe@huawei.com>
Date:   Tue Jul 29 11:09:28 2025 -0400

    mm/zsmalloc.c: convert to use kmem_cache_zalloc in cache_alloc_zspage()
    
    [ Upstream commit f0231305acd53375c6cf736971bf5711105dd6bb ]
    
    We always memset the zspage allocated via cache_alloc_zspage.  So it's
    more convenient to use kmem_cache_zalloc in cache_alloc_zspage than caller
    do it manually.
    
    Link: https://lkml.kernel.org/r/20210114120032.25885-1-linmiaohe@huawei.com
    Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
    Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Stable-dep-of: 694d6b99923e ("mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n [+ + +]
Author: Harry Yoo <harry.yoo@oracle.com>
Date:   Tue Jul 29 11:09:29 2025 -0400

    mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n
    
    [ Upstream commit 694d6b99923eb05a8fd188be44e26077d19f0e21 ]
    
    Commit 48b4800a1c6a ("zsmalloc: page migration support") added support for
    migrating zsmalloc pages using the movable_operations migration framework.
    However, the commit did not take into account that zsmalloc supports
    migration only when CONFIG_COMPACTION is enabled.  Tracing shows that
    zsmalloc was still passing the __GFP_MOVABLE flag even when compaction is
    not supported.
    
    This can result in unmovable pages being allocated from movable page
    blocks (even without stealing page blocks), ZONE_MOVABLE and CMA area.
    
    Possible user visible effects:
    - Some ZONE_MOVABLE memory can be not actually movable
    - CMA allocation can fail because of this
    - Increased memory fragmentation due to ignoring the page mobility
      grouping feature
    I'm not really sure who uses kernels without compaction support, though :(
    
    To fix this, clear the __GFP_MOVABLE flag when
    !IS_ENABLED(CONFIG_COMPACTION).
    
    Link: https://lkml.kernel.org/r/20250704103053.6913-1-harry.yoo@oracle.com
    Fixes: 48b4800a1c6a ("zsmalloc: page migration support")
    Signed-off-by: Harry Yoo <harry.yoo@oracle.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm: drop the assumption that VM_SHARED always implies writable [+ + +]
Author: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date:   Tue Jul 29 18:53:59 2025 -0700

    mm: drop the assumption that VM_SHARED always implies writable
    
    [ Upstream commit e8e17ee90eaf650c855adb0a3e5e965fd6692ff1 ]
    
    Patch series "permit write-sealed memfd read-only shared mappings", v4.
    
    The man page for fcntl() describing memfd file seals states the following
    about F_SEAL_WRITE:-
    
        Furthermore, trying to create new shared, writable memory-mappings via
        mmap(2) will also fail with EPERM.
    
    With emphasis on 'writable'.  In turns out in fact that currently the
    kernel simply disallows all new shared memory mappings for a memfd with
    F_SEAL_WRITE applied, rendering this documentation inaccurate.
    
    This matters because users are therefore unable to obtain a shared mapping
    to a memfd after write sealing altogether, which limits their usefulness.
    This was reported in the discussion thread [1] originating from a bug
    report [2].
    
    This is a product of both using the struct address_space->i_mmap_writable
    atomic counter to determine whether writing may be permitted, and the
    kernel adjusting this counter when any VM_SHARED mapping is performed and
    more generally implicitly assuming VM_SHARED implies writable.
    
    It seems sensible that we should only update this mapping if VM_MAYWRITE
    is specified, i.e.  whether it is possible that this mapping could at any
    point be written to.
    
    If we do so then all we need to do to permit write seals to function as
    documented is to clear VM_MAYWRITE when mapping read-only.  It turns out
    this functionality already exists for F_SEAL_FUTURE_WRITE - we can
    therefore simply adapt this logic to do the same for F_SEAL_WRITE.
    
    We then hit a chicken and egg situation in mmap_region() where the check
    for VM_MAYWRITE occurs before we are able to clear this flag.  To work
    around this, perform this check after we invoke call_mmap(), with careful
    consideration of error paths.
    
    Thanks to Andy Lutomirski for the suggestion!
    
    [1]:https://lore.kernel.org/all/20230324133646.16101dfa666f253c4715d965@linux-foundation.org/
    [2]:https://bugzilla.kernel.org/show_bug.cgi?id=217238
    
    This patch (of 3):
    
    There is a general assumption that VMAs with the VM_SHARED flag set are
    writable.  If the VM_MAYWRITE flag is not set, then this is simply not the
    case.
    
    Update those checks which affect the struct address_space->i_mmap_writable
    field to explicitly test for this by introducing
    [vma_]is_shared_maywrite() helper functions.
    
    This remains entirely conservative, as the lack of VM_MAYWRITE guarantees
    that the VMA cannot be written to.
    
    Link: https://lkml.kernel.org/r/cover.1697116581.git.lstoakes@gmail.com
    Link: https://lkml.kernel.org/r/d978aefefa83ec42d18dfa964ad180dbcde34795.1697116581.git.lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
    Suggested-by: Andy Lutomirski <luto@kernel.org>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Muchun Song <muchun.song@linux.dev>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: stable@vger.kernel.org
    [isaacmanjarres: resolved merge conflicts due to
    due to refactoring that happened in upstream commit
    5de195060b2e ("mm: resolve faulty mmap_region() error path behaviour")]
    Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: extract might_alloc() debug check [+ + +]
Author: Simona Vetter <simona.vetter@ffwll.ch>
Date:   Mon Dec 14 19:08:34 2020 -0800

    mm: extract might_alloc() debug check
    
    [ Upstream commit 95d6c701f4ca7c44dc148d664f604541266a2333 ]
    
    Extracted from slab.h, which seems to have the most complete version
    including the correct might_sleep() check.  Roll it out to slob.c.
    
    Motivated by a discussion with Paul about possibly changing call_rcu
    behaviour to allocate memory, but only roughly every 500th call.
    
    There are a lot fewer places in the kernel that care about whether
    allocating memory is allowed or not (due to deadlocks with reclaim code)
    than places that care whether sleeping is allowed.  But debugging these
    also tends to be a lot harder, so nice descriptive checks could come in
    handy.  I might have some use eventually for annotations in drivers/gpu.
    
    Note that unlike fs_reclaim_acquire/release gfpflags_allow_blocking does
    not consult the PF_MEMALLOC flags.  But there is no flag equivalent for
    GFP_NOWAIT, hence this check can't go wrong due to
    memalloc_no*_save/restore contexts.  Willy is working on a patch series
    which might change this:
    
    https://lore.kernel.org/linux-mm/20200625113122.7540-7-willy@infradead.org/
    
    I think best would be if that updates gfpflags_allow_blocking(), since
    there's a ton of callers all over the place for that already.
    
    Link: https://lkml.kernel.org/r/20201125162532.1299794-3-daniel.vetter@ffwll.ch
    Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Paul E. McKenney <paulmck@kernel.org>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Paul E. McKenney <paulmck@kernel.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Cc: Michel Lespinasse <walken@google.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: Waiman Long <longman@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: Qian Cai <cai@lca.pw>
    Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jason Gunthorpe <jgg@mellanox.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Thomas Hellström (Intel) <thomas_os@shipmail.org>
    Cc: Will Deacon <will@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Stable-dep-of: 99765233ab42 ("NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm: reinstate ability to map write-sealed memfd mappings read-only [+ + +]
Author: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date:   Tue Jul 29 18:54:01 2025 -0700

    mm: reinstate ability to map write-sealed memfd mappings read-only
    
    [ Upstream commit 8ec396d05d1b737c87311fb7311f753b02c2a6b1 ]
    
    Patch series "mm: reinstate ability to map write-sealed memfd mappings
    read-only".
    
    In commit 158978945f31 ("mm: perform the mapping_map_writable() check
    after call_mmap()") (and preceding changes in the same series) it became
    possible to mmap() F_SEAL_WRITE sealed memfd mappings read-only.
    
    Commit 5de195060b2e ("mm: resolve faulty mmap_region() error path
    behaviour") unintentionally undid this logic by moving the
    mapping_map_writable() check before the shmem_mmap() hook is invoked,
    thereby regressing this change.
    
    This series reworks how we both permit write-sealed mappings being mapped
    read-only and disallow mprotect() from undoing the write-seal, fixing this
    regression.
    
    We also add a regression test to ensure that we do not accidentally
    regress this in future.
    
    Thanks to Julian Orth for reporting this regression.
    
    This patch (of 2):
    
    In commit 158978945f31 ("mm: perform the mapping_map_writable() check
    after call_mmap()") (and preceding changes in the same series) it became
    possible to mmap() F_SEAL_WRITE sealed memfd mappings read-only.
    
    This was previously unnecessarily disallowed, despite the man page
    documentation indicating that it would be, thereby limiting the usefulness
    of F_SEAL_WRITE logic.
    
    We fixed this by adapting logic that existed for the F_SEAL_FUTURE_WRITE
    seal (one which disallows future writes to the memfd) to also be used for
    F_SEAL_WRITE.
    
    For background - the F_SEAL_FUTURE_WRITE seal clears VM_MAYWRITE for a
    read-only mapping to disallow mprotect() from overriding the seal - an
    operation performed by seal_check_write(), invoked from shmem_mmap(), the
    f_op->mmap() hook used by shmem mappings.
    
    By extending this to F_SEAL_WRITE and critically - checking
    mapping_map_writable() to determine if we may map the memfd AFTER we
    invoke shmem_mmap() - the desired logic becomes possible.  This is because
    mapping_map_writable() explicitly checks for VM_MAYWRITE, which we will
    have cleared.
    
    Commit 5de195060b2e ("mm: resolve faulty mmap_region() error path
    behaviour") unintentionally undid this logic by moving the
    mapping_map_writable() check before the shmem_mmap() hook is invoked,
    thereby regressing this change.
    
    We reinstate this functionality by moving the check out of shmem_mmap()
    and instead performing it in do_mmap() at the point at which VMA flags are
    being determined, which seems in any case to be a more appropriate place
    in which to make this determination.
    
    In order to achieve this we rework memfd seal logic to allow us access to
    this information using existing logic and eliminate the clearing of
    VM_MAYWRITE from seal_check_write() which we are performing in do_mmap()
    instead.
    
    Link: https://lkml.kernel.org/r/99fc35d2c62bd2e05571cf60d9f8b843c56069e0.1732804776.git.lorenzo.stoakes@oracle.com
    Fixes: 5de195060b2e ("mm: resolve faulty mmap_region() error path behaviour")
    Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Reported-by: Julian Orth <ju.orth@gmail.com>
    Closes: https://lore.kernel.org/all/CAHijbEUMhvJTN9Xw1GmbM266FXXv=U7s4L_Jem5x3AaPZxrYpQ@mail.gmail.com/
    Cc: Jann Horn <jannh@google.com>
    Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: update memfd seal write check to include F_SEAL_WRITE [+ + +]
Author: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date:   Tue Jul 29 18:54:00 2025 -0700

    mm: update memfd seal write check to include F_SEAL_WRITE
    
    [ Upstream commit 28464bbb2ddc199433383994bcb9600c8034afa1 ]
    
    The seal_check_future_write() function is called by shmem_mmap() or
    hugetlbfs_file_mmap() to disallow any future writable mappings of an memfd
    sealed this way.
    
    The F_SEAL_WRITE flag is not checked here, as that is handled via the
    mapping->i_mmap_writable mechanism and so any attempt at a mapping would
    fail before this could be run.
    
    However we intend to change this, meaning this check can be performed for
    F_SEAL_WRITE mappings also.
    
    The logic here is equally applicable to both flags, so update this
    function to accommodate both and rename it accordingly.
    
    Link: https://lkml.kernel.org/r/913628168ce6cce77df7d13a63970bae06a526e0.1697116581.git.lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Muchun Song <muchun.song@linux.dev>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mmc: bcm2835: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jun 30 11:35:07 2025 +0200

    mmc: bcm2835: Fix dma_unmap_sg() nents value
    
    commit ff09b71bf9daeca4f21d6e5e449641c9fad75b53 upstream.
    
    The dma_unmap_sg() functions should be called with the same nents as the
    dma_map_sg(), not the value the map function returned.
    
    Fixes: 2f5da678351f ("mmc: bcm2835: Properly handle dmaengine_prep_slave_sg")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250630093510.82871-2-fourier.thomas@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mmc: rtsx_usb_sdmmc: Fix error-path in sd_set_power_mode() [+ + +]
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue Jun 10 13:16:23 2025 +0200

    mmc: rtsx_usb_sdmmc: Fix error-path in sd_set_power_mode()
    
    [ Upstream commit 47a255f7d2eabee06cfbf5b1c2379749442fd01d ]
    
    In the error path of sd_set_power_mode() we don't update host->power_mode,
    which could lead to an imbalance of the runtime PM usage count. Fix this by
    always updating host->power_mode.
    
    Reviewed-by: Avri Altman <avri.altman@sandisk.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Acked-by: Ricky Wu <ricky_wu@realtek.com>
    Link: https://lore.kernel.org/r/20250610111633.504366-2-ulf.hansson@linaro.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-msm: Ensure SD card power isn't ON when card removed [+ + +]
Author: Sarthak Garg <quic_sartgarg@quicinc.com>
Date:   Tue Jul 1 15:36:59 2025 +0530

    mmc: sdhci-msm: Ensure SD card power isn't ON when card removed
    
    [ Upstream commit db58532188ebf51d52b1d7693d9e94c76b926e9f ]
    
    Many mobile phones feature multi-card tray designs, where the same
    tray is used for both SD and SIM cards. If the SD card is placed
    at the outermost location in the tray, the SIM card may come in
    contact with SD card power-supply while removing the tray, possibly
    resulting in SIM damage.
    
    To prevent that, make sure the SD card is really inserted by reading
    the Card Detect pin state. If it's not, turn off the power in
    sdhci_msm_check_power_status() and also set the BUS_FAIL power state
    on the controller as part of pwr_irq handling for BUS_ON request.
    
    Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20250701100659.3310386-1-quic_sartgarg@quicinc.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mmc: sdhci-pci-gli: GL9763e: Rename the gli_set_gl9763e() for consistency [+ + +]
Author: Victor Shih <victor.shih@genesyslogic.com.tw>
Date:   Thu Jul 31 14:57:51 2025 +0800

    mmc: sdhci-pci-gli: GL9763e: Rename the gli_set_gl9763e() for consistency
    
    commit 293ed0f5f34e1e9df888456af4b0a021f57b5f54 upstream.
    
    In preparation to fix replay timer timeout, rename the
    gli_set_gl9763e() to gl9763e_hw_setting() for consistency.
    
    Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
    Fixes: 1ae1d2d6e555 ("mmc: sdhci-pci-gli: Add Genesys Logic GL9763E support")
    Cc: stable@vger.kernel.org
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20250731065752.450231-3-victorshihgli@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mmc: sdhci-pci: Quirk for broken command queuing on Intel GLK-based Positivo models [+ + +]
Author: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
Date:   Thu Jun 26 08:24:42 2025 -0300

    mmc: sdhci-pci: Quirk for broken command queuing on Intel GLK-based Positivo models
    
    commit 50c78f398e92fafa1cbba3469c95fe04b2e4206d upstream.
    
    Disable command queuing on Intel GLK-based Positivo models.
    
    Without this quirk, CQE (Command Queuing Engine) causes instability
    or I/O errors during operation. Disabling it ensures stable
    operation on affected devices.
    
    Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
    Fixes: bedf9fc01ff1 ("mmc: sdhci: Workaround broken command queuing on Intel GLK")
    Cc: stable@vger.kernel.org
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Link: https://lore.kernel.org/r/20250626112442.9791-1-edson.drosdeck@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mmc: sdhci_am654: Workaround for Errata i2312 [+ + +]
Author: Judith Mendez <jm@ti.com>
Date:   Thu Jun 26 18:14:52 2025 -0500

    mmc: sdhci_am654: Workaround for Errata i2312
    
    commit 6d0b1c01847fedd7c85a5cdf59b8cfc7d14512e6 upstream.
    
    Errata i2312 [0] for K3 silicon mentions the maximum obtainable
    timeout through MMC host controller is 700ms. And for commands taking
    longer than 700ms, hardware timeout should be disabled and software
    timeout should be used.
    
    The workaround for Errata i2312 can be achieved by adding
    SDHCI_QUIRK2_DISABLE_HW_TIMEOUT quirk in sdhci_am654.
    
    [0] https://www.ti.com/lit/pdf/sprz487
    
    Signed-off-by: Judith Mendez <jm@ti.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250626231452.3460987-1-jm@ti.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
module: Restore the moduleparam prefix length check [+ + +]
Author: Petr Pavlu <petr.pavlu@suse.com>
Date:   Mon Jun 30 16:32:34 2025 +0200

    module: Restore the moduleparam prefix length check
    
    [ Upstream commit bdc877ba6b7ff1b6d2ebeff11e63da4a50a54854 ]
    
    The moduleparam code allows modules to provide their own definition of
    MODULE_PARAM_PREFIX, instead of using the default KBUILD_MODNAME ".".
    
    Commit 730b69d22525 ("module: check kernel param length at compile time,
    not runtime") added a check to ensure the prefix doesn't exceed
    MODULE_NAME_LEN, as this is what param_sysfs_builtin() expects.
    
    Later, commit 58f86cc89c33 ("VERIFY_OCTAL_PERMISSIONS: stricter checking
    for sysfs perms.") removed this check, but there is no indication this was
    intentional.
    
    Since the check is still useful for param_sysfs_builtin() to function
    properly, reintroduce it in __module_param_call(), but in a modernized form
    using static_assert().
    
    While here, clean up the __module_param_call() comments. In particular,
    remove the comment "Default value instead of permissions?", which comes
    from commit 9774a1f54f17 ("[PATCH] Compile-time check re world-writeable
    module params"). This comment was related to the test variable
    __param_perm_check_##name, which was removed in the previously mentioned
    commit 58f86cc89c33.
    
    Fixes: 58f86cc89c33 ("VERIFY_OCTAL_PERMISSIONS: stricter checking for sysfs perms.")
    Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
    Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
    Link: https://lore.kernel.org/r/20250630143535.267745-4-petr.pavlu@suse.com
    Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
most: core: Drop device reference after usage in get_channel() [+ + +]
Author: Miaoqian Lin <linmq006@gmail.com>
Date:   Mon Aug 4 12:29:55 2025 +0400

    most: core: Drop device reference after usage in get_channel()
    
    commit b47b493d6387ae437098112936f32be27f73516c upstream.
    
    In get_channel(), the reference obtained by bus_find_device_by_name()
    was dropped via put_device() before accessing the device's driver data
    Move put_device() after usage to avoid potential issues.
    
    Fixes: 2485055394be ("staging: most: core: drop device reference")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Link: https://lore.kernel.org/r/20250804082955.3621026-1-linmq006@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
move_mount: allow to add a mount into an existing group [+ + +]
Author: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date:   Thu Jul 15 13:07:13 2021 +0300

    move_mount: allow to add a mount into an existing group
    
    [ Upstream commit 9ffb14ef61bab83fa818736bf3e7e6b6e182e8e2 ]
    
    Previously a sharing group (shared and master ids pair) can be only
    inherited when mount is created via bindmount. This patch adds an
    ability to add an existing private mount into an existing sharing group.
    
    With this functionality one can first create the desired mount tree from
    only private mounts (without the need to care about undesired mount
    propagation or mount creation order implied by sharing group
    dependencies), and next then setup any desired mount sharing between
    those mounts in tree as needed.
    
    This allows CRIU to restore any set of mount namespaces, mount trees and
    sharing group trees for a container.
    
    We have many issues with restoring mounts in CRIU related to sharing
    groups and propagation:
    - reverse sharing groups vs mount tree order requires complex mounts
      reordering which mostly implies also using some temporary mounts
    (please see https://lkml.org/lkml/2021/3/23/569 for more info)
    
    - mount() syscall creates tons of mounts due to propagation
    - mount re-parenting due to propagation
    - "Mount Trap" due to propagation
    - "Non Uniform" propagation, meaning that with different tricks with
      mount order and temporary children-"lock" mounts one can create mount
      trees which can't be restored without those tricks
    (see https://www.linuxplumbersconf.org/event/7/contributions/640/)
    
    With this new functionality we can resolve all the problems with
    propagation at once.
    
    Link: https://lore.kernel.org/r/20210715100714.120228-1-ptikhomirov@virtuozzo.com
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: Mattias Nissler <mnissler@chromium.org>
    Cc: Aleksa Sarai <cyphar@cyphar.com>
    Cc: Andrei Vagin <avagin@gmail.com>
    Cc: linux-fsdevel@vger.kernel.org
    Cc: linux-api@vger.kernel.org
    Cc: lkml <linux-kernel@vger.kernel.org>
    Co-developed-by: Andrei Vagin <avagin@gmail.com>
    Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Signed-off-by: Andrei Vagin <avagin@gmail.com>
    Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
    Stable-dep-of: cffd0441872e ("use uniform permission checks for all mount propagation changes")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mtd: fix possible integer overflow in erase_xfer() [+ + +]
Author: Ivan Stepchenko <sid@itb.spb.ru>
Date:   Thu Jun 19 17:53:13 2025 +0300

    mtd: fix possible integer overflow in erase_xfer()
    
    [ Upstream commit 9358bdb9f9f54d94ceafc650deffefd737d19fdd ]
    
    The expression '1 << EraseUnitSize' is evaluated in int, which causes
    a negative result when shifting by 31 - the upper bound of the valid
    range [10, 31], enforced by scan_header(). This leads to incorrect
    extension when storing the result in 'erase->len' (uint64_t), producing
    a large unexpected value.
    
    Found by Linux Verification Center (linuxtesting.org) with Svace.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: rawnand: atmel: Fix dma_mapping_error() address [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Wed Jul 2 08:45:11 2025 +0200

    mtd: rawnand: atmel: Fix dma_mapping_error() address
    
    [ Upstream commit e1e6b933c56b1e9fda93caa0b8bae39f3f421e5c ]
    
    It seems like what was intended is to test if the dma_map of the
    previous line failed but the wrong dma address was passed.
    
    Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Rule: add
    Link: https://lore.kernel.org/stable/20250702064515.18145-2-fourier.thomas%40gmail.com
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: rawnand: atmel: set pmecc data setup time [+ + +]
Author: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Date:   Mon Jul 21 16:13:40 2025 +0530

    mtd: rawnand: atmel: set pmecc data setup time
    
    [ Upstream commit f552a7c7e0a14215cb8a6fd89e60fa3932a74786 ]
    
    Setup the pmecc data setup time as 3 clock cycles for 133MHz as recommended
    by the datasheet.
    
    Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
    Reported-by: Zixun LI <admin@hifiphile.com>
    Closes: https://lore.kernel.org/all/c015bb20-6a57-4f63-8102-34b3d83e0f5b@microchip.com
    Suggested-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: rawnand: fsmc: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jul 7 09:39:37 2025 +0200

    mtd: rawnand: fsmc: Add missing check after DMA map
    
    commit 6c4dab38431fee3d39a841d66ba6f2890b31b005 upstream.
    
    The DMA map functions can fail and should be tested for errors.
    
    Fixes: 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Rule: add
    Link: https://lore.kernel.org/stable/20250702065806.20983-2-fourier.thomas%40gmail.com
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mwl8k: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Wed Jul 9 13:13:34 2025 +0200

    mwl8k: Add missing check after DMA map
    
    [ Upstream commit 50459501b9a212dbe7a673727589ee105a8a9954 ]
    
    The DMA map functions can fail and should be tested for errors.
    If the mapping fails, unmap and return an error.
    
    Fixes: 788838ebe8a4 ("mwl8k: use pci_unmap_addr{,set}() to keep track of unmap addresses on rx")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://patch.msgid.link/20250709111339.25360-2-fourier.thomas@gmail.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net, hsr: reject HSR frame if skb can't hold tag [+ + +]
Author: Jakub Acs <acsjakub@amazon.de>
Date:   Tue Aug 19 08:28:42 2025 +0000

    net, hsr: reject HSR frame if skb can't hold tag
    
    commit 7af76e9d18a9fd6f8611b3313c86c190f9b6a5a7 upstream.
    
    Receiving HSR frame with insufficient space to hold HSR tag in the skb
    can result in a crash (kernel BUG):
    
    [   45.390915] skbuff: skb_under_panic: text:ffffffff86f32cac len:26 put:14 head:ffff888042418000 data:ffff888042417ff4 tail:0xe end:0x180 dev:bridge_slave_1
    [   45.392559] ------------[ cut here ]------------
    [   45.392912] kernel BUG at net/core/skbuff.c:211!
    [   45.393276] Oops: invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN NOPTI
    [   45.393809] CPU: 1 UID: 0 PID: 2496 Comm: reproducer Not tainted 6.15.0 #12 PREEMPT(undef)
    [   45.394433] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
    [   45.395273] RIP: 0010:skb_panic+0x15b/0x1d0
    
    <snip registers, remove unreliable trace>
    
    [   45.402911] Call Trace:
    [   45.403105]  <IRQ>
    [   45.404470]  skb_push+0xcd/0xf0
    [   45.404726]  br_dev_queue_push_xmit+0x7c/0x6c0
    [   45.406513]  br_forward_finish+0x128/0x260
    [   45.408483]  __br_forward+0x42d/0x590
    [   45.409464]  maybe_deliver+0x2eb/0x420
    [   45.409763]  br_flood+0x174/0x4a0
    [   45.410030]  br_handle_frame_finish+0xc7c/0x1bc0
    [   45.411618]  br_handle_frame+0xac3/0x1230
    [   45.413674]  __netif_receive_skb_core.constprop.0+0x808/0x3df0
    [   45.422966]  __netif_receive_skb_one_core+0xb4/0x1f0
    [   45.424478]  __netif_receive_skb+0x22/0x170
    [   45.424806]  process_backlog+0x242/0x6d0
    [   45.425116]  __napi_poll+0xbb/0x630
    [   45.425394]  net_rx_action+0x4d1/0xcc0
    [   45.427613]  handle_softirqs+0x1a4/0x580
    [   45.427926]  do_softirq+0x74/0x90
    [   45.428196]  </IRQ>
    
    This issue was found by syzkaller.
    
    The panic happens in br_dev_queue_push_xmit() once it receives a
    corrupted skb with ETH header already pushed in linear data. When it
    attempts the skb_push() call, there's not enough headroom and
    skb_push() panics.
    
    The corrupted skb is put on the queue by HSR layer, which makes a
    sequence of unintended transformations when it receives a specific
    corrupted HSR frame (with incomplete TAG).
    
    Fix it by dropping and consuming frames that are not long enough to
    contain both ethernet and hsr headers.
    
    Alternative fix would be to check for enough headroom before skb_push()
    in br_dev_queue_push_xmit().
    
    In the reproducer, this is injected via AF_PACKET, but I don't easily
    see why it couldn't be sent over the wire from adjacent network.
    
    Further Details:
    
    In the reproducer, the following network interface chain is set up:
    
    ┌────────────────┐   ┌────────────────┐
    │ veth0_to_hsr   ├───┤  hsr_slave0    ┼───┐
    └────────────────┘   └────────────────┘   │
                                              │ ┌──────┐
                                              ├─┤ hsr0 ├───┐
                                              │ └──────┘   │
    ┌────────────────┐   ┌────────────────┐   │            │┌────────┐
    │ veth1_to_hsr   ┼───┤  hsr_slave1    ├───┘            └┤        │
    └────────────────┘   └────────────────┘                ┌┼ bridge │
                                                           ││        │
                                                           │└────────┘
                                                           │
                                            ┌───────┐      │
                                            │  ...  ├──────┘
                                            └───────┘
    
    To trigger the events leading up to crash, reproducer sends a corrupted
    HSR frame with incomplete TAG, via AF_PACKET socket on 'veth0_to_hsr'.
    
    The first HSR-layer function to process this frame is
    hsr_handle_frame(). It and then checks if the
    protocol is ETH_P_PRP or ETH_P_HSR. If it is, it calls
    skb_set_network_header(skb, ETH_HLEN + HSR_HLEN), without checking that
    the skb is long enough. For the crashing frame it is not, and hence the
    skb->network_header and skb->mac_len fields are set incorrectly,
    pointing after the end of the linear buffer.
    
    I will call this a BUG#1 and it is what is addressed by this patch. In
    the crashing scenario before the fix, the skb continues to go down the
    hsr path as follows.
    
    hsr_handle_frame() then calls this sequence
    hsr_forward_skb()
      fill_frame_info()
        hsr->proto_ops->fill_frame_info()
          hsr_fill_frame_info()
    
    hsr_fill_frame_info() contains a check that intends to check whether the
    skb actually contains the HSR header. But the check relies on the
    skb->mac_len field which was erroneously setup due to BUG#1, so the
    check passes and the execution continues  back in the hsr_forward_skb():
    
    hsr_forward_skb()
      hsr_forward_do()
        hsr->proto_ops->get_untagged_frame()
          hsr_get_untagged_frame()
            create_stripped_skb_hsr()
    
    In create_stripped_skb_hsr(), a copy of the skb is created and is
    further corrupted by operation that attempts to strip the HSR tag in a
    call to __pskb_copy().
    
    The skb enters create_stripped_skb_hsr() with ethernet header pushed in
    linear buffer. The skb_pull(skb_in, HSR_HLEN) thus pulls 6 bytes of
    ethernet header into the headroom, creating skb_in with a headroom of
    size 8. The subsequent __pskb_copy() then creates an skb with headroom
    of just 2 and skb->len of just 12, this is how it looks after the copy:
    
    gdb) p skb->len
    $10 = 12
    (gdb) p skb->data
    $11 = (unsigned char *) 0xffff888041e45382 "\252\252\252\252\252!\210\373",
    (gdb) p skb->head
    $12 = (unsigned char *) 0xffff888041e45380 ""
    
    It seems create_stripped_skb_hsr() assumes that ETH header is pulled
    in the headroom when it's entered, because it just pulls HSR header on
    top. But that is not the case in our code-path and we end up with the
    corrupted skb instead. I will call this BUG#2
    
    *I got confused here because it seems that under no conditions can
    create_stripped_skb_hsr() work well, the assumption it makes is not true
    during the processing of hsr frames - since the skb_push() in
    hsr_handle_frame to skb_pull in hsr_deliver_master(). I wonder whether I
    missed something here.*
    
    Next, the execution arrives in hsr_deliver_master(). It calls
    skb_pull(ETH_HLEN), which just returns NULL - the SKB does not have
    enough space for the pull (as it only has 12 bytes in total at this
    point).
    
    *The skb_pull() here further suggests that ethernet header is meant
    to be pushed through the whole hsr processing and
    create_stripped_skb_hsr() should pull it before doing the HSR header
    pull.*
    
    hsr_deliver_master() then puts the corrupted skb on the queue, it is
    then picked up from there by bridge frame handling layer and finally
    lands in br_dev_queue_push_xmit where it panics.
    
    Cc: stable@kernel.org
    Fixes: 48b491a5cc74 ("net: hsr: fix mac_len checks")
    Reported-by: syzbot+a81f2759d022496b40ab@syzkaller.appspotmail.com
    Signed-off-by: Jakub Acs <acsjakub@amazon.de>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250819082842.94378-1-acsjakub@amazon.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/packet: fix a race in packet_set_ring() and packet_notifier() [+ + +]
Author: Quang Le <quanglex97@gmail.com>
Date:   Fri Aug 1 13:54:16 2025 -0400

    net/packet: fix a race in packet_set_ring() and packet_notifier()
    
    commit 01d3c8417b9c1b884a8a981a3b886da556512f36 upstream.
    
    When packet_set_ring() releases po->bind_lock, another thread can
    run packet_notifier() and process an NETDEV_UP event.
    
    This race and the fix are both similar to that of commit 15fe076edea7
    ("net/packet: fix a race in packet_bind() and packet_notifier()").
    
    There too the packet_notifier NETDEV_UP event managed to run while a
    po->bind_lock critical section had to be temporarily released. And
    the fix was similarly to temporarily set po->num to zero to keep
    the socket unhooked until the lock is retaken.
    
    The po->bind_lock in packet_set_ring and packet_notifier precede the
    introduction of git history.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Quang Le <quanglex97@gmail.com>
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20250801175423.2970334-1-willemdebruijn.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/sched: ets: use old 'nbands' while purging unused classes [+ + +]
Author: Davide Caratti <dcaratti@redhat.com>
Date:   Tue Aug 19 10:32:53 2025 -0400

    net/sched: ets: use old 'nbands' while purging unused classes
    
    [ Upstream commit 87c6efc5ce9c126ae4a781bc04504b83780e3650 ]
    
    Shuang reported sch_ets test-case [1] crashing in ets_class_qlen_notify()
    after recent changes from Lion [2]. The problem is: in ets_qdisc_change()
    we purge unused DWRR queues; the value of 'q->nbands' is the new one, and
    the cleanup should be done with the old one. The problem is here since my
    first attempts to fix ets_qdisc_change(), but it surfaced again after the
    recent qdisc len accounting fixes. Fix it purging idle DWRR queues before
    assigning a new value of 'q->nbands', so that all purge operations find a
    consistent configuration:
    
     - old 'q->nbands' because it's needed by ets_class_find()
     - old 'q->nstrict' because it's needed by ets_class_is_strict()
    
     BUG: kernel NULL pointer dereference, address: 0000000000000000
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 0 P4D 0
     Oops: Oops: 0000 [#1] SMP NOPTI
     CPU: 62 UID: 0 PID: 39457 Comm: tc Kdump: loaded Not tainted 6.12.0-116.el10.x86_64 #1 PREEMPT(voluntary)
     Hardware name: Dell Inc. PowerEdge R640/06DKY5, BIOS 2.12.2 07/09/2021
     RIP: 0010:__list_del_entry_valid_or_report+0x4/0x80
     Code: ff 4c 39 c7 0f 84 39 19 8e ff b8 01 00 00 00 c3 cc cc cc cc 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa <48> 8b 17 48 8b 4f 08 48 85 d2 0f 84 56 19 8e ff 48 85 c9 0f 84 ab
     RSP: 0018:ffffba186009f400 EFLAGS: 00010202
     RAX: 00000000000000d6 RBX: 0000000000000000 RCX: 0000000000000004
     RDX: ffff9f0fa29b69c0 RSI: 0000000000000000 RDI: 0000000000000000
     RBP: ffffffffc12c2400 R08: 0000000000000008 R09: 0000000000000004
     R10: ffffffffffffffff R11: 0000000000000004 R12: 0000000000000000
     R13: ffff9f0f8cfe0000 R14: 0000000000100005 R15: 0000000000000000
     FS:  00007f2154f37480(0000) GS:ffff9f269c1c0000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 0000000000000000 CR3: 00000001530be001 CR4: 00000000007726f0
     DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
     PKRU: 55555554
     Call Trace:
      <TASK>
      ets_class_qlen_notify+0x65/0x90 [sch_ets]
      qdisc_tree_reduce_backlog+0x74/0x110
      ets_qdisc_change+0x630/0xa40 [sch_ets]
      __tc_modify_qdisc.constprop.0+0x216/0x7f0
      tc_modify_qdisc+0x7c/0x120
      rtnetlink_rcv_msg+0x145/0x3f0
      netlink_rcv_skb+0x53/0x100
      netlink_unicast+0x245/0x390
      netlink_sendmsg+0x21b/0x470
      ____sys_sendmsg+0x39d/0x3d0
      ___sys_sendmsg+0x9a/0xe0
      __sys_sendmsg+0x7a/0xd0
      do_syscall_64+0x7d/0x160
      entry_SYSCALL_64_after_hwframe+0x76/0x7e
     RIP: 0033:0x7f2155114084
     Code: 89 02 b8 ff ff ff ff eb bb 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 80 3d 25 f0 0c 00 00 74 13 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 48 83 ec 28 89 54 24 1c 48 89
     RSP: 002b:00007fff1fd7a988 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
     RAX: ffffffffffffffda RBX: 0000560ec063e5e0 RCX: 00007f2155114084
     RDX: 0000000000000000 RSI: 00007fff1fd7a9f0 RDI: 0000000000000003
     RBP: 00007fff1fd7aa60 R08: 0000000000000010 R09: 000000000000003f
     R10: 0000560ee9b3a010 R11: 0000000000000202 R12: 00007fff1fd7aae0
     R13: 000000006891ccde R14: 0000560ec063e5e0 R15: 00007fff1fd7aad0
      </TASK>
    
     [1] https://lore.kernel.org/netdev/e08c7f4a6882f260011909a868311c6e9b54f3e4.1639153474.git.dcaratti@redhat.com/
     [2] https://lore.kernel.org/netdev/d912cbd7-193b-4269-9857-525bee8bbb6a@gmail.com/
    
    Cc: stable@vger.kernel.org
    Fixes: 103406b38c60 ("net/sched: Always pass notifications when child class becomes empty")
    Fixes: c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")
    Fixes: dcc68b4d8084 ("net: sch_ets: Add a new Qdisc")
    Reported-by: Li Shuang <shuali@redhat.com>
    Closes: https://issues.redhat.com/browse/RHEL-108026
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Co-developed-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: Ivan Vecera <ivecera@redhat.com>
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
    Link: https://patch.msgid.link/7928ff6d17db47a2ae7cc205c44777b1f1950545.1755016081.git.dcaratti@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: Make cake_enqueue return NET_XMIT_CN when past buffer_limit [+ + +]
Author: William Liu <will@willsroot.io>
Date:   Tue Aug 19 03:36:28 2025 +0000

    net/sched: Make cake_enqueue return NET_XMIT_CN when past buffer_limit
    
    [ Upstream commit 15de71d06a400f7fdc15bf377a2552b0ec437cf5 ]
    
    The following setup can trigger a WARNING in htb_activate due to
    the condition: !cl->leaf.q->q.qlen
    
    tc qdisc del dev lo root
    tc qdisc add dev lo root handle 1: htb default 1
    tc class add dev lo parent 1: classid 1:1 \
           htb rate 64bit
    tc qdisc add dev lo parent 1:1 handle f: \
           cake memlimit 1b
    ping -I lo -f -c1 -s64 -W0.001 127.0.0.1
    
    This is because the low memlimit leads to a low buffer_limit, which
    causes packet dropping. However, cake_enqueue still returns
    NET_XMIT_SUCCESS, causing htb_enqueue to call htb_activate with an
    empty child qdisc. We should return NET_XMIT_CN when packets are
    dropped from the same tin and flow.
    
    I do not believe return value of NET_XMIT_CN is necessary for packet
    drops in the case of ack filtering, as that is meant to optimize
    performance, not to signal congestion.
    
    Fixes: 046f6fd5daef ("sched: Add Common Applications Kept Enhanced (cake) qdisc")
    Signed-off-by: William Liu <will@willsroot.io>
    Reviewed-by: Savino Dicanosa <savy@syst3mfailure.io>
    Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20250819033601.579821-1-will@willsroot.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Remove unnecessary WARNING condition for empty child qdisc in htb_activate [+ + +]
Author: William Liu <will@willsroot.io>
Date:   Tue Aug 19 03:36:59 2025 +0000

    net/sched: Remove unnecessary WARNING condition for empty child qdisc in htb_activate
    
    [ Upstream commit 2c2192e5f9c7c2892fe2363244d1387f62710d83 ]
    
    The WARN_ON trigger based on !cl->leaf.q->q.qlen is unnecessary in
    htb_activate. htb_dequeue_tree already accounts for that scenario.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: William Liu <will@willsroot.io>
    Reviewed-by: Savino Dicanosa <savy@syst3mfailure.io>
    Link: https://patch.msgid.link/20250819033632.579854-1-will@willsroot.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Restrict conditions for adding duplicating netems to qdisc tree [+ + +]
Author: William Liu <will@willsroot.io>
Date:   Tue Jul 8 16:43:26 2025 +0000

    net/sched: Restrict conditions for adding duplicating netems to qdisc tree
    
    [ Upstream commit ec8e0e3d7adef940cdf9475e2352c0680189d14e ]
    
    netem_enqueue's duplication prevention logic breaks when a netem
    resides in a qdisc tree with other netems - this can lead to a
    soft lockup and OOM loop in netem_dequeue, as seen in [1].
    Ensure that a duplicating netem cannot exist in a tree with other
    netems.
    
    Previous approaches suggested in discussions in chronological order:
    
    1) Track duplication status or ttl in the sk_buff struct. Considered
    too specific a use case to extend such a struct, though this would
    be a resilient fix and address other previous and potential future
    DOS bugs like the one described in loopy fun [2].
    
    2) Restrict netem_enqueue recursion depth like in act_mirred with a
    per cpu variable. However, netem_dequeue can call enqueue on its
    child, and the depth restriction could be bypassed if the child is a
    netem.
    
    3) Use the same approach as in 2, but add metadata in netem_skb_cb
    to handle the netem_dequeue case and track a packet's involvement
    in duplication. This is an overly complex approach, and Jamal
    notes that the skb cb can be overwritten to circumvent this
    safeguard.
    
    4) Prevent the addition of a netem to a qdisc tree if its ancestral
    path contains a netem. However, filters and actions can cause a
    packet to change paths when re-enqueued to the root from netem
    duplication, leading us to the current solution: prevent a
    duplicating netem from inhabiting the same tree as other netems.
    
    [1] https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/
    [2] https://lwn.net/Articles/719297/
    
    Fixes: 0afb51e72855 ("[PKT_SCHED]: netem: reinsert for duplication")
    Reported-by: William Liu <will@willsroot.io>
    Reported-by: Savino Dicanosa <savy@syst3mfailure.io>
    Signed-off-by: William Liu <will@willsroot.io>
    Signed-off-by: Savino Dicanosa <savy@syst3mfailure.io>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20250708164141.875402-1-will@willsroot.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree [+ + +]
Author: William Liu <will@willsroot.io>
Date:   Thu Jul 17 02:28:38 2025 +0000

    net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree
    
    [ Upstream commit 0e1d5d9b5c5966e2e42e298670808590db5ed628 ]
    
    htb_lookup_leaf has a BUG_ON that can trigger with the following:
    
    tc qdisc del dev lo root
    tc qdisc add dev lo root handle 1: htb default 1
    tc class add dev lo parent 1: classid 1:1 htb rate 64bit
    tc qdisc add dev lo parent 1:1 handle 2: netem
    tc qdisc add dev lo parent 2:1 handle 3: blackhole
    ping -I lo -c1 -W0.001 127.0.0.1
    
    The root cause is the following:
    
    1. htb_dequeue calls htb_dequeue_tree which calls the dequeue handler on
       the selected leaf qdisc
    2. netem_dequeue calls enqueue on the child qdisc
    3. blackhole_enqueue drops the packet and returns a value that is not
       just NET_XMIT_SUCCESS
    4. Because of this, netem_dequeue calls qdisc_tree_reduce_backlog, and
       since qlen is now 0, it calls htb_qlen_notify -> htb_deactivate ->
       htb_deactiviate_prios -> htb_remove_class_from_row -> htb_safe_rb_erase
    5. As this is the only class in the selected hprio rbtree,
       __rb_change_child in __rb_erase_augmented sets the rb_root pointer to
       NULL
    6. Because blackhole_dequeue returns NULL, netem_dequeue returns NULL,
       which causes htb_dequeue_tree to call htb_lookup_leaf with the same
       hprio rbtree, and fail the BUG_ON
    
    The function graph for this scenario is shown here:
     0)               |  htb_enqueue() {
     0) + 13.635 us   |    netem_enqueue();
     0)   4.719 us    |    htb_activate_prios();
     0) # 2249.199 us |  }
     0)               |  htb_dequeue() {
     0)   2.355 us    |    htb_lookup_leaf();
     0)               |    netem_dequeue() {
     0) + 11.061 us   |      blackhole_enqueue();
     0)               |      qdisc_tree_reduce_backlog() {
     0)               |        qdisc_lookup_rcu() {
     0)   1.873 us    |          qdisc_match_from_root();
     0)   6.292 us    |        }
     0)   1.894 us    |        htb_search();
     0)               |        htb_qlen_notify() {
     0)   2.655 us    |          htb_deactivate_prios();
     0)   6.933 us    |        }
     0) + 25.227 us   |      }
     0)   1.983 us    |      blackhole_dequeue();
     0) + 86.553 us   |    }
     0) # 2932.761 us |    qdisc_warn_nonwc();
     0)               |    htb_lookup_leaf() {
     0)               |      BUG_ON();
     ------------------------------------------
    
    The full original bug report can be seen here [1].
    
    We can fix this just by returning NULL instead of the BUG_ON,
    as htb_dequeue_tree returns NULL when htb_lookup_leaf returns
    NULL.
    
    [1] https://lore.kernel.org/netdev/pF5XOOIim0IuEfhI-SOxTgRvNoDwuux7UHKnE_Y5-zVd4wmGvNk2ceHjKb8ORnzw0cGwfmVu42g9dL7XyJLf1NEzaztboTWcm0Ogxuojoeo=@willsroot.io/
    
    Fixes: 512bb43eb542 ("pkt_sched: sch_htb: Optimize WARN_ONs in htb_dequeue_tree() etc.")
    Signed-off-by: William Liu <will@willsroot.io>
    Signed-off-by: Savino Dicanosa <savy@syst3mfailure.io>
    Link: https://patch.msgid.link/20250717022816.221364-1-will@willsroot.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_ets: properly init all active DRR list handles [+ + +]
Author: Davide Caratti <dcaratti@redhat.com>
Date:   Tue Aug 19 10:32:51 2025 -0400

    net/sched: sch_ets: properly init all active DRR list handles
    
    [ Upstream commit 454d3e1ae057a1e09a15905b06b860f60d6c14d0 ]
    
    leaf classes of ETS qdiscs are served in strict priority or deficit round
    robin (DRR), depending on the value of 'nstrict'. Since this value can be
    changed while traffic is running, we need to be sure that the active list
    of DRR classes can be updated at any time, so:
    
    1) call INIT_LIST_HEAD(&alist) on all leaf classes in .init(), before the
       first packet hits any of them.
    2) ensure that 'alist' is not overwritten with zeros when a leaf class is
       no more strict priority nor DRR (i.e. array elements beyond 'nbands').
    
    Link: https://lore.kernel.org/netdev/YS%2FoZ+f0Nr8eQkzH@dcaratti.users.ipa.redhat.com
    Suggested-by: Cong Wang <cong.wang@bytedance.com>
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 87c6efc5ce9c ("net/sched: ets: use old 'nbands' while purging unused classes")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
Date:   Thu Jul 17 16:01:28 2025 -0700

    net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class
    
    [ Upstream commit cf074eca0065bc5142e6004ae236bb35a2687fdf ]
    
    might_sleep could be trigger in the atomic context in qfq_delete_class.
    
    qfq_destroy_class was moved into atomic context locked
    by sch_tree_lock to avoid a race condition bug on
    qfq_aggregate. However, might_sleep could be triggered by
    qfq_destroy_class, which introduced sleeping in atomic context (path:
    qfq_destroy_class->qdisc_put->__qdisc_destroy->lockdep_unregister_key
    ->might_sleep).
    
    Considering the race is on the qfq_aggregate objects, keeping
    qfq_rm_from_agg in the lock but moving the left part out can solve
    this issue.
    
    Fixes: 5e28d5a3f774 ("net/sched: sch_qfq: Fix race condition on qfq_aggregate")
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Link: https://patch.msgid.link/4a04e0cc-a64b-44e7-9213-2880ed641d77@sabinyo.mountain
    Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://patch.msgid.link/20250717230128.159766-1-xmei5@asu.edu
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_qfq: Fix race condition on qfq_aggregate [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
Date:   Thu Jul 10 03:09:42 2025 -0700

    net/sched: sch_qfq: Fix race condition on qfq_aggregate
    
    [ Upstream commit 5e28d5a3f774f118896aec17a3a20a9c5c9dfc64 ]
    
    A race condition can occur when 'agg' is modified in qfq_change_agg
    (called during qfq_enqueue) while other threads access it
    concurrently. For example, qfq_dump_class may trigger a NULL
    dereference, and qfq_delete_class may cause a use-after-free.
    
    This patch addresses the issue by:
    
    1. Moved qfq_destroy_class into the critical section.
    
    2. Added sch_tree_lock protection to qfq_dump_class and
    qfq_dump_class_stats.
    
    Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: ag71xx: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Wed Jul 16 11:57:25 2025 +0200

    net: ag71xx: Add missing check after DMA map
    
    [ Upstream commit 96a1e15e60216b52da0e6da5336b6d7f5b0188b0 ]
    
    The DMA map functions can fail and should be tested for errors.
    
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250716095733.37452-3-fourier.thomas@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: appletalk: fix kerneldoc warnings [+ + +]
Author: Andrew Lunn <andrew@lunn.ch>
Date:   Wed Oct 28 01:55:27 2020 +0100

    net: appletalk: fix kerneldoc warnings
    
    [ Upstream commit 709565ae14aa2670d6b480be46720856e804af41 ]
    
    net/appletalk/aarp.c:68: warning: Function parameter or member 'dev' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'expires_at' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'hwaddr' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'last_sent' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'next' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'packet_queue' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'status' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'target_addr' not described in 'aarp_entry'
    net/appletalk/aarp.c:68: warning: Function parameter or member 'xmit_count' not described in 'aarp_entry'
    net/appletalk/ddp.c:1422: warning: Function parameter or member 'dev' not described in 'atalk_rcv'
    net/appletalk/ddp.c:1422: warning: Function parameter or member 'orig_dev' not described in 'atalk_rcv'
    net/appletalk/ddp.c:1422: warning: Function parameter or member 'pt' not described in 'atalk_rcv'
    net/appletalk/ddp.c:1422: warning: Function parameter or member 'skb' not described in 'atalk_rcv'
    
    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20201028005527.930388-1-andrew@lunn.ch
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 6c4a92d07b08 ("net: appletalk: Fix use-after-free in AARP proxy probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: appletalk: Fix use-after-free in AARP proxy probe [+ + +]
Author: Kito Xu (veritas501) <hxzene@gmail.com>
Date:   Thu Jul 17 01:28:43 2025 +0000

    net: appletalk: Fix use-after-free in AARP proxy probe
    
    [ Upstream commit 6c4a92d07b0850342d3becf2e608f805e972467c ]
    
    The AARP proxy‐probe routine (aarp_proxy_probe_network) sends a probe,
    releases the aarp_lock, sleeps, then re-acquires the lock.  During that
    window an expire timer thread (__aarp_expire_timer) can remove and
    kfree() the same entry, leading to a use-after-free.
    
    race condition:
    
             cpu 0                          |            cpu 1
        atalk_sendmsg()                     |   atif_proxy_probe_device()
        aarp_send_ddp()                     |   aarp_proxy_probe_network()
        mod_timer()                         |   lock(aarp_lock) // LOCK!!
        timeout around 200ms                |   alloc(aarp_entry)
        and then call                       |   proxies[hash] = aarp_entry
        aarp_expire_timeout()               |   aarp_send_probe()
                                            |   unlock(aarp_lock) // UNLOCK!!
        lock(aarp_lock) // LOCK!!           |   msleep(100);
        __aarp_expire_timer(&proxies[ct])   |
        free(aarp_entry)                    |
        unlock(aarp_lock) // UNLOCK!!       |
                                            |   lock(aarp_lock) // LOCK!!
                                            |   UAF aarp_entry !!
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in aarp_proxy_probe_network+0x560/0x630 net/appletalk/aarp.c:493
    Read of size 4 at addr ffff8880123aa360 by task repro/13278
    
    CPU: 3 UID: 0 PID: 13278 Comm: repro Not tainted 6.15.2 #3 PREEMPT(full)
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:408 [inline]
     print_report+0xc1/0x630 mm/kasan/report.c:521
     kasan_report+0xca/0x100 mm/kasan/report.c:634
     aarp_proxy_probe_network+0x560/0x630 net/appletalk/aarp.c:493
     atif_proxy_probe_device net/appletalk/ddp.c:332 [inline]
     atif_ioctl+0xb58/0x16c0 net/appletalk/ddp.c:857
     atalk_ioctl+0x198/0x2f0 net/appletalk/ddp.c:1818
     sock_do_ioctl+0xdc/0x260 net/socket.c:1190
     sock_ioctl+0x239/0x6a0 net/socket.c:1311
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:906 [inline]
     __se_sys_ioctl fs/ioctl.c:892 [inline]
     __x64_sys_ioctl+0x194/0x200 fs/ioctl.c:892
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xcb/0x250 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
     </TASK>
    
    Allocated:
     aarp_alloc net/appletalk/aarp.c:382 [inline]
     aarp_proxy_probe_network+0xd8/0x630 net/appletalk/aarp.c:468
     atif_proxy_probe_device net/appletalk/ddp.c:332 [inline]
     atif_ioctl+0xb58/0x16c0 net/appletalk/ddp.c:857
     atalk_ioctl+0x198/0x2f0 net/appletalk/ddp.c:1818
    
    Freed:
     kfree+0x148/0x4d0 mm/slub.c:4841
     __aarp_expire net/appletalk/aarp.c:90 [inline]
     __aarp_expire_timer net/appletalk/aarp.c:261 [inline]
     aarp_expire_timeout+0x480/0x6e0 net/appletalk/aarp.c:317
    
    The buggy address belongs to the object at ffff8880123aa300
     which belongs to the cache kmalloc-192 of size 192
    The buggy address is located 96 bytes inside of
     freed 192-byte region [ffff8880123aa300, ffff8880123aa3c0)
    
    Memory state around the buggy address:
     ffff8880123aa200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffff8880123aa280: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
    >ffff8880123aa300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                           ^
     ffff8880123aa380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
     ffff8880123aa400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Kito Xu (veritas501) <hxzene@gmail.com>
    Link: https://patch.msgid.link/20250717012843.880423-1-hxzene@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dpaa: fix device leak when querying time stamp info [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Fri Jul 25 19:12:09 2025 +0200

    net: dpaa: fix device leak when querying time stamp info
    
    commit 3fa840230f534385b34a4f39c8dd313fbe723f05 upstream.
    
    Make sure to drop the reference to the ptp device taken by
    of_find_device_by_node() when querying the time stamping capabilities.
    
    Note that holding a reference to the ptp device does not prevent its
    driver data from going away.
    
    Fixes: 17ae0b0ee9db ("dpaa_eth: add the get_ts_info interface for ethtool")
    Cc: stable@vger.kernel.org      # 4.19
    Cc: Yangbo Lu <yangbo.lu@nxp.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250725171213.880-2-johan@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: drop UFO packets in udp_rcv_segment() [+ + +]
Author: Wang Liang <wangliang74@huawei.com>
Date:   Wed Jul 30 18:14:58 2025 +0800

    net: drop UFO packets in udp_rcv_segment()
    
    [ Upstream commit d46e51f1c78b9ab9323610feb14238d06d46d519 ]
    
    When sending a packet with virtio_net_hdr to tun device, if the gso_type
    in virtio_net_hdr is SKB_GSO_UDP and the gso_size is less than udphdr
    size, below crash may happen.
    
      ------------[ cut here ]------------
      kernel BUG at net/core/skbuff.c:4572!
      Oops: invalid opcode: 0000 [#1] SMP NOPTI
      CPU: 0 UID: 0 PID: 62 Comm: mytest Not tainted 6.16.0-rc7 #203 PREEMPT(voluntary)
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:skb_pull_rcsum+0x8e/0xa0
      Code: 00 00 5b c3 cc cc cc cc 8b 93 88 00 00 00 f7 da e8 37 44 38 00 f7 d8 89 83 88 00 00 00 48 8b 83 c8 00 00 00 5b c3 cc cc cc cc <0f> 0b 0f 0b 66 66 2e 0f 1f 84 00 000
      RSP: 0018:ffffc900001fba38 EFLAGS: 00000297
      RAX: 0000000000000004 RBX: ffff8880040c1000 RCX: ffffc900001fb948
      RDX: ffff888003e6d700 RSI: 0000000000000008 RDI: ffff88800411a062
      RBP: ffff8880040c1000 R08: 0000000000000000 R09: 0000000000000001
      R10: ffff888003606c00 R11: 0000000000000001 R12: 0000000000000000
      R13: ffff888004060900 R14: ffff888004050000 R15: ffff888004060900
      FS:  000000002406d3c0(0000) GS:ffff888084a19000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020000040 CR3: 0000000004007000 CR4: 00000000000006f0
      Call Trace:
       <TASK>
       udp_queue_rcv_one_skb+0x176/0x4b0 net/ipv4/udp.c:2445
       udp_queue_rcv_skb+0x155/0x1f0 net/ipv4/udp.c:2475
       udp_unicast_rcv_skb+0x71/0x90 net/ipv4/udp.c:2626
       __udp4_lib_rcv+0x433/0xb00 net/ipv4/udp.c:2690
       ip_protocol_deliver_rcu+0xa6/0x160 net/ipv4/ip_input.c:205
       ip_local_deliver_finish+0x72/0x90 net/ipv4/ip_input.c:233
       ip_sublist_rcv_finish+0x5f/0x70 net/ipv4/ip_input.c:579
       ip_sublist_rcv+0x122/0x1b0 net/ipv4/ip_input.c:636
       ip_list_rcv+0xf7/0x130 net/ipv4/ip_input.c:670
       __netif_receive_skb_list_core+0x21d/0x240 net/core/dev.c:6067
       netif_receive_skb_list_internal+0x186/0x2b0 net/core/dev.c:6210
       napi_complete_done+0x78/0x180 net/core/dev.c:6580
       tun_get_user+0xa63/0x1120 drivers/net/tun.c:1909
       tun_chr_write_iter+0x65/0xb0 drivers/net/tun.c:1984
       vfs_write+0x300/0x420 fs/read_write.c:593
       ksys_write+0x60/0xd0 fs/read_write.c:686
       do_syscall_64+0x50/0x1c0 arch/x86/entry/syscall_64.c:63
       </TASK>
    
    To trigger gso segment in udp_queue_rcv_skb(), we should also set option
    UDP_ENCAP_ESPINUDP to enable udp_sk(sk)->encap_rcv. When the encap_rcv
    hook return 1 in udp_queue_rcv_one_skb(), udp_csum_pull_header() will try
    to pull udphdr, but the skb size has been segmented to gso size, which
    leads to this crash.
    
    Previous commit cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
    introduces segmentation in UDP receive path only for GRO, which was never
    intended to be used for UFO, so drop UFO packets in udp_rcv_segment().
    
    Link: https://lore.kernel.org/netdev/20250724083005.3918375-1-wangliang74@huawei.com/
    Link: https://lore.kernel.org/netdev/20250729123907.3318425-1-wangliang74@huawei.com/
    Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
    Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
    Signed-off-by: Wang Liang <wangliang74@huawei.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20250730101458.3470788-1-wangliang74@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: b53: fix b53_imp_vlan_setup for BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date:   Sat Jun 14 09:59:59 2025 +0200

    net: dsa: b53: fix b53_imp_vlan_setup for BCM5325
    
    [ Upstream commit c00df1018791185ea398f78af415a2a0aaa0c79c ]
    
    CPU port should be B53_CPU_PORT instead of B53_CPU_PORT_25 for
    B53_PVLAN_PORT_MASK register.
    
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
    Link: https://patch.msgid.link/20250614080000.1884236-14-noltari@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: b53: fix IP_MULTICAST_CTRL on BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date:   Sat Jun 14 09:59:54 2025 +0200

    net: dsa: b53: fix IP_MULTICAST_CTRL on BCM5325
    
    [ Upstream commit 044d5ce2788b165798bfd173548e61bf7b6baf4d ]
    
    BCM5325 doesn't implement B53_UC_FWD_EN, B53_MC_FWD_EN or B53_IPMC_FWD_EN.
    
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
    Link: https://patch.msgid.link/20250614080000.1884236-9-noltari@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: b53: prevent GMII_PORT_OVERRIDE_CTRL access on BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date:   Sat Jun 14 09:59:57 2025 +0200

    net: dsa: b53: prevent GMII_PORT_OVERRIDE_CTRL access on BCM5325
    
    [ Upstream commit 37883bbc45a8555d6eca88d3a9730504d2dac86c ]
    
    BCM5325 doesn't implement GMII_PORT_OVERRIDE_CTRL register so we should
    avoid reading or writing it.
    PORT_OVERRIDE_RX_FLOW and PORT_OVERRIDE_TX_FLOW aren't defined on BCM5325
    and we should use PORT_OVERRIDE_LP_FLOW_25 instead.
    
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
    Link: https://patch.msgid.link/20250614080000.1884236-12-noltari@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: b53: prevent SWITCH_CTRL access on BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date:   Sat Jun 14 09:59:53 2025 +0200

    net: dsa: b53: prevent SWITCH_CTRL access on BCM5325
    
    [ Upstream commit 22ccaaca43440e90a3b68d2183045b42247dc4be ]
    
    BCM5325 doesn't implement SWITCH_CTRL register so we should avoid reading
    or writing it.
    
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
    Link: https://patch.msgid.link/20250614080000.1884236-8-noltari@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: emaclite: Fix missing pointer increment in aligned_read() [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Thu Jul 10 10:38:46 2025 -0700

    net: emaclite: Fix missing pointer increment in aligned_read()
    
    [ Upstream commit 7727ec1523d7973defa1dff8f9c0aad288d04008 ]
    
    Add missing post-increment operators for byte pointers in the
    loop that copies remaining bytes in xemaclite_aligned_read().
    Without the increment, the same byte was written repeatedly
    to the destination.
    This update aligns with xemaclite_aligned_write()
    
    Fixes: bb81b2ddfa19 ("net: add Xilinx emac lite device driver")
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Link: https://patch.msgid.link/20250710173849.2381003-1-alok.a.tiwari@oracle.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: fec: allow disable coalescing [+ + +]
Author: Jonas Rebmann <jre@pengutronix.de>
Date:   Thu Jun 26 15:44:02 2025 +0200

    net: fec: allow disable coalescing
    
    [ Upstream commit b7ad21258f9e9a7f58b19595d5ceed2cde3bed68 ]
    
    In the current implementation, IP coalescing is always enabled and
    cannot be disabled.
    
    As setting maximum frames to 0 or 1, or setting delay to zero implies
    immediate delivery of single packets/IRQs, disable coalescing in
    hardware in these cases.
    
    This also guarantees that coalescing is never enabled with ICFT or ICTT
    set to zero, a configuration that could lead to unpredictable behaviour
    according to i.MX8MP reference manual.
    
    Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
    Reviewed-by: Wei Fang <wei.fang@nxp.com>
    Link: https://patch.msgid.link/20250626-fec_deactivate_coalescing-v2-1-0b217f2e80da@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: gianfar: fix device leak when querying time stamp info [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Fri Jul 25 19:12:11 2025 +0200

    net: gianfar: fix device leak when querying time stamp info
    
    commit da717540acd34e5056e3fa35791d50f6b3303f55 upstream.
    
    Make sure to drop the reference to the ptp device taken by
    of_find_device_by_node() when querying the time stamping capabilities.
    
    Note that holding a reference to the ptp device does not prevent its
    driver data from going away.
    
    Fixes: 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")
    Cc: stable@vger.kernel.org      # 4.18
    Cc: Yangbo Lu <yangbo.lu@nxp.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250725171213.880-4-johan@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: hns3: fixed vf get max channels bug [+ + +]
Author: Jian Shen <shenjian15@huawei.com>
Date:   Tue Jul 22 20:54:22 2025 +0800

    net: hns3: fixed vf get max channels bug
    
    [ Upstream commit b3e75c0bcc53f647311960bc1b0970b9b480ca5a ]
    
    Currently, the queried maximum of vf channels is the maximum of channels
    supported by each TC. However, the actual maximum of channels is
    the maximum of channels supported by the device.
    
    Fixes: 849e46077689 ("net: hns3: add ethtool_ops.get_channels support for VF")
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Hao Lan <lanhao@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250722125423.1270673-4-shaojijie@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: refine the struct hane3_tc_info [+ + +]
Author: Jian Shen <shenjian15@huawei.com>
Date:   Thu Dec 10 11:42:06 2020 +0800

    net: hns3: refine the struct hane3_tc_info
    
    [ Upstream commit 35244430d62422e96b4c9c9b4c00c0ebece91d73 ]
    
    Currently, there are multiple members related to tc information
    in struct hnae3_knic_private_info. Merge them into a new struct
    hnae3_tc_info.
    
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: b3e75c0bcc53 ("net: hns3: fixed vf get max channels bug")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv4: fix incorrect MTU in broadcast routes [+ + +]
Author: Oscar Maes <oscmaes92@gmail.com>
Date:   Thu Jul 10 16:27:13 2025 +0200

    net: ipv4: fix incorrect MTU in broadcast routes
    
    [ Upstream commit 9e30ecf23b1b8f091f7d08b27968dea83aae7908 ]
    
    Currently, __mkroute_output overrules the MTU value configured for
    broadcast routes.
    
    This buggy behaviour can be reproduced with:
    
    ip link set dev eth1 mtu 9000
    ip route del broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2
    ip route add broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2 mtu 1500
    
    The maximum packet size should be 1500, but it is actually 8000:
    
    ping -b 192.168.0.255 -s 8000
    
    Fix __mkroute_output to allow MTU values to be configured for
    for broadcast routes (to support a mixed-MTU local-area-network).
    
    Signed-off-by: Oscar Maes <oscmaes92@gmail.com>
    Link: https://patch.msgid.link/20250710142714.12986-1-oscmaes92@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ncsi: Fix buffer overflow in fetching version id [+ + +]
Author: Hari Kalavakunta <kalavakunta.hari.prasad@gmail.com>
Date:   Tue Jun 10 12:33:38 2025 -0700

    net: ncsi: Fix buffer overflow in fetching version id
    
    [ Upstream commit 8e16170ae972c7fed132bc928914a2ffb94690fc ]
    
    In NC-SI spec v1.2 section 8.4.44.2, the firmware name doesn't
    need to be null terminated while its size occupies the full size
    of the field. Fix the buffer overflow issue by adding one
    additional byte for null terminator.
    
    Signed-off-by: Hari Kalavakunta <kalavakunta.hari.prasad@gmail.com>
    Reviewed-by: Paul Fertser <fercerpav@gmail.com>
    Link: https://patch.msgid.link/20250610193338.1368-1-kalavakunta.hari.prasad@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: phy: smsc: add proper reset flags for LAN8710A [+ + +]
Author: Buday Csaba <buday.csaba@prolan.hu>
Date:   Mon Jul 28 17:29:16 2025 +0200

    net: phy: smsc: add proper reset flags for LAN8710A
    
    [ Upstream commit 57ec5a8735dc5dccd1ee68afdb1114956a3fce0d ]
    
    According to the LAN8710A datasheet (Rev. B, section 3.8.5.1), a hardware
    reset is required after power-on, and the reference clock (REF_CLK) must be
    established before asserting reset.
    
    Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>
    Cc: Csókás Bence <csokas.bence@prolan.hu>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250728152916.46249-2-csokas.bence@prolan.hu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: thunderx: Fix format-truncation warning in bgx_acpi_match_id() [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Fri Jul 11 07:05:30 2025 -0700

    net: thunderx: Fix format-truncation warning in bgx_acpi_match_id()
    
    [ Upstream commit 53d20606c40678d425cc03f0978c614dca51f25e ]
    
    The buffer bgx_sel used in snprintf() was too small to safely hold
    the formatted string "BGX%d" for all valid bgx_id values. This caused
    a -Wformat-truncation warning with `Werror` enabled during build.
    
    Increase the buffer size from 5 to 7 and use `sizeof(bgx_sel)` in
    snprintf() to ensure safety and suppress the warning.
    
    Build warning:
      CC      drivers/net/ethernet/cavium/thunder/thunder_bgx.o
      drivers/net/ethernet/cavium/thunder/thunder_bgx.c: In function
    ‘bgx_acpi_match_id’:
      drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1434:27: error: ‘%d’
    directive output may be truncated writing between 1 and 3 bytes into a
    region of size 2 [-Werror=format-truncation=]
        snprintf(bgx_sel, 5, "BGX%d", bgx->bgx_id);
                                 ^~
      drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1434:23: note:
    directive argument in the range [0, 255]
        snprintf(bgx_sel, 5, "BGX%d", bgx->bgx_id);
                             ^~~~~~~
      drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1434:2: note:
    ‘snprintf’ output between 5 and 7 bytes into a destination of size 5
        snprintf(bgx_sel, 5, "BGX%d", bgx->bgx_id);
    
    compiler warning due to insufficient snprintf buffer size.
    
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250711140532.2463602-1-alok.a.tiwari@oracle.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usbnet: Avoid potential RCU stall on LINK_CHANGE event [+ + +]
Author: John Ernberg <john.ernberg@actia.se>
Date:   Wed Aug 13 09:44:55 2025 -0400

    net: usbnet: Avoid potential RCU stall on LINK_CHANGE event
    
    [ Upstream commit 0d9cfc9b8cb17dbc29a98792d36ec39a1cf1395f ]
    
    The Gemalto Cinterion PLS83-W modem (cdc_ether) is emitting confusing link
    up and down events when the WWAN interface is activated on the modem-side.
    
    Interrupt URBs will in consecutive polls grab:
    * Link Connected
    * Link Disconnected
    * Link Connected
    
    Where the last Connected is then a stable link state.
    
    When the system is under load this may cause the unlink_urbs() work in
    __handle_link_change() to not complete before the next usbnet_link_change()
    call turns the carrier on again, allowing rx_submit() to queue new SKBs.
    
    In that event the URB queue is filled faster than it can drain, ending up
    in a RCU stall:
    
        rcu: INFO: rcu_sched detected expedited stalls on CPUs/tasks: { 0-.... } 33108 jiffies s: 201 root: 0x1/.
        rcu: blocking rcu_node structures (internal RCU debug):
        Sending NMI from CPU 1 to CPUs 0:
        NMI backtrace for cpu 0
    
        Call trace:
         arch_local_irq_enable+0x4/0x8
         local_bh_enable+0x18/0x20
         __netdev_alloc_skb+0x18c/0x1cc
         rx_submit+0x68/0x1f8 [usbnet]
         rx_alloc_submit+0x4c/0x74 [usbnet]
         usbnet_bh+0x1d8/0x218 [usbnet]
         usbnet_bh_tasklet+0x10/0x18 [usbnet]
         tasklet_action_common+0xa8/0x110
         tasklet_action+0x2c/0x34
         handle_softirqs+0x2cc/0x3a0
         __do_softirq+0x10/0x18
         ____do_softirq+0xc/0x14
         call_on_irq_stack+0x24/0x34
         do_softirq_own_stack+0x18/0x20
         __irq_exit_rcu+0xa8/0xb8
         irq_exit_rcu+0xc/0x30
         el1_interrupt+0x34/0x48
         el1h_64_irq_handler+0x14/0x1c
         el1h_64_irq+0x68/0x6c
         _raw_spin_unlock_irqrestore+0x38/0x48
         xhci_urb_dequeue+0x1ac/0x45c [xhci_hcd]
         unlink1+0xd4/0xdc [usbcore]
         usb_hcd_unlink_urb+0x70/0xb0 [usbcore]
         usb_unlink_urb+0x24/0x44 [usbcore]
         unlink_urbs.constprop.0.isra.0+0x64/0xa8 [usbnet]
         __handle_link_change+0x34/0x70 [usbnet]
         usbnet_deferred_kevent+0x1c0/0x320 [usbnet]
         process_scheduled_works+0x2d0/0x48c
         worker_thread+0x150/0x1dc
         kthread+0xd8/0xe8
         ret_from_fork+0x10/0x20
    
    Get around the problem by delaying the carrier on to the scheduled work.
    
    This needs a new flag to keep track of the necessary action.
    
    The carrier ok check cannot be removed as it remains required for the
    LINK_RESET event flow.
    
    Fixes: 4b49f58fff00 ("usbnet: handle link change")
    Cc: stable@vger.kernel.org
    Signed-off-by: John Ernberg <john.ernberg@actia.se>
    Link: https://patch.msgid.link/20250723102526.1305339-1-john.ernberg@actia.se
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ adjust context in header ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: usbnet: Fix the wrong netif_carrier_on() call [+ + +]
Author: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Date:   Wed Aug 6 07:31:05 2025 +0700

    net: usbnet: Fix the wrong netif_carrier_on() call
    
    commit 8466d393700f9ccef68134d3349f4e0a087679b9 upstream.
    
    The commit referenced in the Fixes tag causes usbnet to malfunction
    (identified via git bisect). Post-commit, my external RJ45 LAN cable
    fails to connect. Linus also reported the same issue after pulling that
    commit.
    
    The code has a logic error: netif_carrier_on() is only called when the
    link is already on. Fix this by moving the netif_carrier_on() call
    outside the if-statement entirely. This ensures it is always called
    when EVENT_LINK_CARRIER_ON is set and properly clears it regardless
    of the link state.
    
    Cc: stable@vger.kernel.org
    Cc: Armando Budianto <sprite@gnuweeb.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/all/CAHk-=wjqL4uF0MG_c8+xHX1Vv8==sPYQrtzbdA3kzi96284nuQ@mail.gmail.com
    Closes: https://lore.kernel.org/netdev/CAHk-=wjKh8X4PT_mU1kD4GQrbjivMfPn-_hXa6han_BTDcXddw@mail.gmail.com
    Closes: https://lore.kernel.org/netdev/0752dee6-43d6-4e1f-81d2-4248142cccd2@gnuweeb.org
    Fixes: 0d9cfc9b8cb1 ("net: usbnet: Avoid potential RCU stall on LINK_CHANGE event")
    Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime [+ + +]
Author: Dong Chenchen <dongchenchen2@huawei.com>
Date:   Wed Jul 16 11:45:03 2025 +0800

    net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime
    
    [ Upstream commit 579d4f9ca9a9a605184a9b162355f6ba131f678d ]
    
    Assuming the "rx-vlan-filter" feature is enabled on a net device, the
    8021q module will automatically add or remove VLAN 0 when the net device
    is put administratively up or down, respectively. There are a couple of
    problems with the above scheme.
    
    The first problem is a memory leak that can happen if the "rx-vlan-filter"
    feature is disabled while the device is running:
    
     # ip link add bond1 up type bond mode 0
     # ethtool -K bond1 rx-vlan-filter off
     # ip link del dev bond1
    
    When the device is put administratively down the "rx-vlan-filter"
    feature is disabled, so the 8021q module will not remove VLAN 0 and the
    memory will be leaked [1].
    
    Another problem that can happen is that the kernel can automatically
    delete VLAN 0 when the device is put administratively down despite not
    adding it when the device was put administratively up since during that
    time the "rx-vlan-filter" feature was disabled. null-ptr-unref or
    bug_on[2] will be triggered by unregister_vlan_dev() for refcount
    imbalance if toggling filtering during runtime:
    
    $ ip link add bond0 type bond mode 0
    $ ip link add link bond0 name vlan0 type vlan id 0 protocol 802.1q
    $ ethtool -K bond0 rx-vlan-filter off
    $ ifconfig bond0 up
    $ ethtool -K bond0 rx-vlan-filter on
    $ ifconfig bond0 down
    $ ip link del vlan0
    
    Root cause is as below:
    step1: add vlan0 for real_dev, such as bond, team.
    register_vlan_dev
        vlan_vid_add(real_dev,htons(ETH_P_8021Q),0) //refcnt=1
    step2: disable vlan filter feature and enable real_dev
    step3: change filter from 0 to 1
    vlan_device_event
        vlan_filter_push_vids
            ndo_vlan_rx_add_vid //No refcnt added to real_dev vlan0
    step4: real_dev down
    vlan_device_event
        vlan_vid_del(dev, htons(ETH_P_8021Q), 0); //refcnt=0
            vlan_info_rcu_free //free vlan0
    step5: delete vlan0
    unregister_vlan_dev
        BUG_ON(!vlan_info); //vlan_info is null
    
    Fix both problems by noting in the VLAN info whether VLAN 0 was
    automatically added upon NETDEV_UP and based on that decide whether it
    should be deleted upon NETDEV_DOWN, regardless of the state of the
    "rx-vlan-filter" feature.
    
    [1]
    unreferenced object 0xffff8880068e3100 (size 256):
      comm "ip", pid 384, jiffies 4296130254
      hex dump (first 32 bytes):
        00 20 30 0d 80 88 ff ff 00 00 00 00 00 00 00 00  . 0.............
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace (crc 81ce31fa):
        __kmalloc_cache_noprof+0x2b5/0x340
        vlan_vid_add+0x434/0x940
        vlan_device_event.cold+0x75/0xa8
        notifier_call_chain+0xca/0x150
        __dev_notify_flags+0xe3/0x250
        rtnl_configure_link+0x193/0x260
        rtnl_newlink_create+0x383/0x8e0
        __rtnl_newlink+0x22c/0xa40
        rtnl_newlink+0x627/0xb00
        rtnetlink_rcv_msg+0x6fb/0xb70
        netlink_rcv_skb+0x11f/0x350
        netlink_unicast+0x426/0x710
        netlink_sendmsg+0x75a/0xc20
        __sock_sendmsg+0xc1/0x150
        ____sys_sendmsg+0x5aa/0x7b0
        ___sys_sendmsg+0xfc/0x180
    
    [2]
    kernel BUG at net/8021q/vlan.c:99!
    Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
    CPU: 0 UID: 0 PID: 382 Comm: ip Not tainted 6.16.0-rc3 #61 PREEMPT(voluntary)
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    RIP: 0010:unregister_vlan_dev (net/8021q/vlan.c:99 (discriminator 1))
    RSP: 0018:ffff88810badf310 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: ffff88810da84000 RCX: ffffffffb47ceb9a
    RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88810e8b43c8
    RBP: 0000000000000000 R08: 0000000000000000 R09: fffffbfff6cefe80
    R10: ffffffffb677f407 R11: ffff88810badf3c0 R12: ffff88810e8b4000
    R13: 0000000000000000 R14: ffff88810642a5c0 R15: 000000000000017e
    FS:  00007f1ff68c20c0(0000) GS:ffff888163a24000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f1ff5dad240 CR3: 0000000107e56000 CR4: 00000000000006f0
    Call Trace:
     <TASK>
    rtnl_dellink (net/core/rtnetlink.c:3511 net/core/rtnetlink.c:3553)
    rtnetlink_rcv_msg (net/core/rtnetlink.c:6945)
    netlink_rcv_skb (net/netlink/af_netlink.c:2535)
    netlink_unicast (net/netlink/af_netlink.c:1314 net/netlink/af_netlink.c:1339)
    netlink_sendmsg (net/netlink/af_netlink.c:1883)
    ____sys_sendmsg (net/socket.c:712 net/socket.c:727 net/socket.c:2566)
    ___sys_sendmsg (net/socket.c:2622)
    __sys_sendmsg (net/socket.c:2652)
    do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
    
    Fixes: ad1afb003939 ("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)")
    Reported-by: syzbot+a8b046e462915c65b10b@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=a8b046e462915c65b10b
    Suggested-by: Ido Schimmel <idosch@idosch.org>
    Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20250716034504.2285203-2-dongchenchen2@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: vlan: Replace BUG() with WARN_ON_ONCE() in vlan_dev_* stubs [+ + +]
Author: Gal Pressman <gal@nvidia.com>
Date:   Mon Jun 16 16:26:25 2025 +0300

    net: vlan: Replace BUG() with WARN_ON_ONCE() in vlan_dev_* stubs
    
    [ Upstream commit 60a8b1a5d0824afda869f18dc0ecfe72f8dfda42 ]
    
    When CONFIG_VLAN_8021Q=n, a set of stub helpers are used, three of these
    helpers use BUG() unconditionally.
    
    This code should not be reached, as callers of these functions should
    always check for is_vlan_dev() first, but the usage of BUG() is not
    recommended, replace it with WARN_ON() instead.
    
    Reviewed-by: Alex Lazar <alazar@nvidia.com>
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Gal Pressman <gal@nvidia.com>
    Link: https://patch.msgid.link/20250616132626.1749331-3-gal@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net_sched: act_ctinfo: use atomic64_t for three counters [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Jul 9 09:01:57 2025 +0000

    net_sched: act_ctinfo: use atomic64_t for three counters
    
    [ Upstream commit d300335b4e18672913dd792ff9f49e6cccf41d26 ]
    
    Commit 21c167aa0ba9 ("net/sched: act_ctinfo: use percpu stats")
    missed that stats_dscp_set, stats_dscp_error and stats_cpmark_set
    might be written (and read) locklessly.
    
    Use atomic64_t for these three fields, I doubt act_ctinfo is used
    heavily on big SMP hosts anyway.
    
    Fixes: 24ec483cec98 ("net: sched: Introduce act_ctinfo action")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Pedro Tammela <pctammela@mojatatu.com>
    Link: https://patch.msgid.link/20250709090204.797558-6-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net_sched: sch_ets: implement lockless ets_dump() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Aug 19 10:32:52 2025 -0400

    net_sched: sch_ets: implement lockless ets_dump()
    
    [ Upstream commit c5f1dde7f731e7bf2e7c169ca42cb4989fc2f8b9 ]
    
    Instead of relying on RTNL, ets_dump() can use READ_ONCE()
    annotations, paired with WRITE_ONCE() ones in ets_change().
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 87c6efc5ce9c ("net/sched: ets: use old 'nbands' while purging unused classes")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: ctnetlink: fix refcount leak on table dump [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Aug 1 17:25:08 2025 +0200

    netfilter: ctnetlink: fix refcount leak on table dump
    
    [ Upstream commit de788b2e6227462b6dcd0e07474e72c089008f74 ]
    
    There is a reference count leak in ctnetlink_dump_table():
          if (res < 0) {
                    nf_conntrack_get(&ct->ct_general); // HERE
                    cb->args[1] = (unsigned long)ct;
                    ...
    
    While its very unlikely, its possible that ct == last.
    If this happens, then the refcount of ct was already incremented.
    This 2nd increment is never undone.
    
    This prevents the conntrack object from being released, which in turn
    keeps prevents cnet->count from dropping back to 0.
    
    This will then block the netns dismantle (or conntrack rmmod) as
    nf_conntrack_cleanup_net_list() will wait forever.
    
    This can be reproduced by running conntrack_resize.sh selftest in a loop.
    It takes ~20 minutes for me on a preemptible kernel on average before
    I see a runaway kworker spinning in nf_conntrack_cleanup_net_list.
    
    One fix would to change this to:
            if (res < 0) {
                    if (ct != last)
                            nf_conntrack_get(&ct->ct_general);
    
    But this reference counting isn't needed in the first place.
    We can just store a cookie value instead.
    
    A followup patch will do the same for ctnetlink_exp_dump_table,
    it looks to me as if this has the same problem and like
    ctnetlink_dump_table, we only need a 'skip hint', not the actual
    object so we can apply the same cookie strategy there as well.
    
    Fixes: d205dc40798d ("[NETFILTER]: ctnetlink: fix deadlock in table dumping")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_reject: don't leak dst refcount for loopback packets [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Wed Aug 20 14:37:07 2025 +0200

    netfilter: nf_reject: don't leak dst refcount for loopback packets
    
    [ Upstream commit 91a79b792204313153e1bdbbe5acbfc28903b3a5 ]
    
    recent patches to add a WARN() when replacing skb dst entry found an
    old bug:
    
    WARNING: include/linux/skbuff.h:1165 skb_dst_check_unset include/linux/skbuff.h:1164 [inline]
    WARNING: include/linux/skbuff.h:1165 skb_dst_set include/linux/skbuff.h:1210 [inline]
    WARNING: include/linux/skbuff.h:1165 nf_reject_fill_skb_dst+0x2a4/0x330 net/ipv4/netfilter/nf_reject_ipv4.c:234
    [..]
    Call Trace:
     nf_send_unreach+0x17b/0x6e0 net/ipv4/netfilter/nf_reject_ipv4.c:325
     nft_reject_inet_eval+0x4bc/0x690 net/netfilter/nft_reject_inet.c:27
     expr_call_ops_eval net/netfilter/nf_tables_core.c:237 [inline]
     ..
    
    This is because blamed commit forgot about loopback packets.
    Such packets already have a dst_entry attached, even at PRE_ROUTING stage.
    
    Instead of checking hook just check if the skb already has a route
    attached to it.
    
    Fixes: f53b9b0bdc59 ("netfilter: introduce support for reject at prerouting stage")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Link: https://patch.msgid.link/20250820123707.10671-1-fw@strlen.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_tables: adjust lockdep assertions handling [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
Date:   Tue Jun 24 14:12:15 2025 +0300

    netfilter: nf_tables: adjust lockdep assertions handling
    
    [ Upstream commit 8df1b40de76979bb8e975201d07b71103d5de820 ]
    
    It's needed to check the return value of lockdep_commit_lock_is_held(),
    otherwise there's no point in this assertion as it doesn't print any
    debug information on itself.
    
    Found by Linux Verification Center (linuxtesting.org) with Svace static
    analysis tool.
    
    Fixes: b04df3da1b5c ("netfilter: nf_tables: do not defer rule destruction via call_rcu")
    Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Acked-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nft_reject: unify reject init and dump into nft_reject [+ + +]
Author: Jose M. Guisado Gomez <guigom@riseup.net>
Date:   Thu Oct 22 21:43:52 2020 +0200

    netfilter: nft_reject: unify reject init and dump into nft_reject
    
    [ Upstream commit 312ca575a50543a886a5dfa2af1e72aa6a5b601e ]
    
    Bridge family is using the same static init and dump function as inet.
    
    This patch removes duplicate code unifying these functions body into
    nft_reject.c so they can be reused in the rest of families supporting
    reject verdict.
    
    Signed-off-by: Jose M. Guisado Gomez <guigom@riseup.net>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Stable-dep-of: 91a79b792204 ("netfilter: nf_reject: don't leak dst refcount for loopback packets")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nft_reject_inet: allow to use reject from inet ingress [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Sat Oct 31 11:24:08 2020 +0100

    netfilter: nft_reject_inet: allow to use reject from inet ingress
    
    [ Upstream commit 117ca1f8920cf4087bf82f44bd2a51b49d6aae63 ]
    
    Enhance validation to support for reject from inet ingress chains.
    
    Note that, reject from inet ingress and netdev ingress differ.
    
    Reject packets from inet ingress are sent through ip_local_out() since
    inet reject emulates the IP layer receive path. So the reject packet
    follows to classic IP output and postrouting paths.
    
    The reject action from netdev ingress assumes the packet not yet entered
    the IP layer, so the reject packet is sent through dev_queue_xmit().
    Therefore, reject packets from netdev ingress do not follow the classic
    IP output and postrouting paths.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Stable-dep-of: 91a79b792204 ("netfilter: nf_reject: don't leak dst refcount for loopback packets")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: xt_nfacct: don't assume acct name is null-terminated [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Jul 18 13:27:13 2025 +0200

    netfilter: xt_nfacct: don't assume acct name is null-terminated
    
    [ Upstream commit bf58e667af7d96c8eb9411f926a0a0955f41ce21 ]
    
    BUG: KASAN: slab-out-of-bounds in .. lib/vsprintf.c:721
    Read of size 1 at addr ffff88801eac95c8 by task syz-executor183/5851
    [..]
     string+0x231/0x2b0 lib/vsprintf.c:721
     vsnprintf+0x739/0xf00 lib/vsprintf.c:2874
     [..]
     nfacct_mt_checkentry+0xd2/0xe0 net/netfilter/xt_nfacct.c:41
     xt_check_match+0x3d1/0xab0 net/netfilter/x_tables.c:523
    
    nfnl_acct_find_get() handles non-null input, but the error
    printk relied on its presence.
    
    Reported-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4ff165b9251e4d295690
    Tested-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com
    Fixes: ceb98d03eac5 ("netfilter: xtables: add nfacct match to support extended accounting")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netlink: avoid infinite retry looping in netlink_unicast() [+ + +]
Author: Fedor Pchelkin <pchelkin@ispras.ru>
Date:   Mon Jul 28 11:06:47 2025 +0300

    netlink: avoid infinite retry looping in netlink_unicast()
    
    commit 759dfc7d04bab1b0b86113f1164dc1fec192b859 upstream.
    
    netlink_attachskb() checks for the socket's read memory allocation
    constraints. Firstly, it has:
    
      rmem < READ_ONCE(sk->sk_rcvbuf)
    
    to check if the just increased rmem value fits into the socket's receive
    buffer. If not, it proceeds and tries to wait for the memory under:
    
      rmem + skb->truesize > READ_ONCE(sk->sk_rcvbuf)
    
    The checks don't cover the case when skb->truesize + sk->sk_rmem_alloc is
    equal to sk->sk_rcvbuf. Thus the function neither successfully accepts
    these conditions, nor manages to reschedule the task - and is called in
    retry loop for indefinite time which is caught as:
    
      rcu: INFO: rcu_sched self-detected stall on CPU
      rcu:     0-....: (25999 ticks this GP) idle=ef2/1/0x4000000000000000 softirq=262269/262269 fqs=6212
      (t=26000 jiffies g=230833 q=259957)
      NMI backtrace for cpu 0
      CPU: 0 PID: 22 Comm: kauditd Not tainted 5.10.240 #68
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-4.fc42 04/01/2014
      Call Trace:
      <IRQ>
      dump_stack lib/dump_stack.c:120
      nmi_cpu_backtrace.cold lib/nmi_backtrace.c:105
      nmi_trigger_cpumask_backtrace lib/nmi_backtrace.c:62
      rcu_dump_cpu_stacks kernel/rcu/tree_stall.h:335
      rcu_sched_clock_irq.cold kernel/rcu/tree.c:2590
      update_process_times kernel/time/timer.c:1953
      tick_sched_handle kernel/time/tick-sched.c:227
      tick_sched_timer kernel/time/tick-sched.c:1399
      __hrtimer_run_queues kernel/time/hrtimer.c:1652
      hrtimer_interrupt kernel/time/hrtimer.c:1717
      __sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1113
      asm_call_irq_on_stack arch/x86/entry/entry_64.S:808
      </IRQ>
    
      netlink_attachskb net/netlink/af_netlink.c:1234
      netlink_unicast net/netlink/af_netlink.c:1349
      kauditd_send_queue kernel/audit.c:776
      kauditd_thread kernel/audit.c:897
      kthread kernel/kthread.c:328
      ret_from_fork arch/x86/entry/entry_64.S:304
    
    Restore the original behavior of the check which commit in Fixes
    accidentally missed when restructuring the code.
    
    Found by Linux Verification Center (linuxtesting.org).
    
    Fixes: ae8f160e7eb2 ("netlink: Fix wraparounds of sk->sk_rmem_alloc.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20250728080727.255138-1-pchelkin@ispras.ru
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netmem: fix skb_frag_address_safe with unreadable skbs [+ + +]
Author: Mina Almasry <almasrymina@google.com>
Date:   Thu Jun 19 17:52:38 2025 +0000

    netmem: fix skb_frag_address_safe with unreadable skbs
    
    [ Upstream commit 4672aec56d2e8edabcb74c3e2320301d106a377e ]
    
    skb_frag_address_safe() needs a check that the
    skb_frag_page exists check similar to skb_frag_address().
    
    Cc: ap420073@gmail.com
    
    Signed-off-by: Mina Almasry <almasrymina@google.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20250619175239.3039329-1-almasrymina@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netpoll: prevent hanging NAPI when netcons gets enabled [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Jul 25 18:08:46 2025 -0700

    netpoll: prevent hanging NAPI when netcons gets enabled
    
    [ Upstream commit 2da4def0f487f24bbb0cece3bb2bcdcb918a0b72 ]
    
    Paolo spotted hangs in NIPA running driver tests against virtio.
    The tests hang in virtnet_close() -> virtnet_napi_tx_disable().
    
    The problem is only reproducible if running multiple of our tests
    in sequence (I used TEST_PROGS="xdp.py ping.py netcons_basic.sh \
    netpoll_basic.py stats.py"). Initial suspicion was that this is
    a simple case of double-disable of NAPI, but instrumenting the
    code reveals:
    
     Deadlocked on NAPI ffff888007cd82c0 (virtnet_poll_tx):
       state: 0x37, disabled: false, owner: 0, listed: false, weight: 64
    
    The NAPI was not in fact disabled, owner is 0 (rather than -1),
    so the NAPI "thinks" it's scheduled for CPU 0 but it's not listed
    (!list_empty(&n->poll_list) => false). It seems odd that normal NAPI
    processing would wedge itself like this.
    
    Better suspicion is that netpoll gets enabled while NAPI is polling,
    and also grabs the NAPI instance. This confuses napi_complete_done():
    
      [netpoll]                                   [normal NAPI]
                                            napi_poll()
                                              have = netpoll_poll_lock()
                                                rcu_access_pointer(dev->npinfo)
                                                  return NULL # no netpoll
                                              __napi_poll()
                                                ->poll(->weight)
      poll_napi()
        cmpxchg(->poll_owner, -1, cpu)
          poll_one_napi()
            set_bit(NAPI_STATE_NPSVC, ->state)
                                                  napi_complete_done()
                                                    if (NAPIF_STATE_NPSVC)
                                                      return false
                                               # exit without clearing SCHED
    
    This feels very unlikely, but perhaps virtio has some interactions
    with the hypervisor in the NAPI ->poll that makes the race window
    larger?
    
    Best I could to to prove the theory was to add and trigger this
    warning in napi_poll (just before netpoll_poll_unlock()):
    
          WARN_ONCE(!have && rcu_access_pointer(n->dev->npinfo) &&
                    napi_is_scheduled(n) && list_empty(&n->poll_list),
                    "NAPI race with netpoll %px", n);
    
    If this warning hits the next virtio_close() will hang.
    
    This patch survived 30 test iterations without a hang (without it
    the longest clean run was around 10). Credit for triggering this
    goes to Breno's recent netconsole tests.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Paolo Abeni <pabeni@redhat.com>
    Link: https://lore.kernel.org/c5a93ed1-9abe-4880-a3bb-8d1678018b1d@redhat.com
    Acked-by: Jason Wang <jasowang@redhat.com>
    Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
    Link: https://patch.msgid.link/20250726010846.1105875-1-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFS: Create an nfs4_server_set_init_caps() function [+ + +]
Author: Anna Schumaker <Anna.Schumaker@Netapp.com>
Date:   Fri Aug 15 16:47:30 2025 -0400

    NFS: Create an nfs4_server_set_init_caps() function
    
    [ Upstream commit 01dde76e471229e3437a2686c572f4980b2c483e ]
    
    And call it before doing an FSINFO probe to reset to the baseline
    capabilities before probing.
    
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Stable-dep-of: b01f21cacde9 ("NFS: Fix the setting of capabilities when automounting a new filesystem")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

NFS: Don't set NFS_INO_REVAL_PAGECACHE in the inode cache validity [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Fri Aug 15 16:47:28 2025 -0400

    NFS: Don't set NFS_INO_REVAL_PAGECACHE in the inode cache validity
    
    [ Upstream commit 36a9346c225270262d9f34e66c91aa1723fa903f ]
    
    It is no longer necessary to preserve the NFS_INO_REVAL_PAGECACHE flag.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Stable-dep-of: b01f21cacde9 ("NFS: Fix the setting of capabilities when automounting a new filesystem")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

NFS: Fix filehandle bounds checking in nfs_fh_to_dentry() [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Tue Jul 22 09:24:58 2025 -0400

    NFS: Fix filehandle bounds checking in nfs_fh_to_dentry()
    
    [ Upstream commit ef93a685e01a281b5e2a25ce4e3428cf9371a205 ]
    
    The function needs to check the minimal filehandle length before it can
    access the embedded filehandle.
    
    Reported-by: zhangjian <zhangjian496@huawei.com>
    Fixes: 20fa19027286 ("nfs: add export operations")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

NFS: Fix the setting of capabilities when automounting a new filesystem [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Fri Aug 15 16:47:31 2025 -0400

    NFS: Fix the setting of capabilities when automounting a new filesystem
    
    [ Upstream commit b01f21cacde9f2878492cf318fee61bf4ccad323 ]
    
    Capabilities cannot be inherited when we cross into a new filesystem.
    They need to be reset to the minimal defaults, and then probed for
    again.
    
    Fixes: 54ceac451598 ("NFS: Share NFS superblocks per-protocol per-server per-FSID")
    Cc: stable@vger.kernel.org
    Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    [ Removed extended capability flags that don't exist in older trees ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY [+ + +]
Author: Benjamin Coddington <bcodding@redhat.com>
Date:   Wed Jul 9 21:47:43 2025 -0400

    NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY
    
    [ Upstream commit 99765233ab42bf7a4950377ad7894dce8a5c0e60 ]
    
    If the NFS client is doing writeback from a workqueue context, avoid using
    __GFP_NORETRY for allocations if the task has set PF_MEMALLOC_NOIO or
    PF_MEMALLOC_NOFS.  The combination of these flags makes memory allocation
    failures much more likely.
    
    We've seen those allocation failures show up when the loopback driver is
    doing writeback from a workqueue to a file on NFS, where memory allocation
    failure results in errors or corruption within the loopback device's
    filesystem.
    
    Suggested-by: Trond Myklebust <trondmy@kernel.org>
    Fixes: 0bae835b63c5 ("NFS: Avoid writeback threads getting stuck in mempool_alloc()")
    Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
    Reviewed-by: Laurence Oberman <loberman@redhat.com>
    Tested-by: Laurence Oberman <loberman@redhat.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Link: https://lore.kernel.org/r/f83ac1155a4bc670f2663959a7a068571e06afd9.1752111622.git.bcodding@redhat.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFSD: detect mismatch of file handle and delegation stateid in OPEN op [+ + +]
Author: Dai Ngo <dai.ngo@oracle.com>
Date:   Tue Jun 10 08:35:28 2025 -0700

    NFSD: detect mismatch of file handle and delegation stateid in OPEN op
    
    commit 9c65001c57164033ad08b654c8b5ae35512ddf4a upstream.
    
    When the client sends an OPEN with claim type CLAIM_DELEG_CUR_FH or
    CLAIM_DELEGATION_CUR, the delegation stateid and the file handle
    must belong to the same file, otherwise return NFS4ERR_INVAL.
    
    Note that RFC8881, section 8.2.4, mandates the server to return
    NFS4ERR_BAD_STATEID if the selected table entry does not match the
    current filehandle. However returning NFS4ERR_BAD_STATEID in the
    OPEN causes the client to retry the operation and therefor get the
    client into a loop. To avoid this situation we return NFS4ERR_INVAL
    instead.
    
    Reported-by: Petro Pavlov <petro.pavlov@vastdata.com>
    Fixes: c44c5eeb2c02 ("[PATCH] nfsd4: add open state code for CLAIM_DELEGATE_CUR")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nfsd: handle get_client_locked() failure in nfsd4_setclientid_confirm() [+ + +]
Author: Jeff Layton <jlayton@kernel.org>
Date:   Wed Jun 4 12:01:10 2025 -0400

    nfsd: handle get_client_locked() failure in nfsd4_setclientid_confirm()
    
    commit 908e4ead7f757504d8b345452730636e298cbf68 upstream.
    
    Lei Lu recently reported that nfsd4_setclientid_confirm() did not check
    the return value from get_client_locked(). a SETCLIENTID_CONFIRM could
    race with a confirmed client expiring and fail to get a reference. That
    could later lead to a UAF.
    
    Fix this by getting a reference early in the case where there is an
    extant confirmed client. If that fails then treat it as if there were no
    confirmed client found at all.
    
    In the case where the unconfirmed client is expiring, just fail and
    return the result from get_client_locked().
    
    Reported-by: lei lu <llfamsec@gmail.com>
    Closes: https://lore.kernel.org/linux-nfs/CAEBF3_b=UvqzNKdnfD_52L05Mqrqui9vZ2eFamgAbV0WG+FNWQ@mail.gmail.com/
    Fixes: d20c11d86d8f ("nfsd: Protect session creation and client confirm using client_lock")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NFSv4.2: another fix for listxattr [+ + +]
Author: Olga Kornievskaia <okorniev@redhat.com>
Date:   Tue Jul 22 16:56:41 2025 -0400

    NFSv4.2: another fix for listxattr
    
    [ Upstream commit 9acb237deff7667b0f6b10fe6b1b70c4429ea049 ]
    
    Currently, when the server supports NFS4.1 security labels then
    security.selinux label in included twice. Instead, only add it
    when the server doesn't possess security label support.
    
    Fixes: 243fea134633 ("NFSv4.2: fix listxattr to return selinux security label")
    Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
    Link: https://lore.kernel.org/r/20250722205641.79394-1-okorniev@redhat.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFSv4: Fix nfs4_bitmap_copy_adjust() [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Fri Aug 15 16:47:29 2025 -0400

    NFSv4: Fix nfs4_bitmap_copy_adjust()
    
    [ Upstream commit a71029b86752e8d40301af235a6bbf4896cc1402 ]
    
    Don't remove flags from the set retrieved from the cache_validity.
    We do want to retrieve all attributes that are listed as being
    invalid, whether or not there is a delegation set.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Stable-dep-of: b01f21cacde9 ("NFS: Fix the setting of capabilities when automounting a new filesystem")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nilfs2: reject invalid file types when reading inodes [+ + +]
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Thu Jul 10 22:49:08 2025 +0900

    nilfs2: reject invalid file types when reading inodes
    
    commit 4aead50caf67e01020c8be1945c3201e8a972a27 upstream.
    
    To prevent inodes with invalid file types from tripping through the vfs
    and causing malfunctions or assertion failures, add a missing sanity check
    when reading an inode from a block device.  If the file type is not valid,
    treat it as a filesystem error.
    
    Link: https://lkml.kernel.org/r/20250710134952.29862-1-konishi.ryusuke@gmail.com
    Fixes: 05fe58fdc10d ("nilfs2: inode operations")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com
    Link: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
parisc: Makefile: fix a typo in palo.conf [+ + +]
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Wed Jun 25 00:39:33 2025 -0700

    parisc: Makefile: fix a typo in palo.conf
    
    commit 963f1b20a8d2a098954606b9725cd54336a2a86c upstream.
    
    Correct "objree" to "objtree". "objree" is not defined.
    
    Fixes: 75dd47472b92 ("kbuild: remove src and obj from the top Makefile")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: Masahiro Yamada <masahiroy@kernel.org>
    Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
    Cc: Helge Deller <deller@gmx.de>
    Cc: linux-parisc@vger.kernel.org
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org # v5.3+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pch_uart: Fix dma_sync_sg_for_device() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Tue Jul 1 13:34:52 2025 +0200

    pch_uart: Fix dma_sync_sg_for_device() nents value
    
    commit 6c0e9f05c9d7875995b0e92ace71be947f280bbd upstream.
    
    The dma_sync_sg_for_device() functions should be called with the same
    nents as the dma_map_sg(), not the value the map function returned
    according to the documentation in Documentation/core-api/dma-api.rst:450:
            With the sync_sg API, all the parameters must be the same
            as those passed into the sg mapping API.
    
    Fixes: da3564ee027e ("pch_uart: add multi-scatter processing")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20250701113452.18590-2-fourier.thomas@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Sun Aug 17 09:18:01 2025 -0400

    PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports
    
    [ Upstream commit 6cff20ce3b92ffbf2fc5eb9e5a030b3672aa414a ]
    
    pci_bridge_d3_possible() is called from both pcie_portdrv_probe() and
    pcie_portdrv_remove() to determine whether runtime power management shall
    be enabled (on probe) or disabled (on remove) on a PCIe port.
    
    The underlying assumption is that pci_bridge_d3_possible() always returns
    the same value, else a runtime PM reference imbalance would occur.  That
    assumption is not given if the PCIe port is inaccessible on remove due to
    hot-unplug:  pci_bridge_d3_possible() calls pciehp_is_native(), which
    accesses Config Space to determine whether the port is Hot-Plug Capable.
    An inaccessible port returns "all ones", which is converted to "all
    zeroes" by pcie_capability_read_dword().  Hence the port no longer seems
    Hot-Plug Capable on remove even though it was on probe.
    
    The resulting runtime PM ref imbalance causes warning messages such as:
    
      pcieport 0000:02:04.0: Runtime PM usage count underflow!
    
    Avoid the Config Space access (and thus the runtime PM ref imbalance) by
    caching the Hot-Plug Capable bit in struct pci_dev.
    
    The struct already contains an "is_hotplug_bridge" flag, which however is
    not only set on Hot-Plug Capable PCIe ports, but also Conventional PCI
    Hot-Plug bridges and ACPI slots.  The flag identifies bridges which are
    allocated additional MMIO and bus number resources to allow for hierarchy
    expansion.
    
    The kernel is somewhat sloppily using "is_hotplug_bridge" in a number of
    places to identify Hot-Plug Capable PCIe ports, even though the flag
    encompasses other devices.  Subsequent commits replace these occurrences
    with the new flag to clearly delineate Hot-Plug Capable PCIe ports from
    other kinds of hotplug bridges.
    
    Document the existing "is_hotplug_bridge" and the new "is_pciehp" flag
    and document the (non-obvious) requirement that pci_bridge_d3_possible()
    always returns the same value across the entire lifetime of a bridge,
    including its hot-removal.
    
    Fixes: 5352a44a561d ("PCI: pciehp: Make pciehp_is_native() stricter")
    Reported-by: Laurent Bigonville <bigon@bigon.be>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220216
    Reported-by: Mario Limonciello <mario.limonciello@amd.com>
    Closes: https://lore.kernel.org/r/20250609020223.269407-3-superm1@kernel.org/
    Link: https://lore.kernel.org/all/20250620025535.3425049-3-superm1@kernel.org/T/#u
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Rafael J. Wysocki <rafael@kernel.org>
    Cc: stable@vger.kernel.org # v4.18+
    Link: https://patch.msgid.link/fe5dcc3b2e62ee1df7905d746bde161eb1b3291c.1752390101.git.lukas@wunner.de
    [ Adjust surrounding documentation changes ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI: endpoint: Fix configfs group list head handling [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Tue Jun 24 20:45:43 2025 +0900

    PCI: endpoint: Fix configfs group list head handling
    
    commit d79123d79a8154b4318529b7b2ff7e15806f480b upstream.
    
    Doing a list_del() on the epf_group field of struct pci_epf_driver in
    pci_epf_remove_cfs() is not correct as this field is a list head, not
    a list entry. This list_del() call triggers a KASAN warning when an
    endpoint function driver which has a configfs attribute group is torn
    down:
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in pci_epf_remove_cfs+0x17c/0x198
    Write of size 8 at addr ffff00010f4a0d80 by task rmmod/319
    
    CPU: 3 UID: 0 PID: 319 Comm: rmmod Not tainted 6.16.0-rc2 #1 NONE
    Hardware name: Radxa ROCK 5B (DT)
    Call trace:
    show_stack+0x2c/0x84 (C)
    dump_stack_lvl+0x70/0x98
    print_report+0x17c/0x538
    kasan_report+0xb8/0x190
    __asan_report_store8_noabort+0x20/0x2c
    pci_epf_remove_cfs+0x17c/0x198
    pci_epf_unregister_driver+0x18/0x30
    nvmet_pci_epf_cleanup_module+0x24/0x30 [nvmet_pci_epf]
    __arm64_sys_delete_module+0x264/0x424
    invoke_syscall+0x70/0x260
    el0_svc_common.constprop.0+0xac/0x230
    do_el0_svc+0x40/0x58
    el0_svc+0x48/0xdc
    el0t_64_sync_handler+0x10c/0x138
    el0t_64_sync+0x198/0x19c
    ...
    
    Remove this incorrect list_del() call from pci_epf_remove_cfs().
    
    Fixes: ef1433f717a2 ("PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry")
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250624114544.342159-2-dlemoal@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: endpoint: Fix configfs group removal on driver teardown [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Tue Jun 24 20:45:44 2025 +0900

    PCI: endpoint: Fix configfs group removal on driver teardown
    
    commit 910bdb8197f9322790c738bb32feaa11dba26909 upstream.
    
    An endpoint driver configfs attributes group is added to the
    epf_group list of struct pci_epf_driver by pci_epf_add_cfs() but an
    added group is not removed from this list when the attribute group is
    unregistered with pci_ep_cfs_remove_epf_group().
    
    Add the missing list_del() call in pci_ep_cfs_remove_epf_group()
    to correctly remove the attribute group from the driver list.
    
    With this change, once the loop over all attribute groups in
    pci_epf_remove_cfs() completes, the driver epf_group list should be
    empty. Add a WARN_ON() to make sure of that.
    
    Fixes: ef1433f717a2 ("PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry")
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20250624114544.342159-3-dlemoal@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: pnv_php: Clean up allocated IRQs on unplug [+ + +]
Author: Timothy Pearson <tpearson@raptorengineering.com>
Date:   Tue Jul 15 16:36:07 2025 -0500

    PCI: pnv_php: Clean up allocated IRQs on unplug
    
    [ Upstream commit 4668619092554e1b95c9a5ac2941ca47ba6d548a ]
    
    When the root of a nested PCIe bridge configuration is unplugged, the
    pnv_php driver leaked the allocated IRQ resources for the child bridges'
    hotplug event notifications, resulting in a panic.
    
    Fix this by walking all child buses and deallocating all its IRQ resources
    before calling pci_hp_remove_devices().
    
    Also modify the lifetime of the workqueue at struct pnv_php_slot::wq so
    that it is only destroyed in pnv_php_free_slot(), instead of
    pnv_php_disable_irq(). This is required since pnv_php_disable_irq() will
    now be called by workers triggered by hot unplug interrupts, so the
    workqueue needs to stay allocated.
    
    The abridged kernel panic that occurs without this patch is as follows:
    
      WARNING: CPU: 0 PID: 687 at kernel/irq/msi.c:292 msi_device_data_release+0x6c/0x9c
      CPU: 0 UID: 0 PID: 687 Comm: bash Not tainted 6.14.0-rc5+ #2
      Call Trace:
       msi_device_data_release+0x34/0x9c (unreliable)
       release_nodes+0x64/0x13c
       devres_release_all+0xc0/0x140
       device_del+0x2d4/0x46c
       pci_destroy_dev+0x5c/0x194
       pci_hp_remove_devices+0x90/0x128
       pci_hp_remove_devices+0x44/0x128
       pnv_php_disable_slot+0x54/0xd4
       power_write_file+0xf8/0x18c
       pci_slot_attr_store+0x40/0x5c
       sysfs_kf_write+0x64/0x78
       kernfs_fop_write_iter+0x1b0/0x290
       vfs_write+0x3bc/0x50c
       ksys_write+0x84/0x140
       system_call_exception+0x124/0x230
       system_call_vectored_common+0x15c/0x2ec
    
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    [bhelgaas: tidy comments]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/2013845045.1359852.1752615367790.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: pnv_php: Fix surprise plug detection and recovery [+ + +]
Author: Timothy Pearson <tpearson@raptorengineering.com>
Date:   Tue Jul 15 16:39:06 2025 -0500

    PCI: pnv_php: Fix surprise plug detection and recovery
    
    [ Upstream commit a2a2a6fc2469524caa713036297c542746d148dc ]
    
    The existing PowerNV hotplug code did not handle surprise plug events
    correctly, leading to a complete failure of the hotplug system after device
    removal and a required reboot to detect new devices.
    
    This comes down to two issues:
    
     1) When a device is surprise removed, often the bridge upstream
        port will cause a PE freeze on the PHB.  If this freeze is not
        cleared, the MSI interrupts from the bridge hotplug notification
        logic will not be received by the kernel, stalling all plug events
        on all slots associated with the PE.
    
     2) When a device is removed from a slot, regardless of surprise or
        programmatic removal, the associated PHB/PE ls left frozen.
        If this freeze is not cleared via a fundamental reset, skiboot
        is unable to clear the freeze and cannot retrain / rescan the
        slot.  This also requires a reboot to clear the freeze and redetect
        the device in the slot.
    
    Issue the appropriate unfreeze and rescan commands on hotplug events,
    and don't oops on hotplug if pci_bus_to_OF_node() returns NULL.
    
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    [bhelgaas: tidy comments]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/171044224.1359864.1752615546988.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: pnv_php: Work around switches with broken presence detection [+ + +]
Author: Timothy Pearson <tpearson@raptorengineering.com>
Date:   Tue Jul 15 16:36:55 2025 -0500

    PCI: pnv_php: Work around switches with broken presence detection
    
    [ Upstream commit 80f9fc2362797538ebd4fd70a1dfa838cc2c2cdb ]
    
    The Microsemi Switchtec PM8533 PFX 48xG3 [11f8:8533] PCIe switch system
    was observed to incorrectly assert the Presence Detect Set bit in its
    capabilities when tested on a Raptor Computing Systems Blackbird system,
    resulting in the hot insert path never attempting a rescan of the bus
    and any downstream devices not being re-detected.
    
    Work around this by additionally checking whether the PCIe data link is
    active or not when performing presence detection on downstream switches'
    ports, similar to the pciehp_hpc.c driver.
    
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/505981576.1359853.1752615415117.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: rockchip-host: Fix "Unexpected Completion" log message [+ + +]
Author: Hans Zhang <18255117159@163.com>
Date:   Sun Jun 8 00:01:59 2025 +0800

    PCI: rockchip-host: Fix "Unexpected Completion" log message
    
    [ Upstream commit fcc5f586c4edbcc10de23fb9b8c0972a84e945cd ]
    
    Fix the debug message for the PCIE_CORE_INT_UCR interrupt to clearly
    indicate "Unexpected Completion" instead of a duplicate "malformed TLP"
    message.
    
    Fixes: e77f847df54c ("PCI: rockchip: Add Rockchip PCIe controller support")
    Signed-off-by: Hans Zhang <18255117159@163.com>
    [mani: added fixes tag]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
    Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
    Link: https://patch.msgid.link/20250607160201.807043-2-18255117159@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf tests bp_account: Fix leaked file descriptor [+ + +]
Author: Leo Yan <leo.yan@arm.com>
Date:   Fri Jul 11 12:10:15 2025 +0100

    perf tests bp_account: Fix leaked file descriptor
    
    [ Upstream commit 4a6cdecaa1497f1fbbd1d5307a225b6ca5a62a90 ]
    
    Since the commit e9846f5ead26 ("perf test: In forked mode add check that
    fds aren't leaked"), the test "Breakpoint accounting" reports the error:
    
      # perf test -vvv "Breakpoint accounting"
      20: Breakpoint accounting:
      --- start ---
      test child forked, pid 373
      failed opening event 0
      failed opening event 0
      watchpoints count 4, breakpoints count 6, has_ioctl 1, share 0
      wp 0 created
      wp 1 created
      wp 2 created
      wp 3 created
      wp 0 modified to bp
      wp max created
      ---- end(0) ----
      Leak of file descriptor 7 that opened: 'anon_inode:[perf_event]'
    
    A watchpoint's file descriptor was not properly released. This patch
    fixes the leak.
    
    Fixes: 032db28e5fa3 ("perf tests: Add breakpoint accounting/modify test")
    Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
    Signed-off-by: Leo Yan <leo.yan@arm.com>
    Reviewed-by: Ian Rogers <irogers@google.com>
    Link: https://lore.kernel.org/r/20250711-perf_fix_breakpoint_accounting-v1-1-b314393023f9@arm.com
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/core: Don't leak AUX buffer refcount on allocation failure [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Sat Aug 2 12:39:39 2025 +0200

    perf/core: Don't leak AUX buffer refcount on allocation failure
    
    commit 5468c0fbccbb9d156522c50832244a8b722374fb upstream.
    
    Failure of the AUX buffer allocation leaks the reference count.
    
    Set the reference count to 1 only when the allocation succeeds.
    
    Fixes: 45bfb2e50471 ("perf/core: Add AUX area to ring buffer for raw data streams")
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

perf/core: Exit early on perf_mmap() fail [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Sat Aug 2 12:49:48 2025 +0200

    perf/core: Exit early on perf_mmap() fail
    
    commit 07091aade394f690e7b655578140ef84d0e8d7b0 upstream.
    
    When perf_mmap() fails to allocate a buffer, it still invokes the
    event_mapped() callback of the related event. On X86 this might increase
    the perf_rdpmc_allowed reference counter. But nothing undoes this as
    perf_mmap_close() is never called in this case, which causes another
    reference count leak.
    
    Return early on failure to prevent that.
    
    Fixes: 1e0fb9ec679c ("perf/core: Add pmu callbacks to track event mapping and unmapping")
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

perf/core: Prevent VMA split of buffer mappings [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Jul 30 23:01:21 2025 +0200

    perf/core: Prevent VMA split of buffer mappings
    
    commit b024d7b56c77191cde544f838debb7f8451cd0d6 upstream.
    
    The perf mmap code is careful about mmap()'ing the user page with the
    ringbuffer and additionally the auxiliary buffer, when the event supports
    it. Once the first mapping is established, subsequent mapping have to use
    the same offset and the same size in both cases. The reference counting for
    the ringbuffer and the auxiliary buffer depends on this being correct.
    
    Though perf does not prevent that a related mapping is split via mmap(2),
    munmap(2) or mremap(2). A split of a VMA results in perf_mmap_open() calls,
    which take reference counts, but then the subsequent perf_mmap_close()
    calls are not longer fulfilling the offset and size checks. This leads to
    reference count leaks.
    
    As perf already has the requirement for subsequent mappings to match the
    initial mapping, the obvious consequence is that VMA splits, caused by
    resizing of a mapping or partial unmapping, have to be prevented.
    
    Implement the vm_operations_struct::may_split() callback and return
    unconditionally -EINVAL.
    
    That ensures that the mapping offsets and sizes cannot be changed after the
    fact. Remapping to a different fixed address with the same size is still
    possible as it takes the references for the new mapping and drops those of
    the old mapping.
    
    Fixes: 45bfb2e50471 ("perf/core: Add AUX area to ring buffer for raw data streams")
    Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-27504
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jul 15 16:15:40 2025 -0700

    phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept()
    
    commit 17ba793f381eb813596d6de1cc6820bcbda5ed8b upstream.
    
    A new warning in clang [1] points out a place in pep_sock_accept() where
    dst is uninitialized then passed as a const pointer to pep_find_pipe():
    
      net/phonet/pep.c:829:37: error: variable 'dst' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
        829 |         newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
            |                                            ^~~:
    
    Move the call to pn_skb_get_dst_sockaddr(), which initializes dst, to
    before the call to pep_find_pipe(), so that dst is consistently used
    initialized throughout the function.
    
    Cc: stable@vger.kernel.org
    Fixes: f7ae8d59f661 ("Phonet: allocate sock from accept syscall rather than soft IRQ")
    Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2101
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://patch.msgid.link/20250715-net-phonet-fix-uninit-const-pointer-v1-1-8efd1bd188b3@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
phy: mscc: Fix parsing of unicast frames [+ + +]
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Sat Jul 26 16:03:07 2025 +0200

    phy: mscc: Fix parsing of unicast frames
    
    [ Upstream commit 6fb5ff63b35b7e849cc8510957f25753f87f63d2 ]
    
    According to the 1588 standard, it is possible to use both unicast and
    multicast frames to send the PTP information. It was noticed that if the
    frames were unicast they were not processed by the analyzer meaning that
    they were not timestamped. Therefore fix this to match also these
    unicast frames.
    
    Fixes: ab2bf9339357 ("net: phy: mscc: 1588 block initialization")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250726140307.3039694-1-horatiu.vultur@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

phy: tegra: xusb: Fix unbalanced regulator disable in UTMI PHY mode [+ + +]
Author: Wayne Chang <waynec@nvidia.com>
Date:   Fri May 2 17:26:06 2025 +0800

    phy: tegra: xusb: Fix unbalanced regulator disable in UTMI PHY mode
    
    commit cefc1caee9dd06c69e2d807edc5949b329f52b22 upstream.
    
    When transitioning from USB_ROLE_DEVICE to USB_ROLE_NONE, the code
    assumed that the regulator should be disabled. However, if the regulator
    is marked as always-on, regulator_is_enabled() continues to return true,
    leading to an incorrect attempt to disable a regulator which is not
    enabled.
    
    This can result in warnings such as:
    
    [  250.155624] WARNING: CPU: 1 PID: 7326 at drivers/regulator/core.c:3004
    _regulator_disable+0xe4/0x1a0
    [  250.155652] unbalanced disables for VIN_SYS_5V0
    
    To fix this, we move the regulator control logic into
    tegra186_xusb_padctl_id_override() function since it's directly related
    to the ID override state. The regulator is now only disabled when the role
    transitions from USB_ROLE_HOST to USB_ROLE_NONE, by checking the VBUS_ID
    register. This ensures that regulator enable/disable operations are
    properly balanced and only occur when actually transitioning to/from host
    mode.
    
    Fixes: 49d46e3c7e59 ("phy: tegra: xusb: Add set_mode support for UTMI phy on Tegra186")
    Cc: stable@vger.kernel.org
    Signed-off-by: Wayne Chang <waynec@nvidia.com>
    Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Link: https://lore.kernel.org/r/20250502092606.2275682-1-waynec@nvidia.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
pinctrl: stm32: Manage irq affinity settings [+ + +]
Author: Cheick Traore <cheick.traore@foss.st.com>
Date:   Tue Jun 10 16:30:39 2025 +0200

    pinctrl: stm32: Manage irq affinity settings
    
    [ Upstream commit 4c5cc2f65386e22166ce006efe515c667aa075e4 ]
    
    Trying to set the affinity of the interrupts associated to stm32
    pinctrl results in a write error.
    
    Fill struct irq_chip::irq_set_affinity to use the default helper
    function.
    
    Signed-off-by: Cheick Traore <cheick.traore@foss.st.com>
    Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
    Link: https://lore.kernel.org/20250610143042.295376-3-antonio.borneo@foss.st.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pinctrl: sunxi: Fix memory leak on krealloc failure [+ + +]
Author: Yuan Chen <chenyuan@kylinos.cn>
Date:   Fri Jun 20 09:27:08 2025 +0800

    pinctrl: sunxi: Fix memory leak on krealloc failure
    
    [ Upstream commit e3507c56cbb208d4f160942748c527ef6a528ba1 ]
    
    In sunxi_pctrl_dt_node_to_map(), when krealloc() fails to resize
    the pinctrl_map array, the function returns -ENOMEM directly
    without freeing the previously allocated *map buffer. This results
    in a memory leak of the original kmalloc_array allocation.
    
    Fixes: e11dee2e98f8 ("pinctrl: sunxi: Deal with configless pins")
    Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
    Link: https://lore.kernel.org/20250620012708.16709-1-chenyuan_fl@163.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/chrome: cros_ec: Make cros_ec_unregister() return void [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Aug 21 12:14:34 2025 -0400

    platform/chrome: cros_ec: Make cros_ec_unregister() return void
    
    [ Upstream commit afb0a80e63d67e957b5d0eb4ade301aff6e13c8c ]
    
    Up to now cros_ec_unregister() returns zero unconditionally. Make it
    return void instead which makes it easier to see in the callers that
    there is no error to handle.
    
    Also the return value of i2c, platform and spi remove callbacks is
    ignored anyway.
    
    Reviewed-by: Guenter Roeck <groeck@chromium.org>
    Link: https://lore.kernel.org/r/20211020071753.wltjslmimb6wtlp5@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Acked-by: Lee Jones <lee.jones@linaro.org>
    Link: https://lore.kernel.org/r/20220123175201.34839-5-u.kleine-koenig@pengutronix.de
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: e23749534619 ("platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/chrome: cros_ec: remove unneeded label and if-condition [+ + +]
Author: Tzung-Bi Shih <tzungbi@kernel.org>
Date:   Thu Aug 21 12:14:36 2025 -0400

    platform/chrome: cros_ec: remove unneeded label and if-condition
    
    [ Upstream commit 554ec02c97254962bbb0a8776c3160d294fc7e51 ]
    
    Both `ec_dev->ec` and `ec_dev->pd` are initialized to NULL at the
    beginning of cros_ec_register().  Also, platform_device_unregister()
    takes care if the given platform_device is NULL.
    
    Remove the unneeded goto-label and if-condition.
    
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Reviewed-by: Guenter Roeck <groeck@chromium.org>
    Link: https://lore.kernel.org/r/20230308031247.2866401-1-tzungbi@kernel.org
    Stable-dep-of: e23749534619 ("platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister() [+ + +]
Author: Tzung-Bi Shih <tzungbi@kernel.org>
Date:   Thu Aug 21 12:14:37 2025 -0400

    platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()
    
    [ Upstream commit e2374953461947eee49f69b3e3204ff080ef31b1 ]
    
    The blocking notifier is registered in cros_ec_register(); however, it
    isn't unregistered in cros_ec_unregister().
    
    Fix it.
    
    Fixes: 42cd0ab476e2 ("platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW")
    Cc: stable@vger.kernel.org
    Reviewed-by: Benson Leung <bleung@chromium.org>
    Link: https://lore.kernel.org/r/20250722120513.234031-1-tzungbi@kernel.org
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/chrome: cros_ec: Use per-device lockdep key [+ + +]
Author: Chen-Yu Tsai <wenst@chromium.org>
Date:   Thu Aug 21 12:14:35 2025 -0400

    platform/chrome: cros_ec: Use per-device lockdep key
    
    [ Upstream commit 961a325becd9a142ae5c8b258e5c2f221f8bfac8 ]
    
    Lockdep reports a bogus possible deadlock on MT8192 Chromebooks due to
    the following lock sequences:
    
    1. lock(i2c_register_adapter) [1]; lock(&ec_dev->lock)
    2. lock(&ec_dev->lock); lock(prepare_lock);
    
    The actual dependency chains are much longer. The shortened version
    looks somewhat like:
    
    1. cros-ec-rpmsg on mtk-scp
       ec_dev->lock -> prepare_lock
    2. In rt5682_i2c_probe() on native I2C bus:
       prepare_lock -> regmap->lock -> (possibly) i2c_adapter->bus_lock
    3. In rt5682_i2c_probe() on native I2C bus:
       regmap->lock -> i2c_adapter->bus_lock
    4. In sbs_probe() on i2c-cros-ec-tunnel I2C bus attached on cros-ec:
       i2c_adapter->bus_lock -> ec_dev->lock
    
    While lockdep is correct that the shared lockdep classes have a circular
    dependency, it is bogus because
    
      a) 2+3 happen on a native I2C bus
      b) 4 happens on the actual EC on ChromeOS devices
      c) 1 happens on the SCP coprocessor on MediaTek Chromebooks that just
         happens to expose a cros-ec interface, but does not have an
         i2c-cros-ec-tunnel I2C bus
    
    In short, the "dependencies" are actually on different devices.
    
    Setup a per-device lockdep key for cros_ec devices so lockdep can tell
    the two instances apart. This helps with getting rid of the bogus
    lockdep warning. For ChromeOS devices that only have one cros-ec
    instance this doesn't change anything.
    
    Also add a missing mutex_destroy, just to make the teardown complete.
    
    [1] This is likely the per I2C bus lock with shared lockdep class
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Link: https://lore.kernel.org/r/20230111074146.2624496-1-wenst@chromium.org
    Stable-dep-of: e23749534619 ("platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/chrome: cros_ec_typec: Defer probe on missing EC parent [+ + +]
Author: Tomasz Michalec <tmichalec@google.com>
Date:   Tue Jun 10 17:37:47 2025 +0200

    platform/chrome: cros_ec_typec: Defer probe on missing EC parent
    
    [ Upstream commit 8866f4e557eba43e991f99711515217a95f62d2e ]
    
    If cros_typec_probe is called before EC device is registered,
    cros_typec_probe will fail. It may happen when cros-ec-typec.ko is
    loaded before EC bus layer module (e.g. cros_ec_lpcs.ko,
    cros_ec_spi.ko).
    
    Return -EPROBE_DEFER when cros_typec_probe doesn't get EC device, so
    the probe function can be called again after EC device is registered.
    
    Signed-off-by: Tomasz Michalec <tmichalec@google.com>
    Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
    Link: https://lore.kernel.org/r/20250610153748.1858519-1-tmichalec@google.com
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Thu May 29 11:18:37 2025 -0700

    platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches
    
    [ Upstream commit 6418a8504187dc7f5b6f9d0649c03e362cb0664b ]
    
    When KCOV is enabled all functions get instrumented, unless the
    __no_sanitize_coverage attribute is used. To prepare for
    __no_sanitize_coverage being applied to __init functions[1], we have
    to handle differences in how GCC's inline optimizations get resolved.
    For thinkpad_acpi routines, this means forcing two functions to be
    inline with __always_inline.
    
    Link: https://lore.kernel.org/lkml/20250523043935.2009972-11-kees@kernel.org/ [1]
    Signed-off-by: Kees Cook <kees@kernel.org>
    Link: https://lore.kernel.org/r/20250529181831.work.439-kees@kernel.org
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PM / devfreq: governor: Replace sscanf() with kstrtoul() in set_freq_store() [+ + +]
Author: Lifeng Zheng <zhenglifeng1@huawei.com>
Date:   Mon Apr 21 11:00:17 2025 +0800

    PM / devfreq: governor: Replace sscanf() with kstrtoul() in set_freq_store()
    
    [ Upstream commit 914cc799b28f17d369d5b4db3b941957d18157e8 ]
    
    Replace sscanf() with kstrtoul() in set_freq_store() and check the result
    to avoid invalid input.
    
    Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://lore.kernel.org/lkml/20250421030020.3108405-2-zhenglifeng1@huawei.com/
    Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop() [+ + +]
Author: Gautham R. Shenoy <gautham.shenoy@amd.com>
Date:   Thu Jun 12 17:53:54 2025 +0530

    pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop()
    
    [ Upstream commit cda7ac8ce7de84cf32a3871ba5f318aa3b79381e ]
    
    In the function mperf_start(), mperf_monitor snapshots the time, tsc
    and finally the aperf,mperf MSRs. However, this order of snapshotting
    in is reversed in mperf_stop(). As a result, the C0 residency (which
    is computed as delta_mperf * 100 / delta_tsc) is under-reported on
    CPUs that is 100% busy.
    
    Fix this by snapshotting time, tsc and then aperf,mperf in
    mperf_stop() in the same order as in mperf_start().
    
    Link: https://lore.kernel.org/r/20250612122355.19629-2-gautham.shenoy@amd.com
    Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PM: runtime: Clear power.needs_force_resume in pm_runtime_reinit() [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Jun 27 21:16:05 2025 +0200

    PM: runtime: Clear power.needs_force_resume in pm_runtime_reinit()
    
    [ Upstream commit 89d9cec3b1e9c49bae9375a2db6dc49bc7468af0 ]
    
    Clear power.needs_force_resume in pm_runtime_reinit() in case it has
    been set by pm_runtime_force_suspend() invoked from a driver remove
    callback.
    
    Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://patch.msgid.link/9495163.CDJkKcVGEf@rjwysocki.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PM: sleep: console: Fix the black screen issue [+ + +]
Author: tuhaowen <tuhaowen@uniontech.com>
Date:   Wed Jun 11 11:23:45 2025 +0800

    PM: sleep: console: Fix the black screen issue
    
    [ Upstream commit 4266e8fa56d3d982bf451d382a410b9db432015c ]
    
    When the computer enters sleep status without a monitor
    connected, the system switches the console to the virtual
    terminal tty63(SUSPEND_CONSOLE).
    
    If a monitor is subsequently connected before waking up,
    the system skips the required VT restoration process
    during wake-up, leaving the console on tty63 instead of
    switching back to tty1.
    
    To fix this issue, a global flag vt_switch_done is introduced
    to record whether the system has successfully switched to
    the suspend console via vt_move_to_console() during suspend.
    
    If the switch was completed, vt_switch_done is set to 1.
    Later during resume, this flag is checked to ensure that
    the original console is restored properly by calling
    vt_move_to_console(orig_fgconsole, 0).
    
    This prevents scenarios where the resume logic skips console
    restoration due to incorrect detection of the console state,
    especially when a monitor is reconnected before waking up.
    
    Signed-off-by: tuhaowen <tuhaowen@uniontech.com>
    Link: https://patch.msgid.link/20250611032345.29962-1-tuhaowen@uniontech.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pmdomain: governor: Consider CPU latency tolerance from pm_domain_cpu_gov [+ + +]
Author: Maulik Shah <maulik.shah@oss.qualcomm.com>
Date:   Tue Jul 22 09:44:28 2025 -0400

    pmdomain: governor: Consider CPU latency tolerance from pm_domain_cpu_gov
    
    [ Upstream commit 500ba33284416255b9a5b50ace24470b6fe77ea5 ]
    
    pm_domain_cpu_gov is selecting a cluster idle state but does not consider
    latency tolerance of child CPUs. This results in deeper cluster idle state
    whose latency does not meet latency tolerance requirement.
    
    Select deeper idle state only if global and device latency tolerance of all
    child CPUs meet.
    
    Test results on SM8750 with 300 usec PM-QoS on CPU0 which is less than
    domain idle state entry (2150) + exit (1983) usec latency mentioned in
    devicetree, demonstrate the issue.
    
            # echo 300 > /sys/devices/system/cpu/cpu0/power/pm_qos_resume_latency_us
    
    Before: (Usage is incrementing)
    ======
            # cat /sys/kernel/debug/pm_genpd/power-domain-cluster0/idle_states
            State          Time Spent(ms) Usage      Rejected   Above      Below
            S0             29817          537        8          270        0
    
            # cat /sys/kernel/debug/pm_genpd/power-domain-cluster0/idle_states
            State          Time Spent(ms) Usage      Rejected   Above      Below
            S0             30348          542        8          271        0
    
    After: (Usage is not incrementing due to latency tolerance)
    ======
            # cat /sys/kernel/debug/pm_genpd/power-domain-cluster0/idle_states
            State          Time Spent(ms) Usage      Rejected   Above      Below
            S0             39319          626        14         307        0
    
            # cat /sys/kernel/debug/pm_genpd/power-domain-cluster0/idle_states
            State          Time Spent(ms) Usage      Rejected   Above      Below
            S0             39319          626        14         307        0
    
    Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
    Fixes: e94999688e3a ("PM / Domains: Add genpd governor for CPUs")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250709-pmdomain_qos-v2-1-976b12257899@oss.qualcomm.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    [ adapted file path from drivers/pmdomain/governor.c to drivers/base/power/domain_governor.c ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pNFS/flexfiles: Avoid spurious layout returns in ff_layout_choose_ds_for_read [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Wed Dec 16 14:01:07 2020 -0500

    pNFS/flexfiles: Avoid spurious layout returns in ff_layout_choose_ds_for_read
    
    [ Upstream commit 9bfffea3524b49d0268d01f8e7967f06c4d0a942 ]
    
    The callers of ff_layout_choose_ds_for_read() should decide whether or
    not they want to return the layout on error. Sometimes, we may just want
    to retry from the beginning.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Stable-dep-of: f06bedfa62d5 ("pNFS/flexfiles: don't attempt pnfs on fatal DS errors")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pNFS/flexfiles: don't attempt pnfs on fatal DS errors [+ + +]
Author: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Date:   Fri Jun 27 09:17:51 2025 +0200

    pNFS/flexfiles: don't attempt pnfs on fatal DS errors
    
    [ Upstream commit f06bedfa62d57f7b67d44aacd6badad2e13a803f ]
    
    When an applications get killed (SIGTERM/SIGINT) while pNFS client performs a connection
    to DS, client ends in an infinite loop of connect-disconnect. This
    source of the issue, it that flexfilelayoutdev#nfs4_ff_layout_prepare_ds gets an error
    on nfs4_pnfs_ds_connect with status ERESTARTSYS, which is set by rpc_signal_task, but
    the error is treated as transient, thus retried.
    
    The issue is reproducible with Ctrl+C the following script(there should be ~1000 files in
    a directory, client should must not have any connections to DSes):
    
    ```
    echo 3 > /proc/sys/vm/drop_caches
    
    for i in *
    do
       head -1 $i
    done
    ```
    
    The change aims to propagate the nfs4_ff_layout_prepare_ds error state
    to the caller that can decide whatever this is a retryable error or not.
    
    Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
    Link: https://lore.kernel.org/r/20250627071751.189663-1-tigran.mkrtchyan@desy.de
    Fixes: 260f32adb88d ("pNFS/flexfiles: Check the result of nfs4_pnfs_ds_connect")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pNFS: Fix disk addr range check in block/scsi layout [+ + +]
Author: Sergey Bashirov <sergeybashirov@gmail.com>
Date:   Wed Jul 2 16:32:21 2025 +0300

    pNFS: Fix disk addr range check in block/scsi layout
    
    [ Upstream commit 7db6e66663681abda54f81d5916db3a3b8b1a13d ]
    
    At the end of the isect translation, disc_addr represents the physical
    disk offset. Thus, end calculated from disk_addr is also a physical disk
    offset. Therefore, range checking should be done using map->disk_offset,
    not map->start.
    
    Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250702133226.212537-1-sergeybashirov@gmail.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pNFS: Fix stripe mapping in block/scsi layout [+ + +]
Author: Sergey Bashirov <sergeybashirov@gmail.com>
Date:   Tue Jul 1 15:21:48 2025 +0300

    pNFS: Fix stripe mapping in block/scsi layout
    
    [ Upstream commit 81438498a285759f31e843ac4800f82a5ce6521f ]
    
    Because of integer division, we need to carefully calculate the
    disk offset. Consider the example below for a stripe of 6 volumes,
    a chunk size of 4096, and an offset of 70000.
    
    chunk = div_u64(offset, dev->chunk_size) = 70000 / 4096 = 17
    offset = chunk * dev->chunk_size = 17 * 4096 = 69632
    disk_offset_wrong = div_u64(offset, dev->nr_children) = 69632 / 6 = 11605
    disk_chunk = div_u64(chunk, dev->nr_children) = 17 / 6 = 2
    disk_offset = disk_chunk * dev->chunk_size = 2 * 4096 = 8192
    
    Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250701122341.199112-1-sergeybashirov@gmail.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pNFS: Fix uninited ptr deref in block/scsi layout [+ + +]
Author: Sergey Bashirov <sergeybashirov@gmail.com>
Date:   Mon Jun 30 21:35:26 2025 +0300

    pNFS: Fix uninited ptr deref in block/scsi layout
    
    [ Upstream commit 9768797c219326699778fba9cd3b607b2f1e7950 ]
    
    The error occurs on the third attempt to encode extents. When function
    ext_tree_prepare_commit() reallocates a larger buffer to retry encoding
    extents, the "layoutupdate_pages" page array is initialized only after the
    retry loop. But ext_tree_free_commitdata() is called on every iteration
    and tries to put pages in the array, thus dereferencing uninitialized
    pointers.
    
    An additional problem is that there is no limit on the maximum possible
    buffer_size. When there are too many extents, the client may create a
    layoutcommit that is larger than the maximum possible RPC size accepted
    by the server.
    
    During testing, we observed two typical scenarios. First, one memory page
    for extents is enough when we work with small files, append data to the
    end of the file, or preallocate extents before writing. But when we fill
    a new large file without preallocating, the number of extents can be huge,
    and counting the number of written extents in ext_tree_encode_commit()
    does not help much. Since this number increases even more between
    unlocking and locking of ext_tree, the reallocated buffer may not be
    large enough again and again.
    
    Co-developed-by: Konstantin Evtushenko <koevtushenko@yandex.com>
    Signed-off-by: Konstantin Evtushenko <koevtushenko@yandex.com>
    Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250630183537.196479-2-sergeybashirov@gmail.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pNFS: Handle RPC size limit for layoutcommits [+ + +]
Author: Sergey Bashirov <sergeybashirov@gmail.com>
Date:   Mon Jun 30 21:35:29 2025 +0300

    pNFS: Handle RPC size limit for layoutcommits
    
    [ Upstream commit d897d81671bc4615c80f4f3bd5e6b218f59df50c ]
    
    When there are too many block extents for a layoutcommit, they may not
    all fit into the maximum-sized RPC. This patch allows the generic pnfs
    code to properly handle -ENOSPC returned by the block/scsi layout driver
    and trigger additional layoutcommits if necessary.
    
    Co-developed-by: Konstantin Evtushenko <koevtushenko@yandex.com>
    Signed-off-by: Konstantin Evtushenko <koevtushenko@yandex.com>
    Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20250630183537.196479-5-sergeybashirov@gmail.com
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set [+ + +]
Author: Charles Han <hanchunchao@inspur.com>
Date:   Mon May 19 14:16:01 2025 +0800

    power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set
    
    [ Upstream commit 2937f5d2e24eefef8cb126244caec7fe3307f724 ]
    
    When the kernel is not configured  CONFIG_OF, the max14577_charger_dt_init
    function returns NULL. Fix the max14577_charger_probe functionby returning
    -ENODATA instead of potentially passing a NULL pointer to PTR_ERR.
    
    This fixes the below smatch warning:
    max14577_charger_probe() warn: passing zero to 'PTR_ERR'
    
    Fixes: e30110e9c96f ("charger: max14577: Configure battery-dependent settings from DTS and sysfs")
    Signed-off-by: Charles Han <hanchunchao@inspur.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250519061601.8755-1-hanchunchao@inspur.com
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/eeh: Export eeh_unfreeze_pe() [+ + +]
Author: Timothy Pearson <tpearson@raptorengineering.com>
Date:   Tue Jul 15 16:37:34 2025 -0500

    powerpc/eeh: Export eeh_unfreeze_pe()
    
    [ Upstream commit e82b34eed04b0ddcff4548b62633467235672fd3 ]
    
    The PowerNV hotplug driver needs to be able to clear any frozen PE(s)
    on the PHB after suprise removal of a downstream device.
    
    Export the eeh_unfreeze_pe() symbol to allow implementation of this
    functionality in the php_nv module.
    
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/1778535414.1359858.1752615454618.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

powerpc/eeh: Make EEH driver device hotplug safe [+ + +]
Author: Timothy Pearson <tpearson@raptorengineering.com>
Date:   Tue Jul 15 16:38:23 2025 -0500

    powerpc/eeh: Make EEH driver device hotplug safe
    
    [ Upstream commit 1010b4c012b0d78dfb9d3132b49aa2ef024a07a7 ]
    
    Multiple race conditions existed between the PCIe hotplug driver and the
    EEH driver, leading to a variety of kernel oopses of the same general
    nature:
    
    <pcie device unplug>
    <eeh driver trigger>
    <hotplug removal trigger>
    <pcie tree reconfiguration>
    <eeh recovery next step>
    <oops in EEH driver bus iteration loop>
    
    A second class of oops is also seen when the underlying bus disappears
    during device recovery.
    
    Refactor the EEH module to be PCI rescan and remove safe.  Also clean
    up a few minor formatting / readability issues.
    
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/1334208367.1359861.1752615503144.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

powerpc/eeh: Rely on dev->link_active_reporting [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Sun Jun 11 18:19:32 2023 +0100

    powerpc/eeh: Rely on dev->link_active_reporting
    
    [ Upstream commit 1541a21305ceb10fcf3f7cbb23f3e1a00bbf1789 ]
    
    Use dev->link_active_reporting to determine whether Data Link Layer Link
    Active Reporting is available rather than re-retrieving the capability.
    
    Link: https://lore.kernel.org/r/alpine.DEB.2.21.2305310124100.59226@angie.orcam.me.uk
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pps: fix poll support [+ + +]
Author: Denis OSTERLAND-HEIM <denis.osterland@diehl.com>
Date:   Wed May 28 12:57:50 2025 +0200

    pps: fix poll support
    
    [ Upstream commit 12c409aa1ec2592280a2ddcc66ff8f3c7f7bb171 ]
    
    Because pps_cdev_poll() returns unconditionally EPOLLIN,
    a user space program that calls select/poll get always an immediate data
    ready-to-read response. As a result the intended use to wait until next
    data becomes ready does not work.
    
    User space snippet:
    
        struct pollfd pollfd = {
          .fd = open("/dev/pps0", O_RDONLY),
          .events = POLLIN|POLLERR,
          .revents = 0 };
        while(1) {
          poll(&pollfd, 1, 2000/*ms*/); // returns immediate, but should wait
          if(revents & EPOLLIN) { // always true
            struct pps_fdata fdata;
            memset(&fdata, 0, sizeof(memdata));
            ioctl(PPS_FETCH, &fdata); // currently fetches data at max speed
          }
        }
    
    Lets remember the last fetch event counter and compare this value
    in pps_cdev_poll() with most recent event counter
    and return 0 if they are equal.
    
    Signed-off-by: Denis OSTERLAND-HEIM <denis.osterland@diehl.com>
    Co-developed-by: Rodolfo Giometti <giometti@enneenne.com>
    Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
    Fixes: eae9d2ba0cfc ("LinuxPPS: core support")
    Link: https://lore.kernel.org/all/f6bed779-6d59-4f0f-8a59-b6312bd83b4e@enneenne.com/
    Acked-by: Rodolfo Giometti <giometti@enneenne.com>
    Link: https://lore.kernel.org/r/c3c50ad1eb19ef553eca8a57c17f4c006413ab70.camel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pptp: ensure minimal skb length in pptp_xmit() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Jul 29 08:02:07 2025 +0000

    pptp: ensure minimal skb length in pptp_xmit()
    
    [ Upstream commit de9c4861fb42f0cd72da844c3c34f692d5895b7b ]
    
    Commit aabc6596ffb3 ("net: ppp: Add bound checking for skb data
    on ppp_sync_txmung") fixed ppp_sync_txmunge()
    
    We need a similar fix in pptp_xmit(), otherwise we might
    read uninit data as reported by syzbot.
    
    BUG: KMSAN: uninit-value in pptp_xmit+0xc34/0x2720 drivers/net/ppp/pptp.c:193
      pptp_xmit+0xc34/0x2720 drivers/net/ppp/pptp.c:193
      ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2290 [inline]
      ppp_input+0x1d6/0xe60 drivers/net/ppp/ppp_generic.c:2314
      pppoe_rcv_core+0x1e8/0x760 drivers/net/ppp/pppoe.c:379
      sk_backlog_rcv+0x142/0x420 include/net/sock.h:1148
      __release_sock+0x1d3/0x330 net/core/sock.c:3213
      release_sock+0x6b/0x270 net/core/sock.c:3767
      pppoe_sendmsg+0x15d/0xcb0 drivers/net/ppp/pppoe.c:904
      sock_sendmsg_nosec net/socket.c:712 [inline]
      __sock_sendmsg+0x330/0x3d0 net/socket.c:727
      ____sys_sendmsg+0x893/0xd80 net/socket.c:2566
      ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620
      __sys_sendmmsg+0x2d9/0x7c0 net/socket.c:2709
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+afad90ffc8645324afe5@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/68887d86.a00a0220.b12ec.00cd.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
    Link: https://patch.msgid.link/20250729080207.1863408-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pptp: fix pptp_xmit() error path [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Aug 7 14:21:46 2025 +0000

    pptp: fix pptp_xmit() error path
    
    [ Upstream commit ae633388cae349886f1a3cfb27aa092854b24c1b ]
    
    I accidentally added a bug in pptp_xmit() that syzbot caught for us.
    
    Only call ip_rt_put() if a route has been allocated.
    
    BUG: unable to handle page fault for address: ffffffffffffffdb
    PGD df3b067 P4D df3b067 PUD df3d067 PMD 0
    Oops: Oops: 0002 [#1] SMP KASAN PTI
    CPU: 1 UID: 0 PID: 6346 Comm: syz.0.336 Not tainted 6.16.0-next-20250804-syzkaller #0 PREEMPT(full)
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
    RIP: 0010:arch_atomic_add_return arch/x86/include/asm/atomic.h:85 [inline]
    RIP: 0010:raw_atomic_sub_return_release include/linux/atomic/atomic-arch-fallback.h:846 [inline]
    RIP: 0010:atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:327 [inline]
    RIP: 0010:__rcuref_put include/linux/rcuref.h:109 [inline]
    RIP: 0010:rcuref_put+0x172/0x210 include/linux/rcuref.h:173
    Call Trace:
     <TASK>
     dst_release+0x24/0x1b0 net/core/dst.c:167
     ip_rt_put include/net/route.h:285 [inline]
     pptp_xmit+0x14b/0x1a90 drivers/net/ppp/pptp.c:267
     __ppp_channel_push+0xf2/0x1c0 drivers/net/ppp/ppp_generic.c:2166
     ppp_channel_push+0x123/0x660 drivers/net/ppp/ppp_generic.c:2198
     ppp_write+0x2b0/0x400 drivers/net/ppp/ppp_generic.c:544
     vfs_write+0x27b/0xb30 fs/read_write.c:684
     ksys_write+0x145/0x250 fs/read_write.c:738
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Fixes: de9c4861fb42 ("pptp: ensure minimal skb length in pptp_xmit()")
    Reported-by: syzbot+27d7cfbc93457e472e00@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/689095a5.050a0220.1fc43d.0009.GAE@google.com/
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250807142146.2877060-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ptp: Fix possible memory leak in ptp_clock_register() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Oct 20 16:18:34 2021 +0800

    ptp: Fix possible memory leak in ptp_clock_register()
    
    commit 4225fea1cb28370086e17e82c0f69bec2779dca0 upstream.
    
    I got memory leak as follows when doing fault injection test:
    
    unreferenced object 0xffff88800906c618 (size 8):
      comm "i2c-idt82p33931", pid 4421, jiffies 4294948083 (age 13.188s)
      hex dump (first 8 bytes):
        70 74 70 30 00 00 00 00                          ptp0....
      backtrace:
        [<00000000312ed458>] __kmalloc_track_caller+0x19f/0x3a0
        [<0000000079f6e2ff>] kvasprintf+0xb5/0x150
        [<0000000026aae54f>] kvasprintf_const+0x60/0x190
        [<00000000f323a5f7>] kobject_set_name_vargs+0x56/0x150
        [<000000004e35abdd>] dev_set_name+0xc0/0x100
        [<00000000f20cfe25>] ptp_clock_register+0x9f4/0xd30 [ptp]
        [<000000008bb9f0de>] idt82p33_probe.cold+0x8b6/0x1561 [ptp_idt82p33]
    
    When posix_clock_register() returns an error, the name allocated
    in dev_set_name() will be leaked, the put_device() should be used
    to give up the device reference, then the name will be freed in
    kobject_cleanup() and other memory will be freed in ptp_clock_release().
    
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Fixes: a33121e5487b ("ptp: fix the race between the release of ptp_clock and cdev")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [ Shivani: Modified to apply on 5.10.y, Removed kfree(ptp->vclock_index) in
      the ptach, since vclock_index is introduced in later versions ]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pwm: imx-tpm: Reset counter if CMOD is 0 [+ + +]
Author: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Date:   Mon Jul 28 15:41:44 2025 -0400

    pwm: imx-tpm: Reset counter if CMOD is 0
    
    commit 65c6f742ab14ab1a2679fba72b82dcc0289d96f1 upstream.
    
    As per the i.MX93 TRM, section 67.3.2.1 "MOD register update", the value
    of the TPM counter does NOT get updated when writing MOD.MOD unless
    SC.CMOD != 0. Therefore, with the current code, assuming the following
    sequence:
    
            1) pwm_disable()
            2) pwm_apply_might_sleep() /* period is changed here */
            3) pwm_enable()
    
    and assuming only one channel is active, if CNT.COUNT is higher than the
    MOD.MOD value written during the pwm_apply_might_sleep() call then, when
    re-enabling the PWM during pwm_enable(), the counter will end up resetting
    after UINT32_MAX - CNT.COUNT + MOD.MOD cycles instead of MOD.MOD cycles as
    normally expected.
    
    Fix this problem by forcing a reset of the TPM counter before MOD.MOD is
    written.
    
    Fixes: 738a1cfec2ed ("pwm: Add i.MX TPM PWM driver support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
    Link: https://lore.kernel.org/r/20250728194144.22884-1-laurentiumihalcea111@gmail.com
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pwm: mediatek: Fix duty and period setting [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Date:   Fri Aug 22 15:01:33 2025 -0400

    pwm: mediatek: Fix duty and period setting
    
    [ Upstream commit f21d136caf8171f94159d975ea4620c164431bd9 ]
    
    The period generated by the hardware is
    
            (PWMDWIDTH + 1) << CLKDIV) / freq
    
    according to my tests with a signal analyser and also the documentation.
    
    The current algorithm doesn't consider the `+ 1` part and so configures
    slightly too high periods. The same issue exists for the duty cycle
    setting. So subtract 1 from both the register values for period and
    duty cycle. If period is 0, bail out, if duty_cycle is 0, just disable
    the PWM which results in a constant low output.
    
    Fixes: caf065f8fd58 ("pwm: Add MediaTek PWM support")
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/6d1fa87a76f8020bfe3171529b8e19baffceab10.1753717973.git.u.kleine-koenig@baylibre.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pwm: mediatek: Handle hardware enable and clock enable separately [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Date:   Fri Aug 22 15:01:32 2025 -0400

    pwm: mediatek: Handle hardware enable and clock enable separately
    
    [ Upstream commit 704d918341c378c5f9505dfdf32d315e256d3846 ]
    
    Stop handling the clocks in pwm_mediatek_enable() and
    pwm_mediatek_disable(). This is a preparing change for the next commit
    that requires that clocks and the enable bit are handled separately.
    
    Also move these two functions a bit further up in the source file to
    make them usable in pwm_mediatek_config(), which is needed in the next
    commit, too.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/55c94fe2917ece152ee1e998f4675642a7716f13.1753717973.git.u.kleine-koenig@baylibre.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
    Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pwm: mediatek: Implement .apply() callback [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Fri Aug 22 15:01:31 2025 -0400

    pwm: mediatek: Implement .apply() callback
    
    [ Upstream commit 758de66f4bd2cac2b1d71db917c65c3d611d4e74 ]
    
    To eventually get rid of all legacy drivers convert this driver to the
    modern world implementing .apply().
    This just pushed a variant of pwm_apply_legacy() into the driver that was
    slightly simplified because the driver doesn't provide a .set_polarity()
    callback.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
    Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rcu: Protect ->defer_qs_iw_pending from data race [+ + +]
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Thu Apr 24 16:49:53 2025 -0700

    rcu: Protect ->defer_qs_iw_pending from data race
    
    [ Upstream commit 90c09d57caeca94e6f3f87c49e96a91edd40cbfd ]
    
    On kernels built with CONFIG_IRQ_WORK=y, when rcu_read_unlock() is
    invoked within an interrupts-disabled region of code [1], it will invoke
    rcu_read_unlock_special(), which uses an irq-work handler to force the
    system to notice when the RCU read-side critical section actually ends.
    That end won't happen until interrupts are enabled at the soonest.
    
    In some kernels, such as those booted with rcutree.use_softirq=y, the
    irq-work handler is used unconditionally.
    
    The per-CPU rcu_data structure's ->defer_qs_iw_pending field is
    updated by the irq-work handler and is both read and updated by
    rcu_read_unlock_special().  This resulted in the following KCSAN splat:
    
    ------------------------------------------------------------------------
    
    BUG: KCSAN: data-race in rcu_preempt_deferred_qs_handler / rcu_read_unlock_special
    
    read to 0xffff96b95f42d8d8 of 1 bytes by task 90 on cpu 8:
     rcu_read_unlock_special+0x175/0x260
     __rcu_read_unlock+0x92/0xa0
     rt_spin_unlock+0x9b/0xc0
     __local_bh_enable+0x10d/0x170
     __local_bh_enable_ip+0xfb/0x150
     rcu_do_batch+0x595/0xc40
     rcu_cpu_kthread+0x4e9/0x830
     smpboot_thread_fn+0x24d/0x3b0
     kthread+0x3bd/0x410
     ret_from_fork+0x35/0x40
     ret_from_fork_asm+0x1a/0x30
    
    write to 0xffff96b95f42d8d8 of 1 bytes by task 88 on cpu 8:
     rcu_preempt_deferred_qs_handler+0x1e/0x30
     irq_work_single+0xaf/0x160
     run_irq_workd+0x91/0xc0
     smpboot_thread_fn+0x24d/0x3b0
     kthread+0x3bd/0x410
     ret_from_fork+0x35/0x40
     ret_from_fork_asm+0x1a/0x30
    
    no locks held by irq_work/8/88.
    irq event stamp: 200272
    hardirqs last  enabled at (200272): [<ffffffffb0f56121>] finish_task_switch+0x131/0x320
    hardirqs last disabled at (200271): [<ffffffffb25c7859>] __schedule+0x129/0xd70
    softirqs last  enabled at (0): [<ffffffffb0ee093f>] copy_process+0x4df/0x1cc0
    softirqs last disabled at (0): [<0000000000000000>] 0x0
    
    ------------------------------------------------------------------------
    
    The problem is that irq-work handlers run with interrupts enabled, which
    means that rcu_preempt_deferred_qs_handler() could be interrupted,
    and that interrupt handler might contain an RCU read-side critical
    section, which might invoke rcu_read_unlock_special().  In the strict
    KCSAN mode of operation used by RCU, this constitutes a data race on
    the ->defer_qs_iw_pending field.
    
    This commit therefore disables interrupts across the portion of the
    rcu_preempt_deferred_qs_handler() that updates the ->defer_qs_iw_pending
    field.  This suffices because this handler is not a fast path.
    
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/bnxt_re: Fix to initialize the PBL array [+ + +]
Author: Anantha Prabhu <anantha.prabhu@broadcom.com>
Date:   Tue Aug 5 15:40:00 2025 +0530

    RDMA/bnxt_re: Fix to initialize the PBL array
    
    [ Upstream commit 806b9f494f62791ee6d68f515a8056c615a0e7b2 ]
    
    memset the PBL page pointer and page map arrays before
    populating the SGL addresses of the HWQ.
    
    Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation")
    Signed-off-by: Anantha Prabhu <anantha.prabhu@broadcom.com>
    Reviewed-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
    Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Link: https://patch.msgid.link/20250805101000.233310-5-kalesh-anakkur.purayil@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/core: Rate limit GID cache warning messages [+ + +]
Author: Maor Gottlieb <maorg@nvidia.com>
Date:   Mon Jun 16 11:26:21 2025 +0300

    RDMA/core: Rate limit GID cache warning messages
    
    [ Upstream commit 333e4d79316c9ed5877d7aac8b8ed22efc74e96d ]
    
    The GID cache warning messages can flood the kernel log when there are
    multiple failed attempts to add GIDs. This can happen when creating many
    virtual interfaces without having enough space for their GIDs in the GID
    table.
    
    Change pr_warn to pr_warn_ratelimited to prevent log flooding while still
    maintaining visibility of the issue.
    
    Link: https://patch.msgid.link/r/fd45ed4a1078e743f498b234c3ae816610ba1b18.1750062357.git.leon@kernel.org
    Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/core: reduce stack using in nldev_stat_get_doit() [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Jun 20 13:33:26 2025 +0200

    RDMA/core: reduce stack using in nldev_stat_get_doit()
    
    [ Upstream commit 43163f4c30f94d2103c948a247cdf2cda5068ca7 ]
    
    In the s390 defconfig, gcc-10 and earlier end up inlining three functions
    into nldev_stat_get_doit(), and each of them uses some 600 bytes of stack.
    
    The result is a function with an overly large stack frame and a warning:
    
    drivers/infiniband/core/nldev.c:2466:1: error: the frame size of 1720 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
    
    Mark the three functions noinline_for_stack to prevent this, ensuring
    that only one copy of the nlattr array is on the stack of each function.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20250620113335.3776965-1-arnd@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/rxe: Return CQE error if invalid lkey was supplied [+ + +]
Author: Leon Romanovsky <leon@kernel.org>
Date:   Mon Aug 11 23:12:31 2025 -0700

    RDMA/rxe: Return CQE error if invalid lkey was supplied
    
    [ Upstream commit dc07628bd2bbc1da768e265192c28ebd301f509d ]
    
    RXE is missing update of WQE status in LOCAL_WRITE failures.  This caused
    the following kernel panic if someone sent an atomic operation with an
    explicitly wrong lkey.
    
    [leonro@vm ~]$ mkt test
    test_atomic_invalid_lkey (tests.test_atomic.AtomicTest) ...
     WARNING: CPU: 5 PID: 263 at drivers/infiniband/sw/rxe/rxe_comp.c:740 rxe_completer+0x1a6d/0x2e30 [rdma_rxe]
     Modules linked in: crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel rdma_ucm rdma_cm ib_umad ib_ipoib iw_cm ib_cm mlx5_ib ib_uverbs ib_core mlx5_core ptp pps_core
     CPU: 5 PID: 263 Comm: python3 Not tainted 5.13.0-rc1+ #2936
     Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
     RIP: 0010:rxe_completer+0x1a6d/0x2e30 [rdma_rxe]
     Code: 03 0f 8e 65 0e 00 00 3b 93 10 06 00 00 0f 84 82 0a 00 00 4c 89 ff 4c 89 44 24 38 e8 2d 74 a9 e1 4c 8b 44 24 38 e9 1c f5 ff ff <0f> 0b e9 0c e8 ff ff b8 05 00 00 00 41 bf 05 00 00 00 e9 ab e7 ff
     RSP: 0018:ffff8880158af090 EFLAGS: 00010246
     RAX: 0000000000000000 RBX: ffff888016a78000 RCX: ffffffffa0cf1652
     RDX: 1ffff9200004b442 RSI: 0000000000000004 RDI: ffffc9000025a210
     RBP: dffffc0000000000 R08: 00000000ffffffea R09: ffff88801617740b
     R10: ffffed1002c2ee81 R11: 0000000000000007 R12: ffff88800f3b63e8
     R13: ffff888016a78008 R14: ffffc9000025a180 R15: 000000000000000c
     FS:  00007f88b622a740(0000) GS:ffff88806d540000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 00007f88b5a1fa10 CR3: 000000000d848004 CR4: 0000000000370ea0
     DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
     Call Trace:
      rxe_do_task+0x130/0x230 [rdma_rxe]
      rxe_rcv+0xb11/0x1df0 [rdma_rxe]
      rxe_loopback+0x157/0x1e0 [rdma_rxe]
      rxe_responder+0x5532/0x7620 [rdma_rxe]
      rxe_do_task+0x130/0x230 [rdma_rxe]
      rxe_rcv+0x9c8/0x1df0 [rdma_rxe]
      rxe_loopback+0x157/0x1e0 [rdma_rxe]
      rxe_requester+0x1efd/0x58c0 [rdma_rxe]
      rxe_do_task+0x130/0x230 [rdma_rxe]
      rxe_post_send+0x998/0x1860 [rdma_rxe]
      ib_uverbs_post_send+0xd5f/0x1220 [ib_uverbs]
      ib_uverbs_write+0x847/0xc80 [ib_uverbs]
      vfs_write+0x1c5/0x840
      ksys_write+0x176/0x1d0
      do_syscall_64+0x3f/0x80
      entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Fixes: 8700e3e7c485 ("Soft RoCE driver")
    Link: https://lore.kernel.org/r/11e7b553f3a6f5371c6bb3f57c494bb52b88af99.1620711734.git.leonro@nvidia.com
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA: hfi1: fix possible divide-by-zero in find_hw_thread_mask() [+ + +]
Author: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Date:   Wed Jun 4 15:39:38 2025 -0400

    RDMA: hfi1: fix possible divide-by-zero in find_hw_thread_mask()
    
    [ Upstream commit 59f7d2138591ef8f0e4e4ab5f1ab674e8181ad3a ]
    
    The function divides number of online CPUs by num_core_siblings, and
    later checks the divider by zero. This implies a possibility to get
    and divide-by-zero runtime error. Fix it by moving the check prior to
    division. This also helps to save one indentation level.
    
    Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
    Link: https://patch.msgid.link/20250604193947.11834-3-yury.norov@gmail.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Reapply "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()" [+ + +]
Author: Remi Pommarel <repk@triplefau.lt>
Date:   Thu Jul 17 17:45:29 2025 +0200

    Reapply "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()"
    
    [ Upstream commit 754fe848b3b297fc85ec24cd959bad22b6df8cb8 ]
    
    This reverts commit 0937cb5f345c ("Revert "wifi: mac80211: Update
    skb's control block key in ieee80211_tx_dequeue()"").
    
    This commit broke TX with 802.11 encapsulation HW offloading, now that
    this is fixed, reapply it.
    
    Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue")
    Signed-off-by: Remi Pommarel <repk@triplefau.lt>
    Link: https://patch.msgid.link/66b8fc39fb0194fa06c9ca7eeb6ffe0118dcb3ec.1752765971.git.repk@triplefau.lt
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
regulator: core: fix NULL dereference on unbind due to stale coupling data [+ + +]
Author: Alessandro Carminati <acarmina@redhat.com>
Date:   Thu Jun 26 08:38:09 2025 +0000

    regulator: core: fix NULL dereference on unbind due to stale coupling data
    
    [ Upstream commit ca46946a482238b0cdea459fb82fc837fb36260e ]
    
    Failing to reset coupling_desc.n_coupled after freeing coupled_rdevs can
    lead to NULL pointer dereference when regulators are accessed post-unbind.
    
    This can happen during runtime PM or other regulator operations that rely
    on coupling metadata.
    
    For example, on ridesx4, unbinding the 'reg-dummy' platform device triggers
    a panic in regulator_lock_recursive() due to stale coupling state.
    
    Ensure n_coupled is set to 0 to prevent access to invalid pointers.
    
    Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
    Link: https://patch.msgid.link/20250626083809.314842-1-acarmina@redhat.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
reset: brcmstb: Enable reset drivers for ARCH_BCM2835 [+ + +]
Author: Peter Robinson <pbrobinson@gmail.com>
Date:   Mon Jun 30 18:52:58 2025 +0100

    reset: brcmstb: Enable reset drivers for ARCH_BCM2835
    
    [ Upstream commit 1d99f92f71b6b4b2eee776562c991428490f71ef ]
    
    The BRCMSTB and BRCMSTB_RESCAL reset drivers are also
    used in the BCM2712, AKA the RPi5. The RPi platforms
    have typically used the ARCH_BCM2835, and the PCIe
    support for this SoC can use this config which depends
    on these drivers so enable building them when just that
    arch option is enabled to ensure the platform works as
    expected.
    
    Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
    Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Link: https://lore.kernel.org/r/20250630175301.846082-1-pbrobinson@gmail.com
    Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "vgacon: Add check for vc_origin address range in vgacon_scroll()" [+ + +]
Author: Helge Deller <deller@gmx.de>
Date:   Sat Aug 2 21:34:37 2025 +0200

    Revert "vgacon: Add check for vc_origin address range in vgacon_scroll()"
    
    commit e4fc307d8e24f122402907ebf585248cad52841d upstream.
    
    This reverts commit 864f9963ec6b4b76d104d595ba28110b87158003.
    
    The patch is wrong as it checks vc_origin against vc_screenbuf,
    while in text mode it should compare against vga_vram_base.
    
    As such it broke VGA text scrolling, which can be reproduced like this:
    (1) boot a kernel that is configured to use text mode VGA-console
    (2) type commands:  ls -l /usr/bin | less -S
    (3) scroll up/down with cursor-down/up keys
    
    Reported-by: Jari Ruusu <jariruusu@protonmail.com>
    Cc: stable@vger.kernel.org
    Cc: Yi Yang <yiyang13@huawei.com>
    Cc: GONG Ruiqi <gongruiqi1@huawei.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "vmci: Prevent the dispatching of uninitialized payloads" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Jul 3 10:30:09 2025 +0200

    Revert "vmci: Prevent the dispatching of uninitialized payloads"
    
    [ Upstream commit 8f5d9bed6122b8d96508436e5ad2498bb797eb6b ]
    
    This reverts commit bfb4cf9fb97e4063f0aa62e9e398025fb6625031.
    
    While the code "looks" correct, the compiler has no way to know that
    doing "fun" pointer math like this really isn't a write off the end of
    the structure as there is no hint anywhere that the structure has data
    at the end of it.
    
    This causes the following build warning:
    
    In function 'fortify_memset_chk',
        inlined from 'ctx_fire_notification.isra' at drivers/misc/vmw_vmci/vmci_context.c:254:3:
    include/linux/fortify-string.h:480:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
      480 |                         __write_overflow_field(p_size_field, size);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    So revert it for now and it can come back in the future in a "sane" way
    that either correctly makes the structure know that there is trailing
    data, OR just the payload structure is properly referenced and zeroed
    out.
    
    Fixes: bfb4cf9fb97e ("vmci: Prevent the dispatching of uninitialized payloads")
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Lizhi Xu <lizhi.xu@windriver.com>
    Link: https://lore.kernel.org/r/20250703171021.0aee1482@canb.auug.org.au
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rpl: Fix use-after-free in rpl_do_srh_inline(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Fri Jul 11 18:21:19 2025 +0000

    rpl: Fix use-after-free in rpl_do_srh_inline().
    
    [ Upstream commit b640daa2822a39ff76e70200cb2b7b892b896dce ]
    
    Running lwt_dst_cache_ref_loop.sh in selftest with KASAN triggers
    the splat below [0].
    
    rpl_do_srh_inline() fetches ipv6_hdr(skb) and accesses it after
    skb_cow_head(), which is illegal as the header could be freed then.
    
    Let's fix it by making oldhdr to a local struct instead of a pointer.
    
    [0]:
    [root@fedora net]# ./lwt_dst_cache_ref_loop.sh
    ...
    TEST: rpl (input)
    [   57.631529] ==================================================================
    BUG: KASAN: slab-use-after-free in rpl_do_srh_inline.isra.0 (net/ipv6/rpl_iptunnel.c:174)
    Read of size 40 at addr ffff888122bf96d8 by task ping6/1543
    
    CPU: 50 UID: 0 PID: 1543 Comm: ping6 Not tainted 6.16.0-rc5-01302-gfadd1e6231b1 #23 PREEMPT(voluntary)
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    Call Trace:
     <IRQ>
     dump_stack_lvl (lib/dump_stack.c:122)
     print_report (mm/kasan/report.c:409 mm/kasan/report.c:521)
     kasan_report (mm/kasan/report.c:221 mm/kasan/report.c:636)
     kasan_check_range (mm/kasan/generic.c:175 (discriminator 1) mm/kasan/generic.c:189 (discriminator 1))
     __asan_memmove (mm/kasan/shadow.c:94 (discriminator 2))
     rpl_do_srh_inline.isra.0 (net/ipv6/rpl_iptunnel.c:174)
     rpl_input (net/ipv6/rpl_iptunnel.c:201 net/ipv6/rpl_iptunnel.c:282)
     lwtunnel_input (net/core/lwtunnel.c:459)
     ipv6_rcv (./include/net/dst.h:471 (discriminator 1) ./include/net/dst.h:469 (discriminator 1) net/ipv6/ip6_input.c:79 (discriminator 1) ./include/linux/netfilter.h:317 (discriminator 1) ./include/linux/netfilter.h:311 (discriminator 1) net/ipv6/ip6_input.c:311 (discriminator 1))
     __netif_receive_skb_one_core (net/core/dev.c:5967)
     process_backlog (./include/linux/rcupdate.h:869 net/core/dev.c:6440)
     __napi_poll.constprop.0 (net/core/dev.c:7452)
     net_rx_action (net/core/dev.c:7518 net/core/dev.c:7643)
     handle_softirqs (kernel/softirq.c:579)
     do_softirq (kernel/softirq.c:480 (discriminator 20))
     </IRQ>
     <TASK>
     __local_bh_enable_ip (kernel/softirq.c:407)
     __dev_queue_xmit (net/core/dev.c:4740)
     ip6_finish_output2 (./include/linux/netdevice.h:3358 ./include/net/neighbour.h:526 ./include/net/neighbour.h:540 net/ipv6/ip6_output.c:141)
     ip6_finish_output (net/ipv6/ip6_output.c:215 net/ipv6/ip6_output.c:226)
     ip6_output (./include/linux/netfilter.h:306 net/ipv6/ip6_output.c:248)
     ip6_send_skb (net/ipv6/ip6_output.c:1983)
     rawv6_sendmsg (net/ipv6/raw.c:588 net/ipv6/raw.c:918)
     __sys_sendto (net/socket.c:714 (discriminator 1) net/socket.c:729 (discriminator 1) net/socket.c:2228 (discriminator 1))
     __x64_sys_sendto (net/socket.c:2231)
     do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1))
     entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    RIP: 0033:0x7f68cffb2a06
    Code: 5d e8 41 8b 93 08 03 00 00 59 5e 48 83 f8 fc 75 19 83 e2 39 83 fa 08 75 11 e8 26 ff ff ff 66 0f 1f 44 00 00 48 8b 45 10 0f 05 <48> 8b 5d f8 c9 c3 0f 1f 40 00 f3 0f 1e fa 55 48 89 e5 48 83 ec 08
    RSP: 002b:00007ffefb7c53d0 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 0000564cd69f10a0 RCX: 00007f68cffb2a06
    RDX: 0000000000000040 RSI: 0000564cd69f10a4 RDI: 0000000000000003
    RBP: 00007ffefb7c53f0 R08: 0000564cd6a032ac R09: 000000000000001c
    R10: 0000000000000000 R11: 0000000000000202 R12: 0000564cd69f10a4
    R13: 0000000000000040 R14: 00007ffefb7c66e0 R15: 0000564cd69f10a0
     </TASK>
    
    Allocated by task 1543:
     kasan_save_stack (mm/kasan/common.c:48)
     kasan_save_track (mm/kasan/common.c:60 (discriminator 1) mm/kasan/common.c:69 (discriminator 1))
     __kasan_slab_alloc (mm/kasan/common.c:319 mm/kasan/common.c:345)
     kmem_cache_alloc_node_noprof (./include/linux/kasan.h:250 mm/slub.c:4148 mm/slub.c:4197 mm/slub.c:4249)
     kmalloc_reserve (net/core/skbuff.c:581 (discriminator 88))
     __alloc_skb (net/core/skbuff.c:669)
     __ip6_append_data (net/ipv6/ip6_output.c:1672 (discriminator 1))
     ip6_append_data (net/ipv6/ip6_output.c:1859)
     rawv6_sendmsg (net/ipv6/raw.c:911)
     __sys_sendto (net/socket.c:714 (discriminator 1) net/socket.c:729 (discriminator 1) net/socket.c:2228 (discriminator 1))
     __x64_sys_sendto (net/socket.c:2231)
     do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1))
     entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    
    Freed by task 1543:
     kasan_save_stack (mm/kasan/common.c:48)
     kasan_save_track (mm/kasan/common.c:60 (discriminator 1) mm/kasan/common.c:69 (discriminator 1))
     kasan_save_free_info (mm/kasan/generic.c:579 (discriminator 1))
     __kasan_slab_free (mm/kasan/common.c:271)
     kmem_cache_free (mm/slub.c:4643 (discriminator 3) mm/slub.c:4745 (discriminator 3))
     pskb_expand_head (net/core/skbuff.c:2274)
     rpl_do_srh_inline.isra.0 (net/ipv6/rpl_iptunnel.c:158 (discriminator 1))
     rpl_input (net/ipv6/rpl_iptunnel.c:201 net/ipv6/rpl_iptunnel.c:282)
     lwtunnel_input (net/core/lwtunnel.c:459)
     ipv6_rcv (./include/net/dst.h:471 (discriminator 1) ./include/net/dst.h:469 (discriminator 1) net/ipv6/ip6_input.c:79 (discriminator 1) ./include/linux/netfilter.h:317 (discriminator 1) ./include/linux/netfilter.h:311 (discriminator 1) net/ipv6/ip6_input.c:311 (discriminator 1))
     __netif_receive_skb_one_core (net/core/dev.c:5967)
     process_backlog (./include/linux/rcupdate.h:869 net/core/dev.c:6440)
     __napi_poll.constprop.0 (net/core/dev.c:7452)
     net_rx_action (net/core/dev.c:7518 net/core/dev.c:7643)
     handle_softirqs (kernel/softirq.c:579)
     do_softirq (kernel/softirq.c:480 (discriminator 20))
     __local_bh_enable_ip (kernel/softirq.c:407)
     __dev_queue_xmit (net/core/dev.c:4740)
     ip6_finish_output2 (./include/linux/netdevice.h:3358 ./include/net/neighbour.h:526 ./include/net/neighbour.h:540 net/ipv6/ip6_output.c:141)
     ip6_finish_output (net/ipv6/ip6_output.c:215 net/ipv6/ip6_output.c:226)
     ip6_output (./include/linux/netfilter.h:306 net/ipv6/ip6_output.c:248)
     ip6_send_skb (net/ipv6/ip6_output.c:1983)
     rawv6_sendmsg (net/ipv6/raw.c:588 net/ipv6/raw.c:918)
     __sys_sendto (net/socket.c:714 (discriminator 1) net/socket.c:729 (discriminator 1) net/socket.c:2228 (discriminator 1))
     __x64_sys_sendto (net/socket.c:2231)
     do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1))
     entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
    
    The buggy address belongs to the object at ffff888122bf96c0
     which belongs to the cache skbuff_small_head of size 704
    The buggy address is located 24 bytes inside of
     freed 704-byte region [ffff888122bf96c0, ffff888122bf9980)
    
    The buggy address belongs to the physical page:
    page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x122bf8
    head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
    flags: 0x200000000000040(head|node=0|zone=2)
    page_type: f5(slab)
    raw: 0200000000000040 ffff888101fc0a00 ffffea000464dc00 0000000000000002
    raw: 0000000000000000 0000000080270027 00000000f5000000 0000000000000000
    head: 0200000000000040 ffff888101fc0a00 ffffea000464dc00 0000000000000002
    head: 0000000000000000 0000000080270027 00000000f5000000 0000000000000000
    head: 0200000000000003 ffffea00048afe01 00000000ffffffff 00000000ffffffff
    head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
     ffff888122bf9580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888122bf9600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    >ffff888122bf9680: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                        ^
     ffff888122bf9700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff888122bf9780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    
    Fixes: a7a29f9c361f8 ("net: ipv6: add rpl sr tunnel")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rtc: ds1307: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <bmasney@redhat.com>
Date:   Thu Jul 10 11:20:21 2025 -0400

    rtc: ds1307: fix incorrect maximum clock rate handling
    
    [ Upstream commit cf6eb547a24af7ad7bbd2abe9c5327f956bbeae8 ]
    
    When ds3231_clk_sqw_round_rate() is called with a requested rate higher
    than the highest supported rate, it currently returns 0, which disables
    the clock. According to the clk API, round_rate() should instead return
    the highest supported rate. Update the function to return the maximum
    supported rate in this case.
    
    Fixes: 6c6ff145b3346 ("rtc: ds1307: add clock provider support for DS3231")
    Signed-off-by: Brian Masney <bmasney@redhat.com>
    Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-1-33140bb2278e@redhat.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 [+ + +]
Author: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
Date:   Wed Jun 11 11:14:16 2025 -0700

    rtc: ds1307: handle oscillator stop flag (OSF) for ds1341
    
    [ Upstream commit 523923cfd5d622b8f4ba893fdaf29fa6adeb8c3e ]
    
    In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the
    kernel time as long as rtc_read_time() succeeds. In some power loss
    situations, our supercapacitor-backed DS1342 RTC comes up with either an
    unpredictable future time or the default 01/01/00 from the datasheet.
    The oscillator stop flag (OSF) is set in these scenarios due to the
    power loss and can be used to determine the validity of the RTC data.
    
    This change expands the oscillator stop flag (OSF) handling that has
    already been implemented for some chips to the ds1341 chip (DS1341 and
    DS1342 share a datasheet). This handling manages the validity of the RTC
    data in .read_time and .set_time based on the OSF.
    
    Signed-off-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
    Reviewed-by: Tyler Hicks <code@tyhicks.com>
    Acked-by: Rodolfo Giometti <giometti@enneenne.com>
    Link: https://lore.kernel.org/r/1749665656-30108-3-git-send-email-meaganlloyd@linux.microsoft.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe [+ + +]
Author: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
Date:   Wed Jun 11 11:14:15 2025 -0700

    rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe
    
    [ Upstream commit 48458654659c9c2e149c211d86637f1592470da5 ]
    
    In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the
    kernel time as long as rtc_read_time() succeeds. In some power loss
    situations, our supercapacitor-backed DS1342 RTC comes up with either an
    unpredictable future time or the default 01/01/00 from the datasheet.
    The oscillator stop flag (OSF) is set in these scenarios due to the
    power loss and can be used to determine the validity of the RTC data.
    
    Some chip types in the ds1307 driver already have OSF handling to
    determine whether .read_time provides valid RTC data or returns -EINVAL.
    
    This change removes the clear of the OSF in .probe as the OSF needs to
    be preserved to expand the OSF handling to the ds1341 chip type (note
    that DS1341 and DS1342 share a datasheet).
    
    Signed-off-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
    Reviewed-by: Tyler Hicks <code@tyhicks.com>
    Acked-by: Rodolfo Giometti <giometti@enneenne.com>
    Link: https://lore.kernel.org/r/1749665656-30108-2-git-send-email-meaganlloyd@linux.microsoft.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: hym8563: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <bmasney@redhat.com>
Date:   Thu Jul 10 11:20:22 2025 -0400

    rtc: hym8563: fix incorrect maximum clock rate handling
    
    [ Upstream commit d0a518eb0a692a2ab8357e844970660c5ea37720 ]
    
    When hym8563_clkout_round_rate() is called with a requested rate higher
    than the highest supported rate, it currently returns 0, which disables
    the clock. According to the clk API, round_rate() should instead return
    the highest supported rate. Update the function to return the maximum
    supported rate in this case.
    
    Fixes: dcaf038493525 ("rtc: add hym8563 rtc-driver")
    Signed-off-by: Brian Masney <bmasney@redhat.com>
    Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-2-33140bb2278e@redhat.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: pcf85063: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <bmasney@redhat.com>
Date:   Thu Jul 10 11:20:24 2025 -0400

    rtc: pcf85063: fix incorrect maximum clock rate handling
    
    [ Upstream commit 186ae1869880e58bb3f142d222abdb35ecb4df0f ]
    
    When pcf85063_clkout_round_rate() is called with a requested rate higher
    than the highest supported rate, it currently returns 0, which disables
    the clock. According to the clk API, round_rate() should instead return
    the highest supported rate. Update the function to return the maximum
    supported rate in this case.
    
    Fixes: 8c229ab6048b7 ("rtc: pcf85063: Add pcf85063 clkout control to common clock framework")
    Signed-off-by: Brian Masney <bmasney@redhat.com>
    Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-4-33140bb2278e@redhat.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: pcf8563: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <bmasney@redhat.com>
Date:   Thu Jul 10 11:20:25 2025 -0400

    rtc: pcf8563: fix incorrect maximum clock rate handling
    
    [ Upstream commit 906726a5efeefe0ef0103ccff5312a09080c04ae ]
    
    When pcf8563_clkout_round_rate() is called with a requested rate higher
    than the highest supported rate, it currently returns 0, which disables
    the clock. According to the clk API, round_rate() should instead return
    the highest supported rate. Update the function to return the maximum
    supported rate in this case.
    
    Fixes: a39a6405d5f94 ("rtc: pcf8563: add CLKOUT to common clock framework")
    Signed-off-by: Brian Masney <bmasney@redhat.com>
    Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-5-33140bb2278e@redhat.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rtc: rv3028: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <bmasney@redhat.com>
Date:   Thu Jul 10 11:20:26 2025 -0400

    rtc: rv3028: fix incorrect maximum clock rate handling
    
    [ Upstream commit b574acb3cf7591d2513a9f29f8c2021ad55fb881 ]
    
    When rv3028_clkout_round_rate() is called with a requested rate higher
    than the highest supported rate, it currently returns 0, which disables
    the clock. According to the clk API, round_rate() should instead return
    the highest supported rate. Update the function to return the maximum
    supported rate in this case.
    
    Fixes: f583c341a515f ("rtc: rv3028: add clkout support")
    Signed-off-by: Brian Masney <bmasney@redhat.com>
    Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-6-33140bb2278e@redhat.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/hypfs: Avoid unnecessary ioctl registration in debugfs [+ + +]
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Thu Aug 21 14:35:40 2025 +0200

    s390/hypfs: Avoid unnecessary ioctl registration in debugfs
    
    [ Upstream commit fec7bdfe7f8694a0c39e6c3ec026ff61ca1058b9 ]
    
    Currently, hypfs registers ioctl callbacks for all debugfs files,
    despite only one file requiring them. This leads to unintended exposure
    of unused interfaces to user space and can trigger side effects such as
    restricted access when kernel lockdown is enabled.
    
    Restrict ioctl registration to only those files that implement ioctl
    functionality to avoid interface clutter and unnecessary access
    restrictions.
    
    Tested-by: Mete Durlu <meted@linux.ibm.com>
    Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
    Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked down")
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

s390/hypfs: Enable limited access during lockdown [+ + +]
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Thu Aug 21 15:12:37 2025 +0200

    s390/hypfs: Enable limited access during lockdown
    
    [ Upstream commit 3868f910440c47cd5d158776be4ba4e2186beda7 ]
    
    When kernel lockdown is active, debugfs_locked_down() blocks access to
    hypfs files that register ioctl callbacks, even if the ioctl interface
    is not required for a function. This unnecessarily breaks userspace
    tools that only rely on read operations.
    
    Resolve this by registering a minimal set of file operations during
    lockdown, avoiding ioctl registration and preserving access for affected
    tooling.
    
    Note that this change restores hypfs functionality when lockdown is
    active from early boot (e.g. via lockdown=integrity kernel parameter),
    but does not apply to scenarios where lockdown is enabled dynamically
    while Linux is running.
    
    Tested-by: Mete Durlu <meted@linux.ibm.com>
    Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
    Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked down")
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/stp: Remove udelay from stp_sync_clock() [+ + +]
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Jul 3 13:50:27 2025 +0200

    s390/stp: Remove udelay from stp_sync_clock()
    
    [ Upstream commit b367017cdac21781a74eff4e208d3d38e1f38d3f ]
    
    When an stp sync check is handled on a system with multiple
    cpus each cpu gets a machine check but only the first one
    actually handles the sync operation. All other CPUs spin
    waiting for the first one to finish with a short udelay().
    But udelay can't be used here as the first CPU modifies tod_clock_base
    before performing the sync op. During this timeframe
    get_tod_clock_monotonic() might return a non-monotonic time.
    
    The time spent waiting should be very short and udelay is a busy loop
    anyways, therefore simply remove the udelay.
    
    Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/time: Use monotonic clock in get_cycles() [+ + +]
Author: Sven Schnelle <svens@linux.ibm.com>
Date:   Thu Jul 10 09:42:29 2025 +0200

    s390/time: Use monotonic clock in get_cycles()
    
    [ Upstream commit 09e7e29d2b49ba84bcefb3dc1657726d2de5bb24 ]
    
    Otherwise the code might not work correctly when the clock
    is changed.
    
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
samples: mei: Fix building on musl libc [+ + +]
Author: Brahmajit Das <listout@listout.xyz>
Date:   Wed Jul 2 19:29:55 2025 +0530

    samples: mei: Fix building on musl libc
    
    [ Upstream commit 239df3e4b4752524e7c0fb3417c218d8063654b4 ]
    
    The header bits/wordsize.h is glibc specific and on building on musl
    with allyesconfig results in
    
    samples/mei/mei-amt-version.c:77:10: fatal error: bits/wordsize.h: No such file or directory
       77 | #include <bits/wordsize.h>
          |          ^~~~~~~~~~~~~~~~~
    
    mei-amt-version.c build file without bits/wordsize.h on musl and glibc.
    
    However on musl we get the follwing error without sys/time.h
    
    samples/mei/mei-amt-version.c: In function 'mei_recv_msg':
    samples/mei/mei-amt-version.c:159:24: error: storage size of 'tv' isn't known
      159 |         struct timeval tv;
          |                        ^~
    samples/mei/mei-amt-version.c:160:9: error: unknown type name 'fd_set'
      160 |         fd_set set;
          |         ^~~~~~
    samples/mei/mei-amt-version.c:168:9: error: implicit declaration of function 'FD_ZERO' [-Wimplicit-function-declaration]
      168 |         FD_ZERO(&set);
          |         ^~~~~~~
    samples/mei/mei-amt-version.c:169:9: error: implicit declaration of function 'FD_SET'; did you mean 'L_SET'? [-Wimplicit-function-declaration]
      169 |         FD_SET(me->fd, &set);
          |         ^~~~~~
          |         L_SET
    samples/mei/mei-amt-version.c:170:14: error: implicit declaration of function 'select' [-Wimplicit-function-declaration]
      170 |         rc = select(me->fd + 1, &set, NULL, NULL, &tv);
          |              ^~~~~~
    samples/mei/mei-amt-version.c:171:23: error: implicit declaration of function 'FD_ISSET' [-Wimplicit-function-declaration]
      171 |         if (rc > 0 && FD_ISSET(me->fd, &set)) {
          |                       ^~~~~~~~
    samples/mei/mei-amt-version.c:159:24: warning: unused variable 'tv' [-Wunused-variable]
      159 |         struct timeval tv;
          |                        ^~
    
    Hence the the file has been included.
    
    Fixes: c52827cc4ddf ("staging/mei: add mei user space example")
    Signed-off-by: Brahmajit Das <listout@listout.xyz>
    Link: https://lore.kernel.org/r/20250702135955.24955-1-listout@listout.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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: Siddh Raman Pant <siddh.raman.pant@oracle.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: Siddh Raman Pant <siddh.raman.pant@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sch_htb: make htb_deactivate() idempotent [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Mon Apr 28 16:29:54 2025 -0700

    sch_htb: make htb_deactivate() idempotent
    
    commit 3769478610135e82b262640252d90f6efb05be71 upstream.
    
    Alan reported a NULL pointer dereference in htb_next_rb_node()
    after we made htb_qlen_notify() idempotent.
    
    It turns out in the following case it introduced some regression:
    
    htb_dequeue_tree():
      |-> fq_codel_dequeue()
        |-> qdisc_tree_reduce_backlog()
          |-> htb_qlen_notify()
            |-> htb_deactivate()
      |-> htb_next_rb_node()
      |-> htb_deactivate()
    
    For htb_next_rb_node(), after calling the 1st htb_deactivate(), the
    clprio[prio]->ptr could be already set to  NULL, which means
    htb_next_rb_node() is vulnerable here.
    
    For htb_deactivate(), although we checked qlen before calling it, in
    case of qlen==0 after qdisc_tree_reduce_backlog(), we may call it again
    which triggers the warning inside.
    
    To fix the issues here, we need to:
    
    1) Make htb_deactivate() idempotent, that is, simply return if we
       already call it before.
    2) Make htb_next_rb_node() safe against ptr==NULL.
    
    Many thanks to Alan for testing and for the reproducer.
    
    Fixes: 5ba8b837b522 ("sch_htb: make htb_qlen_notify() idempotent")
    Reported-by: Alan J. Wylie <alan@wylie.me.uk>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Link: https://patch.msgid.link/20250428232955.1740419-2-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Siddh Raman Pant <siddh.raman.pant@oracle.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: Siddh Raman Pant <siddh.raman.pant@oracle.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: Siddh Raman Pant <siddh.raman.pant@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
scsi: aacraid: Stop using PCI_IRQ_AFFINITY [+ + +]
Author: John Garry <john.g.garry@oracle.com>
Date:   Tue Jul 15 11:15:35 2025 +0000

    scsi: aacraid: Stop using PCI_IRQ_AFFINITY
    
    [ Upstream commit dafeaf2c03e71255438ffe5a341d94d180e6c88e ]
    
    When PCI_IRQ_AFFINITY is set for calling pci_alloc_irq_vectors(), it
    means interrupts are spread around the available CPUs. It also means that
    the interrupts become managed, which means that an interrupt is shutdown
    when all the CPUs in the interrupt affinity mask go offline.
    
    Using managed interrupts in this way means that we should ensure that
    completions should not occur on HW queues where the associated interrupt
    is shutdown. This is typically achieved by ensuring only CPUs which are
    online can generate IO completion traffic to the HW queue which they are
    mapped to (so that they can also serve completion interrupts for that HW
    queue).
    
    The problem in the driver is that a CPU can generate completions to a HW
    queue whose interrupt may be shutdown, as the CPUs in the HW queue
    interrupt affinity mask may be offline. This can cause IOs to never
    complete and hang the system. The driver maintains its own CPU <-> HW
    queue mapping for submissions, see aac_fib_vector_assign(), but this does
    not reflect the CPU <-> HW queue interrupt affinity mapping.
    
    Commit 9dc704dcc09e ("scsi: aacraid: Reply queue mapping to CPUs based on
    IRQ affinity") tried to remedy this issue may mapping CPUs properly to HW
    queue interrupts. However this was later reverted in commit c5becf57dd56
    ("Revert "scsi: aacraid: Reply queue mapping to CPUs based on IRQ
    affinity") - it seems that there were other reports of hangs. I guess
    that this was due to some implementation issue in the original commit or
    maybe a HW issue.
    
    Fix the very original hang by just not using managed interrupts by not
    setting PCI_IRQ_AFFINITY.  In this way, all CPUs will be in each HW queue
    affinity mask, so should not create completion problems if any CPUs go
    offline.
    
    Signed-off-by: John Garry <john.g.garry@oracle.com>
    Link: https://lore.kernel.org/r/20250715111535.499853-1-john.g.garry@oracle.com
    Closes: https://lore.kernel.org/linux-scsi/20250618192427.3845724-1-jmeneghi@redhat.com/
    Reviewed-by: John Meneghini <jmeneghi@redhat.com>
    Tested-by: John Meneghini <jmeneghi@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: bfa: Double-free fix [+ + +]
Author: jackysliu <1972843537@qq.com>
Date:   Tue Jun 24 19:58:24 2025 +0800

    scsi: bfa: Double-free fix
    
    [ Upstream commit add4c4850363d7c1b72e8fce9ccb21fdd2cf5dc9 ]
    
    When the bfad_im_probe() function fails during initialization, the memory
    pointed to by bfad->im is freed without setting bfad->im to NULL.
    
    Subsequently, during driver uninstallation, when the state machine enters
    the bfad_sm_stopping state and calls the bfad_im_probe_undo() function,
    it attempts to free the memory pointed to by bfad->im again, thereby
    triggering a double-free vulnerability.
    
    Set bfad->im to NULL if probing fails.
    
    Signed-off-by: jackysliu <1972843537@qq.com>
    Link: https://lore.kernel.org/r/tencent_3BB950D6D2D470976F55FC879206DE0B9A09@qq.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans [+ + +]
Author: Ranjan Kumar <ranjan.kumar@broadcom.com>
Date:   Tue Jun 24 11:46:49 2025 +0530

    scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans
    
    [ Upstream commit 37c4e72b0651e7697eb338cd1fb09feef472cc1a ]
    
    sas_user_scan() did not fully process wildcard channel scans
    (SCAN_WILD_CARD) when a transport-specific user_scan() callback was
    present. Only channel 0 would be scanned via user_scan(), while the
    remaining channels were skipped, potentially missing devices.
    
    user_scan() invokes updated sas_user_scan() for channel 0, and if
    successful, iteratively scans remaining channels (1 to
    shost->max_channel) via scsi_scan_host_selected().  This ensures complete
    wildcard scanning without affecting transport-specific scanning behavior.
    
    Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
    Link: https://lore.kernel.org/r/20250624061649.17990-1-ranjan.kumar@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jun 30 13:18:02 2025 +0200

    scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value
    
    [ Upstream commit 023a293b9cd0bb86a9b50cd7688a3d9d266826db ]
    
    The dma_unmap_sg() functions should be called with the same nents as the
    dma_map_sg(), not the value the map function returned.
    
    Fixes: 88a678bbc34c ("ibmvscsis: Initial commit of IBM VSCSI Tgt Driver")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://lore.kernel.org/r/20250630111803.94389-2-fourier.thomas@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: isci: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Fri Jun 27 16:24:47 2025 +0200

    scsi: isci: Fix dma_unmap_sg() nents value
    
    [ Upstream commit 063bec4444d54e5f35d11949c5c90eaa1ff84c11 ]
    
    The dma_unmap_sg() functions should be called with the same nents as the
    dma_map_sg(), not the value the map function returned.
    
    Fixes: ddcc7e347a89 ("isci: fix dma_unmap_sg usage")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://lore.kernel.org/r/20250627142451.241713-2-fourier.thomas@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated [+ + +]
Author: Showrya M N <showrya@chelsio.com>
Date:   Fri Jun 27 16:53:29 2025 +0530

    scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated
    
    [ Upstream commit 3ea3a256ed81f95ab0f3281a0e234b01a9cae605 ]
    
    In case of an ib_fast_reg_mr allocation failure during iSER setup, the
    machine hits a panic because iscsi_conn->dd_data is initialized
    unconditionally, even when no memory is allocated (dd_size == 0).  This
    leads invalid pointer dereference during connection teardown.
    
    Fix by setting iscsi_conn->dd_data only if memory is actually allocated.
    
    Panic trace:
    ------------
     iser: iser_create_fastreg_desc: Failed to allocate ib_fast_reg_mr err=-12
     iser: iser_alloc_rx_descriptors: failed allocating rx descriptors / data buffers
     BUG: unable to handle page fault for address: fffffffffffffff8
     RIP: 0010:swake_up_locked.part.5+0xa/0x40
     Call Trace:
      complete+0x31/0x40
      iscsi_iser_conn_stop+0x88/0xb0 [ib_iser]
      iscsi_stop_conn+0x66/0xc0 [scsi_transport_iscsi]
      iscsi_if_stop_conn+0x14a/0x150 [scsi_transport_iscsi]
      iscsi_if_rx+0x1135/0x1834 [scsi_transport_iscsi]
      ? netlink_lookup+0x12f/0x1b0
      ? netlink_deliver_tap+0x2c/0x200
      netlink_unicast+0x1ab/0x280
      netlink_sendmsg+0x257/0x4f0
      ? _copy_from_user+0x29/0x60
      sock_sendmsg+0x5f/0x70
    
    Signed-off-by: Showrya M N <showrya@chelsio.com>
    Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
    Link: https://lore.kernel.org/r/20250627112329.19763-1-showrya@chelsio.com
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure [+ + +]
Author: Justin Tee <justin.tee@broadcom.com>
Date:   Wed Jun 18 12:21:28 2025 -0700

    scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure
    
    [ Upstream commit 6698796282e828733cde3329c887b4ae9e5545e9 ]
    
    If a call to lpfc_sli4_read_rev() from lpfc_sli4_hba_setup() fails, the
    resultant cleanup routine lpfc_sli4_vport_delete_fcp_xri_aborted() may
    occur before sli4_hba.hdwqs are allocated.  This may result in a null
    pointer dereference when attempting to take the abts_io_buf_list_lock for
    the first hardware queue.  Fix by adding a null ptr check on
    phba->sli4_hba.hdwq and early return because this situation means there
    must have been an error during port initialization.
    
    Signed-off-by: Justin Tee <justin.tee@broadcom.com>
    Link: https://lore.kernel.org/r/20250618192138.124116-4-justintee8345@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: lpfc: Fix link down processing to address NULL pointer dereference [+ + +]
Author: James Smart <jsmart2021@gmail.com>
Date:   Mon Aug 11 23:08:22 2025 -0700

    scsi: lpfc: Fix link down processing to address NULL pointer dereference
    
    [ Upstream commit 1854f53ccd88ad4e7568ddfafafffe71f1ceb0a6 ]
    
    If an FC link down transition while PLOGIs are outstanding to fabric well
    known addresses, outstanding ABTS requests may result in a NULL pointer
    dereference. Driver unload requests may hang with repeated "2878" log
    messages.
    
    The Link down processing results in ABTS requests for outstanding ELS
    requests. The Abort WQEs are sent for the ELSs before the driver had set
    the link state to down. Thus the driver is sending the Abort with the
    expectation that an ABTS will be sent on the wire. The Abort request is
    stalled waiting for the link to come up. In some conditions the driver may
    auto-complete the ELSs thus if the link does come up, the Abort completions
    may reference an invalid structure.
    
    Fix by ensuring that Abort set the flag to avoid link traffic if issued due
    to conditions where the link failed.
    
    Link: https://lore.kernel.org/r/20211020211417.88754-7-jsmart2021@gmail.com
    Co-developed-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: James Smart <jsmart2021@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: lpfc: Remove redundant assignment to avoid memory leak [+ + +]
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Date:   Fri Aug 1 18:52:02 2025 +0000

    scsi: lpfc: Remove redundant assignment to avoid memory leak
    
    [ Upstream commit eea6cafb5890db488fce1c69d05464214616d800 ]
    
    Remove the redundant assignment if kzalloc() succeeds to avoid memory
    leak.
    
    Fixes: bd2cdd5e400f ("scsi: lpfc: NVME Initiator: Add debugfs support")
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
    Link: https://lore.kernel.org/r/20250801185202.42631-1-jiashengjiangcool@gmail.com
    Reviewed-by: Justin Tee <justin.tee@broadcom.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: mpt3sas: Correctly handle ATA device errors [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Fri Jun 6 14:27:47 2025 +0900

    scsi: mpt3sas: Correctly handle ATA device errors
    
    [ Upstream commit 15592a11d5a5c8411ac8494ec49736b658f6fbff ]
    
    With the ATA error model, an NCQ command failure always triggers an abort
    (termination) of all NCQ commands queued on the device. In such case, the
    SAT or the host must handle the failed command according to the command
    sense data and immediately retry all other NCQ commands that were aborted
    due to the failed NCQ command.
    
    For SAS HBAs controlled by the mpt3sas driver, NCQ command aborts are not
    handled by the HBA SAT and sent back to the host, with an ioc log
    information equal to 0x31080000 (IOC_LOGINFO_PREFIX_PL with the PL code
    PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR). The function
    _scsih_io_done() always forces a retry of commands terminated with the
    status MPI2_IOCSTATUS_SCSI_IOC_TERMINATED using the SCSI result
    DID_SOFT_ERROR, regardless of the log_info for the command.  This
    correctly forces the retry of collateral NCQ abort commands, but with the
    retry counter for the command being incremented. If a command to an ATA
    device is subject to too many retries due to other NCQ commands failing
    (e.g. read commands trying to access unreadable sectors), the collateral
    NCQ abort commands may be terminated with an error as they run out of
    retries. This violates the SAT specification and causes hard-to-debug
    command errors.
    
    Solve this issue by modifying the handling of the
    MPI2_IOCSTATUS_SCSI_IOC_TERMINATED status to check if a command is for an
    ATA device and if the command loginfo indicates an NCQ collateral
    abort. If that is the case, force the command retry using the SCSI result
    DID_IMM_RETRY to avoid incrementing the command retry count.
    
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Link: https://lore.kernel.org/r/20250606052747.742998-3-dlemoal@kernel.org
    Tested-by: Yafang Shao <laoar.shao@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: mvsas: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Fri Jun 27 15:48:18 2025 +0200

    scsi: mvsas: Fix dma_unmap_sg() nents value
    
    [ Upstream commit 0141618727bc929fe868153d21797f10ce5bef3f ]
    
    The dma_unmap_sg() functions should be called with the same nents as the
    dma_map_sg(), not the value the map function returned.
    
    Fixes: b5762948263d ("[SCSI] mvsas: Add Marvell 6440 SAS/SATA driver")
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://lore.kernel.org/r/20250627134822.234813-2-fourier.thomas@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: pm80xx: Fix memory leak during rmmod [+ + +]
Author: Ajish Koshy <Ajish.Koshy@microchip.com>
Date:   Sun Aug 10 22:20:35 2025 -0700

    scsi: pm80xx: Fix memory leak during rmmod
    
    [ Upstream commit 51e6ed83bb4ade7c360551fa4ae55c4eacea354b ]
    
    Driver failed to release all memory allocated. This would lead to memory
    leak during driver removal.
    
    Properly free memory when the module is removed.
    
    Link: https://lore.kernel.org/r/20210906170404.5682-5-Ajish.Koshy@microchip.com
    Acked-by: Jack Wang <jinpu.wang@ionos.com>
    Signed-off-by: Ajish Koshy <Ajish.Koshy@microchip.com>
    Signed-off-by: Viswas G <Viswas.G@microchip.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: qla4xxx: Prevent a potential error pointer dereference [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Aug 13 08:49:08 2025 +0300

    scsi: qla4xxx: Prevent a potential error pointer dereference
    
    [ Upstream commit 9dcf111dd3e7ed5fce82bb108e3a3fc001c07225 ]
    
    The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error,
    but qla4xxx_ep_connect() returns error pointers.  Propagating the error
    pointers will lead to an Oops in the caller, so change the error pointers
    to NULL.
    
    Fixes: 13483730a13b ("[SCSI] qla4xxx: fix flash/ddb support")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://lore.kernel.org/r/aJwnVKS9tHsw1tEu@stanley.mountain
    Reviewed-by: Chris Leech <cleech@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume [+ + +]
Author: Seunghui Lee <sh043.lee@samsung.com>
Date:   Thu Jul 17 17:12:13 2025 +0900

    scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume
    
    [ Upstream commit 35dabf4503b94a697bababe94678a8bc989c3223 ]
    
    If the h8 exit fails during runtime resume process, the runtime thread
    enters runtime suspend immediately and the error handler operates at the
    same time.  It becomes stuck and cannot be recovered through the error
    handler.  To fix this, use link recovery instead of the error handler.
    
    Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and other error recovery paths")
    Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
    Link: https://lore.kernel.org/r/20250717081213.6811-1-sh043.lee@samsung.com
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Acked-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: exynos: Fix programming of HCI_UTRL_NEXUS_TYPE [+ + +]
Author: André Draszik <andre.draszik@linaro.org>
Date:   Fri Aug 22 13:43:47 2025 -0400

    scsi: ufs: exynos: Fix programming of HCI_UTRL_NEXUS_TYPE
    
    [ Upstream commit 01aad16c2257ab8ff33b152b972c9f2e1af47912 ]
    
    On Google gs101, the number of UTP transfer request slots (nutrs) is 32,
    and in this case the driver ends up programming the UTRL_NEXUS_TYPE
    incorrectly as 0.
    
    This is because the left hand side of the shift is 1, which is of type
    int, i.e. 31 bits wide. Shifting by more than that width results in
    undefined behaviour.
    
    Fix this by switching to the BIT() macro, which applies correct type
    casting as required. This ensures the correct value is written to
    UTRL_NEXUS_TYPE (0xffffffff on gs101), and it also fixes a UBSAN shift
    warning:
    
        UBSAN: shift-out-of-bounds in drivers/ufs/host/ufs-exynos.c:1113:21
        shift exponent 32 is too large for 32-bit type 'int'
    
    For consistency, apply the same change to the nutmrs / UTMRL_NEXUS_TYPE
    write.
    
    Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
    Cc: stable@vger.kernel.org
    Signed-off-by: André Draszik <andre.draszik@linaro.org>
    Link: https://lore.kernel.org/r/20250707-ufs-exynos-shift-v1-1-1418e161ae40@linaro.org
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    [ Adjusted path from drivers/ufs/host to drivers/scsi/ufs ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sctp: linearize cloned gso packets in sctp_rcv [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Thu Aug 7 15:40:11 2025 -0400

    sctp: linearize cloned gso packets in sctp_rcv
    
    [ Upstream commit fd60d8a086191fe33c2d719732d2482052fa6805 ]
    
    A cloned head skb still shares these frag skbs in fraglist with the
    original head skb. It's not safe to access these frag skbs.
    
    syzbot reported two use-of-uninitialized-memory bugs caused by this:
    
      BUG: KMSAN: uninit-value in sctp_inq_pop+0x15b7/0x1920 net/sctp/inqueue.c:211
       sctp_inq_pop+0x15b7/0x1920 net/sctp/inqueue.c:211
       sctp_assoc_bh_rcv+0x1a7/0xc50 net/sctp/associola.c:998
       sctp_inq_push+0x2ef/0x380 net/sctp/inqueue.c:88
       sctp_backlog_rcv+0x397/0xdb0 net/sctp/input.c:331
       sk_backlog_rcv+0x13b/0x420 include/net/sock.h:1122
       __release_sock+0x1da/0x330 net/core/sock.c:3106
       release_sock+0x6b/0x250 net/core/sock.c:3660
       sctp_wait_for_connect+0x487/0x820 net/sctp/socket.c:9360
       sctp_sendmsg_to_asoc+0x1ec1/0x1f00 net/sctp/socket.c:1885
       sctp_sendmsg+0x32b9/0x4a80 net/sctp/socket.c:2031
       inet_sendmsg+0x25a/0x280 net/ipv4/af_inet.c:851
       sock_sendmsg_nosec net/socket.c:718 [inline]
    
    and
    
      BUG: KMSAN: uninit-value in sctp_assoc_bh_rcv+0x34e/0xbc0 net/sctp/associola.c:987
       sctp_assoc_bh_rcv+0x34e/0xbc0 net/sctp/associola.c:987
       sctp_inq_push+0x2a3/0x350 net/sctp/inqueue.c:88
       sctp_backlog_rcv+0x3c7/0xda0 net/sctp/input.c:331
       sk_backlog_rcv+0x142/0x420 include/net/sock.h:1148
       __release_sock+0x1d3/0x330 net/core/sock.c:3213
       release_sock+0x6b/0x270 net/core/sock.c:3767
       sctp_wait_for_connect+0x458/0x820 net/sctp/socket.c:9367
       sctp_sendmsg_to_asoc+0x223a/0x2260 net/sctp/socket.c:1886
       sctp_sendmsg+0x3910/0x49f0 net/sctp/socket.c:2032
       inet_sendmsg+0x269/0x2a0 net/ipv4/af_inet.c:851
       sock_sendmsg_nosec net/socket.c:712 [inline]
    
    This patch fixes it by linearizing cloned gso packets in sctp_rcv().
    
    Fixes: 90017accff61 ("sctp: Add GSO support")
    Reported-by: syzbot+773e51afe420baaf0e2b@syzkaller.appspotmail.com
    Reported-by: syzbot+70a42f45e76bede082be@syzkaller.appspotmail.com
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Link: https://patch.msgid.link/dd7dc337b99876d4132d0961f776913719f7d225.1754595611.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
securityfs: don't pin dentries twice, once is enough... [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Thu May 8 23:38:01 2025 -0400

    securityfs: don't pin dentries twice, once is enough...
    
    [ Upstream commit 27cd1bf1240d482e4f02ca4f9812e748f3106e4f ]
    
    incidentally, securityfs_recursive_remove() is broken without that -
    it leaks dentries, since simple_recursive_removal() does not expect
    anything of that sort.  It could be worked around by dput() in
    remove_one() callback, but it's easier to just drop that double-get
    stuff.
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/futex: Define SYS_futex on 32-bit architectures with 64-bit time_t [+ + +]
Author: Cynthia Huang <cynthia@andestech.com>
Date:   Thu Jul 10 18:36:30 2025 +0800

    selftests/futex: Define SYS_futex on 32-bit architectures with 64-bit time_t
    
    [ Upstream commit 04850819c65c8242072818655d4341e70ae998b5 ]
    
    The kernel does not provide sys_futex() on 32-bit architectures that do not
    support 32-bit time representations, such as riscv32.
    
    As a result, glibc cannot define SYS_futex, causing compilation failures in
    tests that rely on this syscall. Define SYS_futex as SYS_futex_time64 in
    such cases to ensure successful compilation and compatibility.
    
    Signed-off-by: Cynthia Huang <cynthia@andestech.com>
    Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Link: https://lore.kernel.org/all/20250710103630.3156130-1-ben717@andestech.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/memfd: add test for mapping write-sealed memfd read-only [+ + +]
Author: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date:   Tue Jul 29 18:54:02 2025 -0700

    selftests/memfd: add test for mapping write-sealed memfd read-only
    
    [ Upstream commit ea0916e01d0b0f2cce1369ac1494239a79827270 ]
    
    Now we have reinstated the ability to map F_SEAL_WRITE mappings read-only,
    assert that we are able to do this in a test to ensure that we do not
    regress this again.
    
    Link: https://lkml.kernel.org/r/a6377ec470b14c0539b4600cf8fa24bf2e4858ae.1732804776.git.lorenzo.stoakes@oracle.com
    Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Julian Orth <ju.orth@gmail.com>
    Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/tracing: Fix false failure of subsystem event test [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Mon Jul 21 13:42:12 2025 -0400

    selftests/tracing: Fix false failure of subsystem event test
    
    [ Upstream commit 213879061a9c60200ba971330dbefec6df3b4a30 ]
    
    The subsystem event test enables all "sched" events and makes sure there's
    at least 3 different events in the output. It used to cat the entire trace
    file to | wc -l, but on slow machines, that could last a very long time.
    To solve that, it was changed to just read the first 100 lines of the
    trace file. This can cause false failures as some events repeat so often,
    that the 100 lines that are examined could possibly be of only one event.
    
    Instead, create an awk script that looks for 3 different events and will
    exit out after it finds them. This will find the 3 events the test looks
    for (eventually if it works), and still exit out after the test is
    satisfied and not cause slower machines to run forever.
    
    Link: https://lore.kernel.org/r/20250721134212.53c3e140@batman.local.home
    Reported-by: Tengda Wu <wutengda@huaweicloud.com>
    Closes: https://lore.kernel.org/all/20250710130134.591066-1-wutengda@huaweicloud.com/
    Fixes: 1a4ea83a6e67 ("selftests/ftrace: Limit length in subsystem-enable tests")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests: mptcp: connect: also cover alt modes [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Tue Jul 15 20:43:28 2025 +0200

    selftests: mptcp: connect: also cover alt modes
    
    commit 37848a456fc38c191aedfe41f662cc24db8c23d9 upstream.
    
    The "mmap" and "sendfile" alternate modes for mptcp_connect.sh/.c are
    available from the beginning, but only tested when mptcp_connect.sh is
    manually launched with "-m mmap" or "-m sendfile", not via the
    kselftests helpers.
    
    The MPTCP CI was manually running "mptcp_connect.sh -m mmap", but not
    "-m sendfile". Plus other CIs, especially the ones validating the stable
    releases, were not validating these alternate modes.
    
    To make sure these modes are validated by these CIs, add two new test
    programs executing mptcp_connect.sh with the alternate modes.
    
    Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
    Cc: stable@vger.kernel.org
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250715-net-mptcp-sft-connect-alt-v2-1-8230ddd82454@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Drop userspace_pm.sh from TEST_PROGS ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    [ Drop mptcp_sockopt.sh from TEST_PROGS, and drop "sendfile" which is
      not supported in this version. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: pm: check flush doesn't reset limits [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri Aug 15 19:28:21 2025 +0200

    selftests: mptcp: pm: check flush doesn't reset limits
    
    commit 452690be7de2f91cc0de68cb9e95252875b33503 upstream.
    
    This modification is linked to the parent commit where the received
    ADD_ADDR limit was accidentally reset when the endpoints were flushed.
    
    To validate that, the test is now flushing endpoints after having set
    new limits, and before checking them.
    
    The 'Fixes' tag here below is the same as the one from the previous
    commit: this patch here is not fixing anything wrong in the selftests,
    but it validates the previous fix for an issue introduced by this commit
    ID.
    
    Fixes: 01cacb00b35c ("mptcp: add netlink-based PM")
    Cc: stable@vger.kernel.org
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250815-net-mptcp-misc-fixes-6-17-rc2-v1-3-521fe9957892@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflicts in pm_netlink.sh, because some refactoring have been done
      later on: commit 3188309c8ceb ("selftests: mptcp: netlink:
      add 'limits' helpers") and commit c99d57d0007a ("selftests: mptcp: use
      pm_nl endpoint ops") are not in this version. The same operation can
      still be done at the same place, without using the new helper. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: rtnetlink.sh: remove esp4_offload after test [+ + +]
Author: Xiumei Mu <xmu@redhat.com>
Date:   Fri Jul 25 11:50:28 2025 +0800

    selftests: rtnetlink.sh: remove esp4_offload after test
    
    [ Upstream commit 5b32321fdaf3fd1a92ec726af18765e225b0ee2b ]
    
    The esp4_offload module, loaded during IPsec offload tests, should
    be reset to its default settings after testing.
    Otherwise, leaving it enabled could unintentionally affect subsequence
    test cases by keeping offload active.
    
    Without this fix:
    $ lsmod | grep offload; ./rtnetlink.sh -t kci_test_ipsec_offload ; lsmod | grep offload;
    PASS: ipsec_offload
    esp4_offload           12288  0
    esp4                   32768  1 esp4_offload
    
    With this fix:
    $ lsmod | grep offload; ./rtnetlink.sh -t kci_test_ipsec_offload ; lsmod | grep offload;
    PASS: ipsec_offload
    
    Fixes: 2766a11161cc ("selftests: rtnetlink: add ipsec offload API test")
    Signed-off-by: Xiumei Mu <xmu@redhat.com>
    Reviewed-by: Shannon Nelson <sln@onemain.com>
    Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
    Link: https://patch.msgid.link/6d3a1d777c4de4eb0ca94ced9e77be8d48c5b12f.1753415428.git.xmu@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selftests: tracing: Use mutex_unlock for testing glob filter [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Thu Jul 3 13:26:43 2025 +0900

    selftests: tracing: Use mutex_unlock for testing glob filter
    
    [ Upstream commit a089bb2822a49b0c5777a8936f82c1f8629231fb ]
    
    Since commit c5b6ababd21a ("locking/mutex: implement
    mutex_trylock_nested") makes mutex_trylock() as an inlined
    function if CONFIG_DEBUG_LOCK_ALLOC=y, we can not use
    mutex_trylock() for testing the glob filter of ftrace.
    
    Use mutex_unlock instead.
    
    Link: https://lore.kernel.org/r/175151680309.2149615.9795104805153538717.stgit@mhiramat.tok.corp.google.com
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
serial: 8250: fix panic due to PSLVERR [+ + +]
Author: Yunhui Cui <cuiyunhui@bytedance.com>
Date:   Wed Jul 23 10:33:22 2025 +0800

    serial: 8250: fix panic due to PSLVERR
    
    commit 7f8fdd4dbffc05982b96caf586f77a014b2a9353 upstream.
    
    When the PSLVERR_RESP_EN parameter is set to 1, the device generates
    an error response if an attempt is made to read an empty RBR (Receive
    Buffer Register) while the FIFO is enabled.
    
    In serial8250_do_startup(), calling serial_port_out(port, UART_LCR,
    UART_LCR_WLEN8) triggers dw8250_check_lcr(), which invokes
    dw8250_force_idle() and serial8250_clear_and_reinit_fifos(). The latter
    function enables the FIFO via serial_out(p, UART_FCR, p->fcr).
    Execution proceeds to the serial_port_in(port, UART_RX).
    This satisfies the PSLVERR trigger condition.
    
    When another CPU (e.g., using printk()) is accessing the UART (UART
    is busy), the current CPU fails the check (value & ~UART_LCR_SPAR) ==
    (lcr & ~UART_LCR_SPAR) in dw8250_check_lcr(), causing it to enter
    dw8250_force_idle().
    
    Put serial_port_out(port, UART_LCR, UART_LCR_WLEN8) under the port->lock
    to fix this issue.
    
    Panic backtrace:
    [    0.442336] Oops - unknown exception [#1]
    [    0.442343] epc : dw8250_serial_in32+0x1e/0x4a
    [    0.442351]  ra : serial8250_do_startup+0x2c8/0x88e
    ...
    [    0.442416] console_on_rootfs+0x26/0x70
    
    Fixes: c49436b657d0 ("serial: 8250_dw: Improve unwritable LCR workaround")
    Link: https://lore.kernel.org/all/84cydt5peu.fsf@jogness.linutronix.de/T/
    Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
    Reviewed-by: John Ogness <john.ogness@linutronix.de>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20250723023322.464-2-cuiyunhui@bytedance.com
    [ Applied fix to serial8250_do_startup() instead of serial8250_initialize() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sh: Do not use hyphen in exported variable name [+ + +]
Author: Ben Hutchings <benh@debian.org>
Date:   Thu Jul 17 16:47:32 2025 +0200

    sh: Do not use hyphen in exported variable name
    
    [ Upstream commit c32969d0362a790fbc6117e0b6a737a7e510b843 ]
    
    arch/sh/Makefile defines and exports ld-bfd to be used by
    arch/sh/boot/compressed/Makefile and arch/sh/boot/romimage/Makefile.
    However some shells, including dash, will not pass through environment
    variables whose name includes a hyphen.  Usually GNU make does not use
    a shell to recurse, but if e.g. $(srctree) contains '~' it will use a
    shell here.
    
    Other instances of this problem were previously fixed by commits
    2bfbe7881ee0 "kbuild: Do not use hyphen in exported variable name"
    and 82977af93a0d "sh: rename suffix-y to suffix_y".
    
    Rename the variable to ld_bfd.
    
    References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=sh4&ver=4.13%7Erc5-1%7Eexp1&stamp=1502943967&raw=0
    Fixes: 7b022d07a0fd ("sh: Tidy up the ldscript output format specifier.")
    Signed-off-by: Ben Hutchings <benh@debian.org>
    Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
smb: client: fix use-after-free in crypt_message when using async crypto [+ + +]
Author: Wang Zhaolong <wangzhaolong@huaweicloud.com>
Date:   Tue Jul 22 17:59:01 2025 -0400

    smb: client: fix use-after-free in crypt_message when using async crypto
    
    [ Upstream commit b220bed63330c0e1733dc06ea8e75d5b9962b6b6 ]
    
    The CVE-2024-50047 fix removed asynchronous crypto handling from
    crypt_message(), assuming all crypto operations are synchronous.
    However, when hardware crypto accelerators are used, this can cause
    use-after-free crashes:
    
      crypt_message()
        // Allocate the creq buffer containing the req
        creq = smb2_get_aead_req(..., &req);
    
        // Async encryption returns -EINPROGRESS immediately
        rc = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
    
        // Free creq while async operation is still in progress
        kvfree_sensitive(creq, ...);
    
    Hardware crypto modules often implement async AEAD operations for
    performance. When crypto_aead_encrypt/decrypt() returns -EINPROGRESS,
    the operation completes asynchronously. Without crypto_wait_req(),
    the function immediately frees the request buffer, leading to crashes
    when the driver later accesses the freed memory.
    
    This results in a use-after-free condition when the hardware crypto
    driver later accesses the freed request structure, leading to kernel
    crashes with NULL pointer dereferences.
    
    The issue occurs because crypto_alloc_aead() with mask=0 doesn't
    guarantee synchronous operation. Even without CRYPTO_ALG_ASYNC in
    the mask, async implementations can be selected.
    
    Fix by restoring the async crypto handling:
    - DECLARE_CRYPTO_WAIT(wait) for completion tracking
    - aead_request_set_callback() for async completion notification
    - crypto_wait_req() to wait for operation completion
    
    This ensures the request buffer isn't freed until the crypto operation
    completes, whether synchronous or asynchronous, while preserving the
    CVE-2024-50047 fix.
    
    Fixes: b0abcd65ec54 ("smb: client: fix UAF in async decryption")
    Link: https://lore.kernel.org/all/8b784a13-87b0-4131-9ff9-7a8993538749@huaweicloud.com/
    Cc: stable@vger.kernel.org
    Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
    Signed-off-by: Wang Zhaolong <wangzhaolong@huaweicloud.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: let recv_done() cleanup before notifying the callers. [+ + +]
Author: Stefan Metzmacher <metze@samba.org>
Date:   Mon Aug 4 14:10:15 2025 +0200

    smb: client: let recv_done() cleanup before notifying the callers.
    
    [ Upstream commit bdd7afc6dca5e0ebbb75583484aa6ea9e03fbb13 ]
    
    We should call put_receive_buffer() before waking up the callers.
    
    For the internal error case of response->type being unexpected,
    we now also call smbd_disconnect_rdma_connection() instead
    of not waking up the callers at all.
    
    Note that the SMBD_TRANSFER_DATA case still has problems,
    which will be addressed in the next commit in order to make
    it easier to review this one.
    
    Cc: Steve French <smfrench@gmail.com>
    Cc: Tom Talpey <tom@talpey.com>
    Cc: Long Li <longli@microsoft.com>
    Cc: linux-cifs@vger.kernel.org
    Cc: samba-technical@lists.samba.org
    Fixes: f198186aa9bb ("CIFS: SMBD: Establish SMB Direct connection")
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
soc/tegra: pmc: Ensure power-domains are in a known state [+ + +]
Author: Jon Hunter <jonathanh@nvidia.com>
Date:   Thu Jul 31 13:18:32 2025 +0100

    soc/tegra: pmc: Ensure power-domains are in a known state
    
    commit b6bcbce3359619d05bf387d4f5cc3af63668dbaa upstream.
    
    After commit 13a4b7fb6260 ("pmdomain: core: Leave powered-on genpds on
    until late_initcall_sync") was applied, the Tegra210 Jetson TX1 board
    failed to boot. Looking into this issue, before this commit was applied,
    if any of the Tegra power-domains were in 'on' state when the kernel
    booted, they were being turned off by the genpd core before any driver
    had chance to request them. This was purely by luck and a consequence of
    the power-domains being turned off earlier during boot. After this
    commit was applied, any power-domains in the 'on' state are kept on for
    longer during boot and therefore, may never transitioned to the off
    state before they are requested/used. The hang on the Tegra210 Jetson
    TX1 is caused because devices in some power-domains are accessed without
    the power-domain being turned off and on, indicating that the
    power-domain is not in a completely on state.
    
    >From reviewing the Tegra PMC driver code, if a power-domain is in the
    'on' state there is no guarantee that all the necessary clocks
    associated with the power-domain are on and even if they are they would
    not have been requested via the clock framework and so could be turned
    off later. Some power-domains also have a 'clamping' register that needs
    to be configured as well. In short, if a power-domain is already 'on' it
    is difficult to know if it has been configured correctly. Given that the
    power-domains happened to be switched off during boot previously, to
    ensure that they are in a good known state on boot, fix this by
    switching off any power-domains that are on initially when registering
    the power-domains with the genpd framework.
    
    Note that commit 05cfb988a4d0 ("soc/tegra: pmc: Initialise resets
    associated with a power partition") updated the
    tegra_powergate_of_get_resets() function to pass the 'off' to ensure
    that the resets for the power-domain are in the correct state on boot.
    However, now that we may power off a domain on boot, if it is on, it is
    better to move this logic into the tegra_powergate_add() function so
    that there is a single place where we are handling the initial state of
    the power-domain.
    
    Fixes: a38045121bf4 ("soc/tegra: pmc: Add generic PM domain support")
    Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250731121832.213671-1-jonathanh@nvidia.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
soc: aspeed: lpc-snoop: Cleanup resources in stack-order [+ + +]
Author: Andrew Jeffery <andrew@codeconstruct.com.au>
Date:   Mon Jun 16 22:43:38 2025 +0930

    soc: aspeed: lpc-snoop: Cleanup resources in stack-order
    
    commit 8481d59be606d2338dbfe14b04cdbd1a3402c150 upstream.
    
    Free the kfifo after unregistering the miscdev in
    aspeed_lpc_disable_snoop() as the kfifo is initialised before the
    miscdev in aspeed_lpc_enable_snoop().
    
    Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev")
    Cc: stable@vger.kernel.org
    Cc: Jean Delvare <jdelvare@suse.de>
    Acked-by: Jean Delvare <jdelvare@suse.de>
    Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-1-3cdd59c934d3@codeconstruct.com.au
    Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: aspeed: lpc-snoop: Don't disable channels that aren't enabled [+ + +]
Author: Andrew Jeffery <andrew@codeconstruct.com.au>
Date:   Mon Jun 16 22:43:39 2025 +0930

    soc: aspeed: lpc-snoop: Don't disable channels that aren't enabled
    
    commit 56448e78a6bb4e1a8528a0e2efe94eff0400c247 upstream.
    
    Mitigate e.g. the following:
    
        # echo 1e789080.lpc-snoop > /sys/bus/platform/drivers/aspeed-lpc-snoop/unbind
        ...
        [  120.363594] Unable to handle kernel NULL pointer dereference at virtual address 00000004 when write
        [  120.373866] [00000004] *pgd=00000000
        [  120.377910] Internal error: Oops: 805 [#1] SMP ARM
        [  120.383306] CPU: 1 UID: 0 PID: 315 Comm: sh Not tainted 6.15.0-rc1-00009-g926217bc7d7d-dirty #20 NONE
        ...
        [  120.679543] Call trace:
        [  120.679559]  misc_deregister from aspeed_lpc_snoop_remove+0x84/0xac
        [  120.692462]  aspeed_lpc_snoop_remove from platform_remove+0x28/0x38
        [  120.700996]  platform_remove from device_release_driver_internal+0x188/0x200
        ...
    
    Fixes: 9f4f9ae81d0a ("drivers/misc: add Aspeed LPC snoop driver")
    Cc: stable@vger.kernel.org
    Cc: Jean Delvare <jdelvare@suse.de>
    Acked-by: Jean Delvare <jdelvare@suse.de>
    Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-2-3cdd59c934d3@codeconstruct.com.au
    Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

soc: qcom: mdt_loader: Ensure we don't read past the ELF header [+ + +]
Author: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Date:   Fri Aug 22 14:18:15 2025 -0400

    soc: qcom: mdt_loader: Ensure we don't read past the ELF header
    
    [ Upstream commit 9f9967fed9d066ed3dae9372b45ffa4f6fccfeef ]
    
    When the MDT loader is used in remoteproc, the ELF header is sanitized
    beforehand, but that's not necessary the case for other clients.
    
    Validate the size of the firmware buffer to ensure that we don't read
    past the end as we iterate over the header. e_phentsize and e_shentsize
    are validated as well, to ensure that the assumptions about step size in
    the traversal are valid.
    
    Fixes: 2aad40d911ee ("remoteproc: Move qcom_mdt_loader into drivers/soc/qcom")
    Cc: stable@vger.kernel.org
    Reported-by: Doug Anderson <dianders@chromium.org>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20250610-mdt-loader-validation-and-fixes-v2-1-f7073e9ab899@oss.qualcomm.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
soundwire: stream: restore params when prepare ports fail [+ + +]
Author: Bard Liao <yung-chuan.liao@linux.intel.com>
Date:   Thu Jun 26 14:09:52 2025 +0800

    soundwire: stream: restore params when prepare ports fail
    
    [ Upstream commit dba7d9dbfdc4389361ff3a910e767d3cfca22587 ]
    
    The bus->params should be restored if the stream is failed to prepare.
    The issue exists since beginning. The Fixes tag just indicates the
    first commit that the commit can be applied to.
    
    Fixes: 17ed5bef49f4 ("soundwire: add missing newlines in dynamic debug logs")
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Link: https://lore.kernel.org/r/20250626060952.405996-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
squashfs: fix memory leak in squashfs_fill_super [+ + +]
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date:   Mon Aug 11 23:37:40 2025 +0100

    squashfs: fix memory leak in squashfs_fill_super
    
    commit b64700d41bdc4e9f82f1346c15a3678ebb91a89c upstream.
    
    If sb_min_blocksize returns 0, squashfs_fill_super exits without freeing
    allocated memory (sb->s_fs_info).
    
    Fix this by moving the call to sb_min_blocksize to before memory is
    allocated.
    
    Link: https://lkml.kernel.org/r/20250811223740.110392-1-phillip@squashfs.org.uk
    Fixes: 734aa85390ea ("Squashfs: check return result of sb_min_blocksize")
    Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
    Reported-by: Scott GUO <scottzhguo@tencent.com>
    Closes: https://lore.kernel.org/all/20250811061921.3807353-1-scott_gzh@163.com
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc() [+ + +]
Author: Abdun Nihaal <abdun.nihaal@gmail.com>
Date:   Thu Jun 26 22:54:10 2025 +0530

    staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc()
    
    [ Upstream commit eb2cb7dab60f9be0b435ac4a674255429a36d72c ]
    
    In the error paths after fb_info structure is successfully allocated,
    the memory allocated in fb_deferred_io_init() for info->pagerefs is not
    freed. Fix that by adding the cleanup function on the error path.
    
    Fixes: c296d5f9957c ("staging: fbtft: core support")
    Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://lore.kernel.org/r/20250626172412.18355-1-abdun.nihaal@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

staging: nvec: Fix incorrect null termination of battery manufacturer [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Sat Jul 19 01:07:42 2025 -0700

    staging: nvec: Fix incorrect null termination of battery manufacturer
    
    [ Upstream commit a8934352ba01081c51d2df428e9d540aae0e88b5 ]
    
    The battery manufacturer string was incorrectly null terminated using
    bat_model instead of bat_manu. This could result in an unintended
    write to the wrong field and potentially incorrect behavior.
    
    fixe the issue by correctly null terminating the bat_manu string.
    
    Fixes: 32890b983086 ("Staging: initial version of the nvec driver")
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://lore.kernel.org/r/20250719080755.3954373-1-alok.a.tiwari@oracle.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sunvdc: Balance device refcount in vdc_port_mpgroup_check [+ + +]
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Sat Jul 19 15:58:56 2025 +0800

    sunvdc: Balance device refcount in vdc_port_mpgroup_check
    
    commit 63ce53724637e2e7ba51fe3a4f78351715049905 upstream.
    
    Using device_find_child() to locate a probed virtual-device-port node
    causes a device refcount imbalance, as device_find_child() internally
    calls get_device() to increment the device’s reference count before
    returning its pointer. vdc_port_mpgroup_check() directly returns true
    upon finding a matching device without releasing the reference via
    put_device(). We should call put_device() to decrement refcount.
    
    As comment of device_find_child() says, 'NOTE: you will need to drop
    the reference with put_device() after use'.
    
    Found by code review.
    
    Cc: stable@vger.kernel.org
    Fixes: 3ee70591d6c4 ("sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20250719075856.3447953-1-make24@iscas.ac.cn
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range [+ + +]
Author: xin.guo <guoxin0309@gmail.com>
Date:   Thu Jun 26 12:34:19 2025 +0000

    tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range
    
    [ Upstream commit a041f70e573e185d5d5fdbba53f0db2fbe7257ad ]
    
    If the new coming segment covers more than one skbs in the ofo queue,
    and which seq is equal to rcv_nxt, then the sequence range
    that is duplicated will be sent as DUP SACK, the detail as below,
    in step6, the {501,2001} range is clearly including too much
    DUP SACK range, in violation of RFC 2883 rules.
    
    1. client > server: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500
    2. server > client: Flags [.], ack 1, [nop,nop,sack 1 {501:1001}], length 0
    3. client > server: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500
    4. server > client: Flags [.], ack 1, [nop,nop,sack 2 {1501:2001} {501:1001}], length 0
    5. client > server: Flags [.], seq 1:2001, ack 1325288529, win 20000, length 2000
    6. server > client: Flags [.], ack 2001, [nop,nop,sack 1 {501:2001}], length 0
    
    After this fix, the final ACK is as below:
    
    6. server > client: Flags [.], ack 2001, options [nop,nop,sack 1 {501:1001}], length 0
    
    [edumazet] added a new packetdrill test in the following patch.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: xin.guo <guoxin0309@gmail.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250626123420.1933835-2-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
thermal: sysfs: Return ENODATA instead of EAGAIN for reads [+ + +]
Author: Hsin-Te Yuan <yuanhsinte@chromium.org>
Date:   Fri Jun 20 10:41:43 2025 +0000

    thermal: sysfs: Return ENODATA instead of EAGAIN for reads
    
    [ Upstream commit 1a4aabc27e95674837f2e25f4ef340c0469e6203 ]
    
    According to POSIX spec, EAGAIN returned by read with O_NONBLOCK set
    means the read would block. Hence, the common implementation in
    nonblocking model will poll the file when the nonblocking read returns
    EAGAIN. However, when the target file is thermal zone, this mechanism
    will totally malfunction because thermal zone doesn't implement sysfs
    notification and thus the poll will never return.
    
    For example, the read in Golang implemnts such method and sometimes
    hangs at reading some thermal zones via sysfs.
    
    Change to return -ENODATA instead of -EAGAIN to userspace.
    
    Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
    Link: https://patch.msgid.link/20250620-temp-v3-1-6becc6aeb66c@chromium.org
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
thunderbolt: Fix bit masking in tb_dp_port_set_hops() [+ + +]
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Date:   Sun Jun 22 10:17:02 2025 -0700

    thunderbolt: Fix bit masking in tb_dp_port_set_hops()
    
    commit 2cdde91c14ec358087f43287513946d493aef940 upstream.
    
    The tb_dp_port_set_hops() function was incorrectly clearing
    ADP_DP_CS_1_AUX_RX_HOPID_MASK twice. According to the function's
    purpose, it should clear both TX and RX AUX HopID fields.  Replace the
    first instance with ADP_DP_CS_1_AUX_TX_HOPID_MASK to ensure proper
    configuration of both AUX directions.
    
    Fixes: 98176380cbe5 ("thunderbolt: Convert DP adapter register names to follow the USB4 spec")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: Fix copy+paste error in match_service_id() [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Jul 20 22:01:36 2025 -0700

    thunderbolt: Fix copy+paste error in match_service_id()
    
    commit 5cc1f66cb23cccc704e3def27ad31ed479e934a5 upstream.
    
    The second instance of TBSVC_MATCH_PROTOCOL_VERSION seems to have been
    intended to be TBSVC_MATCH_PROTOCOL_REVISION.
    
    Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Link: https://lore.kernel.org/r/20250721050136.30004-1-ebiggers@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing: Add down_write(trace_event_sem) when adding trace event [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Tue Jul 22 10:06:16 2025 -0400

    tracing: Add down_write(trace_event_sem) when adding trace event
    
    [ Upstream commit b5e8acc14dcb314a9b61ff19dcd9fdd0d88f70df ]
    
    When a module is loaded, it adds trace events defined by the module. It
    may also need to modify the modules trace printk formats to replace enum
    names with their values.
    
    If two modules are loaded at the same time, the adding of the event to the
    ftrace_events list can corrupt the walking of the list in the code that is
    modifying the printk format strings and crash the kernel.
    
    The addition of the event should take the trace_event_sem for write while
    it adds the new event.
    
    Also add a lockdep_assert_held() on that semaphore in
    __trace_add_event_dirs() as it iterates the list.
    
    Cc: stable@vger.kernel.org
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Link: https://lore.kernel.org/20250718223158.799bfc0c@batman.local.home
    Reported-by: Fusheng Huang(黄富生)  <Fusheng.Huang@luxshare-ict.com>
    Closes: https://lore.kernel.org/all/20250717105007.46ccd18f@batman.local.home/
    Fixes: 110bf2b764eb6 ("tracing: add protection around module events unload")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tracing: Limit access to parser->buffer when trace_get_user failed [+ + +]
Author: Pu Lehui <pulehui@huawei.com>
Date:   Sun Aug 24 10:08:38 2025 -0400

    tracing: Limit access to parser->buffer when trace_get_user failed
    
    [ Upstream commit 6a909ea83f226803ea0e718f6e88613df9234d58 ]
    
    When the length of the string written to set_ftrace_filter exceeds
    FTRACE_BUFF_MAX, the following KASAN alarm will be triggered:
    
    BUG: KASAN: slab-out-of-bounds in strsep+0x18c/0x1b0
    Read of size 1 at addr ffff0000d00bd5ba by task ash/165
    
    CPU: 1 UID: 0 PID: 165 Comm: ash Not tainted 6.16.0-g6bcdbd62bd56-dirty
    Hardware name: linux,dummy-virt (DT)
    Call trace:
     show_stack+0x34/0x50 (C)
     dump_stack_lvl+0xa0/0x158
     print_address_description.constprop.0+0x88/0x398
     print_report+0xb0/0x280
     kasan_report+0xa4/0xf0
     __asan_report_load1_noabort+0x20/0x30
     strsep+0x18c/0x1b0
     ftrace_process_regex.isra.0+0x100/0x2d8
     ftrace_regex_release+0x484/0x618
     __fput+0x364/0xa58
     ____fput+0x28/0x40
     task_work_run+0x154/0x278
     do_notify_resume+0x1f0/0x220
     el0_svc+0xec/0xf0
     el0t_64_sync_handler+0xa0/0xe8
     el0t_64_sync+0x1ac/0x1b0
    
    The reason is that trace_get_user will fail when processing a string
    longer than FTRACE_BUFF_MAX, but not set the end of parser->buffer to 0.
    Then an OOB access will be triggered in ftrace_regex_release->
    ftrace_process_regex->strsep->strpbrk. We can solve this problem by
    limiting access to parser->buffer when trace_get_user failed.
    
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/20250813040232.1344527-1-pulehui@huaweicloud.com
    Fixes: 8c9af478c06b ("ftrace: Handle commands when closing set_ftrace_filter file")
    Signed-off-by: Pu Lehui <pulehui@huawei.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tracing: Remove unneeded goto out logic [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Sun Aug 24 10:08:37 2025 -0400

    tracing: Remove unneeded goto out logic
    
    [ Upstream commit c89504a703fb779052213add0e8ed642f4a4f1c8 ]
    
    Several places in the trace.c file there's a goto out where the out is
    simply a return. There's no reason to jump to the out label if it's not
    doing any more logic but simply returning from the function.
    
    Replace the goto outs with a return and remove the out labels.
    
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Link: https://lore.kernel.org/20250801203857.538726745@kernel.org
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
uapi: in6: restore visibility of most IPv6 socket options [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Mon Jun 9 07:39:33 2025 -0700

    uapi: in6: restore visibility of most IPv6 socket options
    
    [ Upstream commit 31557b3487b349464daf42bc4366153743c1e727 ]
    
    A decade ago commit 6d08acd2d32e ("in6: fix conflict with glibc")
    hid the definitions of IPV6 options, because GCC was complaining
    about duplicates. The commit did not list the warnings seen, but
    trying to recreate them now I think they are (building iproute2):
    
    In file included from ./include/uapi/rdma/rdma_user_cm.h:39,
                     from rdma.h:16,
                     from res.h:9,
                     from res-ctx.c:7:
    ../include/uapi/linux/in6.h:171:9: warning: ‘IPV6_ADD_MEMBERSHIP’ redefined
      171 | #define IPV6_ADD_MEMBERSHIP     20
          |         ^~~~~~~~~~~~~~~~~~~
    In file included from /usr/include/netinet/in.h:37,
                     from rdma.h:13:
    /usr/include/bits/in.h:233:10: note: this is the location of the previous definition
      233 | # define IPV6_ADD_MEMBERSHIP    IPV6_JOIN_GROUP
          |          ^~~~~~~~~~~~~~~~~~~
    ../include/uapi/linux/in6.h:172:9: warning: ‘IPV6_DROP_MEMBERSHIP’ redefined
      172 | #define IPV6_DROP_MEMBERSHIP    21
          |         ^~~~~~~~~~~~~~~~~~~~
    /usr/include/bits/in.h:234:10: note: this is the location of the previous definition
      234 | # define IPV6_DROP_MEMBERSHIP   IPV6_LEAVE_GROUP
          |          ^~~~~~~~~~~~~~~~~~~~
    
    Compilers don't complain about redefinition if the defines
    are identical, but here we have the kernel using the literal
    value, and glibc using an indirection (defining to a name
    of another define, with the same numerical value).
    
    Problem is, the commit in question hid all the IPV6 socket
    options, and glibc has a pretty sparse list. For instance
    it lacks Flow Label related options. Willem called this out
    in commit 3fb321fde22d ("selftests/net: ipv6 flowlabel"):
    
      /* uapi/glibc weirdness may leave this undefined */
      #ifndef IPV6_FLOWINFO
      #define IPV6_FLOWINFO 11
      #endif
    
    More interestingly some applications (socat) use
    a #ifdef IPV6_FLOWINFO to gate compilation of thier
    rudimentary flow label support. (For added confusion
    socat misspells it as IPV4_FLOWINFO in some places.)
    
    Hide only the two defines we know glibc has a problem
    with. If we discover more warnings we can hide more
    but we should avoid covering the entire block of
    defines for "IPV6 socket options".
    
    Link: https://patch.msgid.link/20250609143933.1654417-1-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
udf: Verify partition map count [+ + +]
Author: Jan Kara <jack@suse.cz>
Date:   Fri Jul 11 19:01:20 2025 +0200

    udf: Verify partition map count
    
    [ Upstream commit 1a11201668e8635602577dcf06f2e96c591d8819 ]
    
    Verify that number of partition maps isn't insanely high which can lead
    to large allocation in udf_sb_alloc_partition_maps(). All partition maps
    have to fit in the LVD which is in a single block.
    
    Reported-by: syzbot+478f2c1a6f0f447a46bb@syzkaller.appspotmail.com
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
udp: also consider secpath when evaluating ipsec use for checksumming [+ + +]
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Mon Aug 4 11:26:27 2025 +0200

    udp: also consider secpath when evaluating ipsec use for checksumming
    
    [ Upstream commit 1118aaa3b35157777890fffab91d8c1da841b20b ]
    
    Commit b40c5f4fde22 ("udp: disable inner UDP checksum offloads in
    IPsec case") tried to fix checksumming in UFO when the packets are
    going through IPsec, so that we can't rely on offloads because the UDP
    header and payload will be encrypted.
    
    But when doing a TCP test over VXLAN going through IPsec transport
    mode with GSO enabled (esp4_offload module loaded), I'm seeing broken
    UDP checksums on the encap after successful decryption.
    
    The skbs get to udp4_ufo_fragment/__skb_udp_tunnel_segment via
    __dev_queue_xmit -> validate_xmit_skb -> skb_gso_segment and at this
    point we've already dropped the dst (unless the device sets
    IFF_XMIT_DST_RELEASE, which is not common), so need_ipsec is false and
    we proceed with checksum offload.
    
    Make need_ipsec also check the secpath, which is not dropped on this
    callpath.
    
    Fixes: b40c5f4fde22 ("udp: disable inner UDP checksum offloads in IPsec case")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
uio_hv_generic: Fix another memory leak in error handling paths [+ + +]
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun May 9 09:13:12 2021 +0200

    uio_hv_generic: Fix another memory leak in error handling paths
    
    commit 0b0226be3a52dadd965644bc52a807961c2c26df upstream.
    
    Memory allocated by 'vmbus_alloc_ring()' at the beginning of the probe
    function is never freed in the error handling path.
    
    Add the missing 'vmbus_free_ring()' call.
    
    Note that it is already freed in the .remove function.
    
    Fixes: cdfa835c6e5e ("uio_hv_generic: defer opening vmbus until first use")
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/r/0d86027b8eeed8e6360bc3d52bcdb328ff9bdca1.1620544055.git.christophe.jaillet@wanadoo.fr
    [Shivani: Modified to apply on 5.10.y]
    Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init() [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jul 22 12:11:18 2025 -0700

    usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init()
    
    commit 8d1b02e5d7e3a6d2acffb1f4c094678fda9e3456 upstream.
    
    After a recent change in clang to expose uninitialized warnings from
    const variables [1], there is a warning in cxacru_heavy_init():
    
      drivers/usb/atm/cxacru.c:1104:6: error: variable 'bp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
       1104 |         if (instance->modem_type->boot_rom_patch) {
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/usb/atm/cxacru.c:1113:39: note: uninitialized use occurs here
       1113 |         cxacru_upload_firmware(instance, fw, bp);
            |                                              ^~
      drivers/usb/atm/cxacru.c:1104:2: note: remove the 'if' if its condition is always true
       1104 |         if (instance->modem_type->boot_rom_patch) {
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/usb/atm/cxacru.c:1095:32: note: initialize the variable 'bp' to silence this warning
       1095 |         const struct firmware *fw, *bp;
            |                                       ^
            |                                        = NULL
    
    While the warning is technically correct that bp is conditionally passed
    uninitialized to cxacru_upload_firmware(), it is ultimately a false
    positive warning on the uninitialized use of bp because the same
    condition that initializes bp, instance->modem_type->boot_rom_patch, is
    the same one that gates the use of bp within cxacru_upload_firmware().
    As this warning occurs in clang's frontend before inlining occurs, it
    cannot know that these conditions are indentical to avoid the warning.
    
    Manually inline cxacru_upload_firmware() into cxacru_heavy_init(), as
    that is its only callsite, so that clang can see that bp is initialized
    and used under the same condition, clearing up the warning without any
    functional changes to the code (LLVM was already doing this inlining
    later).
    
    Cc: stable@vger.kernel.org
    Fixes: 1b0e61465234 ("[PATCH] USB ATM: driver for the Conexant AccessRunner chipset cxacru")
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2102
    Link: https://github.com/llvm/llvm-project/commit/2464313eef01c5b1edf0eccf57a32cdee01472c7 [1]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20250722-usb-cxacru-fix-clang-21-uninit-warning-v2-1-6708a18decd2@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: cdc-acm: do not log successful probe on later errors [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Aug 18 19:08:38 2025 -0400

    USB: cdc-acm: do not log successful probe on later errors
    
    [ Upstream commit 79579411826647fd573dbe301c4d933bc90e4be7 ]
    
    Do not log the successful-probe message until the tty device has been
    registered.
    
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20210322155318.9837-9-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 64690a90cd7c ("cdc-acm: fix race between initial clearing halt and open")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: chipidea: add USB PHY event [+ + +]
Author: Xu Yang <xu.yang_2@nxp.com>
Date:   Tue Jun 27 19:03:51 2023 +0800

    usb: chipidea: add USB PHY event
    
    [ Upstream commit b7a62611fab72e585c729a7fcf666aa9c4144214 ]
    
    Add USB PHY event for below situation:
    - usb role changed
    - vbus connect
    - vbus disconnect
    - gadget driver is enumerated
    
    USB PHY driver can get the last event after above situation occurs
    and deal with different situations.
    
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Link: https://lore.kernel.org/r/20230627110353.1879477-1-xu.yang_2@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: core: config: Prevent OOB read in SS endpoint companion parsing [+ + +]
Author: Xinyu Liu <katieeliu@tencent.com>
Date:   Mon Jun 30 10:02:56 2025 +0800

    usb: core: config: Prevent OOB read in SS endpoint companion parsing
    
    commit cf16f408364efd8a68f39011a3b073c83a03612d upstream.
    
    usb_parse_ss_endpoint_companion() checks descriptor type before length,
    enabling a potentially odd read outside of the buffer size.
    
    Fix this up by checking the size first before looking at any of the
    fields in the descriptor.
    
    Signed-off-by: Xinyu Liu <katieeliu@tencent.com>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: core: usb_submit_urb: downgrade type check [+ + +]
Author: Oliver Neukum <oneukum@suse.com>
Date:   Thu Jun 12 14:20:25 2025 +0200

    usb: core: usb_submit_urb: downgrade type check
    
    [ Upstream commit 503bbde34cc3dd2acd231f277ba70c3f9ed22e59 ]
    
    Checking for the endpoint type is no reason for a WARN, as that can
    cause a reboot. A driver not checking the endpoint type must not cause a
    reboot, as there is just no point in this.  We cannot prevent a device
    from doing something incorrect as a reaction to a transfer. Hence
    warning for a mere assumption being wrong is not sensible.
    
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20250612122149.2559724-1-oneukum@suse.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock [+ + +]
Author: Meng Li <Meng.Li@windriver.com>
Date:   Tue Jun 18 11:19:18 2024 +0800

    usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock
    
    commit 7838de15bb700c2898a7d741db9b1f3cbc86c136 upstream.
    
    When config CONFIG_USB_DWC3_DUAL_ROLE is selected, and trigger system
    to enter suspend status with below command:
    echo mem > /sys/power/state
    There will be a deadlock issue occurring. Detailed invoking path as
    below:
    dwc3_suspend_common()
        spin_lock_irqsave(&dwc->lock, flags);              <-- 1st
        dwc3_gadget_suspend(dwc);
            dwc3_gadget_soft_disconnect(dwc);
                spin_lock_irqsave(&dwc->lock, flags);      <-- 2nd
    This issue is exposed by commit c7ebd8149ee5 ("usb: dwc3: gadget: Fix
    NULL pointer dereference in dwc3_gadget_suspend") that removes the code
    of checking whether dwc->gadget_driver is NULL or not. It causes the
    following code is executed and deadlock occurs when trying to get the
    spinlock. In fact, the root cause is the commit 5265397f9442("usb: dwc3:
    Remove DWC3 locking during gadget suspend/resume") that forgot to remove
    the lock of otg mode. So, remove the redundant lock of otg mode during
    gadget suspend/resume.
    
    Fixes: 5265397f9442 ("usb: dwc3: Remove DWC3 locking during gadget suspend/resume")
    Cc: Xu Yang <xu.yang_2@nxp.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Meng Li <Meng.Li@windriver.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20240618031918.2585799-1-Meng.Li@windriver.com
    Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: Ignore late xferNotReady event to prevent halt timeout [+ + +]
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Thu Aug 7 17:06:55 2025 +0800

    usb: dwc3: Ignore late xferNotReady event to prevent halt timeout
    
    commit 58577118cc7cec9eb7c1836bf88f865ff2c5e3a3 upstream.
    
    During a device-initiated disconnect, the End Transfer command resets
    the event filter, allowing a new xferNotReady event to be generated
    before the controller is fully halted. Processing this late event
    incorrectly triggers a Start Transfer, which prevents the controller
    from halting and results in a DSTS.DEVCTLHLT bit polling timeout.
    
    Ignore the late xferNotReady event if the controller is already in a
    disconnected state.
    
    Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20250807090700.2397190-1-khtsai@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: meson-g12a: fix device leaks at unbind [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jul 24 11:19:07 2025 +0200

    usb: dwc3: meson-g12a: fix device leaks at unbind
    
    commit 93b400f4951404d040197943a25d6fef9f8ccabb upstream.
    
    Make sure to drop the references taken to the child devices by
    of_find_device_by_node() during probe on driver unbind.
    
    Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
    Cc: stable@vger.kernel.org      # 5.2
    Cc: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Link: https://lore.kernel.org/r/20250724091910.21092-3-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: qcom: Don't leave BCR asserted [+ + +]
Author: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Date:   Wed Jul 9 18:59:00 2025 +0530

    usb: dwc3: qcom: Don't leave BCR asserted
    
    commit ef8abc0ba49ce717e6bc4124e88e59982671f3b5 upstream.
    
    Leaving the USB BCR asserted prevents the associated GDSC to turn on. This
    blocks any subsequent attempts of probing the device, e.g. after a probe
    deferral, with the following showing in the log:
    
    [    1.332226] usb30_prim_gdsc status stuck at 'off'
    
    Leave the BCR deasserted when exiting the driver to avoid this issue.
    
    Cc: stable <stable@kernel.org>
    Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20250709132900.3408752-1-krishna.kurapati@oss.qualcomm.com
    [ adapted to individual clock management API instead of bulk clock operations ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: Remove DWC3 locking during gadget suspend/resume [+ + +]
Author: Wesley Cheng <quic_wcheng@quicinc.com>
Date:   Thu Sep 1 12:36:22 2022 -0700

    usb: dwc3: Remove DWC3 locking during gadget suspend/resume
    
    commit 5265397f94424eaea596026fd34dc7acf474dcec upstream.
    
    Remove the need for making dwc3_gadget_suspend() and dwc3_gadget_resume()
    to be called in a spinlock, as dwc3_gadget_run_stop() could potentially
    take some time to complete.
    
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20220901193625.8727-3-quic_wcheng@quicinc.com
    Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: early: xhci-dbc: Fix early_ioremap leak [+ + +]
Author: Lucas De Marchi <lucas.demarchi@intel.com>
Date:   Fri Jun 27 14:47:47 2025 -0700

    usb: early: xhci-dbc: Fix early_ioremap leak
    
    [ Upstream commit 2b7eec2ec3015f52fc74cf45d0408925e984ecd1 ]
    
    Using the kernel param earlyprintk=xdbc,keep without proper hardware
    setup leads to this:
    
            [ ] xhci_dbc:early_xdbc_parse_parameter: dbgp_num: 0
            ...
            [ ] xhci_dbc:early_xdbc_setup_hardware: failed to setup the connection to host
            ...
            [ ] calling  kmemleak_late_init+0x0/0xa0 @ 1
            [ ] kmemleak: Kernel memory leak detector initialized (mem pool available: 14919)
            [ ] kmemleak: Automatic memory scanning thread started
            [ ] initcall kmemleak_late_init+0x0/0xa0 returned 0 after 417 usecs
            [ ] calling  check_early_ioremap_leak+0x0/0x70 @ 1
            [ ] ------------[ cut here ]------------
            [ ] Debug warning: early ioremap leak of 1 areas detected.
                please boot with early_ioremap_debug and report the dmesg.
            [ ] WARNING: CPU: 11 PID: 1 at mm/early_ioremap.c:90 check_early_ioremap_leak+0x4e/0x70
    
    When early_xdbc_setup_hardware() fails, make sure to call
    early_iounmap() since xdbc_init() won't handle it.
    
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    Fixes: aeb9dd1de98c ("usb/early: Add driver for xhci debug capability")
    Link: https://lore.kernel.org/r/20250627-xdbc-v1-1-43cc8c317b1b@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: gadget : fix use-after-free in composite_dev_cleanup() [+ + +]
Author: Tao Xue <xuetao09@huawei.com>
Date:   Mon Jul 21 17:39:08 2025 +0800

    usb: gadget : fix use-after-free in composite_dev_cleanup()
    
    commit 151c0aa896c47a4459e07fee7d4843f44c1bb18e upstream.
    
    1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():
    if kmalloc fails, the pointer cdev->os_desc_req will be freed but not
    set to NULL. Then it will return a failure to the upper-level function.
    2. in func configfs_composite_bind() -> composite_dev_cleanup():
    it will checks whether cdev->os_desc_req is NULL. If it is not NULL, it
    will attempt to use it.This will lead to a use-after-free issue.
    
    BUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0
    Read of size 8 at addr 0000004827837a00 by task init/1
    
    CPU: 10 PID: 1 Comm: init Tainted: G           O      5.10.97-oh #1
     kasan_report+0x188/0x1cc
     __asan_load8+0xb4/0xbc
     composite_dev_cleanup+0xf4/0x2c0
     configfs_composite_bind+0x210/0x7ac
     udc_bind_to_driver+0xb4/0x1ec
     usb_gadget_probe_driver+0xec/0x21c
     gadget_dev_desc_UDC_store+0x264/0x27c
    
    Fixes: 37a3a533429e ("usb: gadget: OS Feature Descriptors support")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Tao Xue <xuetao09@huawei.com>
    Link: https://lore.kernel.org/r/20250721093908.14967-1-xuetao09@huawei.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: configfs: Fix OOB read on empty string write [+ + +]
Author: Xinyu Liu <1171169449@qq.com>
Date:   Wed Jul 9 11:55:33 2025 +0800

    usb: gadget: configfs: Fix OOB read on empty string write
    
    commit 3014168731b7930300aab656085af784edc861f6 upstream.
    
    When writing an empty string to either 'qw_sign' or 'landingPage'
    sysfs attributes, the store functions attempt to access page[l - 1]
    before validating that the length 'l' is greater than zero.
    
    This patch fixes the vulnerability by adding a check at the beginning
    of os_desc_qw_sign_store() and webusb_landingPage_store() to handle
    the zero-length input case gracefully by returning immediately.
    
    Signed-off-by: Xinyu Liu <katieeliu@tencent.com>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/tencent_B1C9481688D0E95E7362AB2E999DE8048207@qq.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: udc: renesas_usb3: fix device leak at unbind [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jul 24 11:19:08 2025 +0200

    usb: gadget: udc: renesas_usb3: fix device leak at unbind
    
    commit 868837b0a94c6b1b1fdbc04d3ba218ca83432393 upstream.
    
    Make sure to drop the reference to the companion device taken during
    probe when the driver is unbound.
    
    Fixes: 39facfa01c9f ("usb: gadget: udc: renesas_usb3: Add register of usb role switch")
    Cc: stable@vger.kernel.org      # 4.19
    Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20250724091910.21092-4-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: hub: avoid warm port reset during USB3 disconnect [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Tue Jul 22 18:50:49 2025 -0400

    usb: hub: avoid warm port reset during USB3 disconnect
    
    [ Upstream commit f59f93cd1d720809466c7fd5aa16a236156c672b ]
    
    During disconnect USB-3 ports often go via SS.Inactive link error state
    before the missing terminations are noticed, and link finally goes to
    RxDetect state
    
    Avoid immediately warm-resetting ports in SS.Inactive state.
    Let ports settle for a while and re-read the link status a few times 20ms
    apart to see if the ports transitions out of SS.Inactive.
    
    According to USB 3.x spec 7.5.2, a port in SS.Inactive should
    automatically check for missing far-end receiver termination every
    12 ms (SSInactiveQuietTimeout)
    
    The futile multiple warm reset retries of a disconnected device takes
    a lot of time, also the resetting of a removed devices has caused cases
    where the reset bit got stuck for a long time on xHCI roothub.
    This lead to issues in detecting new devices connected to the same port
    shortly after.
    
    Tested-by: Mark Pearson <markpearson@lenovo.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20211210111653.1378381-1-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 2521106fc732 ("usb: hub: Don't try to recover devices lost during warm reset.")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: hub: Don't try to recover devices lost during warm reset. [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Tue Jul 22 18:50:50 2025 -0400

    usb: hub: Don't try to recover devices lost during warm reset.
    
    [ Upstream commit 2521106fc732b0b75fd3555c689b1ed1d29d273c ]
    
    Hub driver warm-resets ports in SS.Inactive or Compliance mode to
    recover a possible connected device. The port reset code correctly
    detects if a connection is lost during reset, but hub driver
    port_event() fails to take this into account in some cases.
    port_event() ends up using stale values and assumes there is a
    connected device, and will try all means to recover it, including
    power-cycling the port.
    
    Details:
    This case was triggered when xHC host was suspended with DbC (Debug
    Capability) enabled and connected. DbC turns one xHC port into a simple
    usb debug device, allowing debugging a system with an A-to-A USB debug
    cable.
    
    xhci DbC code disables DbC when xHC is system suspended to D3, and
    enables it back during resume.
    We essentially end up with two hosts connected to each other during
    suspend, and, for a short while during resume, until DbC is enabled back.
    The suspended xHC host notices some activity on the roothub port, but
    can't train the link due to being suspended, so xHC hardware sets a CAS
    (Cold Attach Status) flag for this port to inform xhci host driver that
    the port needs to be warm reset once xHC resumes.
    
    CAS is xHCI specific, and not part of USB specification, so xhci driver
    tells usb core that the port has a connection and link is in compliance
    mode. Recovery from complinace mode is similar to CAS recovery.
    
    xhci CAS driver support that fakes a compliance mode connection was added
    in commit 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
    
    Once xHCI resumes and DbC is enabled back, all activity on the xHC
    roothub host side port disappears. The hub driver will anyway think
    port has a connection and link is in compliance mode, and hub driver
    will try to recover it.
    
    The port power-cycle during recovery seems to cause issues to the active
    DbC connection.
    
    Fix this by clearing connect_change flag if hub_port_reset() returns
    -ENOTCONN, thus avoiding the whole unnecessary port recovery and
    initialization attempt.
    
    Cc: stable@vger.kernel.org
    Fixes: 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
    Tested-by: Łukasz Bartosik <ukaszb@chromium.org>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20250623133947.3144608-1-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: hub: fix detection of high tier USB3 devices behind suspended hubs [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Jun 11 14:24:41 2025 +0300

    usb: hub: fix detection of high tier USB3 devices behind suspended hubs
    
    commit 8f5b7e2bec1c36578fdaa74a6951833541103e27 upstream.
    
    USB3 devices connected behind several external suspended hubs may not
    be detected when plugged in due to aggressive hub runtime pm suspend.
    
    The hub driver immediately runtime-suspends hubs if there are no
    active children or port activity.
    
    There is a delay between the wake signal causing hub resume, and driver
    visible port activity on the hub downstream facing ports.
    Most of the LFPS handshake, resume signaling and link training done
    on the downstream ports is not visible to the hub driver until completed,
    when device then will appear fully enabled and running on the port.
    
    This delay between wake signal and detectable port change is even more
    significant with chained suspended hubs where the wake signal will
    propagate upstream first. Suspended hubs will only start resuming
    downstream ports after upstream facing port resumes.
    
    The hub driver may resume a USB3 hub, read status of all ports, not
    yet see any activity, and runtime suspend back the hub before any
    port activity is visible.
    
    This exact case was seen when conncting USB3 devices to a suspended
    Thunderbolt dock.
    
    USB3 specification defines a 100ms tU3WakeupRetryDelay, indicating
    USB3 devices expect to be resumed within 100ms after signaling wake.
    if not then device will resend the wake signal.
    
    Give the USB3 hubs twice this time (200ms) to detect any port
    changes after resume, before allowing hub to runtime suspend again.
    
    Cc: stable <stable@kernel.org>
    Fixes: 2839f5bcfcfc ("USB: Turn on auto-suspend for USB 3.0 hubs.")
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250611112441.2267883-1-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Jun 26 16:01:02 2025 +0300

    usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm
    
    commit a49e1e2e785fb3621f2d748581881b23a364998a upstream.
    
    Delayed work to prevent USB3 hubs from runtime-suspending immediately
    after resume was added in commit 8f5b7e2bec1c ("usb: hub: fix detection
    of high tier USB3 devices behind suspended hubs").
    
    This delayed work needs be flushed if system suspends, or hub needs to
    be quiesced for other reasons right after resume. Not flushing it
    triggered issues on QC SC8280XP CRD board during suspend/resume testing.
    
    Fix it by flushing the delayed resume work in hub_quiesce()
    
    The delayed work item that allow hub runtime suspend is also scheduled
    just before calling autopm get. Alan pointed out there is a small risk
    that work is run before autopm get, which would call autopm put before
    get, and mess up the runtime pm usage order.
    Swap the order of work sheduling and calling autopm get to solve this.
    
    Cc: stable <stable@kernel.org>
    Fixes: 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs")
    Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Closes: https://lore.kernel.org/linux-usb/acaaa928-832c-48ca-b0ea-d202d5cd3d6c@oss.qualcomm.com
    Reported-by: Alan Stern <stern@rowland.harvard.edu>
    Closes: https://lore.kernel.org/linux-usb/c73fbead-66d7-497a-8fa1-75ea4761090a@rowland.harvard.edu
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250626130102.3639861-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: hub: Fix flushing of delayed work used for post resume purposes [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Jun 27 19:43:48 2025 +0300

    usb: hub: Fix flushing of delayed work used for post resume purposes
    
    commit 9bd9c8026341f75f25c53104eb7e656e357ca1a2 upstream.
    
    Delayed work that prevents USB3 hubs from runtime-suspending too early
    needed to be flushed in hub_quiesce() to resolve issues detected on
    QC SC8280XP CRD board during suspend resume testing.
    
    This flushing did however trigger new issues on Raspberry Pi 3B+, which
    doesn't have USB3 ports, and doesn't queue any post resume delayed work.
    
    The flushed 'hub->init_work' item is used for several purposes, and
    is originally initialized with a 'NULL' work function. The work function
    is also changed on the fly, which may contribute to the issue.
    
    Solve this by creating a dedicated delayed work item for post resume work,
    and flush that delayed work in hub_quiesce()
    
    Cc: stable <stable@kernel.org>
    Fixes: a49e1e2e785f ("usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm")
    Reported-by: Mark Brown <broonie@kernel.org>
    Closes: https://lore.kernel.org/linux-usb/aF5rNp1l0LWITnEB@finisterre.sirena.org.uk
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # SC8280XP CRD
    Tested-by: Mark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20250627164348.3982628-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: musb: Add and use inline functions musb_{get,set}_state [+ + +]
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Wed Oct 26 19:26:51 2022 +0100

    usb: musb: Add and use inline functions musb_{get,set}_state
    
    commit 21acc656a06e912341d9db66c67b58cc7ed071e7 upstream.
    
    Instead of manipulating musb->xceiv->otg->state directly, use the newly
    introduced musb_get_state() and musb_set_state() inline functions.
    
    Later, these inline functions will be modified to get rid of the
    musb->xceiv dependency, which prevents the musb code from using the
    generic PHY subsystem.
    
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Link: https://lore.kernel.org/r/20221026182657.146630-2-paul@crapouillou.net
    Stable-dep-of: 67a59f82196c ("usb: musb: fix gadget state on disconnect")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: musb: fix gadget state on disconnect [+ + +]
Author: Drew Hamilton <drew.hamilton@zetier.com>
Date:   Tue Jul 1 11:41:26 2025 -0400

    usb: musb: fix gadget state on disconnect
    
    commit 67a59f82196c8c4f50c83329f0577acfb1349b50 upstream.
    
    When unplugging the USB cable or disconnecting a gadget in usb peripheral mode with
    echo "" > /sys/kernel/config/usb_gadget/<your_gadget>/UDC,
    /sys/class/udc/musb-hdrc.0/state does not change from USB_STATE_CONFIGURED.
    
    Testing on dwc2/3 shows they both update the state to USB_STATE_NOTATTACHED.
    
    Add calls to usb_gadget_set_state in musb_g_disconnect and musb_gadget_stop
    to fix both cases.
    
    Fixes: 49401f4169c0 ("usb: gadget: introduce gadget state tracking")
    Cc: stable@vger.kernel.org
    Co-authored-by: Yehowshua Immanuel <yehowshua.immanuel@twosixtech.com>
    Signed-off-by: Yehowshua Immanuel <yehowshua.immanuel@twosixtech.com>
    Signed-off-by: Drew Hamilton <drew.hamilton@zetier.com>
    Link: https://lore.kernel.org/r/20250701154126.8543-1-drew.hamilton@zetier.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: musb: omap2430: fix device leak at unbind [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Aug 21 12:14:13 2025 -0400

    usb: musb: omap2430: fix device leak at unbind
    
    [ Upstream commit 1473e9e7679bd4f5a62d1abccae894fb86de280f ]
    
    Make sure to drop the reference to the control device taken by
    of_find_device_by_node() during probe when the driver is unbound.
    
    Fixes: 8934d3e4d0e7 ("usb: musb: omap2430: Don't use omap_get_control_dev()")
    Cc: stable@vger.kernel.org      # 3.13
    Cc: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20250724091910.21092-5-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [ Removed populate_irqs-related goto changes ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: net: sierra: check for no status endpoint [+ + +]
Author: Oliver Neukum <oneukum@suse.com>
Date:   Mon Jul 14 13:12:56 2025 +0200

    usb: net: sierra: check for no status endpoint
    
    [ Upstream commit 4c4ca3c46167518f8534ed70f6e3b4bf86c4d158 ]
    
    The driver checks for having three endpoints and
    having bulk in and out endpoints, but not that
    the third endpoint is interrupt input.
    Rectify the omission.
    
    Reported-by: syzbot+3f89ec3d1d0842e95d50@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/linux-usb/686d5a9f.050a0220.1ffab7.0017.GAE@google.com/
    Tested-by: syzbot+3f89ec3d1d0842e95d50@syzkaller.appspotmail.com
    Fixes: eb4fd8cd355c8 ("net/usb: add sierra_net.c driver")
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    Link: https://patch.msgid.link/20250714111326.258378-1-oneukum@suse.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: phy: mxs: disconnect line when USB charger is attached [+ + +]
Author: Xu Yang <xu.yang_2@nxp.com>
Date:   Tue Jun 27 19:03:53 2023 +0800

    usb: phy: mxs: disconnect line when USB charger is attached
    
    [ Upstream commit 87ed257acb0934e08644568df6495988631afd4c ]
    
    For mxs PHY, if there is a vbus but the bus is not enumerated, we need
    to force the dp/dm as SE0 from the controller side. If not, there is
    possible USB wakeup due to unstable dp/dm, since there is possible no
    pull on dp/dm, such as there is a USB charger on the port.
    
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Link: https://lore.kernel.org/r/20230627110353.1879477-3-xu.yang_2@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: quirks: Add DELAY_INIT quick for another SanDisk 3.2Gen1 Flash Drive [+ + +]
Author: Miao Li <limiao@kylinos.cn>
Date:   Fri Aug 1 16:27:28 2025 +0800

    usb: quirks: Add DELAY_INIT quick for another SanDisk 3.2Gen1 Flash Drive
    
    commit e664036cf36480414936cd91f4cfa2179a3d8367 upstream.
    
    Another SanDisk 3.2Gen1 Flash Drive also need DELAY_INIT quick,
    or it will randomly work incorrectly on Huawei hisi platforms
    when doing reboot test.
    
    Signed-off-by: Miao Li <limiao@kylinos.cn>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20250801082728.469406-1-limiao870622@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: renesas-xhci: Fix External ROM access timeouts [+ + +]
Author: Marek Vasut <marek.vasut+renesas@mailbox.org>
Date:   Sun Aug 3 00:55:20 2025 +0200

    usb: renesas-xhci: Fix External ROM access timeouts
    
    commit f9420f4757752f056144896024d5ea89e5a611f1 upstream.
    
    Increase the External ROM access timeouts to prevent failures during
    programming of External SPI EEPROM chips. The current timeouts are
    too short for some SPI EEPROMs used with uPD720201 controllers.
    
    The current timeout for Chip Erase in renesas_rom_erase() is 100 ms ,
    the current timeout for Sector Erase issued by the controller before
    Page Program in renesas_fw_download_image() is also 100 ms. Neither
    timeout is sufficient for e.g. the Macronix MX25L5121E or MX25V5126F.
    
    MX25L5121E reference manual [1] page 35 section "ERASE AND PROGRAMMING
    PERFORMANCE" and page 23 section "Table 8. AC CHARACTERISTICS (Temperature
    = 0°C to 70°C for Commercial grade, VCC = 2.7V ~ 3.6V)" row "tCE" indicate
    that the maximum time required for Chip Erase opcode to complete is 2 s,
    and for Sector Erase it is 300 ms .
    
    MX25V5126F reference manual [2] page 47 section "13. ERASE AND PROGRAMMING
    PERFORMANCE (2.3V - 3.6V)" and page 42 section "Table 8. AC CHARACTERISTICS
    (Temperature = -40°C to 85°C for Industrial grade, VCC = 2.3V - 3.6V)" row
    "tCE" indicate that the maximum time required for Chip Erase opcode to
    complete is 3.2 s, and for Sector Erase it is 400 ms .
    
    Update the timeouts such, that Chip Erase timeout is set to 5 seconds,
    and Sector Erase timeout is set to 500 ms. Such lengthy timeouts ought
    to be sufficient for majority of SPI EEPROM chips.
    
    [1] https://www.macronix.com/Lists/Datasheet/Attachments/8634/MX25L5121E,%203V,%20512Kb,%20v1.3.pdf
    [2] https://www.macronix.com/Lists/Datasheet/Attachments/8750/MX25V5126F,%202.5V,%20512Kb,%20v1.1.pdf
    
    Fixes: 2478be82de44 ("usb: renesas-xhci: Add ROM loader for uPD720201")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
    Link: https://lore.kernel.org/r/20250802225526.25431-1-marek.vasut+renesas@mailbox.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI [+ + +]
Author: Ryan Mann (NDI) <rmann@ndigital.com>
Date:   Thu Jul 10 13:08:00 2025 +0000

    USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI
    
    commit c980666b6958d9a841597331b38115a29a32250e upstream.
    
    NDI (Northern Digital Inc.) is introducing a new product called the
    EMGUIDE GEMINI that will use an FTDI chip for USB serial communications.
    Add the NDI EMGUIDE GEMINI product ID that uses the NDI Vendor ID
    rather than the FTDI Vendor ID, unlike older products.
    
    Signed-off-by: Ryan Mann <rmann@ndigital.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Foxconn T99W640 [+ + +]
Author: Slark Xiao <slark_xiao@163.com>
Date:   Fri Jun 20 11:57:21 2025 +0800

    USB: serial: option: add Foxconn T99W640
    
    commit 08f49cdb71f3759368fded4dbc9dde35a404ec2b upstream.
    
    T99W640 is designed based on Qualconn SDX72 chip. There are 3
    serial ports to be enumerated: Diag, NMEA and AT.
    
    Test evidence as below:
    T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
    D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
    P:  Vendor=0489 ProdID=e167 Rev=05.15
    S:  Manufacturer=QCOM
    S:  Product=SDXPINNL USB WWAN Adapter
    S:  SerialNumber=cc1f1d92
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    0&1: MBIM, 2:Modem, 3:GNSS(non-serial port), 4: NMEA, 5:Diag
    
    Signed-off-by: Slark Xiao <slark_xiao@163.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Foxconn T99W709 [+ + +]
Author: Slark Xiao <slark_xiao@163.com>
Date:   Mon Jul 21 19:39:19 2025 +0800

    USB: serial: option: add Foxconn T99W709
    
    commit ad1244e1ce18f8c1a5ebad8074bfcf10eacb0311 upstream.
    
    T99W709 is designed based on MTK T300(5G redcap) chip. There are
    7 serial ports to be enumerated: AP_LOG, GNSS, AP_META, AT,
    MD_META, NPT, DBG. RSVD(5) for ADB port.
    
    test evidence as below:
    T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e15f Rev=00.01
    S:  Manufacturer=MediaTek Inc.
    S:  Product=USB DATA CARD
    S:  SerialNumber=355511220000399
    C:  #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:  If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    I:  If#=0x6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    
    Signed-off-by: Slark Xiao <slark_xiao@163.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition [+ + +]
Author: Fabio Porcedda <fabio.porcedda@gmail.com>
Date:   Thu Jul 10 14:16:38 2025 +0200

    USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition
    
    commit 252f4ac08cd2f16ecd20e4c5e41ac2a17dd86942 upstream.
    
    Add Telit Cinterion FE910C04 (ECM) composition:
    0x10c7: ECM + tty (AT) + tty (AT) + tty (diag)
    
    usb-devices output:
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10c7 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FE910
    S:  SerialNumber=f71b8b32
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: storage: Add unusual-devs entry for Novatek NTK96550-based camera [+ + +]
Author: Mael GUERIN <mael.guerin@murena.io>
Date:   Wed Aug 6 18:44:03 2025 +0200

    USB: storage: Add unusual-devs entry for Novatek NTK96550-based camera
    
    commit 6ca8af3c8fb584f3424a827f554ff74f898c27cd upstream.
    
    Add the US_FL_BULK_IGNORE_TAG quirk for Novatek NTK96550-based camera
    to fix USB resets after sending SCSI vendor commands due to CBW and
    CSW tags difference, leading to undesired slowness while communicating
    with the device.
    
    Please find below the copy of /sys/kernel/debug/usb/devices with my
    device plugged in (listed as TechSys USB mass storage here, the
    underlying chipset being the Novatek NTK96550-based camera):
    
    T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=0603 ProdID=8611 Rev= 0.01
    S:  Manufacturer=TechSys
    S:  Product=USB Mass Storage
    S:  SerialNumber=966110000000100
    C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Mael GUERIN <mael.guerin@murena.io>
    Cc: stable <stable@kernel.org>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20250806164406.43450-1-mael.guerin@murena.io
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles [+ + +]
Author: Zenm Chen <zenmchen@gmail.com>
Date:   Thu Aug 14 00:24:15 2025 +0800

    USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles
    
    commit a3dc32c635bae0ae569f489e00de0e8f015bfc25 upstream.
    
    Many Realtek USB Wi-Fi dongles released in recent years have two modes:
    one is driver CD mode which has Windows driver onboard, another one is
    Wi-Fi mode. Add the US_FL_IGNORE_DEVICE quirk for these multi-mode devices.
    Otherwise, usb_modeswitch may fail to switch them to Wi-Fi mode.
    
    Currently there are only two USB IDs known to be used by these multi-mode
    Wi-Fi dongles: 0bda:1a2b and 0bda:a192.
    
    Information about Mercury MW310UH in /sys/kernel/debug/usb/devices.
    T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 12 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=0bda ProdID=a192 Rev= 2.00
    S:  Manufacturer=Realtek
    S:  Product=DISK
    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
    E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Information about D-Link AX9U rev. A1 in /sys/kernel/debug/usb/devices.
    T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 55 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=0bda ProdID=1a2b Rev= 0.00
    S:  Manufacturer=Realtek
    S:  Product=DISK
    C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Cc: stable <stable@kernel.org>
    Signed-off-by: Zenm Chen <zenmchen@gmail.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20250813162415.2630-1-zenmchen@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: storage: realtek_cr: Use correct byte order for bcs->Residue [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Wed Aug 13 16:52:49 2025 +0200

    usb: storage: realtek_cr: Use correct byte order for bcs->Residue
    
    commit 98da66a70ad2396e5a508c4245367797ebc052ce upstream.
    
    Since 'bcs->Residue' has the data type '__le32', convert it to the
    correct byte order of the CPU using this driver when assigning it to
    the local variable 'residue'.
    
    Cc: stable <stable@kernel.org>
    Fixes: 50a6cb932d5c ("USB: usb_storage: add ums-realtek driver")
    Suggested-by: Alan Stern <stern@rowland.harvard.edu>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Link: https://lore.kernel.org/r/20250813145247.184717-3-thorsten.blum@linux.dev
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: fusb302: cache PD RX state [+ + +]
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
Date:   Mon Aug 18 18:54:25 2025 -0400

    usb: typec: fusb302: cache PD RX state
    
    [ Upstream commit 1e61f6ab08786d66a11cfc51e13d6f08a6b06c56 ]
    
    This patch fixes a race condition communication error, which ends up in
    PD hard resets when losing the race. Some systems, like the Radxa ROCK
    5B are powered through USB-C without any backup power source and use a
    FUSB302 chip to do the PD negotiation. This means it is quite important
    to avoid hard resets, since that effectively kills the system's
    power-supply.
    
    I've found the following race condition while debugging unplanned power
    loss during booting the board every now and then:
    
    1. lots of TCPM/FUSB302/PD initialization stuff
    2. TCPM ends up in SNK_WAIT_CAPABILITIES (tcpm_set_pd_rx is enabled here)
    3. the remote PD source does not send anything, so TCPM does a SOFT RESET
    4. TCPM ends up in SNK_WAIT_CAPABILITIES for the second time
       (tcpm_set_pd_rx is enabled again, even though it is still on)
    
    At this point I've seen broken CRC good messages being send by the
    FUSB302 with a logic analyzer sniffing the CC lines. Also it looks like
    messages are being lost and things generally going haywire with one of
    the two sides doing a hard reset once a broken CRC good message was send
    to the bus.
    
    I think the system is running into a race condition, that the FIFOs are
    being cleared and/or the automatic good CRC message generation flag is
    being updated while a message is already arriving.
    
    Let's avoid this by caching the PD RX enabled state, as we have already
    processed anything in the FIFOs and are in a good state. As a side
    effect that this also optimizes I2C bus usage :)
    
    As far as I can tell the problem theoretically also exists when TCPM
    enters SNK_WAIT_CAPABILITIES the first time, but I believe this is less
    critical for the following reason:
    
    On devices like the ROCK 5B, which are powered through a TCPM backed
    USB-C port, the bootloader must have done some prior PD communication
    (initial communication must happen within 5 seconds after plugging the
    USB-C plug). This means the first time the kernel TCPM state machine
    reaches SNK_WAIT_CAPABILITIES, the remote side is not sending messages
    actively. On other devices a hard reset simply adds some extra delay and
    things should be good afterwards.
    
    Fixes: c034a43e72dda ("staging: typec: Fairchild FUSB302 Type-c chip driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://lore.kernel.org/r/20250704-fusb302-race-condition-fix-v1-1-239012c0e27a@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [ replaced str_on_off(on) with ternary operator ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: intel_pmc_mux: Defer probe if SCU IPC isn't present [+ + +]
Author: Tomasz Michalec <tmichalec@google.com>
Date:   Tue Jun 10 17:40:58 2025 +0200

    usb: typec: intel_pmc_mux: Defer probe if SCU IPC isn't present
    
    [ Upstream commit df9a825f330e76c72d1985bc9bdc4b8981e3d15f ]
    
    If pmc_usb_probe is called before SCU IPC is registered, pmc_usb_probe
    will fail.
    
    Return -EPROBE_DEFER when pmc_usb_probe doesn't get SCU IPC device, so
    the probe function can be called again after SCU IPC is initialized.
    
    Signed-off-by: Tomasz Michalec <tmichalec@google.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://lore.kernel.org/r/20250610154058.1859812-1-tmichalec@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: typec: ucsi: psy: Set current max to 100mA for BC 1.2 and Default [+ + +]
Author: Benson Leung <bleung@chromium.org>
Date:   Thu Jul 17 20:08:05 2025 +0000

    usb: typec: ucsi: psy: Set current max to 100mA for BC 1.2 and Default
    
    [ Upstream commit af833e7f7db3cf4c82f063668e1b52297a30ec18 ]
    
    ucsi_psy_get_current_max would return 0mA as the maximum current if
    UCSI detected a BC or a Default USB Power sporce.
    
    The comment in this function is true that we can't tell the difference
    between DCP/CDP or SDP chargers, but we can guarantee that at least 1-unit
    of USB 1.1/2.0 power is available, which is 100mA, which is a better
    fallback value than 0, which causes some userspaces, including the ChromeOS
    power manager, to regard this as a power source that is not providing
    any power.
    
    In reality, 100mA is guaranteed from all sources in these classes.
    
    Signed-off-by: Benson Leung <bleung@chromium.org>
    Reviewed-by: Jameson Thies <jthies@google.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Link: https://lore.kernel.org/r/20250717200805.3710473-1-bleung@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: typec: ucsi: Update power_supply on power role change [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Mon Jul 21 13:32:51 2025 +0700

    usb: typec: ucsi: Update power_supply on power role change
    
    commit 7616f006db07017ef5d4ae410fca99279aaca7aa upstream.
    
    The current power direction of an USB-C port also influences the
    power_supply's online status, so a power role change should also update
    the power_supply.
    
    Fixes an issue on some systems where plugging in a normal USB device in
    for the first time after a reboot will cause upower to erroneously
    consider the system to be connected to AC power.
    
    Cc: stable <stable@kernel.org>
    Fixes: 0e6371fbfba3 ("usb: typec: ucsi: Report power supply changes")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://lore.kernel.org/r/20250721-fix-ucsi-pwr-dir-notify-v1-1-e53d5340cb38@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: xhci: Avoid showing errors during surprise removal [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Thu Jul 17 10:31:05 2025 +0300

    usb: xhci: Avoid showing errors during surprise removal
    
    [ Upstream commit 4b9c60e440525b729ac5f071e00bcee12e0a7e84 ]
    
    When a USB4 dock is unplugged from a system it won't respond to ring
    events. The PCI core handles the surprise removal event and notifies
    all PCI drivers. The XHCI PCI driver sets a flag that the device is
    being removed as well.
    
    When that flag is set don't show messages in the cleanup path for
    marking the controller dead.
    
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250717073107.488599-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci: Avoid showing warnings for dying controller [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Thu Jul 17 10:31:06 2025 +0300

    usb: xhci: Avoid showing warnings for dying controller
    
    [ Upstream commit 65fc0fc137b5da3ee1f4ca4f61050fcb203d7582 ]
    
    When a USB4 dock is unplugged from a system it won't respond to ring
    events. The PCI core handles the surprise removal event and notifies
    all PCI drivers. The XHCI PCI driver sets a flag that the device is
    being removed, and when the device stops responding a flag is also
    added to indicate it's dying.
    
    When that flag is set don't bother to show warnings about a missing
    controller.
    
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250717073107.488599-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci: Fix slot_id resource race conflict [+ + +]
Author: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Date:   Sun Aug 24 12:49:45 2025 -0400

    usb: xhci: Fix slot_id resource race conflict
    
    [ Upstream commit 2eb03376151bb8585caa23ed2673583107bb5193 ]
    
    xHC controller may immediately reuse a slot_id after it's disabled,
    giving it to a new enumerating device before the xhci driver freed
    all resources related to the disabled device.
    
    In such a scenario, device-A with slot_id equal to 1 is disconnecting
    while device-B is enumerating, device-B will fail to enumerate in the
    follow sequence.
    
    1.[device-A] send disable slot command
    2.[device-B] send enable slot command
    3.[device-A] disable slot command completed and wakeup waiting thread
    4.[device-B] enable slot command completed with slot_id equal to 1 and
                 wakeup waiting thread
    5.[device-B] driver checks that slot_id is still in use (by device-A) in
                 xhci_alloc_virt_device, and fail to enumerate due to this
                 conflict
    6.[device-A] xhci->devs[slot_id] set to NULL in xhci_free_virt_device
    
    To fix driver's slot_id resources conflict, clear xhci->devs[slot_id] and
    xhci->dcbba->dev_context_ptrs[slot_id] pointers in the interrupt context
    when disable slot command completes successfully. Simultaneously, adjust
    function xhci_free_virt_device to accurately handle device release.
    
    [minor smatch warning and commit message fix -Mathias]
    
    Cc: stable@vger.kernel.org
    Fixes: 7faac1953ed1 ("xhci: avoid race between disable slot command and host runtime suspend")
    Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250819125844.2042452-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: xhci: print xhci->xhc_state when queue_command failed [+ + +]
Author: Su Hui <suhui@nfschina.com>
Date:   Fri Jul 25 14:01:18 2025 +0800

    usb: xhci: print xhci->xhc_state when queue_command failed
    
    [ Upstream commit 7919407eca2ef562fa6c98c41cfdf6f6cdd69d92 ]
    
    When encounters some errors like these:
    xhci_hcd 0000:4a:00.2: xHCI dying or halted, can't queue_command
    xhci_hcd 0000:4a:00.2: FIXME: allocate a command ring segment
    usb usb5-port6: couldn't allocate usb_device
    
    It's hard to know whether xhc_state is dying or halted. So it's better
    to print xhc_state's value which can help locate the resaon of the bug.
    
    Signed-off-by: Su Hui <suhui@nfschina.com>
    Link: https://lore.kernel.org/r/20250725060117.1773770-1-suhui@nfschina.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci: Set avg_trb_len = 8 for EP0 during Address Device Command [+ + +]
Author: Jay Chen <shawn2000100@gmail.com>
Date:   Thu Jul 17 10:31:07 2025 +0300

    usb: xhci: Set avg_trb_len = 8 for EP0 during Address Device Command
    
    [ Upstream commit f72b9aa821a2bfe4b6dfec4be19f264d0673b008 ]
    
    There is a subtle contradiction between sections of the xHCI 1.2 spec
    regarding the initialization of Input Endpoint Context fields. Section
    4.8.2 ("Endpoint Context Initialization") states that all fields should
    be initialized to 0. However, Section 6.2.3 ("Endpoint Context", p.453)
    specifies that the Average TRB Length (avg_trb_len) field shall be
    greater than 0, and explicitly notes (p.454): "Software shall set
    Average TRB Length to '8' for control endpoints."
    
    Strictly setting all fields to 0 during initialization conflicts with
    the specific recommendation for control endpoints. In practice, setting
    avg_trb_len = 0 is not meaningful for the hardware/firmware, as the
    value is used for bandwidth calculation.
    
    Motivation: Our company is developing a custom Virtual xHC hardware
    platform that strictly follows the xHCI spec and its recommendations.
    During validation, we observed that enumeration fails and a parameter
    error (TRB Completion Code = 5) is reported if avg_trb_len for EP0 is
    not set to 8 as recommended by Section 6.2.3. This demonstrates the
    importance of assigning a meaningful, non-zero value to avg_trb_len,
    even in virtualized or emulated environments.
    
    This patch explicitly sets avg_trb_len to 8 for EP0 in
    xhci_setup_addressable_virt_dev(), as recommended in Section 6.2.3, to
    prevent potential issues with xHCI host controllers that enforce the
    spec strictly.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=220033
    Signed-off-by: Jay Chen <shawn2000100@gmail.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250717073107.488599-4-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: use uniform permission checks for all mount propagation changes [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Thu Aug 14 01:44:31 2025 -0400

    use uniform permission checks for all mount propagation changes
    
    [ Upstream commit cffd0441872e7f6b1fce5e78fb1c99187a291330 ]
    
    do_change_type() and do_set_group() are operating on different
    aspects of the same thing - propagation graph.  The latter
    asks for mounts involved to be mounted in namespace(s) the caller
    has CAP_SYS_ADMIN for.  The former is a mess - originally it
    didn't even check that mount *is* mounted.  That got fixed,
    but the resulting check turns out to be too strict for userland -
    in effect, we check that mount is in our namespace, having already
    checked that we have CAP_SYS_ADMIN there.
    
    What we really need (in both cases) is
            * only touch mounts that are mounted.  That's a must-have
    constraint - data corruption happens if it get violated.
            * don't allow to mess with a namespace unless you already
    have enough permissions to do so (i.e. CAP_SYS_ADMIN in its userns).
    
    That's an equivalent of what do_set_group() does; let's extract that
    into a helper (may_change_propagation()) and use it in both
    do_set_group() and do_change_type().
    
    Fixes: 12f147ddd6de "do_change_type(): refuse to operate on unmounted/not ours mounts"
    Acked-by: Andrei Vagin <avagin@gmail.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Tested-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vhost-scsi: Fix log flooding with target does not exist errors [+ + +]
Author: Mike Christie <michael.christie@oracle.com>
Date:   Wed Jun 11 16:01:13 2025 -0500

    vhost-scsi: Fix log flooding with target does not exist errors
    
    [ Upstream commit 69cd720a8a5e9ef0f05ce5dd8c9ea6e018245c82 ]
    
    As part of the normal initiator side scanning the guest's scsi layer
    will loop over all possible targets and send an inquiry. Since the
    max number of targets for virtio-scsi is 256, this can result in 255
    error messages about targets not existing if you only have a single
    target. When there's more than 1 vhost-scsi device each with a single
    target, then you get N * 255 log messages.
    
    It looks like the log message was added by accident in:
    
    commit 3f8ca2e115e5 ("vhost/scsi: Extract common handling code from
    control queue handler")
    
    when we added common helpers. Then in:
    
    commit 09d7583294aa ("vhost/scsi: Use common handling code in request
    queue handler")
    
    we converted the scsi command processing path to use the new
    helpers so we started to see the extra log messages during scanning.
    
    The patches were just making some code common but added the vq_err
    call and I'm guessing the patch author forgot to enable the vq_err
    call (vq_err is implemented by pr_debug which defaults to off). So
    this patch removes the call since it's expected to hit this path
    during device discovery.
    
    Fixes: 09d7583294aa ("vhost/scsi: Use common handling code in request queue handler")
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20250611210113.10912-1-michael.christie@oracle.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vhost: fail early when __vhost_add_used() fails [+ + +]
Author: Jason Wang <jasowang@redhat.com>
Date:   Mon Jul 14 16:47:53 2025 +0800

    vhost: fail early when __vhost_add_used() fails
    
    [ Upstream commit b4ba1207d45adaafa2982c035898b36af2d3e518 ]
    
    This patch fails vhost_add_used_n() early when __vhost_add_used()
    fails to make sure used idx is not updated with stale used ring
    information.
    
    Reported-by: Eugenio Pérez <eperezma@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20250714084755.11921-2-jasowang@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Tested-by: Lei Yang <leiyang@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
virtio-net: ensure the received length does not exceed allocated size [+ + +]
Author: Bui Quang Minh <minhquangbui99@gmail.com>
Date:   Mon Jun 30 21:42:10 2025 +0700

    virtio-net: ensure the received length does not exceed allocated size
    
    commit 315dbdd7cdf6aa533829774caaf4d25f1fd20e73 upstream.
    
    In xdp_linearize_page, when reading the following buffers from the ring,
    we forget to check the received length with the true allocate size. This
    can lead to an out-of-bound read. This commit adds that missing check.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 4941d472bf95 ("virtio-net: do not reset during XDP set")
    Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Link: https://patch.msgid.link/20250630144212.48471-2-minhquangbui99@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    [ adapted virtqueue_get_buf() to virtqueue_get_buf_ctx() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vmci: Prevent the dispatching of uninitialized payloads [+ + +]
Author: Lizhi Xu <lizhi.xu@windriver.com>
Date:   Fri Jun 27 13:52:14 2025 +0800

    vmci: Prevent the dispatching of uninitialized payloads
    
    [ Upstream commit bfb4cf9fb97e4063f0aa62e9e398025fb6625031 ]
    
    The reproducer executes the host's unlocked_ioctl call in two different
    tasks. When init_context fails, the struct vmci_event_ctx is not fully
    initialized when executing vmci_datagram_dispatch() to send events to all
    vm contexts. This affects the datagram taken from the datagram queue of
    its context by another task, because the datagram payload is not initialized
    according to the size payload_size, which causes the kernel data to leak
    to the user space.
    
    Before dispatching the datagram, and before setting the payload content,
    explicitly set the payload content to 0 to avoid data leakage caused by
    incomplete payload initialization.
    
    Fixes: 28d6692cd8fb ("VMCI: context implementation.")
    Reported-by: syzbot+9b9124ae9b12d5af5d95@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=9b9124ae9b12d5af5d95
    Tested-by: syzbot+9b9124ae9b12d5af5d95@syzkaller.appspotmail.com
    Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
    Link: https://lore.kernel.org/r/20250627055214.2967129-1-lizhi.xu@windriver.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vrf: Drop existing dst reference in vrf_ip6_input_dst [+ + +]
Author: Stanislav Fomichev <sdf@fomichev.me>
Date:   Fri Jul 25 09:00:43 2025 -0700

    vrf: Drop existing dst reference in vrf_ip6_input_dst
    
    [ Upstream commit f388f807eca1de9e6e70f9ffb1a573c3811c4215 ]
    
    Commit ff3fbcdd4724 ("selftests: tc: Add generic erspan_opts matching support
    for tc-flower") started triggering the following kmemleak warning:
    
    unreferenced object 0xffff888015fb0e00 (size 512):
      comm "softirq", pid 0, jiffies 4294679065
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 40 d2 85 9e ff ff ff ff  ........@.......
        41 69 59 9d ff ff ff ff 00 00 00 00 00 00 00 00  AiY.............
      backtrace (crc 30b71e8b):
        __kmalloc_noprof+0x359/0x460
        metadata_dst_alloc+0x28/0x490
        erspan_rcv+0x4f1/0x1160 [ip_gre]
        gre_rcv+0x217/0x240 [ip_gre]
        gre_rcv+0x1b8/0x400 [gre]
        ip_protocol_deliver_rcu+0x31d/0x3a0
        ip_local_deliver_finish+0x37d/0x620
        ip_local_deliver+0x174/0x460
        ip_rcv+0x52b/0x6b0
        __netif_receive_skb_one_core+0x149/0x1a0
        process_backlog+0x3c8/0x1390
        __napi_poll.constprop.0+0xa1/0x390
        net_rx_action+0x59b/0xe00
        handle_softirqs+0x22b/0x630
        do_softirq+0xb1/0xf0
        __local_bh_enable_ip+0x115/0x150
    
    vrf_ip6_input_dst unconditionally sets skb dst entry, add a call to
    skb_dst_drop to drop any existing entry.
    
    Cc: David Ahern <dsahern@kernel.org>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Fixes: 9ff74384600a ("net: vrf: Handle ipv6 multicast and link-local addresses")
    Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20250725160043.350725-1-sdf@fomichev.me
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vsock: Do not allow binding to VMADDR_PORT_ANY [+ + +]
Author: Budimir Markovic <markovicbudimir@gmail.com>
Date:   Thu Aug 7 04:18:11 2025 +0000

    vsock: Do not allow binding to VMADDR_PORT_ANY
    
    commit aba0c94f61ec05315fa7815d21aefa4c87f6a9f4 upstream.
    
    It is possible for a vsock to autobind to VMADDR_PORT_ANY. This can
    cause a use-after-free when a connection is made to the bound socket.
    The socket returned by accept() also has port VMADDR_PORT_ANY but is not
    on the list of unbound sockets. Binding it will result in an extra
    refcount decrement similar to the one fixed in fcdd2242c023 (vsock: Keep
    the binding until socket destruction).
    
    Modify the check in __vsock_bind_connectible() to also prevent binding
    to VMADDR_PORT_ANY.
    
    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
    Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Link: https://patch.msgid.link/20250807041811.678-1-markovicbudimir@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vt: defkeymap: Map keycodes above 127 to K_HOLE [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Wed Jul 2 21:17:58 2025 +0700

    vt: defkeymap: Map keycodes above 127 to K_HOLE
    
    commit b43cb4ff85da5cf29c4cd351ef1d7dd8210780f7 upstream.
    
    The maximum number of keycodes got bumped to 256 a very long time ago,
    but the default keymaps were never adjusted to match. This is causing
    the kernel to interpret keycodes above 127 as U+0000 if the shipped
    generated keymap is used.
    
    Fix this by mapping all keycodes above 127 to K_HOLE so the kernel
    ignores them.
    
    The contents of this patche were generated by rerunning `loadkeys
    --mktable --unicode` and only including the changes to map keycodes
    above 127 to K_HOLE.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20250702-vt-misc-unicode-fixes-v1-2-c27e143cc2eb@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vt: keyboard: Don't process Unicode characters in K_OFF mode [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Wed Jul 2 21:17:57 2025 +0700

    vt: keyboard: Don't process Unicode characters in K_OFF mode
    
    commit b1cc2092ea7a52e2c435aee6d2b1bcb773202663 upstream.
    
    We don't process Unicode characters if the virtual terminal is in raw
    mode, so there's no reason why we shouldn't do the same for K_OFF
    (especially since people would expect K_OFF to actually turn off all VT
    key processing).
    
    Fixes: 9fc3de9c8356 ("vt: Add virtual console keyboard mode OFF")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20250702-vt-misc-unicode-fixes-v1-1-c27e143cc2eb@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
watchdog: dw_wdt: Fix default timeout [+ + +]
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
Date:   Thu Jul 17 18:55:02 2025 +0200

    watchdog: dw_wdt: Fix default timeout
    
    [ Upstream commit ac3dbb91e0167d017f44701dd51c1efe30d0c256 ]
    
    The Synopsys Watchdog driver sets the default timeout to 30 seconds,
    but on some devices this is not a valid timeout. E.g. on RK3588 the
    actual timeout being used is 44 seconds instead.
    
    Once the watchdog is started the value is updated accordingly, but
    it would be better to expose a sensible timeout to userspace without
    the need to first start the watchdog.
    
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20250717-dw-wdt-fix-initial-timeout-v1-1-86dc864d48dd@kernel.org
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

watchdog: ziirave_wdt: check record length in ziirave_firm_verify() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed May 28 23:22:19 2025 +0300

    watchdog: ziirave_wdt: check record length in ziirave_firm_verify()
    
    [ Upstream commit 8b61d8ca751bc15875b50e0ff6ac3ba0cf95a529 ]
    
    The "rec->len" value comes from the firmware.  We generally do
    trust firmware, but it's always better to double check.  If
    the length value is too large it would lead to memory corruption
    when we set "data[i] = ret;"
    
    Fixes: 217209db0204 ("watchdog: ziirave_wdt: Add support to upload the firmware.")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/3b58b453f0faa8b968c90523f52c11908b56c346.1748463049.git.dan.carpenter@linaro.org
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: ath11k: clear initialized flag for deinit-ed srng lists [+ + +]
Author: Sergey Senozhatsky <senozhatsky@chromium.org>
Date:   Thu Jun 12 17:45:06 2025 +0900

    wifi: ath11k: clear initialized flag for deinit-ed srng lists
    
    [ Upstream commit a5b46aa7cf5f05c213316a018e49a8e086efd98e ]
    
    In a number of cases we see kernel panics on resume due
    to ath11k kernel page fault, which happens under the
    following circumstances:
    
    1) First ath11k_hal_dump_srng_stats() call
    
     Last interrupt received for each group:
     ath11k_pci 0000:01:00.0: group_id 0 22511ms before
     ath11k_pci 0000:01:00.0: group_id 1 14440788ms before
     [..]
     ath11k_pci 0000:01:00.0: failed to receive control response completion, polling..
     ath11k_pci 0000:01:00.0: Service connect timeout
     ath11k_pci 0000:01:00.0: failed to connect to HTT: -110
     ath11k_pci 0000:01:00.0: failed to start core: -110
     ath11k_pci 0000:01:00.0: firmware crashed: MHI_CB_EE_RDDM
     ath11k_pci 0000:01:00.0: already resetting count 2
     ath11k_pci 0000:01:00.0: failed to wait wlan mode request (mode 4): -110
     ath11k_pci 0000:01:00.0: qmi failed to send wlan mode off: -110
     ath11k_pci 0000:01:00.0: failed to reconfigure driver on crash recovery
     [..]
    
    2) At this point reconfiguration fails (we have 2 resets) and
      ath11k_core_reconfigure_on_crash() calls ath11k_hal_srng_deinit()
      which destroys srng lists.  However, it does not reset per-list
      ->initialized flag.
    
    3) Second ath11k_hal_dump_srng_stats() call sees stale ->initialized
      flag and attempts to dump srng stats:
    
     Last interrupt received for each group:
     ath11k_pci 0000:01:00.0: group_id 0 66785ms before
     ath11k_pci 0000:01:00.0: group_id 1 14485062ms before
     ath11k_pci 0000:01:00.0: group_id 2 14485062ms before
     ath11k_pci 0000:01:00.0: group_id 3 14485062ms before
     ath11k_pci 0000:01:00.0: group_id 4 14780845ms before
     ath11k_pci 0000:01:00.0: group_id 5 14780845ms before
     ath11k_pci 0000:01:00.0: group_id 6 14485062ms before
     ath11k_pci 0000:01:00.0: group_id 7 66814ms before
     ath11k_pci 0000:01:00.0: group_id 8 68997ms before
     ath11k_pci 0000:01:00.0: group_id 9 67588ms before
     ath11k_pci 0000:01:00.0: group_id 10 69511ms before
     BUG: unable to handle page fault for address: ffffa007404eb010
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 100000067 P4D 100000067 PUD 10022d067 PMD 100b01067 PTE 0
     Oops: 0000 [#1] PREEMPT SMP NOPTI
     RIP: 0010:ath11k_hal_dump_srng_stats+0x2b4/0x3b0 [ath11k]
     Call Trace:
     <TASK>
     ? __die_body+0xae/0xb0
     ? page_fault_oops+0x381/0x3e0
     ? exc_page_fault+0x69/0xa0
     ? asm_exc_page_fault+0x22/0x30
     ? ath11k_hal_dump_srng_stats+0x2b4/0x3b0 [ath11k (HASH:6cea 4)]
     ath11k_qmi_driver_event_work+0xbd/0x1050 [ath11k (HASH:6cea 4)]
     worker_thread+0x389/0x930
     kthread+0x149/0x170
    
    Clear per-list ->initialized flag in ath11k_hal_srng_deinit().
    
    Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com>
    Fixes: 5118935b1bc2 ("ath11k: dump SRNG stats during FW assert")
    Link: https://patch.msgid.link/20250612084551.702803-1-senozhatsky@chromium.org
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: ath11k: fix dest ring-buffer corruption when ring is full [+ + +]
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Fri Aug 22 15:53:30 2025 -0400

    wifi: ath11k: fix dest ring-buffer corruption when ring is full
    
    [ Upstream commit aa6956150f820e6a6deba44be325ddfcb5b10f88 ]
    
    Add the missing memory barriers to make sure that destination ring
    descriptors are read before updating the tail pointer (and passing
    ownership to the device) to avoid memory corruption on weakly ordered
    architectures like aarch64 when the ring is full.
    
    Tested-on: WCN6855 hw2.1 WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.41
    
    Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
    Cc: stable@vger.kernel.org      # 5.6
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com>
    Link: https://patch.msgid.link/20250604143457.26032-6-johan+linaro@kernel.org
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: ath11k: fix source ring-buffer corruption [+ + +]
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Jun 4 16:34:56 2025 +0200

    wifi: ath11k: fix source ring-buffer corruption
    
    commit 6efa0df54022c6c9fd4d294b87622c7fcdc418c8 upstream.
    
    Add the missing memory barrier to make sure that LMAC source ring
    descriptors are written before updating the head pointer to avoid
    passing stale data to the firmware on weakly ordered architectures like
    aarch64.
    
    Note that non-LMAC rings use MMIO write accessors which have the
    required write memory barrier.
    
    Tested-on: WCN6855 hw2.1 WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.41
    
    Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
    Cc: stable@vger.kernel.org      # 5.6
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com>
    Link: https://patch.msgid.link/20250604143457.26032-5-johan+linaro@kernel.org
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: brcmfmac: fix P2P discovery failure in P2P peer due to missing P2P IE [+ + +]
Author: Gokul Sivakumar <gokulkumar.sivakumar@infineon.com>
Date:   Thu Jun 26 10:37:02 2025 +0530

    wifi: brcmfmac: fix P2P discovery failure in P2P peer due to missing P2P IE
    
    [ Upstream commit 579bf8037b70b644a674c126a32bbb2212cf5c21 ]
    
    After commit bd99a3013bdc ("brcmfmac: move configuration of probe request
    IEs"), the probe request MGMT IE addition operation brcmf_vif_set_mgmt_ie()
    got moved from the brcmf_p2p_scan_prep() to the brcmf_cfg80211_scan().
    
    Because of this, as part of the scan request handler for the P2P Discovery,
    vif struct used for adding the Probe Request P2P IE in firmware got changed
    from the P2PAPI_BSSCFG_DEVICE vif to P2PAPI_BSSCFG_PRIMARY vif incorrectly.
    So the firmware stopped adding P2P IE to the outgoing P2P Discovery probe
    requests frames and the other P2P peers were unable to discover this device
    causing a regression on the P2P feature.
    
    To fix this, while setting the P2P IE in firmware, properly use the vif of
    the P2P discovery wdev on which the driver received the P2P scan request.
    This is done by not changing the vif pointer, until brcmf_vif_set_mgmt_ie()
    is completed.
    
    Fixes: bd99a3013bdc ("brcmfmac: move configuration of probe request IEs")
    Signed-off-by: Gokul Sivakumar <gokulkumar.sivakumar@infineon.com>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Link: https://patch.msgid.link/20250626050706.7271-1-gokulkumar.sivakumar@infineon.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: brcmsmac: Remove const from tbl_ptr parameter in wlc_lcnphy_common_read_table() [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Jul 15 19:45:23 2025 -0700

    wifi: brcmsmac: Remove const from tbl_ptr parameter in wlc_lcnphy_common_read_table()
    
    commit 81284e86bf8849f8e98e8ead3ff5811926b2107f upstream.
    
    A new warning in clang [1] complains that diq_start in
    wlc_lcnphy_tx_iqlo_cal() is passed uninitialized as a const pointer to
    wlc_lcnphy_common_read_table():
    
      drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:2728:13: error: variable 'diq_start' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
       2728 |                                                      &diq_start, 1, 16, 69);
            |                                                       ^~~~~~~~~
    
    The table pointer passed to wlc_lcnphy_common_read_table() should not be
    considered constant, as wlc_phy_read_table() is ultimately going to
    update it. Remove the const qualifier from the tbl_ptr to clear up the
    warning.
    
    Cc: stable@vger.kernel.org
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2108
    Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
    Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>>
    Link: https://patch.msgid.link/20250715-brcmsmac-fix-uninit-const-pointer-v1-1-16e6a51a8ef4@kernel.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: cfg80211: Fix interface type validation [+ + +]
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Wed Jul 9 23:37:55 2025 +0300

    wifi: cfg80211: Fix interface type validation
    
    [ Upstream commit 14450be2332a49445106403492a367412b8c23f4 ]
    
    Fix a condition that verified valid values of interface types.
    
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20250709233537.7ad199ca5939.I0ac1ff74798bf59a87a57f2e18f2153c308b119b@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: cfg80211: reject HTC bit for management frames [+ + +]
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Jul 18 20:23:06 2025 +0200

    wifi: cfg80211: reject HTC bit for management frames
    
    [ Upstream commit be06a8c7313943109fa870715356503c4c709cbc ]
    
    Management frames sent by userspace should never have the
    order/HTC bit set, reject that. It could also cause some
    confusion with the length of the buffer and the header so
    the validation might end up wrong.
    
    Link: https://patch.msgid.link/20250718202307.97a0455f0f35.I1805355c7e331352df16611839bc8198c855a33f@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlegacy: Check rate_idx range after addition [+ + +]
Author: Stanislaw Gruszka <stf_xl@wp.pl>
Date:   Sun May 25 16:45:24 2025 +0200

    wifi: iwlegacy: Check rate_idx range after addition
    
    [ Upstream commit 0de19d5ae0b2c5b18b88c5c7f0442f707a207409 ]
    
    Limit rate_idx to IL_LAST_OFDM_RATE for 5GHz band for thinkable case
    the index is incorrect.
    
    Reported-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Reported-by: Alexei Safin <a.safin@rosa.ru>
    Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
    Reviewed-by: Fedor Pchelkin <pchelkin@ispras.ru>
    Link: https://patch.msgid.link/20250525144524.GA172583@wp.pl
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: dvm: fix potential overflow in rs_fill_link_cmd() [+ + +]
Author: Rand Deeb <rand.sec96@gmail.com>
Date:   Wed Mar 13 13:17:55 2024 +0300

    wifi: iwlwifi: dvm: fix potential overflow in rs_fill_link_cmd()
    
    [ Upstream commit e3ad987e9dc7d1e12e3f2f1e623f0e174cd0ca78 ]
    
    The 'index' variable in the rs_fill_link_cmd() function can reach
    LINK_QUAL_MAX_RETRY_NUM during the execution of the inner loop. This
    variable is used as an index for the lq_cmd->rs_table array, which has a
    size of LINK_QUAL_MAX_RETRY_NUM, without proper validation.
    
    Modify the condition of the inner loop to ensure that the 'index' variable
    does not exceed LINK_QUAL_MAX_RETRY_NUM - 1, thereby preventing any
    potential overflow issues.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
    Link: https://patch.msgid.link/20240313101755.269209-1-rand.sec96@gmail.com
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: Fix memory leak in iwl_mvm_init() [+ + +]
Author: Xiu Jianfeng <xiujianfeng@huawei.com>
Date:   Wed Nov 9 11:52:13 2022 +0800

    wifi: iwlwifi: Fix memory leak in iwl_mvm_init()
    
    [ Upstream commit ed2e916c890944633d6826dce267579334f63ea5 ]
    
    When iwl_opmode_register() fails, it does not unregster rate control,
    which will cause a memory leak issue, this patch fixes it.
    
    Fixes: 9f66a397c877 ("iwlwifi: mvm: rs: add ops for the new rate scaling in the FW")
    Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
    Link: https://patch.msgid.link/20221109035213.570-1-xiujianfeng@huawei.com
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: fw: Fix possible memory leak in iwl_fw_dbg_collect [+ + +]
Author: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Date:   Wed Jun 11 22:26:23 2025 +0300

    wifi: iwlwifi: fw: Fix possible memory leak in iwl_fw_dbg_collect
    
    [ Upstream commit cc8d9cbf269dab363c768bfa9312265bc807fca5 ]
    
    Ensure descriptor is freed on error to avoid memory leak.
    
    Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20250611222325.8158d15ec866.Ifa3e422c302397111f20a16da7509e6574bc19e3@changeid
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: mvm: fix scan request validation [+ + +]
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Wed Jul 9 23:05:43 2025 +0300

    wifi: iwlwifi: mvm: fix scan request validation
    
    [ Upstream commit 7c2f3ec7707188d8d5269ae2dce97d7be3e9f261 ]
    
    The scan request validation function uses bitwise and instead
    of logical and. Fix it.
    
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Reviewed-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20250709230308.3fbc1f27871b.I7a8ee91f463c1a2d9d8561c8232e196885d02c43@changeid
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: Check 802.11 encaps offloading in ieee80211_tx_h_select_key() [+ + +]
Author: Remi Pommarel <repk@triplefau.lt>
Date:   Thu Jul 17 17:45:28 2025 +0200

    wifi: mac80211: Check 802.11 encaps offloading in ieee80211_tx_h_select_key()
    
    [ Upstream commit 4037c468d1b3c508d69e6df0ef47fdee3d440e39 ]
    
    With 802.11 encapsulation offloading, ieee80211_tx_h_select_key() is
    called on 802.3 frames. In that case do not try to use skb data as
    valid 802.11 headers.
    
    Reported-by: Bert Karwatzki <spasswolf@web.de>
    Closes: https://lore.kernel.org/linux-wireless/20250410215527.3001-1-spasswolf@web.de
    Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue")
    Signed-off-by: Remi Pommarel <repk@triplefau.lt>
    Link: https://patch.msgid.link/1af4b5b903a5fca5ebe67333d5854f93b2be5abe.1752765971.git.repk@triplefau.lt
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtl818x: Kill URBs before clearing tx status queue [+ + +]
Author: Daniil Dulov <d.dulov@aladdin.ru>
Date:   Tue Jun 17 16:56:34 2025 +0300

    wifi: rtl818x: Kill URBs before clearing tx status queue
    
    [ Upstream commit 16d8fd74dbfca0ea58645cd2fca13be10cae3cdd ]
    
    In rtl8187_stop() move the call of usb_kill_anchored_urbs() before clearing
    b_tx_status.queue. This change prevents callbacks from using already freed
    skb due to anchor was not killed before freeing such skb.
    
     BUG: kernel NULL pointer dereference, address: 0000000000000080
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 0 P4D 0
     Oops: Oops: 0000 [#1] SMP NOPTI
     CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Not tainted 6.15.0 #8 PREEMPT(voluntary)
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
     RIP: 0010:ieee80211_tx_status_irqsafe+0x21/0xc0 [mac80211]
     Call Trace:
      <IRQ>
      rtl8187_tx_cb+0x116/0x150 [rtl8187]
      __usb_hcd_giveback_urb+0x9d/0x120
      usb_giveback_urb_bh+0xbb/0x140
      process_one_work+0x19b/0x3c0
      bh_worker+0x1a7/0x210
      tasklet_action+0x10/0x30
      handle_softirqs+0xf0/0x340
      __irq_exit_rcu+0xcd/0xf0
      common_interrupt+0x85/0xa0
      </IRQ>
    
    Tested on RTL8187BvE device.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: c1db52b9d27e ("rtl8187: Use usb anchor facilities to manage urbs")
    Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
    Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250617135634.21760-1-d.dulov@aladdin.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtl8xxxu: Fix RX skb size for aggregation disabled [+ + +]
Author: Martin Kaistra <martin.kaistra@linutronix.de>
Date:   Wed Jul 9 14:15:22 2025 +0200

    wifi: rtl8xxxu: Fix RX skb size for aggregation disabled
    
    [ Upstream commit d76a1abcf57734d2bcd4a7ec051617edd4513d7f ]
    
    Commit 1e5b3b3fe9e0 ("rtl8xxxu: Adjust RX skb size to include space for
    phystats") increased the skb size when aggregation is enabled but decreased
    it for the aggregation disabled case.
    
    As a result, if a frame near the maximum size is received,
    rtl8xxxu_rx_complete() is called with status -EOVERFLOW and then the
    driver starts to malfunction and no further communication is possible.
    
    Restore the skb size in the aggregation disabled case.
    
    Fixes: 1e5b3b3fe9e0 ("rtl8xxxu: Adjust RX skb size to include space for phystats")
    Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
    Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250709121522.1992366-1-martin.kaistra@linutronix.de
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtlwifi: fix possible skb memory leak in _rtl_pci_init_one_rxdesc() [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Fri Jun 13 09:38:36 2025 +0200

    wifi: rtlwifi: fix possible skb memory leak in _rtl_pci_init_one_rxdesc()
    
    [ Upstream commit 76b3e5078d76f0eeadb7aacf9845399f8473da0d ]
    
    When `dma_mapping_error()` is true, if a new `skb` has been allocated,
    then it must be de-allocated.
    
    Compile tested only
    
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250613074014.69856-2-fourier.thomas@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtlwifi: fix possible skb memory leak in `_rtl_pci_rx_interrupt()`. [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Mon Jun 16 12:56:30 2025 +0200

    wifi: rtlwifi: fix possible skb memory leak in `_rtl_pci_rx_interrupt()`.
    
    [ Upstream commit 44c0e191004f0e3aa1bdee3be248be14dbe5b020 ]
    
    The function `_rtl_pci_init_one_rxdesc()` can fail even when the new
    `skb` is passed because of a DMA mapping error.  If it fails, the `skb`
    is not saved in the rx ringbuffer and thus lost.
    
    Compile tested only
    
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Acked-by: Ping-Ke Shih <pkshih@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20250616105631.444309-4-fourier.thomas@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/bugs: Avoid warning when overriding return thunk [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Jun 11 10:29:31 2025 -0700

    x86/bugs: Avoid warning when overriding return thunk
    
    [ Upstream commit 9f85fdb9fc5a1bd308a10a0a7d7e34f2712ba58b ]
    
    The purpose of the warning is to prevent an unexpected change to the return
    thunk mitigation. However, there are legitimate cases where the return
    thunk is intentionally set more than once. For example, ITS and SRSO both
    can set the return thunk after retbleed has set it. In both the cases
    retbleed is still mitigated.
    
    Replace the warning with an info about the active return thunk.
    
    Suggested-by: Borislav Petkov <bp@alien8.de>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/20250611-eibrs-fix-v4-3-5ff86cac6c61@linux.intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() [+ + +]
Author: Michael Zhivich <mzhivich@akamai.com>
Date:   Wed Jul 23 09:40:19 2025 -0400

    x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode()
    
    For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved
    field in zen_patch_rev union on the stack may be garbage.  If so, it will
    prevent correct microcode check when consulting p.ucode_rev, resulting in
    incorrect mitigation selection.
    
    This is a stable-only fix.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Michael Zhivich <mzhivich@akamai.com>
    Fixes: 78192f511f40 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/fpu: Delay instruction pointer fixup until after warning [+ + +]
Author: Dave Hansen <dave.hansen@linux.intel.com>
Date:   Wed Aug 13 12:24:25 2025 -0400

    x86/fpu: Delay instruction pointer fixup until after warning
    
    [ Upstream commit 1cec9ac2d071cfd2da562241aab0ef701355762a ]
    
    Right now, if XRSTOR fails a console message like this is be printed:
    
            Bad FPU state detected at restore_fpregs_from_fpstate+0x9a/0x170, reinitializing FPU registers.
    
    However, the text location (...+0x9a in this case) is the instruction
    *AFTER* the XRSTOR. The highlighted instruction in the "Code:" dump
    also points one instruction late.
    
    The reason is that the "fixup" moves RIP up to pass the bad XRSTOR and
    keep on running after returning from the #GP handler. But it does this
    fixup before warning.
    
    The resulting warning output is nonsensical because it looks like the
    non-FPU-related instruction is #GP'ing.
    
    Do not fix up RIP until after printing the warning. Do this by using
    the more generic and standard ex_handler_default().
    
    Fixes: d5c8028b4788 ("x86/fpu: Reinitialize FPU registers if restoring FPU state fails")
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Chao Gao <chao.gao@intel.com>
    Acked-by: Alison Schofield <alison.schofield@intel.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20250624210148.97126F9E%40davehans-spike.ostc.intel.com
    [ Adapted ex_handler_default() call ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/mce/amd: Add default names for MCA banks and blocks [+ + +]
Author: Yazen Ghannam <yazen.ghannam@amd.com>
Date:   Wed Jul 23 00:04:37 2025 -0400

    x86/mce/amd: Add default names for MCA banks and blocks
    
    [ Upstream commit d66e1e90b16055d2f0ee76e5384e3f119c3c2773 ]
    
    Ensure that sysfs init doesn't fail for new/unrecognized bank types or if
    a bank has additional blocks available.
    
    Most MCA banks have a single thresholding block, so the block takes the same
    name as the bank.
    
    Unified Memory Controllers (UMCs) are a special case where there are two
    blocks and each has a unique name.
    
    However, the microarchitecture allows for five blocks. Any new MCA bank types
    with more than one block will be missing names for the extra blocks. The MCE
    sysfs will fail to initialize in this case.
    
    Fixes: 87a6d4091bd7 ("x86/mce/AMD: Update sysfs bank names for SMCA systems")
    Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/20250624-wip-mca-updates-v4-3-236dd74f645f@amd.com
    [ adapted get_name() function signature ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
XArray: Add calls to might_alloc() [+ + +]
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Wed Jul 6 14:51:00 2022 -0400

    XArray: Add calls to might_alloc()
    
    [ Upstream commit 1dd685c414a7b9fdb3d23aca3aedae84f0b998ae ]
    
    Catch bogus GFP flags deterministically, instead of occasionally
    when we actually have to allocate memory.
    
    Reported-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Stable-dep-of: 99765233ab42 ("NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xen/gntdev: remove struct gntdev_copy_batch from stack [+ + +]
Author: Juergen Gross <jgross@suse.com>
Date:   Thu Jul 3 09:32:59 2025 +0200

    xen/gntdev: remove struct gntdev_copy_batch from stack
    
    [ Upstream commit 70045cf6593cbf0740956ea9b7b4269142c6ee38 ]
    
    When compiling the kernel with LLVM, the following warning was issued:
    
      drivers/xen/gntdev.c:991: warning: stack frame size (1160) exceeds
      limit (1024) in function 'gntdev_ioctl'
    
    The main reason is struct gntdev_copy_batch which is located on the
    stack and has a size of nearly 1kb.
    
    For performance reasons it shouldn't by just dynamically allocated
    instead, so allocate a new instance when needed and instead of freeing
    it put it into a list of free structs anchored in struct gntdev_priv.
    
    Fixes: a4cdb556cae0 ("xen/gntdev: add ioctl for grant copy")
    Reported-by: Abinash Singh <abinashsinghlalotra@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Message-ID: <20250703073259.17356-1-jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xen/netfront: Fix TX response spurious interrupts [+ + +]
Author: Anthoine Bourgeois <anthoine.bourgeois@vates.tech>
Date:   Mon Jul 21 09:34:54 2025 +0000

    xen/netfront: Fix TX response spurious interrupts
    
    [ Upstream commit 114a2de6fa86d99ed9546cc9113a3cad58beef79 ]
    
    We found at Vates that there are lot of spurious interrupts when
    benchmarking the xen-net PV driver frontend. This issue appeared with a
    patch that addresses security issue XSA-391 (b27d47950e48 "xen/netfront:
    harden netfront against event channel storms"). On an iperf benchmark,
    spurious interrupts can represent up to 50% of the interrupts.
    
    Spurious interrupts are interrupts that are rised for nothing, there is
    no work to do. This appends because the function that handles the
    interrupts ("xennet_tx_buf_gc") is also called at the end of the request
    path to garbage collect the responses received during the transmission
    load.
    
    The request path is doing the work that the interrupt handler should
    have done otherwise. This is particurary true when there is more than
    one vcpu and get worse linearly with the number of vcpu/queue.
    
    Moreover, this problem is amplifyed by the penalty imposed by a spurious
    interrupt. When an interrupt is found spurious the interrupt chip will
    delay the EOI to slowdown the backend. This delay will allow more
    responses to be handled by the request path and then there will be more
    chance the next interrupt will not find any work to do, creating a new
    spurious interrupt.
    
    This causes performance issue. The solution here is to remove the calls
    from the request path and let the interrupt handler do the processing of
    the responses. This approch removes most of the spurious interrupts
    (<0.05%) and also has the benefit of freeing up cycles in the request
    path, allowing it to process more work, which improves performance
    compared to masking the spurious interrupt one way or another.
    
    This optimization changes a part of the code that is present since the
    net frontend driver was upstreamed. There is no similar pattern in the
    other xen PV drivers. Since the first commit of xen-netfront is a blob
    that doesn't explain all the design choices I can only guess why this
    specific mecanism was here. This could have been introduce to compensate
    a slow backend at the time (maybe the backend was fixed or optimize
    later) or a small queue. In 18 years, both frontend and backend gain lot
    of features and optimizations that could have obsolete the feature of
    reaping completions from the TX path.
    
    Some vif throughput performance figures from a 8 vCPUs, 4GB of RAM HVM
    guest(s):
    
    Without this patch on the :
    vm -> dom0: 4.5Gb/s
    vm -> vm:   7.0Gb/s
    
    Without XSA-391 patch (revert of b27d47950e48):
    vm -> dom0: 8.3Gb/s
    vm -> vm:   8.7Gb/s
    
    With XSA-391 and this patch:
    vm -> dom0: 11.5Gb/s
    vm -> vm:   12.6Gb/s
    
    v2:
    - add revewed and tested by tags
    - resend with the maintainers in the recipients list
    
    v3:
    - remove Fixes tag but keep the commit ref in the explanation
    - add a paragraph on why this code was here
    
    Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@vates.tech>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Message-ID: <20250721093316.23560-1-anthoine.bourgeois@vates.tech>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS [+ + +]
Author: Hongyu Xie <xiehongyu1@kylinos.cn>
Date:   Fri Jun 27 17:41:20 2025 +0300

    xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS
    
    commit cd65ee81240e8bc3c3119b46db7f60c80864b90b upstream.
    
    Disable stream for platform xHC controller with broken stream.
    
    Fixes: 14aec589327a6 ("storage: accept some UAS devices if streams are unavailable")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Hongyu Xie <xiehongyu1@kylinos.cn>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20250627144127.3889714-3-mathias.nyman@linux.intel.com
    [ removed xhci_get_usb3_hcd() call ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
zynq_fpga: use sgtable-based scatterlist wrappers [+ + +]
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Jun 16 14:09:32 2025 +0200

    zynq_fpga: use sgtable-based scatterlist wrappers
    
    commit 37e00703228ab44d0aacc32a97809a4f6f58df1b upstream.
    
    Use common wrappers operating directly on the struct sg_table objects to
    fix incorrect use of statterlists related calls. dma_unmap_sg() function
    has to be called with the number of elements originally passed to the
    dma_map_sg() function, not the one returned in sgtable's nents.
    
    CC: stable@vger.kernel.org
    Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Xu Yilun <yilun.xu@intel.com>
    Link: https://lore.kernel.org/r/20250616120932.1090614-1-m.szyprowski@samsung.com
    Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>